app.js 1.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896
  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. /******/ // identity function for calling harmony imports with the correct context
  37. /******/ __webpack_require__.i = function(value) { return value; };
  38. /******/
  39. /******/ // define getter function for harmony exports
  40. /******/ __webpack_require__.d = function(exports, name, getter) {
  41. /******/ if(!__webpack_require__.o(exports, name)) {
  42. /******/ Object.defineProperty(exports, name, {
  43. /******/ configurable: false,
  44. /******/ enumerable: true,
  45. /******/ get: getter
  46. /******/ });
  47. /******/ }
  48. /******/ };
  49. /******/
  50. /******/ // getDefaultExport function for compatibility with non-harmony modules
  51. /******/ __webpack_require__.n = function(module) {
  52. /******/ var getter = module && module.__esModule ?
  53. /******/ function getDefault() { return module['default']; } :
  54. /******/ function getModuleExports() { return module; };
  55. /******/ __webpack_require__.d(getter, 'a', getter);
  56. /******/ return getter;
  57. /******/ };
  58. /******/
  59. /******/ // Object.prototype.hasOwnProperty.call
  60. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  61. /******/
  62. /******/ // __webpack_public_path__
  63. /******/ __webpack_require__.p = "./";
  64. /******/
  65. /******/ // Load entry module and return exports
  66. /******/ return __webpack_require__(__webpack_require__.s = 39);
  67. /******/ })
  68. /************************************************************************/
  69. /******/ ([
  70. /* 0 */
  71. /***/ (function(module, exports, __webpack_require__) {
  72. "use strict";
  73. var bind = __webpack_require__(7);
  74. /*global toString:true*/
  75. // utils is a library of generic helper functions non-specific to axios
  76. var toString = Object.prototype.toString;
  77. /**
  78. * Determine if a value is an Array
  79. *
  80. * @param {Object} val The value to test
  81. * @returns {boolean} True if value is an Array, otherwise false
  82. */
  83. function isArray(val) {
  84. return toString.call(val) === '[object Array]';
  85. }
  86. /**
  87. * Determine if a value is an ArrayBuffer
  88. *
  89. * @param {Object} val The value to test
  90. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  91. */
  92. function isArrayBuffer(val) {
  93. return toString.call(val) === '[object ArrayBuffer]';
  94. }
  95. /**
  96. * Determine if a value is a FormData
  97. *
  98. * @param {Object} val The value to test
  99. * @returns {boolean} True if value is an FormData, otherwise false
  100. */
  101. function isFormData(val) {
  102. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  103. }
  104. /**
  105. * Determine if a value is a view on an ArrayBuffer
  106. *
  107. * @param {Object} val The value to test
  108. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  109. */
  110. function isArrayBufferView(val) {
  111. var result;
  112. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  113. result = ArrayBuffer.isView(val);
  114. } else {
  115. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  116. }
  117. return result;
  118. }
  119. /**
  120. * Determine if a value is a String
  121. *
  122. * @param {Object} val The value to test
  123. * @returns {boolean} True if value is a String, otherwise false
  124. */
  125. function isString(val) {
  126. return typeof val === 'string';
  127. }
  128. /**
  129. * Determine if a value is a Number
  130. *
  131. * @param {Object} val The value to test
  132. * @returns {boolean} True if value is a Number, otherwise false
  133. */
  134. function isNumber(val) {
  135. return typeof val === 'number';
  136. }
  137. /**
  138. * Determine if a value is undefined
  139. *
  140. * @param {Object} val The value to test
  141. * @returns {boolean} True if the value is undefined, otherwise false
  142. */
  143. function isUndefined(val) {
  144. return typeof val === 'undefined';
  145. }
  146. /**
  147. * Determine if a value is an Object
  148. *
  149. * @param {Object} val The value to test
  150. * @returns {boolean} True if value is an Object, otherwise false
  151. */
  152. function isObject(val) {
  153. return val !== null && typeof val === 'object';
  154. }
  155. /**
  156. * Determine if a value is a Date
  157. *
  158. * @param {Object} val The value to test
  159. * @returns {boolean} True if value is a Date, otherwise false
  160. */
  161. function isDate(val) {
  162. return toString.call(val) === '[object Date]';
  163. }
  164. /**
  165. * Determine if a value is a File
  166. *
  167. * @param {Object} val The value to test
  168. * @returns {boolean} True if value is a File, otherwise false
  169. */
  170. function isFile(val) {
  171. return toString.call(val) === '[object File]';
  172. }
  173. /**
  174. * Determine if a value is a Blob
  175. *
  176. * @param {Object} val The value to test
  177. * @returns {boolean} True if value is a Blob, otherwise false
  178. */
  179. function isBlob(val) {
  180. return toString.call(val) === '[object Blob]';
  181. }
  182. /**
  183. * Determine if a value is a Function
  184. *
  185. * @param {Object} val The value to test
  186. * @returns {boolean} True if value is a Function, otherwise false
  187. */
  188. function isFunction(val) {
  189. return toString.call(val) === '[object Function]';
  190. }
  191. /**
  192. * Determine if a value is a Stream
  193. *
  194. * @param {Object} val The value to test
  195. * @returns {boolean} True if value is a Stream, otherwise false
  196. */
  197. function isStream(val) {
  198. return isObject(val) && isFunction(val.pipe);
  199. }
  200. /**
  201. * Determine if a value is a URLSearchParams object
  202. *
  203. * @param {Object} val The value to test
  204. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  205. */
  206. function isURLSearchParams(val) {
  207. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  208. }
  209. /**
  210. * Trim excess whitespace off the beginning and end of a string
  211. *
  212. * @param {String} str The String to trim
  213. * @returns {String} The String freed of excess whitespace
  214. */
  215. function trim(str) {
  216. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  217. }
  218. /**
  219. * Determine if we're running in a standard browser environment
  220. *
  221. * This allows axios to run in a web worker, and react-native.
  222. * Both environments support XMLHttpRequest, but not fully standard globals.
  223. *
  224. * web workers:
  225. * typeof window -> undefined
  226. * typeof document -> undefined
  227. *
  228. * react-native:
  229. * typeof document.createElement -> undefined
  230. */
  231. function isStandardBrowserEnv() {
  232. return (
  233. typeof window !== 'undefined' &&
  234. typeof document !== 'undefined' &&
  235. typeof document.createElement === 'function'
  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. isFormData: isFormData,
  327. isArrayBufferView: isArrayBufferView,
  328. isString: isString,
  329. isNumber: isNumber,
  330. isObject: isObject,
  331. isUndefined: isUndefined,
  332. isDate: isDate,
  333. isFile: isFile,
  334. isBlob: isBlob,
  335. isFunction: isFunction,
  336. isStream: isStream,
  337. isURLSearchParams: isURLSearchParams,
  338. isStandardBrowserEnv: isStandardBrowserEnv,
  339. forEach: forEach,
  340. merge: merge,
  341. extend: extend,
  342. trim: trim
  343. };
  344. /***/ }),
  345. /* 1 */
  346. /***/ (function(module, exports, __webpack_require__) {
  347. "use strict";
  348. /* WEBPACK VAR INJECTION */(function(process) {
  349. var utils = __webpack_require__(0);
  350. var normalizeHeaderName = __webpack_require__(27);
  351. var PROTECTION_PREFIX = /^\)\]\}',?\n/;
  352. var DEFAULT_CONTENT_TYPE = {
  353. 'Content-Type': 'application/x-www-form-urlencoded'
  354. };
  355. function setContentTypeIfUnset(headers, value) {
  356. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  357. headers['Content-Type'] = value;
  358. }
  359. }
  360. function getDefaultAdapter() {
  361. var adapter;
  362. if (typeof XMLHttpRequest !== 'undefined') {
  363. // For browsers use XHR adapter
  364. adapter = __webpack_require__(3);
  365. } else if (typeof process !== 'undefined') {
  366. // For node use HTTP adapter
  367. adapter = __webpack_require__(3);
  368. }
  369. return adapter;
  370. }
  371. var defaults = {
  372. adapter: getDefaultAdapter(),
  373. transformRequest: [function transformRequest(data, headers) {
  374. normalizeHeaderName(headers, 'Content-Type');
  375. if (utils.isFormData(data) ||
  376. utils.isArrayBuffer(data) ||
  377. utils.isStream(data) ||
  378. utils.isFile(data) ||
  379. utils.isBlob(data)
  380. ) {
  381. return data;
  382. }
  383. if (utils.isArrayBufferView(data)) {
  384. return data.buffer;
  385. }
  386. if (utils.isURLSearchParams(data)) {
  387. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  388. return data.toString();
  389. }
  390. if (utils.isObject(data)) {
  391. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  392. return JSON.stringify(data);
  393. }
  394. return data;
  395. }],
  396. transformResponse: [function transformResponse(data) {
  397. /*eslint no-param-reassign:0*/
  398. if (typeof data === 'string') {
  399. data = data.replace(PROTECTION_PREFIX, '');
  400. try {
  401. data = JSON.parse(data);
  402. } catch (e) { /* Ignore */ }
  403. }
  404. return data;
  405. }],
  406. timeout: 0,
  407. xsrfCookieName: 'XSRF-TOKEN',
  408. xsrfHeaderName: 'X-XSRF-TOKEN',
  409. maxContentLength: -1,
  410. validateStatus: function validateStatus(status) {
  411. return status >= 200 && status < 300;
  412. }
  413. };
  414. defaults.headers = {
  415. common: {
  416. 'Accept': 'application/json, text/plain, */*'
  417. }
  418. };
  419. utils.forEach(['delete', 'get', 'head'], function forEachMehtodNoData(method) {
  420. defaults.headers[method] = {};
  421. });
  422. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  423. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  424. });
  425. module.exports = defaults;
  426. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
  427. /***/ }),
  428. /* 2 */
  429. /***/ (function(module, exports) {
  430. // shim for using process in browser
  431. var process = module.exports = {};
  432. // cached from whatever global is present so that test runners that stub it
  433. // don't break things. But we need to wrap it in a try catch in case it is
  434. // wrapped in strict mode code which doesn't define any globals. It's inside a
  435. // function because try/catches deoptimize in certain engines.
  436. var cachedSetTimeout;
  437. var cachedClearTimeout;
  438. function defaultSetTimout() {
  439. throw new Error('setTimeout has not been defined');
  440. }
  441. function defaultClearTimeout () {
  442. throw new Error('clearTimeout has not been defined');
  443. }
  444. (function () {
  445. try {
  446. if (typeof setTimeout === 'function') {
  447. cachedSetTimeout = setTimeout;
  448. } else {
  449. cachedSetTimeout = defaultSetTimout;
  450. }
  451. } catch (e) {
  452. cachedSetTimeout = defaultSetTimout;
  453. }
  454. try {
  455. if (typeof clearTimeout === 'function') {
  456. cachedClearTimeout = clearTimeout;
  457. } else {
  458. cachedClearTimeout = defaultClearTimeout;
  459. }
  460. } catch (e) {
  461. cachedClearTimeout = defaultClearTimeout;
  462. }
  463. } ())
  464. function runTimeout(fun) {
  465. if (cachedSetTimeout === setTimeout) {
  466. //normal enviroments in sane situations
  467. return setTimeout(fun, 0);
  468. }
  469. // if setTimeout wasn't available but was latter defined
  470. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  471. cachedSetTimeout = setTimeout;
  472. return setTimeout(fun, 0);
  473. }
  474. try {
  475. // when when somebody has screwed with setTimeout but no I.E. maddness
  476. return cachedSetTimeout(fun, 0);
  477. } catch(e){
  478. try {
  479. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  480. return cachedSetTimeout.call(null, fun, 0);
  481. } catch(e){
  482. // 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
  483. return cachedSetTimeout.call(this, fun, 0);
  484. }
  485. }
  486. }
  487. function runClearTimeout(marker) {
  488. if (cachedClearTimeout === clearTimeout) {
  489. //normal enviroments in sane situations
  490. return clearTimeout(marker);
  491. }
  492. // if clearTimeout wasn't available but was latter defined
  493. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  494. cachedClearTimeout = clearTimeout;
  495. return clearTimeout(marker);
  496. }
  497. try {
  498. // when when somebody has screwed with setTimeout but no I.E. maddness
  499. return cachedClearTimeout(marker);
  500. } catch (e){
  501. try {
  502. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  503. return cachedClearTimeout.call(null, marker);
  504. } catch (e){
  505. // 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.
  506. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  507. return cachedClearTimeout.call(this, marker);
  508. }
  509. }
  510. }
  511. var queue = [];
  512. var draining = false;
  513. var currentQueue;
  514. var queueIndex = -1;
  515. function cleanUpNextTick() {
  516. if (!draining || !currentQueue) {
  517. return;
  518. }
  519. draining = false;
  520. if (currentQueue.length) {
  521. queue = currentQueue.concat(queue);
  522. } else {
  523. queueIndex = -1;
  524. }
  525. if (queue.length) {
  526. drainQueue();
  527. }
  528. }
  529. function drainQueue() {
  530. if (draining) {
  531. return;
  532. }
  533. var timeout = runTimeout(cleanUpNextTick);
  534. draining = true;
  535. var len = queue.length;
  536. while(len) {
  537. currentQueue = queue;
  538. queue = [];
  539. while (++queueIndex < len) {
  540. if (currentQueue) {
  541. currentQueue[queueIndex].run();
  542. }
  543. }
  544. queueIndex = -1;
  545. len = queue.length;
  546. }
  547. currentQueue = null;
  548. draining = false;
  549. runClearTimeout(timeout);
  550. }
  551. process.nextTick = function (fun) {
  552. var args = new Array(arguments.length - 1);
  553. if (arguments.length > 1) {
  554. for (var i = 1; i < arguments.length; i++) {
  555. args[i - 1] = arguments[i];
  556. }
  557. }
  558. queue.push(new Item(fun, args));
  559. if (queue.length === 1 && !draining) {
  560. runTimeout(drainQueue);
  561. }
  562. };
  563. // v8 likes predictible objects
  564. function Item(fun, array) {
  565. this.fun = fun;
  566. this.array = array;
  567. }
  568. Item.prototype.run = function () {
  569. this.fun.apply(null, this.array);
  570. };
  571. process.title = 'browser';
  572. process.browser = true;
  573. process.env = {};
  574. process.argv = [];
  575. process.version = ''; // empty string to avoid regexp issues
  576. process.versions = {};
  577. function noop() {}
  578. process.on = noop;
  579. process.addListener = noop;
  580. process.once = noop;
  581. process.off = noop;
  582. process.removeListener = noop;
  583. process.removeAllListeners = noop;
  584. process.emit = noop;
  585. process.prependListener = noop;
  586. process.prependOnceListener = noop;
  587. process.listeners = function (name) { return [] }
  588. process.binding = function (name) {
  589. throw new Error('process.binding is not supported');
  590. };
  591. process.cwd = function () { return '/' };
  592. process.chdir = function (dir) {
  593. throw new Error('process.chdir is not supported');
  594. };
  595. process.umask = function() { return 0; };
  596. /***/ }),
  597. /* 3 */
  598. /***/ (function(module, exports, __webpack_require__) {
  599. "use strict";
  600. /* WEBPACK VAR INJECTION */(function(process) {
  601. var utils = __webpack_require__(0);
  602. var settle = __webpack_require__(19);
  603. var buildURL = __webpack_require__(22);
  604. var parseHeaders = __webpack_require__(28);
  605. var isURLSameOrigin = __webpack_require__(26);
  606. var createError = __webpack_require__(6);
  607. var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(21);
  608. module.exports = function xhrAdapter(config) {
  609. return new Promise(function dispatchXhrRequest(resolve, reject) {
  610. var requestData = config.data;
  611. var requestHeaders = config.headers;
  612. if (utils.isFormData(requestData)) {
  613. delete requestHeaders['Content-Type']; // Let the browser set it
  614. }
  615. var request = new XMLHttpRequest();
  616. var loadEvent = 'onreadystatechange';
  617. var xDomain = false;
  618. // For IE 8/9 CORS support
  619. // Only supports POST and GET calls and doesn't returns the response headers.
  620. // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
  621. if (process.env.NODE_ENV !== 'test' &&
  622. typeof window !== 'undefined' &&
  623. window.XDomainRequest && !('withCredentials' in request) &&
  624. !isURLSameOrigin(config.url)) {
  625. request = new window.XDomainRequest();
  626. loadEvent = 'onload';
  627. xDomain = true;
  628. request.onprogress = function handleProgress() {};
  629. request.ontimeout = function handleTimeout() {};
  630. }
  631. // HTTP basic authentication
  632. if (config.auth) {
  633. var username = config.auth.username || '';
  634. var password = config.auth.password || '';
  635. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  636. }
  637. request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
  638. // Set the request timeout in MS
  639. request.timeout = config.timeout;
  640. // Listen for ready state
  641. request[loadEvent] = function handleLoad() {
  642. if (!request || (request.readyState !== 4 && !xDomain)) {
  643. return;
  644. }
  645. // The request errored out and we didn't get a response, this will be
  646. // handled by onerror instead
  647. // With one exception: request that using file: protocol, most browsers
  648. // will return status as 0 even though it's a successful request
  649. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  650. return;
  651. }
  652. // Prepare the response
  653. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  654. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  655. var response = {
  656. data: responseData,
  657. // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
  658. status: request.status === 1223 ? 204 : request.status,
  659. statusText: request.status === 1223 ? 'No Content' : request.statusText,
  660. headers: responseHeaders,
  661. config: config,
  662. request: request
  663. };
  664. settle(resolve, reject, response);
  665. // Clean up request
  666. request = null;
  667. };
  668. // Handle low level network errors
  669. request.onerror = function handleError() {
  670. // Real errors are hidden from us by the browser
  671. // onerror should only fire if it's a network error
  672. reject(createError('Network Error', config));
  673. // Clean up request
  674. request = null;
  675. };
  676. // Handle timeout
  677. request.ontimeout = function handleTimeout() {
  678. reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED'));
  679. // Clean up request
  680. request = null;
  681. };
  682. // Add xsrf header
  683. // This is only done if running in a standard browser environment.
  684. // Specifically not if we're in a web worker, or react-native.
  685. if (utils.isStandardBrowserEnv()) {
  686. var cookies = __webpack_require__(24);
  687. // Add xsrf header
  688. var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
  689. cookies.read(config.xsrfCookieName) :
  690. undefined;
  691. if (xsrfValue) {
  692. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  693. }
  694. }
  695. // Add headers to the request
  696. if ('setRequestHeader' in request) {
  697. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  698. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  699. // Remove Content-Type if data is undefined
  700. delete requestHeaders[key];
  701. } else {
  702. // Otherwise add header to the request
  703. request.setRequestHeader(key, val);
  704. }
  705. });
  706. }
  707. // Add withCredentials to request if needed
  708. if (config.withCredentials) {
  709. request.withCredentials = true;
  710. }
  711. // Add responseType to request if needed
  712. if (config.responseType) {
  713. try {
  714. request.responseType = config.responseType;
  715. } catch (e) {
  716. if (request.responseType !== 'json') {
  717. throw e;
  718. }
  719. }
  720. }
  721. // Handle progress if needed
  722. if (typeof config.onDownloadProgress === 'function') {
  723. request.addEventListener('progress', config.onDownloadProgress);
  724. }
  725. // Not all browsers support upload events
  726. if (typeof config.onUploadProgress === 'function' && request.upload) {
  727. request.upload.addEventListener('progress', config.onUploadProgress);
  728. }
  729. if (config.cancelToken) {
  730. // Handle cancellation
  731. config.cancelToken.promise.then(function onCanceled(cancel) {
  732. if (!request) {
  733. return;
  734. }
  735. request.abort();
  736. reject(cancel);
  737. // Clean up request
  738. request = null;
  739. });
  740. }
  741. if (requestData === undefined) {
  742. requestData = null;
  743. }
  744. // Send the request
  745. request.send(requestData);
  746. });
  747. };
  748. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
  749. /***/ }),
  750. /* 4 */
  751. /***/ (function(module, exports, __webpack_require__) {
  752. "use strict";
  753. /**
  754. * A `Cancel` is an object that is thrown when an operation is canceled.
  755. *
  756. * @class
  757. * @param {string=} message The message.
  758. */
  759. function Cancel(message) {
  760. this.message = message;
  761. }
  762. Cancel.prototype.toString = function toString() {
  763. return 'Cancel' + (this.message ? ': ' + this.message : '');
  764. };
  765. Cancel.prototype.__CANCEL__ = true;
  766. module.exports = Cancel;
  767. /***/ }),
  768. /* 5 */
  769. /***/ (function(module, exports, __webpack_require__) {
  770. "use strict";
  771. module.exports = function isCancel(value) {
  772. return !!(value && value.__CANCEL__);
  773. };
  774. /***/ }),
  775. /* 6 */
  776. /***/ (function(module, exports, __webpack_require__) {
  777. "use strict";
  778. var enhanceError = __webpack_require__(18);
  779. /**
  780. * Create an Error with the specified message, config, error code, and response.
  781. *
  782. * @param {string} message The error message.
  783. * @param {Object} config The config.
  784. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  785. @ @param {Object} [response] The response.
  786. * @returns {Error} The created error.
  787. */
  788. module.exports = function createError(message, config, code, response) {
  789. var error = new Error(message);
  790. return enhanceError(error, config, code, response);
  791. };
  792. /***/ }),
  793. /* 7 */
  794. /***/ (function(module, exports, __webpack_require__) {
  795. "use strict";
  796. module.exports = function bind(fn, thisArg) {
  797. return function wrap() {
  798. var args = new Array(arguments.length);
  799. for (var i = 0; i < args.length; i++) {
  800. args[i] = arguments[i];
  801. }
  802. return fn.apply(thisArg, args);
  803. };
  804. };
  805. /***/ }),
  806. /* 8 */
  807. /***/ (function(module, exports, __webpack_require__) {
  808. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  809. * jQuery JavaScript Library v3.2.1
  810. * https://jquery.com/
  811. *
  812. * Includes Sizzle.js
  813. * https://sizzlejs.com/
  814. *
  815. * Copyright JS Foundation and other contributors
  816. * Released under the MIT license
  817. * https://jquery.org/license
  818. *
  819. * Date: 2017-03-20T18:59Z
  820. */
  821. ( function( global, factory ) {
  822. "use strict";
  823. if ( typeof module === "object" && typeof module.exports === "object" ) {
  824. // For CommonJS and CommonJS-like environments where a proper `window`
  825. // is present, execute the factory and get jQuery.
  826. // For environments that do not have a `window` with a `document`
  827. // (such as Node.js), expose a factory as module.exports.
  828. // This accentuates the need for the creation of a real `window`.
  829. // e.g. var jQuery = require("jquery")(window);
  830. // See ticket #14549 for more info.
  831. module.exports = global.document ?
  832. factory( global, true ) :
  833. function( w ) {
  834. if ( !w.document ) {
  835. throw new Error( "jQuery requires a window with a document" );
  836. }
  837. return factory( w );
  838. };
  839. } else {
  840. factory( global );
  841. }
  842. // Pass this if window is not defined yet
  843. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  844. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  845. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  846. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  847. // enough that all such attempts are guarded in a try block.
  848. "use strict";
  849. var arr = [];
  850. var document = window.document;
  851. var getProto = Object.getPrototypeOf;
  852. var slice = arr.slice;
  853. var concat = arr.concat;
  854. var push = arr.push;
  855. var indexOf = arr.indexOf;
  856. var class2type = {};
  857. var toString = class2type.toString;
  858. var hasOwn = class2type.hasOwnProperty;
  859. var fnToString = hasOwn.toString;
  860. var ObjectFunctionString = fnToString.call( Object );
  861. var support = {};
  862. function DOMEval( code, doc ) {
  863. doc = doc || document;
  864. var script = doc.createElement( "script" );
  865. script.text = code;
  866. doc.head.appendChild( script ).parentNode.removeChild( script );
  867. }
  868. /* global Symbol */
  869. // Defining this global in .eslintrc.json would create a danger of using the global
  870. // unguarded in another place, it seems safer to define global only for this module
  871. var
  872. version = "3.2.1",
  873. // Define a local copy of jQuery
  874. jQuery = function( selector, context ) {
  875. // The jQuery object is actually just the init constructor 'enhanced'
  876. // Need init if jQuery is called (just allow error to be thrown if not included)
  877. return new jQuery.fn.init( selector, context );
  878. },
  879. // Support: Android <=4.0 only
  880. // Make sure we trim BOM and NBSP
  881. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
  882. // Matches dashed string for camelizing
  883. rmsPrefix = /^-ms-/,
  884. rdashAlpha = /-([a-z])/g,
  885. // Used by jQuery.camelCase as callback to replace()
  886. fcamelCase = function( all, letter ) {
  887. return letter.toUpperCase();
  888. };
  889. jQuery.fn = jQuery.prototype = {
  890. // The current version of jQuery being used
  891. jquery: version,
  892. constructor: jQuery,
  893. // The default length of a jQuery object is 0
  894. length: 0,
  895. toArray: function() {
  896. return slice.call( this );
  897. },
  898. // Get the Nth element in the matched element set OR
  899. // Get the whole matched element set as a clean array
  900. get: function( num ) {
  901. // Return all the elements in a clean array
  902. if ( num == null ) {
  903. return slice.call( this );
  904. }
  905. // Return just the one element from the set
  906. return num < 0 ? this[ num + this.length ] : this[ num ];
  907. },
  908. // Take an array of elements and push it onto the stack
  909. // (returning the new matched element set)
  910. pushStack: function( elems ) {
  911. // Build a new jQuery matched element set
  912. var ret = jQuery.merge( this.constructor(), elems );
  913. // Add the old object onto the stack (as a reference)
  914. ret.prevObject = this;
  915. // Return the newly-formed element set
  916. return ret;
  917. },
  918. // Execute a callback for every element in the matched set.
  919. each: function( callback ) {
  920. return jQuery.each( this, callback );
  921. },
  922. map: function( callback ) {
  923. return this.pushStack( jQuery.map( this, function( elem, i ) {
  924. return callback.call( elem, i, elem );
  925. } ) );
  926. },
  927. slice: function() {
  928. return this.pushStack( slice.apply( this, arguments ) );
  929. },
  930. first: function() {
  931. return this.eq( 0 );
  932. },
  933. last: function() {
  934. return this.eq( -1 );
  935. },
  936. eq: function( i ) {
  937. var len = this.length,
  938. j = +i + ( i < 0 ? len : 0 );
  939. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  940. },
  941. end: function() {
  942. return this.prevObject || this.constructor();
  943. },
  944. // For internal use only.
  945. // Behaves like an Array's method, not like a jQuery method.
  946. push: push,
  947. sort: arr.sort,
  948. splice: arr.splice
  949. };
  950. jQuery.extend = jQuery.fn.extend = function() {
  951. var options, name, src, copy, copyIsArray, clone,
  952. target = arguments[ 0 ] || {},
  953. i = 1,
  954. length = arguments.length,
  955. deep = false;
  956. // Handle a deep copy situation
  957. if ( typeof target === "boolean" ) {
  958. deep = target;
  959. // Skip the boolean and the target
  960. target = arguments[ i ] || {};
  961. i++;
  962. }
  963. // Handle case when target is a string or something (possible in deep copy)
  964. if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
  965. target = {};
  966. }
  967. // Extend jQuery itself if only one argument is passed
  968. if ( i === length ) {
  969. target = this;
  970. i--;
  971. }
  972. for ( ; i < length; i++ ) {
  973. // Only deal with non-null/undefined values
  974. if ( ( options = arguments[ i ] ) != null ) {
  975. // Extend the base object
  976. for ( name in options ) {
  977. src = target[ name ];
  978. copy = options[ name ];
  979. // Prevent never-ending loop
  980. if ( target === copy ) {
  981. continue;
  982. }
  983. // Recurse if we're merging plain objects or arrays
  984. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  985. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  986. if ( copyIsArray ) {
  987. copyIsArray = false;
  988. clone = src && Array.isArray( src ) ? src : [];
  989. } else {
  990. clone = src && jQuery.isPlainObject( src ) ? src : {};
  991. }
  992. // Never move original objects, clone them
  993. target[ name ] = jQuery.extend( deep, clone, copy );
  994. // Don't bring in undefined values
  995. } else if ( copy !== undefined ) {
  996. target[ name ] = copy;
  997. }
  998. }
  999. }
  1000. }
  1001. // Return the modified object
  1002. return target;
  1003. };
  1004. jQuery.extend( {
  1005. // Unique for each copy of jQuery on the page
  1006. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  1007. // Assume jQuery is ready without the ready module
  1008. isReady: true,
  1009. error: function( msg ) {
  1010. throw new Error( msg );
  1011. },
  1012. noop: function() {},
  1013. isFunction: function( obj ) {
  1014. return jQuery.type( obj ) === "function";
  1015. },
  1016. isWindow: function( obj ) {
  1017. return obj != null && obj === obj.window;
  1018. },
  1019. isNumeric: function( obj ) {
  1020. // As of jQuery 3.0, isNumeric is limited to
  1021. // strings and numbers (primitives or objects)
  1022. // that can be coerced to finite numbers (gh-2662)
  1023. var type = jQuery.type( obj );
  1024. return ( type === "number" || type === "string" ) &&
  1025. // parseFloat NaNs numeric-cast false positives ("")
  1026. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  1027. // subtraction forces infinities to NaN
  1028. !isNaN( obj - parseFloat( obj ) );
  1029. },
  1030. isPlainObject: function( obj ) {
  1031. var proto, Ctor;
  1032. // Detect obvious negatives
  1033. // Use toString instead of jQuery.type to catch host objects
  1034. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  1035. return false;
  1036. }
  1037. proto = getProto( obj );
  1038. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  1039. if ( !proto ) {
  1040. return true;
  1041. }
  1042. // Objects with prototype are plain iff they were constructed by a global Object function
  1043. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  1044. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  1045. },
  1046. isEmptyObject: function( obj ) {
  1047. /* eslint-disable no-unused-vars */
  1048. // See https://github.com/eslint/eslint/issues/6125
  1049. var name;
  1050. for ( name in obj ) {
  1051. return false;
  1052. }
  1053. return true;
  1054. },
  1055. type: function( obj ) {
  1056. if ( obj == null ) {
  1057. return obj + "";
  1058. }
  1059. // Support: Android <=2.3 only (functionish RegExp)
  1060. return typeof obj === "object" || typeof obj === "function" ?
  1061. class2type[ toString.call( obj ) ] || "object" :
  1062. typeof obj;
  1063. },
  1064. // Evaluates a script in a global context
  1065. globalEval: function( code ) {
  1066. DOMEval( code );
  1067. },
  1068. // Convert dashed to camelCase; used by the css and data modules
  1069. // Support: IE <=9 - 11, Edge 12 - 13
  1070. // Microsoft forgot to hump their vendor prefix (#9572)
  1071. camelCase: function( string ) {
  1072. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  1073. },
  1074. each: function( obj, callback ) {
  1075. var length, i = 0;
  1076. if ( isArrayLike( obj ) ) {
  1077. length = obj.length;
  1078. for ( ; i < length; i++ ) {
  1079. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  1080. break;
  1081. }
  1082. }
  1083. } else {
  1084. for ( i in obj ) {
  1085. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  1086. break;
  1087. }
  1088. }
  1089. }
  1090. return obj;
  1091. },
  1092. // Support: Android <=4.0 only
  1093. trim: function( text ) {
  1094. return text == null ?
  1095. "" :
  1096. ( text + "" ).replace( rtrim, "" );
  1097. },
  1098. // results is for internal usage only
  1099. makeArray: function( arr, results ) {
  1100. var ret = results || [];
  1101. if ( arr != null ) {
  1102. if ( isArrayLike( Object( arr ) ) ) {
  1103. jQuery.merge( ret,
  1104. typeof arr === "string" ?
  1105. [ arr ] : arr
  1106. );
  1107. } else {
  1108. push.call( ret, arr );
  1109. }
  1110. }
  1111. return ret;
  1112. },
  1113. inArray: function( elem, arr, i ) {
  1114. return arr == null ? -1 : indexOf.call( arr, elem, i );
  1115. },
  1116. // Support: Android <=4.0 only, PhantomJS 1 only
  1117. // push.apply(_, arraylike) throws on ancient WebKit
  1118. merge: function( first, second ) {
  1119. var len = +second.length,
  1120. j = 0,
  1121. i = first.length;
  1122. for ( ; j < len; j++ ) {
  1123. first[ i++ ] = second[ j ];
  1124. }
  1125. first.length = i;
  1126. return first;
  1127. },
  1128. grep: function( elems, callback, invert ) {
  1129. var callbackInverse,
  1130. matches = [],
  1131. i = 0,
  1132. length = elems.length,
  1133. callbackExpect = !invert;
  1134. // Go through the array, only saving the items
  1135. // that pass the validator function
  1136. for ( ; i < length; i++ ) {
  1137. callbackInverse = !callback( elems[ i ], i );
  1138. if ( callbackInverse !== callbackExpect ) {
  1139. matches.push( elems[ i ] );
  1140. }
  1141. }
  1142. return matches;
  1143. },
  1144. // arg is for internal usage only
  1145. map: function( elems, callback, arg ) {
  1146. var length, value,
  1147. i = 0,
  1148. ret = [];
  1149. // Go through the array, translating each of the items to their new values
  1150. if ( isArrayLike( elems ) ) {
  1151. length = elems.length;
  1152. for ( ; i < length; i++ ) {
  1153. value = callback( elems[ i ], i, arg );
  1154. if ( value != null ) {
  1155. ret.push( value );
  1156. }
  1157. }
  1158. // Go through every key on the object,
  1159. } else {
  1160. for ( i in elems ) {
  1161. value = callback( elems[ i ], i, arg );
  1162. if ( value != null ) {
  1163. ret.push( value );
  1164. }
  1165. }
  1166. }
  1167. // Flatten any nested arrays
  1168. return concat.apply( [], ret );
  1169. },
  1170. // A global GUID counter for objects
  1171. guid: 1,
  1172. // Bind a function to a context, optionally partially applying any
  1173. // arguments.
  1174. proxy: function( fn, context ) {
  1175. var tmp, args, proxy;
  1176. if ( typeof context === "string" ) {
  1177. tmp = fn[ context ];
  1178. context = fn;
  1179. fn = tmp;
  1180. }
  1181. // Quick check to determine if target is callable, in the spec
  1182. // this throws a TypeError, but we will just return undefined.
  1183. if ( !jQuery.isFunction( fn ) ) {
  1184. return undefined;
  1185. }
  1186. // Simulated bind
  1187. args = slice.call( arguments, 2 );
  1188. proxy = function() {
  1189. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  1190. };
  1191. // Set the guid of unique handler to the same of original handler, so it can be removed
  1192. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  1193. return proxy;
  1194. },
  1195. now: Date.now,
  1196. // jQuery.support is not used in Core but other projects attach their
  1197. // properties to it so it needs to exist.
  1198. support: support
  1199. } );
  1200. if ( typeof Symbol === "function" ) {
  1201. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  1202. }
  1203. // Populate the class2type map
  1204. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  1205. function( i, name ) {
  1206. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  1207. } );
  1208. function isArrayLike( obj ) {
  1209. // Support: real iOS 8.2 only (not reproducible in simulator)
  1210. // `in` check used to prevent JIT error (gh-2145)
  1211. // hasOwn isn't used here due to false negatives
  1212. // regarding Nodelist length in IE
  1213. var length = !!obj && "length" in obj && obj.length,
  1214. type = jQuery.type( obj );
  1215. if ( type === "function" || jQuery.isWindow( obj ) ) {
  1216. return false;
  1217. }
  1218. return type === "array" || length === 0 ||
  1219. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  1220. }
  1221. var Sizzle =
  1222. /*!
  1223. * Sizzle CSS Selector Engine v2.3.3
  1224. * https://sizzlejs.com/
  1225. *
  1226. * Copyright jQuery Foundation and other contributors
  1227. * Released under the MIT license
  1228. * http://jquery.org/license
  1229. *
  1230. * Date: 2016-08-08
  1231. */
  1232. (function( window ) {
  1233. var i,
  1234. support,
  1235. Expr,
  1236. getText,
  1237. isXML,
  1238. tokenize,
  1239. compile,
  1240. select,
  1241. outermostContext,
  1242. sortInput,
  1243. hasDuplicate,
  1244. // Local document vars
  1245. setDocument,
  1246. document,
  1247. docElem,
  1248. documentIsHTML,
  1249. rbuggyQSA,
  1250. rbuggyMatches,
  1251. matches,
  1252. contains,
  1253. // Instance-specific data
  1254. expando = "sizzle" + 1 * new Date(),
  1255. preferredDoc = window.document,
  1256. dirruns = 0,
  1257. done = 0,
  1258. classCache = createCache(),
  1259. tokenCache = createCache(),
  1260. compilerCache = createCache(),
  1261. sortOrder = function( a, b ) {
  1262. if ( a === b ) {
  1263. hasDuplicate = true;
  1264. }
  1265. return 0;
  1266. },
  1267. // Instance methods
  1268. hasOwn = ({}).hasOwnProperty,
  1269. arr = [],
  1270. pop = arr.pop,
  1271. push_native = arr.push,
  1272. push = arr.push,
  1273. slice = arr.slice,
  1274. // Use a stripped-down indexOf as it's faster than native
  1275. // https://jsperf.com/thor-indexof-vs-for/5
  1276. indexOf = function( list, elem ) {
  1277. var i = 0,
  1278. len = list.length;
  1279. for ( ; i < len; i++ ) {
  1280. if ( list[i] === elem ) {
  1281. return i;
  1282. }
  1283. }
  1284. return -1;
  1285. },
  1286. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  1287. // Regular expressions
  1288. // http://www.w3.org/TR/css3-selectors/#whitespace
  1289. whitespace = "[\\x20\\t\\r\\n\\f]",
  1290. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  1291. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  1292. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  1293. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  1294. // Operator (capture 2)
  1295. "*([*^$|!~]?=)" + whitespace +
  1296. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  1297. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  1298. "*\\]",
  1299. pseudos = ":(" + identifier + ")(?:\\((" +
  1300. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  1301. // 1. quoted (capture 3; capture 4 or capture 5)
  1302. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  1303. // 2. simple (capture 6)
  1304. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  1305. // 3. anything else (capture 2)
  1306. ".*" +
  1307. ")\\)|)",
  1308. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  1309. rwhitespace = new RegExp( whitespace + "+", "g" ),
  1310. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  1311. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  1312. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  1313. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  1314. rpseudo = new RegExp( pseudos ),
  1315. ridentifier = new RegExp( "^" + identifier + "$" ),
  1316. matchExpr = {
  1317. "ID": new RegExp( "^#(" + identifier + ")" ),
  1318. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  1319. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  1320. "ATTR": new RegExp( "^" + attributes ),
  1321. "PSEUDO": new RegExp( "^" + pseudos ),
  1322. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  1323. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  1324. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  1325. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  1326. // For use in libraries implementing .is()
  1327. // We use this for POS matching in `select`
  1328. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  1329. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  1330. },
  1331. rinputs = /^(?:input|select|textarea|button)$/i,
  1332. rheader = /^h\d$/i,
  1333. rnative = /^[^{]+\{\s*\[native \w/,
  1334. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  1335. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  1336. rsibling = /[+~]/,
  1337. // CSS escapes
  1338. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  1339. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  1340. funescape = function( _, escaped, escapedWhitespace ) {
  1341. var high = "0x" + escaped - 0x10000;
  1342. // NaN means non-codepoint
  1343. // Support: Firefox<24
  1344. // Workaround erroneous numeric interpretation of +"0x"
  1345. return high !== high || escapedWhitespace ?
  1346. escaped :
  1347. high < 0 ?
  1348. // BMP codepoint
  1349. String.fromCharCode( high + 0x10000 ) :
  1350. // Supplemental Plane codepoint (surrogate pair)
  1351. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  1352. },
  1353. // CSS string/identifier serialization
  1354. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  1355. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  1356. fcssescape = function( ch, asCodePoint ) {
  1357. if ( asCodePoint ) {
  1358. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  1359. if ( ch === "\0" ) {
  1360. return "\uFFFD";
  1361. }
  1362. // Control characters and (dependent upon position) numbers get escaped as code points
  1363. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  1364. }
  1365. // Other potentially-special ASCII characters get backslash-escaped
  1366. return "\\" + ch;
  1367. },
  1368. // Used for iframes
  1369. // See setDocument()
  1370. // Removing the function wrapper causes a "Permission Denied"
  1371. // error in IE
  1372. unloadHandler = function() {
  1373. setDocument();
  1374. },
  1375. disabledAncestor = addCombinator(
  1376. function( elem ) {
  1377. return elem.disabled === true && ("form" in elem || "label" in elem);
  1378. },
  1379. { dir: "parentNode", next: "legend" }
  1380. );
  1381. // Optimize for push.apply( _, NodeList )
  1382. try {
  1383. push.apply(
  1384. (arr = slice.call( preferredDoc.childNodes )),
  1385. preferredDoc.childNodes
  1386. );
  1387. // Support: Android<4.0
  1388. // Detect silently failing push.apply
  1389. arr[ preferredDoc.childNodes.length ].nodeType;
  1390. } catch ( e ) {
  1391. push = { apply: arr.length ?
  1392. // Leverage slice if possible
  1393. function( target, els ) {
  1394. push_native.apply( target, slice.call(els) );
  1395. } :
  1396. // Support: IE<9
  1397. // Otherwise append directly
  1398. function( target, els ) {
  1399. var j = target.length,
  1400. i = 0;
  1401. // Can't trust NodeList.length
  1402. while ( (target[j++] = els[i++]) ) {}
  1403. target.length = j - 1;
  1404. }
  1405. };
  1406. }
  1407. function Sizzle( selector, context, results, seed ) {
  1408. var m, i, elem, nid, match, groups, newSelector,
  1409. newContext = context && context.ownerDocument,
  1410. // nodeType defaults to 9, since context defaults to document
  1411. nodeType = context ? context.nodeType : 9;
  1412. results = results || [];
  1413. // Return early from calls with invalid selector or context
  1414. if ( typeof selector !== "string" || !selector ||
  1415. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  1416. return results;
  1417. }
  1418. // Try to shortcut find operations (as opposed to filters) in HTML documents
  1419. if ( !seed ) {
  1420. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  1421. setDocument( context );
  1422. }
  1423. context = context || document;
  1424. if ( documentIsHTML ) {
  1425. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  1426. // (excepting DocumentFragment context, where the methods don't exist)
  1427. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  1428. // ID selector
  1429. if ( (m = match[1]) ) {
  1430. // Document context
  1431. if ( nodeType === 9 ) {
  1432. if ( (elem = context.getElementById( m )) ) {
  1433. // Support: IE, Opera, Webkit
  1434. // TODO: identify versions
  1435. // getElementById can match elements by name instead of ID
  1436. if ( elem.id === m ) {
  1437. results.push( elem );
  1438. return results;
  1439. }
  1440. } else {
  1441. return results;
  1442. }
  1443. // Element context
  1444. } else {
  1445. // Support: IE, Opera, Webkit
  1446. // TODO: identify versions
  1447. // getElementById can match elements by name instead of ID
  1448. if ( newContext && (elem = newContext.getElementById( m )) &&
  1449. contains( context, elem ) &&
  1450. elem.id === m ) {
  1451. results.push( elem );
  1452. return results;
  1453. }
  1454. }
  1455. // Type selector
  1456. } else if ( match[2] ) {
  1457. push.apply( results, context.getElementsByTagName( selector ) );
  1458. return results;
  1459. // Class selector
  1460. } else if ( (m = match[3]) && support.getElementsByClassName &&
  1461. context.getElementsByClassName ) {
  1462. push.apply( results, context.getElementsByClassName( m ) );
  1463. return results;
  1464. }
  1465. }
  1466. // Take advantage of querySelectorAll
  1467. if ( support.qsa &&
  1468. !compilerCache[ selector + " " ] &&
  1469. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  1470. if ( nodeType !== 1 ) {
  1471. newContext = context;
  1472. newSelector = selector;
  1473. // qSA looks outside Element context, which is not what we want
  1474. // Thanks to Andrew Dupont for this workaround technique
  1475. // Support: IE <=8
  1476. // Exclude object elements
  1477. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  1478. // Capture the context ID, setting it first if necessary
  1479. if ( (nid = context.getAttribute( "id" )) ) {
  1480. nid = nid.replace( rcssescape, fcssescape );
  1481. } else {
  1482. context.setAttribute( "id", (nid = expando) );
  1483. }
  1484. // Prefix every selector in the list
  1485. groups = tokenize( selector );
  1486. i = groups.length;
  1487. while ( i-- ) {
  1488. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  1489. }
  1490. newSelector = groups.join( "," );
  1491. // Expand context for sibling selectors
  1492. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  1493. context;
  1494. }
  1495. if ( newSelector ) {
  1496. try {
  1497. push.apply( results,
  1498. newContext.querySelectorAll( newSelector )
  1499. );
  1500. return results;
  1501. } catch ( qsaError ) {
  1502. } finally {
  1503. if ( nid === expando ) {
  1504. context.removeAttribute( "id" );
  1505. }
  1506. }
  1507. }
  1508. }
  1509. }
  1510. }
  1511. // All others
  1512. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  1513. }
  1514. /**
  1515. * Create key-value caches of limited size
  1516. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  1517. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  1518. * deleting the oldest entry
  1519. */
  1520. function createCache() {
  1521. var keys = [];
  1522. function cache( key, value ) {
  1523. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  1524. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  1525. // Only keep the most recent entries
  1526. delete cache[ keys.shift() ];
  1527. }
  1528. return (cache[ key + " " ] = value);
  1529. }
  1530. return cache;
  1531. }
  1532. /**
  1533. * Mark a function for special use by Sizzle
  1534. * @param {Function} fn The function to mark
  1535. */
  1536. function markFunction( fn ) {
  1537. fn[ expando ] = true;
  1538. return fn;
  1539. }
  1540. /**
  1541. * Support testing using an element
  1542. * @param {Function} fn Passed the created element and returns a boolean result
  1543. */
  1544. function assert( fn ) {
  1545. var el = document.createElement("fieldset");
  1546. try {
  1547. return !!fn( el );
  1548. } catch (e) {
  1549. return false;
  1550. } finally {
  1551. // Remove from its parent by default
  1552. if ( el.parentNode ) {
  1553. el.parentNode.removeChild( el );
  1554. }
  1555. // release memory in IE
  1556. el = null;
  1557. }
  1558. }
  1559. /**
  1560. * Adds the same handler for all of the specified attrs
  1561. * @param {String} attrs Pipe-separated list of attributes
  1562. * @param {Function} handler The method that will be applied
  1563. */
  1564. function addHandle( attrs, handler ) {
  1565. var arr = attrs.split("|"),
  1566. i = arr.length;
  1567. while ( i-- ) {
  1568. Expr.attrHandle[ arr[i] ] = handler;
  1569. }
  1570. }
  1571. /**
  1572. * Checks document order of two siblings
  1573. * @param {Element} a
  1574. * @param {Element} b
  1575. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  1576. */
  1577. function siblingCheck( a, b ) {
  1578. var cur = b && a,
  1579. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  1580. a.sourceIndex - b.sourceIndex;
  1581. // Use IE sourceIndex if available on both nodes
  1582. if ( diff ) {
  1583. return diff;
  1584. }
  1585. // Check if b follows a
  1586. if ( cur ) {
  1587. while ( (cur = cur.nextSibling) ) {
  1588. if ( cur === b ) {
  1589. return -1;
  1590. }
  1591. }
  1592. }
  1593. return a ? 1 : -1;
  1594. }
  1595. /**
  1596. * Returns a function to use in pseudos for input types
  1597. * @param {String} type
  1598. */
  1599. function createInputPseudo( type ) {
  1600. return function( elem ) {
  1601. var name = elem.nodeName.toLowerCase();
  1602. return name === "input" && elem.type === type;
  1603. };
  1604. }
  1605. /**
  1606. * Returns a function to use in pseudos for buttons
  1607. * @param {String} type
  1608. */
  1609. function createButtonPseudo( type ) {
  1610. return function( elem ) {
  1611. var name = elem.nodeName.toLowerCase();
  1612. return (name === "input" || name === "button") && elem.type === type;
  1613. };
  1614. }
  1615. /**
  1616. * Returns a function to use in pseudos for :enabled/:disabled
  1617. * @param {Boolean} disabled true for :disabled; false for :enabled
  1618. */
  1619. function createDisabledPseudo( disabled ) {
  1620. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  1621. return function( elem ) {
  1622. // Only certain elements can match :enabled or :disabled
  1623. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  1624. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  1625. if ( "form" in elem ) {
  1626. // Check for inherited disabledness on relevant non-disabled elements:
  1627. // * listed form-associated elements in a disabled fieldset
  1628. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  1629. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  1630. // * option elements in a disabled optgroup
  1631. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  1632. // All such elements have a "form" property.
  1633. if ( elem.parentNode && elem.disabled === false ) {
  1634. // Option elements defer to a parent optgroup if present
  1635. if ( "label" in elem ) {
  1636. if ( "label" in elem.parentNode ) {
  1637. return elem.parentNode.disabled === disabled;
  1638. } else {
  1639. return elem.disabled === disabled;
  1640. }
  1641. }
  1642. // Support: IE 6 - 11
  1643. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  1644. return elem.isDisabled === disabled ||
  1645. // Where there is no isDisabled, check manually
  1646. /* jshint -W018 */
  1647. elem.isDisabled !== !disabled &&
  1648. disabledAncestor( elem ) === disabled;
  1649. }
  1650. return elem.disabled === disabled;
  1651. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  1652. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  1653. // even exist on them, let alone have a boolean value.
  1654. } else if ( "label" in elem ) {
  1655. return elem.disabled === disabled;
  1656. }
  1657. // Remaining elements are neither :enabled nor :disabled
  1658. return false;
  1659. };
  1660. }
  1661. /**
  1662. * Returns a function to use in pseudos for positionals
  1663. * @param {Function} fn
  1664. */
  1665. function createPositionalPseudo( fn ) {
  1666. return markFunction(function( argument ) {
  1667. argument = +argument;
  1668. return markFunction(function( seed, matches ) {
  1669. var j,
  1670. matchIndexes = fn( [], seed.length, argument ),
  1671. i = matchIndexes.length;
  1672. // Match elements found at the specified indexes
  1673. while ( i-- ) {
  1674. if ( seed[ (j = matchIndexes[i]) ] ) {
  1675. seed[j] = !(matches[j] = seed[j]);
  1676. }
  1677. }
  1678. });
  1679. });
  1680. }
  1681. /**
  1682. * Checks a node for validity as a Sizzle context
  1683. * @param {Element|Object=} context
  1684. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  1685. */
  1686. function testContext( context ) {
  1687. return context && typeof context.getElementsByTagName !== "undefined" && context;
  1688. }
  1689. // Expose support vars for convenience
  1690. support = Sizzle.support = {};
  1691. /**
  1692. * Detects XML nodes
  1693. * @param {Element|Object} elem An element or a document
  1694. * @returns {Boolean} True iff elem is a non-HTML XML node
  1695. */
  1696. isXML = Sizzle.isXML = function( elem ) {
  1697. // documentElement is verified for cases where it doesn't yet exist
  1698. // (such as loading iframes in IE - #4833)
  1699. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  1700. return documentElement ? documentElement.nodeName !== "HTML" : false;
  1701. };
  1702. /**
  1703. * Sets document-related variables once based on the current document
  1704. * @param {Element|Object} [doc] An element or document object to use to set the document
  1705. * @returns {Object} Returns the current document
  1706. */
  1707. setDocument = Sizzle.setDocument = function( node ) {
  1708. var hasCompare, subWindow,
  1709. doc = node ? node.ownerDocument || node : preferredDoc;
  1710. // Return early if doc is invalid or already selected
  1711. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  1712. return document;
  1713. }
  1714. // Update global variables
  1715. document = doc;
  1716. docElem = document.documentElement;
  1717. documentIsHTML = !isXML( document );
  1718. // Support: IE 9-11, Edge
  1719. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  1720. if ( preferredDoc !== document &&
  1721. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  1722. // Support: IE 11, Edge
  1723. if ( subWindow.addEventListener ) {
  1724. subWindow.addEventListener( "unload", unloadHandler, false );
  1725. // Support: IE 9 - 10 only
  1726. } else if ( subWindow.attachEvent ) {
  1727. subWindow.attachEvent( "onunload", unloadHandler );
  1728. }
  1729. }
  1730. /* Attributes
  1731. ---------------------------------------------------------------------- */
  1732. // Support: IE<8
  1733. // Verify that getAttribute really returns attributes and not properties
  1734. // (excepting IE8 booleans)
  1735. support.attributes = assert(function( el ) {
  1736. el.className = "i";
  1737. return !el.getAttribute("className");
  1738. });
  1739. /* getElement(s)By*
  1740. ---------------------------------------------------------------------- */
  1741. // Check if getElementsByTagName("*") returns only elements
  1742. support.getElementsByTagName = assert(function( el ) {
  1743. el.appendChild( document.createComment("") );
  1744. return !el.getElementsByTagName("*").length;
  1745. });
  1746. // Support: IE<9
  1747. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  1748. // Support: IE<10
  1749. // Check if getElementById returns elements by name
  1750. // The broken getElementById methods don't pick up programmatically-set names,
  1751. // so use a roundabout getElementsByName test
  1752. support.getById = assert(function( el ) {
  1753. docElem.appendChild( el ).id = expando;
  1754. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  1755. });
  1756. // ID filter and find
  1757. if ( support.getById ) {
  1758. Expr.filter["ID"] = function( id ) {
  1759. var attrId = id.replace( runescape, funescape );
  1760. return function( elem ) {
  1761. return elem.getAttribute("id") === attrId;
  1762. };
  1763. };
  1764. Expr.find["ID"] = function( id, context ) {
  1765. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  1766. var elem = context.getElementById( id );
  1767. return elem ? [ elem ] : [];
  1768. }
  1769. };
  1770. } else {
  1771. Expr.filter["ID"] = function( id ) {
  1772. var attrId = id.replace( runescape, funescape );
  1773. return function( elem ) {
  1774. var node = typeof elem.getAttributeNode !== "undefined" &&
  1775. elem.getAttributeNode("id");
  1776. return node && node.value === attrId;
  1777. };
  1778. };
  1779. // Support: IE 6 - 7 only
  1780. // getElementById is not reliable as a find shortcut
  1781. Expr.find["ID"] = function( id, context ) {
  1782. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  1783. var node, i, elems,
  1784. elem = context.getElementById( id );
  1785. if ( elem ) {
  1786. // Verify the id attribute
  1787. node = elem.getAttributeNode("id");
  1788. if ( node && node.value === id ) {
  1789. return [ elem ];
  1790. }
  1791. // Fall back on getElementsByName
  1792. elems = context.getElementsByName( id );
  1793. i = 0;
  1794. while ( (elem = elems[i++]) ) {
  1795. node = elem.getAttributeNode("id");
  1796. if ( node && node.value === id ) {
  1797. return [ elem ];
  1798. }
  1799. }
  1800. }
  1801. return [];
  1802. }
  1803. };
  1804. }
  1805. // Tag
  1806. Expr.find["TAG"] = support.getElementsByTagName ?
  1807. function( tag, context ) {
  1808. if ( typeof context.getElementsByTagName !== "undefined" ) {
  1809. return context.getElementsByTagName( tag );
  1810. // DocumentFragment nodes don't have gEBTN
  1811. } else if ( support.qsa ) {
  1812. return context.querySelectorAll( tag );
  1813. }
  1814. } :
  1815. function( tag, context ) {
  1816. var elem,
  1817. tmp = [],
  1818. i = 0,
  1819. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  1820. results = context.getElementsByTagName( tag );
  1821. // Filter out possible comments
  1822. if ( tag === "*" ) {
  1823. while ( (elem = results[i++]) ) {
  1824. if ( elem.nodeType === 1 ) {
  1825. tmp.push( elem );
  1826. }
  1827. }
  1828. return tmp;
  1829. }
  1830. return results;
  1831. };
  1832. // Class
  1833. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  1834. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  1835. return context.getElementsByClassName( className );
  1836. }
  1837. };
  1838. /* QSA/matchesSelector
  1839. ---------------------------------------------------------------------- */
  1840. // QSA and matchesSelector support
  1841. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  1842. rbuggyMatches = [];
  1843. // qSa(:focus) reports false when true (Chrome 21)
  1844. // We allow this because of a bug in IE8/9 that throws an error
  1845. // whenever `document.activeElement` is accessed on an iframe
  1846. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  1847. // See https://bugs.jquery.com/ticket/13378
  1848. rbuggyQSA = [];
  1849. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  1850. // Build QSA regex
  1851. // Regex strategy adopted from Diego Perini
  1852. assert(function( el ) {
  1853. // Select is set to empty string on purpose
  1854. // This is to test IE's treatment of not explicitly
  1855. // setting a boolean content attribute,
  1856. // since its presence should be enough
  1857. // https://bugs.jquery.com/ticket/12359
  1858. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  1859. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  1860. "<option selected=''></option></select>";
  1861. // Support: IE8, Opera 11-12.16
  1862. // Nothing should be selected when empty strings follow ^= or $= or *=
  1863. // The test attribute must be unknown in Opera but "safe" for WinRT
  1864. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  1865. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  1866. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  1867. }
  1868. // Support: IE8
  1869. // Boolean attributes and "value" are not treated correctly
  1870. if ( !el.querySelectorAll("[selected]").length ) {
  1871. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1872. }
  1873. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  1874. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1875. rbuggyQSA.push("~=");
  1876. }
  1877. // Webkit/Opera - :checked should return selected option elements
  1878. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1879. // IE8 throws error here and will not see later tests
  1880. if ( !el.querySelectorAll(":checked").length ) {
  1881. rbuggyQSA.push(":checked");
  1882. }
  1883. // Support: Safari 8+, iOS 8+
  1884. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1885. // In-page `selector#id sibling-combinator selector` fails
  1886. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1887. rbuggyQSA.push(".#.+[+~]");
  1888. }
  1889. });
  1890. assert(function( el ) {
  1891. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  1892. "<select disabled='disabled'><option/></select>";
  1893. // Support: Windows 8 Native Apps
  1894. // The type and name attributes are restricted during .innerHTML assignment
  1895. var input = document.createElement("input");
  1896. input.setAttribute( "type", "hidden" );
  1897. el.appendChild( input ).setAttribute( "name", "D" );
  1898. // Support: IE8
  1899. // Enforce case-sensitivity of name attribute
  1900. if ( el.querySelectorAll("[name=d]").length ) {
  1901. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1902. }
  1903. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1904. // IE8 throws error here and will not see later tests
  1905. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  1906. rbuggyQSA.push( ":enabled", ":disabled" );
  1907. }
  1908. // Support: IE9-11+
  1909. // IE's :disabled selector does not pick up the children of disabled fieldsets
  1910. docElem.appendChild( el ).disabled = true;
  1911. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  1912. rbuggyQSA.push( ":enabled", ":disabled" );
  1913. }
  1914. // Opera 10-11 does not throw on post-comma invalid pseudos
  1915. el.querySelectorAll("*,:x");
  1916. rbuggyQSA.push(",.*:");
  1917. });
  1918. }
  1919. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  1920. docElem.webkitMatchesSelector ||
  1921. docElem.mozMatchesSelector ||
  1922. docElem.oMatchesSelector ||
  1923. docElem.msMatchesSelector) )) ) {
  1924. assert(function( el ) {
  1925. // Check to see if it's possible to do matchesSelector
  1926. // on a disconnected node (IE 9)
  1927. support.disconnectedMatch = matches.call( el, "*" );
  1928. // This should fail with an exception
  1929. // Gecko does not error, returns false instead
  1930. matches.call( el, "[s!='']:x" );
  1931. rbuggyMatches.push( "!=", pseudos );
  1932. });
  1933. }
  1934. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  1935. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  1936. /* Contains
  1937. ---------------------------------------------------------------------- */
  1938. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1939. // Element contains another
  1940. // Purposefully self-exclusive
  1941. // As in, an element does not contain itself
  1942. contains = hasCompare || rnative.test( docElem.contains ) ?
  1943. function( a, b ) {
  1944. var adown = a.nodeType === 9 ? a.documentElement : a,
  1945. bup = b && b.parentNode;
  1946. return a === bup || !!( bup && bup.nodeType === 1 && (
  1947. adown.contains ?
  1948. adown.contains( bup ) :
  1949. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1950. ));
  1951. } :
  1952. function( a, b ) {
  1953. if ( b ) {
  1954. while ( (b = b.parentNode) ) {
  1955. if ( b === a ) {
  1956. return true;
  1957. }
  1958. }
  1959. }
  1960. return false;
  1961. };
  1962. /* Sorting
  1963. ---------------------------------------------------------------------- */
  1964. // Document order sorting
  1965. sortOrder = hasCompare ?
  1966. function( a, b ) {
  1967. // Flag for duplicate removal
  1968. if ( a === b ) {
  1969. hasDuplicate = true;
  1970. return 0;
  1971. }
  1972. // Sort on method existence if only one input has compareDocumentPosition
  1973. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1974. if ( compare ) {
  1975. return compare;
  1976. }
  1977. // Calculate position if both inputs belong to the same document
  1978. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  1979. a.compareDocumentPosition( b ) :
  1980. // Otherwise we know they are disconnected
  1981. 1;
  1982. // Disconnected nodes
  1983. if ( compare & 1 ||
  1984. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  1985. // Choose the first element that is related to our preferred document
  1986. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  1987. return -1;
  1988. }
  1989. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  1990. return 1;
  1991. }
  1992. // Maintain original order
  1993. return sortInput ?
  1994. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1995. 0;
  1996. }
  1997. return compare & 4 ? -1 : 1;
  1998. } :
  1999. function( a, b ) {
  2000. // Exit early if the nodes are identical
  2001. if ( a === b ) {
  2002. hasDuplicate = true;
  2003. return 0;
  2004. }
  2005. var cur,
  2006. i = 0,
  2007. aup = a.parentNode,
  2008. bup = b.parentNode,
  2009. ap = [ a ],
  2010. bp = [ b ];
  2011. // Parentless nodes are either documents or disconnected
  2012. if ( !aup || !bup ) {
  2013. return a === document ? -1 :
  2014. b === document ? 1 :
  2015. aup ? -1 :
  2016. bup ? 1 :
  2017. sortInput ?
  2018. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  2019. 0;
  2020. // If the nodes are siblings, we can do a quick check
  2021. } else if ( aup === bup ) {
  2022. return siblingCheck( a, b );
  2023. }
  2024. // Otherwise we need full lists of their ancestors for comparison
  2025. cur = a;
  2026. while ( (cur = cur.parentNode) ) {
  2027. ap.unshift( cur );
  2028. }
  2029. cur = b;
  2030. while ( (cur = cur.parentNode) ) {
  2031. bp.unshift( cur );
  2032. }
  2033. // Walk down the tree looking for a discrepancy
  2034. while ( ap[i] === bp[i] ) {
  2035. i++;
  2036. }
  2037. return i ?
  2038. // Do a sibling check if the nodes have a common ancestor
  2039. siblingCheck( ap[i], bp[i] ) :
  2040. // Otherwise nodes in our document sort first
  2041. ap[i] === preferredDoc ? -1 :
  2042. bp[i] === preferredDoc ? 1 :
  2043. 0;
  2044. };
  2045. return document;
  2046. };
  2047. Sizzle.matches = function( expr, elements ) {
  2048. return Sizzle( expr, null, null, elements );
  2049. };
  2050. Sizzle.matchesSelector = function( elem, expr ) {
  2051. // Set document vars if needed
  2052. if ( ( elem.ownerDocument || elem ) !== document ) {
  2053. setDocument( elem );
  2054. }
  2055. // Make sure that attribute selectors are quoted
  2056. expr = expr.replace( rattributeQuotes, "='$1']" );
  2057. if ( support.matchesSelector && documentIsHTML &&
  2058. !compilerCache[ expr + " " ] &&
  2059. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  2060. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  2061. try {
  2062. var ret = matches.call( elem, expr );
  2063. // IE 9's matchesSelector returns false on disconnected nodes
  2064. if ( ret || support.disconnectedMatch ||
  2065. // As well, disconnected nodes are said to be in a document
  2066. // fragment in IE 9
  2067. elem.document && elem.document.nodeType !== 11 ) {
  2068. return ret;
  2069. }
  2070. } catch (e) {}
  2071. }
  2072. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  2073. };
  2074. Sizzle.contains = function( context, elem ) {
  2075. // Set document vars if needed
  2076. if ( ( context.ownerDocument || context ) !== document ) {
  2077. setDocument( context );
  2078. }
  2079. return contains( context, elem );
  2080. };
  2081. Sizzle.attr = function( elem, name ) {
  2082. // Set document vars if needed
  2083. if ( ( elem.ownerDocument || elem ) !== document ) {
  2084. setDocument( elem );
  2085. }
  2086. var fn = Expr.attrHandle[ name.toLowerCase() ],
  2087. // Don't get fooled by Object.prototype properties (jQuery #13807)
  2088. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  2089. fn( elem, name, !documentIsHTML ) :
  2090. undefined;
  2091. return val !== undefined ?
  2092. val :
  2093. support.attributes || !documentIsHTML ?
  2094. elem.getAttribute( name ) :
  2095. (val = elem.getAttributeNode(name)) && val.specified ?
  2096. val.value :
  2097. null;
  2098. };
  2099. Sizzle.escape = function( sel ) {
  2100. return (sel + "").replace( rcssescape, fcssescape );
  2101. };
  2102. Sizzle.error = function( msg ) {
  2103. throw new Error( "Syntax error, unrecognized expression: " + msg );
  2104. };
  2105. /**
  2106. * Document sorting and removing duplicates
  2107. * @param {ArrayLike} results
  2108. */
  2109. Sizzle.uniqueSort = function( results ) {
  2110. var elem,
  2111. duplicates = [],
  2112. j = 0,
  2113. i = 0;
  2114. // Unless we *know* we can detect duplicates, assume their presence
  2115. hasDuplicate = !support.detectDuplicates;
  2116. sortInput = !support.sortStable && results.slice( 0 );
  2117. results.sort( sortOrder );
  2118. if ( hasDuplicate ) {
  2119. while ( (elem = results[i++]) ) {
  2120. if ( elem === results[ i ] ) {
  2121. j = duplicates.push( i );
  2122. }
  2123. }
  2124. while ( j-- ) {
  2125. results.splice( duplicates[ j ], 1 );
  2126. }
  2127. }
  2128. // Clear input after sorting to release objects
  2129. // See https://github.com/jquery/sizzle/pull/225
  2130. sortInput = null;
  2131. return results;
  2132. };
  2133. /**
  2134. * Utility function for retrieving the text value of an array of DOM nodes
  2135. * @param {Array|Element} elem
  2136. */
  2137. getText = Sizzle.getText = function( elem ) {
  2138. var node,
  2139. ret = "",
  2140. i = 0,
  2141. nodeType = elem.nodeType;
  2142. if ( !nodeType ) {
  2143. // If no nodeType, this is expected to be an array
  2144. while ( (node = elem[i++]) ) {
  2145. // Do not traverse comment nodes
  2146. ret += getText( node );
  2147. }
  2148. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  2149. // Use textContent for elements
  2150. // innerText usage removed for consistency of new lines (jQuery #11153)
  2151. if ( typeof elem.textContent === "string" ) {
  2152. return elem.textContent;
  2153. } else {
  2154. // Traverse its children
  2155. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  2156. ret += getText( elem );
  2157. }
  2158. }
  2159. } else if ( nodeType === 3 || nodeType === 4 ) {
  2160. return elem.nodeValue;
  2161. }
  2162. // Do not include comment or processing instruction nodes
  2163. return ret;
  2164. };
  2165. Expr = Sizzle.selectors = {
  2166. // Can be adjusted by the user
  2167. cacheLength: 50,
  2168. createPseudo: markFunction,
  2169. match: matchExpr,
  2170. attrHandle: {},
  2171. find: {},
  2172. relative: {
  2173. ">": { dir: "parentNode", first: true },
  2174. " ": { dir: "parentNode" },
  2175. "+": { dir: "previousSibling", first: true },
  2176. "~": { dir: "previousSibling" }
  2177. },
  2178. preFilter: {
  2179. "ATTR": function( match ) {
  2180. match[1] = match[1].replace( runescape, funescape );
  2181. // Move the given value to match[3] whether quoted or unquoted
  2182. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  2183. if ( match[2] === "~=" ) {
  2184. match[3] = " " + match[3] + " ";
  2185. }
  2186. return match.slice( 0, 4 );
  2187. },
  2188. "CHILD": function( match ) {
  2189. /* matches from matchExpr["CHILD"]
  2190. 1 type (only|nth|...)
  2191. 2 what (child|of-type)
  2192. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  2193. 4 xn-component of xn+y argument ([+-]?\d*n|)
  2194. 5 sign of xn-component
  2195. 6 x of xn-component
  2196. 7 sign of y-component
  2197. 8 y of y-component
  2198. */
  2199. match[1] = match[1].toLowerCase();
  2200. if ( match[1].slice( 0, 3 ) === "nth" ) {
  2201. // nth-* requires argument
  2202. if ( !match[3] ) {
  2203. Sizzle.error( match[0] );
  2204. }
  2205. // numeric x and y parameters for Expr.filter.CHILD
  2206. // remember that false/true cast respectively to 0/1
  2207. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  2208. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  2209. // other types prohibit arguments
  2210. } else if ( match[3] ) {
  2211. Sizzle.error( match[0] );
  2212. }
  2213. return match;
  2214. },
  2215. "PSEUDO": function( match ) {
  2216. var excess,
  2217. unquoted = !match[6] && match[2];
  2218. if ( matchExpr["CHILD"].test( match[0] ) ) {
  2219. return null;
  2220. }
  2221. // Accept quoted arguments as-is
  2222. if ( match[3] ) {
  2223. match[2] = match[4] || match[5] || "";
  2224. // Strip excess characters from unquoted arguments
  2225. } else if ( unquoted && rpseudo.test( unquoted ) &&
  2226. // Get excess from tokenize (recursively)
  2227. (excess = tokenize( unquoted, true )) &&
  2228. // advance to the next closing parenthesis
  2229. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  2230. // excess is a negative index
  2231. match[0] = match[0].slice( 0, excess );
  2232. match[2] = unquoted.slice( 0, excess );
  2233. }
  2234. // Return only captures needed by the pseudo filter method (type and argument)
  2235. return match.slice( 0, 3 );
  2236. }
  2237. },
  2238. filter: {
  2239. "TAG": function( nodeNameSelector ) {
  2240. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  2241. return nodeNameSelector === "*" ?
  2242. function() { return true; } :
  2243. function( elem ) {
  2244. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  2245. };
  2246. },
  2247. "CLASS": function( className ) {
  2248. var pattern = classCache[ className + " " ];
  2249. return pattern ||
  2250. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  2251. classCache( className, function( elem ) {
  2252. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  2253. });
  2254. },
  2255. "ATTR": function( name, operator, check ) {
  2256. return function( elem ) {
  2257. var result = Sizzle.attr( elem, name );
  2258. if ( result == null ) {
  2259. return operator === "!=";
  2260. }
  2261. if ( !operator ) {
  2262. return true;
  2263. }
  2264. result += "";
  2265. return operator === "=" ? result === check :
  2266. operator === "!=" ? result !== check :
  2267. operator === "^=" ? check && result.indexOf( check ) === 0 :
  2268. operator === "*=" ? check && result.indexOf( check ) > -1 :
  2269. operator === "$=" ? check && result.slice( -check.length ) === check :
  2270. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  2271. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  2272. false;
  2273. };
  2274. },
  2275. "CHILD": function( type, what, argument, first, last ) {
  2276. var simple = type.slice( 0, 3 ) !== "nth",
  2277. forward = type.slice( -4 ) !== "last",
  2278. ofType = what === "of-type";
  2279. return first === 1 && last === 0 ?
  2280. // Shortcut for :nth-*(n)
  2281. function( elem ) {
  2282. return !!elem.parentNode;
  2283. } :
  2284. function( elem, context, xml ) {
  2285. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  2286. dir = simple !== forward ? "nextSibling" : "previousSibling",
  2287. parent = elem.parentNode,
  2288. name = ofType && elem.nodeName.toLowerCase(),
  2289. useCache = !xml && !ofType,
  2290. diff = false;
  2291. if ( parent ) {
  2292. // :(first|last|only)-(child|of-type)
  2293. if ( simple ) {
  2294. while ( dir ) {
  2295. node = elem;
  2296. while ( (node = node[ dir ]) ) {
  2297. if ( ofType ?
  2298. node.nodeName.toLowerCase() === name :
  2299. node.nodeType === 1 ) {
  2300. return false;
  2301. }
  2302. }
  2303. // Reverse direction for :only-* (if we haven't yet done so)
  2304. start = dir = type === "only" && !start && "nextSibling";
  2305. }
  2306. return true;
  2307. }
  2308. start = [ forward ? parent.firstChild : parent.lastChild ];
  2309. // non-xml :nth-child(...) stores cache data on `parent`
  2310. if ( forward && useCache ) {
  2311. // Seek `elem` from a previously-cached index
  2312. // ...in a gzip-friendly way
  2313. node = parent;
  2314. outerCache = node[ expando ] || (node[ expando ] = {});
  2315. // Support: IE <9 only
  2316. // Defend against cloned attroperties (jQuery gh-1709)
  2317. uniqueCache = outerCache[ node.uniqueID ] ||
  2318. (outerCache[ node.uniqueID ] = {});
  2319. cache = uniqueCache[ type ] || [];
  2320. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  2321. diff = nodeIndex && cache[ 2 ];
  2322. node = nodeIndex && parent.childNodes[ nodeIndex ];
  2323. while ( (node = ++nodeIndex && node && node[ dir ] ||
  2324. // Fallback to seeking `elem` from the start
  2325. (diff = nodeIndex = 0) || start.pop()) ) {
  2326. // When found, cache indexes on `parent` and break
  2327. if ( node.nodeType === 1 && ++diff && node === elem ) {
  2328. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  2329. break;
  2330. }
  2331. }
  2332. } else {
  2333. // Use previously-cached element index if available
  2334. if ( useCache ) {
  2335. // ...in a gzip-friendly way
  2336. node = elem;
  2337. outerCache = node[ expando ] || (node[ expando ] = {});
  2338. // Support: IE <9 only
  2339. // Defend against cloned attroperties (jQuery gh-1709)
  2340. uniqueCache = outerCache[ node.uniqueID ] ||
  2341. (outerCache[ node.uniqueID ] = {});
  2342. cache = uniqueCache[ type ] || [];
  2343. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  2344. diff = nodeIndex;
  2345. }
  2346. // xml :nth-child(...)
  2347. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  2348. if ( diff === false ) {
  2349. // Use the same loop as above to seek `elem` from the start
  2350. while ( (node = ++nodeIndex && node && node[ dir ] ||
  2351. (diff = nodeIndex = 0) || start.pop()) ) {
  2352. if ( ( ofType ?
  2353. node.nodeName.toLowerCase() === name :
  2354. node.nodeType === 1 ) &&
  2355. ++diff ) {
  2356. // Cache the index of each encountered element
  2357. if ( useCache ) {
  2358. outerCache = node[ expando ] || (node[ expando ] = {});
  2359. // Support: IE <9 only
  2360. // Defend against cloned attroperties (jQuery gh-1709)
  2361. uniqueCache = outerCache[ node.uniqueID ] ||
  2362. (outerCache[ node.uniqueID ] = {});
  2363. uniqueCache[ type ] = [ dirruns, diff ];
  2364. }
  2365. if ( node === elem ) {
  2366. break;
  2367. }
  2368. }
  2369. }
  2370. }
  2371. }
  2372. // Incorporate the offset, then check against cycle size
  2373. diff -= last;
  2374. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  2375. }
  2376. };
  2377. },
  2378. "PSEUDO": function( pseudo, argument ) {
  2379. // pseudo-class names are case-insensitive
  2380. // http://www.w3.org/TR/selectors/#pseudo-classes
  2381. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  2382. // Remember that setFilters inherits from pseudos
  2383. var args,
  2384. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  2385. Sizzle.error( "unsupported pseudo: " + pseudo );
  2386. // The user may use createPseudo to indicate that
  2387. // arguments are needed to create the filter function
  2388. // just as Sizzle does
  2389. if ( fn[ expando ] ) {
  2390. return fn( argument );
  2391. }
  2392. // But maintain support for old signatures
  2393. if ( fn.length > 1 ) {
  2394. args = [ pseudo, pseudo, "", argument ];
  2395. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  2396. markFunction(function( seed, matches ) {
  2397. var idx,
  2398. matched = fn( seed, argument ),
  2399. i = matched.length;
  2400. while ( i-- ) {
  2401. idx = indexOf( seed, matched[i] );
  2402. seed[ idx ] = !( matches[ idx ] = matched[i] );
  2403. }
  2404. }) :
  2405. function( elem ) {
  2406. return fn( elem, 0, args );
  2407. };
  2408. }
  2409. return fn;
  2410. }
  2411. },
  2412. pseudos: {
  2413. // Potentially complex pseudos
  2414. "not": markFunction(function( selector ) {
  2415. // Trim the selector passed to compile
  2416. // to avoid treating leading and trailing
  2417. // spaces as combinators
  2418. var input = [],
  2419. results = [],
  2420. matcher = compile( selector.replace( rtrim, "$1" ) );
  2421. return matcher[ expando ] ?
  2422. markFunction(function( seed, matches, context, xml ) {
  2423. var elem,
  2424. unmatched = matcher( seed, null, xml, [] ),
  2425. i = seed.length;
  2426. // Match elements unmatched by `matcher`
  2427. while ( i-- ) {
  2428. if ( (elem = unmatched[i]) ) {
  2429. seed[i] = !(matches[i] = elem);
  2430. }
  2431. }
  2432. }) :
  2433. function( elem, context, xml ) {
  2434. input[0] = elem;
  2435. matcher( input, null, xml, results );
  2436. // Don't keep the element (issue #299)
  2437. input[0] = null;
  2438. return !results.pop();
  2439. };
  2440. }),
  2441. "has": markFunction(function( selector ) {
  2442. return function( elem ) {
  2443. return Sizzle( selector, elem ).length > 0;
  2444. };
  2445. }),
  2446. "contains": markFunction(function( text ) {
  2447. text = text.replace( runescape, funescape );
  2448. return function( elem ) {
  2449. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  2450. };
  2451. }),
  2452. // "Whether an element is represented by a :lang() selector
  2453. // is based solely on the element's language value
  2454. // being equal to the identifier C,
  2455. // or beginning with the identifier C immediately followed by "-".
  2456. // The matching of C against the element's language value is performed case-insensitively.
  2457. // The identifier C does not have to be a valid language name."
  2458. // http://www.w3.org/TR/selectors/#lang-pseudo
  2459. "lang": markFunction( function( lang ) {
  2460. // lang value must be a valid identifier
  2461. if ( !ridentifier.test(lang || "") ) {
  2462. Sizzle.error( "unsupported lang: " + lang );
  2463. }
  2464. lang = lang.replace( runescape, funescape ).toLowerCase();
  2465. return function( elem ) {
  2466. var elemLang;
  2467. do {
  2468. if ( (elemLang = documentIsHTML ?
  2469. elem.lang :
  2470. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  2471. elemLang = elemLang.toLowerCase();
  2472. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  2473. }
  2474. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  2475. return false;
  2476. };
  2477. }),
  2478. // Miscellaneous
  2479. "target": function( elem ) {
  2480. var hash = window.location && window.location.hash;
  2481. return hash && hash.slice( 1 ) === elem.id;
  2482. },
  2483. "root": function( elem ) {
  2484. return elem === docElem;
  2485. },
  2486. "focus": function( elem ) {
  2487. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  2488. },
  2489. // Boolean properties
  2490. "enabled": createDisabledPseudo( false ),
  2491. "disabled": createDisabledPseudo( true ),
  2492. "checked": function( elem ) {
  2493. // In CSS3, :checked should return both checked and selected elements
  2494. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  2495. var nodeName = elem.nodeName.toLowerCase();
  2496. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  2497. },
  2498. "selected": function( elem ) {
  2499. // Accessing this property makes selected-by-default
  2500. // options in Safari work properly
  2501. if ( elem.parentNode ) {
  2502. elem.parentNode.selectedIndex;
  2503. }
  2504. return elem.selected === true;
  2505. },
  2506. // Contents
  2507. "empty": function( elem ) {
  2508. // http://www.w3.org/TR/selectors/#empty-pseudo
  2509. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  2510. // but not by others (comment: 8; processing instruction: 7; etc.)
  2511. // nodeType < 6 works because attributes (2) do not appear as children
  2512. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  2513. if ( elem.nodeType < 6 ) {
  2514. return false;
  2515. }
  2516. }
  2517. return true;
  2518. },
  2519. "parent": function( elem ) {
  2520. return !Expr.pseudos["empty"]( elem );
  2521. },
  2522. // Element/input types
  2523. "header": function( elem ) {
  2524. return rheader.test( elem.nodeName );
  2525. },
  2526. "input": function( elem ) {
  2527. return rinputs.test( elem.nodeName );
  2528. },
  2529. "button": function( elem ) {
  2530. var name = elem.nodeName.toLowerCase();
  2531. return name === "input" && elem.type === "button" || name === "button";
  2532. },
  2533. "text": function( elem ) {
  2534. var attr;
  2535. return elem.nodeName.toLowerCase() === "input" &&
  2536. elem.type === "text" &&
  2537. // Support: IE<8
  2538. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  2539. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  2540. },
  2541. // Position-in-collection
  2542. "first": createPositionalPseudo(function() {
  2543. return [ 0 ];
  2544. }),
  2545. "last": createPositionalPseudo(function( matchIndexes, length ) {
  2546. return [ length - 1 ];
  2547. }),
  2548. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2549. return [ argument < 0 ? argument + length : argument ];
  2550. }),
  2551. "even": createPositionalPseudo(function( matchIndexes, length ) {
  2552. var i = 0;
  2553. for ( ; i < length; i += 2 ) {
  2554. matchIndexes.push( i );
  2555. }
  2556. return matchIndexes;
  2557. }),
  2558. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  2559. var i = 1;
  2560. for ( ; i < length; i += 2 ) {
  2561. matchIndexes.push( i );
  2562. }
  2563. return matchIndexes;
  2564. }),
  2565. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2566. var i = argument < 0 ? argument + length : argument;
  2567. for ( ; --i >= 0; ) {
  2568. matchIndexes.push( i );
  2569. }
  2570. return matchIndexes;
  2571. }),
  2572. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2573. var i = argument < 0 ? argument + length : argument;
  2574. for ( ; ++i < length; ) {
  2575. matchIndexes.push( i );
  2576. }
  2577. return matchIndexes;
  2578. })
  2579. }
  2580. };
  2581. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  2582. // Add button/input type pseudos
  2583. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  2584. Expr.pseudos[ i ] = createInputPseudo( i );
  2585. }
  2586. for ( i in { submit: true, reset: true } ) {
  2587. Expr.pseudos[ i ] = createButtonPseudo( i );
  2588. }
  2589. // Easy API for creating new setFilters
  2590. function setFilters() {}
  2591. setFilters.prototype = Expr.filters = Expr.pseudos;
  2592. Expr.setFilters = new setFilters();
  2593. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  2594. var matched, match, tokens, type,
  2595. soFar, groups, preFilters,
  2596. cached = tokenCache[ selector + " " ];
  2597. if ( cached ) {
  2598. return parseOnly ? 0 : cached.slice( 0 );
  2599. }
  2600. soFar = selector;
  2601. groups = [];
  2602. preFilters = Expr.preFilter;
  2603. while ( soFar ) {
  2604. // Comma and first run
  2605. if ( !matched || (match = rcomma.exec( soFar )) ) {
  2606. if ( match ) {
  2607. // Don't consume trailing commas as valid
  2608. soFar = soFar.slice( match[0].length ) || soFar;
  2609. }
  2610. groups.push( (tokens = []) );
  2611. }
  2612. matched = false;
  2613. // Combinators
  2614. if ( (match = rcombinators.exec( soFar )) ) {
  2615. matched = match.shift();
  2616. tokens.push({
  2617. value: matched,
  2618. // Cast descendant combinators to space
  2619. type: match[0].replace( rtrim, " " )
  2620. });
  2621. soFar = soFar.slice( matched.length );
  2622. }
  2623. // Filters
  2624. for ( type in Expr.filter ) {
  2625. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  2626. (match = preFilters[ type ]( match ))) ) {
  2627. matched = match.shift();
  2628. tokens.push({
  2629. value: matched,
  2630. type: type,
  2631. matches: match
  2632. });
  2633. soFar = soFar.slice( matched.length );
  2634. }
  2635. }
  2636. if ( !matched ) {
  2637. break;
  2638. }
  2639. }
  2640. // Return the length of the invalid excess
  2641. // if we're just parsing
  2642. // Otherwise, throw an error or return tokens
  2643. return parseOnly ?
  2644. soFar.length :
  2645. soFar ?
  2646. Sizzle.error( selector ) :
  2647. // Cache the tokens
  2648. tokenCache( selector, groups ).slice( 0 );
  2649. };
  2650. function toSelector( tokens ) {
  2651. var i = 0,
  2652. len = tokens.length,
  2653. selector = "";
  2654. for ( ; i < len; i++ ) {
  2655. selector += tokens[i].value;
  2656. }
  2657. return selector;
  2658. }
  2659. function addCombinator( matcher, combinator, base ) {
  2660. var dir = combinator.dir,
  2661. skip = combinator.next,
  2662. key = skip || dir,
  2663. checkNonElements = base && key === "parentNode",
  2664. doneName = done++;
  2665. return combinator.first ?
  2666. // Check against closest ancestor/preceding element
  2667. function( elem, context, xml ) {
  2668. while ( (elem = elem[ dir ]) ) {
  2669. if ( elem.nodeType === 1 || checkNonElements ) {
  2670. return matcher( elem, context, xml );
  2671. }
  2672. }
  2673. return false;
  2674. } :
  2675. // Check against all ancestor/preceding elements
  2676. function( elem, context, xml ) {
  2677. var oldCache, uniqueCache, outerCache,
  2678. newCache = [ dirruns, doneName ];
  2679. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  2680. if ( xml ) {
  2681. while ( (elem = elem[ dir ]) ) {
  2682. if ( elem.nodeType === 1 || checkNonElements ) {
  2683. if ( matcher( elem, context, xml ) ) {
  2684. return true;
  2685. }
  2686. }
  2687. }
  2688. } else {
  2689. while ( (elem = elem[ dir ]) ) {
  2690. if ( elem.nodeType === 1 || checkNonElements ) {
  2691. outerCache = elem[ expando ] || (elem[ expando ] = {});
  2692. // Support: IE <9 only
  2693. // Defend against cloned attroperties (jQuery gh-1709)
  2694. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  2695. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  2696. elem = elem[ dir ] || elem;
  2697. } else if ( (oldCache = uniqueCache[ key ]) &&
  2698. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  2699. // Assign to newCache so results back-propagate to previous elements
  2700. return (newCache[ 2 ] = oldCache[ 2 ]);
  2701. } else {
  2702. // Reuse newcache so results back-propagate to previous elements
  2703. uniqueCache[ key ] = newCache;
  2704. // A match means we're done; a fail means we have to keep checking
  2705. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  2706. return true;
  2707. }
  2708. }
  2709. }
  2710. }
  2711. }
  2712. return false;
  2713. };
  2714. }
  2715. function elementMatcher( matchers ) {
  2716. return matchers.length > 1 ?
  2717. function( elem, context, xml ) {
  2718. var i = matchers.length;
  2719. while ( i-- ) {
  2720. if ( !matchers[i]( elem, context, xml ) ) {
  2721. return false;
  2722. }
  2723. }
  2724. return true;
  2725. } :
  2726. matchers[0];
  2727. }
  2728. function multipleContexts( selector, contexts, results ) {
  2729. var i = 0,
  2730. len = contexts.length;
  2731. for ( ; i < len; i++ ) {
  2732. Sizzle( selector, contexts[i], results );
  2733. }
  2734. return results;
  2735. }
  2736. function condense( unmatched, map, filter, context, xml ) {
  2737. var elem,
  2738. newUnmatched = [],
  2739. i = 0,
  2740. len = unmatched.length,
  2741. mapped = map != null;
  2742. for ( ; i < len; i++ ) {
  2743. if ( (elem = unmatched[i]) ) {
  2744. if ( !filter || filter( elem, context, xml ) ) {
  2745. newUnmatched.push( elem );
  2746. if ( mapped ) {
  2747. map.push( i );
  2748. }
  2749. }
  2750. }
  2751. }
  2752. return newUnmatched;
  2753. }
  2754. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  2755. if ( postFilter && !postFilter[ expando ] ) {
  2756. postFilter = setMatcher( postFilter );
  2757. }
  2758. if ( postFinder && !postFinder[ expando ] ) {
  2759. postFinder = setMatcher( postFinder, postSelector );
  2760. }
  2761. return markFunction(function( seed, results, context, xml ) {
  2762. var temp, i, elem,
  2763. preMap = [],
  2764. postMap = [],
  2765. preexisting = results.length,
  2766. // Get initial elements from seed or context
  2767. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  2768. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  2769. matcherIn = preFilter && ( seed || !selector ) ?
  2770. condense( elems, preMap, preFilter, context, xml ) :
  2771. elems,
  2772. matcherOut = matcher ?
  2773. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  2774. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  2775. // ...intermediate processing is necessary
  2776. [] :
  2777. // ...otherwise use results directly
  2778. results :
  2779. matcherIn;
  2780. // Find primary matches
  2781. if ( matcher ) {
  2782. matcher( matcherIn, matcherOut, context, xml );
  2783. }
  2784. // Apply postFilter
  2785. if ( postFilter ) {
  2786. temp = condense( matcherOut, postMap );
  2787. postFilter( temp, [], context, xml );
  2788. // Un-match failing elements by moving them back to matcherIn
  2789. i = temp.length;
  2790. while ( i-- ) {
  2791. if ( (elem = temp[i]) ) {
  2792. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  2793. }
  2794. }
  2795. }
  2796. if ( seed ) {
  2797. if ( postFinder || preFilter ) {
  2798. if ( postFinder ) {
  2799. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  2800. temp = [];
  2801. i = matcherOut.length;
  2802. while ( i-- ) {
  2803. if ( (elem = matcherOut[i]) ) {
  2804. // Restore matcherIn since elem is not yet a final match
  2805. temp.push( (matcherIn[i] = elem) );
  2806. }
  2807. }
  2808. postFinder( null, (matcherOut = []), temp, xml );
  2809. }
  2810. // Move matched elements from seed to results to keep them synchronized
  2811. i = matcherOut.length;
  2812. while ( i-- ) {
  2813. if ( (elem = matcherOut[i]) &&
  2814. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  2815. seed[temp] = !(results[temp] = elem);
  2816. }
  2817. }
  2818. }
  2819. // Add elements to results, through postFinder if defined
  2820. } else {
  2821. matcherOut = condense(
  2822. matcherOut === results ?
  2823. matcherOut.splice( preexisting, matcherOut.length ) :
  2824. matcherOut
  2825. );
  2826. if ( postFinder ) {
  2827. postFinder( null, results, matcherOut, xml );
  2828. } else {
  2829. push.apply( results, matcherOut );
  2830. }
  2831. }
  2832. });
  2833. }
  2834. function matcherFromTokens( tokens ) {
  2835. var checkContext, matcher, j,
  2836. len = tokens.length,
  2837. leadingRelative = Expr.relative[ tokens[0].type ],
  2838. implicitRelative = leadingRelative || Expr.relative[" "],
  2839. i = leadingRelative ? 1 : 0,
  2840. // The foundational matcher ensures that elements are reachable from top-level context(s)
  2841. matchContext = addCombinator( function( elem ) {
  2842. return elem === checkContext;
  2843. }, implicitRelative, true ),
  2844. matchAnyContext = addCombinator( function( elem ) {
  2845. return indexOf( checkContext, elem ) > -1;
  2846. }, implicitRelative, true ),
  2847. matchers = [ function( elem, context, xml ) {
  2848. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  2849. (checkContext = context).nodeType ?
  2850. matchContext( elem, context, xml ) :
  2851. matchAnyContext( elem, context, xml ) );
  2852. // Avoid hanging onto element (issue #299)
  2853. checkContext = null;
  2854. return ret;
  2855. } ];
  2856. for ( ; i < len; i++ ) {
  2857. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  2858. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  2859. } else {
  2860. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  2861. // Return special upon seeing a positional matcher
  2862. if ( matcher[ expando ] ) {
  2863. // Find the next relative operator (if any) for proper handling
  2864. j = ++i;
  2865. for ( ; j < len; j++ ) {
  2866. if ( Expr.relative[ tokens[j].type ] ) {
  2867. break;
  2868. }
  2869. }
  2870. return setMatcher(
  2871. i > 1 && elementMatcher( matchers ),
  2872. i > 1 && toSelector(
  2873. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2874. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  2875. ).replace( rtrim, "$1" ),
  2876. matcher,
  2877. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  2878. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  2879. j < len && toSelector( tokens )
  2880. );
  2881. }
  2882. matchers.push( matcher );
  2883. }
  2884. }
  2885. return elementMatcher( matchers );
  2886. }
  2887. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  2888. var bySet = setMatchers.length > 0,
  2889. byElement = elementMatchers.length > 0,
  2890. superMatcher = function( seed, context, xml, results, outermost ) {
  2891. var elem, j, matcher,
  2892. matchedCount = 0,
  2893. i = "0",
  2894. unmatched = seed && [],
  2895. setMatched = [],
  2896. contextBackup = outermostContext,
  2897. // We must always have either seed elements or outermost context
  2898. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  2899. // Use integer dirruns iff this is the outermost matcher
  2900. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  2901. len = elems.length;
  2902. if ( outermost ) {
  2903. outermostContext = context === document || context || outermost;
  2904. }
  2905. // Add elements passing elementMatchers directly to results
  2906. // Support: IE<9, Safari
  2907. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  2908. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  2909. if ( byElement && elem ) {
  2910. j = 0;
  2911. if ( !context && elem.ownerDocument !== document ) {
  2912. setDocument( elem );
  2913. xml = !documentIsHTML;
  2914. }
  2915. while ( (matcher = elementMatchers[j++]) ) {
  2916. if ( matcher( elem, context || document, xml) ) {
  2917. results.push( elem );
  2918. break;
  2919. }
  2920. }
  2921. if ( outermost ) {
  2922. dirruns = dirrunsUnique;
  2923. }
  2924. }
  2925. // Track unmatched elements for set filters
  2926. if ( bySet ) {
  2927. // They will have gone through all possible matchers
  2928. if ( (elem = !matcher && elem) ) {
  2929. matchedCount--;
  2930. }
  2931. // Lengthen the array for every element, matched or not
  2932. if ( seed ) {
  2933. unmatched.push( elem );
  2934. }
  2935. }
  2936. }
  2937. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  2938. // makes the latter nonnegative.
  2939. matchedCount += i;
  2940. // Apply set filters to unmatched elements
  2941. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  2942. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  2943. // no element matchers and no seed.
  2944. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  2945. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  2946. // numerically zero.
  2947. if ( bySet && i !== matchedCount ) {
  2948. j = 0;
  2949. while ( (matcher = setMatchers[j++]) ) {
  2950. matcher( unmatched, setMatched, context, xml );
  2951. }
  2952. if ( seed ) {
  2953. // Reintegrate element matches to eliminate the need for sorting
  2954. if ( matchedCount > 0 ) {
  2955. while ( i-- ) {
  2956. if ( !(unmatched[i] || setMatched[i]) ) {
  2957. setMatched[i] = pop.call( results );
  2958. }
  2959. }
  2960. }
  2961. // Discard index placeholder values to get only actual matches
  2962. setMatched = condense( setMatched );
  2963. }
  2964. // Add matches to results
  2965. push.apply( results, setMatched );
  2966. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2967. if ( outermost && !seed && setMatched.length > 0 &&
  2968. ( matchedCount + setMatchers.length ) > 1 ) {
  2969. Sizzle.uniqueSort( results );
  2970. }
  2971. }
  2972. // Override manipulation of globals by nested matchers
  2973. if ( outermost ) {
  2974. dirruns = dirrunsUnique;
  2975. outermostContext = contextBackup;
  2976. }
  2977. return unmatched;
  2978. };
  2979. return bySet ?
  2980. markFunction( superMatcher ) :
  2981. superMatcher;
  2982. }
  2983. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  2984. var i,
  2985. setMatchers = [],
  2986. elementMatchers = [],
  2987. cached = compilerCache[ selector + " " ];
  2988. if ( !cached ) {
  2989. // Generate a function of recursive functions that can be used to check each element
  2990. if ( !match ) {
  2991. match = tokenize( selector );
  2992. }
  2993. i = match.length;
  2994. while ( i-- ) {
  2995. cached = matcherFromTokens( match[i] );
  2996. if ( cached[ expando ] ) {
  2997. setMatchers.push( cached );
  2998. } else {
  2999. elementMatchers.push( cached );
  3000. }
  3001. }
  3002. // Cache the compiled function
  3003. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  3004. // Save selector and tokenization
  3005. cached.selector = selector;
  3006. }
  3007. return cached;
  3008. };
  3009. /**
  3010. * A low-level selection function that works with Sizzle's compiled
  3011. * selector functions
  3012. * @param {String|Function} selector A selector or a pre-compiled
  3013. * selector function built with Sizzle.compile
  3014. * @param {Element} context
  3015. * @param {Array} [results]
  3016. * @param {Array} [seed] A set of elements to match against
  3017. */
  3018. select = Sizzle.select = function( selector, context, results, seed ) {
  3019. var i, tokens, token, type, find,
  3020. compiled = typeof selector === "function" && selector,
  3021. match = !seed && tokenize( (selector = compiled.selector || selector) );
  3022. results = results || [];
  3023. // Try to minimize operations if there is only one selector in the list and no seed
  3024. // (the latter of which guarantees us context)
  3025. if ( match.length === 1 ) {
  3026. // Reduce context if the leading compound selector is an ID
  3027. tokens = match[0] = match[0].slice( 0 );
  3028. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  3029. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  3030. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  3031. if ( !context ) {
  3032. return results;
  3033. // Precompiled matchers will still verify ancestry, so step up a level
  3034. } else if ( compiled ) {
  3035. context = context.parentNode;
  3036. }
  3037. selector = selector.slice( tokens.shift().value.length );
  3038. }
  3039. // Fetch a seed set for right-to-left matching
  3040. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  3041. while ( i-- ) {
  3042. token = tokens[i];
  3043. // Abort if we hit a combinator
  3044. if ( Expr.relative[ (type = token.type) ] ) {
  3045. break;
  3046. }
  3047. if ( (find = Expr.find[ type ]) ) {
  3048. // Search, expanding context for leading sibling combinators
  3049. if ( (seed = find(
  3050. token.matches[0].replace( runescape, funescape ),
  3051. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  3052. )) ) {
  3053. // If seed is empty or no tokens remain, we can return early
  3054. tokens.splice( i, 1 );
  3055. selector = seed.length && toSelector( tokens );
  3056. if ( !selector ) {
  3057. push.apply( results, seed );
  3058. return results;
  3059. }
  3060. break;
  3061. }
  3062. }
  3063. }
  3064. }
  3065. // Compile and execute a filtering function if one is not provided
  3066. // Provide `match` to avoid retokenization if we modified the selector above
  3067. ( compiled || compile( selector, match ) )(
  3068. seed,
  3069. context,
  3070. !documentIsHTML,
  3071. results,
  3072. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  3073. );
  3074. return results;
  3075. };
  3076. // One-time assignments
  3077. // Sort stability
  3078. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  3079. // Support: Chrome 14-35+
  3080. // Always assume duplicates if they aren't passed to the comparison function
  3081. support.detectDuplicates = !!hasDuplicate;
  3082. // Initialize against the default document
  3083. setDocument();
  3084. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  3085. // Detached nodes confoundingly follow *each other*
  3086. support.sortDetached = assert(function( el ) {
  3087. // Should return 1, but returns 4 (following)
  3088. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  3089. });
  3090. // Support: IE<8
  3091. // Prevent attribute/property "interpolation"
  3092. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  3093. if ( !assert(function( el ) {
  3094. el.innerHTML = "<a href='#'></a>";
  3095. return el.firstChild.getAttribute("href") === "#" ;
  3096. }) ) {
  3097. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  3098. if ( !isXML ) {
  3099. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  3100. }
  3101. });
  3102. }
  3103. // Support: IE<9
  3104. // Use defaultValue in place of getAttribute("value")
  3105. if ( !support.attributes || !assert(function( el ) {
  3106. el.innerHTML = "<input/>";
  3107. el.firstChild.setAttribute( "value", "" );
  3108. return el.firstChild.getAttribute( "value" ) === "";
  3109. }) ) {
  3110. addHandle( "value", function( elem, name, isXML ) {
  3111. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  3112. return elem.defaultValue;
  3113. }
  3114. });
  3115. }
  3116. // Support: IE<9
  3117. // Use getAttributeNode to fetch booleans when getAttribute lies
  3118. if ( !assert(function( el ) {
  3119. return el.getAttribute("disabled") == null;
  3120. }) ) {
  3121. addHandle( booleans, function( elem, name, isXML ) {
  3122. var val;
  3123. if ( !isXML ) {
  3124. return elem[ name ] === true ? name.toLowerCase() :
  3125. (val = elem.getAttributeNode( name )) && val.specified ?
  3126. val.value :
  3127. null;
  3128. }
  3129. });
  3130. }
  3131. return Sizzle;
  3132. })( window );
  3133. jQuery.find = Sizzle;
  3134. jQuery.expr = Sizzle.selectors;
  3135. // Deprecated
  3136. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  3137. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  3138. jQuery.text = Sizzle.getText;
  3139. jQuery.isXMLDoc = Sizzle.isXML;
  3140. jQuery.contains = Sizzle.contains;
  3141. jQuery.escapeSelector = Sizzle.escape;
  3142. var dir = function( elem, dir, until ) {
  3143. var matched = [],
  3144. truncate = until !== undefined;
  3145. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  3146. if ( elem.nodeType === 1 ) {
  3147. if ( truncate && jQuery( elem ).is( until ) ) {
  3148. break;
  3149. }
  3150. matched.push( elem );
  3151. }
  3152. }
  3153. return matched;
  3154. };
  3155. var siblings = function( n, elem ) {
  3156. var matched = [];
  3157. for ( ; n; n = n.nextSibling ) {
  3158. if ( n.nodeType === 1 && n !== elem ) {
  3159. matched.push( n );
  3160. }
  3161. }
  3162. return matched;
  3163. };
  3164. var rneedsContext = jQuery.expr.match.needsContext;
  3165. function nodeName( elem, name ) {
  3166. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  3167. };
  3168. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  3169. var risSimple = /^.[^:#\[\.,]*$/;
  3170. // Implement the identical functionality for filter and not
  3171. function winnow( elements, qualifier, not ) {
  3172. if ( jQuery.isFunction( qualifier ) ) {
  3173. return jQuery.grep( elements, function( elem, i ) {
  3174. return !!qualifier.call( elem, i, elem ) !== not;
  3175. } );
  3176. }
  3177. // Single element
  3178. if ( qualifier.nodeType ) {
  3179. return jQuery.grep( elements, function( elem ) {
  3180. return ( elem === qualifier ) !== not;
  3181. } );
  3182. }
  3183. // Arraylike of elements (jQuery, arguments, Array)
  3184. if ( typeof qualifier !== "string" ) {
  3185. return jQuery.grep( elements, function( elem ) {
  3186. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  3187. } );
  3188. }
  3189. // Simple selector that can be filtered directly, removing non-Elements
  3190. if ( risSimple.test( qualifier ) ) {
  3191. return jQuery.filter( qualifier, elements, not );
  3192. }
  3193. // Complex selector, compare the two sets, removing non-Elements
  3194. qualifier = jQuery.filter( qualifier, elements );
  3195. return jQuery.grep( elements, function( elem ) {
  3196. return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
  3197. } );
  3198. }
  3199. jQuery.filter = function( expr, elems, not ) {
  3200. var elem = elems[ 0 ];
  3201. if ( not ) {
  3202. expr = ":not(" + expr + ")";
  3203. }
  3204. if ( elems.length === 1 && elem.nodeType === 1 ) {
  3205. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  3206. }
  3207. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  3208. return elem.nodeType === 1;
  3209. } ) );
  3210. };
  3211. jQuery.fn.extend( {
  3212. find: function( selector ) {
  3213. var i, ret,
  3214. len = this.length,
  3215. self = this;
  3216. if ( typeof selector !== "string" ) {
  3217. return this.pushStack( jQuery( selector ).filter( function() {
  3218. for ( i = 0; i < len; i++ ) {
  3219. if ( jQuery.contains( self[ i ], this ) ) {
  3220. return true;
  3221. }
  3222. }
  3223. } ) );
  3224. }
  3225. ret = this.pushStack( [] );
  3226. for ( i = 0; i < len; i++ ) {
  3227. jQuery.find( selector, self[ i ], ret );
  3228. }
  3229. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  3230. },
  3231. filter: function( selector ) {
  3232. return this.pushStack( winnow( this, selector || [], false ) );
  3233. },
  3234. not: function( selector ) {
  3235. return this.pushStack( winnow( this, selector || [], true ) );
  3236. },
  3237. is: function( selector ) {
  3238. return !!winnow(
  3239. this,
  3240. // If this is a positional/relative selector, check membership in the returned set
  3241. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  3242. typeof selector === "string" && rneedsContext.test( selector ) ?
  3243. jQuery( selector ) :
  3244. selector || [],
  3245. false
  3246. ).length;
  3247. }
  3248. } );
  3249. // Initialize a jQuery object
  3250. // A central reference to the root jQuery(document)
  3251. var rootjQuery,
  3252. // A simple way to check for HTML strings
  3253. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  3254. // Strict HTML recognition (#11290: must start with <)
  3255. // Shortcut simple #id case for speed
  3256. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  3257. init = jQuery.fn.init = function( selector, context, root ) {
  3258. var match, elem;
  3259. // HANDLE: $(""), $(null), $(undefined), $(false)
  3260. if ( !selector ) {
  3261. return this;
  3262. }
  3263. // Method init() accepts an alternate rootjQuery
  3264. // so migrate can support jQuery.sub (gh-2101)
  3265. root = root || rootjQuery;
  3266. // Handle HTML strings
  3267. if ( typeof selector === "string" ) {
  3268. if ( selector[ 0 ] === "<" &&
  3269. selector[ selector.length - 1 ] === ">" &&
  3270. selector.length >= 3 ) {
  3271. // Assume that strings that start and end with <> are HTML and skip the regex check
  3272. match = [ null, selector, null ];
  3273. } else {
  3274. match = rquickExpr.exec( selector );
  3275. }
  3276. // Match html or make sure no context is specified for #id
  3277. if ( match && ( match[ 1 ] || !context ) ) {
  3278. // HANDLE: $(html) -> $(array)
  3279. if ( match[ 1 ] ) {
  3280. context = context instanceof jQuery ? context[ 0 ] : context;
  3281. // Option to run scripts is true for back-compat
  3282. // Intentionally let the error be thrown if parseHTML is not present
  3283. jQuery.merge( this, jQuery.parseHTML(
  3284. match[ 1 ],
  3285. context && context.nodeType ? context.ownerDocument || context : document,
  3286. true
  3287. ) );
  3288. // HANDLE: $(html, props)
  3289. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  3290. for ( match in context ) {
  3291. // Properties of context are called as methods if possible
  3292. if ( jQuery.isFunction( this[ match ] ) ) {
  3293. this[ match ]( context[ match ] );
  3294. // ...and otherwise set as attributes
  3295. } else {
  3296. this.attr( match, context[ match ] );
  3297. }
  3298. }
  3299. }
  3300. return this;
  3301. // HANDLE: $(#id)
  3302. } else {
  3303. elem = document.getElementById( match[ 2 ] );
  3304. if ( elem ) {
  3305. // Inject the element directly into the jQuery object
  3306. this[ 0 ] = elem;
  3307. this.length = 1;
  3308. }
  3309. return this;
  3310. }
  3311. // HANDLE: $(expr, $(...))
  3312. } else if ( !context || context.jquery ) {
  3313. return ( context || root ).find( selector );
  3314. // HANDLE: $(expr, context)
  3315. // (which is just equivalent to: $(context).find(expr)
  3316. } else {
  3317. return this.constructor( context ).find( selector );
  3318. }
  3319. // HANDLE: $(DOMElement)
  3320. } else if ( selector.nodeType ) {
  3321. this[ 0 ] = selector;
  3322. this.length = 1;
  3323. return this;
  3324. // HANDLE: $(function)
  3325. // Shortcut for document ready
  3326. } else if ( jQuery.isFunction( selector ) ) {
  3327. return root.ready !== undefined ?
  3328. root.ready( selector ) :
  3329. // Execute immediately if ready is not present
  3330. selector( jQuery );
  3331. }
  3332. return jQuery.makeArray( selector, this );
  3333. };
  3334. // Give the init function the jQuery prototype for later instantiation
  3335. init.prototype = jQuery.fn;
  3336. // Initialize central reference
  3337. rootjQuery = jQuery( document );
  3338. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  3339. // Methods guaranteed to produce a unique set when starting from a unique set
  3340. guaranteedUnique = {
  3341. children: true,
  3342. contents: true,
  3343. next: true,
  3344. prev: true
  3345. };
  3346. jQuery.fn.extend( {
  3347. has: function( target ) {
  3348. var targets = jQuery( target, this ),
  3349. l = targets.length;
  3350. return this.filter( function() {
  3351. var i = 0;
  3352. for ( ; i < l; i++ ) {
  3353. if ( jQuery.contains( this, targets[ i ] ) ) {
  3354. return true;
  3355. }
  3356. }
  3357. } );
  3358. },
  3359. closest: function( selectors, context ) {
  3360. var cur,
  3361. i = 0,
  3362. l = this.length,
  3363. matched = [],
  3364. targets = typeof selectors !== "string" && jQuery( selectors );
  3365. // Positional selectors never match, since there's no _selection_ context
  3366. if ( !rneedsContext.test( selectors ) ) {
  3367. for ( ; i < l; i++ ) {
  3368. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  3369. // Always skip document fragments
  3370. if ( cur.nodeType < 11 && ( targets ?
  3371. targets.index( cur ) > -1 :
  3372. // Don't pass non-elements to Sizzle
  3373. cur.nodeType === 1 &&
  3374. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  3375. matched.push( cur );
  3376. break;
  3377. }
  3378. }
  3379. }
  3380. }
  3381. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  3382. },
  3383. // Determine the position of an element within the set
  3384. index: function( elem ) {
  3385. // No argument, return index in parent
  3386. if ( !elem ) {
  3387. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  3388. }
  3389. // Index in selector
  3390. if ( typeof elem === "string" ) {
  3391. return indexOf.call( jQuery( elem ), this[ 0 ] );
  3392. }
  3393. // Locate the position of the desired element
  3394. return indexOf.call( this,
  3395. // If it receives a jQuery object, the first element is used
  3396. elem.jquery ? elem[ 0 ] : elem
  3397. );
  3398. },
  3399. add: function( selector, context ) {
  3400. return this.pushStack(
  3401. jQuery.uniqueSort(
  3402. jQuery.merge( this.get(), jQuery( selector, context ) )
  3403. )
  3404. );
  3405. },
  3406. addBack: function( selector ) {
  3407. return this.add( selector == null ?
  3408. this.prevObject : this.prevObject.filter( selector )
  3409. );
  3410. }
  3411. } );
  3412. function sibling( cur, dir ) {
  3413. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  3414. return cur;
  3415. }
  3416. jQuery.each( {
  3417. parent: function( elem ) {
  3418. var parent = elem.parentNode;
  3419. return parent && parent.nodeType !== 11 ? parent : null;
  3420. },
  3421. parents: function( elem ) {
  3422. return dir( elem, "parentNode" );
  3423. },
  3424. parentsUntil: function( elem, i, until ) {
  3425. return dir( elem, "parentNode", until );
  3426. },
  3427. next: function( elem ) {
  3428. return sibling( elem, "nextSibling" );
  3429. },
  3430. prev: function( elem ) {
  3431. return sibling( elem, "previousSibling" );
  3432. },
  3433. nextAll: function( elem ) {
  3434. return dir( elem, "nextSibling" );
  3435. },
  3436. prevAll: function( elem ) {
  3437. return dir( elem, "previousSibling" );
  3438. },
  3439. nextUntil: function( elem, i, until ) {
  3440. return dir( elem, "nextSibling", until );
  3441. },
  3442. prevUntil: function( elem, i, until ) {
  3443. return dir( elem, "previousSibling", until );
  3444. },
  3445. siblings: function( elem ) {
  3446. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  3447. },
  3448. children: function( elem ) {
  3449. return siblings( elem.firstChild );
  3450. },
  3451. contents: function( elem ) {
  3452. if ( nodeName( elem, "iframe" ) ) {
  3453. return elem.contentDocument;
  3454. }
  3455. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  3456. // Treat the template element as a regular one in browsers that
  3457. // don't support it.
  3458. if ( nodeName( elem, "template" ) ) {
  3459. elem = elem.content || elem;
  3460. }
  3461. return jQuery.merge( [], elem.childNodes );
  3462. }
  3463. }, function( name, fn ) {
  3464. jQuery.fn[ name ] = function( until, selector ) {
  3465. var matched = jQuery.map( this, fn, until );
  3466. if ( name.slice( -5 ) !== "Until" ) {
  3467. selector = until;
  3468. }
  3469. if ( selector && typeof selector === "string" ) {
  3470. matched = jQuery.filter( selector, matched );
  3471. }
  3472. if ( this.length > 1 ) {
  3473. // Remove duplicates
  3474. if ( !guaranteedUnique[ name ] ) {
  3475. jQuery.uniqueSort( matched );
  3476. }
  3477. // Reverse order for parents* and prev-derivatives
  3478. if ( rparentsprev.test( name ) ) {
  3479. matched.reverse();
  3480. }
  3481. }
  3482. return this.pushStack( matched );
  3483. };
  3484. } );
  3485. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  3486. // Convert String-formatted options into Object-formatted ones
  3487. function createOptions( options ) {
  3488. var object = {};
  3489. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  3490. object[ flag ] = true;
  3491. } );
  3492. return object;
  3493. }
  3494. /*
  3495. * Create a callback list using the following parameters:
  3496. *
  3497. * options: an optional list of space-separated options that will change how
  3498. * the callback list behaves or a more traditional option object
  3499. *
  3500. * By default a callback list will act like an event callback list and can be
  3501. * "fired" multiple times.
  3502. *
  3503. * Possible options:
  3504. *
  3505. * once: will ensure the callback list can only be fired once (like a Deferred)
  3506. *
  3507. * memory: will keep track of previous values and will call any callback added
  3508. * after the list has been fired right away with the latest "memorized"
  3509. * values (like a Deferred)
  3510. *
  3511. * unique: will ensure a callback can only be added once (no duplicate in the list)
  3512. *
  3513. * stopOnFalse: interrupt callings when a callback returns false
  3514. *
  3515. */
  3516. jQuery.Callbacks = function( options ) {
  3517. // Convert options from String-formatted to Object-formatted if needed
  3518. // (we check in cache first)
  3519. options = typeof options === "string" ?
  3520. createOptions( options ) :
  3521. jQuery.extend( {}, options );
  3522. var // Flag to know if list is currently firing
  3523. firing,
  3524. // Last fire value for non-forgettable lists
  3525. memory,
  3526. // Flag to know if list was already fired
  3527. fired,
  3528. // Flag to prevent firing
  3529. locked,
  3530. // Actual callback list
  3531. list = [],
  3532. // Queue of execution data for repeatable lists
  3533. queue = [],
  3534. // Index of currently firing callback (modified by add/remove as needed)
  3535. firingIndex = -1,
  3536. // Fire callbacks
  3537. fire = function() {
  3538. // Enforce single-firing
  3539. locked = locked || options.once;
  3540. // Execute callbacks for all pending executions,
  3541. // respecting firingIndex overrides and runtime changes
  3542. fired = firing = true;
  3543. for ( ; queue.length; firingIndex = -1 ) {
  3544. memory = queue.shift();
  3545. while ( ++firingIndex < list.length ) {
  3546. // Run callback and check for early termination
  3547. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  3548. options.stopOnFalse ) {
  3549. // Jump to end and forget the data so .add doesn't re-fire
  3550. firingIndex = list.length;
  3551. memory = false;
  3552. }
  3553. }
  3554. }
  3555. // Forget the data if we're done with it
  3556. if ( !options.memory ) {
  3557. memory = false;
  3558. }
  3559. firing = false;
  3560. // Clean up if we're done firing for good
  3561. if ( locked ) {
  3562. // Keep an empty list if we have data for future add calls
  3563. if ( memory ) {
  3564. list = [];
  3565. // Otherwise, this object is spent
  3566. } else {
  3567. list = "";
  3568. }
  3569. }
  3570. },
  3571. // Actual Callbacks object
  3572. self = {
  3573. // Add a callback or a collection of callbacks to the list
  3574. add: function() {
  3575. if ( list ) {
  3576. // If we have memory from a past run, we should fire after adding
  3577. if ( memory && !firing ) {
  3578. firingIndex = list.length - 1;
  3579. queue.push( memory );
  3580. }
  3581. ( function add( args ) {
  3582. jQuery.each( args, function( _, arg ) {
  3583. if ( jQuery.isFunction( arg ) ) {
  3584. if ( !options.unique || !self.has( arg ) ) {
  3585. list.push( arg );
  3586. }
  3587. } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
  3588. // Inspect recursively
  3589. add( arg );
  3590. }
  3591. } );
  3592. } )( arguments );
  3593. if ( memory && !firing ) {
  3594. fire();
  3595. }
  3596. }
  3597. return this;
  3598. },
  3599. // Remove a callback from the list
  3600. remove: function() {
  3601. jQuery.each( arguments, function( _, arg ) {
  3602. var index;
  3603. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  3604. list.splice( index, 1 );
  3605. // Handle firing indexes
  3606. if ( index <= firingIndex ) {
  3607. firingIndex--;
  3608. }
  3609. }
  3610. } );
  3611. return this;
  3612. },
  3613. // Check if a given callback is in the list.
  3614. // If no argument is given, return whether or not list has callbacks attached.
  3615. has: function( fn ) {
  3616. return fn ?
  3617. jQuery.inArray( fn, list ) > -1 :
  3618. list.length > 0;
  3619. },
  3620. // Remove all callbacks from the list
  3621. empty: function() {
  3622. if ( list ) {
  3623. list = [];
  3624. }
  3625. return this;
  3626. },
  3627. // Disable .fire and .add
  3628. // Abort any current/pending executions
  3629. // Clear all callbacks and values
  3630. disable: function() {
  3631. locked = queue = [];
  3632. list = memory = "";
  3633. return this;
  3634. },
  3635. disabled: function() {
  3636. return !list;
  3637. },
  3638. // Disable .fire
  3639. // Also disable .add unless we have memory (since it would have no effect)
  3640. // Abort any pending executions
  3641. lock: function() {
  3642. locked = queue = [];
  3643. if ( !memory && !firing ) {
  3644. list = memory = "";
  3645. }
  3646. return this;
  3647. },
  3648. locked: function() {
  3649. return !!locked;
  3650. },
  3651. // Call all callbacks with the given context and arguments
  3652. fireWith: function( context, args ) {
  3653. if ( !locked ) {
  3654. args = args || [];
  3655. args = [ context, args.slice ? args.slice() : args ];
  3656. queue.push( args );
  3657. if ( !firing ) {
  3658. fire();
  3659. }
  3660. }
  3661. return this;
  3662. },
  3663. // Call all the callbacks with the given arguments
  3664. fire: function() {
  3665. self.fireWith( this, arguments );
  3666. return this;
  3667. },
  3668. // To know if the callbacks have already been called at least once
  3669. fired: function() {
  3670. return !!fired;
  3671. }
  3672. };
  3673. return self;
  3674. };
  3675. function Identity( v ) {
  3676. return v;
  3677. }
  3678. function Thrower( ex ) {
  3679. throw ex;
  3680. }
  3681. function adoptValue( value, resolve, reject, noValue ) {
  3682. var method;
  3683. try {
  3684. // Check for promise aspect first to privilege synchronous behavior
  3685. if ( value && jQuery.isFunction( ( method = value.promise ) ) ) {
  3686. method.call( value ).done( resolve ).fail( reject );
  3687. // Other thenables
  3688. } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) {
  3689. method.call( value, resolve, reject );
  3690. // Other non-thenables
  3691. } else {
  3692. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  3693. // * false: [ value ].slice( 0 ) => resolve( value )
  3694. // * true: [ value ].slice( 1 ) => resolve()
  3695. resolve.apply( undefined, [ value ].slice( noValue ) );
  3696. }
  3697. // For Promises/A+, convert exceptions into rejections
  3698. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  3699. // Deferred#then to conditionally suppress rejection.
  3700. } catch ( value ) {
  3701. // Support: Android 4.0 only
  3702. // Strict mode functions invoked without .call/.apply get global-object context
  3703. reject.apply( undefined, [ value ] );
  3704. }
  3705. }
  3706. jQuery.extend( {
  3707. Deferred: function( func ) {
  3708. var tuples = [
  3709. // action, add listener, callbacks,
  3710. // ... .then handlers, argument index, [final state]
  3711. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  3712. jQuery.Callbacks( "memory" ), 2 ],
  3713. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  3714. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  3715. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  3716. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  3717. ],
  3718. state = "pending",
  3719. promise = {
  3720. state: function() {
  3721. return state;
  3722. },
  3723. always: function() {
  3724. deferred.done( arguments ).fail( arguments );
  3725. return this;
  3726. },
  3727. "catch": function( fn ) {
  3728. return promise.then( null, fn );
  3729. },
  3730. // Keep pipe for back-compat
  3731. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  3732. var fns = arguments;
  3733. return jQuery.Deferred( function( newDefer ) {
  3734. jQuery.each( tuples, function( i, tuple ) {
  3735. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  3736. var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  3737. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  3738. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  3739. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  3740. deferred[ tuple[ 1 ] ]( function() {
  3741. var returned = fn && fn.apply( this, arguments );
  3742. if ( returned && jQuery.isFunction( returned.promise ) ) {
  3743. returned.promise()
  3744. .progress( newDefer.notify )
  3745. .done( newDefer.resolve )
  3746. .fail( newDefer.reject );
  3747. } else {
  3748. newDefer[ tuple[ 0 ] + "With" ](
  3749. this,
  3750. fn ? [ returned ] : arguments
  3751. );
  3752. }
  3753. } );
  3754. } );
  3755. fns = null;
  3756. } ).promise();
  3757. },
  3758. then: function( onFulfilled, onRejected, onProgress ) {
  3759. var maxDepth = 0;
  3760. function resolve( depth, deferred, handler, special ) {
  3761. return function() {
  3762. var that = this,
  3763. args = arguments,
  3764. mightThrow = function() {
  3765. var returned, then;
  3766. // Support: Promises/A+ section 2.3.3.3.3
  3767. // https://promisesaplus.com/#point-59
  3768. // Ignore double-resolution attempts
  3769. if ( depth < maxDepth ) {
  3770. return;
  3771. }
  3772. returned = handler.apply( that, args );
  3773. // Support: Promises/A+ section 2.3.1
  3774. // https://promisesaplus.com/#point-48
  3775. if ( returned === deferred.promise() ) {
  3776. throw new TypeError( "Thenable self-resolution" );
  3777. }
  3778. // Support: Promises/A+ sections 2.3.3.1, 3.5
  3779. // https://promisesaplus.com/#point-54
  3780. // https://promisesaplus.com/#point-75
  3781. // Retrieve `then` only once
  3782. then = returned &&
  3783. // Support: Promises/A+ section 2.3.4
  3784. // https://promisesaplus.com/#point-64
  3785. // Only check objects and functions for thenability
  3786. ( typeof returned === "object" ||
  3787. typeof returned === "function" ) &&
  3788. returned.then;
  3789. // Handle a returned thenable
  3790. if ( jQuery.isFunction( then ) ) {
  3791. // Special processors (notify) just wait for resolution
  3792. if ( special ) {
  3793. then.call(
  3794. returned,
  3795. resolve( maxDepth, deferred, Identity, special ),
  3796. resolve( maxDepth, deferred, Thrower, special )
  3797. );
  3798. // Normal processors (resolve) also hook into progress
  3799. } else {
  3800. // ...and disregard older resolution values
  3801. maxDepth++;
  3802. then.call(
  3803. returned,
  3804. resolve( maxDepth, deferred, Identity, special ),
  3805. resolve( maxDepth, deferred, Thrower, special ),
  3806. resolve( maxDepth, deferred, Identity,
  3807. deferred.notifyWith )
  3808. );
  3809. }
  3810. // Handle all other returned values
  3811. } else {
  3812. // Only substitute handlers pass on context
  3813. // and multiple values (non-spec behavior)
  3814. if ( handler !== Identity ) {
  3815. that = undefined;
  3816. args = [ returned ];
  3817. }
  3818. // Process the value(s)
  3819. // Default process is resolve
  3820. ( special || deferred.resolveWith )( that, args );
  3821. }
  3822. },
  3823. // Only normal processors (resolve) catch and reject exceptions
  3824. process = special ?
  3825. mightThrow :
  3826. function() {
  3827. try {
  3828. mightThrow();
  3829. } catch ( e ) {
  3830. if ( jQuery.Deferred.exceptionHook ) {
  3831. jQuery.Deferred.exceptionHook( e,
  3832. process.stackTrace );
  3833. }
  3834. // Support: Promises/A+ section 2.3.3.3.4.1
  3835. // https://promisesaplus.com/#point-61
  3836. // Ignore post-resolution exceptions
  3837. if ( depth + 1 >= maxDepth ) {
  3838. // Only substitute handlers pass on context
  3839. // and multiple values (non-spec behavior)
  3840. if ( handler !== Thrower ) {
  3841. that = undefined;
  3842. args = [ e ];
  3843. }
  3844. deferred.rejectWith( that, args );
  3845. }
  3846. }
  3847. };
  3848. // Support: Promises/A+ section 2.3.3.3.1
  3849. // https://promisesaplus.com/#point-57
  3850. // Re-resolve promises immediately to dodge false rejection from
  3851. // subsequent errors
  3852. if ( depth ) {
  3853. process();
  3854. } else {
  3855. // Call an optional hook to record the stack, in case of exception
  3856. // since it's otherwise lost when execution goes async
  3857. if ( jQuery.Deferred.getStackHook ) {
  3858. process.stackTrace = jQuery.Deferred.getStackHook();
  3859. }
  3860. window.setTimeout( process );
  3861. }
  3862. };
  3863. }
  3864. return jQuery.Deferred( function( newDefer ) {
  3865. // progress_handlers.add( ... )
  3866. tuples[ 0 ][ 3 ].add(
  3867. resolve(
  3868. 0,
  3869. newDefer,
  3870. jQuery.isFunction( onProgress ) ?
  3871. onProgress :
  3872. Identity,
  3873. newDefer.notifyWith
  3874. )
  3875. );
  3876. // fulfilled_handlers.add( ... )
  3877. tuples[ 1 ][ 3 ].add(
  3878. resolve(
  3879. 0,
  3880. newDefer,
  3881. jQuery.isFunction( onFulfilled ) ?
  3882. onFulfilled :
  3883. Identity
  3884. )
  3885. );
  3886. // rejected_handlers.add( ... )
  3887. tuples[ 2 ][ 3 ].add(
  3888. resolve(
  3889. 0,
  3890. newDefer,
  3891. jQuery.isFunction( onRejected ) ?
  3892. onRejected :
  3893. Thrower
  3894. )
  3895. );
  3896. } ).promise();
  3897. },
  3898. // Get a promise for this deferred
  3899. // If obj is provided, the promise aspect is added to the object
  3900. promise: function( obj ) {
  3901. return obj != null ? jQuery.extend( obj, promise ) : promise;
  3902. }
  3903. },
  3904. deferred = {};
  3905. // Add list-specific methods
  3906. jQuery.each( tuples, function( i, tuple ) {
  3907. var list = tuple[ 2 ],
  3908. stateString = tuple[ 5 ];
  3909. // promise.progress = list.add
  3910. // promise.done = list.add
  3911. // promise.fail = list.add
  3912. promise[ tuple[ 1 ] ] = list.add;
  3913. // Handle state
  3914. if ( stateString ) {
  3915. list.add(
  3916. function() {
  3917. // state = "resolved" (i.e., fulfilled)
  3918. // state = "rejected"
  3919. state = stateString;
  3920. },
  3921. // rejected_callbacks.disable
  3922. // fulfilled_callbacks.disable
  3923. tuples[ 3 - i ][ 2 ].disable,
  3924. // progress_callbacks.lock
  3925. tuples[ 0 ][ 2 ].lock
  3926. );
  3927. }
  3928. // progress_handlers.fire
  3929. // fulfilled_handlers.fire
  3930. // rejected_handlers.fire
  3931. list.add( tuple[ 3 ].fire );
  3932. // deferred.notify = function() { deferred.notifyWith(...) }
  3933. // deferred.resolve = function() { deferred.resolveWith(...) }
  3934. // deferred.reject = function() { deferred.rejectWith(...) }
  3935. deferred[ tuple[ 0 ] ] = function() {
  3936. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  3937. return this;
  3938. };
  3939. // deferred.notifyWith = list.fireWith
  3940. // deferred.resolveWith = list.fireWith
  3941. // deferred.rejectWith = list.fireWith
  3942. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  3943. } );
  3944. // Make the deferred a promise
  3945. promise.promise( deferred );
  3946. // Call given func if any
  3947. if ( func ) {
  3948. func.call( deferred, deferred );
  3949. }
  3950. // All done!
  3951. return deferred;
  3952. },
  3953. // Deferred helper
  3954. when: function( singleValue ) {
  3955. var
  3956. // count of uncompleted subordinates
  3957. remaining = arguments.length,
  3958. // count of unprocessed arguments
  3959. i = remaining,
  3960. // subordinate fulfillment data
  3961. resolveContexts = Array( i ),
  3962. resolveValues = slice.call( arguments ),
  3963. // the master Deferred
  3964. master = jQuery.Deferred(),
  3965. // subordinate callback factory
  3966. updateFunc = function( i ) {
  3967. return function( value ) {
  3968. resolveContexts[ i ] = this;
  3969. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  3970. if ( !( --remaining ) ) {
  3971. master.resolveWith( resolveContexts, resolveValues );
  3972. }
  3973. };
  3974. };
  3975. // Single- and empty arguments are adopted like Promise.resolve
  3976. if ( remaining <= 1 ) {
  3977. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  3978. !remaining );
  3979. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  3980. if ( master.state() === "pending" ||
  3981. jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  3982. return master.then();
  3983. }
  3984. }
  3985. // Multiple arguments are aggregated like Promise.all array elements
  3986. while ( i-- ) {
  3987. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  3988. }
  3989. return master.promise();
  3990. }
  3991. } );
  3992. // These usually indicate a programmer mistake during development,
  3993. // warn about them ASAP rather than swallowing them by default.
  3994. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  3995. jQuery.Deferred.exceptionHook = function( error, stack ) {
  3996. // Support: IE 8 - 9 only
  3997. // Console exists when dev tools are open, which can happen at any time
  3998. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  3999. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  4000. }
  4001. };
  4002. jQuery.readyException = function( error ) {
  4003. window.setTimeout( function() {
  4004. throw error;
  4005. } );
  4006. };
  4007. // The deferred used on DOM ready
  4008. var readyList = jQuery.Deferred();
  4009. jQuery.fn.ready = function( fn ) {
  4010. readyList
  4011. .then( fn )
  4012. // Wrap jQuery.readyException in a function so that the lookup
  4013. // happens at the time of error handling instead of callback
  4014. // registration.
  4015. .catch( function( error ) {
  4016. jQuery.readyException( error );
  4017. } );
  4018. return this;
  4019. };
  4020. jQuery.extend( {
  4021. // Is the DOM ready to be used? Set to true once it occurs.
  4022. isReady: false,
  4023. // A counter to track how many items to wait for before
  4024. // the ready event fires. See #6781
  4025. readyWait: 1,
  4026. // Handle when the DOM is ready
  4027. ready: function( wait ) {
  4028. // Abort if there are pending holds or we're already ready
  4029. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  4030. return;
  4031. }
  4032. // Remember that the DOM is ready
  4033. jQuery.isReady = true;
  4034. // If a normal DOM Ready event fired, decrement, and wait if need be
  4035. if ( wait !== true && --jQuery.readyWait > 0 ) {
  4036. return;
  4037. }
  4038. // If there are functions bound, to execute
  4039. readyList.resolveWith( document, [ jQuery ] );
  4040. }
  4041. } );
  4042. jQuery.ready.then = readyList.then;
  4043. // The ready event handler and self cleanup method
  4044. function completed() {
  4045. document.removeEventListener( "DOMContentLoaded", completed );
  4046. window.removeEventListener( "load", completed );
  4047. jQuery.ready();
  4048. }
  4049. // Catch cases where $(document).ready() is called
  4050. // after the browser event has already occurred.
  4051. // Support: IE <=9 - 10 only
  4052. // Older IE sometimes signals "interactive" too soon
  4053. if ( document.readyState === "complete" ||
  4054. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  4055. // Handle it asynchronously to allow scripts the opportunity to delay ready
  4056. window.setTimeout( jQuery.ready );
  4057. } else {
  4058. // Use the handy event callback
  4059. document.addEventListener( "DOMContentLoaded", completed );
  4060. // A fallback to window.onload, that will always work
  4061. window.addEventListener( "load", completed );
  4062. }
  4063. // Multifunctional method to get and set values of a collection
  4064. // The value/s can optionally be executed if it's a function
  4065. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  4066. var i = 0,
  4067. len = elems.length,
  4068. bulk = key == null;
  4069. // Sets many values
  4070. if ( jQuery.type( key ) === "object" ) {
  4071. chainable = true;
  4072. for ( i in key ) {
  4073. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  4074. }
  4075. // Sets one value
  4076. } else if ( value !== undefined ) {
  4077. chainable = true;
  4078. if ( !jQuery.isFunction( value ) ) {
  4079. raw = true;
  4080. }
  4081. if ( bulk ) {
  4082. // Bulk operations run against the entire set
  4083. if ( raw ) {
  4084. fn.call( elems, value );
  4085. fn = null;
  4086. // ...except when executing function values
  4087. } else {
  4088. bulk = fn;
  4089. fn = function( elem, key, value ) {
  4090. return bulk.call( jQuery( elem ), value );
  4091. };
  4092. }
  4093. }
  4094. if ( fn ) {
  4095. for ( ; i < len; i++ ) {
  4096. fn(
  4097. elems[ i ], key, raw ?
  4098. value :
  4099. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  4100. );
  4101. }
  4102. }
  4103. }
  4104. if ( chainable ) {
  4105. return elems;
  4106. }
  4107. // Gets
  4108. if ( bulk ) {
  4109. return fn.call( elems );
  4110. }
  4111. return len ? fn( elems[ 0 ], key ) : emptyGet;
  4112. };
  4113. var acceptData = function( owner ) {
  4114. // Accepts only:
  4115. // - Node
  4116. // - Node.ELEMENT_NODE
  4117. // - Node.DOCUMENT_NODE
  4118. // - Object
  4119. // - Any
  4120. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  4121. };
  4122. function Data() {
  4123. this.expando = jQuery.expando + Data.uid++;
  4124. }
  4125. Data.uid = 1;
  4126. Data.prototype = {
  4127. cache: function( owner ) {
  4128. // Check if the owner object already has a cache
  4129. var value = owner[ this.expando ];
  4130. // If not, create one
  4131. if ( !value ) {
  4132. value = {};
  4133. // We can accept data for non-element nodes in modern browsers,
  4134. // but we should not, see #8335.
  4135. // Always return an empty object.
  4136. if ( acceptData( owner ) ) {
  4137. // If it is a node unlikely to be stringify-ed or looped over
  4138. // use plain assignment
  4139. if ( owner.nodeType ) {
  4140. owner[ this.expando ] = value;
  4141. // Otherwise secure it in a non-enumerable property
  4142. // configurable must be true to allow the property to be
  4143. // deleted when data is removed
  4144. } else {
  4145. Object.defineProperty( owner, this.expando, {
  4146. value: value,
  4147. configurable: true
  4148. } );
  4149. }
  4150. }
  4151. }
  4152. return value;
  4153. },
  4154. set: function( owner, data, value ) {
  4155. var prop,
  4156. cache = this.cache( owner );
  4157. // Handle: [ owner, key, value ] args
  4158. // Always use camelCase key (gh-2257)
  4159. if ( typeof data === "string" ) {
  4160. cache[ jQuery.camelCase( data ) ] = value;
  4161. // Handle: [ owner, { properties } ] args
  4162. } else {
  4163. // Copy the properties one-by-one to the cache object
  4164. for ( prop in data ) {
  4165. cache[ jQuery.camelCase( prop ) ] = data[ prop ];
  4166. }
  4167. }
  4168. return cache;
  4169. },
  4170. get: function( owner, key ) {
  4171. return key === undefined ?
  4172. this.cache( owner ) :
  4173. // Always use camelCase key (gh-2257)
  4174. owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];
  4175. },
  4176. access: function( owner, key, value ) {
  4177. // In cases where either:
  4178. //
  4179. // 1. No key was specified
  4180. // 2. A string key was specified, but no value provided
  4181. //
  4182. // Take the "read" path and allow the get method to determine
  4183. // which value to return, respectively either:
  4184. //
  4185. // 1. The entire cache object
  4186. // 2. The data stored at the key
  4187. //
  4188. if ( key === undefined ||
  4189. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  4190. return this.get( owner, key );
  4191. }
  4192. // When the key is not a string, or both a key and value
  4193. // are specified, set or extend (existing objects) with either:
  4194. //
  4195. // 1. An object of properties
  4196. // 2. A key and value
  4197. //
  4198. this.set( owner, key, value );
  4199. // Since the "set" path can have two possible entry points
  4200. // return the expected data based on which path was taken[*]
  4201. return value !== undefined ? value : key;
  4202. },
  4203. remove: function( owner, key ) {
  4204. var i,
  4205. cache = owner[ this.expando ];
  4206. if ( cache === undefined ) {
  4207. return;
  4208. }
  4209. if ( key !== undefined ) {
  4210. // Support array or space separated string of keys
  4211. if ( Array.isArray( key ) ) {
  4212. // If key is an array of keys...
  4213. // We always set camelCase keys, so remove that.
  4214. key = key.map( jQuery.camelCase );
  4215. } else {
  4216. key = jQuery.camelCase( key );
  4217. // If a key with the spaces exists, use it.
  4218. // Otherwise, create an array by matching non-whitespace
  4219. key = key in cache ?
  4220. [ key ] :
  4221. ( key.match( rnothtmlwhite ) || [] );
  4222. }
  4223. i = key.length;
  4224. while ( i-- ) {
  4225. delete cache[ key[ i ] ];
  4226. }
  4227. }
  4228. // Remove the expando if there's no more data
  4229. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  4230. // Support: Chrome <=35 - 45
  4231. // Webkit & Blink performance suffers when deleting properties
  4232. // from DOM nodes, so set to undefined instead
  4233. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  4234. if ( owner.nodeType ) {
  4235. owner[ this.expando ] = undefined;
  4236. } else {
  4237. delete owner[ this.expando ];
  4238. }
  4239. }
  4240. },
  4241. hasData: function( owner ) {
  4242. var cache = owner[ this.expando ];
  4243. return cache !== undefined && !jQuery.isEmptyObject( cache );
  4244. }
  4245. };
  4246. var dataPriv = new Data();
  4247. var dataUser = new Data();
  4248. // Implementation Summary
  4249. //
  4250. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  4251. // 2. Improve the module's maintainability by reducing the storage
  4252. // paths to a single mechanism.
  4253. // 3. Use the same single mechanism to support "private" and "user" data.
  4254. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  4255. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  4256. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  4257. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  4258. rmultiDash = /[A-Z]/g;
  4259. function getData( data ) {
  4260. if ( data === "true" ) {
  4261. return true;
  4262. }
  4263. if ( data === "false" ) {
  4264. return false;
  4265. }
  4266. if ( data === "null" ) {
  4267. return null;
  4268. }
  4269. // Only convert to a number if it doesn't change the string
  4270. if ( data === +data + "" ) {
  4271. return +data;
  4272. }
  4273. if ( rbrace.test( data ) ) {
  4274. return JSON.parse( data );
  4275. }
  4276. return data;
  4277. }
  4278. function dataAttr( elem, key, data ) {
  4279. var name;
  4280. // If nothing was found internally, try to fetch any
  4281. // data from the HTML5 data-* attribute
  4282. if ( data === undefined && elem.nodeType === 1 ) {
  4283. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  4284. data = elem.getAttribute( name );
  4285. if ( typeof data === "string" ) {
  4286. try {
  4287. data = getData( data );
  4288. } catch ( e ) {}
  4289. // Make sure we set the data so it isn't changed later
  4290. dataUser.set( elem, key, data );
  4291. } else {
  4292. data = undefined;
  4293. }
  4294. }
  4295. return data;
  4296. }
  4297. jQuery.extend( {
  4298. hasData: function( elem ) {
  4299. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  4300. },
  4301. data: function( elem, name, data ) {
  4302. return dataUser.access( elem, name, data );
  4303. },
  4304. removeData: function( elem, name ) {
  4305. dataUser.remove( elem, name );
  4306. },
  4307. // TODO: Now that all calls to _data and _removeData have been replaced
  4308. // with direct calls to dataPriv methods, these can be deprecated.
  4309. _data: function( elem, name, data ) {
  4310. return dataPriv.access( elem, name, data );
  4311. },
  4312. _removeData: function( elem, name ) {
  4313. dataPriv.remove( elem, name );
  4314. }
  4315. } );
  4316. jQuery.fn.extend( {
  4317. data: function( key, value ) {
  4318. var i, name, data,
  4319. elem = this[ 0 ],
  4320. attrs = elem && elem.attributes;
  4321. // Gets all values
  4322. if ( key === undefined ) {
  4323. if ( this.length ) {
  4324. data = dataUser.get( elem );
  4325. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  4326. i = attrs.length;
  4327. while ( i-- ) {
  4328. // Support: IE 11 only
  4329. // The attrs elements can be null (#14894)
  4330. if ( attrs[ i ] ) {
  4331. name = attrs[ i ].name;
  4332. if ( name.indexOf( "data-" ) === 0 ) {
  4333. name = jQuery.camelCase( name.slice( 5 ) );
  4334. dataAttr( elem, name, data[ name ] );
  4335. }
  4336. }
  4337. }
  4338. dataPriv.set( elem, "hasDataAttrs", true );
  4339. }
  4340. }
  4341. return data;
  4342. }
  4343. // Sets multiple values
  4344. if ( typeof key === "object" ) {
  4345. return this.each( function() {
  4346. dataUser.set( this, key );
  4347. } );
  4348. }
  4349. return access( this, function( value ) {
  4350. var data;
  4351. // The calling jQuery object (element matches) is not empty
  4352. // (and therefore has an element appears at this[ 0 ]) and the
  4353. // `value` parameter was not undefined. An empty jQuery object
  4354. // will result in `undefined` for elem = this[ 0 ] which will
  4355. // throw an exception if an attempt to read a data cache is made.
  4356. if ( elem && value === undefined ) {
  4357. // Attempt to get data from the cache
  4358. // The key will always be camelCased in Data
  4359. data = dataUser.get( elem, key );
  4360. if ( data !== undefined ) {
  4361. return data;
  4362. }
  4363. // Attempt to "discover" the data in
  4364. // HTML5 custom data-* attrs
  4365. data = dataAttr( elem, key );
  4366. if ( data !== undefined ) {
  4367. return data;
  4368. }
  4369. // We tried really hard, but the data doesn't exist.
  4370. return;
  4371. }
  4372. // Set the data...
  4373. this.each( function() {
  4374. // We always store the camelCased key
  4375. dataUser.set( this, key, value );
  4376. } );
  4377. }, null, value, arguments.length > 1, null, true );
  4378. },
  4379. removeData: function( key ) {
  4380. return this.each( function() {
  4381. dataUser.remove( this, key );
  4382. } );
  4383. }
  4384. } );
  4385. jQuery.extend( {
  4386. queue: function( elem, type, data ) {
  4387. var queue;
  4388. if ( elem ) {
  4389. type = ( type || "fx" ) + "queue";
  4390. queue = dataPriv.get( elem, type );
  4391. // Speed up dequeue by getting out quickly if this is just a lookup
  4392. if ( data ) {
  4393. if ( !queue || Array.isArray( data ) ) {
  4394. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  4395. } else {
  4396. queue.push( data );
  4397. }
  4398. }
  4399. return queue || [];
  4400. }
  4401. },
  4402. dequeue: function( elem, type ) {
  4403. type = type || "fx";
  4404. var queue = jQuery.queue( elem, type ),
  4405. startLength = queue.length,
  4406. fn = queue.shift(),
  4407. hooks = jQuery._queueHooks( elem, type ),
  4408. next = function() {
  4409. jQuery.dequeue( elem, type );
  4410. };
  4411. // If the fx queue is dequeued, always remove the progress sentinel
  4412. if ( fn === "inprogress" ) {
  4413. fn = queue.shift();
  4414. startLength--;
  4415. }
  4416. if ( fn ) {
  4417. // Add a progress sentinel to prevent the fx queue from being
  4418. // automatically dequeued
  4419. if ( type === "fx" ) {
  4420. queue.unshift( "inprogress" );
  4421. }
  4422. // Clear up the last queue stop function
  4423. delete hooks.stop;
  4424. fn.call( elem, next, hooks );
  4425. }
  4426. if ( !startLength && hooks ) {
  4427. hooks.empty.fire();
  4428. }
  4429. },
  4430. // Not public - generate a queueHooks object, or return the current one
  4431. _queueHooks: function( elem, type ) {
  4432. var key = type + "queueHooks";
  4433. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  4434. empty: jQuery.Callbacks( "once memory" ).add( function() {
  4435. dataPriv.remove( elem, [ type + "queue", key ] );
  4436. } )
  4437. } );
  4438. }
  4439. } );
  4440. jQuery.fn.extend( {
  4441. queue: function( type, data ) {
  4442. var setter = 2;
  4443. if ( typeof type !== "string" ) {
  4444. data = type;
  4445. type = "fx";
  4446. setter--;
  4447. }
  4448. if ( arguments.length < setter ) {
  4449. return jQuery.queue( this[ 0 ], type );
  4450. }
  4451. return data === undefined ?
  4452. this :
  4453. this.each( function() {
  4454. var queue = jQuery.queue( this, type, data );
  4455. // Ensure a hooks for this queue
  4456. jQuery._queueHooks( this, type );
  4457. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  4458. jQuery.dequeue( this, type );
  4459. }
  4460. } );
  4461. },
  4462. dequeue: function( type ) {
  4463. return this.each( function() {
  4464. jQuery.dequeue( this, type );
  4465. } );
  4466. },
  4467. clearQueue: function( type ) {
  4468. return this.queue( type || "fx", [] );
  4469. },
  4470. // Get a promise resolved when queues of a certain type
  4471. // are emptied (fx is the type by default)
  4472. promise: function( type, obj ) {
  4473. var tmp,
  4474. count = 1,
  4475. defer = jQuery.Deferred(),
  4476. elements = this,
  4477. i = this.length,
  4478. resolve = function() {
  4479. if ( !( --count ) ) {
  4480. defer.resolveWith( elements, [ elements ] );
  4481. }
  4482. };
  4483. if ( typeof type !== "string" ) {
  4484. obj = type;
  4485. type = undefined;
  4486. }
  4487. type = type || "fx";
  4488. while ( i-- ) {
  4489. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  4490. if ( tmp && tmp.empty ) {
  4491. count++;
  4492. tmp.empty.add( resolve );
  4493. }
  4494. }
  4495. resolve();
  4496. return defer.promise( obj );
  4497. }
  4498. } );
  4499. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  4500. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  4501. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  4502. var isHiddenWithinTree = function( elem, el ) {
  4503. // isHiddenWithinTree might be called from jQuery#filter function;
  4504. // in that case, element will be second argument
  4505. elem = el || elem;
  4506. // Inline style trumps all
  4507. return elem.style.display === "none" ||
  4508. elem.style.display === "" &&
  4509. // Otherwise, check computed style
  4510. // Support: Firefox <=43 - 45
  4511. // Disconnected elements can have computed display: none, so first confirm that elem is
  4512. // in the document.
  4513. jQuery.contains( elem.ownerDocument, elem ) &&
  4514. jQuery.css( elem, "display" ) === "none";
  4515. };
  4516. var swap = function( elem, options, callback, args ) {
  4517. var ret, name,
  4518. old = {};
  4519. // Remember the old values, and insert the new ones
  4520. for ( name in options ) {
  4521. old[ name ] = elem.style[ name ];
  4522. elem.style[ name ] = options[ name ];
  4523. }
  4524. ret = callback.apply( elem, args || [] );
  4525. // Revert the old values
  4526. for ( name in options ) {
  4527. elem.style[ name ] = old[ name ];
  4528. }
  4529. return ret;
  4530. };
  4531. function adjustCSS( elem, prop, valueParts, tween ) {
  4532. var adjusted,
  4533. scale = 1,
  4534. maxIterations = 20,
  4535. currentValue = tween ?
  4536. function() {
  4537. return tween.cur();
  4538. } :
  4539. function() {
  4540. return jQuery.css( elem, prop, "" );
  4541. },
  4542. initial = currentValue(),
  4543. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  4544. // Starting value computation is required for potential unit mismatches
  4545. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  4546. rcssNum.exec( jQuery.css( elem, prop ) );
  4547. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  4548. // Trust units reported by jQuery.css
  4549. unit = unit || initialInUnit[ 3 ];
  4550. // Make sure we update the tween properties later on
  4551. valueParts = valueParts || [];
  4552. // Iteratively approximate from a nonzero starting point
  4553. initialInUnit = +initial || 1;
  4554. do {
  4555. // If previous iteration zeroed out, double until we get *something*.
  4556. // Use string for doubling so we don't accidentally see scale as unchanged below
  4557. scale = scale || ".5";
  4558. // Adjust and apply
  4559. initialInUnit = initialInUnit / scale;
  4560. jQuery.style( elem, prop, initialInUnit + unit );
  4561. // Update scale, tolerating zero or NaN from tween.cur()
  4562. // Break the loop if scale is unchanged or perfect, or if we've just had enough.
  4563. } while (
  4564. scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
  4565. );
  4566. }
  4567. if ( valueParts ) {
  4568. initialInUnit = +initialInUnit || +initial || 0;
  4569. // Apply relative offset (+=/-=) if specified
  4570. adjusted = valueParts[ 1 ] ?
  4571. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  4572. +valueParts[ 2 ];
  4573. if ( tween ) {
  4574. tween.unit = unit;
  4575. tween.start = initialInUnit;
  4576. tween.end = adjusted;
  4577. }
  4578. }
  4579. return adjusted;
  4580. }
  4581. var defaultDisplayMap = {};
  4582. function getDefaultDisplay( elem ) {
  4583. var temp,
  4584. doc = elem.ownerDocument,
  4585. nodeName = elem.nodeName,
  4586. display = defaultDisplayMap[ nodeName ];
  4587. if ( display ) {
  4588. return display;
  4589. }
  4590. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  4591. display = jQuery.css( temp, "display" );
  4592. temp.parentNode.removeChild( temp );
  4593. if ( display === "none" ) {
  4594. display = "block";
  4595. }
  4596. defaultDisplayMap[ nodeName ] = display;
  4597. return display;
  4598. }
  4599. function showHide( elements, show ) {
  4600. var display, elem,
  4601. values = [],
  4602. index = 0,
  4603. length = elements.length;
  4604. // Determine new display value for elements that need to change
  4605. for ( ; index < length; index++ ) {
  4606. elem = elements[ index ];
  4607. if ( !elem.style ) {
  4608. continue;
  4609. }
  4610. display = elem.style.display;
  4611. if ( show ) {
  4612. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  4613. // check is required in this first loop unless we have a nonempty display value (either
  4614. // inline or about-to-be-restored)
  4615. if ( display === "none" ) {
  4616. values[ index ] = dataPriv.get( elem, "display" ) || null;
  4617. if ( !values[ index ] ) {
  4618. elem.style.display = "";
  4619. }
  4620. }
  4621. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  4622. values[ index ] = getDefaultDisplay( elem );
  4623. }
  4624. } else {
  4625. if ( display !== "none" ) {
  4626. values[ index ] = "none";
  4627. // Remember what we're overwriting
  4628. dataPriv.set( elem, "display", display );
  4629. }
  4630. }
  4631. }
  4632. // Set the display of the elements in a second loop to avoid constant reflow
  4633. for ( index = 0; index < length; index++ ) {
  4634. if ( values[ index ] != null ) {
  4635. elements[ index ].style.display = values[ index ];
  4636. }
  4637. }
  4638. return elements;
  4639. }
  4640. jQuery.fn.extend( {
  4641. show: function() {
  4642. return showHide( this, true );
  4643. },
  4644. hide: function() {
  4645. return showHide( this );
  4646. },
  4647. toggle: function( state ) {
  4648. if ( typeof state === "boolean" ) {
  4649. return state ? this.show() : this.hide();
  4650. }
  4651. return this.each( function() {
  4652. if ( isHiddenWithinTree( this ) ) {
  4653. jQuery( this ).show();
  4654. } else {
  4655. jQuery( this ).hide();
  4656. }
  4657. } );
  4658. }
  4659. } );
  4660. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  4661. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  4662. var rscriptType = ( /^$|\/(?:java|ecma)script/i );
  4663. // We have to close these tags to support XHTML (#13200)
  4664. var wrapMap = {
  4665. // Support: IE <=9 only
  4666. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  4667. // XHTML parsers do not magically insert elements in the
  4668. // same way that tag soup parsers do. So we cannot shorten
  4669. // this by omitting <tbody> or other required elements.
  4670. thead: [ 1, "<table>", "</table>" ],
  4671. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  4672. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  4673. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  4674. _default: [ 0, "", "" ]
  4675. };
  4676. // Support: IE <=9 only
  4677. wrapMap.optgroup = wrapMap.option;
  4678. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  4679. wrapMap.th = wrapMap.td;
  4680. function getAll( context, tag ) {
  4681. // Support: IE <=9 - 11 only
  4682. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  4683. var ret;
  4684. if ( typeof context.getElementsByTagName !== "undefined" ) {
  4685. ret = context.getElementsByTagName( tag || "*" );
  4686. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  4687. ret = context.querySelectorAll( tag || "*" );
  4688. } else {
  4689. ret = [];
  4690. }
  4691. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  4692. return jQuery.merge( [ context ], ret );
  4693. }
  4694. return ret;
  4695. }
  4696. // Mark scripts as having already been evaluated
  4697. function setGlobalEval( elems, refElements ) {
  4698. var i = 0,
  4699. l = elems.length;
  4700. for ( ; i < l; i++ ) {
  4701. dataPriv.set(
  4702. elems[ i ],
  4703. "globalEval",
  4704. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  4705. );
  4706. }
  4707. }
  4708. var rhtml = /<|&#?\w+;/;
  4709. function buildFragment( elems, context, scripts, selection, ignored ) {
  4710. var elem, tmp, tag, wrap, contains, j,
  4711. fragment = context.createDocumentFragment(),
  4712. nodes = [],
  4713. i = 0,
  4714. l = elems.length;
  4715. for ( ; i < l; i++ ) {
  4716. elem = elems[ i ];
  4717. if ( elem || elem === 0 ) {
  4718. // Add nodes directly
  4719. if ( jQuery.type( elem ) === "object" ) {
  4720. // Support: Android <=4.0 only, PhantomJS 1 only
  4721. // push.apply(_, arraylike) throws on ancient WebKit
  4722. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  4723. // Convert non-html into a text node
  4724. } else if ( !rhtml.test( elem ) ) {
  4725. nodes.push( context.createTextNode( elem ) );
  4726. // Convert html into DOM nodes
  4727. } else {
  4728. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  4729. // Deserialize a standard representation
  4730. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  4731. wrap = wrapMap[ tag ] || wrapMap._default;
  4732. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  4733. // Descend through wrappers to the right content
  4734. j = wrap[ 0 ];
  4735. while ( j-- ) {
  4736. tmp = tmp.lastChild;
  4737. }
  4738. // Support: Android <=4.0 only, PhantomJS 1 only
  4739. // push.apply(_, arraylike) throws on ancient WebKit
  4740. jQuery.merge( nodes, tmp.childNodes );
  4741. // Remember the top-level container
  4742. tmp = fragment.firstChild;
  4743. // Ensure the created nodes are orphaned (#12392)
  4744. tmp.textContent = "";
  4745. }
  4746. }
  4747. }
  4748. // Remove wrapper from fragment
  4749. fragment.textContent = "";
  4750. i = 0;
  4751. while ( ( elem = nodes[ i++ ] ) ) {
  4752. // Skip elements already in the context collection (trac-4087)
  4753. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  4754. if ( ignored ) {
  4755. ignored.push( elem );
  4756. }
  4757. continue;
  4758. }
  4759. contains = jQuery.contains( elem.ownerDocument, elem );
  4760. // Append to fragment
  4761. tmp = getAll( fragment.appendChild( elem ), "script" );
  4762. // Preserve script evaluation history
  4763. if ( contains ) {
  4764. setGlobalEval( tmp );
  4765. }
  4766. // Capture executables
  4767. if ( scripts ) {
  4768. j = 0;
  4769. while ( ( elem = tmp[ j++ ] ) ) {
  4770. if ( rscriptType.test( elem.type || "" ) ) {
  4771. scripts.push( elem );
  4772. }
  4773. }
  4774. }
  4775. }
  4776. return fragment;
  4777. }
  4778. ( function() {
  4779. var fragment = document.createDocumentFragment(),
  4780. div = fragment.appendChild( document.createElement( "div" ) ),
  4781. input = document.createElement( "input" );
  4782. // Support: Android 4.0 - 4.3 only
  4783. // Check state lost if the name is set (#11217)
  4784. // Support: Windows Web Apps (WWA)
  4785. // `name` and `type` must use .setAttribute for WWA (#14901)
  4786. input.setAttribute( "type", "radio" );
  4787. input.setAttribute( "checked", "checked" );
  4788. input.setAttribute( "name", "t" );
  4789. div.appendChild( input );
  4790. // Support: Android <=4.1 only
  4791. // Older WebKit doesn't clone checked state correctly in fragments
  4792. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  4793. // Support: IE <=11 only
  4794. // Make sure textarea (and checkbox) defaultValue is properly cloned
  4795. div.innerHTML = "<textarea>x</textarea>";
  4796. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  4797. } )();
  4798. var documentElement = document.documentElement;
  4799. var
  4800. rkeyEvent = /^key/,
  4801. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  4802. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  4803. function returnTrue() {
  4804. return true;
  4805. }
  4806. function returnFalse() {
  4807. return false;
  4808. }
  4809. // Support: IE <=9 only
  4810. // See #13393 for more info
  4811. function safeActiveElement() {
  4812. try {
  4813. return document.activeElement;
  4814. } catch ( err ) { }
  4815. }
  4816. function on( elem, types, selector, data, fn, one ) {
  4817. var origFn, type;
  4818. // Types can be a map of types/handlers
  4819. if ( typeof types === "object" ) {
  4820. // ( types-Object, selector, data )
  4821. if ( typeof selector !== "string" ) {
  4822. // ( types-Object, data )
  4823. data = data || selector;
  4824. selector = undefined;
  4825. }
  4826. for ( type in types ) {
  4827. on( elem, type, selector, data, types[ type ], one );
  4828. }
  4829. return elem;
  4830. }
  4831. if ( data == null && fn == null ) {
  4832. // ( types, fn )
  4833. fn = selector;
  4834. data = selector = undefined;
  4835. } else if ( fn == null ) {
  4836. if ( typeof selector === "string" ) {
  4837. // ( types, selector, fn )
  4838. fn = data;
  4839. data = undefined;
  4840. } else {
  4841. // ( types, data, fn )
  4842. fn = data;
  4843. data = selector;
  4844. selector = undefined;
  4845. }
  4846. }
  4847. if ( fn === false ) {
  4848. fn = returnFalse;
  4849. } else if ( !fn ) {
  4850. return elem;
  4851. }
  4852. if ( one === 1 ) {
  4853. origFn = fn;
  4854. fn = function( event ) {
  4855. // Can use an empty set, since event contains the info
  4856. jQuery().off( event );
  4857. return origFn.apply( this, arguments );
  4858. };
  4859. // Use same guid so caller can remove using origFn
  4860. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  4861. }
  4862. return elem.each( function() {
  4863. jQuery.event.add( this, types, fn, data, selector );
  4864. } );
  4865. }
  4866. /*
  4867. * Helper functions for managing events -- not part of the public interface.
  4868. * Props to Dean Edwards' addEvent library for many of the ideas.
  4869. */
  4870. jQuery.event = {
  4871. global: {},
  4872. add: function( elem, types, handler, data, selector ) {
  4873. var handleObjIn, eventHandle, tmp,
  4874. events, t, handleObj,
  4875. special, handlers, type, namespaces, origType,
  4876. elemData = dataPriv.get( elem );
  4877. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  4878. if ( !elemData ) {
  4879. return;
  4880. }
  4881. // Caller can pass in an object of custom data in lieu of the handler
  4882. if ( handler.handler ) {
  4883. handleObjIn = handler;
  4884. handler = handleObjIn.handler;
  4885. selector = handleObjIn.selector;
  4886. }
  4887. // Ensure that invalid selectors throw exceptions at attach time
  4888. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  4889. if ( selector ) {
  4890. jQuery.find.matchesSelector( documentElement, selector );
  4891. }
  4892. // Make sure that the handler has a unique ID, used to find/remove it later
  4893. if ( !handler.guid ) {
  4894. handler.guid = jQuery.guid++;
  4895. }
  4896. // Init the element's event structure and main handler, if this is the first
  4897. if ( !( events = elemData.events ) ) {
  4898. events = elemData.events = {};
  4899. }
  4900. if ( !( eventHandle = elemData.handle ) ) {
  4901. eventHandle = elemData.handle = function( e ) {
  4902. // Discard the second event of a jQuery.event.trigger() and
  4903. // when an event is called after a page has unloaded
  4904. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  4905. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  4906. };
  4907. }
  4908. // Handle multiple events separated by a space
  4909. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4910. t = types.length;
  4911. while ( t-- ) {
  4912. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4913. type = origType = tmp[ 1 ];
  4914. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4915. // There *must* be a type, no attaching namespace-only handlers
  4916. if ( !type ) {
  4917. continue;
  4918. }
  4919. // If event changes its type, use the special event handlers for the changed type
  4920. special = jQuery.event.special[ type ] || {};
  4921. // If selector defined, determine special event api type, otherwise given type
  4922. type = ( selector ? special.delegateType : special.bindType ) || type;
  4923. // Update special based on newly reset type
  4924. special = jQuery.event.special[ type ] || {};
  4925. // handleObj is passed to all event handlers
  4926. handleObj = jQuery.extend( {
  4927. type: type,
  4928. origType: origType,
  4929. data: data,
  4930. handler: handler,
  4931. guid: handler.guid,
  4932. selector: selector,
  4933. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  4934. namespace: namespaces.join( "." )
  4935. }, handleObjIn );
  4936. // Init the event handler queue if we're the first
  4937. if ( !( handlers = events[ type ] ) ) {
  4938. handlers = events[ type ] = [];
  4939. handlers.delegateCount = 0;
  4940. // Only use addEventListener if the special events handler returns false
  4941. if ( !special.setup ||
  4942. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  4943. if ( elem.addEventListener ) {
  4944. elem.addEventListener( type, eventHandle );
  4945. }
  4946. }
  4947. }
  4948. if ( special.add ) {
  4949. special.add.call( elem, handleObj );
  4950. if ( !handleObj.handler.guid ) {
  4951. handleObj.handler.guid = handler.guid;
  4952. }
  4953. }
  4954. // Add to the element's handler list, delegates in front
  4955. if ( selector ) {
  4956. handlers.splice( handlers.delegateCount++, 0, handleObj );
  4957. } else {
  4958. handlers.push( handleObj );
  4959. }
  4960. // Keep track of which events have ever been used, for event optimization
  4961. jQuery.event.global[ type ] = true;
  4962. }
  4963. },
  4964. // Detach an event or set of events from an element
  4965. remove: function( elem, types, handler, selector, mappedTypes ) {
  4966. var j, origCount, tmp,
  4967. events, t, handleObj,
  4968. special, handlers, type, namespaces, origType,
  4969. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  4970. if ( !elemData || !( events = elemData.events ) ) {
  4971. return;
  4972. }
  4973. // Once for each type.namespace in types; type may be omitted
  4974. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4975. t = types.length;
  4976. while ( t-- ) {
  4977. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4978. type = origType = tmp[ 1 ];
  4979. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4980. // Unbind all events (on this namespace, if provided) for the element
  4981. if ( !type ) {
  4982. for ( type in events ) {
  4983. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  4984. }
  4985. continue;
  4986. }
  4987. special = jQuery.event.special[ type ] || {};
  4988. type = ( selector ? special.delegateType : special.bindType ) || type;
  4989. handlers = events[ type ] || [];
  4990. tmp = tmp[ 2 ] &&
  4991. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  4992. // Remove matching events
  4993. origCount = j = handlers.length;
  4994. while ( j-- ) {
  4995. handleObj = handlers[ j ];
  4996. if ( ( mappedTypes || origType === handleObj.origType ) &&
  4997. ( !handler || handler.guid === handleObj.guid ) &&
  4998. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  4999. ( !selector || selector === handleObj.selector ||
  5000. selector === "**" && handleObj.selector ) ) {
  5001. handlers.splice( j, 1 );
  5002. if ( handleObj.selector ) {
  5003. handlers.delegateCount--;
  5004. }
  5005. if ( special.remove ) {
  5006. special.remove.call( elem, handleObj );
  5007. }
  5008. }
  5009. }
  5010. // Remove generic event handler if we removed something and no more handlers exist
  5011. // (avoids potential for endless recursion during removal of special event handlers)
  5012. if ( origCount && !handlers.length ) {
  5013. if ( !special.teardown ||
  5014. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  5015. jQuery.removeEvent( elem, type, elemData.handle );
  5016. }
  5017. delete events[ type ];
  5018. }
  5019. }
  5020. // Remove data and the expando if it's no longer used
  5021. if ( jQuery.isEmptyObject( events ) ) {
  5022. dataPriv.remove( elem, "handle events" );
  5023. }
  5024. },
  5025. dispatch: function( nativeEvent ) {
  5026. // Make a writable jQuery.Event from the native event object
  5027. var event = jQuery.event.fix( nativeEvent );
  5028. var i, j, ret, matched, handleObj, handlerQueue,
  5029. args = new Array( arguments.length ),
  5030. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  5031. special = jQuery.event.special[ event.type ] || {};
  5032. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  5033. args[ 0 ] = event;
  5034. for ( i = 1; i < arguments.length; i++ ) {
  5035. args[ i ] = arguments[ i ];
  5036. }
  5037. event.delegateTarget = this;
  5038. // Call the preDispatch hook for the mapped type, and let it bail if desired
  5039. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  5040. return;
  5041. }
  5042. // Determine handlers
  5043. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  5044. // Run delegates first; they may want to stop propagation beneath us
  5045. i = 0;
  5046. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  5047. event.currentTarget = matched.elem;
  5048. j = 0;
  5049. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  5050. !event.isImmediatePropagationStopped() ) {
  5051. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  5052. // a subset or equal to those in the bound event (both can have no namespace).
  5053. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  5054. event.handleObj = handleObj;
  5055. event.data = handleObj.data;
  5056. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  5057. handleObj.handler ).apply( matched.elem, args );
  5058. if ( ret !== undefined ) {
  5059. if ( ( event.result = ret ) === false ) {
  5060. event.preventDefault();
  5061. event.stopPropagation();
  5062. }
  5063. }
  5064. }
  5065. }
  5066. }
  5067. // Call the postDispatch hook for the mapped type
  5068. if ( special.postDispatch ) {
  5069. special.postDispatch.call( this, event );
  5070. }
  5071. return event.result;
  5072. },
  5073. handlers: function( event, handlers ) {
  5074. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  5075. handlerQueue = [],
  5076. delegateCount = handlers.delegateCount,
  5077. cur = event.target;
  5078. // Find delegate handlers
  5079. if ( delegateCount &&
  5080. // Support: IE <=9
  5081. // Black-hole SVG <use> instance trees (trac-13180)
  5082. cur.nodeType &&
  5083. // Support: Firefox <=42
  5084. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  5085. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  5086. // Support: IE 11 only
  5087. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  5088. !( event.type === "click" && event.button >= 1 ) ) {
  5089. for ( ; cur !== this; cur = cur.parentNode || this ) {
  5090. // Don't check non-elements (#13208)
  5091. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  5092. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  5093. matchedHandlers = [];
  5094. matchedSelectors = {};
  5095. for ( i = 0; i < delegateCount; i++ ) {
  5096. handleObj = handlers[ i ];
  5097. // Don't conflict with Object.prototype properties (#13203)
  5098. sel = handleObj.selector + " ";
  5099. if ( matchedSelectors[ sel ] === undefined ) {
  5100. matchedSelectors[ sel ] = handleObj.needsContext ?
  5101. jQuery( sel, this ).index( cur ) > -1 :
  5102. jQuery.find( sel, this, null, [ cur ] ).length;
  5103. }
  5104. if ( matchedSelectors[ sel ] ) {
  5105. matchedHandlers.push( handleObj );
  5106. }
  5107. }
  5108. if ( matchedHandlers.length ) {
  5109. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  5110. }
  5111. }
  5112. }
  5113. }
  5114. // Add the remaining (directly-bound) handlers
  5115. cur = this;
  5116. if ( delegateCount < handlers.length ) {
  5117. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  5118. }
  5119. return handlerQueue;
  5120. },
  5121. addProp: function( name, hook ) {
  5122. Object.defineProperty( jQuery.Event.prototype, name, {
  5123. enumerable: true,
  5124. configurable: true,
  5125. get: jQuery.isFunction( hook ) ?
  5126. function() {
  5127. if ( this.originalEvent ) {
  5128. return hook( this.originalEvent );
  5129. }
  5130. } :
  5131. function() {
  5132. if ( this.originalEvent ) {
  5133. return this.originalEvent[ name ];
  5134. }
  5135. },
  5136. set: function( value ) {
  5137. Object.defineProperty( this, name, {
  5138. enumerable: true,
  5139. configurable: true,
  5140. writable: true,
  5141. value: value
  5142. } );
  5143. }
  5144. } );
  5145. },
  5146. fix: function( originalEvent ) {
  5147. return originalEvent[ jQuery.expando ] ?
  5148. originalEvent :
  5149. new jQuery.Event( originalEvent );
  5150. },
  5151. special: {
  5152. load: {
  5153. // Prevent triggered image.load events from bubbling to window.load
  5154. noBubble: true
  5155. },
  5156. focus: {
  5157. // Fire native event if possible so blur/focus sequence is correct
  5158. trigger: function() {
  5159. if ( this !== safeActiveElement() && this.focus ) {
  5160. this.focus();
  5161. return false;
  5162. }
  5163. },
  5164. delegateType: "focusin"
  5165. },
  5166. blur: {
  5167. trigger: function() {
  5168. if ( this === safeActiveElement() && this.blur ) {
  5169. this.blur();
  5170. return false;
  5171. }
  5172. },
  5173. delegateType: "focusout"
  5174. },
  5175. click: {
  5176. // For checkbox, fire native event so checked state will be right
  5177. trigger: function() {
  5178. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  5179. this.click();
  5180. return false;
  5181. }
  5182. },
  5183. // For cross-browser consistency, don't fire native .click() on links
  5184. _default: function( event ) {
  5185. return nodeName( event.target, "a" );
  5186. }
  5187. },
  5188. beforeunload: {
  5189. postDispatch: function( event ) {
  5190. // Support: Firefox 20+
  5191. // Firefox doesn't alert if the returnValue field is not set.
  5192. if ( event.result !== undefined && event.originalEvent ) {
  5193. event.originalEvent.returnValue = event.result;
  5194. }
  5195. }
  5196. }
  5197. }
  5198. };
  5199. jQuery.removeEvent = function( elem, type, handle ) {
  5200. // This "if" is needed for plain objects
  5201. if ( elem.removeEventListener ) {
  5202. elem.removeEventListener( type, handle );
  5203. }
  5204. };
  5205. jQuery.Event = function( src, props ) {
  5206. // Allow instantiation without the 'new' keyword
  5207. if ( !( this instanceof jQuery.Event ) ) {
  5208. return new jQuery.Event( src, props );
  5209. }
  5210. // Event object
  5211. if ( src && src.type ) {
  5212. this.originalEvent = src;
  5213. this.type = src.type;
  5214. // Events bubbling up the document may have been marked as prevented
  5215. // by a handler lower down the tree; reflect the correct value.
  5216. this.isDefaultPrevented = src.defaultPrevented ||
  5217. src.defaultPrevented === undefined &&
  5218. // Support: Android <=2.3 only
  5219. src.returnValue === false ?
  5220. returnTrue :
  5221. returnFalse;
  5222. // Create target properties
  5223. // Support: Safari <=6 - 7 only
  5224. // Target should not be a text node (#504, #13143)
  5225. this.target = ( src.target && src.target.nodeType === 3 ) ?
  5226. src.target.parentNode :
  5227. src.target;
  5228. this.currentTarget = src.currentTarget;
  5229. this.relatedTarget = src.relatedTarget;
  5230. // Event type
  5231. } else {
  5232. this.type = src;
  5233. }
  5234. // Put explicitly provided properties onto the event object
  5235. if ( props ) {
  5236. jQuery.extend( this, props );
  5237. }
  5238. // Create a timestamp if incoming event doesn't have one
  5239. this.timeStamp = src && src.timeStamp || jQuery.now();
  5240. // Mark it as fixed
  5241. this[ jQuery.expando ] = true;
  5242. };
  5243. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  5244. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  5245. jQuery.Event.prototype = {
  5246. constructor: jQuery.Event,
  5247. isDefaultPrevented: returnFalse,
  5248. isPropagationStopped: returnFalse,
  5249. isImmediatePropagationStopped: returnFalse,
  5250. isSimulated: false,
  5251. preventDefault: function() {
  5252. var e = this.originalEvent;
  5253. this.isDefaultPrevented = returnTrue;
  5254. if ( e && !this.isSimulated ) {
  5255. e.preventDefault();
  5256. }
  5257. },
  5258. stopPropagation: function() {
  5259. var e = this.originalEvent;
  5260. this.isPropagationStopped = returnTrue;
  5261. if ( e && !this.isSimulated ) {
  5262. e.stopPropagation();
  5263. }
  5264. },
  5265. stopImmediatePropagation: function() {
  5266. var e = this.originalEvent;
  5267. this.isImmediatePropagationStopped = returnTrue;
  5268. if ( e && !this.isSimulated ) {
  5269. e.stopImmediatePropagation();
  5270. }
  5271. this.stopPropagation();
  5272. }
  5273. };
  5274. // Includes all common event props including KeyEvent and MouseEvent specific props
  5275. jQuery.each( {
  5276. altKey: true,
  5277. bubbles: true,
  5278. cancelable: true,
  5279. changedTouches: true,
  5280. ctrlKey: true,
  5281. detail: true,
  5282. eventPhase: true,
  5283. metaKey: true,
  5284. pageX: true,
  5285. pageY: true,
  5286. shiftKey: true,
  5287. view: true,
  5288. "char": true,
  5289. charCode: true,
  5290. key: true,
  5291. keyCode: true,
  5292. button: true,
  5293. buttons: true,
  5294. clientX: true,
  5295. clientY: true,
  5296. offsetX: true,
  5297. offsetY: true,
  5298. pointerId: true,
  5299. pointerType: true,
  5300. screenX: true,
  5301. screenY: true,
  5302. targetTouches: true,
  5303. toElement: true,
  5304. touches: true,
  5305. which: function( event ) {
  5306. var button = event.button;
  5307. // Add which for key events
  5308. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  5309. return event.charCode != null ? event.charCode : event.keyCode;
  5310. }
  5311. // Add which for click: 1 === left; 2 === middle; 3 === right
  5312. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  5313. if ( button & 1 ) {
  5314. return 1;
  5315. }
  5316. if ( button & 2 ) {
  5317. return 3;
  5318. }
  5319. if ( button & 4 ) {
  5320. return 2;
  5321. }
  5322. return 0;
  5323. }
  5324. return event.which;
  5325. }
  5326. }, jQuery.event.addProp );
  5327. // Create mouseenter/leave events using mouseover/out and event-time checks
  5328. // so that event delegation works in jQuery.
  5329. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  5330. //
  5331. // Support: Safari 7 only
  5332. // Safari sends mouseenter too often; see:
  5333. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  5334. // for the description of the bug (it existed in older Chrome versions as well).
  5335. jQuery.each( {
  5336. mouseenter: "mouseover",
  5337. mouseleave: "mouseout",
  5338. pointerenter: "pointerover",
  5339. pointerleave: "pointerout"
  5340. }, function( orig, fix ) {
  5341. jQuery.event.special[ orig ] = {
  5342. delegateType: fix,
  5343. bindType: fix,
  5344. handle: function( event ) {
  5345. var ret,
  5346. target = this,
  5347. related = event.relatedTarget,
  5348. handleObj = event.handleObj;
  5349. // For mouseenter/leave call the handler if related is outside the target.
  5350. // NB: No relatedTarget if the mouse left/entered the browser window
  5351. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  5352. event.type = handleObj.origType;
  5353. ret = handleObj.handler.apply( this, arguments );
  5354. event.type = fix;
  5355. }
  5356. return ret;
  5357. }
  5358. };
  5359. } );
  5360. jQuery.fn.extend( {
  5361. on: function( types, selector, data, fn ) {
  5362. return on( this, types, selector, data, fn );
  5363. },
  5364. one: function( types, selector, data, fn ) {
  5365. return on( this, types, selector, data, fn, 1 );
  5366. },
  5367. off: function( types, selector, fn ) {
  5368. var handleObj, type;
  5369. if ( types && types.preventDefault && types.handleObj ) {
  5370. // ( event ) dispatched jQuery.Event
  5371. handleObj = types.handleObj;
  5372. jQuery( types.delegateTarget ).off(
  5373. handleObj.namespace ?
  5374. handleObj.origType + "." + handleObj.namespace :
  5375. handleObj.origType,
  5376. handleObj.selector,
  5377. handleObj.handler
  5378. );
  5379. return this;
  5380. }
  5381. if ( typeof types === "object" ) {
  5382. // ( types-object [, selector] )
  5383. for ( type in types ) {
  5384. this.off( type, selector, types[ type ] );
  5385. }
  5386. return this;
  5387. }
  5388. if ( selector === false || typeof selector === "function" ) {
  5389. // ( types [, fn] )
  5390. fn = selector;
  5391. selector = undefined;
  5392. }
  5393. if ( fn === false ) {
  5394. fn = returnFalse;
  5395. }
  5396. return this.each( function() {
  5397. jQuery.event.remove( this, types, fn, selector );
  5398. } );
  5399. }
  5400. } );
  5401. var
  5402. /* eslint-disable max-len */
  5403. // See https://github.com/eslint/eslint/issues/3229
  5404. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  5405. /* eslint-enable */
  5406. // Support: IE <=10 - 11, Edge 12 - 13
  5407. // In IE/Edge using regex groups here causes severe slowdowns.
  5408. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  5409. rnoInnerhtml = /<script|<style|<link/i,
  5410. // checked="checked" or checked
  5411. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  5412. rscriptTypeMasked = /^true\/(.*)/,
  5413. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  5414. // Prefer a tbody over its parent table for containing new rows
  5415. function manipulationTarget( elem, content ) {
  5416. if ( nodeName( elem, "table" ) &&
  5417. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  5418. return jQuery( ">tbody", elem )[ 0 ] || elem;
  5419. }
  5420. return elem;
  5421. }
  5422. // Replace/restore the type attribute of script elements for safe DOM manipulation
  5423. function disableScript( elem ) {
  5424. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  5425. return elem;
  5426. }
  5427. function restoreScript( elem ) {
  5428. var match = rscriptTypeMasked.exec( elem.type );
  5429. if ( match ) {
  5430. elem.type = match[ 1 ];
  5431. } else {
  5432. elem.removeAttribute( "type" );
  5433. }
  5434. return elem;
  5435. }
  5436. function cloneCopyEvent( src, dest ) {
  5437. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  5438. if ( dest.nodeType !== 1 ) {
  5439. return;
  5440. }
  5441. // 1. Copy private data: events, handlers, etc.
  5442. if ( dataPriv.hasData( src ) ) {
  5443. pdataOld = dataPriv.access( src );
  5444. pdataCur = dataPriv.set( dest, pdataOld );
  5445. events = pdataOld.events;
  5446. if ( events ) {
  5447. delete pdataCur.handle;
  5448. pdataCur.events = {};
  5449. for ( type in events ) {
  5450. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  5451. jQuery.event.add( dest, type, events[ type ][ i ] );
  5452. }
  5453. }
  5454. }
  5455. }
  5456. // 2. Copy user data
  5457. if ( dataUser.hasData( src ) ) {
  5458. udataOld = dataUser.access( src );
  5459. udataCur = jQuery.extend( {}, udataOld );
  5460. dataUser.set( dest, udataCur );
  5461. }
  5462. }
  5463. // Fix IE bugs, see support tests
  5464. function fixInput( src, dest ) {
  5465. var nodeName = dest.nodeName.toLowerCase();
  5466. // Fails to persist the checked state of a cloned checkbox or radio button.
  5467. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  5468. dest.checked = src.checked;
  5469. // Fails to return the selected option to the default selected state when cloning options
  5470. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  5471. dest.defaultValue = src.defaultValue;
  5472. }
  5473. }
  5474. function domManip( collection, args, callback, ignored ) {
  5475. // Flatten any nested arrays
  5476. args = concat.apply( [], args );
  5477. var fragment, first, scripts, hasScripts, node, doc,
  5478. i = 0,
  5479. l = collection.length,
  5480. iNoClone = l - 1,
  5481. value = args[ 0 ],
  5482. isFunction = jQuery.isFunction( value );
  5483. // We can't cloneNode fragments that contain checked, in WebKit
  5484. if ( isFunction ||
  5485. ( l > 1 && typeof value === "string" &&
  5486. !support.checkClone && rchecked.test( value ) ) ) {
  5487. return collection.each( function( index ) {
  5488. var self = collection.eq( index );
  5489. if ( isFunction ) {
  5490. args[ 0 ] = value.call( this, index, self.html() );
  5491. }
  5492. domManip( self, args, callback, ignored );
  5493. } );
  5494. }
  5495. if ( l ) {
  5496. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  5497. first = fragment.firstChild;
  5498. if ( fragment.childNodes.length === 1 ) {
  5499. fragment = first;
  5500. }
  5501. // Require either new content or an interest in ignored elements to invoke the callback
  5502. if ( first || ignored ) {
  5503. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  5504. hasScripts = scripts.length;
  5505. // Use the original fragment for the last item
  5506. // instead of the first because it can end up
  5507. // being emptied incorrectly in certain situations (#8070).
  5508. for ( ; i < l; i++ ) {
  5509. node = fragment;
  5510. if ( i !== iNoClone ) {
  5511. node = jQuery.clone( node, true, true );
  5512. // Keep references to cloned scripts for later restoration
  5513. if ( hasScripts ) {
  5514. // Support: Android <=4.0 only, PhantomJS 1 only
  5515. // push.apply(_, arraylike) throws on ancient WebKit
  5516. jQuery.merge( scripts, getAll( node, "script" ) );
  5517. }
  5518. }
  5519. callback.call( collection[ i ], node, i );
  5520. }
  5521. if ( hasScripts ) {
  5522. doc = scripts[ scripts.length - 1 ].ownerDocument;
  5523. // Reenable scripts
  5524. jQuery.map( scripts, restoreScript );
  5525. // Evaluate executable scripts on first document insertion
  5526. for ( i = 0; i < hasScripts; i++ ) {
  5527. node = scripts[ i ];
  5528. if ( rscriptType.test( node.type || "" ) &&
  5529. !dataPriv.access( node, "globalEval" ) &&
  5530. jQuery.contains( doc, node ) ) {
  5531. if ( node.src ) {
  5532. // Optional AJAX dependency, but won't run scripts if not present
  5533. if ( jQuery._evalUrl ) {
  5534. jQuery._evalUrl( node.src );
  5535. }
  5536. } else {
  5537. DOMEval( node.textContent.replace( rcleanScript, "" ), doc );
  5538. }
  5539. }
  5540. }
  5541. }
  5542. }
  5543. }
  5544. return collection;
  5545. }
  5546. function remove( elem, selector, keepData ) {
  5547. var node,
  5548. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  5549. i = 0;
  5550. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  5551. if ( !keepData && node.nodeType === 1 ) {
  5552. jQuery.cleanData( getAll( node ) );
  5553. }
  5554. if ( node.parentNode ) {
  5555. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  5556. setGlobalEval( getAll( node, "script" ) );
  5557. }
  5558. node.parentNode.removeChild( node );
  5559. }
  5560. }
  5561. return elem;
  5562. }
  5563. jQuery.extend( {
  5564. htmlPrefilter: function( html ) {
  5565. return html.replace( rxhtmlTag, "<$1></$2>" );
  5566. },
  5567. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  5568. var i, l, srcElements, destElements,
  5569. clone = elem.cloneNode( true ),
  5570. inPage = jQuery.contains( elem.ownerDocument, elem );
  5571. // Fix IE cloning issues
  5572. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  5573. !jQuery.isXMLDoc( elem ) ) {
  5574. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  5575. destElements = getAll( clone );
  5576. srcElements = getAll( elem );
  5577. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  5578. fixInput( srcElements[ i ], destElements[ i ] );
  5579. }
  5580. }
  5581. // Copy the events from the original to the clone
  5582. if ( dataAndEvents ) {
  5583. if ( deepDataAndEvents ) {
  5584. srcElements = srcElements || getAll( elem );
  5585. destElements = destElements || getAll( clone );
  5586. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  5587. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  5588. }
  5589. } else {
  5590. cloneCopyEvent( elem, clone );
  5591. }
  5592. }
  5593. // Preserve script evaluation history
  5594. destElements = getAll( clone, "script" );
  5595. if ( destElements.length > 0 ) {
  5596. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  5597. }
  5598. // Return the cloned set
  5599. return clone;
  5600. },
  5601. cleanData: function( elems ) {
  5602. var data, elem, type,
  5603. special = jQuery.event.special,
  5604. i = 0;
  5605. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  5606. if ( acceptData( elem ) ) {
  5607. if ( ( data = elem[ dataPriv.expando ] ) ) {
  5608. if ( data.events ) {
  5609. for ( type in data.events ) {
  5610. if ( special[ type ] ) {
  5611. jQuery.event.remove( elem, type );
  5612. // This is a shortcut to avoid jQuery.event.remove's overhead
  5613. } else {
  5614. jQuery.removeEvent( elem, type, data.handle );
  5615. }
  5616. }
  5617. }
  5618. // Support: Chrome <=35 - 45+
  5619. // Assign undefined instead of using delete, see Data#remove
  5620. elem[ dataPriv.expando ] = undefined;
  5621. }
  5622. if ( elem[ dataUser.expando ] ) {
  5623. // Support: Chrome <=35 - 45+
  5624. // Assign undefined instead of using delete, see Data#remove
  5625. elem[ dataUser.expando ] = undefined;
  5626. }
  5627. }
  5628. }
  5629. }
  5630. } );
  5631. jQuery.fn.extend( {
  5632. detach: function( selector ) {
  5633. return remove( this, selector, true );
  5634. },
  5635. remove: function( selector ) {
  5636. return remove( this, selector );
  5637. },
  5638. text: function( value ) {
  5639. return access( this, function( value ) {
  5640. return value === undefined ?
  5641. jQuery.text( this ) :
  5642. this.empty().each( function() {
  5643. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5644. this.textContent = value;
  5645. }
  5646. } );
  5647. }, null, value, arguments.length );
  5648. },
  5649. append: function() {
  5650. return domManip( this, arguments, function( elem ) {
  5651. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5652. var target = manipulationTarget( this, elem );
  5653. target.appendChild( elem );
  5654. }
  5655. } );
  5656. },
  5657. prepend: function() {
  5658. return domManip( this, arguments, function( elem ) {
  5659. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5660. var target = manipulationTarget( this, elem );
  5661. target.insertBefore( elem, target.firstChild );
  5662. }
  5663. } );
  5664. },
  5665. before: function() {
  5666. return domManip( this, arguments, function( elem ) {
  5667. if ( this.parentNode ) {
  5668. this.parentNode.insertBefore( elem, this );
  5669. }
  5670. } );
  5671. },
  5672. after: function() {
  5673. return domManip( this, arguments, function( elem ) {
  5674. if ( this.parentNode ) {
  5675. this.parentNode.insertBefore( elem, this.nextSibling );
  5676. }
  5677. } );
  5678. },
  5679. empty: function() {
  5680. var elem,
  5681. i = 0;
  5682. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  5683. if ( elem.nodeType === 1 ) {
  5684. // Prevent memory leaks
  5685. jQuery.cleanData( getAll( elem, false ) );
  5686. // Remove any remaining nodes
  5687. elem.textContent = "";
  5688. }
  5689. }
  5690. return this;
  5691. },
  5692. clone: function( dataAndEvents, deepDataAndEvents ) {
  5693. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  5694. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  5695. return this.map( function() {
  5696. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  5697. } );
  5698. },
  5699. html: function( value ) {
  5700. return access( this, function( value ) {
  5701. var elem = this[ 0 ] || {},
  5702. i = 0,
  5703. l = this.length;
  5704. if ( value === undefined && elem.nodeType === 1 ) {
  5705. return elem.innerHTML;
  5706. }
  5707. // See if we can take a shortcut and just use innerHTML
  5708. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  5709. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  5710. value = jQuery.htmlPrefilter( value );
  5711. try {
  5712. for ( ; i < l; i++ ) {
  5713. elem = this[ i ] || {};
  5714. // Remove element nodes and prevent memory leaks
  5715. if ( elem.nodeType === 1 ) {
  5716. jQuery.cleanData( getAll( elem, false ) );
  5717. elem.innerHTML = value;
  5718. }
  5719. }
  5720. elem = 0;
  5721. // If using innerHTML throws an exception, use the fallback method
  5722. } catch ( e ) {}
  5723. }
  5724. if ( elem ) {
  5725. this.empty().append( value );
  5726. }
  5727. }, null, value, arguments.length );
  5728. },
  5729. replaceWith: function() {
  5730. var ignored = [];
  5731. // Make the changes, replacing each non-ignored context element with the new content
  5732. return domManip( this, arguments, function( elem ) {
  5733. var parent = this.parentNode;
  5734. if ( jQuery.inArray( this, ignored ) < 0 ) {
  5735. jQuery.cleanData( getAll( this ) );
  5736. if ( parent ) {
  5737. parent.replaceChild( elem, this );
  5738. }
  5739. }
  5740. // Force callback invocation
  5741. }, ignored );
  5742. }
  5743. } );
  5744. jQuery.each( {
  5745. appendTo: "append",
  5746. prependTo: "prepend",
  5747. insertBefore: "before",
  5748. insertAfter: "after",
  5749. replaceAll: "replaceWith"
  5750. }, function( name, original ) {
  5751. jQuery.fn[ name ] = function( selector ) {
  5752. var elems,
  5753. ret = [],
  5754. insert = jQuery( selector ),
  5755. last = insert.length - 1,
  5756. i = 0;
  5757. for ( ; i <= last; i++ ) {
  5758. elems = i === last ? this : this.clone( true );
  5759. jQuery( insert[ i ] )[ original ]( elems );
  5760. // Support: Android <=4.0 only, PhantomJS 1 only
  5761. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  5762. push.apply( ret, elems.get() );
  5763. }
  5764. return this.pushStack( ret );
  5765. };
  5766. } );
  5767. var rmargin = ( /^margin/ );
  5768. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  5769. var getStyles = function( elem ) {
  5770. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  5771. // IE throws on elements created in popups
  5772. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  5773. var view = elem.ownerDocument.defaultView;
  5774. if ( !view || !view.opener ) {
  5775. view = window;
  5776. }
  5777. return view.getComputedStyle( elem );
  5778. };
  5779. ( function() {
  5780. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  5781. // so they're executed at the same time to save the second computation.
  5782. function computeStyleTests() {
  5783. // This is a singleton, we need to execute it only once
  5784. if ( !div ) {
  5785. return;
  5786. }
  5787. div.style.cssText =
  5788. "box-sizing:border-box;" +
  5789. "position:relative;display:block;" +
  5790. "margin:auto;border:1px;padding:1px;" +
  5791. "top:1%;width:50%";
  5792. div.innerHTML = "";
  5793. documentElement.appendChild( container );
  5794. var divStyle = window.getComputedStyle( div );
  5795. pixelPositionVal = divStyle.top !== "1%";
  5796. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  5797. reliableMarginLeftVal = divStyle.marginLeft === "2px";
  5798. boxSizingReliableVal = divStyle.width === "4px";
  5799. // Support: Android 4.0 - 4.3 only
  5800. // Some styles come back with percentage values, even though they shouldn't
  5801. div.style.marginRight = "50%";
  5802. pixelMarginRightVal = divStyle.marginRight === "4px";
  5803. documentElement.removeChild( container );
  5804. // Nullify the div so it wouldn't be stored in the memory and
  5805. // it will also be a sign that checks already performed
  5806. div = null;
  5807. }
  5808. var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
  5809. container = document.createElement( "div" ),
  5810. div = document.createElement( "div" );
  5811. // Finish early in limited (non-browser) environments
  5812. if ( !div.style ) {
  5813. return;
  5814. }
  5815. // Support: IE <=9 - 11 only
  5816. // Style of cloned element affects source element cloned (#8908)
  5817. div.style.backgroundClip = "content-box";
  5818. div.cloneNode( true ).style.backgroundClip = "";
  5819. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  5820. container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
  5821. "padding:0;margin-top:1px;position:absolute";
  5822. container.appendChild( div );
  5823. jQuery.extend( support, {
  5824. pixelPosition: function() {
  5825. computeStyleTests();
  5826. return pixelPositionVal;
  5827. },
  5828. boxSizingReliable: function() {
  5829. computeStyleTests();
  5830. return boxSizingReliableVal;
  5831. },
  5832. pixelMarginRight: function() {
  5833. computeStyleTests();
  5834. return pixelMarginRightVal;
  5835. },
  5836. reliableMarginLeft: function() {
  5837. computeStyleTests();
  5838. return reliableMarginLeftVal;
  5839. }
  5840. } );
  5841. } )();
  5842. function curCSS( elem, name, computed ) {
  5843. var width, minWidth, maxWidth, ret,
  5844. // Support: Firefox 51+
  5845. // Retrieving style before computed somehow
  5846. // fixes an issue with getting wrong values
  5847. // on detached elements
  5848. style = elem.style;
  5849. computed = computed || getStyles( elem );
  5850. // getPropertyValue is needed for:
  5851. // .css('filter') (IE 9 only, #12537)
  5852. // .css('--customProperty) (#3144)
  5853. if ( computed ) {
  5854. ret = computed.getPropertyValue( name ) || computed[ name ];
  5855. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  5856. ret = jQuery.style( elem, name );
  5857. }
  5858. // A tribute to the "awesome hack by Dean Edwards"
  5859. // Android Browser returns percentage for some values,
  5860. // but width seems to be reliably pixels.
  5861. // This is against the CSSOM draft spec:
  5862. // https://drafts.csswg.org/cssom/#resolved-values
  5863. if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
  5864. // Remember the original values
  5865. width = style.width;
  5866. minWidth = style.minWidth;
  5867. maxWidth = style.maxWidth;
  5868. // Put in the new values to get a computed value out
  5869. style.minWidth = style.maxWidth = style.width = ret;
  5870. ret = computed.width;
  5871. // Revert the changed values
  5872. style.width = width;
  5873. style.minWidth = minWidth;
  5874. style.maxWidth = maxWidth;
  5875. }
  5876. }
  5877. return ret !== undefined ?
  5878. // Support: IE <=9 - 11 only
  5879. // IE returns zIndex value as an integer.
  5880. ret + "" :
  5881. ret;
  5882. }
  5883. function addGetHookIf( conditionFn, hookFn ) {
  5884. // Define the hook, we'll check on the first run if it's really needed.
  5885. return {
  5886. get: function() {
  5887. if ( conditionFn() ) {
  5888. // Hook not needed (or it's not possible to use it due
  5889. // to missing dependency), remove it.
  5890. delete this.get;
  5891. return;
  5892. }
  5893. // Hook needed; redefine it so that the support test is not executed again.
  5894. return ( this.get = hookFn ).apply( this, arguments );
  5895. }
  5896. };
  5897. }
  5898. var
  5899. // Swappable if display is none or starts with table
  5900. // except "table", "table-cell", or "table-caption"
  5901. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  5902. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  5903. rcustomProp = /^--/,
  5904. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  5905. cssNormalTransform = {
  5906. letterSpacing: "0",
  5907. fontWeight: "400"
  5908. },
  5909. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  5910. emptyStyle = document.createElement( "div" ).style;
  5911. // Return a css property mapped to a potentially vendor prefixed property
  5912. function vendorPropName( name ) {
  5913. // Shortcut for names that are not vendor prefixed
  5914. if ( name in emptyStyle ) {
  5915. return name;
  5916. }
  5917. // Check for vendor prefixed names
  5918. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  5919. i = cssPrefixes.length;
  5920. while ( i-- ) {
  5921. name = cssPrefixes[ i ] + capName;
  5922. if ( name in emptyStyle ) {
  5923. return name;
  5924. }
  5925. }
  5926. }
  5927. // Return a property mapped along what jQuery.cssProps suggests or to
  5928. // a vendor prefixed property.
  5929. function finalPropName( name ) {
  5930. var ret = jQuery.cssProps[ name ];
  5931. if ( !ret ) {
  5932. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  5933. }
  5934. return ret;
  5935. }
  5936. function setPositiveNumber( elem, value, subtract ) {
  5937. // Any relative (+/-) values have already been
  5938. // normalized at this point
  5939. var matches = rcssNum.exec( value );
  5940. return matches ?
  5941. // Guard against undefined "subtract", e.g., when used as in cssHooks
  5942. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  5943. value;
  5944. }
  5945. function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
  5946. var i,
  5947. val = 0;
  5948. // If we already have the right measurement, avoid augmentation
  5949. if ( extra === ( isBorderBox ? "border" : "content" ) ) {
  5950. i = 4;
  5951. // Otherwise initialize for horizontal or vertical properties
  5952. } else {
  5953. i = name === "width" ? 1 : 0;
  5954. }
  5955. for ( ; i < 4; i += 2 ) {
  5956. // Both box models exclude margin, so add it if we want it
  5957. if ( extra === "margin" ) {
  5958. val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
  5959. }
  5960. if ( isBorderBox ) {
  5961. // border-box includes padding, so remove it if we want content
  5962. if ( extra === "content" ) {
  5963. val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5964. }
  5965. // At this point, extra isn't border nor margin, so remove border
  5966. if ( extra !== "margin" ) {
  5967. val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5968. }
  5969. } else {
  5970. // At this point, extra isn't content, so add padding
  5971. val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5972. // At this point, extra isn't content nor padding, so add border
  5973. if ( extra !== "padding" ) {
  5974. val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5975. }
  5976. }
  5977. }
  5978. return val;
  5979. }
  5980. function getWidthOrHeight( elem, name, extra ) {
  5981. // Start with computed style
  5982. var valueIsBorderBox,
  5983. styles = getStyles( elem ),
  5984. val = curCSS( elem, name, styles ),
  5985. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  5986. // Computed unit is not pixels. Stop here and return.
  5987. if ( rnumnonpx.test( val ) ) {
  5988. return val;
  5989. }
  5990. // Check for style in case a browser which returns unreliable values
  5991. // for getComputedStyle silently falls back to the reliable elem.style
  5992. valueIsBorderBox = isBorderBox &&
  5993. ( support.boxSizingReliable() || val === elem.style[ name ] );
  5994. // Fall back to offsetWidth/Height when value is "auto"
  5995. // This happens for inline elements with no explicit setting (gh-3571)
  5996. if ( val === "auto" ) {
  5997. val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ];
  5998. }
  5999. // Normalize "", auto, and prepare for extra
  6000. val = parseFloat( val ) || 0;
  6001. // Use the active box-sizing model to add/subtract irrelevant styles
  6002. return ( val +
  6003. augmentWidthOrHeight(
  6004. elem,
  6005. name,
  6006. extra || ( isBorderBox ? "border" : "content" ),
  6007. valueIsBorderBox,
  6008. styles
  6009. )
  6010. ) + "px";
  6011. }
  6012. jQuery.extend( {
  6013. // Add in style property hooks for overriding the default
  6014. // behavior of getting and setting a style property
  6015. cssHooks: {
  6016. opacity: {
  6017. get: function( elem, computed ) {
  6018. if ( computed ) {
  6019. // We should always get a number back from opacity
  6020. var ret = curCSS( elem, "opacity" );
  6021. return ret === "" ? "1" : ret;
  6022. }
  6023. }
  6024. }
  6025. },
  6026. // Don't automatically add "px" to these possibly-unitless properties
  6027. cssNumber: {
  6028. "animationIterationCount": true,
  6029. "columnCount": true,
  6030. "fillOpacity": true,
  6031. "flexGrow": true,
  6032. "flexShrink": true,
  6033. "fontWeight": true,
  6034. "lineHeight": true,
  6035. "opacity": true,
  6036. "order": true,
  6037. "orphans": true,
  6038. "widows": true,
  6039. "zIndex": true,
  6040. "zoom": true
  6041. },
  6042. // Add in properties whose names you wish to fix before
  6043. // setting or getting the value
  6044. cssProps: {
  6045. "float": "cssFloat"
  6046. },
  6047. // Get and set the style property on a DOM Node
  6048. style: function( elem, name, value, extra ) {
  6049. // Don't set styles on text and comment nodes
  6050. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  6051. return;
  6052. }
  6053. // Make sure that we're working with the right name
  6054. var ret, type, hooks,
  6055. origName = jQuery.camelCase( name ),
  6056. isCustomProp = rcustomProp.test( name ),
  6057. style = elem.style;
  6058. // Make sure that we're working with the right name. We don't
  6059. // want to query the value if it is a CSS custom property
  6060. // since they are user-defined.
  6061. if ( !isCustomProp ) {
  6062. name = finalPropName( origName );
  6063. }
  6064. // Gets hook for the prefixed version, then unprefixed version
  6065. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  6066. // Check if we're setting a value
  6067. if ( value !== undefined ) {
  6068. type = typeof value;
  6069. // Convert "+=" or "-=" to relative numbers (#7345)
  6070. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  6071. value = adjustCSS( elem, name, ret );
  6072. // Fixes bug #9237
  6073. type = "number";
  6074. }
  6075. // Make sure that null and NaN values aren't set (#7116)
  6076. if ( value == null || value !== value ) {
  6077. return;
  6078. }
  6079. // If a number was passed in, add the unit (except for certain CSS properties)
  6080. if ( type === "number" ) {
  6081. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  6082. }
  6083. // background-* props affect original clone's values
  6084. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  6085. style[ name ] = "inherit";
  6086. }
  6087. // If a hook was provided, use that value, otherwise just set the specified value
  6088. if ( !hooks || !( "set" in hooks ) ||
  6089. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  6090. if ( isCustomProp ) {
  6091. style.setProperty( name, value );
  6092. } else {
  6093. style[ name ] = value;
  6094. }
  6095. }
  6096. } else {
  6097. // If a hook was provided get the non-computed value from there
  6098. if ( hooks && "get" in hooks &&
  6099. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  6100. return ret;
  6101. }
  6102. // Otherwise just get the value from the style object
  6103. return style[ name ];
  6104. }
  6105. },
  6106. css: function( elem, name, extra, styles ) {
  6107. var val, num, hooks,
  6108. origName = jQuery.camelCase( name ),
  6109. isCustomProp = rcustomProp.test( name );
  6110. // Make sure that we're working with the right name. We don't
  6111. // want to modify the value if it is a CSS custom property
  6112. // since they are user-defined.
  6113. if ( !isCustomProp ) {
  6114. name = finalPropName( origName );
  6115. }
  6116. // Try prefixed name followed by the unprefixed name
  6117. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  6118. // If a hook was provided get the computed value from there
  6119. if ( hooks && "get" in hooks ) {
  6120. val = hooks.get( elem, true, extra );
  6121. }
  6122. // Otherwise, if a way to get the computed value exists, use that
  6123. if ( val === undefined ) {
  6124. val = curCSS( elem, name, styles );
  6125. }
  6126. // Convert "normal" to computed value
  6127. if ( val === "normal" && name in cssNormalTransform ) {
  6128. val = cssNormalTransform[ name ];
  6129. }
  6130. // Make numeric if forced or a qualifier was provided and val looks numeric
  6131. if ( extra === "" || extra ) {
  6132. num = parseFloat( val );
  6133. return extra === true || isFinite( num ) ? num || 0 : val;
  6134. }
  6135. return val;
  6136. }
  6137. } );
  6138. jQuery.each( [ "height", "width" ], function( i, name ) {
  6139. jQuery.cssHooks[ name ] = {
  6140. get: function( elem, computed, extra ) {
  6141. if ( computed ) {
  6142. // Certain elements can have dimension info if we invisibly show them
  6143. // but it must have a current display style that would benefit
  6144. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  6145. // Support: Safari 8+
  6146. // Table columns in Safari have non-zero offsetWidth & zero
  6147. // getBoundingClientRect().width unless display is changed.
  6148. // Support: IE <=11 only
  6149. // Running getBoundingClientRect on a disconnected node
  6150. // in IE throws an error.
  6151. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  6152. swap( elem, cssShow, function() {
  6153. return getWidthOrHeight( elem, name, extra );
  6154. } ) :
  6155. getWidthOrHeight( elem, name, extra );
  6156. }
  6157. },
  6158. set: function( elem, value, extra ) {
  6159. var matches,
  6160. styles = extra && getStyles( elem ),
  6161. subtract = extra && augmentWidthOrHeight(
  6162. elem,
  6163. name,
  6164. extra,
  6165. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  6166. styles
  6167. );
  6168. // Convert to pixels if value adjustment is needed
  6169. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  6170. ( matches[ 3 ] || "px" ) !== "px" ) {
  6171. elem.style[ name ] = value;
  6172. value = jQuery.css( elem, name );
  6173. }
  6174. return setPositiveNumber( elem, value, subtract );
  6175. }
  6176. };
  6177. } );
  6178. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  6179. function( elem, computed ) {
  6180. if ( computed ) {
  6181. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  6182. elem.getBoundingClientRect().left -
  6183. swap( elem, { marginLeft: 0 }, function() {
  6184. return elem.getBoundingClientRect().left;
  6185. } )
  6186. ) + "px";
  6187. }
  6188. }
  6189. );
  6190. // These hooks are used by animate to expand properties
  6191. jQuery.each( {
  6192. margin: "",
  6193. padding: "",
  6194. border: "Width"
  6195. }, function( prefix, suffix ) {
  6196. jQuery.cssHooks[ prefix + suffix ] = {
  6197. expand: function( value ) {
  6198. var i = 0,
  6199. expanded = {},
  6200. // Assumes a single number if not a string
  6201. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  6202. for ( ; i < 4; i++ ) {
  6203. expanded[ prefix + cssExpand[ i ] + suffix ] =
  6204. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  6205. }
  6206. return expanded;
  6207. }
  6208. };
  6209. if ( !rmargin.test( prefix ) ) {
  6210. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  6211. }
  6212. } );
  6213. jQuery.fn.extend( {
  6214. css: function( name, value ) {
  6215. return access( this, function( elem, name, value ) {
  6216. var styles, len,
  6217. map = {},
  6218. i = 0;
  6219. if ( Array.isArray( name ) ) {
  6220. styles = getStyles( elem );
  6221. len = name.length;
  6222. for ( ; i < len; i++ ) {
  6223. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  6224. }
  6225. return map;
  6226. }
  6227. return value !== undefined ?
  6228. jQuery.style( elem, name, value ) :
  6229. jQuery.css( elem, name );
  6230. }, name, value, arguments.length > 1 );
  6231. }
  6232. } );
  6233. function Tween( elem, options, prop, end, easing ) {
  6234. return new Tween.prototype.init( elem, options, prop, end, easing );
  6235. }
  6236. jQuery.Tween = Tween;
  6237. Tween.prototype = {
  6238. constructor: Tween,
  6239. init: function( elem, options, prop, end, easing, unit ) {
  6240. this.elem = elem;
  6241. this.prop = prop;
  6242. this.easing = easing || jQuery.easing._default;
  6243. this.options = options;
  6244. this.start = this.now = this.cur();
  6245. this.end = end;
  6246. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  6247. },
  6248. cur: function() {
  6249. var hooks = Tween.propHooks[ this.prop ];
  6250. return hooks && hooks.get ?
  6251. hooks.get( this ) :
  6252. Tween.propHooks._default.get( this );
  6253. },
  6254. run: function( percent ) {
  6255. var eased,
  6256. hooks = Tween.propHooks[ this.prop ];
  6257. if ( this.options.duration ) {
  6258. this.pos = eased = jQuery.easing[ this.easing ](
  6259. percent, this.options.duration * percent, 0, 1, this.options.duration
  6260. );
  6261. } else {
  6262. this.pos = eased = percent;
  6263. }
  6264. this.now = ( this.end - this.start ) * eased + this.start;
  6265. if ( this.options.step ) {
  6266. this.options.step.call( this.elem, this.now, this );
  6267. }
  6268. if ( hooks && hooks.set ) {
  6269. hooks.set( this );
  6270. } else {
  6271. Tween.propHooks._default.set( this );
  6272. }
  6273. return this;
  6274. }
  6275. };
  6276. Tween.prototype.init.prototype = Tween.prototype;
  6277. Tween.propHooks = {
  6278. _default: {
  6279. get: function( tween ) {
  6280. var result;
  6281. // Use a property on the element directly when it is not a DOM element,
  6282. // or when there is no matching style property that exists.
  6283. if ( tween.elem.nodeType !== 1 ||
  6284. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  6285. return tween.elem[ tween.prop ];
  6286. }
  6287. // Passing an empty string as a 3rd parameter to .css will automatically
  6288. // attempt a parseFloat and fallback to a string if the parse fails.
  6289. // Simple values such as "10px" are parsed to Float;
  6290. // complex values such as "rotate(1rad)" are returned as-is.
  6291. result = jQuery.css( tween.elem, tween.prop, "" );
  6292. // Empty strings, null, undefined and "auto" are converted to 0.
  6293. return !result || result === "auto" ? 0 : result;
  6294. },
  6295. set: function( tween ) {
  6296. // Use step hook for back compat.
  6297. // Use cssHook if its there.
  6298. // Use .style if available and use plain properties where available.
  6299. if ( jQuery.fx.step[ tween.prop ] ) {
  6300. jQuery.fx.step[ tween.prop ]( tween );
  6301. } else if ( tween.elem.nodeType === 1 &&
  6302. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  6303. jQuery.cssHooks[ tween.prop ] ) ) {
  6304. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  6305. } else {
  6306. tween.elem[ tween.prop ] = tween.now;
  6307. }
  6308. }
  6309. }
  6310. };
  6311. // Support: IE <=9 only
  6312. // Panic based approach to setting things on disconnected nodes
  6313. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  6314. set: function( tween ) {
  6315. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  6316. tween.elem[ tween.prop ] = tween.now;
  6317. }
  6318. }
  6319. };
  6320. jQuery.easing = {
  6321. linear: function( p ) {
  6322. return p;
  6323. },
  6324. swing: function( p ) {
  6325. return 0.5 - Math.cos( p * Math.PI ) / 2;
  6326. },
  6327. _default: "swing"
  6328. };
  6329. jQuery.fx = Tween.prototype.init;
  6330. // Back compat <1.8 extension point
  6331. jQuery.fx.step = {};
  6332. var
  6333. fxNow, inProgress,
  6334. rfxtypes = /^(?:toggle|show|hide)$/,
  6335. rrun = /queueHooks$/;
  6336. function schedule() {
  6337. if ( inProgress ) {
  6338. if ( document.hidden === false && window.requestAnimationFrame ) {
  6339. window.requestAnimationFrame( schedule );
  6340. } else {
  6341. window.setTimeout( schedule, jQuery.fx.interval );
  6342. }
  6343. jQuery.fx.tick();
  6344. }
  6345. }
  6346. // Animations created synchronously will run synchronously
  6347. function createFxNow() {
  6348. window.setTimeout( function() {
  6349. fxNow = undefined;
  6350. } );
  6351. return ( fxNow = jQuery.now() );
  6352. }
  6353. // Generate parameters to create a standard animation
  6354. function genFx( type, includeWidth ) {
  6355. var which,
  6356. i = 0,
  6357. attrs = { height: type };
  6358. // If we include width, step value is 1 to do all cssExpand values,
  6359. // otherwise step value is 2 to skip over Left and Right
  6360. includeWidth = includeWidth ? 1 : 0;
  6361. for ( ; i < 4; i += 2 - includeWidth ) {
  6362. which = cssExpand[ i ];
  6363. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  6364. }
  6365. if ( includeWidth ) {
  6366. attrs.opacity = attrs.width = type;
  6367. }
  6368. return attrs;
  6369. }
  6370. function createTween( value, prop, animation ) {
  6371. var tween,
  6372. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  6373. index = 0,
  6374. length = collection.length;
  6375. for ( ; index < length; index++ ) {
  6376. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  6377. // We're done with this property
  6378. return tween;
  6379. }
  6380. }
  6381. }
  6382. function defaultPrefilter( elem, props, opts ) {
  6383. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  6384. isBox = "width" in props || "height" in props,
  6385. anim = this,
  6386. orig = {},
  6387. style = elem.style,
  6388. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  6389. dataShow = dataPriv.get( elem, "fxshow" );
  6390. // Queue-skipping animations hijack the fx hooks
  6391. if ( !opts.queue ) {
  6392. hooks = jQuery._queueHooks( elem, "fx" );
  6393. if ( hooks.unqueued == null ) {
  6394. hooks.unqueued = 0;
  6395. oldfire = hooks.empty.fire;
  6396. hooks.empty.fire = function() {
  6397. if ( !hooks.unqueued ) {
  6398. oldfire();
  6399. }
  6400. };
  6401. }
  6402. hooks.unqueued++;
  6403. anim.always( function() {
  6404. // Ensure the complete handler is called before this completes
  6405. anim.always( function() {
  6406. hooks.unqueued--;
  6407. if ( !jQuery.queue( elem, "fx" ).length ) {
  6408. hooks.empty.fire();
  6409. }
  6410. } );
  6411. } );
  6412. }
  6413. // Detect show/hide animations
  6414. for ( prop in props ) {
  6415. value = props[ prop ];
  6416. if ( rfxtypes.test( value ) ) {
  6417. delete props[ prop ];
  6418. toggle = toggle || value === "toggle";
  6419. if ( value === ( hidden ? "hide" : "show" ) ) {
  6420. // Pretend to be hidden if this is a "show" and
  6421. // there is still data from a stopped show/hide
  6422. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  6423. hidden = true;
  6424. // Ignore all other no-op show/hide data
  6425. } else {
  6426. continue;
  6427. }
  6428. }
  6429. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  6430. }
  6431. }
  6432. // Bail out if this is a no-op like .hide().hide()
  6433. propTween = !jQuery.isEmptyObject( props );
  6434. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  6435. return;
  6436. }
  6437. // Restrict "overflow" and "display" styles during box animations
  6438. if ( isBox && elem.nodeType === 1 ) {
  6439. // Support: IE <=9 - 11, Edge 12 - 13
  6440. // Record all 3 overflow attributes because IE does not infer the shorthand
  6441. // from identically-valued overflowX and overflowY
  6442. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  6443. // Identify a display type, preferring old show/hide data over the CSS cascade
  6444. restoreDisplay = dataShow && dataShow.display;
  6445. if ( restoreDisplay == null ) {
  6446. restoreDisplay = dataPriv.get( elem, "display" );
  6447. }
  6448. display = jQuery.css( elem, "display" );
  6449. if ( display === "none" ) {
  6450. if ( restoreDisplay ) {
  6451. display = restoreDisplay;
  6452. } else {
  6453. // Get nonempty value(s) by temporarily forcing visibility
  6454. showHide( [ elem ], true );
  6455. restoreDisplay = elem.style.display || restoreDisplay;
  6456. display = jQuery.css( elem, "display" );
  6457. showHide( [ elem ] );
  6458. }
  6459. }
  6460. // Animate inline elements as inline-block
  6461. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  6462. if ( jQuery.css( elem, "float" ) === "none" ) {
  6463. // Restore the original display value at the end of pure show/hide animations
  6464. if ( !propTween ) {
  6465. anim.done( function() {
  6466. style.display = restoreDisplay;
  6467. } );
  6468. if ( restoreDisplay == null ) {
  6469. display = style.display;
  6470. restoreDisplay = display === "none" ? "" : display;
  6471. }
  6472. }
  6473. style.display = "inline-block";
  6474. }
  6475. }
  6476. }
  6477. if ( opts.overflow ) {
  6478. style.overflow = "hidden";
  6479. anim.always( function() {
  6480. style.overflow = opts.overflow[ 0 ];
  6481. style.overflowX = opts.overflow[ 1 ];
  6482. style.overflowY = opts.overflow[ 2 ];
  6483. } );
  6484. }
  6485. // Implement show/hide animations
  6486. propTween = false;
  6487. for ( prop in orig ) {
  6488. // General show/hide setup for this element animation
  6489. if ( !propTween ) {
  6490. if ( dataShow ) {
  6491. if ( "hidden" in dataShow ) {
  6492. hidden = dataShow.hidden;
  6493. }
  6494. } else {
  6495. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  6496. }
  6497. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  6498. if ( toggle ) {
  6499. dataShow.hidden = !hidden;
  6500. }
  6501. // Show elements before animating them
  6502. if ( hidden ) {
  6503. showHide( [ elem ], true );
  6504. }
  6505. /* eslint-disable no-loop-func */
  6506. anim.done( function() {
  6507. /* eslint-enable no-loop-func */
  6508. // The final step of a "hide" animation is actually hiding the element
  6509. if ( !hidden ) {
  6510. showHide( [ elem ] );
  6511. }
  6512. dataPriv.remove( elem, "fxshow" );
  6513. for ( prop in orig ) {
  6514. jQuery.style( elem, prop, orig[ prop ] );
  6515. }
  6516. } );
  6517. }
  6518. // Per-property setup
  6519. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  6520. if ( !( prop in dataShow ) ) {
  6521. dataShow[ prop ] = propTween.start;
  6522. if ( hidden ) {
  6523. propTween.end = propTween.start;
  6524. propTween.start = 0;
  6525. }
  6526. }
  6527. }
  6528. }
  6529. function propFilter( props, specialEasing ) {
  6530. var index, name, easing, value, hooks;
  6531. // camelCase, specialEasing and expand cssHook pass
  6532. for ( index in props ) {
  6533. name = jQuery.camelCase( index );
  6534. easing = specialEasing[ name ];
  6535. value = props[ index ];
  6536. if ( Array.isArray( value ) ) {
  6537. easing = value[ 1 ];
  6538. value = props[ index ] = value[ 0 ];
  6539. }
  6540. if ( index !== name ) {
  6541. props[ name ] = value;
  6542. delete props[ index ];
  6543. }
  6544. hooks = jQuery.cssHooks[ name ];
  6545. if ( hooks && "expand" in hooks ) {
  6546. value = hooks.expand( value );
  6547. delete props[ name ];
  6548. // Not quite $.extend, this won't overwrite existing keys.
  6549. // Reusing 'index' because we have the correct "name"
  6550. for ( index in value ) {
  6551. if ( !( index in props ) ) {
  6552. props[ index ] = value[ index ];
  6553. specialEasing[ index ] = easing;
  6554. }
  6555. }
  6556. } else {
  6557. specialEasing[ name ] = easing;
  6558. }
  6559. }
  6560. }
  6561. function Animation( elem, properties, options ) {
  6562. var result,
  6563. stopped,
  6564. index = 0,
  6565. length = Animation.prefilters.length,
  6566. deferred = jQuery.Deferred().always( function() {
  6567. // Don't match elem in the :animated selector
  6568. delete tick.elem;
  6569. } ),
  6570. tick = function() {
  6571. if ( stopped ) {
  6572. return false;
  6573. }
  6574. var currentTime = fxNow || createFxNow(),
  6575. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  6576. // Support: Android 2.3 only
  6577. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  6578. temp = remaining / animation.duration || 0,
  6579. percent = 1 - temp,
  6580. index = 0,
  6581. length = animation.tweens.length;
  6582. for ( ; index < length; index++ ) {
  6583. animation.tweens[ index ].run( percent );
  6584. }
  6585. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  6586. // If there's more to do, yield
  6587. if ( percent < 1 && length ) {
  6588. return remaining;
  6589. }
  6590. // If this was an empty animation, synthesize a final progress notification
  6591. if ( !length ) {
  6592. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  6593. }
  6594. // Resolve the animation and report its conclusion
  6595. deferred.resolveWith( elem, [ animation ] );
  6596. return false;
  6597. },
  6598. animation = deferred.promise( {
  6599. elem: elem,
  6600. props: jQuery.extend( {}, properties ),
  6601. opts: jQuery.extend( true, {
  6602. specialEasing: {},
  6603. easing: jQuery.easing._default
  6604. }, options ),
  6605. originalProperties: properties,
  6606. originalOptions: options,
  6607. startTime: fxNow || createFxNow(),
  6608. duration: options.duration,
  6609. tweens: [],
  6610. createTween: function( prop, end ) {
  6611. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  6612. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  6613. animation.tweens.push( tween );
  6614. return tween;
  6615. },
  6616. stop: function( gotoEnd ) {
  6617. var index = 0,
  6618. // If we are going to the end, we want to run all the tweens
  6619. // otherwise we skip this part
  6620. length = gotoEnd ? animation.tweens.length : 0;
  6621. if ( stopped ) {
  6622. return this;
  6623. }
  6624. stopped = true;
  6625. for ( ; index < length; index++ ) {
  6626. animation.tweens[ index ].run( 1 );
  6627. }
  6628. // Resolve when we played the last frame; otherwise, reject
  6629. if ( gotoEnd ) {
  6630. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  6631. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  6632. } else {
  6633. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  6634. }
  6635. return this;
  6636. }
  6637. } ),
  6638. props = animation.props;
  6639. propFilter( props, animation.opts.specialEasing );
  6640. for ( ; index < length; index++ ) {
  6641. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  6642. if ( result ) {
  6643. if ( jQuery.isFunction( result.stop ) ) {
  6644. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  6645. jQuery.proxy( result.stop, result );
  6646. }
  6647. return result;
  6648. }
  6649. }
  6650. jQuery.map( props, createTween, animation );
  6651. if ( jQuery.isFunction( animation.opts.start ) ) {
  6652. animation.opts.start.call( elem, animation );
  6653. }
  6654. // Attach callbacks from options
  6655. animation
  6656. .progress( animation.opts.progress )
  6657. .done( animation.opts.done, animation.opts.complete )
  6658. .fail( animation.opts.fail )
  6659. .always( animation.opts.always );
  6660. jQuery.fx.timer(
  6661. jQuery.extend( tick, {
  6662. elem: elem,
  6663. anim: animation,
  6664. queue: animation.opts.queue
  6665. } )
  6666. );
  6667. return animation;
  6668. }
  6669. jQuery.Animation = jQuery.extend( Animation, {
  6670. tweeners: {
  6671. "*": [ function( prop, value ) {
  6672. var tween = this.createTween( prop, value );
  6673. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  6674. return tween;
  6675. } ]
  6676. },
  6677. tweener: function( props, callback ) {
  6678. if ( jQuery.isFunction( props ) ) {
  6679. callback = props;
  6680. props = [ "*" ];
  6681. } else {
  6682. props = props.match( rnothtmlwhite );
  6683. }
  6684. var prop,
  6685. index = 0,
  6686. length = props.length;
  6687. for ( ; index < length; index++ ) {
  6688. prop = props[ index ];
  6689. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  6690. Animation.tweeners[ prop ].unshift( callback );
  6691. }
  6692. },
  6693. prefilters: [ defaultPrefilter ],
  6694. prefilter: function( callback, prepend ) {
  6695. if ( prepend ) {
  6696. Animation.prefilters.unshift( callback );
  6697. } else {
  6698. Animation.prefilters.push( callback );
  6699. }
  6700. }
  6701. } );
  6702. jQuery.speed = function( speed, easing, fn ) {
  6703. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  6704. complete: fn || !fn && easing ||
  6705. jQuery.isFunction( speed ) && speed,
  6706. duration: speed,
  6707. easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
  6708. };
  6709. // Go to the end state if fx are off
  6710. if ( jQuery.fx.off ) {
  6711. opt.duration = 0;
  6712. } else {
  6713. if ( typeof opt.duration !== "number" ) {
  6714. if ( opt.duration in jQuery.fx.speeds ) {
  6715. opt.duration = jQuery.fx.speeds[ opt.duration ];
  6716. } else {
  6717. opt.duration = jQuery.fx.speeds._default;
  6718. }
  6719. }
  6720. }
  6721. // Normalize opt.queue - true/undefined/null -> "fx"
  6722. if ( opt.queue == null || opt.queue === true ) {
  6723. opt.queue = "fx";
  6724. }
  6725. // Queueing
  6726. opt.old = opt.complete;
  6727. opt.complete = function() {
  6728. if ( jQuery.isFunction( opt.old ) ) {
  6729. opt.old.call( this );
  6730. }
  6731. if ( opt.queue ) {
  6732. jQuery.dequeue( this, opt.queue );
  6733. }
  6734. };
  6735. return opt;
  6736. };
  6737. jQuery.fn.extend( {
  6738. fadeTo: function( speed, to, easing, callback ) {
  6739. // Show any hidden elements after setting opacity to 0
  6740. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  6741. // Animate to the value specified
  6742. .end().animate( { opacity: to }, speed, easing, callback );
  6743. },
  6744. animate: function( prop, speed, easing, callback ) {
  6745. var empty = jQuery.isEmptyObject( prop ),
  6746. optall = jQuery.speed( speed, easing, callback ),
  6747. doAnimation = function() {
  6748. // Operate on a copy of prop so per-property easing won't be lost
  6749. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  6750. // Empty animations, or finishing resolves immediately
  6751. if ( empty || dataPriv.get( this, "finish" ) ) {
  6752. anim.stop( true );
  6753. }
  6754. };
  6755. doAnimation.finish = doAnimation;
  6756. return empty || optall.queue === false ?
  6757. this.each( doAnimation ) :
  6758. this.queue( optall.queue, doAnimation );
  6759. },
  6760. stop: function( type, clearQueue, gotoEnd ) {
  6761. var stopQueue = function( hooks ) {
  6762. var stop = hooks.stop;
  6763. delete hooks.stop;
  6764. stop( gotoEnd );
  6765. };
  6766. if ( typeof type !== "string" ) {
  6767. gotoEnd = clearQueue;
  6768. clearQueue = type;
  6769. type = undefined;
  6770. }
  6771. if ( clearQueue && type !== false ) {
  6772. this.queue( type || "fx", [] );
  6773. }
  6774. return this.each( function() {
  6775. var dequeue = true,
  6776. index = type != null && type + "queueHooks",
  6777. timers = jQuery.timers,
  6778. data = dataPriv.get( this );
  6779. if ( index ) {
  6780. if ( data[ index ] && data[ index ].stop ) {
  6781. stopQueue( data[ index ] );
  6782. }
  6783. } else {
  6784. for ( index in data ) {
  6785. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  6786. stopQueue( data[ index ] );
  6787. }
  6788. }
  6789. }
  6790. for ( index = timers.length; index--; ) {
  6791. if ( timers[ index ].elem === this &&
  6792. ( type == null || timers[ index ].queue === type ) ) {
  6793. timers[ index ].anim.stop( gotoEnd );
  6794. dequeue = false;
  6795. timers.splice( index, 1 );
  6796. }
  6797. }
  6798. // Start the next in the queue if the last step wasn't forced.
  6799. // Timers currently will call their complete callbacks, which
  6800. // will dequeue but only if they were gotoEnd.
  6801. if ( dequeue || !gotoEnd ) {
  6802. jQuery.dequeue( this, type );
  6803. }
  6804. } );
  6805. },
  6806. finish: function( type ) {
  6807. if ( type !== false ) {
  6808. type = type || "fx";
  6809. }
  6810. return this.each( function() {
  6811. var index,
  6812. data = dataPriv.get( this ),
  6813. queue = data[ type + "queue" ],
  6814. hooks = data[ type + "queueHooks" ],
  6815. timers = jQuery.timers,
  6816. length = queue ? queue.length : 0;
  6817. // Enable finishing flag on private data
  6818. data.finish = true;
  6819. // Empty the queue first
  6820. jQuery.queue( this, type, [] );
  6821. if ( hooks && hooks.stop ) {
  6822. hooks.stop.call( this, true );
  6823. }
  6824. // Look for any active animations, and finish them
  6825. for ( index = timers.length; index--; ) {
  6826. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  6827. timers[ index ].anim.stop( true );
  6828. timers.splice( index, 1 );
  6829. }
  6830. }
  6831. // Look for any animations in the old queue and finish them
  6832. for ( index = 0; index < length; index++ ) {
  6833. if ( queue[ index ] && queue[ index ].finish ) {
  6834. queue[ index ].finish.call( this );
  6835. }
  6836. }
  6837. // Turn off finishing flag
  6838. delete data.finish;
  6839. } );
  6840. }
  6841. } );
  6842. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  6843. var cssFn = jQuery.fn[ name ];
  6844. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6845. return speed == null || typeof speed === "boolean" ?
  6846. cssFn.apply( this, arguments ) :
  6847. this.animate( genFx( name, true ), speed, easing, callback );
  6848. };
  6849. } );
  6850. // Generate shortcuts for custom animations
  6851. jQuery.each( {
  6852. slideDown: genFx( "show" ),
  6853. slideUp: genFx( "hide" ),
  6854. slideToggle: genFx( "toggle" ),
  6855. fadeIn: { opacity: "show" },
  6856. fadeOut: { opacity: "hide" },
  6857. fadeToggle: { opacity: "toggle" }
  6858. }, function( name, props ) {
  6859. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6860. return this.animate( props, speed, easing, callback );
  6861. };
  6862. } );
  6863. jQuery.timers = [];
  6864. jQuery.fx.tick = function() {
  6865. var timer,
  6866. i = 0,
  6867. timers = jQuery.timers;
  6868. fxNow = jQuery.now();
  6869. for ( ; i < timers.length; i++ ) {
  6870. timer = timers[ i ];
  6871. // Run the timer and safely remove it when done (allowing for external removal)
  6872. if ( !timer() && timers[ i ] === timer ) {
  6873. timers.splice( i--, 1 );
  6874. }
  6875. }
  6876. if ( !timers.length ) {
  6877. jQuery.fx.stop();
  6878. }
  6879. fxNow = undefined;
  6880. };
  6881. jQuery.fx.timer = function( timer ) {
  6882. jQuery.timers.push( timer );
  6883. jQuery.fx.start();
  6884. };
  6885. jQuery.fx.interval = 13;
  6886. jQuery.fx.start = function() {
  6887. if ( inProgress ) {
  6888. return;
  6889. }
  6890. inProgress = true;
  6891. schedule();
  6892. };
  6893. jQuery.fx.stop = function() {
  6894. inProgress = null;
  6895. };
  6896. jQuery.fx.speeds = {
  6897. slow: 600,
  6898. fast: 200,
  6899. // Default speed
  6900. _default: 400
  6901. };
  6902. // Based off of the plugin by Clint Helfers, with permission.
  6903. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  6904. jQuery.fn.delay = function( time, type ) {
  6905. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  6906. type = type || "fx";
  6907. return this.queue( type, function( next, hooks ) {
  6908. var timeout = window.setTimeout( next, time );
  6909. hooks.stop = function() {
  6910. window.clearTimeout( timeout );
  6911. };
  6912. } );
  6913. };
  6914. ( function() {
  6915. var input = document.createElement( "input" ),
  6916. select = document.createElement( "select" ),
  6917. opt = select.appendChild( document.createElement( "option" ) );
  6918. input.type = "checkbox";
  6919. // Support: Android <=4.3 only
  6920. // Default value for a checkbox should be "on"
  6921. support.checkOn = input.value !== "";
  6922. // Support: IE <=11 only
  6923. // Must access selectedIndex to make default options select
  6924. support.optSelected = opt.selected;
  6925. // Support: IE <=11 only
  6926. // An input loses its value after becoming a radio
  6927. input = document.createElement( "input" );
  6928. input.value = "t";
  6929. input.type = "radio";
  6930. support.radioValue = input.value === "t";
  6931. } )();
  6932. var boolHook,
  6933. attrHandle = jQuery.expr.attrHandle;
  6934. jQuery.fn.extend( {
  6935. attr: function( name, value ) {
  6936. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  6937. },
  6938. removeAttr: function( name ) {
  6939. return this.each( function() {
  6940. jQuery.removeAttr( this, name );
  6941. } );
  6942. }
  6943. } );
  6944. jQuery.extend( {
  6945. attr: function( elem, name, value ) {
  6946. var ret, hooks,
  6947. nType = elem.nodeType;
  6948. // Don't get/set attributes on text, comment and attribute nodes
  6949. if ( nType === 3 || nType === 8 || nType === 2 ) {
  6950. return;
  6951. }
  6952. // Fallback to prop when attributes are not supported
  6953. if ( typeof elem.getAttribute === "undefined" ) {
  6954. return jQuery.prop( elem, name, value );
  6955. }
  6956. // Attribute hooks are determined by the lowercase version
  6957. // Grab necessary hook if one is defined
  6958. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  6959. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  6960. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  6961. }
  6962. if ( value !== undefined ) {
  6963. if ( value === null ) {
  6964. jQuery.removeAttr( elem, name );
  6965. return;
  6966. }
  6967. if ( hooks && "set" in hooks &&
  6968. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  6969. return ret;
  6970. }
  6971. elem.setAttribute( name, value + "" );
  6972. return value;
  6973. }
  6974. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  6975. return ret;
  6976. }
  6977. ret = jQuery.find.attr( elem, name );
  6978. // Non-existent attributes return null, we normalize to undefined
  6979. return ret == null ? undefined : ret;
  6980. },
  6981. attrHooks: {
  6982. type: {
  6983. set: function( elem, value ) {
  6984. if ( !support.radioValue && value === "radio" &&
  6985. nodeName( elem, "input" ) ) {
  6986. var val = elem.value;
  6987. elem.setAttribute( "type", value );
  6988. if ( val ) {
  6989. elem.value = val;
  6990. }
  6991. return value;
  6992. }
  6993. }
  6994. }
  6995. },
  6996. removeAttr: function( elem, value ) {
  6997. var name,
  6998. i = 0,
  6999. // Attribute names can contain non-HTML whitespace characters
  7000. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  7001. attrNames = value && value.match( rnothtmlwhite );
  7002. if ( attrNames && elem.nodeType === 1 ) {
  7003. while ( ( name = attrNames[ i++ ] ) ) {
  7004. elem.removeAttribute( name );
  7005. }
  7006. }
  7007. }
  7008. } );
  7009. // Hooks for boolean attributes
  7010. boolHook = {
  7011. set: function( elem, value, name ) {
  7012. if ( value === false ) {
  7013. // Remove boolean attributes when set to false
  7014. jQuery.removeAttr( elem, name );
  7015. } else {
  7016. elem.setAttribute( name, name );
  7017. }
  7018. return name;
  7019. }
  7020. };
  7021. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  7022. var getter = attrHandle[ name ] || jQuery.find.attr;
  7023. attrHandle[ name ] = function( elem, name, isXML ) {
  7024. var ret, handle,
  7025. lowercaseName = name.toLowerCase();
  7026. if ( !isXML ) {
  7027. // Avoid an infinite loop by temporarily removing this function from the getter
  7028. handle = attrHandle[ lowercaseName ];
  7029. attrHandle[ lowercaseName ] = ret;
  7030. ret = getter( elem, name, isXML ) != null ?
  7031. lowercaseName :
  7032. null;
  7033. attrHandle[ lowercaseName ] = handle;
  7034. }
  7035. return ret;
  7036. };
  7037. } );
  7038. var rfocusable = /^(?:input|select|textarea|button)$/i,
  7039. rclickable = /^(?:a|area)$/i;
  7040. jQuery.fn.extend( {
  7041. prop: function( name, value ) {
  7042. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  7043. },
  7044. removeProp: function( name ) {
  7045. return this.each( function() {
  7046. delete this[ jQuery.propFix[ name ] || name ];
  7047. } );
  7048. }
  7049. } );
  7050. jQuery.extend( {
  7051. prop: function( elem, name, value ) {
  7052. var ret, hooks,
  7053. nType = elem.nodeType;
  7054. // Don't get/set properties on text, comment and attribute nodes
  7055. if ( nType === 3 || nType === 8 || nType === 2 ) {
  7056. return;
  7057. }
  7058. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  7059. // Fix name and attach hooks
  7060. name = jQuery.propFix[ name ] || name;
  7061. hooks = jQuery.propHooks[ name ];
  7062. }
  7063. if ( value !== undefined ) {
  7064. if ( hooks && "set" in hooks &&
  7065. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  7066. return ret;
  7067. }
  7068. return ( elem[ name ] = value );
  7069. }
  7070. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  7071. return ret;
  7072. }
  7073. return elem[ name ];
  7074. },
  7075. propHooks: {
  7076. tabIndex: {
  7077. get: function( elem ) {
  7078. // Support: IE <=9 - 11 only
  7079. // elem.tabIndex doesn't always return the
  7080. // correct value when it hasn't been explicitly set
  7081. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  7082. // Use proper attribute retrieval(#12072)
  7083. var tabindex = jQuery.find.attr( elem, "tabindex" );
  7084. if ( tabindex ) {
  7085. return parseInt( tabindex, 10 );
  7086. }
  7087. if (
  7088. rfocusable.test( elem.nodeName ) ||
  7089. rclickable.test( elem.nodeName ) &&
  7090. elem.href
  7091. ) {
  7092. return 0;
  7093. }
  7094. return -1;
  7095. }
  7096. }
  7097. },
  7098. propFix: {
  7099. "for": "htmlFor",
  7100. "class": "className"
  7101. }
  7102. } );
  7103. // Support: IE <=11 only
  7104. // Accessing the selectedIndex property
  7105. // forces the browser to respect setting selected
  7106. // on the option
  7107. // The getter ensures a default option is selected
  7108. // when in an optgroup
  7109. // eslint rule "no-unused-expressions" is disabled for this code
  7110. // since it considers such accessions noop
  7111. if ( !support.optSelected ) {
  7112. jQuery.propHooks.selected = {
  7113. get: function( elem ) {
  7114. /* eslint no-unused-expressions: "off" */
  7115. var parent = elem.parentNode;
  7116. if ( parent && parent.parentNode ) {
  7117. parent.parentNode.selectedIndex;
  7118. }
  7119. return null;
  7120. },
  7121. set: function( elem ) {
  7122. /* eslint no-unused-expressions: "off" */
  7123. var parent = elem.parentNode;
  7124. if ( parent ) {
  7125. parent.selectedIndex;
  7126. if ( parent.parentNode ) {
  7127. parent.parentNode.selectedIndex;
  7128. }
  7129. }
  7130. }
  7131. };
  7132. }
  7133. jQuery.each( [
  7134. "tabIndex",
  7135. "readOnly",
  7136. "maxLength",
  7137. "cellSpacing",
  7138. "cellPadding",
  7139. "rowSpan",
  7140. "colSpan",
  7141. "useMap",
  7142. "frameBorder",
  7143. "contentEditable"
  7144. ], function() {
  7145. jQuery.propFix[ this.toLowerCase() ] = this;
  7146. } );
  7147. // Strip and collapse whitespace according to HTML spec
  7148. // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
  7149. function stripAndCollapse( value ) {
  7150. var tokens = value.match( rnothtmlwhite ) || [];
  7151. return tokens.join( " " );
  7152. }
  7153. function getClass( elem ) {
  7154. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  7155. }
  7156. jQuery.fn.extend( {
  7157. addClass: function( value ) {
  7158. var classes, elem, cur, curValue, clazz, j, finalValue,
  7159. i = 0;
  7160. if ( jQuery.isFunction( value ) ) {
  7161. return this.each( function( j ) {
  7162. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  7163. } );
  7164. }
  7165. if ( typeof value === "string" && value ) {
  7166. classes = value.match( rnothtmlwhite ) || [];
  7167. while ( ( elem = this[ i++ ] ) ) {
  7168. curValue = getClass( elem );
  7169. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  7170. if ( cur ) {
  7171. j = 0;
  7172. while ( ( clazz = classes[ j++ ] ) ) {
  7173. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  7174. cur += clazz + " ";
  7175. }
  7176. }
  7177. // Only assign if different to avoid unneeded rendering.
  7178. finalValue = stripAndCollapse( cur );
  7179. if ( curValue !== finalValue ) {
  7180. elem.setAttribute( "class", finalValue );
  7181. }
  7182. }
  7183. }
  7184. }
  7185. return this;
  7186. },
  7187. removeClass: function( value ) {
  7188. var classes, elem, cur, curValue, clazz, j, finalValue,
  7189. i = 0;
  7190. if ( jQuery.isFunction( value ) ) {
  7191. return this.each( function( j ) {
  7192. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  7193. } );
  7194. }
  7195. if ( !arguments.length ) {
  7196. return this.attr( "class", "" );
  7197. }
  7198. if ( typeof value === "string" && value ) {
  7199. classes = value.match( rnothtmlwhite ) || [];
  7200. while ( ( elem = this[ i++ ] ) ) {
  7201. curValue = getClass( elem );
  7202. // This expression is here for better compressibility (see addClass)
  7203. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  7204. if ( cur ) {
  7205. j = 0;
  7206. while ( ( clazz = classes[ j++ ] ) ) {
  7207. // Remove *all* instances
  7208. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  7209. cur = cur.replace( " " + clazz + " ", " " );
  7210. }
  7211. }
  7212. // Only assign if different to avoid unneeded rendering.
  7213. finalValue = stripAndCollapse( cur );
  7214. if ( curValue !== finalValue ) {
  7215. elem.setAttribute( "class", finalValue );
  7216. }
  7217. }
  7218. }
  7219. }
  7220. return this;
  7221. },
  7222. toggleClass: function( value, stateVal ) {
  7223. var type = typeof value;
  7224. if ( typeof stateVal === "boolean" && type === "string" ) {
  7225. return stateVal ? this.addClass( value ) : this.removeClass( value );
  7226. }
  7227. if ( jQuery.isFunction( value ) ) {
  7228. return this.each( function( i ) {
  7229. jQuery( this ).toggleClass(
  7230. value.call( this, i, getClass( this ), stateVal ),
  7231. stateVal
  7232. );
  7233. } );
  7234. }
  7235. return this.each( function() {
  7236. var className, i, self, classNames;
  7237. if ( type === "string" ) {
  7238. // Toggle individual class names
  7239. i = 0;
  7240. self = jQuery( this );
  7241. classNames = value.match( rnothtmlwhite ) || [];
  7242. while ( ( className = classNames[ i++ ] ) ) {
  7243. // Check each className given, space separated list
  7244. if ( self.hasClass( className ) ) {
  7245. self.removeClass( className );
  7246. } else {
  7247. self.addClass( className );
  7248. }
  7249. }
  7250. // Toggle whole class name
  7251. } else if ( value === undefined || type === "boolean" ) {
  7252. className = getClass( this );
  7253. if ( className ) {
  7254. // Store className if set
  7255. dataPriv.set( this, "__className__", className );
  7256. }
  7257. // If the element has a class name or if we're passed `false`,
  7258. // then remove the whole classname (if there was one, the above saved it).
  7259. // Otherwise bring back whatever was previously saved (if anything),
  7260. // falling back to the empty string if nothing was stored.
  7261. if ( this.setAttribute ) {
  7262. this.setAttribute( "class",
  7263. className || value === false ?
  7264. "" :
  7265. dataPriv.get( this, "__className__" ) || ""
  7266. );
  7267. }
  7268. }
  7269. } );
  7270. },
  7271. hasClass: function( selector ) {
  7272. var className, elem,
  7273. i = 0;
  7274. className = " " + selector + " ";
  7275. while ( ( elem = this[ i++ ] ) ) {
  7276. if ( elem.nodeType === 1 &&
  7277. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  7278. return true;
  7279. }
  7280. }
  7281. return false;
  7282. }
  7283. } );
  7284. var rreturn = /\r/g;
  7285. jQuery.fn.extend( {
  7286. val: function( value ) {
  7287. var hooks, ret, isFunction,
  7288. elem = this[ 0 ];
  7289. if ( !arguments.length ) {
  7290. if ( elem ) {
  7291. hooks = jQuery.valHooks[ elem.type ] ||
  7292. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  7293. if ( hooks &&
  7294. "get" in hooks &&
  7295. ( ret = hooks.get( elem, "value" ) ) !== undefined
  7296. ) {
  7297. return ret;
  7298. }
  7299. ret = elem.value;
  7300. // Handle most common string cases
  7301. if ( typeof ret === "string" ) {
  7302. return ret.replace( rreturn, "" );
  7303. }
  7304. // Handle cases where value is null/undef or number
  7305. return ret == null ? "" : ret;
  7306. }
  7307. return;
  7308. }
  7309. isFunction = jQuery.isFunction( value );
  7310. return this.each( function( i ) {
  7311. var val;
  7312. if ( this.nodeType !== 1 ) {
  7313. return;
  7314. }
  7315. if ( isFunction ) {
  7316. val = value.call( this, i, jQuery( this ).val() );
  7317. } else {
  7318. val = value;
  7319. }
  7320. // Treat null/undefined as ""; convert numbers to string
  7321. if ( val == null ) {
  7322. val = "";
  7323. } else if ( typeof val === "number" ) {
  7324. val += "";
  7325. } else if ( Array.isArray( val ) ) {
  7326. val = jQuery.map( val, function( value ) {
  7327. return value == null ? "" : value + "";
  7328. } );
  7329. }
  7330. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  7331. // If set returns undefined, fall back to normal setting
  7332. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  7333. this.value = val;
  7334. }
  7335. } );
  7336. }
  7337. } );
  7338. jQuery.extend( {
  7339. valHooks: {
  7340. option: {
  7341. get: function( elem ) {
  7342. var val = jQuery.find.attr( elem, "value" );
  7343. return val != null ?
  7344. val :
  7345. // Support: IE <=10 - 11 only
  7346. // option.text throws exceptions (#14686, #14858)
  7347. // Strip and collapse whitespace
  7348. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  7349. stripAndCollapse( jQuery.text( elem ) );
  7350. }
  7351. },
  7352. select: {
  7353. get: function( elem ) {
  7354. var value, option, i,
  7355. options = elem.options,
  7356. index = elem.selectedIndex,
  7357. one = elem.type === "select-one",
  7358. values = one ? null : [],
  7359. max = one ? index + 1 : options.length;
  7360. if ( index < 0 ) {
  7361. i = max;
  7362. } else {
  7363. i = one ? index : 0;
  7364. }
  7365. // Loop through all the selected options
  7366. for ( ; i < max; i++ ) {
  7367. option = options[ i ];
  7368. // Support: IE <=9 only
  7369. // IE8-9 doesn't update selected after form reset (#2551)
  7370. if ( ( option.selected || i === index ) &&
  7371. // Don't return options that are disabled or in a disabled optgroup
  7372. !option.disabled &&
  7373. ( !option.parentNode.disabled ||
  7374. !nodeName( option.parentNode, "optgroup" ) ) ) {
  7375. // Get the specific value for the option
  7376. value = jQuery( option ).val();
  7377. // We don't need an array for one selects
  7378. if ( one ) {
  7379. return value;
  7380. }
  7381. // Multi-Selects return an array
  7382. values.push( value );
  7383. }
  7384. }
  7385. return values;
  7386. },
  7387. set: function( elem, value ) {
  7388. var optionSet, option,
  7389. options = elem.options,
  7390. values = jQuery.makeArray( value ),
  7391. i = options.length;
  7392. while ( i-- ) {
  7393. option = options[ i ];
  7394. /* eslint-disable no-cond-assign */
  7395. if ( option.selected =
  7396. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  7397. ) {
  7398. optionSet = true;
  7399. }
  7400. /* eslint-enable no-cond-assign */
  7401. }
  7402. // Force browsers to behave consistently when non-matching value is set
  7403. if ( !optionSet ) {
  7404. elem.selectedIndex = -1;
  7405. }
  7406. return values;
  7407. }
  7408. }
  7409. }
  7410. } );
  7411. // Radios and checkboxes getter/setter
  7412. jQuery.each( [ "radio", "checkbox" ], function() {
  7413. jQuery.valHooks[ this ] = {
  7414. set: function( elem, value ) {
  7415. if ( Array.isArray( value ) ) {
  7416. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  7417. }
  7418. }
  7419. };
  7420. if ( !support.checkOn ) {
  7421. jQuery.valHooks[ this ].get = function( elem ) {
  7422. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  7423. };
  7424. }
  7425. } );
  7426. // Return jQuery for attributes-only inclusion
  7427. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
  7428. jQuery.extend( jQuery.event, {
  7429. trigger: function( event, data, elem, onlyHandlers ) {
  7430. var i, cur, tmp, bubbleType, ontype, handle, special,
  7431. eventPath = [ elem || document ],
  7432. type = hasOwn.call( event, "type" ) ? event.type : event,
  7433. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  7434. cur = tmp = elem = elem || document;
  7435. // Don't do events on text and comment nodes
  7436. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  7437. return;
  7438. }
  7439. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  7440. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  7441. return;
  7442. }
  7443. if ( type.indexOf( "." ) > -1 ) {
  7444. // Namespaced trigger; create a regexp to match event type in handle()
  7445. namespaces = type.split( "." );
  7446. type = namespaces.shift();
  7447. namespaces.sort();
  7448. }
  7449. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  7450. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  7451. event = event[ jQuery.expando ] ?
  7452. event :
  7453. new jQuery.Event( type, typeof event === "object" && event );
  7454. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  7455. event.isTrigger = onlyHandlers ? 2 : 3;
  7456. event.namespace = namespaces.join( "." );
  7457. event.rnamespace = event.namespace ?
  7458. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  7459. null;
  7460. // Clean up the event in case it is being reused
  7461. event.result = undefined;
  7462. if ( !event.target ) {
  7463. event.target = elem;
  7464. }
  7465. // Clone any incoming data and prepend the event, creating the handler arg list
  7466. data = data == null ?
  7467. [ event ] :
  7468. jQuery.makeArray( data, [ event ] );
  7469. // Allow special events to draw outside the lines
  7470. special = jQuery.event.special[ type ] || {};
  7471. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  7472. return;
  7473. }
  7474. // Determine event propagation path in advance, per W3C events spec (#9951)
  7475. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  7476. if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
  7477. bubbleType = special.delegateType || type;
  7478. if ( !rfocusMorph.test( bubbleType + type ) ) {
  7479. cur = cur.parentNode;
  7480. }
  7481. for ( ; cur; cur = cur.parentNode ) {
  7482. eventPath.push( cur );
  7483. tmp = cur;
  7484. }
  7485. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  7486. if ( tmp === ( elem.ownerDocument || document ) ) {
  7487. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  7488. }
  7489. }
  7490. // Fire handlers on the event path
  7491. i = 0;
  7492. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  7493. event.type = i > 1 ?
  7494. bubbleType :
  7495. special.bindType || type;
  7496. // jQuery handler
  7497. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  7498. dataPriv.get( cur, "handle" );
  7499. if ( handle ) {
  7500. handle.apply( cur, data );
  7501. }
  7502. // Native handler
  7503. handle = ontype && cur[ ontype ];
  7504. if ( handle && handle.apply && acceptData( cur ) ) {
  7505. event.result = handle.apply( cur, data );
  7506. if ( event.result === false ) {
  7507. event.preventDefault();
  7508. }
  7509. }
  7510. }
  7511. event.type = type;
  7512. // If nobody prevented the default action, do it now
  7513. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  7514. if ( ( !special._default ||
  7515. special._default.apply( eventPath.pop(), data ) === false ) &&
  7516. acceptData( elem ) ) {
  7517. // Call a native DOM method on the target with the same name as the event.
  7518. // Don't do default actions on window, that's where global variables be (#6170)
  7519. if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
  7520. // Don't re-trigger an onFOO event when we call its FOO() method
  7521. tmp = elem[ ontype ];
  7522. if ( tmp ) {
  7523. elem[ ontype ] = null;
  7524. }
  7525. // Prevent re-triggering of the same event, since we already bubbled it above
  7526. jQuery.event.triggered = type;
  7527. elem[ type ]();
  7528. jQuery.event.triggered = undefined;
  7529. if ( tmp ) {
  7530. elem[ ontype ] = tmp;
  7531. }
  7532. }
  7533. }
  7534. }
  7535. return event.result;
  7536. },
  7537. // Piggyback on a donor event to simulate a different one
  7538. // Used only for `focus(in | out)` events
  7539. simulate: function( type, elem, event ) {
  7540. var e = jQuery.extend(
  7541. new jQuery.Event(),
  7542. event,
  7543. {
  7544. type: type,
  7545. isSimulated: true
  7546. }
  7547. );
  7548. jQuery.event.trigger( e, null, elem );
  7549. }
  7550. } );
  7551. jQuery.fn.extend( {
  7552. trigger: function( type, data ) {
  7553. return this.each( function() {
  7554. jQuery.event.trigger( type, data, this );
  7555. } );
  7556. },
  7557. triggerHandler: function( type, data ) {
  7558. var elem = this[ 0 ];
  7559. if ( elem ) {
  7560. return jQuery.event.trigger( type, data, elem, true );
  7561. }
  7562. }
  7563. } );
  7564. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  7565. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  7566. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  7567. function( i, name ) {
  7568. // Handle event binding
  7569. jQuery.fn[ name ] = function( data, fn ) {
  7570. return arguments.length > 0 ?
  7571. this.on( name, null, data, fn ) :
  7572. this.trigger( name );
  7573. };
  7574. } );
  7575. jQuery.fn.extend( {
  7576. hover: function( fnOver, fnOut ) {
  7577. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  7578. }
  7579. } );
  7580. support.focusin = "onfocusin" in window;
  7581. // Support: Firefox <=44
  7582. // Firefox doesn't have focus(in | out) events
  7583. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  7584. //
  7585. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  7586. // focus(in | out) events fire after focus & blur events,
  7587. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  7588. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  7589. if ( !support.focusin ) {
  7590. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  7591. // Attach a single capturing handler on the document while someone wants focusin/focusout
  7592. var handler = function( event ) {
  7593. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  7594. };
  7595. jQuery.event.special[ fix ] = {
  7596. setup: function() {
  7597. var doc = this.ownerDocument || this,
  7598. attaches = dataPriv.access( doc, fix );
  7599. if ( !attaches ) {
  7600. doc.addEventListener( orig, handler, true );
  7601. }
  7602. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  7603. },
  7604. teardown: function() {
  7605. var doc = this.ownerDocument || this,
  7606. attaches = dataPriv.access( doc, fix ) - 1;
  7607. if ( !attaches ) {
  7608. doc.removeEventListener( orig, handler, true );
  7609. dataPriv.remove( doc, fix );
  7610. } else {
  7611. dataPriv.access( doc, fix, attaches );
  7612. }
  7613. }
  7614. };
  7615. } );
  7616. }
  7617. var location = window.location;
  7618. var nonce = jQuery.now();
  7619. var rquery = ( /\?/ );
  7620. // Cross-browser xml parsing
  7621. jQuery.parseXML = function( data ) {
  7622. var xml;
  7623. if ( !data || typeof data !== "string" ) {
  7624. return null;
  7625. }
  7626. // Support: IE 9 - 11 only
  7627. // IE throws on parseFromString with invalid input.
  7628. try {
  7629. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  7630. } catch ( e ) {
  7631. xml = undefined;
  7632. }
  7633. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  7634. jQuery.error( "Invalid XML: " + data );
  7635. }
  7636. return xml;
  7637. };
  7638. var
  7639. rbracket = /\[\]$/,
  7640. rCRLF = /\r?\n/g,
  7641. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  7642. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  7643. function buildParams( prefix, obj, traditional, add ) {
  7644. var name;
  7645. if ( Array.isArray( obj ) ) {
  7646. // Serialize array item.
  7647. jQuery.each( obj, function( i, v ) {
  7648. if ( traditional || rbracket.test( prefix ) ) {
  7649. // Treat each array item as a scalar.
  7650. add( prefix, v );
  7651. } else {
  7652. // Item is non-scalar (array or object), encode its numeric index.
  7653. buildParams(
  7654. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  7655. v,
  7656. traditional,
  7657. add
  7658. );
  7659. }
  7660. } );
  7661. } else if ( !traditional && jQuery.type( obj ) === "object" ) {
  7662. // Serialize object item.
  7663. for ( name in obj ) {
  7664. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  7665. }
  7666. } else {
  7667. // Serialize scalar item.
  7668. add( prefix, obj );
  7669. }
  7670. }
  7671. // Serialize an array of form elements or a set of
  7672. // key/values into a query string
  7673. jQuery.param = function( a, traditional ) {
  7674. var prefix,
  7675. s = [],
  7676. add = function( key, valueOrFunction ) {
  7677. // If value is a function, invoke it and use its return value
  7678. var value = jQuery.isFunction( valueOrFunction ) ?
  7679. valueOrFunction() :
  7680. valueOrFunction;
  7681. s[ s.length ] = encodeURIComponent( key ) + "=" +
  7682. encodeURIComponent( value == null ? "" : value );
  7683. };
  7684. // If an array was passed in, assume that it is an array of form elements.
  7685. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  7686. // Serialize the form elements
  7687. jQuery.each( a, function() {
  7688. add( this.name, this.value );
  7689. } );
  7690. } else {
  7691. // If traditional, encode the "old" way (the way 1.3.2 or older
  7692. // did it), otherwise encode params recursively.
  7693. for ( prefix in a ) {
  7694. buildParams( prefix, a[ prefix ], traditional, add );
  7695. }
  7696. }
  7697. // Return the resulting serialization
  7698. return s.join( "&" );
  7699. };
  7700. jQuery.fn.extend( {
  7701. serialize: function() {
  7702. return jQuery.param( this.serializeArray() );
  7703. },
  7704. serializeArray: function() {
  7705. return this.map( function() {
  7706. // Can add propHook for "elements" to filter or add form elements
  7707. var elements = jQuery.prop( this, "elements" );
  7708. return elements ? jQuery.makeArray( elements ) : this;
  7709. } )
  7710. .filter( function() {
  7711. var type = this.type;
  7712. // Use .is( ":disabled" ) so that fieldset[disabled] works
  7713. return this.name && !jQuery( this ).is( ":disabled" ) &&
  7714. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  7715. ( this.checked || !rcheckableType.test( type ) );
  7716. } )
  7717. .map( function( i, elem ) {
  7718. var val = jQuery( this ).val();
  7719. if ( val == null ) {
  7720. return null;
  7721. }
  7722. if ( Array.isArray( val ) ) {
  7723. return jQuery.map( val, function( val ) {
  7724. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  7725. } );
  7726. }
  7727. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  7728. } ).get();
  7729. }
  7730. } );
  7731. var
  7732. r20 = /%20/g,
  7733. rhash = /#.*$/,
  7734. rantiCache = /([?&])_=[^&]*/,
  7735. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  7736. // #7653, #8125, #8152: local protocol detection
  7737. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  7738. rnoContent = /^(?:GET|HEAD)$/,
  7739. rprotocol = /^\/\//,
  7740. /* Prefilters
  7741. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  7742. * 2) These are called:
  7743. * - BEFORE asking for a transport
  7744. * - AFTER param serialization (s.data is a string if s.processData is true)
  7745. * 3) key is the dataType
  7746. * 4) the catchall symbol "*" can be used
  7747. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  7748. */
  7749. prefilters = {},
  7750. /* Transports bindings
  7751. * 1) key is the dataType
  7752. * 2) the catchall symbol "*" can be used
  7753. * 3) selection will start with transport dataType and THEN go to "*" if needed
  7754. */
  7755. transports = {},
  7756. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  7757. allTypes = "*/".concat( "*" ),
  7758. // Anchor tag for parsing the document origin
  7759. originAnchor = document.createElement( "a" );
  7760. originAnchor.href = location.href;
  7761. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  7762. function addToPrefiltersOrTransports( structure ) {
  7763. // dataTypeExpression is optional and defaults to "*"
  7764. return function( dataTypeExpression, func ) {
  7765. if ( typeof dataTypeExpression !== "string" ) {
  7766. func = dataTypeExpression;
  7767. dataTypeExpression = "*";
  7768. }
  7769. var dataType,
  7770. i = 0,
  7771. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  7772. if ( jQuery.isFunction( func ) ) {
  7773. // For each dataType in the dataTypeExpression
  7774. while ( ( dataType = dataTypes[ i++ ] ) ) {
  7775. // Prepend if requested
  7776. if ( dataType[ 0 ] === "+" ) {
  7777. dataType = dataType.slice( 1 ) || "*";
  7778. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  7779. // Otherwise append
  7780. } else {
  7781. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  7782. }
  7783. }
  7784. }
  7785. };
  7786. }
  7787. // Base inspection function for prefilters and transports
  7788. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  7789. var inspected = {},
  7790. seekingTransport = ( structure === transports );
  7791. function inspect( dataType ) {
  7792. var selected;
  7793. inspected[ dataType ] = true;
  7794. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  7795. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  7796. if ( typeof dataTypeOrTransport === "string" &&
  7797. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  7798. options.dataTypes.unshift( dataTypeOrTransport );
  7799. inspect( dataTypeOrTransport );
  7800. return false;
  7801. } else if ( seekingTransport ) {
  7802. return !( selected = dataTypeOrTransport );
  7803. }
  7804. } );
  7805. return selected;
  7806. }
  7807. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  7808. }
  7809. // A special extend for ajax options
  7810. // that takes "flat" options (not to be deep extended)
  7811. // Fixes #9887
  7812. function ajaxExtend( target, src ) {
  7813. var key, deep,
  7814. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  7815. for ( key in src ) {
  7816. if ( src[ key ] !== undefined ) {
  7817. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  7818. }
  7819. }
  7820. if ( deep ) {
  7821. jQuery.extend( true, target, deep );
  7822. }
  7823. return target;
  7824. }
  7825. /* Handles responses to an ajax request:
  7826. * - finds the right dataType (mediates between content-type and expected dataType)
  7827. * - returns the corresponding response
  7828. */
  7829. function ajaxHandleResponses( s, jqXHR, responses ) {
  7830. var ct, type, finalDataType, firstDataType,
  7831. contents = s.contents,
  7832. dataTypes = s.dataTypes;
  7833. // Remove auto dataType and get content-type in the process
  7834. while ( dataTypes[ 0 ] === "*" ) {
  7835. dataTypes.shift();
  7836. if ( ct === undefined ) {
  7837. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  7838. }
  7839. }
  7840. // Check if we're dealing with a known content-type
  7841. if ( ct ) {
  7842. for ( type in contents ) {
  7843. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  7844. dataTypes.unshift( type );
  7845. break;
  7846. }
  7847. }
  7848. }
  7849. // Check to see if we have a response for the expected dataType
  7850. if ( dataTypes[ 0 ] in responses ) {
  7851. finalDataType = dataTypes[ 0 ];
  7852. } else {
  7853. // Try convertible dataTypes
  7854. for ( type in responses ) {
  7855. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  7856. finalDataType = type;
  7857. break;
  7858. }
  7859. if ( !firstDataType ) {
  7860. firstDataType = type;
  7861. }
  7862. }
  7863. // Or just use first one
  7864. finalDataType = finalDataType || firstDataType;
  7865. }
  7866. // If we found a dataType
  7867. // We add the dataType to the list if needed
  7868. // and return the corresponding response
  7869. if ( finalDataType ) {
  7870. if ( finalDataType !== dataTypes[ 0 ] ) {
  7871. dataTypes.unshift( finalDataType );
  7872. }
  7873. return responses[ finalDataType ];
  7874. }
  7875. }
  7876. /* Chain conversions given the request and the original response
  7877. * Also sets the responseXXX fields on the jqXHR instance
  7878. */
  7879. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  7880. var conv2, current, conv, tmp, prev,
  7881. converters = {},
  7882. // Work with a copy of dataTypes in case we need to modify it for conversion
  7883. dataTypes = s.dataTypes.slice();
  7884. // Create converters map with lowercased keys
  7885. if ( dataTypes[ 1 ] ) {
  7886. for ( conv in s.converters ) {
  7887. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  7888. }
  7889. }
  7890. current = dataTypes.shift();
  7891. // Convert to each sequential dataType
  7892. while ( current ) {
  7893. if ( s.responseFields[ current ] ) {
  7894. jqXHR[ s.responseFields[ current ] ] = response;
  7895. }
  7896. // Apply the dataFilter if provided
  7897. if ( !prev && isSuccess && s.dataFilter ) {
  7898. response = s.dataFilter( response, s.dataType );
  7899. }
  7900. prev = current;
  7901. current = dataTypes.shift();
  7902. if ( current ) {
  7903. // There's only work to do if current dataType is non-auto
  7904. if ( current === "*" ) {
  7905. current = prev;
  7906. // Convert response if prev dataType is non-auto and differs from current
  7907. } else if ( prev !== "*" && prev !== current ) {
  7908. // Seek a direct converter
  7909. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  7910. // If none found, seek a pair
  7911. if ( !conv ) {
  7912. for ( conv2 in converters ) {
  7913. // If conv2 outputs current
  7914. tmp = conv2.split( " " );
  7915. if ( tmp[ 1 ] === current ) {
  7916. // If prev can be converted to accepted input
  7917. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  7918. converters[ "* " + tmp[ 0 ] ];
  7919. if ( conv ) {
  7920. // Condense equivalence converters
  7921. if ( conv === true ) {
  7922. conv = converters[ conv2 ];
  7923. // Otherwise, insert the intermediate dataType
  7924. } else if ( converters[ conv2 ] !== true ) {
  7925. current = tmp[ 0 ];
  7926. dataTypes.unshift( tmp[ 1 ] );
  7927. }
  7928. break;
  7929. }
  7930. }
  7931. }
  7932. }
  7933. // Apply converter (if not an equivalence)
  7934. if ( conv !== true ) {
  7935. // Unless errors are allowed to bubble, catch and return them
  7936. if ( conv && s.throws ) {
  7937. response = conv( response );
  7938. } else {
  7939. try {
  7940. response = conv( response );
  7941. } catch ( e ) {
  7942. return {
  7943. state: "parsererror",
  7944. error: conv ? e : "No conversion from " + prev + " to " + current
  7945. };
  7946. }
  7947. }
  7948. }
  7949. }
  7950. }
  7951. }
  7952. return { state: "success", data: response };
  7953. }
  7954. jQuery.extend( {
  7955. // Counter for holding the number of active queries
  7956. active: 0,
  7957. // Last-Modified header cache for next request
  7958. lastModified: {},
  7959. etag: {},
  7960. ajaxSettings: {
  7961. url: location.href,
  7962. type: "GET",
  7963. isLocal: rlocalProtocol.test( location.protocol ),
  7964. global: true,
  7965. processData: true,
  7966. async: true,
  7967. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  7968. /*
  7969. timeout: 0,
  7970. data: null,
  7971. dataType: null,
  7972. username: null,
  7973. password: null,
  7974. cache: null,
  7975. throws: false,
  7976. traditional: false,
  7977. headers: {},
  7978. */
  7979. accepts: {
  7980. "*": allTypes,
  7981. text: "text/plain",
  7982. html: "text/html",
  7983. xml: "application/xml, text/xml",
  7984. json: "application/json, text/javascript"
  7985. },
  7986. contents: {
  7987. xml: /\bxml\b/,
  7988. html: /\bhtml/,
  7989. json: /\bjson\b/
  7990. },
  7991. responseFields: {
  7992. xml: "responseXML",
  7993. text: "responseText",
  7994. json: "responseJSON"
  7995. },
  7996. // Data converters
  7997. // Keys separate source (or catchall "*") and destination types with a single space
  7998. converters: {
  7999. // Convert anything to text
  8000. "* text": String,
  8001. // Text to html (true = no transformation)
  8002. "text html": true,
  8003. // Evaluate text as a json expression
  8004. "text json": JSON.parse,
  8005. // Parse text as xml
  8006. "text xml": jQuery.parseXML
  8007. },
  8008. // For options that shouldn't be deep extended:
  8009. // you can add your own custom options here if
  8010. // and when you create one that shouldn't be
  8011. // deep extended (see ajaxExtend)
  8012. flatOptions: {
  8013. url: true,
  8014. context: true
  8015. }
  8016. },
  8017. // Creates a full fledged settings object into target
  8018. // with both ajaxSettings and settings fields.
  8019. // If target is omitted, writes into ajaxSettings.
  8020. ajaxSetup: function( target, settings ) {
  8021. return settings ?
  8022. // Building a settings object
  8023. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  8024. // Extending ajaxSettings
  8025. ajaxExtend( jQuery.ajaxSettings, target );
  8026. },
  8027. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  8028. ajaxTransport: addToPrefiltersOrTransports( transports ),
  8029. // Main method
  8030. ajax: function( url, options ) {
  8031. // If url is an object, simulate pre-1.5 signature
  8032. if ( typeof url === "object" ) {
  8033. options = url;
  8034. url = undefined;
  8035. }
  8036. // Force options to be an object
  8037. options = options || {};
  8038. var transport,
  8039. // URL without anti-cache param
  8040. cacheURL,
  8041. // Response headers
  8042. responseHeadersString,
  8043. responseHeaders,
  8044. // timeout handle
  8045. timeoutTimer,
  8046. // Url cleanup var
  8047. urlAnchor,
  8048. // Request state (becomes false upon send and true upon completion)
  8049. completed,
  8050. // To know if global events are to be dispatched
  8051. fireGlobals,
  8052. // Loop variable
  8053. i,
  8054. // uncached part of the url
  8055. uncached,
  8056. // Create the final options object
  8057. s = jQuery.ajaxSetup( {}, options ),
  8058. // Callbacks context
  8059. callbackContext = s.context || s,
  8060. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  8061. globalEventContext = s.context &&
  8062. ( callbackContext.nodeType || callbackContext.jquery ) ?
  8063. jQuery( callbackContext ) :
  8064. jQuery.event,
  8065. // Deferreds
  8066. deferred = jQuery.Deferred(),
  8067. completeDeferred = jQuery.Callbacks( "once memory" ),
  8068. // Status-dependent callbacks
  8069. statusCode = s.statusCode || {},
  8070. // Headers (they are sent all at once)
  8071. requestHeaders = {},
  8072. requestHeadersNames = {},
  8073. // Default abort message
  8074. strAbort = "canceled",
  8075. // Fake xhr
  8076. jqXHR = {
  8077. readyState: 0,
  8078. // Builds headers hashtable if needed
  8079. getResponseHeader: function( key ) {
  8080. var match;
  8081. if ( completed ) {
  8082. if ( !responseHeaders ) {
  8083. responseHeaders = {};
  8084. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  8085. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  8086. }
  8087. }
  8088. match = responseHeaders[ key.toLowerCase() ];
  8089. }
  8090. return match == null ? null : match;
  8091. },
  8092. // Raw string
  8093. getAllResponseHeaders: function() {
  8094. return completed ? responseHeadersString : null;
  8095. },
  8096. // Caches the header
  8097. setRequestHeader: function( name, value ) {
  8098. if ( completed == null ) {
  8099. name = requestHeadersNames[ name.toLowerCase() ] =
  8100. requestHeadersNames[ name.toLowerCase() ] || name;
  8101. requestHeaders[ name ] = value;
  8102. }
  8103. return this;
  8104. },
  8105. // Overrides response content-type header
  8106. overrideMimeType: function( type ) {
  8107. if ( completed == null ) {
  8108. s.mimeType = type;
  8109. }
  8110. return this;
  8111. },
  8112. // Status-dependent callbacks
  8113. statusCode: function( map ) {
  8114. var code;
  8115. if ( map ) {
  8116. if ( completed ) {
  8117. // Execute the appropriate callbacks
  8118. jqXHR.always( map[ jqXHR.status ] );
  8119. } else {
  8120. // Lazy-add the new callbacks in a way that preserves old ones
  8121. for ( code in map ) {
  8122. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  8123. }
  8124. }
  8125. }
  8126. return this;
  8127. },
  8128. // Cancel the request
  8129. abort: function( statusText ) {
  8130. var finalText = statusText || strAbort;
  8131. if ( transport ) {
  8132. transport.abort( finalText );
  8133. }
  8134. done( 0, finalText );
  8135. return this;
  8136. }
  8137. };
  8138. // Attach deferreds
  8139. deferred.promise( jqXHR );
  8140. // Add protocol if not provided (prefilters might expect it)
  8141. // Handle falsy url in the settings object (#10093: consistency with old signature)
  8142. // We also use the url parameter if available
  8143. s.url = ( ( url || s.url || location.href ) + "" )
  8144. .replace( rprotocol, location.protocol + "//" );
  8145. // Alias method option to type as per ticket #12004
  8146. s.type = options.method || options.type || s.method || s.type;
  8147. // Extract dataTypes list
  8148. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  8149. // A cross-domain request is in order when the origin doesn't match the current origin.
  8150. if ( s.crossDomain == null ) {
  8151. urlAnchor = document.createElement( "a" );
  8152. // Support: IE <=8 - 11, Edge 12 - 13
  8153. // IE throws exception on accessing the href property if url is malformed,
  8154. // e.g. http://example.com:80x/
  8155. try {
  8156. urlAnchor.href = s.url;
  8157. // Support: IE <=8 - 11 only
  8158. // Anchor's host property isn't correctly set when s.url is relative
  8159. urlAnchor.href = urlAnchor.href;
  8160. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  8161. urlAnchor.protocol + "//" + urlAnchor.host;
  8162. } catch ( e ) {
  8163. // If there is an error parsing the URL, assume it is crossDomain,
  8164. // it can be rejected by the transport if it is invalid
  8165. s.crossDomain = true;
  8166. }
  8167. }
  8168. // Convert data if not already a string
  8169. if ( s.data && s.processData && typeof s.data !== "string" ) {
  8170. s.data = jQuery.param( s.data, s.traditional );
  8171. }
  8172. // Apply prefilters
  8173. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  8174. // If request was aborted inside a prefilter, stop there
  8175. if ( completed ) {
  8176. return jqXHR;
  8177. }
  8178. // We can fire global events as of now if asked to
  8179. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  8180. fireGlobals = jQuery.event && s.global;
  8181. // Watch for a new set of requests
  8182. if ( fireGlobals && jQuery.active++ === 0 ) {
  8183. jQuery.event.trigger( "ajaxStart" );
  8184. }
  8185. // Uppercase the type
  8186. s.type = s.type.toUpperCase();
  8187. // Determine if request has content
  8188. s.hasContent = !rnoContent.test( s.type );
  8189. // Save the URL in case we're toying with the If-Modified-Since
  8190. // and/or If-None-Match header later on
  8191. // Remove hash to simplify url manipulation
  8192. cacheURL = s.url.replace( rhash, "" );
  8193. // More options handling for requests with no content
  8194. if ( !s.hasContent ) {
  8195. // Remember the hash so we can put it back
  8196. uncached = s.url.slice( cacheURL.length );
  8197. // If data is available, append data to url
  8198. if ( s.data ) {
  8199. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  8200. // #9682: remove data so that it's not used in an eventual retry
  8201. delete s.data;
  8202. }
  8203. // Add or update anti-cache param if needed
  8204. if ( s.cache === false ) {
  8205. cacheURL = cacheURL.replace( rantiCache, "$1" );
  8206. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  8207. }
  8208. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  8209. s.url = cacheURL + uncached;
  8210. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  8211. } else if ( s.data && s.processData &&
  8212. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  8213. s.data = s.data.replace( r20, "+" );
  8214. }
  8215. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  8216. if ( s.ifModified ) {
  8217. if ( jQuery.lastModified[ cacheURL ] ) {
  8218. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  8219. }
  8220. if ( jQuery.etag[ cacheURL ] ) {
  8221. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  8222. }
  8223. }
  8224. // Set the correct header, if data is being sent
  8225. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  8226. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  8227. }
  8228. // Set the Accepts header for the server, depending on the dataType
  8229. jqXHR.setRequestHeader(
  8230. "Accept",
  8231. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  8232. s.accepts[ s.dataTypes[ 0 ] ] +
  8233. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  8234. s.accepts[ "*" ]
  8235. );
  8236. // Check for headers option
  8237. for ( i in s.headers ) {
  8238. jqXHR.setRequestHeader( i, s.headers[ i ] );
  8239. }
  8240. // Allow custom headers/mimetypes and early abort
  8241. if ( s.beforeSend &&
  8242. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  8243. // Abort if not done already and return
  8244. return jqXHR.abort();
  8245. }
  8246. // Aborting is no longer a cancellation
  8247. strAbort = "abort";
  8248. // Install callbacks on deferreds
  8249. completeDeferred.add( s.complete );
  8250. jqXHR.done( s.success );
  8251. jqXHR.fail( s.error );
  8252. // Get transport
  8253. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  8254. // If no transport, we auto-abort
  8255. if ( !transport ) {
  8256. done( -1, "No Transport" );
  8257. } else {
  8258. jqXHR.readyState = 1;
  8259. // Send global event
  8260. if ( fireGlobals ) {
  8261. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  8262. }
  8263. // If request was aborted inside ajaxSend, stop there
  8264. if ( completed ) {
  8265. return jqXHR;
  8266. }
  8267. // Timeout
  8268. if ( s.async && s.timeout > 0 ) {
  8269. timeoutTimer = window.setTimeout( function() {
  8270. jqXHR.abort( "timeout" );
  8271. }, s.timeout );
  8272. }
  8273. try {
  8274. completed = false;
  8275. transport.send( requestHeaders, done );
  8276. } catch ( e ) {
  8277. // Rethrow post-completion exceptions
  8278. if ( completed ) {
  8279. throw e;
  8280. }
  8281. // Propagate others as results
  8282. done( -1, e );
  8283. }
  8284. }
  8285. // Callback for when everything is done
  8286. function done( status, nativeStatusText, responses, headers ) {
  8287. var isSuccess, success, error, response, modified,
  8288. statusText = nativeStatusText;
  8289. // Ignore repeat invocations
  8290. if ( completed ) {
  8291. return;
  8292. }
  8293. completed = true;
  8294. // Clear timeout if it exists
  8295. if ( timeoutTimer ) {
  8296. window.clearTimeout( timeoutTimer );
  8297. }
  8298. // Dereference transport for early garbage collection
  8299. // (no matter how long the jqXHR object will be used)
  8300. transport = undefined;
  8301. // Cache response headers
  8302. responseHeadersString = headers || "";
  8303. // Set readyState
  8304. jqXHR.readyState = status > 0 ? 4 : 0;
  8305. // Determine if successful
  8306. isSuccess = status >= 200 && status < 300 || status === 304;
  8307. // Get response data
  8308. if ( responses ) {
  8309. response = ajaxHandleResponses( s, jqXHR, responses );
  8310. }
  8311. // Convert no matter what (that way responseXXX fields are always set)
  8312. response = ajaxConvert( s, response, jqXHR, isSuccess );
  8313. // If successful, handle type chaining
  8314. if ( isSuccess ) {
  8315. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  8316. if ( s.ifModified ) {
  8317. modified = jqXHR.getResponseHeader( "Last-Modified" );
  8318. if ( modified ) {
  8319. jQuery.lastModified[ cacheURL ] = modified;
  8320. }
  8321. modified = jqXHR.getResponseHeader( "etag" );
  8322. if ( modified ) {
  8323. jQuery.etag[ cacheURL ] = modified;
  8324. }
  8325. }
  8326. // if no content
  8327. if ( status === 204 || s.type === "HEAD" ) {
  8328. statusText = "nocontent";
  8329. // if not modified
  8330. } else if ( status === 304 ) {
  8331. statusText = "notmodified";
  8332. // If we have data, let's convert it
  8333. } else {
  8334. statusText = response.state;
  8335. success = response.data;
  8336. error = response.error;
  8337. isSuccess = !error;
  8338. }
  8339. } else {
  8340. // Extract error from statusText and normalize for non-aborts
  8341. error = statusText;
  8342. if ( status || !statusText ) {
  8343. statusText = "error";
  8344. if ( status < 0 ) {
  8345. status = 0;
  8346. }
  8347. }
  8348. }
  8349. // Set data for the fake xhr object
  8350. jqXHR.status = status;
  8351. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  8352. // Success/Error
  8353. if ( isSuccess ) {
  8354. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  8355. } else {
  8356. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  8357. }
  8358. // Status-dependent callbacks
  8359. jqXHR.statusCode( statusCode );
  8360. statusCode = undefined;
  8361. if ( fireGlobals ) {
  8362. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  8363. [ jqXHR, s, isSuccess ? success : error ] );
  8364. }
  8365. // Complete
  8366. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  8367. if ( fireGlobals ) {
  8368. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  8369. // Handle the global AJAX counter
  8370. if ( !( --jQuery.active ) ) {
  8371. jQuery.event.trigger( "ajaxStop" );
  8372. }
  8373. }
  8374. }
  8375. return jqXHR;
  8376. },
  8377. getJSON: function( url, data, callback ) {
  8378. return jQuery.get( url, data, callback, "json" );
  8379. },
  8380. getScript: function( url, callback ) {
  8381. return jQuery.get( url, undefined, callback, "script" );
  8382. }
  8383. } );
  8384. jQuery.each( [ "get", "post" ], function( i, method ) {
  8385. jQuery[ method ] = function( url, data, callback, type ) {
  8386. // Shift arguments if data argument was omitted
  8387. if ( jQuery.isFunction( data ) ) {
  8388. type = type || callback;
  8389. callback = data;
  8390. data = undefined;
  8391. }
  8392. // The url can be an options object (which then must have .url)
  8393. return jQuery.ajax( jQuery.extend( {
  8394. url: url,
  8395. type: method,
  8396. dataType: type,
  8397. data: data,
  8398. success: callback
  8399. }, jQuery.isPlainObject( url ) && url ) );
  8400. };
  8401. } );
  8402. jQuery._evalUrl = function( url ) {
  8403. return jQuery.ajax( {
  8404. url: url,
  8405. // Make this explicit, since user can override this through ajaxSetup (#11264)
  8406. type: "GET",
  8407. dataType: "script",
  8408. cache: true,
  8409. async: false,
  8410. global: false,
  8411. "throws": true
  8412. } );
  8413. };
  8414. jQuery.fn.extend( {
  8415. wrapAll: function( html ) {
  8416. var wrap;
  8417. if ( this[ 0 ] ) {
  8418. if ( jQuery.isFunction( html ) ) {
  8419. html = html.call( this[ 0 ] );
  8420. }
  8421. // The elements to wrap the target around
  8422. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  8423. if ( this[ 0 ].parentNode ) {
  8424. wrap.insertBefore( this[ 0 ] );
  8425. }
  8426. wrap.map( function() {
  8427. var elem = this;
  8428. while ( elem.firstElementChild ) {
  8429. elem = elem.firstElementChild;
  8430. }
  8431. return elem;
  8432. } ).append( this );
  8433. }
  8434. return this;
  8435. },
  8436. wrapInner: function( html ) {
  8437. if ( jQuery.isFunction( html ) ) {
  8438. return this.each( function( i ) {
  8439. jQuery( this ).wrapInner( html.call( this, i ) );
  8440. } );
  8441. }
  8442. return this.each( function() {
  8443. var self = jQuery( this ),
  8444. contents = self.contents();
  8445. if ( contents.length ) {
  8446. contents.wrapAll( html );
  8447. } else {
  8448. self.append( html );
  8449. }
  8450. } );
  8451. },
  8452. wrap: function( html ) {
  8453. var isFunction = jQuery.isFunction( html );
  8454. return this.each( function( i ) {
  8455. jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
  8456. } );
  8457. },
  8458. unwrap: function( selector ) {
  8459. this.parent( selector ).not( "body" ).each( function() {
  8460. jQuery( this ).replaceWith( this.childNodes );
  8461. } );
  8462. return this;
  8463. }
  8464. } );
  8465. jQuery.expr.pseudos.hidden = function( elem ) {
  8466. return !jQuery.expr.pseudos.visible( elem );
  8467. };
  8468. jQuery.expr.pseudos.visible = function( elem ) {
  8469. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  8470. };
  8471. jQuery.ajaxSettings.xhr = function() {
  8472. try {
  8473. return new window.XMLHttpRequest();
  8474. } catch ( e ) {}
  8475. };
  8476. var xhrSuccessStatus = {
  8477. // File protocol always yields status code 0, assume 200
  8478. 0: 200,
  8479. // Support: IE <=9 only
  8480. // #1450: sometimes IE returns 1223 when it should be 204
  8481. 1223: 204
  8482. },
  8483. xhrSupported = jQuery.ajaxSettings.xhr();
  8484. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  8485. support.ajax = xhrSupported = !!xhrSupported;
  8486. jQuery.ajaxTransport( function( options ) {
  8487. var callback, errorCallback;
  8488. // Cross domain only allowed if supported through XMLHttpRequest
  8489. if ( support.cors || xhrSupported && !options.crossDomain ) {
  8490. return {
  8491. send: function( headers, complete ) {
  8492. var i,
  8493. xhr = options.xhr();
  8494. xhr.open(
  8495. options.type,
  8496. options.url,
  8497. options.async,
  8498. options.username,
  8499. options.password
  8500. );
  8501. // Apply custom fields if provided
  8502. if ( options.xhrFields ) {
  8503. for ( i in options.xhrFields ) {
  8504. xhr[ i ] = options.xhrFields[ i ];
  8505. }
  8506. }
  8507. // Override mime type if needed
  8508. if ( options.mimeType && xhr.overrideMimeType ) {
  8509. xhr.overrideMimeType( options.mimeType );
  8510. }
  8511. // X-Requested-With header
  8512. // For cross-domain requests, seeing as conditions for a preflight are
  8513. // akin to a jigsaw puzzle, we simply never set it to be sure.
  8514. // (it can always be set on a per-request basis or even using ajaxSetup)
  8515. // For same-domain requests, won't change header if already provided.
  8516. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  8517. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  8518. }
  8519. // Set headers
  8520. for ( i in headers ) {
  8521. xhr.setRequestHeader( i, headers[ i ] );
  8522. }
  8523. // Callback
  8524. callback = function( type ) {
  8525. return function() {
  8526. if ( callback ) {
  8527. callback = errorCallback = xhr.onload =
  8528. xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
  8529. if ( type === "abort" ) {
  8530. xhr.abort();
  8531. } else if ( type === "error" ) {
  8532. // Support: IE <=9 only
  8533. // On a manual native abort, IE9 throws
  8534. // errors on any property access that is not readyState
  8535. if ( typeof xhr.status !== "number" ) {
  8536. complete( 0, "error" );
  8537. } else {
  8538. complete(
  8539. // File: protocol always yields status 0; see #8605, #14207
  8540. xhr.status,
  8541. xhr.statusText
  8542. );
  8543. }
  8544. } else {
  8545. complete(
  8546. xhrSuccessStatus[ xhr.status ] || xhr.status,
  8547. xhr.statusText,
  8548. // Support: IE <=9 only
  8549. // IE9 has no XHR2 but throws on binary (trac-11426)
  8550. // For XHR2 non-text, let the caller handle it (gh-2498)
  8551. ( xhr.responseType || "text" ) !== "text" ||
  8552. typeof xhr.responseText !== "string" ?
  8553. { binary: xhr.response } :
  8554. { text: xhr.responseText },
  8555. xhr.getAllResponseHeaders()
  8556. );
  8557. }
  8558. }
  8559. };
  8560. };
  8561. // Listen to events
  8562. xhr.onload = callback();
  8563. errorCallback = xhr.onerror = callback( "error" );
  8564. // Support: IE 9 only
  8565. // Use onreadystatechange to replace onabort
  8566. // to handle uncaught aborts
  8567. if ( xhr.onabort !== undefined ) {
  8568. xhr.onabort = errorCallback;
  8569. } else {
  8570. xhr.onreadystatechange = function() {
  8571. // Check readyState before timeout as it changes
  8572. if ( xhr.readyState === 4 ) {
  8573. // Allow onerror to be called first,
  8574. // but that will not handle a native abort
  8575. // Also, save errorCallback to a variable
  8576. // as xhr.onerror cannot be accessed
  8577. window.setTimeout( function() {
  8578. if ( callback ) {
  8579. errorCallback();
  8580. }
  8581. } );
  8582. }
  8583. };
  8584. }
  8585. // Create the abort callback
  8586. callback = callback( "abort" );
  8587. try {
  8588. // Do send the request (this may raise an exception)
  8589. xhr.send( options.hasContent && options.data || null );
  8590. } catch ( e ) {
  8591. // #14683: Only rethrow if this hasn't been notified as an error yet
  8592. if ( callback ) {
  8593. throw e;
  8594. }
  8595. }
  8596. },
  8597. abort: function() {
  8598. if ( callback ) {
  8599. callback();
  8600. }
  8601. }
  8602. };
  8603. }
  8604. } );
  8605. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  8606. jQuery.ajaxPrefilter( function( s ) {
  8607. if ( s.crossDomain ) {
  8608. s.contents.script = false;
  8609. }
  8610. } );
  8611. // Install script dataType
  8612. jQuery.ajaxSetup( {
  8613. accepts: {
  8614. script: "text/javascript, application/javascript, " +
  8615. "application/ecmascript, application/x-ecmascript"
  8616. },
  8617. contents: {
  8618. script: /\b(?:java|ecma)script\b/
  8619. },
  8620. converters: {
  8621. "text script": function( text ) {
  8622. jQuery.globalEval( text );
  8623. return text;
  8624. }
  8625. }
  8626. } );
  8627. // Handle cache's special case and crossDomain
  8628. jQuery.ajaxPrefilter( "script", function( s ) {
  8629. if ( s.cache === undefined ) {
  8630. s.cache = false;
  8631. }
  8632. if ( s.crossDomain ) {
  8633. s.type = "GET";
  8634. }
  8635. } );
  8636. // Bind script tag hack transport
  8637. jQuery.ajaxTransport( "script", function( s ) {
  8638. // This transport only deals with cross domain requests
  8639. if ( s.crossDomain ) {
  8640. var script, callback;
  8641. return {
  8642. send: function( _, complete ) {
  8643. script = jQuery( "<script>" ).prop( {
  8644. charset: s.scriptCharset,
  8645. src: s.url
  8646. } ).on(
  8647. "load error",
  8648. callback = function( evt ) {
  8649. script.remove();
  8650. callback = null;
  8651. if ( evt ) {
  8652. complete( evt.type === "error" ? 404 : 200, evt.type );
  8653. }
  8654. }
  8655. );
  8656. // Use native DOM manipulation to avoid our domManip AJAX trickery
  8657. document.head.appendChild( script[ 0 ] );
  8658. },
  8659. abort: function() {
  8660. if ( callback ) {
  8661. callback();
  8662. }
  8663. }
  8664. };
  8665. }
  8666. } );
  8667. var oldCallbacks = [],
  8668. rjsonp = /(=)\?(?=&|$)|\?\?/;
  8669. // Default jsonp settings
  8670. jQuery.ajaxSetup( {
  8671. jsonp: "callback",
  8672. jsonpCallback: function() {
  8673. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  8674. this[ callback ] = true;
  8675. return callback;
  8676. }
  8677. } );
  8678. // Detect, normalize options and install callbacks for jsonp requests
  8679. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  8680. var callbackName, overwritten, responseContainer,
  8681. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  8682. "url" :
  8683. typeof s.data === "string" &&
  8684. ( s.contentType || "" )
  8685. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  8686. rjsonp.test( s.data ) && "data"
  8687. );
  8688. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  8689. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  8690. // Get callback name, remembering preexisting value associated with it
  8691. callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
  8692. s.jsonpCallback() :
  8693. s.jsonpCallback;
  8694. // Insert callback into url or form data
  8695. if ( jsonProp ) {
  8696. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  8697. } else if ( s.jsonp !== false ) {
  8698. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  8699. }
  8700. // Use data converter to retrieve json after script execution
  8701. s.converters[ "script json" ] = function() {
  8702. if ( !responseContainer ) {
  8703. jQuery.error( callbackName + " was not called" );
  8704. }
  8705. return responseContainer[ 0 ];
  8706. };
  8707. // Force json dataType
  8708. s.dataTypes[ 0 ] = "json";
  8709. // Install callback
  8710. overwritten = window[ callbackName ];
  8711. window[ callbackName ] = function() {
  8712. responseContainer = arguments;
  8713. };
  8714. // Clean-up function (fires after converters)
  8715. jqXHR.always( function() {
  8716. // If previous value didn't exist - remove it
  8717. if ( overwritten === undefined ) {
  8718. jQuery( window ).removeProp( callbackName );
  8719. // Otherwise restore preexisting value
  8720. } else {
  8721. window[ callbackName ] = overwritten;
  8722. }
  8723. // Save back as free
  8724. if ( s[ callbackName ] ) {
  8725. // Make sure that re-using the options doesn't screw things around
  8726. s.jsonpCallback = originalSettings.jsonpCallback;
  8727. // Save the callback name for future use
  8728. oldCallbacks.push( callbackName );
  8729. }
  8730. // Call if it was a function and we have a response
  8731. if ( responseContainer && jQuery.isFunction( overwritten ) ) {
  8732. overwritten( responseContainer[ 0 ] );
  8733. }
  8734. responseContainer = overwritten = undefined;
  8735. } );
  8736. // Delegate to script
  8737. return "script";
  8738. }
  8739. } );
  8740. // Support: Safari 8 only
  8741. // In Safari 8 documents created via document.implementation.createHTMLDocument
  8742. // collapse sibling forms: the second one becomes a child of the first one.
  8743. // Because of that, this security measure has to be disabled in Safari 8.
  8744. // https://bugs.webkit.org/show_bug.cgi?id=137337
  8745. support.createHTMLDocument = ( function() {
  8746. var body = document.implementation.createHTMLDocument( "" ).body;
  8747. body.innerHTML = "<form></form><form></form>";
  8748. return body.childNodes.length === 2;
  8749. } )();
  8750. // Argument "data" should be string of html
  8751. // context (optional): If specified, the fragment will be created in this context,
  8752. // defaults to document
  8753. // keepScripts (optional): If true, will include scripts passed in the html string
  8754. jQuery.parseHTML = function( data, context, keepScripts ) {
  8755. if ( typeof data !== "string" ) {
  8756. return [];
  8757. }
  8758. if ( typeof context === "boolean" ) {
  8759. keepScripts = context;
  8760. context = false;
  8761. }
  8762. var base, parsed, scripts;
  8763. if ( !context ) {
  8764. // Stop scripts or inline event handlers from being executed immediately
  8765. // by using document.implementation
  8766. if ( support.createHTMLDocument ) {
  8767. context = document.implementation.createHTMLDocument( "" );
  8768. // Set the base href for the created document
  8769. // so any parsed elements with URLs
  8770. // are based on the document's URL (gh-2965)
  8771. base = context.createElement( "base" );
  8772. base.href = document.location.href;
  8773. context.head.appendChild( base );
  8774. } else {
  8775. context = document;
  8776. }
  8777. }
  8778. parsed = rsingleTag.exec( data );
  8779. scripts = !keepScripts && [];
  8780. // Single tag
  8781. if ( parsed ) {
  8782. return [ context.createElement( parsed[ 1 ] ) ];
  8783. }
  8784. parsed = buildFragment( [ data ], context, scripts );
  8785. if ( scripts && scripts.length ) {
  8786. jQuery( scripts ).remove();
  8787. }
  8788. return jQuery.merge( [], parsed.childNodes );
  8789. };
  8790. /**
  8791. * Load a url into a page
  8792. */
  8793. jQuery.fn.load = function( url, params, callback ) {
  8794. var selector, type, response,
  8795. self = this,
  8796. off = url.indexOf( " " );
  8797. if ( off > -1 ) {
  8798. selector = stripAndCollapse( url.slice( off ) );
  8799. url = url.slice( 0, off );
  8800. }
  8801. // If it's a function
  8802. if ( jQuery.isFunction( params ) ) {
  8803. // We assume that it's the callback
  8804. callback = params;
  8805. params = undefined;
  8806. // Otherwise, build a param string
  8807. } else if ( params && typeof params === "object" ) {
  8808. type = "POST";
  8809. }
  8810. // If we have elements to modify, make the request
  8811. if ( self.length > 0 ) {
  8812. jQuery.ajax( {
  8813. url: url,
  8814. // If "type" variable is undefined, then "GET" method will be used.
  8815. // Make value of this field explicit since
  8816. // user can override it through ajaxSetup method
  8817. type: type || "GET",
  8818. dataType: "html",
  8819. data: params
  8820. } ).done( function( responseText ) {
  8821. // Save response for use in complete callback
  8822. response = arguments;
  8823. self.html( selector ?
  8824. // If a selector was specified, locate the right elements in a dummy div
  8825. // Exclude scripts to avoid IE 'Permission Denied' errors
  8826. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  8827. // Otherwise use the full result
  8828. responseText );
  8829. // If the request succeeds, this function gets "data", "status", "jqXHR"
  8830. // but they are ignored because response was set above.
  8831. // If it fails, this function gets "jqXHR", "status", "error"
  8832. } ).always( callback && function( jqXHR, status ) {
  8833. self.each( function() {
  8834. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  8835. } );
  8836. } );
  8837. }
  8838. return this;
  8839. };
  8840. // Attach a bunch of functions for handling common AJAX events
  8841. jQuery.each( [
  8842. "ajaxStart",
  8843. "ajaxStop",
  8844. "ajaxComplete",
  8845. "ajaxError",
  8846. "ajaxSuccess",
  8847. "ajaxSend"
  8848. ], function( i, type ) {
  8849. jQuery.fn[ type ] = function( fn ) {
  8850. return this.on( type, fn );
  8851. };
  8852. } );
  8853. jQuery.expr.pseudos.animated = function( elem ) {
  8854. return jQuery.grep( jQuery.timers, function( fn ) {
  8855. return elem === fn.elem;
  8856. } ).length;
  8857. };
  8858. jQuery.offset = {
  8859. setOffset: function( elem, options, i ) {
  8860. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  8861. position = jQuery.css( elem, "position" ),
  8862. curElem = jQuery( elem ),
  8863. props = {};
  8864. // Set position first, in-case top/left are set even on static elem
  8865. if ( position === "static" ) {
  8866. elem.style.position = "relative";
  8867. }
  8868. curOffset = curElem.offset();
  8869. curCSSTop = jQuery.css( elem, "top" );
  8870. curCSSLeft = jQuery.css( elem, "left" );
  8871. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  8872. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  8873. // Need to be able to calculate position if either
  8874. // top or left is auto and position is either absolute or fixed
  8875. if ( calculatePosition ) {
  8876. curPosition = curElem.position();
  8877. curTop = curPosition.top;
  8878. curLeft = curPosition.left;
  8879. } else {
  8880. curTop = parseFloat( curCSSTop ) || 0;
  8881. curLeft = parseFloat( curCSSLeft ) || 0;
  8882. }
  8883. if ( jQuery.isFunction( options ) ) {
  8884. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  8885. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  8886. }
  8887. if ( options.top != null ) {
  8888. props.top = ( options.top - curOffset.top ) + curTop;
  8889. }
  8890. if ( options.left != null ) {
  8891. props.left = ( options.left - curOffset.left ) + curLeft;
  8892. }
  8893. if ( "using" in options ) {
  8894. options.using.call( elem, props );
  8895. } else {
  8896. curElem.css( props );
  8897. }
  8898. }
  8899. };
  8900. jQuery.fn.extend( {
  8901. offset: function( options ) {
  8902. // Preserve chaining for setter
  8903. if ( arguments.length ) {
  8904. return options === undefined ?
  8905. this :
  8906. this.each( function( i ) {
  8907. jQuery.offset.setOffset( this, options, i );
  8908. } );
  8909. }
  8910. var doc, docElem, rect, win,
  8911. elem = this[ 0 ];
  8912. if ( !elem ) {
  8913. return;
  8914. }
  8915. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  8916. // Support: IE <=11 only
  8917. // Running getBoundingClientRect on a
  8918. // disconnected node in IE throws an error
  8919. if ( !elem.getClientRects().length ) {
  8920. return { top: 0, left: 0 };
  8921. }
  8922. rect = elem.getBoundingClientRect();
  8923. doc = elem.ownerDocument;
  8924. docElem = doc.documentElement;
  8925. win = doc.defaultView;
  8926. return {
  8927. top: rect.top + win.pageYOffset - docElem.clientTop,
  8928. left: rect.left + win.pageXOffset - docElem.clientLeft
  8929. };
  8930. },
  8931. position: function() {
  8932. if ( !this[ 0 ] ) {
  8933. return;
  8934. }
  8935. var offsetParent, offset,
  8936. elem = this[ 0 ],
  8937. parentOffset = { top: 0, left: 0 };
  8938. // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
  8939. // because it is its only offset parent
  8940. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  8941. // Assume getBoundingClientRect is there when computed position is fixed
  8942. offset = elem.getBoundingClientRect();
  8943. } else {
  8944. // Get *real* offsetParent
  8945. offsetParent = this.offsetParent();
  8946. // Get correct offsets
  8947. offset = this.offset();
  8948. if ( !nodeName( offsetParent[ 0 ], "html" ) ) {
  8949. parentOffset = offsetParent.offset();
  8950. }
  8951. // Add offsetParent borders
  8952. parentOffset = {
  8953. top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ),
  8954. left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true )
  8955. };
  8956. }
  8957. // Subtract parent offsets and element margins
  8958. return {
  8959. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  8960. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  8961. };
  8962. },
  8963. // This method will return documentElement in the following cases:
  8964. // 1) For the element inside the iframe without offsetParent, this method will return
  8965. // documentElement of the parent window
  8966. // 2) For the hidden or detached element
  8967. // 3) For body or html element, i.e. in case of the html node - it will return itself
  8968. //
  8969. // but those exceptions were never presented as a real life use-cases
  8970. // and might be considered as more preferable results.
  8971. //
  8972. // This logic, however, is not guaranteed and can change at any point in the future
  8973. offsetParent: function() {
  8974. return this.map( function() {
  8975. var offsetParent = this.offsetParent;
  8976. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  8977. offsetParent = offsetParent.offsetParent;
  8978. }
  8979. return offsetParent || documentElement;
  8980. } );
  8981. }
  8982. } );
  8983. // Create scrollLeft and scrollTop methods
  8984. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  8985. var top = "pageYOffset" === prop;
  8986. jQuery.fn[ method ] = function( val ) {
  8987. return access( this, function( elem, method, val ) {
  8988. // Coalesce documents and windows
  8989. var win;
  8990. if ( jQuery.isWindow( elem ) ) {
  8991. win = elem;
  8992. } else if ( elem.nodeType === 9 ) {
  8993. win = elem.defaultView;
  8994. }
  8995. if ( val === undefined ) {
  8996. return win ? win[ prop ] : elem[ method ];
  8997. }
  8998. if ( win ) {
  8999. win.scrollTo(
  9000. !top ? val : win.pageXOffset,
  9001. top ? val : win.pageYOffset
  9002. );
  9003. } else {
  9004. elem[ method ] = val;
  9005. }
  9006. }, method, val, arguments.length );
  9007. };
  9008. } );
  9009. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  9010. // Add the top/left cssHooks using jQuery.fn.position
  9011. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  9012. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  9013. // getComputedStyle returns percent when specified for top/left/bottom/right;
  9014. // rather than make the css module depend on the offset module, just check for it here
  9015. jQuery.each( [ "top", "left" ], function( i, prop ) {
  9016. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  9017. function( elem, computed ) {
  9018. if ( computed ) {
  9019. computed = curCSS( elem, prop );
  9020. // If curCSS returns percentage, fallback to offset
  9021. return rnumnonpx.test( computed ) ?
  9022. jQuery( elem ).position()[ prop ] + "px" :
  9023. computed;
  9024. }
  9025. }
  9026. );
  9027. } );
  9028. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  9029. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  9030. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  9031. function( defaultExtra, funcName ) {
  9032. // Margin is only for outerHeight, outerWidth
  9033. jQuery.fn[ funcName ] = function( margin, value ) {
  9034. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  9035. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  9036. return access( this, function( elem, type, value ) {
  9037. var doc;
  9038. if ( jQuery.isWindow( elem ) ) {
  9039. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  9040. return funcName.indexOf( "outer" ) === 0 ?
  9041. elem[ "inner" + name ] :
  9042. elem.document.documentElement[ "client" + name ];
  9043. }
  9044. // Get document width or height
  9045. if ( elem.nodeType === 9 ) {
  9046. doc = elem.documentElement;
  9047. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  9048. // whichever is greatest
  9049. return Math.max(
  9050. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  9051. elem.body[ "offset" + name ], doc[ "offset" + name ],
  9052. doc[ "client" + name ]
  9053. );
  9054. }
  9055. return value === undefined ?
  9056. // Get width or height on the element, requesting but not forcing parseFloat
  9057. jQuery.css( elem, type, extra ) :
  9058. // Set width or height on the element
  9059. jQuery.style( elem, type, value, extra );
  9060. }, type, chainable ? margin : undefined, chainable );
  9061. };
  9062. } );
  9063. } );
  9064. jQuery.fn.extend( {
  9065. bind: function( types, data, fn ) {
  9066. return this.on( types, null, data, fn );
  9067. },
  9068. unbind: function( types, fn ) {
  9069. return this.off( types, null, fn );
  9070. },
  9071. delegate: function( selector, types, data, fn ) {
  9072. return this.on( types, selector, data, fn );
  9073. },
  9074. undelegate: function( selector, types, fn ) {
  9075. // ( namespace ) or ( selector, types [, fn] )
  9076. return arguments.length === 1 ?
  9077. this.off( selector, "**" ) :
  9078. this.off( types, selector || "**", fn );
  9079. }
  9080. } );
  9081. jQuery.holdReady = function( hold ) {
  9082. if ( hold ) {
  9083. jQuery.readyWait++;
  9084. } else {
  9085. jQuery.ready( true );
  9086. }
  9087. };
  9088. jQuery.isArray = Array.isArray;
  9089. jQuery.parseJSON = JSON.parse;
  9090. jQuery.nodeName = nodeName;
  9091. // Register as a named AMD module, since jQuery can be concatenated with other
  9092. // files that may use define, but not via a proper concatenation script that
  9093. // understands anonymous AMD modules. A named AMD is safest and most robust
  9094. // way to register. Lowercase jquery is used because AMD module names are
  9095. // derived from file names, and jQuery is normally delivered in a lowercase
  9096. // file name. Do this after creating the global so that if an AMD module wants
  9097. // to call noConflict to hide this version of jQuery, it will work.
  9098. // Note that for maximum portability, libraries that are not jQuery should
  9099. // declare themselves as anonymous modules, and avoid setting a global if an
  9100. // AMD loader is present. jQuery is a special case. For more information, see
  9101. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  9102. if ( true ) {
  9103. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
  9104. return jQuery;
  9105. }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  9106. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  9107. }
  9108. var
  9109. // Map over jQuery in case of overwrite
  9110. _jQuery = window.jQuery,
  9111. // Map over the $ in case of overwrite
  9112. _$ = window.$;
  9113. jQuery.noConflict = function( deep ) {
  9114. if ( window.$ === jQuery ) {
  9115. window.$ = _$;
  9116. }
  9117. if ( deep && window.jQuery === jQuery ) {
  9118. window.jQuery = _jQuery;
  9119. }
  9120. return jQuery;
  9121. };
  9122. // Expose jQuery and $ identifiers, even in AMD
  9123. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  9124. // and CommonJS for browser emulators (#13566)
  9125. if ( !noGlobal ) {
  9126. window.jQuery = window.$ = jQuery;
  9127. }
  9128. return jQuery;
  9129. } );
  9130. /***/ }),
  9131. /* 9 */
  9132. /***/ (function(module, exports) {
  9133. var g;
  9134. // This works in non-strict mode
  9135. g = (function() {
  9136. return this;
  9137. })();
  9138. try {
  9139. // This works if eval is allowed (see CSP)
  9140. g = g || Function("return this")() || (1,eval)("this");
  9141. } catch(e) {
  9142. // This works if the window reference is available
  9143. if(typeof window === "object")
  9144. g = window;
  9145. }
  9146. // g can still be undefined, but nothing to do about it...
  9147. // We return undefined, instead of nothing here, so it's
  9148. // easier to handle this case. if(!global) { ...}
  9149. module.exports = g;
  9150. /***/ }),
  9151. /* 10 */
  9152. /***/ (function(module, exports, __webpack_require__) {
  9153. /**
  9154. * First we will load all of this project's JavaScript dependencies which
  9155. * includes Vue and other libraries. It is a great starting point when
  9156. * building robust, powerful web applications using Vue and Laravel.
  9157. */
  9158. __webpack_require__(31);
  9159. /**
  9160. * Next, we will create a fresh Vue application instance and attach it to
  9161. * the page. Then, you may begin adding components to this application
  9162. * or customize the JavaScript scaffolding to fit your unique needs.
  9163. */
  9164. Vue.component('example', __webpack_require__(34));
  9165. var app = new Vue({
  9166. el: '#app'
  9167. });
  9168. /***/ }),
  9169. /* 11 */
  9170. /***/ (function(module, exports) {
  9171. // removed by extract-text-webpack-plugin
  9172. /***/ }),
  9173. /* 12 */
  9174. /***/ (function(module, exports, __webpack_require__) {
  9175. module.exports = __webpack_require__(13);
  9176. /***/ }),
  9177. /* 13 */
  9178. /***/ (function(module, exports, __webpack_require__) {
  9179. "use strict";
  9180. var utils = __webpack_require__(0);
  9181. var bind = __webpack_require__(7);
  9182. var Axios = __webpack_require__(15);
  9183. var defaults = __webpack_require__(1);
  9184. /**
  9185. * Create an instance of Axios
  9186. *
  9187. * @param {Object} defaultConfig The default config for the instance
  9188. * @return {Axios} A new instance of Axios
  9189. */
  9190. function createInstance(defaultConfig) {
  9191. var context = new Axios(defaultConfig);
  9192. var instance = bind(Axios.prototype.request, context);
  9193. // Copy axios.prototype to instance
  9194. utils.extend(instance, Axios.prototype, context);
  9195. // Copy context to instance
  9196. utils.extend(instance, context);
  9197. return instance;
  9198. }
  9199. // Create the default instance to be exported
  9200. var axios = createInstance(defaults);
  9201. // Expose Axios class to allow class inheritance
  9202. axios.Axios = Axios;
  9203. // Factory for creating new instances
  9204. axios.create = function create(instanceConfig) {
  9205. return createInstance(utils.merge(defaults, instanceConfig));
  9206. };
  9207. // Expose Cancel & CancelToken
  9208. axios.Cancel = __webpack_require__(4);
  9209. axios.CancelToken = __webpack_require__(14);
  9210. axios.isCancel = __webpack_require__(5);
  9211. // Expose all/spread
  9212. axios.all = function all(promises) {
  9213. return Promise.all(promises);
  9214. };
  9215. axios.spread = __webpack_require__(29);
  9216. module.exports = axios;
  9217. // Allow use of default import syntax in TypeScript
  9218. module.exports.default = axios;
  9219. /***/ }),
  9220. /* 14 */
  9221. /***/ (function(module, exports, __webpack_require__) {
  9222. "use strict";
  9223. var Cancel = __webpack_require__(4);
  9224. /**
  9225. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  9226. *
  9227. * @class
  9228. * @param {Function} executor The executor function.
  9229. */
  9230. function CancelToken(executor) {
  9231. if (typeof executor !== 'function') {
  9232. throw new TypeError('executor must be a function.');
  9233. }
  9234. var resolvePromise;
  9235. this.promise = new Promise(function promiseExecutor(resolve) {
  9236. resolvePromise = resolve;
  9237. });
  9238. var token = this;
  9239. executor(function cancel(message) {
  9240. if (token.reason) {
  9241. // Cancellation has already been requested
  9242. return;
  9243. }
  9244. token.reason = new Cancel(message);
  9245. resolvePromise(token.reason);
  9246. });
  9247. }
  9248. /**
  9249. * Throws a `Cancel` if cancellation has been requested.
  9250. */
  9251. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  9252. if (this.reason) {
  9253. throw this.reason;
  9254. }
  9255. };
  9256. /**
  9257. * Returns an object that contains a new `CancelToken` and a function that, when called,
  9258. * cancels the `CancelToken`.
  9259. */
  9260. CancelToken.source = function source() {
  9261. var cancel;
  9262. var token = new CancelToken(function executor(c) {
  9263. cancel = c;
  9264. });
  9265. return {
  9266. token: token,
  9267. cancel: cancel
  9268. };
  9269. };
  9270. module.exports = CancelToken;
  9271. /***/ }),
  9272. /* 15 */
  9273. /***/ (function(module, exports, __webpack_require__) {
  9274. "use strict";
  9275. var defaults = __webpack_require__(1);
  9276. var utils = __webpack_require__(0);
  9277. var InterceptorManager = __webpack_require__(16);
  9278. var dispatchRequest = __webpack_require__(17);
  9279. var isAbsoluteURL = __webpack_require__(25);
  9280. var combineURLs = __webpack_require__(23);
  9281. /**
  9282. * Create a new instance of Axios
  9283. *
  9284. * @param {Object} instanceConfig The default config for the instance
  9285. */
  9286. function Axios(instanceConfig) {
  9287. this.defaults = instanceConfig;
  9288. this.interceptors = {
  9289. request: new InterceptorManager(),
  9290. response: new InterceptorManager()
  9291. };
  9292. }
  9293. /**
  9294. * Dispatch a request
  9295. *
  9296. * @param {Object} config The config specific for this request (merged with this.defaults)
  9297. */
  9298. Axios.prototype.request = function request(config) {
  9299. /*eslint no-param-reassign:0*/
  9300. // Allow for axios('example/url'[, config]) a la fetch API
  9301. if (typeof config === 'string') {
  9302. config = utils.merge({
  9303. url: arguments[0]
  9304. }, arguments[1]);
  9305. }
  9306. config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
  9307. // Support baseURL config
  9308. if (config.baseURL && !isAbsoluteURL(config.url)) {
  9309. config.url = combineURLs(config.baseURL, config.url);
  9310. }
  9311. // Hook up interceptors middleware
  9312. var chain = [dispatchRequest, undefined];
  9313. var promise = Promise.resolve(config);
  9314. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  9315. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  9316. });
  9317. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  9318. chain.push(interceptor.fulfilled, interceptor.rejected);
  9319. });
  9320. while (chain.length) {
  9321. promise = promise.then(chain.shift(), chain.shift());
  9322. }
  9323. return promise;
  9324. };
  9325. // Provide aliases for supported request methods
  9326. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  9327. /*eslint func-names:0*/
  9328. Axios.prototype[method] = function(url, config) {
  9329. return this.request(utils.merge(config || {}, {
  9330. method: method,
  9331. url: url
  9332. }));
  9333. };
  9334. });
  9335. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  9336. /*eslint func-names:0*/
  9337. Axios.prototype[method] = function(url, data, config) {
  9338. return this.request(utils.merge(config || {}, {
  9339. method: method,
  9340. url: url,
  9341. data: data
  9342. }));
  9343. };
  9344. });
  9345. module.exports = Axios;
  9346. /***/ }),
  9347. /* 16 */
  9348. /***/ (function(module, exports, __webpack_require__) {
  9349. "use strict";
  9350. var utils = __webpack_require__(0);
  9351. function InterceptorManager() {
  9352. this.handlers = [];
  9353. }
  9354. /**
  9355. * Add a new interceptor to the stack
  9356. *
  9357. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  9358. * @param {Function} rejected The function to handle `reject` for a `Promise`
  9359. *
  9360. * @return {Number} An ID used to remove interceptor later
  9361. */
  9362. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  9363. this.handlers.push({
  9364. fulfilled: fulfilled,
  9365. rejected: rejected
  9366. });
  9367. return this.handlers.length - 1;
  9368. };
  9369. /**
  9370. * Remove an interceptor from the stack
  9371. *
  9372. * @param {Number} id The ID that was returned by `use`
  9373. */
  9374. InterceptorManager.prototype.eject = function eject(id) {
  9375. if (this.handlers[id]) {
  9376. this.handlers[id] = null;
  9377. }
  9378. };
  9379. /**
  9380. * Iterate over all the registered interceptors
  9381. *
  9382. * This method is particularly useful for skipping over any
  9383. * interceptors that may have become `null` calling `eject`.
  9384. *
  9385. * @param {Function} fn The function to call for each interceptor
  9386. */
  9387. InterceptorManager.prototype.forEach = function forEach(fn) {
  9388. utils.forEach(this.handlers, function forEachHandler(h) {
  9389. if (h !== null) {
  9390. fn(h);
  9391. }
  9392. });
  9393. };
  9394. module.exports = InterceptorManager;
  9395. /***/ }),
  9396. /* 17 */
  9397. /***/ (function(module, exports, __webpack_require__) {
  9398. "use strict";
  9399. var utils = __webpack_require__(0);
  9400. var transformData = __webpack_require__(20);
  9401. var isCancel = __webpack_require__(5);
  9402. var defaults = __webpack_require__(1);
  9403. /**
  9404. * Throws a `Cancel` if cancellation has been requested.
  9405. */
  9406. function throwIfCancellationRequested(config) {
  9407. if (config.cancelToken) {
  9408. config.cancelToken.throwIfRequested();
  9409. }
  9410. }
  9411. /**
  9412. * Dispatch a request to the server using the configured adapter.
  9413. *
  9414. * @param {object} config The config that is to be used for the request
  9415. * @returns {Promise} The Promise to be fulfilled
  9416. */
  9417. module.exports = function dispatchRequest(config) {
  9418. throwIfCancellationRequested(config);
  9419. // Ensure headers exist
  9420. config.headers = config.headers || {};
  9421. // Transform request data
  9422. config.data = transformData(
  9423. config.data,
  9424. config.headers,
  9425. config.transformRequest
  9426. );
  9427. // Flatten headers
  9428. config.headers = utils.merge(
  9429. config.headers.common || {},
  9430. config.headers[config.method] || {},
  9431. config.headers || {}
  9432. );
  9433. utils.forEach(
  9434. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  9435. function cleanHeaderConfig(method) {
  9436. delete config.headers[method];
  9437. }
  9438. );
  9439. var adapter = config.adapter || defaults.adapter;
  9440. return adapter(config).then(function onAdapterResolution(response) {
  9441. throwIfCancellationRequested(config);
  9442. // Transform response data
  9443. response.data = transformData(
  9444. response.data,
  9445. response.headers,
  9446. config.transformResponse
  9447. );
  9448. return response;
  9449. }, function onAdapterRejection(reason) {
  9450. if (!isCancel(reason)) {
  9451. throwIfCancellationRequested(config);
  9452. // Transform response data
  9453. if (reason && reason.response) {
  9454. reason.response.data = transformData(
  9455. reason.response.data,
  9456. reason.response.headers,
  9457. config.transformResponse
  9458. );
  9459. }
  9460. }
  9461. return Promise.reject(reason);
  9462. });
  9463. };
  9464. /***/ }),
  9465. /* 18 */
  9466. /***/ (function(module, exports, __webpack_require__) {
  9467. "use strict";
  9468. /**
  9469. * Update an Error with the specified config, error code, and response.
  9470. *
  9471. * @param {Error} error The error to update.
  9472. * @param {Object} config The config.
  9473. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  9474. @ @param {Object} [response] The response.
  9475. * @returns {Error} The error.
  9476. */
  9477. module.exports = function enhanceError(error, config, code, response) {
  9478. error.config = config;
  9479. if (code) {
  9480. error.code = code;
  9481. }
  9482. error.response = response;
  9483. return error;
  9484. };
  9485. /***/ }),
  9486. /* 19 */
  9487. /***/ (function(module, exports, __webpack_require__) {
  9488. "use strict";
  9489. var createError = __webpack_require__(6);
  9490. /**
  9491. * Resolve or reject a Promise based on response status.
  9492. *
  9493. * @param {Function} resolve A function that resolves the promise.
  9494. * @param {Function} reject A function that rejects the promise.
  9495. * @param {object} response The response.
  9496. */
  9497. module.exports = function settle(resolve, reject, response) {
  9498. var validateStatus = response.config.validateStatus;
  9499. // Note: status is not exposed by XDomainRequest
  9500. if (!response.status || !validateStatus || validateStatus(response.status)) {
  9501. resolve(response);
  9502. } else {
  9503. reject(createError(
  9504. 'Request failed with status code ' + response.status,
  9505. response.config,
  9506. null,
  9507. response
  9508. ));
  9509. }
  9510. };
  9511. /***/ }),
  9512. /* 20 */
  9513. /***/ (function(module, exports, __webpack_require__) {
  9514. "use strict";
  9515. var utils = __webpack_require__(0);
  9516. /**
  9517. * Transform the data for a request or a response
  9518. *
  9519. * @param {Object|String} data The data to be transformed
  9520. * @param {Array} headers The headers for the request or response
  9521. * @param {Array|Function} fns A single function or Array of functions
  9522. * @returns {*} The resulting transformed data
  9523. */
  9524. module.exports = function transformData(data, headers, fns) {
  9525. /*eslint no-param-reassign:0*/
  9526. utils.forEach(fns, function transform(fn) {
  9527. data = fn(data, headers);
  9528. });
  9529. return data;
  9530. };
  9531. /***/ }),
  9532. /* 21 */
  9533. /***/ (function(module, exports, __webpack_require__) {
  9534. "use strict";
  9535. // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
  9536. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  9537. function E() {
  9538. this.message = 'String contains an invalid character';
  9539. }
  9540. E.prototype = new Error;
  9541. E.prototype.code = 5;
  9542. E.prototype.name = 'InvalidCharacterError';
  9543. function btoa(input) {
  9544. var str = String(input);
  9545. var output = '';
  9546. for (
  9547. // initialize result and counter
  9548. var block, charCode, idx = 0, map = chars;
  9549. // if the next str index does not exist:
  9550. // change the mapping table to "="
  9551. // check if d has no fractional digits
  9552. str.charAt(idx | 0) || (map = '=', idx % 1);
  9553. // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
  9554. output += map.charAt(63 & block >> 8 - idx % 1 * 8)
  9555. ) {
  9556. charCode = str.charCodeAt(idx += 3 / 4);
  9557. if (charCode > 0xFF) {
  9558. throw new E();
  9559. }
  9560. block = block << 8 | charCode;
  9561. }
  9562. return output;
  9563. }
  9564. module.exports = btoa;
  9565. /***/ }),
  9566. /* 22 */
  9567. /***/ (function(module, exports, __webpack_require__) {
  9568. "use strict";
  9569. var utils = __webpack_require__(0);
  9570. function encode(val) {
  9571. return encodeURIComponent(val).
  9572. replace(/%40/gi, '@').
  9573. replace(/%3A/gi, ':').
  9574. replace(/%24/g, '$').
  9575. replace(/%2C/gi, ',').
  9576. replace(/%20/g, '+').
  9577. replace(/%5B/gi, '[').
  9578. replace(/%5D/gi, ']');
  9579. }
  9580. /**
  9581. * Build a URL by appending params to the end
  9582. *
  9583. * @param {string} url The base of the url (e.g., http://www.google.com)
  9584. * @param {object} [params] The params to be appended
  9585. * @returns {string} The formatted url
  9586. */
  9587. module.exports = function buildURL(url, params, paramsSerializer) {
  9588. /*eslint no-param-reassign:0*/
  9589. if (!params) {
  9590. return url;
  9591. }
  9592. var serializedParams;
  9593. if (paramsSerializer) {
  9594. serializedParams = paramsSerializer(params);
  9595. } else if (utils.isURLSearchParams(params)) {
  9596. serializedParams = params.toString();
  9597. } else {
  9598. var parts = [];
  9599. utils.forEach(params, function serialize(val, key) {
  9600. if (val === null || typeof val === 'undefined') {
  9601. return;
  9602. }
  9603. if (utils.isArray(val)) {
  9604. key = key + '[]';
  9605. }
  9606. if (!utils.isArray(val)) {
  9607. val = [val];
  9608. }
  9609. utils.forEach(val, function parseValue(v) {
  9610. if (utils.isDate(v)) {
  9611. v = v.toISOString();
  9612. } else if (utils.isObject(v)) {
  9613. v = JSON.stringify(v);
  9614. }
  9615. parts.push(encode(key) + '=' + encode(v));
  9616. });
  9617. });
  9618. serializedParams = parts.join('&');
  9619. }
  9620. if (serializedParams) {
  9621. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  9622. }
  9623. return url;
  9624. };
  9625. /***/ }),
  9626. /* 23 */
  9627. /***/ (function(module, exports, __webpack_require__) {
  9628. "use strict";
  9629. /**
  9630. * Creates a new URL by combining the specified URLs
  9631. *
  9632. * @param {string} baseURL The base URL
  9633. * @param {string} relativeURL The relative URL
  9634. * @returns {string} The combined URL
  9635. */
  9636. module.exports = function combineURLs(baseURL, relativeURL) {
  9637. return baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '');
  9638. };
  9639. /***/ }),
  9640. /* 24 */
  9641. /***/ (function(module, exports, __webpack_require__) {
  9642. "use strict";
  9643. var utils = __webpack_require__(0);
  9644. module.exports = (
  9645. utils.isStandardBrowserEnv() ?
  9646. // Standard browser envs support document.cookie
  9647. (function standardBrowserEnv() {
  9648. return {
  9649. write: function write(name, value, expires, path, domain, secure) {
  9650. var cookie = [];
  9651. cookie.push(name + '=' + encodeURIComponent(value));
  9652. if (utils.isNumber(expires)) {
  9653. cookie.push('expires=' + new Date(expires).toGMTString());
  9654. }
  9655. if (utils.isString(path)) {
  9656. cookie.push('path=' + path);
  9657. }
  9658. if (utils.isString(domain)) {
  9659. cookie.push('domain=' + domain);
  9660. }
  9661. if (secure === true) {
  9662. cookie.push('secure');
  9663. }
  9664. document.cookie = cookie.join('; ');
  9665. },
  9666. read: function read(name) {
  9667. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  9668. return (match ? decodeURIComponent(match[3]) : null);
  9669. },
  9670. remove: function remove(name) {
  9671. this.write(name, '', Date.now() - 86400000);
  9672. }
  9673. };
  9674. })() :
  9675. // Non standard browser env (web workers, react-native) lack needed support.
  9676. (function nonStandardBrowserEnv() {
  9677. return {
  9678. write: function write() {},
  9679. read: function read() { return null; },
  9680. remove: function remove() {}
  9681. };
  9682. })()
  9683. );
  9684. /***/ }),
  9685. /* 25 */
  9686. /***/ (function(module, exports, __webpack_require__) {
  9687. "use strict";
  9688. /**
  9689. * Determines whether the specified URL is absolute
  9690. *
  9691. * @param {string} url The URL to test
  9692. * @returns {boolean} True if the specified URL is absolute, otherwise false
  9693. */
  9694. module.exports = function isAbsoluteURL(url) {
  9695. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  9696. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  9697. // by any combination of letters, digits, plus, period, or hyphen.
  9698. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  9699. };
  9700. /***/ }),
  9701. /* 26 */
  9702. /***/ (function(module, exports, __webpack_require__) {
  9703. "use strict";
  9704. var utils = __webpack_require__(0);
  9705. module.exports = (
  9706. utils.isStandardBrowserEnv() ?
  9707. // Standard browser envs have full support of the APIs needed to test
  9708. // whether the request URL is of the same origin as current location.
  9709. (function standardBrowserEnv() {
  9710. var msie = /(msie|trident)/i.test(navigator.userAgent);
  9711. var urlParsingNode = document.createElement('a');
  9712. var originURL;
  9713. /**
  9714. * Parse a URL to discover it's components
  9715. *
  9716. * @param {String} url The URL to be parsed
  9717. * @returns {Object}
  9718. */
  9719. function resolveURL(url) {
  9720. var href = url;
  9721. if (msie) {
  9722. // IE needs attribute set twice to normalize properties
  9723. urlParsingNode.setAttribute('href', href);
  9724. href = urlParsingNode.href;
  9725. }
  9726. urlParsingNode.setAttribute('href', href);
  9727. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  9728. return {
  9729. href: urlParsingNode.href,
  9730. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  9731. host: urlParsingNode.host,
  9732. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  9733. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  9734. hostname: urlParsingNode.hostname,
  9735. port: urlParsingNode.port,
  9736. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  9737. urlParsingNode.pathname :
  9738. '/' + urlParsingNode.pathname
  9739. };
  9740. }
  9741. originURL = resolveURL(window.location.href);
  9742. /**
  9743. * Determine if a URL shares the same origin as the current location
  9744. *
  9745. * @param {String} requestURL The URL to test
  9746. * @returns {boolean} True if URL shares the same origin, otherwise false
  9747. */
  9748. return function isURLSameOrigin(requestURL) {
  9749. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  9750. return (parsed.protocol === originURL.protocol &&
  9751. parsed.host === originURL.host);
  9752. };
  9753. })() :
  9754. // Non standard browser envs (web workers, react-native) lack needed support.
  9755. (function nonStandardBrowserEnv() {
  9756. return function isURLSameOrigin() {
  9757. return true;
  9758. };
  9759. })()
  9760. );
  9761. /***/ }),
  9762. /* 27 */
  9763. /***/ (function(module, exports, __webpack_require__) {
  9764. "use strict";
  9765. var utils = __webpack_require__(0);
  9766. module.exports = function normalizeHeaderName(headers, normalizedName) {
  9767. utils.forEach(headers, function processHeader(value, name) {
  9768. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  9769. headers[normalizedName] = value;
  9770. delete headers[name];
  9771. }
  9772. });
  9773. };
  9774. /***/ }),
  9775. /* 28 */
  9776. /***/ (function(module, exports, __webpack_require__) {
  9777. "use strict";
  9778. var utils = __webpack_require__(0);
  9779. /**
  9780. * Parse headers into an object
  9781. *
  9782. * ```
  9783. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  9784. * Content-Type: application/json
  9785. * Connection: keep-alive
  9786. * Transfer-Encoding: chunked
  9787. * ```
  9788. *
  9789. * @param {String} headers Headers needing to be parsed
  9790. * @returns {Object} Headers parsed into an object
  9791. */
  9792. module.exports = function parseHeaders(headers) {
  9793. var parsed = {};
  9794. var key;
  9795. var val;
  9796. var i;
  9797. if (!headers) { return parsed; }
  9798. utils.forEach(headers.split('\n'), function parser(line) {
  9799. i = line.indexOf(':');
  9800. key = utils.trim(line.substr(0, i)).toLowerCase();
  9801. val = utils.trim(line.substr(i + 1));
  9802. if (key) {
  9803. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  9804. }
  9805. });
  9806. return parsed;
  9807. };
  9808. /***/ }),
  9809. /* 29 */
  9810. /***/ (function(module, exports, __webpack_require__) {
  9811. "use strict";
  9812. /**
  9813. * Syntactic sugar for invoking a function and expanding an array for arguments.
  9814. *
  9815. * Common use case would be to use `Function.prototype.apply`.
  9816. *
  9817. * ```js
  9818. * function f(x, y, z) {}
  9819. * var args = [1, 2, 3];
  9820. * f.apply(null, args);
  9821. * ```
  9822. *
  9823. * With `spread` this example can be re-written.
  9824. *
  9825. * ```js
  9826. * spread(function(x, y, z) {})([1, 2, 3]);
  9827. * ```
  9828. *
  9829. * @param {Function} callback
  9830. * @returns {Function}
  9831. */
  9832. module.exports = function spread(callback) {
  9833. return function wrap(arr) {
  9834. return callback.apply(null, arr);
  9835. };
  9836. };
  9837. /***/ }),
  9838. /* 30 */
  9839. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9840. "use strict";
  9841. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  9842. //
  9843. //
  9844. //
  9845. //
  9846. //
  9847. //
  9848. //
  9849. //
  9850. //
  9851. //
  9852. //
  9853. //
  9854. //
  9855. //
  9856. //
  9857. //
  9858. /* harmony default export */ __webpack_exports__["default"] = ({
  9859. mounted: function mounted() {
  9860. console.log('Component mounted.');
  9861. }
  9862. });
  9863. /***/ }),
  9864. /* 31 */
  9865. /***/ (function(module, exports, __webpack_require__) {
  9866. window._ = __webpack_require__(33);
  9867. /**
  9868. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  9869. * for JavaScript based Bootstrap features such as modals and tabs. This
  9870. * code may be modified to fit the specific needs of your application.
  9871. */
  9872. window.$ = window.jQuery = __webpack_require__(8);
  9873. __webpack_require__(32);
  9874. /**
  9875. * Vue is a modern JavaScript library for building interactive web interfaces
  9876. * using reactive data binding and reusable components. Vue's API is clean
  9877. * and simple, leaving you to focus on building your next great project.
  9878. */
  9879. window.Vue = __webpack_require__(37);
  9880. /**
  9881. * We'll load the axios HTTP library which allows us to easily issue requests
  9882. * to our Laravel back-end. This library automatically handles sending the
  9883. * CSRF token as a header based on the value of the "XSRF" token cookie.
  9884. */
  9885. window.axios = __webpack_require__(12);
  9886. window.axios.defaults.headers.common = {
  9887. 'X-CSRF-TOKEN': window.Laravel.csrfToken,
  9888. 'X-Requested-With': 'XMLHttpRequest'
  9889. };
  9890. /**
  9891. * Echo exposes an expressive API for subscribing to channels and listening
  9892. * for events that are broadcast by Laravel. Echo and event broadcasting
  9893. * allows your team to easily build robust real-time web applications.
  9894. */
  9895. // import Echo from 'laravel-echo'
  9896. // window.Pusher = require('pusher-js');
  9897. // window.Echo = new Echo({
  9898. // broadcaster: 'pusher',
  9899. // key: 'your-pusher-key'
  9900. // });
  9901. /***/ }),
  9902. /* 32 */
  9903. /***/ (function(module, exports, __webpack_require__) {
  9904. /* WEBPACK VAR INJECTION */(function(jQuery) {/*!
  9905. * Bootstrap v3.3.7 (http://getbootstrap.com)
  9906. * Copyright 2011-2016 Twitter, Inc.
  9907. * Licensed under the MIT license
  9908. */
  9909. if (typeof jQuery === 'undefined') {
  9910. throw new Error('Bootstrap\'s JavaScript requires jQuery')
  9911. }
  9912. +function ($) {
  9913. 'use strict';
  9914. var version = $.fn.jquery.split(' ')[0].split('.')
  9915. if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) {
  9916. throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4')
  9917. }
  9918. }(jQuery);
  9919. /* ========================================================================
  9920. * Bootstrap: transition.js v3.3.7
  9921. * http://getbootstrap.com/javascript/#transitions
  9922. * ========================================================================
  9923. * Copyright 2011-2016 Twitter, Inc.
  9924. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  9925. * ======================================================================== */
  9926. +function ($) {
  9927. 'use strict';
  9928. // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
  9929. // ============================================================
  9930. function transitionEnd() {
  9931. var el = document.createElement('bootstrap')
  9932. var transEndEventNames = {
  9933. WebkitTransition : 'webkitTransitionEnd',
  9934. MozTransition : 'transitionend',
  9935. OTransition : 'oTransitionEnd otransitionend',
  9936. transition : 'transitionend'
  9937. }
  9938. for (var name in transEndEventNames) {
  9939. if (el.style[name] !== undefined) {
  9940. return { end: transEndEventNames[name] }
  9941. }
  9942. }
  9943. return false // explicit for ie8 ( ._.)
  9944. }
  9945. // http://blog.alexmaccaw.com/css-transitions
  9946. $.fn.emulateTransitionEnd = function (duration) {
  9947. var called = false
  9948. var $el = this
  9949. $(this).one('bsTransitionEnd', function () { called = true })
  9950. var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
  9951. setTimeout(callback, duration)
  9952. return this
  9953. }
  9954. $(function () {
  9955. $.support.transition = transitionEnd()
  9956. if (!$.support.transition) return
  9957. $.event.special.bsTransitionEnd = {
  9958. bindType: $.support.transition.end,
  9959. delegateType: $.support.transition.end,
  9960. handle: function (e) {
  9961. if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
  9962. }
  9963. }
  9964. })
  9965. }(jQuery);
  9966. /* ========================================================================
  9967. * Bootstrap: alert.js v3.3.7
  9968. * http://getbootstrap.com/javascript/#alerts
  9969. * ========================================================================
  9970. * Copyright 2011-2016 Twitter, Inc.
  9971. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  9972. * ======================================================================== */
  9973. +function ($) {
  9974. 'use strict';
  9975. // ALERT CLASS DEFINITION
  9976. // ======================
  9977. var dismiss = '[data-dismiss="alert"]'
  9978. var Alert = function (el) {
  9979. $(el).on('click', dismiss, this.close)
  9980. }
  9981. Alert.VERSION = '3.3.7'
  9982. Alert.TRANSITION_DURATION = 150
  9983. Alert.prototype.close = function (e) {
  9984. var $this = $(this)
  9985. var selector = $this.attr('data-target')
  9986. if (!selector) {
  9987. selector = $this.attr('href')
  9988. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  9989. }
  9990. var $parent = $(selector === '#' ? [] : selector)
  9991. if (e) e.preventDefault()
  9992. if (!$parent.length) {
  9993. $parent = $this.closest('.alert')
  9994. }
  9995. $parent.trigger(e = $.Event('close.bs.alert'))
  9996. if (e.isDefaultPrevented()) return
  9997. $parent.removeClass('in')
  9998. function removeElement() {
  9999. // detach from parent, fire event then clean up data
  10000. $parent.detach().trigger('closed.bs.alert').remove()
  10001. }
  10002. $.support.transition && $parent.hasClass('fade') ?
  10003. $parent
  10004. .one('bsTransitionEnd', removeElement)
  10005. .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
  10006. removeElement()
  10007. }
  10008. // ALERT PLUGIN DEFINITION
  10009. // =======================
  10010. function Plugin(option) {
  10011. return this.each(function () {
  10012. var $this = $(this)
  10013. var data = $this.data('bs.alert')
  10014. if (!data) $this.data('bs.alert', (data = new Alert(this)))
  10015. if (typeof option == 'string') data[option].call($this)
  10016. })
  10017. }
  10018. var old = $.fn.alert
  10019. $.fn.alert = Plugin
  10020. $.fn.alert.Constructor = Alert
  10021. // ALERT NO CONFLICT
  10022. // =================
  10023. $.fn.alert.noConflict = function () {
  10024. $.fn.alert = old
  10025. return this
  10026. }
  10027. // ALERT DATA-API
  10028. // ==============
  10029. $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
  10030. }(jQuery);
  10031. /* ========================================================================
  10032. * Bootstrap: button.js v3.3.7
  10033. * http://getbootstrap.com/javascript/#buttons
  10034. * ========================================================================
  10035. * Copyright 2011-2016 Twitter, Inc.
  10036. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  10037. * ======================================================================== */
  10038. +function ($) {
  10039. 'use strict';
  10040. // BUTTON PUBLIC CLASS DEFINITION
  10041. // ==============================
  10042. var Button = function (element, options) {
  10043. this.$element = $(element)
  10044. this.options = $.extend({}, Button.DEFAULTS, options)
  10045. this.isLoading = false
  10046. }
  10047. Button.VERSION = '3.3.7'
  10048. Button.DEFAULTS = {
  10049. loadingText: 'loading...'
  10050. }
  10051. Button.prototype.setState = function (state) {
  10052. var d = 'disabled'
  10053. var $el = this.$element
  10054. var val = $el.is('input') ? 'val' : 'html'
  10055. var data = $el.data()
  10056. state += 'Text'
  10057. if (data.resetText == null) $el.data('resetText', $el[val]())
  10058. // push to event loop to allow forms to submit
  10059. setTimeout($.proxy(function () {
  10060. $el[val](data[state] == null ? this.options[state] : data[state])
  10061. if (state == 'loadingText') {
  10062. this.isLoading = true
  10063. $el.addClass(d).attr(d, d).prop(d, true)
  10064. } else if (this.isLoading) {
  10065. this.isLoading = false
  10066. $el.removeClass(d).removeAttr(d).prop(d, false)
  10067. }
  10068. }, this), 0)
  10069. }
  10070. Button.prototype.toggle = function () {
  10071. var changed = true
  10072. var $parent = this.$element.closest('[data-toggle="buttons"]')
  10073. if ($parent.length) {
  10074. var $input = this.$element.find('input')
  10075. if ($input.prop('type') == 'radio') {
  10076. if ($input.prop('checked')) changed = false
  10077. $parent.find('.active').removeClass('active')
  10078. this.$element.addClass('active')
  10079. } else if ($input.prop('type') == 'checkbox') {
  10080. if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
  10081. this.$element.toggleClass('active')
  10082. }
  10083. $input.prop('checked', this.$element.hasClass('active'))
  10084. if (changed) $input.trigger('change')
  10085. } else {
  10086. this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
  10087. this.$element.toggleClass('active')
  10088. }
  10089. }
  10090. // BUTTON PLUGIN DEFINITION
  10091. // ========================
  10092. function Plugin(option) {
  10093. return this.each(function () {
  10094. var $this = $(this)
  10095. var data = $this.data('bs.button')
  10096. var options = typeof option == 'object' && option
  10097. if (!data) $this.data('bs.button', (data = new Button(this, options)))
  10098. if (option == 'toggle') data.toggle()
  10099. else if (option) data.setState(option)
  10100. })
  10101. }
  10102. var old = $.fn.button
  10103. $.fn.button = Plugin
  10104. $.fn.button.Constructor = Button
  10105. // BUTTON NO CONFLICT
  10106. // ==================
  10107. $.fn.button.noConflict = function () {
  10108. $.fn.button = old
  10109. return this
  10110. }
  10111. // BUTTON DATA-API
  10112. // ===============
  10113. $(document)
  10114. .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  10115. var $btn = $(e.target).closest('.btn')
  10116. Plugin.call($btn, 'toggle')
  10117. if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
  10118. // Prevent double click on radios, and the double selections (so cancellation) on checkboxes
  10119. e.preventDefault()
  10120. // The target component still receive the focus
  10121. if ($btn.is('input,button')) $btn.trigger('focus')
  10122. else $btn.find('input:visible,button:visible').first().trigger('focus')
  10123. }
  10124. })
  10125. .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  10126. $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
  10127. })
  10128. }(jQuery);
  10129. /* ========================================================================
  10130. * Bootstrap: carousel.js v3.3.7
  10131. * http://getbootstrap.com/javascript/#carousel
  10132. * ========================================================================
  10133. * Copyright 2011-2016 Twitter, Inc.
  10134. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  10135. * ======================================================================== */
  10136. +function ($) {
  10137. 'use strict';
  10138. // CAROUSEL CLASS DEFINITION
  10139. // =========================
  10140. var Carousel = function (element, options) {
  10141. this.$element = $(element)
  10142. this.$indicators = this.$element.find('.carousel-indicators')
  10143. this.options = options
  10144. this.paused = null
  10145. this.sliding = null
  10146. this.interval = null
  10147. this.$active = null
  10148. this.$items = null
  10149. this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
  10150. this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
  10151. .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
  10152. .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
  10153. }
  10154. Carousel.VERSION = '3.3.7'
  10155. Carousel.TRANSITION_DURATION = 600
  10156. Carousel.DEFAULTS = {
  10157. interval: 5000,
  10158. pause: 'hover',
  10159. wrap: true,
  10160. keyboard: true
  10161. }
  10162. Carousel.prototype.keydown = function (e) {
  10163. if (/input|textarea/i.test(e.target.tagName)) return
  10164. switch (e.which) {
  10165. case 37: this.prev(); break
  10166. case 39: this.next(); break
  10167. default: return
  10168. }
  10169. e.preventDefault()
  10170. }
  10171. Carousel.prototype.cycle = function (e) {
  10172. e || (this.paused = false)
  10173. this.interval && clearInterval(this.interval)
  10174. this.options.interval
  10175. && !this.paused
  10176. && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
  10177. return this
  10178. }
  10179. Carousel.prototype.getItemIndex = function (item) {
  10180. this.$items = item.parent().children('.item')
  10181. return this.$items.index(item || this.$active)
  10182. }
  10183. Carousel.prototype.getItemForDirection = function (direction, active) {
  10184. var activeIndex = this.getItemIndex(active)
  10185. var willWrap = (direction == 'prev' && activeIndex === 0)
  10186. || (direction == 'next' && activeIndex == (this.$items.length - 1))
  10187. if (willWrap && !this.options.wrap) return active
  10188. var delta = direction == 'prev' ? -1 : 1
  10189. var itemIndex = (activeIndex + delta) % this.$items.length
  10190. return this.$items.eq(itemIndex)
  10191. }
  10192. Carousel.prototype.to = function (pos) {
  10193. var that = this
  10194. var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
  10195. if (pos > (this.$items.length - 1) || pos < 0) return
  10196. if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
  10197. if (activeIndex == pos) return this.pause().cycle()
  10198. return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
  10199. }
  10200. Carousel.prototype.pause = function (e) {
  10201. e || (this.paused = true)
  10202. if (this.$element.find('.next, .prev').length && $.support.transition) {
  10203. this.$element.trigger($.support.transition.end)
  10204. this.cycle(true)
  10205. }
  10206. this.interval = clearInterval(this.interval)
  10207. return this
  10208. }
  10209. Carousel.prototype.next = function () {
  10210. if (this.sliding) return
  10211. return this.slide('next')
  10212. }
  10213. Carousel.prototype.prev = function () {
  10214. if (this.sliding) return
  10215. return this.slide('prev')
  10216. }
  10217. Carousel.prototype.slide = function (type, next) {
  10218. var $active = this.$element.find('.item.active')
  10219. var $next = next || this.getItemForDirection(type, $active)
  10220. var isCycling = this.interval
  10221. var direction = type == 'next' ? 'left' : 'right'
  10222. var that = this
  10223. if ($next.hasClass('active')) return (this.sliding = false)
  10224. var relatedTarget = $next[0]
  10225. var slideEvent = $.Event('slide.bs.carousel', {
  10226. relatedTarget: relatedTarget,
  10227. direction: direction
  10228. })
  10229. this.$element.trigger(slideEvent)
  10230. if (slideEvent.isDefaultPrevented()) return
  10231. this.sliding = true
  10232. isCycling && this.pause()
  10233. if (this.$indicators.length) {
  10234. this.$indicators.find('.active').removeClass('active')
  10235. var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
  10236. $nextIndicator && $nextIndicator.addClass('active')
  10237. }
  10238. var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
  10239. if ($.support.transition && this.$element.hasClass('slide')) {
  10240. $next.addClass(type)
  10241. $next[0].offsetWidth // force reflow
  10242. $active.addClass(direction)
  10243. $next.addClass(direction)
  10244. $active
  10245. .one('bsTransitionEnd', function () {
  10246. $next.removeClass([type, direction].join(' ')).addClass('active')
  10247. $active.removeClass(['active', direction].join(' '))
  10248. that.sliding = false
  10249. setTimeout(function () {
  10250. that.$element.trigger(slidEvent)
  10251. }, 0)
  10252. })
  10253. .emulateTransitionEnd(Carousel.TRANSITION_DURATION)
  10254. } else {
  10255. $active.removeClass('active')
  10256. $next.addClass('active')
  10257. this.sliding = false
  10258. this.$element.trigger(slidEvent)
  10259. }
  10260. isCycling && this.cycle()
  10261. return this
  10262. }
  10263. // CAROUSEL PLUGIN DEFINITION
  10264. // ==========================
  10265. function Plugin(option) {
  10266. return this.each(function () {
  10267. var $this = $(this)
  10268. var data = $this.data('bs.carousel')
  10269. var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
  10270. var action = typeof option == 'string' ? option : options.slide
  10271. if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
  10272. if (typeof option == 'number') data.to(option)
  10273. else if (action) data[action]()
  10274. else if (options.interval) data.pause().cycle()
  10275. })
  10276. }
  10277. var old = $.fn.carousel
  10278. $.fn.carousel = Plugin
  10279. $.fn.carousel.Constructor = Carousel
  10280. // CAROUSEL NO CONFLICT
  10281. // ====================
  10282. $.fn.carousel.noConflict = function () {
  10283. $.fn.carousel = old
  10284. return this
  10285. }
  10286. // CAROUSEL DATA-API
  10287. // =================
  10288. var clickHandler = function (e) {
  10289. var href
  10290. var $this = $(this)
  10291. var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
  10292. if (!$target.hasClass('carousel')) return
  10293. var options = $.extend({}, $target.data(), $this.data())
  10294. var slideIndex = $this.attr('data-slide-to')
  10295. if (slideIndex) options.interval = false
  10296. Plugin.call($target, options)
  10297. if (slideIndex) {
  10298. $target.data('bs.carousel').to(slideIndex)
  10299. }
  10300. e.preventDefault()
  10301. }
  10302. $(document)
  10303. .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
  10304. .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
  10305. $(window).on('load', function () {
  10306. $('[data-ride="carousel"]').each(function () {
  10307. var $carousel = $(this)
  10308. Plugin.call($carousel, $carousel.data())
  10309. })
  10310. })
  10311. }(jQuery);
  10312. /* ========================================================================
  10313. * Bootstrap: collapse.js v3.3.7
  10314. * http://getbootstrap.com/javascript/#collapse
  10315. * ========================================================================
  10316. * Copyright 2011-2016 Twitter, Inc.
  10317. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  10318. * ======================================================================== */
  10319. /* jshint latedef: false */
  10320. +function ($) {
  10321. 'use strict';
  10322. // COLLAPSE PUBLIC CLASS DEFINITION
  10323. // ================================
  10324. var Collapse = function (element, options) {
  10325. this.$element = $(element)
  10326. this.options = $.extend({}, Collapse.DEFAULTS, options)
  10327. this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
  10328. '[data-toggle="collapse"][data-target="#' + element.id + '"]')
  10329. this.transitioning = null
  10330. if (this.options.parent) {
  10331. this.$parent = this.getParent()
  10332. } else {
  10333. this.addAriaAndCollapsedClass(this.$element, this.$trigger)
  10334. }
  10335. if (this.options.toggle) this.toggle()
  10336. }
  10337. Collapse.VERSION = '3.3.7'
  10338. Collapse.TRANSITION_DURATION = 350
  10339. Collapse.DEFAULTS = {
  10340. toggle: true
  10341. }
  10342. Collapse.prototype.dimension = function () {
  10343. var hasWidth = this.$element.hasClass('width')
  10344. return hasWidth ? 'width' : 'height'
  10345. }
  10346. Collapse.prototype.show = function () {
  10347. if (this.transitioning || this.$element.hasClass('in')) return
  10348. var activesData
  10349. var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
  10350. if (actives && actives.length) {
  10351. activesData = actives.data('bs.collapse')
  10352. if (activesData && activesData.transitioning) return
  10353. }
  10354. var startEvent = $.Event('show.bs.collapse')
  10355. this.$element.trigger(startEvent)
  10356. if (startEvent.isDefaultPrevented()) return
  10357. if (actives && actives.length) {
  10358. Plugin.call(actives, 'hide')
  10359. activesData || actives.data('bs.collapse', null)
  10360. }
  10361. var dimension = this.dimension()
  10362. this.$element
  10363. .removeClass('collapse')
  10364. .addClass('collapsing')[dimension](0)
  10365. .attr('aria-expanded', true)
  10366. this.$trigger
  10367. .removeClass('collapsed')
  10368. .attr('aria-expanded', true)
  10369. this.transitioning = 1
  10370. var complete = function () {
  10371. this.$element
  10372. .removeClass('collapsing')
  10373. .addClass('collapse in')[dimension]('')
  10374. this.transitioning = 0
  10375. this.$element
  10376. .trigger('shown.bs.collapse')
  10377. }
  10378. if (!$.support.transition) return complete.call(this)
  10379. var scrollSize = $.camelCase(['scroll', dimension].join('-'))
  10380. this.$element
  10381. .one('bsTransitionEnd', $.proxy(complete, this))
  10382. .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
  10383. }
  10384. Collapse.prototype.hide = function () {
  10385. if (this.transitioning || !this.$element.hasClass('in')) return
  10386. var startEvent = $.Event('hide.bs.collapse')
  10387. this.$element.trigger(startEvent)
  10388. if (startEvent.isDefaultPrevented()) return
  10389. var dimension = this.dimension()
  10390. this.$element[dimension](this.$element[dimension]())[0].offsetHeight
  10391. this.$element
  10392. .addClass('collapsing')
  10393. .removeClass('collapse in')
  10394. .attr('aria-expanded', false)
  10395. this.$trigger
  10396. .addClass('collapsed')
  10397. .attr('aria-expanded', false)
  10398. this.transitioning = 1
  10399. var complete = function () {
  10400. this.transitioning = 0
  10401. this.$element
  10402. .removeClass('collapsing')
  10403. .addClass('collapse')
  10404. .trigger('hidden.bs.collapse')
  10405. }
  10406. if (!$.support.transition) return complete.call(this)
  10407. this.$element
  10408. [dimension](0)
  10409. .one('bsTransitionEnd', $.proxy(complete, this))
  10410. .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
  10411. }
  10412. Collapse.prototype.toggle = function () {
  10413. this[this.$element.hasClass('in') ? 'hide' : 'show']()
  10414. }
  10415. Collapse.prototype.getParent = function () {
  10416. return $(this.options.parent)
  10417. .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
  10418. .each($.proxy(function (i, element) {
  10419. var $element = $(element)
  10420. this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
  10421. }, this))
  10422. .end()
  10423. }
  10424. Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
  10425. var isOpen = $element.hasClass('in')
  10426. $element.attr('aria-expanded', isOpen)
  10427. $trigger
  10428. .toggleClass('collapsed', !isOpen)
  10429. .attr('aria-expanded', isOpen)
  10430. }
  10431. function getTargetFromTrigger($trigger) {
  10432. var href
  10433. var target = $trigger.attr('data-target')
  10434. || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
  10435. return $(target)
  10436. }
  10437. // COLLAPSE PLUGIN DEFINITION
  10438. // ==========================
  10439. function Plugin(option) {
  10440. return this.each(function () {
  10441. var $this = $(this)
  10442. var data = $this.data('bs.collapse')
  10443. var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
  10444. if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
  10445. if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
  10446. if (typeof option == 'string') data[option]()
  10447. })
  10448. }
  10449. var old = $.fn.collapse
  10450. $.fn.collapse = Plugin
  10451. $.fn.collapse.Constructor = Collapse
  10452. // COLLAPSE NO CONFLICT
  10453. // ====================
  10454. $.fn.collapse.noConflict = function () {
  10455. $.fn.collapse = old
  10456. return this
  10457. }
  10458. // COLLAPSE DATA-API
  10459. // =================
  10460. $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
  10461. var $this = $(this)
  10462. if (!$this.attr('data-target')) e.preventDefault()
  10463. var $target = getTargetFromTrigger($this)
  10464. var data = $target.data('bs.collapse')
  10465. var option = data ? 'toggle' : $this.data()
  10466. Plugin.call($target, option)
  10467. })
  10468. }(jQuery);
  10469. /* ========================================================================
  10470. * Bootstrap: dropdown.js v3.3.7
  10471. * http://getbootstrap.com/javascript/#dropdowns
  10472. * ========================================================================
  10473. * Copyright 2011-2016 Twitter, Inc.
  10474. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  10475. * ======================================================================== */
  10476. +function ($) {
  10477. 'use strict';
  10478. // DROPDOWN CLASS DEFINITION
  10479. // =========================
  10480. var backdrop = '.dropdown-backdrop'
  10481. var toggle = '[data-toggle="dropdown"]'
  10482. var Dropdown = function (element) {
  10483. $(element).on('click.bs.dropdown', this.toggle)
  10484. }
  10485. Dropdown.VERSION = '3.3.7'
  10486. function getParent($this) {
  10487. var selector = $this.attr('data-target')
  10488. if (!selector) {
  10489. selector = $this.attr('href')
  10490. selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  10491. }
  10492. var $parent = selector && $(selector)
  10493. return $parent && $parent.length ? $parent : $this.parent()
  10494. }
  10495. function clearMenus(e) {
  10496. if (e && e.which === 3) return
  10497. $(backdrop).remove()
  10498. $(toggle).each(function () {
  10499. var $this = $(this)
  10500. var $parent = getParent($this)
  10501. var relatedTarget = { relatedTarget: this }
  10502. if (!$parent.hasClass('open')) return
  10503. if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
  10504. $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
  10505. if (e.isDefaultPrevented()) return
  10506. $this.attr('aria-expanded', 'false')
  10507. $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
  10508. })
  10509. }
  10510. Dropdown.prototype.toggle = function (e) {
  10511. var $this = $(this)
  10512. if ($this.is('.disabled, :disabled')) return
  10513. var $parent = getParent($this)
  10514. var isActive = $parent.hasClass('open')
  10515. clearMenus()
  10516. if (!isActive) {
  10517. if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
  10518. // if mobile we use a backdrop because click events don't delegate
  10519. $(document.createElement('div'))
  10520. .addClass('dropdown-backdrop')
  10521. .insertAfter($(this))
  10522. .on('click', clearMenus)
  10523. }
  10524. var relatedTarget = { relatedTarget: this }
  10525. $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
  10526. if (e.isDefaultPrevented()) return
  10527. $this
  10528. .trigger('focus')
  10529. .attr('aria-expanded', 'true')
  10530. $parent
  10531. .toggleClass('open')
  10532. .trigger($.Event('shown.bs.dropdown', relatedTarget))
  10533. }
  10534. return false
  10535. }
  10536. Dropdown.prototype.keydown = function (e) {
  10537. if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
  10538. var $this = $(this)
  10539. e.preventDefault()
  10540. e.stopPropagation()
  10541. if ($this.is('.disabled, :disabled')) return
  10542. var $parent = getParent($this)
  10543. var isActive = $parent.hasClass('open')
  10544. if (!isActive && e.which != 27 || isActive && e.which == 27) {
  10545. if (e.which == 27) $parent.find(toggle).trigger('focus')
  10546. return $this.trigger('click')
  10547. }
  10548. var desc = ' li:not(.disabled):visible a'
  10549. var $items = $parent.find('.dropdown-menu' + desc)
  10550. if (!$items.length) return
  10551. var index = $items.index(e.target)
  10552. if (e.which == 38 && index > 0) index-- // up
  10553. if (e.which == 40 && index < $items.length - 1) index++ // down
  10554. if (!~index) index = 0
  10555. $items.eq(index).trigger('focus')
  10556. }
  10557. // DROPDOWN PLUGIN DEFINITION
  10558. // ==========================
  10559. function Plugin(option) {
  10560. return this.each(function () {
  10561. var $this = $(this)
  10562. var data = $this.data('bs.dropdown')
  10563. if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
  10564. if (typeof option == 'string') data[option].call($this)
  10565. })
  10566. }
  10567. var old = $.fn.dropdown
  10568. $.fn.dropdown = Plugin
  10569. $.fn.dropdown.Constructor = Dropdown
  10570. // DROPDOWN NO CONFLICT
  10571. // ====================
  10572. $.fn.dropdown.noConflict = function () {
  10573. $.fn.dropdown = old
  10574. return this
  10575. }
  10576. // APPLY TO STANDARD DROPDOWN ELEMENTS
  10577. // ===================================
  10578. $(document)
  10579. .on('click.bs.dropdown.data-api', clearMenus)
  10580. .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
  10581. .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
  10582. .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
  10583. .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
  10584. }(jQuery);
  10585. /* ========================================================================
  10586. * Bootstrap: modal.js v3.3.7
  10587. * http://getbootstrap.com/javascript/#modals
  10588. * ========================================================================
  10589. * Copyright 2011-2016 Twitter, Inc.
  10590. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  10591. * ======================================================================== */
  10592. +function ($) {
  10593. 'use strict';
  10594. // MODAL CLASS DEFINITION
  10595. // ======================
  10596. var Modal = function (element, options) {
  10597. this.options = options
  10598. this.$body = $(document.body)
  10599. this.$element = $(element)
  10600. this.$dialog = this.$element.find('.modal-dialog')
  10601. this.$backdrop = null
  10602. this.isShown = null
  10603. this.originalBodyPad = null
  10604. this.scrollbarWidth = 0
  10605. this.ignoreBackdropClick = false
  10606. if (this.options.remote) {
  10607. this.$element
  10608. .find('.modal-content')
  10609. .load(this.options.remote, $.proxy(function () {
  10610. this.$element.trigger('loaded.bs.modal')
  10611. }, this))
  10612. }
  10613. }
  10614. Modal.VERSION = '3.3.7'
  10615. Modal.TRANSITION_DURATION = 300
  10616. Modal.BACKDROP_TRANSITION_DURATION = 150
  10617. Modal.DEFAULTS = {
  10618. backdrop: true,
  10619. keyboard: true,
  10620. show: true
  10621. }
  10622. Modal.prototype.toggle = function (_relatedTarget) {
  10623. return this.isShown ? this.hide() : this.show(_relatedTarget)
  10624. }
  10625. Modal.prototype.show = function (_relatedTarget) {
  10626. var that = this
  10627. var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
  10628. this.$element.trigger(e)
  10629. if (this.isShown || e.isDefaultPrevented()) return
  10630. this.isShown = true
  10631. this.checkScrollbar()
  10632. this.setScrollbar()
  10633. this.$body.addClass('modal-open')
  10634. this.escape()
  10635. this.resize()
  10636. this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
  10637. this.$dialog.on('mousedown.dismiss.bs.modal', function () {
  10638. that.$element.one('mouseup.dismiss.bs.modal', function (e) {
  10639. if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
  10640. })
  10641. })
  10642. this.backdrop(function () {
  10643. var transition = $.support.transition && that.$element.hasClass('fade')
  10644. if (!that.$element.parent().length) {
  10645. that.$element.appendTo(that.$body) // don't move modals dom position
  10646. }
  10647. that.$element
  10648. .show()
  10649. .scrollTop(0)
  10650. that.adjustDialog()
  10651. if (transition) {
  10652. that.$element[0].offsetWidth // force reflow
  10653. }
  10654. that.$element.addClass('in')
  10655. that.enforceFocus()
  10656. var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
  10657. transition ?
  10658. that.$dialog // wait for modal to slide in
  10659. .one('bsTransitionEnd', function () {
  10660. that.$element.trigger('focus').trigger(e)
  10661. })
  10662. .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
  10663. that.$element.trigger('focus').trigger(e)
  10664. })
  10665. }
  10666. Modal.prototype.hide = function (e) {
  10667. if (e) e.preventDefault()
  10668. e = $.Event('hide.bs.modal')
  10669. this.$element.trigger(e)
  10670. if (!this.isShown || e.isDefaultPrevented()) return
  10671. this.isShown = false
  10672. this.escape()
  10673. this.resize()
  10674. $(document).off('focusin.bs.modal')
  10675. this.$element
  10676. .removeClass('in')
  10677. .off('click.dismiss.bs.modal')
  10678. .off('mouseup.dismiss.bs.modal')
  10679. this.$dialog.off('mousedown.dismiss.bs.modal')
  10680. $.support.transition && this.$element.hasClass('fade') ?
  10681. this.$element
  10682. .one('bsTransitionEnd', $.proxy(this.hideModal, this))
  10683. .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
  10684. this.hideModal()
  10685. }
  10686. Modal.prototype.enforceFocus = function () {
  10687. $(document)
  10688. .off('focusin.bs.modal') // guard against infinite focus loop
  10689. .on('focusin.bs.modal', $.proxy(function (e) {
  10690. if (document !== e.target &&
  10691. this.$element[0] !== e.target &&
  10692. !this.$element.has(e.target).length) {
  10693. this.$element.trigger('focus')
  10694. }
  10695. }, this))
  10696. }
  10697. Modal.prototype.escape = function () {
  10698. if (this.isShown && this.options.keyboard) {
  10699. this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
  10700. e.which == 27 && this.hide()
  10701. }, this))
  10702. } else if (!this.isShown) {
  10703. this.$element.off('keydown.dismiss.bs.modal')
  10704. }
  10705. }
  10706. Modal.prototype.resize = function () {
  10707. if (this.isShown) {
  10708. $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
  10709. } else {
  10710. $(window).off('resize.bs.modal')
  10711. }
  10712. }
  10713. Modal.prototype.hideModal = function () {
  10714. var that = this
  10715. this.$element.hide()
  10716. this.backdrop(function () {
  10717. that.$body.removeClass('modal-open')
  10718. that.resetAdjustments()
  10719. that.resetScrollbar()
  10720. that.$element.trigger('hidden.bs.modal')
  10721. })
  10722. }
  10723. Modal.prototype.removeBackdrop = function () {
  10724. this.$backdrop && this.$backdrop.remove()
  10725. this.$backdrop = null
  10726. }
  10727. Modal.prototype.backdrop = function (callback) {
  10728. var that = this
  10729. var animate = this.$element.hasClass('fade') ? 'fade' : ''
  10730. if (this.isShown && this.options.backdrop) {
  10731. var doAnimate = $.support.transition && animate
  10732. this.$backdrop = $(document.createElement('div'))
  10733. .addClass('modal-backdrop ' + animate)
  10734. .appendTo(this.$body)
  10735. this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
  10736. if (this.ignoreBackdropClick) {
  10737. this.ignoreBackdropClick = false
  10738. return
  10739. }
  10740. if (e.target !== e.currentTarget) return
  10741. this.options.backdrop == 'static'
  10742. ? this.$element[0].focus()
  10743. : this.hide()
  10744. }, this))
  10745. if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
  10746. this.$backdrop.addClass('in')
  10747. if (!callback) return
  10748. doAnimate ?
  10749. this.$backdrop
  10750. .one('bsTransitionEnd', callback)
  10751. .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
  10752. callback()
  10753. } else if (!this.isShown && this.$backdrop) {
  10754. this.$backdrop.removeClass('in')
  10755. var callbackRemove = function () {
  10756. that.removeBackdrop()
  10757. callback && callback()
  10758. }
  10759. $.support.transition && this.$element.hasClass('fade') ?
  10760. this.$backdrop
  10761. .one('bsTransitionEnd', callbackRemove)
  10762. .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
  10763. callbackRemove()
  10764. } else if (callback) {
  10765. callback()
  10766. }
  10767. }
  10768. // these following methods are used to handle overflowing modals
  10769. Modal.prototype.handleUpdate = function () {
  10770. this.adjustDialog()
  10771. }
  10772. Modal.prototype.adjustDialog = function () {
  10773. var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
  10774. this.$element.css({
  10775. paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
  10776. paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
  10777. })
  10778. }
  10779. Modal.prototype.resetAdjustments = function () {
  10780. this.$element.css({
  10781. paddingLeft: '',
  10782. paddingRight: ''
  10783. })
  10784. }
  10785. Modal.prototype.checkScrollbar = function () {
  10786. var fullWindowWidth = window.innerWidth
  10787. if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
  10788. var documentElementRect = document.documentElement.getBoundingClientRect()
  10789. fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
  10790. }
  10791. this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
  10792. this.scrollbarWidth = this.measureScrollbar()
  10793. }
  10794. Modal.prototype.setScrollbar = function () {
  10795. var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
  10796. this.originalBodyPad = document.body.style.paddingRight || ''
  10797. if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
  10798. }
  10799. Modal.prototype.resetScrollbar = function () {
  10800. this.$body.css('padding-right', this.originalBodyPad)
  10801. }
  10802. Modal.prototype.measureScrollbar = function () { // thx walsh
  10803. var scrollDiv = document.createElement('div')
  10804. scrollDiv.className = 'modal-scrollbar-measure'
  10805. this.$body.append(scrollDiv)
  10806. var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
  10807. this.$body[0].removeChild(scrollDiv)
  10808. return scrollbarWidth
  10809. }
  10810. // MODAL PLUGIN DEFINITION
  10811. // =======================
  10812. function Plugin(option, _relatedTarget) {
  10813. return this.each(function () {
  10814. var $this = $(this)
  10815. var data = $this.data('bs.modal')
  10816. var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
  10817. if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
  10818. if (typeof option == 'string') data[option](_relatedTarget)
  10819. else if (options.show) data.show(_relatedTarget)
  10820. })
  10821. }
  10822. var old = $.fn.modal
  10823. $.fn.modal = Plugin
  10824. $.fn.modal.Constructor = Modal
  10825. // MODAL NO CONFLICT
  10826. // =================
  10827. $.fn.modal.noConflict = function () {
  10828. $.fn.modal = old
  10829. return this
  10830. }
  10831. // MODAL DATA-API
  10832. // ==============
  10833. $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
  10834. var $this = $(this)
  10835. var href = $this.attr('href')
  10836. var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
  10837. var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
  10838. if ($this.is('a')) e.preventDefault()
  10839. $target.one('show.bs.modal', function (showEvent) {
  10840. if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
  10841. $target.one('hidden.bs.modal', function () {
  10842. $this.is(':visible') && $this.trigger('focus')
  10843. })
  10844. })
  10845. Plugin.call($target, option, this)
  10846. })
  10847. }(jQuery);
  10848. /* ========================================================================
  10849. * Bootstrap: tooltip.js v3.3.7
  10850. * http://getbootstrap.com/javascript/#tooltip
  10851. * Inspired by the original jQuery.tipsy by Jason Frame
  10852. * ========================================================================
  10853. * Copyright 2011-2016 Twitter, Inc.
  10854. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  10855. * ======================================================================== */
  10856. +function ($) {
  10857. 'use strict';
  10858. // TOOLTIP PUBLIC CLASS DEFINITION
  10859. // ===============================
  10860. var Tooltip = function (element, options) {
  10861. this.type = null
  10862. this.options = null
  10863. this.enabled = null
  10864. this.timeout = null
  10865. this.hoverState = null
  10866. this.$element = null
  10867. this.inState = null
  10868. this.init('tooltip', element, options)
  10869. }
  10870. Tooltip.VERSION = '3.3.7'
  10871. Tooltip.TRANSITION_DURATION = 150
  10872. Tooltip.DEFAULTS = {
  10873. animation: true,
  10874. placement: 'top',
  10875. selector: false,
  10876. template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  10877. trigger: 'hover focus',
  10878. title: '',
  10879. delay: 0,
  10880. html: false,
  10881. container: false,
  10882. viewport: {
  10883. selector: 'body',
  10884. padding: 0
  10885. }
  10886. }
  10887. Tooltip.prototype.init = function (type, element, options) {
  10888. this.enabled = true
  10889. this.type = type
  10890. this.$element = $(element)
  10891. this.options = this.getOptions(options)
  10892. this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
  10893. this.inState = { click: false, hover: false, focus: false }
  10894. if (this.$element[0] instanceof document.constructor && !this.options.selector) {
  10895. throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
  10896. }
  10897. var triggers = this.options.trigger.split(' ')
  10898. for (var i = triggers.length; i--;) {
  10899. var trigger = triggers[i]
  10900. if (trigger == 'click') {
  10901. this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
  10902. } else if (trigger != 'manual') {
  10903. var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
  10904. var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
  10905. this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
  10906. this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
  10907. }
  10908. }
  10909. this.options.selector ?
  10910. (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
  10911. this.fixTitle()
  10912. }
  10913. Tooltip.prototype.getDefaults = function () {
  10914. return Tooltip.DEFAULTS
  10915. }
  10916. Tooltip.prototype.getOptions = function (options) {
  10917. options = $.extend({}, this.getDefaults(), this.$element.data(), options)
  10918. if (options.delay && typeof options.delay == 'number') {
  10919. options.delay = {
  10920. show: options.delay,
  10921. hide: options.delay
  10922. }
  10923. }
  10924. return options
  10925. }
  10926. Tooltip.prototype.getDelegateOptions = function () {
  10927. var options = {}
  10928. var defaults = this.getDefaults()
  10929. this._options && $.each(this._options, function (key, value) {
  10930. if (defaults[key] != value) options[key] = value
  10931. })
  10932. return options
  10933. }
  10934. Tooltip.prototype.enter = function (obj) {
  10935. var self = obj instanceof this.constructor ?
  10936. obj : $(obj.currentTarget).data('bs.' + this.type)
  10937. if (!self) {
  10938. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  10939. $(obj.currentTarget).data('bs.' + this.type, self)
  10940. }
  10941. if (obj instanceof $.Event) {
  10942. self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
  10943. }
  10944. if (self.tip().hasClass('in') || self.hoverState == 'in') {
  10945. self.hoverState = 'in'
  10946. return
  10947. }
  10948. clearTimeout(self.timeout)
  10949. self.hoverState = 'in'
  10950. if (!self.options.delay || !self.options.delay.show) return self.show()
  10951. self.timeout = setTimeout(function () {
  10952. if (self.hoverState == 'in') self.show()
  10953. }, self.options.delay.show)
  10954. }
  10955. Tooltip.prototype.isInStateTrue = function () {
  10956. for (var key in this.inState) {
  10957. if (this.inState[key]) return true
  10958. }
  10959. return false
  10960. }
  10961. Tooltip.prototype.leave = function (obj) {
  10962. var self = obj instanceof this.constructor ?
  10963. obj : $(obj.currentTarget).data('bs.' + this.type)
  10964. if (!self) {
  10965. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  10966. $(obj.currentTarget).data('bs.' + this.type, self)
  10967. }
  10968. if (obj instanceof $.Event) {
  10969. self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
  10970. }
  10971. if (self.isInStateTrue()) return
  10972. clearTimeout(self.timeout)
  10973. self.hoverState = 'out'
  10974. if (!self.options.delay || !self.options.delay.hide) return self.hide()
  10975. self.timeout = setTimeout(function () {
  10976. if (self.hoverState == 'out') self.hide()
  10977. }, self.options.delay.hide)
  10978. }
  10979. Tooltip.prototype.show = function () {
  10980. var e = $.Event('show.bs.' + this.type)
  10981. if (this.hasContent() && this.enabled) {
  10982. this.$element.trigger(e)
  10983. var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
  10984. if (e.isDefaultPrevented() || !inDom) return
  10985. var that = this
  10986. var $tip = this.tip()
  10987. var tipId = this.getUID(this.type)
  10988. this.setContent()
  10989. $tip.attr('id', tipId)
  10990. this.$element.attr('aria-describedby', tipId)
  10991. if (this.options.animation) $tip.addClass('fade')
  10992. var placement = typeof this.options.placement == 'function' ?
  10993. this.options.placement.call(this, $tip[0], this.$element[0]) :
  10994. this.options.placement
  10995. var autoToken = /\s?auto?\s?/i
  10996. var autoPlace = autoToken.test(placement)
  10997. if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
  10998. $tip
  10999. .detach()
  11000. .css({ top: 0, left: 0, display: 'block' })
  11001. .addClass(placement)
  11002. .data('bs.' + this.type, this)
  11003. this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
  11004. this.$element.trigger('inserted.bs.' + this.type)
  11005. var pos = this.getPosition()
  11006. var actualWidth = $tip[0].offsetWidth
  11007. var actualHeight = $tip[0].offsetHeight
  11008. if (autoPlace) {
  11009. var orgPlacement = placement
  11010. var viewportDim = this.getPosition(this.$viewport)
  11011. placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
  11012. placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
  11013. placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
  11014. placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
  11015. placement
  11016. $tip
  11017. .removeClass(orgPlacement)
  11018. .addClass(placement)
  11019. }
  11020. var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
  11021. this.applyPlacement(calculatedOffset, placement)
  11022. var complete = function () {
  11023. var prevHoverState = that.hoverState
  11024. that.$element.trigger('shown.bs.' + that.type)
  11025. that.hoverState = null
  11026. if (prevHoverState == 'out') that.leave(that)
  11027. }
  11028. $.support.transition && this.$tip.hasClass('fade') ?
  11029. $tip
  11030. .one('bsTransitionEnd', complete)
  11031. .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
  11032. complete()
  11033. }
  11034. }
  11035. Tooltip.prototype.applyPlacement = function (offset, placement) {
  11036. var $tip = this.tip()
  11037. var width = $tip[0].offsetWidth
  11038. var height = $tip[0].offsetHeight
  11039. // manually read margins because getBoundingClientRect includes difference
  11040. var marginTop = parseInt($tip.css('margin-top'), 10)
  11041. var marginLeft = parseInt($tip.css('margin-left'), 10)
  11042. // we must check for NaN for ie 8/9
  11043. if (isNaN(marginTop)) marginTop = 0
  11044. if (isNaN(marginLeft)) marginLeft = 0
  11045. offset.top += marginTop
  11046. offset.left += marginLeft
  11047. // $.fn.offset doesn't round pixel values
  11048. // so we use setOffset directly with our own function B-0
  11049. $.offset.setOffset($tip[0], $.extend({
  11050. using: function (props) {
  11051. $tip.css({
  11052. top: Math.round(props.top),
  11053. left: Math.round(props.left)
  11054. })
  11055. }
  11056. }, offset), 0)
  11057. $tip.addClass('in')
  11058. // check to see if placing tip in new offset caused the tip to resize itself
  11059. var actualWidth = $tip[0].offsetWidth
  11060. var actualHeight = $tip[0].offsetHeight
  11061. if (placement == 'top' && actualHeight != height) {
  11062. offset.top = offset.top + height - actualHeight
  11063. }
  11064. var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
  11065. if (delta.left) offset.left += delta.left
  11066. else offset.top += delta.top
  11067. var isVertical = /top|bottom/.test(placement)
  11068. var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
  11069. var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
  11070. $tip.offset(offset)
  11071. this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
  11072. }
  11073. Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
  11074. this.arrow()
  11075. .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
  11076. .css(isVertical ? 'top' : 'left', '')
  11077. }
  11078. Tooltip.prototype.setContent = function () {
  11079. var $tip = this.tip()
  11080. var title = this.getTitle()
  11081. $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
  11082. $tip.removeClass('fade in top bottom left right')
  11083. }
  11084. Tooltip.prototype.hide = function (callback) {
  11085. var that = this
  11086. var $tip = $(this.$tip)
  11087. var e = $.Event('hide.bs.' + this.type)
  11088. function complete() {
  11089. if (that.hoverState != 'in') $tip.detach()
  11090. if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
  11091. that.$element
  11092. .removeAttr('aria-describedby')
  11093. .trigger('hidden.bs.' + that.type)
  11094. }
  11095. callback && callback()
  11096. }
  11097. this.$element.trigger(e)
  11098. if (e.isDefaultPrevented()) return
  11099. $tip.removeClass('in')
  11100. $.support.transition && $tip.hasClass('fade') ?
  11101. $tip
  11102. .one('bsTransitionEnd', complete)
  11103. .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
  11104. complete()
  11105. this.hoverState = null
  11106. return this
  11107. }
  11108. Tooltip.prototype.fixTitle = function () {
  11109. var $e = this.$element
  11110. if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
  11111. $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
  11112. }
  11113. }
  11114. Tooltip.prototype.hasContent = function () {
  11115. return this.getTitle()
  11116. }
  11117. Tooltip.prototype.getPosition = function ($element) {
  11118. $element = $element || this.$element
  11119. var el = $element[0]
  11120. var isBody = el.tagName == 'BODY'
  11121. var elRect = el.getBoundingClientRect()
  11122. if (elRect.width == null) {
  11123. // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
  11124. elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
  11125. }
  11126. var isSvg = window.SVGElement && el instanceof window.SVGElement
  11127. // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
  11128. // See https://github.com/twbs/bootstrap/issues/20280
  11129. var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
  11130. var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
  11131. var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
  11132. return $.extend({}, elRect, scroll, outerDims, elOffset)
  11133. }
  11134. Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
  11135. return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  11136. placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  11137. placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
  11138. /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
  11139. }
  11140. Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
  11141. var delta = { top: 0, left: 0 }
  11142. if (!this.$viewport) return delta
  11143. var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
  11144. var viewportDimensions = this.getPosition(this.$viewport)
  11145. if (/right|left/.test(placement)) {
  11146. var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
  11147. var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
  11148. if (topEdgeOffset < viewportDimensions.top) { // top overflow
  11149. delta.top = viewportDimensions.top - topEdgeOffset
  11150. } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
  11151. delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
  11152. }
  11153. } else {
  11154. var leftEdgeOffset = pos.left - viewportPadding
  11155. var rightEdgeOffset = pos.left + viewportPadding + actualWidth
  11156. if (leftEdgeOffset < viewportDimensions.left) { // left overflow
  11157. delta.left = viewportDimensions.left - leftEdgeOffset
  11158. } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
  11159. delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
  11160. }
  11161. }
  11162. return delta
  11163. }
  11164. Tooltip.prototype.getTitle = function () {
  11165. var title
  11166. var $e = this.$element
  11167. var o = this.options
  11168. title = $e.attr('data-original-title')
  11169. || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
  11170. return title
  11171. }
  11172. Tooltip.prototype.getUID = function (prefix) {
  11173. do prefix += ~~(Math.random() * 1000000)
  11174. while (document.getElementById(prefix))
  11175. return prefix
  11176. }
  11177. Tooltip.prototype.tip = function () {
  11178. if (!this.$tip) {
  11179. this.$tip = $(this.options.template)
  11180. if (this.$tip.length != 1) {
  11181. throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
  11182. }
  11183. }
  11184. return this.$tip
  11185. }
  11186. Tooltip.prototype.arrow = function () {
  11187. return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
  11188. }
  11189. Tooltip.prototype.enable = function () {
  11190. this.enabled = true
  11191. }
  11192. Tooltip.prototype.disable = function () {
  11193. this.enabled = false
  11194. }
  11195. Tooltip.prototype.toggleEnabled = function () {
  11196. this.enabled = !this.enabled
  11197. }
  11198. Tooltip.prototype.toggle = function (e) {
  11199. var self = this
  11200. if (e) {
  11201. self = $(e.currentTarget).data('bs.' + this.type)
  11202. if (!self) {
  11203. self = new this.constructor(e.currentTarget, this.getDelegateOptions())
  11204. $(e.currentTarget).data('bs.' + this.type, self)
  11205. }
  11206. }
  11207. if (e) {
  11208. self.inState.click = !self.inState.click
  11209. if (self.isInStateTrue()) self.enter(self)
  11210. else self.leave(self)
  11211. } else {
  11212. self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
  11213. }
  11214. }
  11215. Tooltip.prototype.destroy = function () {
  11216. var that = this
  11217. clearTimeout(this.timeout)
  11218. this.hide(function () {
  11219. that.$element.off('.' + that.type).removeData('bs.' + that.type)
  11220. if (that.$tip) {
  11221. that.$tip.detach()
  11222. }
  11223. that.$tip = null
  11224. that.$arrow = null
  11225. that.$viewport = null
  11226. that.$element = null
  11227. })
  11228. }
  11229. // TOOLTIP PLUGIN DEFINITION
  11230. // =========================
  11231. function Plugin(option) {
  11232. return this.each(function () {
  11233. var $this = $(this)
  11234. var data = $this.data('bs.tooltip')
  11235. var options = typeof option == 'object' && option
  11236. if (!data && /destroy|hide/.test(option)) return
  11237. if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
  11238. if (typeof option == 'string') data[option]()
  11239. })
  11240. }
  11241. var old = $.fn.tooltip
  11242. $.fn.tooltip = Plugin
  11243. $.fn.tooltip.Constructor = Tooltip
  11244. // TOOLTIP NO CONFLICT
  11245. // ===================
  11246. $.fn.tooltip.noConflict = function () {
  11247. $.fn.tooltip = old
  11248. return this
  11249. }
  11250. }(jQuery);
  11251. /* ========================================================================
  11252. * Bootstrap: popover.js v3.3.7
  11253. * http://getbootstrap.com/javascript/#popovers
  11254. * ========================================================================
  11255. * Copyright 2011-2016 Twitter, Inc.
  11256. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  11257. * ======================================================================== */
  11258. +function ($) {
  11259. 'use strict';
  11260. // POPOVER PUBLIC CLASS DEFINITION
  11261. // ===============================
  11262. var Popover = function (element, options) {
  11263. this.init('popover', element, options)
  11264. }
  11265. if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
  11266. Popover.VERSION = '3.3.7'
  11267. Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
  11268. placement: 'right',
  11269. trigger: 'click',
  11270. content: '',
  11271. template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  11272. })
  11273. // NOTE: POPOVER EXTENDS tooltip.js
  11274. // ================================
  11275. Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
  11276. Popover.prototype.constructor = Popover
  11277. Popover.prototype.getDefaults = function () {
  11278. return Popover.DEFAULTS
  11279. }
  11280. Popover.prototype.setContent = function () {
  11281. var $tip = this.tip()
  11282. var title = this.getTitle()
  11283. var content = this.getContent()
  11284. $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
  11285. $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
  11286. this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
  11287. ](content)
  11288. $tip.removeClass('fade top bottom left right in')
  11289. // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
  11290. // this manually by checking the contents.
  11291. if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
  11292. }
  11293. Popover.prototype.hasContent = function () {
  11294. return this.getTitle() || this.getContent()
  11295. }
  11296. Popover.prototype.getContent = function () {
  11297. var $e = this.$element
  11298. var o = this.options
  11299. return $e.attr('data-content')
  11300. || (typeof o.content == 'function' ?
  11301. o.content.call($e[0]) :
  11302. o.content)
  11303. }
  11304. Popover.prototype.arrow = function () {
  11305. return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
  11306. }
  11307. // POPOVER PLUGIN DEFINITION
  11308. // =========================
  11309. function Plugin(option) {
  11310. return this.each(function () {
  11311. var $this = $(this)
  11312. var data = $this.data('bs.popover')
  11313. var options = typeof option == 'object' && option
  11314. if (!data && /destroy|hide/.test(option)) return
  11315. if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
  11316. if (typeof option == 'string') data[option]()
  11317. })
  11318. }
  11319. var old = $.fn.popover
  11320. $.fn.popover = Plugin
  11321. $.fn.popover.Constructor = Popover
  11322. // POPOVER NO CONFLICT
  11323. // ===================
  11324. $.fn.popover.noConflict = function () {
  11325. $.fn.popover = old
  11326. return this
  11327. }
  11328. }(jQuery);
  11329. /* ========================================================================
  11330. * Bootstrap: scrollspy.js v3.3.7
  11331. * http://getbootstrap.com/javascript/#scrollspy
  11332. * ========================================================================
  11333. * Copyright 2011-2016 Twitter, Inc.
  11334. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  11335. * ======================================================================== */
  11336. +function ($) {
  11337. 'use strict';
  11338. // SCROLLSPY CLASS DEFINITION
  11339. // ==========================
  11340. function ScrollSpy(element, options) {
  11341. this.$body = $(document.body)
  11342. this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
  11343. this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
  11344. this.selector = (this.options.target || '') + ' .nav li > a'
  11345. this.offsets = []
  11346. this.targets = []
  11347. this.activeTarget = null
  11348. this.scrollHeight = 0
  11349. this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
  11350. this.refresh()
  11351. this.process()
  11352. }
  11353. ScrollSpy.VERSION = '3.3.7'
  11354. ScrollSpy.DEFAULTS = {
  11355. offset: 10
  11356. }
  11357. ScrollSpy.prototype.getScrollHeight = function () {
  11358. return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
  11359. }
  11360. ScrollSpy.prototype.refresh = function () {
  11361. var that = this
  11362. var offsetMethod = 'offset'
  11363. var offsetBase = 0
  11364. this.offsets = []
  11365. this.targets = []
  11366. this.scrollHeight = this.getScrollHeight()
  11367. if (!$.isWindow(this.$scrollElement[0])) {
  11368. offsetMethod = 'position'
  11369. offsetBase = this.$scrollElement.scrollTop()
  11370. }
  11371. this.$body
  11372. .find(this.selector)
  11373. .map(function () {
  11374. var $el = $(this)
  11375. var href = $el.data('target') || $el.attr('href')
  11376. var $href = /^#./.test(href) && $(href)
  11377. return ($href
  11378. && $href.length
  11379. && $href.is(':visible')
  11380. && [[$href[offsetMethod]().top + offsetBase, href]]) || null
  11381. })
  11382. .sort(function (a, b) { return a[0] - b[0] })
  11383. .each(function () {
  11384. that.offsets.push(this[0])
  11385. that.targets.push(this[1])
  11386. })
  11387. }
  11388. ScrollSpy.prototype.process = function () {
  11389. var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
  11390. var scrollHeight = this.getScrollHeight()
  11391. var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
  11392. var offsets = this.offsets
  11393. var targets = this.targets
  11394. var activeTarget = this.activeTarget
  11395. var i
  11396. if (this.scrollHeight != scrollHeight) {
  11397. this.refresh()
  11398. }
  11399. if (scrollTop >= maxScroll) {
  11400. return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
  11401. }
  11402. if (activeTarget && scrollTop < offsets[0]) {
  11403. this.activeTarget = null
  11404. return this.clear()
  11405. }
  11406. for (i = offsets.length; i--;) {
  11407. activeTarget != targets[i]
  11408. && scrollTop >= offsets[i]
  11409. && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
  11410. && this.activate(targets[i])
  11411. }
  11412. }
  11413. ScrollSpy.prototype.activate = function (target) {
  11414. this.activeTarget = target
  11415. this.clear()
  11416. var selector = this.selector +
  11417. '[data-target="' + target + '"],' +
  11418. this.selector + '[href="' + target + '"]'
  11419. var active = $(selector)
  11420. .parents('li')
  11421. .addClass('active')
  11422. if (active.parent('.dropdown-menu').length) {
  11423. active = active
  11424. .closest('li.dropdown')
  11425. .addClass('active')
  11426. }
  11427. active.trigger('activate.bs.scrollspy')
  11428. }
  11429. ScrollSpy.prototype.clear = function () {
  11430. $(this.selector)
  11431. .parentsUntil(this.options.target, '.active')
  11432. .removeClass('active')
  11433. }
  11434. // SCROLLSPY PLUGIN DEFINITION
  11435. // ===========================
  11436. function Plugin(option) {
  11437. return this.each(function () {
  11438. var $this = $(this)
  11439. var data = $this.data('bs.scrollspy')
  11440. var options = typeof option == 'object' && option
  11441. if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
  11442. if (typeof option == 'string') data[option]()
  11443. })
  11444. }
  11445. var old = $.fn.scrollspy
  11446. $.fn.scrollspy = Plugin
  11447. $.fn.scrollspy.Constructor = ScrollSpy
  11448. // SCROLLSPY NO CONFLICT
  11449. // =====================
  11450. $.fn.scrollspy.noConflict = function () {
  11451. $.fn.scrollspy = old
  11452. return this
  11453. }
  11454. // SCROLLSPY DATA-API
  11455. // ==================
  11456. $(window).on('load.bs.scrollspy.data-api', function () {
  11457. $('[data-spy="scroll"]').each(function () {
  11458. var $spy = $(this)
  11459. Plugin.call($spy, $spy.data())
  11460. })
  11461. })
  11462. }(jQuery);
  11463. /* ========================================================================
  11464. * Bootstrap: tab.js v3.3.7
  11465. * http://getbootstrap.com/javascript/#tabs
  11466. * ========================================================================
  11467. * Copyright 2011-2016 Twitter, Inc.
  11468. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  11469. * ======================================================================== */
  11470. +function ($) {
  11471. 'use strict';
  11472. // TAB CLASS DEFINITION
  11473. // ====================
  11474. var Tab = function (element) {
  11475. // jscs:disable requireDollarBeforejQueryAssignment
  11476. this.element = $(element)
  11477. // jscs:enable requireDollarBeforejQueryAssignment
  11478. }
  11479. Tab.VERSION = '3.3.7'
  11480. Tab.TRANSITION_DURATION = 150
  11481. Tab.prototype.show = function () {
  11482. var $this = this.element
  11483. var $ul = $this.closest('ul:not(.dropdown-menu)')
  11484. var selector = $this.data('target')
  11485. if (!selector) {
  11486. selector = $this.attr('href')
  11487. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  11488. }
  11489. if ($this.parent('li').hasClass('active')) return
  11490. var $previous = $ul.find('.active:last a')
  11491. var hideEvent = $.Event('hide.bs.tab', {
  11492. relatedTarget: $this[0]
  11493. })
  11494. var showEvent = $.Event('show.bs.tab', {
  11495. relatedTarget: $previous[0]
  11496. })
  11497. $previous.trigger(hideEvent)
  11498. $this.trigger(showEvent)
  11499. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
  11500. var $target = $(selector)
  11501. this.activate($this.closest('li'), $ul)
  11502. this.activate($target, $target.parent(), function () {
  11503. $previous.trigger({
  11504. type: 'hidden.bs.tab',
  11505. relatedTarget: $this[0]
  11506. })
  11507. $this.trigger({
  11508. type: 'shown.bs.tab',
  11509. relatedTarget: $previous[0]
  11510. })
  11511. })
  11512. }
  11513. Tab.prototype.activate = function (element, container, callback) {
  11514. var $active = container.find('> .active')
  11515. var transition = callback
  11516. && $.support.transition
  11517. && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
  11518. function next() {
  11519. $active
  11520. .removeClass('active')
  11521. .find('> .dropdown-menu > .active')
  11522. .removeClass('active')
  11523. .end()
  11524. .find('[data-toggle="tab"]')
  11525. .attr('aria-expanded', false)
  11526. element
  11527. .addClass('active')
  11528. .find('[data-toggle="tab"]')
  11529. .attr('aria-expanded', true)
  11530. if (transition) {
  11531. element[0].offsetWidth // reflow for transition
  11532. element.addClass('in')
  11533. } else {
  11534. element.removeClass('fade')
  11535. }
  11536. if (element.parent('.dropdown-menu').length) {
  11537. element
  11538. .closest('li.dropdown')
  11539. .addClass('active')
  11540. .end()
  11541. .find('[data-toggle="tab"]')
  11542. .attr('aria-expanded', true)
  11543. }
  11544. callback && callback()
  11545. }
  11546. $active.length && transition ?
  11547. $active
  11548. .one('bsTransitionEnd', next)
  11549. .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
  11550. next()
  11551. $active.removeClass('in')
  11552. }
  11553. // TAB PLUGIN DEFINITION
  11554. // =====================
  11555. function Plugin(option) {
  11556. return this.each(function () {
  11557. var $this = $(this)
  11558. var data = $this.data('bs.tab')
  11559. if (!data) $this.data('bs.tab', (data = new Tab(this)))
  11560. if (typeof option == 'string') data[option]()
  11561. })
  11562. }
  11563. var old = $.fn.tab
  11564. $.fn.tab = Plugin
  11565. $.fn.tab.Constructor = Tab
  11566. // TAB NO CONFLICT
  11567. // ===============
  11568. $.fn.tab.noConflict = function () {
  11569. $.fn.tab = old
  11570. return this
  11571. }
  11572. // TAB DATA-API
  11573. // ============
  11574. var clickHandler = function (e) {
  11575. e.preventDefault()
  11576. Plugin.call($(this), 'show')
  11577. }
  11578. $(document)
  11579. .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
  11580. .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
  11581. }(jQuery);
  11582. /* ========================================================================
  11583. * Bootstrap: affix.js v3.3.7
  11584. * http://getbootstrap.com/javascript/#affix
  11585. * ========================================================================
  11586. * Copyright 2011-2016 Twitter, Inc.
  11587. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  11588. * ======================================================================== */
  11589. +function ($) {
  11590. 'use strict';
  11591. // AFFIX CLASS DEFINITION
  11592. // ======================
  11593. var Affix = function (element, options) {
  11594. this.options = $.extend({}, Affix.DEFAULTS, options)
  11595. this.$target = $(this.options.target)
  11596. .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
  11597. .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
  11598. this.$element = $(element)
  11599. this.affixed = null
  11600. this.unpin = null
  11601. this.pinnedOffset = null
  11602. this.checkPosition()
  11603. }
  11604. Affix.VERSION = '3.3.7'
  11605. Affix.RESET = 'affix affix-top affix-bottom'
  11606. Affix.DEFAULTS = {
  11607. offset: 0,
  11608. target: window
  11609. }
  11610. Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
  11611. var scrollTop = this.$target.scrollTop()
  11612. var position = this.$element.offset()
  11613. var targetHeight = this.$target.height()
  11614. if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
  11615. if (this.affixed == 'bottom') {
  11616. if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
  11617. return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
  11618. }
  11619. var initializing = this.affixed == null
  11620. var colliderTop = initializing ? scrollTop : position.top
  11621. var colliderHeight = initializing ? targetHeight : height
  11622. if (offsetTop != null && scrollTop <= offsetTop) return 'top'
  11623. if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
  11624. return false
  11625. }
  11626. Affix.prototype.getPinnedOffset = function () {
  11627. if (this.pinnedOffset) return this.pinnedOffset
  11628. this.$element.removeClass(Affix.RESET).addClass('affix')
  11629. var scrollTop = this.$target.scrollTop()
  11630. var position = this.$element.offset()
  11631. return (this.pinnedOffset = position.top - scrollTop)
  11632. }
  11633. Affix.prototype.checkPositionWithEventLoop = function () {
  11634. setTimeout($.proxy(this.checkPosition, this), 1)
  11635. }
  11636. Affix.prototype.checkPosition = function () {
  11637. if (!this.$element.is(':visible')) return
  11638. var height = this.$element.height()
  11639. var offset = this.options.offset
  11640. var offsetTop = offset.top
  11641. var offsetBottom = offset.bottom
  11642. var scrollHeight = Math.max($(document).height(), $(document.body).height())
  11643. if (typeof offset != 'object') offsetBottom = offsetTop = offset
  11644. if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
  11645. if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
  11646. var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
  11647. if (this.affixed != affix) {
  11648. if (this.unpin != null) this.$element.css('top', '')
  11649. var affixType = 'affix' + (affix ? '-' + affix : '')
  11650. var e = $.Event(affixType + '.bs.affix')
  11651. this.$element.trigger(e)
  11652. if (e.isDefaultPrevented()) return
  11653. this.affixed = affix
  11654. this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
  11655. this.$element
  11656. .removeClass(Affix.RESET)
  11657. .addClass(affixType)
  11658. .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
  11659. }
  11660. if (affix == 'bottom') {
  11661. this.$element.offset({
  11662. top: scrollHeight - height - offsetBottom
  11663. })
  11664. }
  11665. }
  11666. // AFFIX PLUGIN DEFINITION
  11667. // =======================
  11668. function Plugin(option) {
  11669. return this.each(function () {
  11670. var $this = $(this)
  11671. var data = $this.data('bs.affix')
  11672. var options = typeof option == 'object' && option
  11673. if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
  11674. if (typeof option == 'string') data[option]()
  11675. })
  11676. }
  11677. var old = $.fn.affix
  11678. $.fn.affix = Plugin
  11679. $.fn.affix.Constructor = Affix
  11680. // AFFIX NO CONFLICT
  11681. // =================
  11682. $.fn.affix.noConflict = function () {
  11683. $.fn.affix = old
  11684. return this
  11685. }
  11686. // AFFIX DATA-API
  11687. // ==============
  11688. $(window).on('load', function () {
  11689. $('[data-spy="affix"]').each(function () {
  11690. var $spy = $(this)
  11691. var data = $spy.data()
  11692. data.offset = data.offset || {}
  11693. if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
  11694. if (data.offsetTop != null) data.offset.top = data.offsetTop
  11695. Plugin.call($spy, data)
  11696. })
  11697. })
  11698. }(jQuery);
  11699. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8)))
  11700. /***/ }),
  11701. /* 33 */
  11702. /***/ (function(module, exports, __webpack_require__) {
  11703. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  11704. * @license
  11705. * Lodash <https://lodash.com/>
  11706. * Copyright JS Foundation and other contributors <https://js.foundation/>
  11707. * Released under MIT license <https://lodash.com/license>
  11708. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  11709. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  11710. */
  11711. ;(function() {
  11712. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  11713. var undefined;
  11714. /** Used as the semantic version number. */
  11715. var VERSION = '4.17.4';
  11716. /** Used as the size to enable large array optimizations. */
  11717. var LARGE_ARRAY_SIZE = 200;
  11718. /** Error message constants. */
  11719. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  11720. FUNC_ERROR_TEXT = 'Expected a function';
  11721. /** Used to stand-in for `undefined` hash values. */
  11722. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  11723. /** Used as the maximum memoize cache size. */
  11724. var MAX_MEMOIZE_SIZE = 500;
  11725. /** Used as the internal argument placeholder. */
  11726. var PLACEHOLDER = '__lodash_placeholder__';
  11727. /** Used to compose bitmasks for cloning. */
  11728. var CLONE_DEEP_FLAG = 1,
  11729. CLONE_FLAT_FLAG = 2,
  11730. CLONE_SYMBOLS_FLAG = 4;
  11731. /** Used to compose bitmasks for value comparisons. */
  11732. var COMPARE_PARTIAL_FLAG = 1,
  11733. COMPARE_UNORDERED_FLAG = 2;
  11734. /** Used to compose bitmasks for function metadata. */
  11735. var WRAP_BIND_FLAG = 1,
  11736. WRAP_BIND_KEY_FLAG = 2,
  11737. WRAP_CURRY_BOUND_FLAG = 4,
  11738. WRAP_CURRY_FLAG = 8,
  11739. WRAP_CURRY_RIGHT_FLAG = 16,
  11740. WRAP_PARTIAL_FLAG = 32,
  11741. WRAP_PARTIAL_RIGHT_FLAG = 64,
  11742. WRAP_ARY_FLAG = 128,
  11743. WRAP_REARG_FLAG = 256,
  11744. WRAP_FLIP_FLAG = 512;
  11745. /** Used as default options for `_.truncate`. */
  11746. var DEFAULT_TRUNC_LENGTH = 30,
  11747. DEFAULT_TRUNC_OMISSION = '...';
  11748. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  11749. var HOT_COUNT = 800,
  11750. HOT_SPAN = 16;
  11751. /** Used to indicate the type of lazy iteratees. */
  11752. var LAZY_FILTER_FLAG = 1,
  11753. LAZY_MAP_FLAG = 2,
  11754. LAZY_WHILE_FLAG = 3;
  11755. /** Used as references for various `Number` constants. */
  11756. var INFINITY = 1 / 0,
  11757. MAX_SAFE_INTEGER = 9007199254740991,
  11758. MAX_INTEGER = 1.7976931348623157e+308,
  11759. NAN = 0 / 0;
  11760. /** Used as references for the maximum length and index of an array. */
  11761. var MAX_ARRAY_LENGTH = 4294967295,
  11762. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  11763. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  11764. /** Used to associate wrap methods with their bit flags. */
  11765. var wrapFlags = [
  11766. ['ary', WRAP_ARY_FLAG],
  11767. ['bind', WRAP_BIND_FLAG],
  11768. ['bindKey', WRAP_BIND_KEY_FLAG],
  11769. ['curry', WRAP_CURRY_FLAG],
  11770. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  11771. ['flip', WRAP_FLIP_FLAG],
  11772. ['partial', WRAP_PARTIAL_FLAG],
  11773. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  11774. ['rearg', WRAP_REARG_FLAG]
  11775. ];
  11776. /** `Object#toString` result references. */
  11777. var argsTag = '[object Arguments]',
  11778. arrayTag = '[object Array]',
  11779. asyncTag = '[object AsyncFunction]',
  11780. boolTag = '[object Boolean]',
  11781. dateTag = '[object Date]',
  11782. domExcTag = '[object DOMException]',
  11783. errorTag = '[object Error]',
  11784. funcTag = '[object Function]',
  11785. genTag = '[object GeneratorFunction]',
  11786. mapTag = '[object Map]',
  11787. numberTag = '[object Number]',
  11788. nullTag = '[object Null]',
  11789. objectTag = '[object Object]',
  11790. promiseTag = '[object Promise]',
  11791. proxyTag = '[object Proxy]',
  11792. regexpTag = '[object RegExp]',
  11793. setTag = '[object Set]',
  11794. stringTag = '[object String]',
  11795. symbolTag = '[object Symbol]',
  11796. undefinedTag = '[object Undefined]',
  11797. weakMapTag = '[object WeakMap]',
  11798. weakSetTag = '[object WeakSet]';
  11799. var arrayBufferTag = '[object ArrayBuffer]',
  11800. dataViewTag = '[object DataView]',
  11801. float32Tag = '[object Float32Array]',
  11802. float64Tag = '[object Float64Array]',
  11803. int8Tag = '[object Int8Array]',
  11804. int16Tag = '[object Int16Array]',
  11805. int32Tag = '[object Int32Array]',
  11806. uint8Tag = '[object Uint8Array]',
  11807. uint8ClampedTag = '[object Uint8ClampedArray]',
  11808. uint16Tag = '[object Uint16Array]',
  11809. uint32Tag = '[object Uint32Array]';
  11810. /** Used to match empty string literals in compiled template source. */
  11811. var reEmptyStringLeading = /\b__p \+= '';/g,
  11812. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  11813. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  11814. /** Used to match HTML entities and HTML characters. */
  11815. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  11816. reUnescapedHtml = /[&<>"']/g,
  11817. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  11818. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  11819. /** Used to match template delimiters. */
  11820. var reEscape = /<%-([\s\S]+?)%>/g,
  11821. reEvaluate = /<%([\s\S]+?)%>/g,
  11822. reInterpolate = /<%=([\s\S]+?)%>/g;
  11823. /** Used to match property names within property paths. */
  11824. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  11825. reIsPlainProp = /^\w*$/,
  11826. reLeadingDot = /^\./,
  11827. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  11828. /**
  11829. * Used to match `RegExp`
  11830. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  11831. */
  11832. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  11833. reHasRegExpChar = RegExp(reRegExpChar.source);
  11834. /** Used to match leading and trailing whitespace. */
  11835. var reTrim = /^\s+|\s+$/g,
  11836. reTrimStart = /^\s+/,
  11837. reTrimEnd = /\s+$/;
  11838. /** Used to match wrap detail comments. */
  11839. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  11840. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  11841. reSplitDetails = /,? & /;
  11842. /** Used to match words composed of alphanumeric characters. */
  11843. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  11844. /** Used to match backslashes in property paths. */
  11845. var reEscapeChar = /\\(\\)?/g;
  11846. /**
  11847. * Used to match
  11848. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  11849. */
  11850. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  11851. /** Used to match `RegExp` flags from their coerced string values. */
  11852. var reFlags = /\w*$/;
  11853. /** Used to detect bad signed hexadecimal string values. */
  11854. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  11855. /** Used to detect binary string values. */
  11856. var reIsBinary = /^0b[01]+$/i;
  11857. /** Used to detect host constructors (Safari). */
  11858. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  11859. /** Used to detect octal string values. */
  11860. var reIsOctal = /^0o[0-7]+$/i;
  11861. /** Used to detect unsigned integer values. */
  11862. var reIsUint = /^(?:0|[1-9]\d*)$/;
  11863. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  11864. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  11865. /** Used to ensure capturing order of template delimiters. */
  11866. var reNoMatch = /($^)/;
  11867. /** Used to match unescaped characters in compiled string literals. */
  11868. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  11869. /** Used to compose unicode character classes. */
  11870. var rsAstralRange = '\\ud800-\\udfff',
  11871. rsComboMarksRange = '\\u0300-\\u036f',
  11872. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  11873. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  11874. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  11875. rsDingbatRange = '\\u2700-\\u27bf',
  11876. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  11877. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  11878. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  11879. rsPunctuationRange = '\\u2000-\\u206f',
  11880. 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',
  11881. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  11882. rsVarRange = '\\ufe0e\\ufe0f',
  11883. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  11884. /** Used to compose unicode capture groups. */
  11885. var rsApos = "['\u2019]",
  11886. rsAstral = '[' + rsAstralRange + ']',
  11887. rsBreak = '[' + rsBreakRange + ']',
  11888. rsCombo = '[' + rsComboRange + ']',
  11889. rsDigits = '\\d+',
  11890. rsDingbat = '[' + rsDingbatRange + ']',
  11891. rsLower = '[' + rsLowerRange + ']',
  11892. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  11893. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  11894. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  11895. rsNonAstral = '[^' + rsAstralRange + ']',
  11896. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  11897. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  11898. rsUpper = '[' + rsUpperRange + ']',
  11899. rsZWJ = '\\u200d';
  11900. /** Used to compose unicode regexes. */
  11901. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  11902. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  11903. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  11904. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  11905. reOptMod = rsModifier + '?',
  11906. rsOptVar = '[' + rsVarRange + ']?',
  11907. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  11908. rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)',
  11909. rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)',
  11910. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  11911. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  11912. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  11913. /** Used to match apostrophes. */
  11914. var reApos = RegExp(rsApos, 'g');
  11915. /**
  11916. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  11917. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  11918. */
  11919. var reComboMark = RegExp(rsCombo, 'g');
  11920. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  11921. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  11922. /** Used to match complex or compound words. */
  11923. var reUnicodeWord = RegExp([
  11924. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  11925. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  11926. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  11927. rsUpper + '+' + rsOptContrUpper,
  11928. rsOrdUpper,
  11929. rsOrdLower,
  11930. rsDigits,
  11931. rsEmoji
  11932. ].join('|'), 'g');
  11933. /** 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/). */
  11934. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  11935. /** Used to detect strings that need a more robust regexp to match words. */
  11936. 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 ]/;
  11937. /** Used to assign default `context` object properties. */
  11938. var contextProps = [
  11939. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  11940. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  11941. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  11942. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  11943. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  11944. ];
  11945. /** Used to make template sourceURLs easier to identify. */
  11946. var templateCounter = -1;
  11947. /** Used to identify `toStringTag` values of typed arrays. */
  11948. var typedArrayTags = {};
  11949. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  11950. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  11951. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  11952. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  11953. typedArrayTags[uint32Tag] = true;
  11954. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  11955. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  11956. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  11957. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  11958. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  11959. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  11960. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  11961. typedArrayTags[weakMapTag] = false;
  11962. /** Used to identify `toStringTag` values supported by `_.clone`. */
  11963. var cloneableTags = {};
  11964. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  11965. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  11966. cloneableTags[boolTag] = cloneableTags[dateTag] =
  11967. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  11968. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  11969. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  11970. cloneableTags[numberTag] = cloneableTags[objectTag] =
  11971. cloneableTags[regexpTag] = cloneableTags[setTag] =
  11972. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  11973. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  11974. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  11975. cloneableTags[errorTag] = cloneableTags[funcTag] =
  11976. cloneableTags[weakMapTag] = false;
  11977. /** Used to map Latin Unicode letters to basic Latin letters. */
  11978. var deburredLetters = {
  11979. // Latin-1 Supplement block.
  11980. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  11981. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  11982. '\xc7': 'C', '\xe7': 'c',
  11983. '\xd0': 'D', '\xf0': 'd',
  11984. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  11985. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  11986. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  11987. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  11988. '\xd1': 'N', '\xf1': 'n',
  11989. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  11990. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  11991. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  11992. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  11993. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  11994. '\xc6': 'Ae', '\xe6': 'ae',
  11995. '\xde': 'Th', '\xfe': 'th',
  11996. '\xdf': 'ss',
  11997. // Latin Extended-A block.
  11998. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  11999. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  12000. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  12001. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  12002. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  12003. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  12004. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  12005. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  12006. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  12007. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  12008. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  12009. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  12010. '\u0134': 'J', '\u0135': 'j',
  12011. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  12012. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  12013. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  12014. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  12015. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  12016. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  12017. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  12018. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  12019. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  12020. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  12021. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  12022. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  12023. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  12024. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  12025. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  12026. '\u0174': 'W', '\u0175': 'w',
  12027. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  12028. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  12029. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  12030. '\u0132': 'IJ', '\u0133': 'ij',
  12031. '\u0152': 'Oe', '\u0153': 'oe',
  12032. '\u0149': "'n", '\u017f': 's'
  12033. };
  12034. /** Used to map characters to HTML entities. */
  12035. var htmlEscapes = {
  12036. '&': '&amp;',
  12037. '<': '&lt;',
  12038. '>': '&gt;',
  12039. '"': '&quot;',
  12040. "'": '&#39;'
  12041. };
  12042. /** Used to map HTML entities to characters. */
  12043. var htmlUnescapes = {
  12044. '&amp;': '&',
  12045. '&lt;': '<',
  12046. '&gt;': '>',
  12047. '&quot;': '"',
  12048. '&#39;': "'"
  12049. };
  12050. /** Used to escape characters for inclusion in compiled string literals. */
  12051. var stringEscapes = {
  12052. '\\': '\\',
  12053. "'": "'",
  12054. '\n': 'n',
  12055. '\r': 'r',
  12056. '\u2028': 'u2028',
  12057. '\u2029': 'u2029'
  12058. };
  12059. /** Built-in method references without a dependency on `root`. */
  12060. var freeParseFloat = parseFloat,
  12061. freeParseInt = parseInt;
  12062. /** Detect free variable `global` from Node.js. */
  12063. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  12064. /** Detect free variable `self`. */
  12065. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  12066. /** Used as a reference to the global object. */
  12067. var root = freeGlobal || freeSelf || Function('return this')();
  12068. /** Detect free variable `exports`. */
  12069. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  12070. /** Detect free variable `module`. */
  12071. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  12072. /** Detect the popular CommonJS extension `module.exports`. */
  12073. var moduleExports = freeModule && freeModule.exports === freeExports;
  12074. /** Detect free variable `process` from Node.js. */
  12075. var freeProcess = moduleExports && freeGlobal.process;
  12076. /** Used to access faster Node.js helpers. */
  12077. var nodeUtil = (function() {
  12078. try {
  12079. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  12080. } catch (e) {}
  12081. }());
  12082. /* Node.js helper references. */
  12083. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  12084. nodeIsDate = nodeUtil && nodeUtil.isDate,
  12085. nodeIsMap = nodeUtil && nodeUtil.isMap,
  12086. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  12087. nodeIsSet = nodeUtil && nodeUtil.isSet,
  12088. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  12089. /*--------------------------------------------------------------------------*/
  12090. /**
  12091. * Adds the key-value `pair` to `map`.
  12092. *
  12093. * @private
  12094. * @param {Object} map The map to modify.
  12095. * @param {Array} pair The key-value pair to add.
  12096. * @returns {Object} Returns `map`.
  12097. */
  12098. function addMapEntry(map, pair) {
  12099. // Don't return `map.set` because it's not chainable in IE 11.
  12100. map.set(pair[0], pair[1]);
  12101. return map;
  12102. }
  12103. /**
  12104. * Adds `value` to `set`.
  12105. *
  12106. * @private
  12107. * @param {Object} set The set to modify.
  12108. * @param {*} value The value to add.
  12109. * @returns {Object} Returns `set`.
  12110. */
  12111. function addSetEntry(set, value) {
  12112. // Don't return `set.add` because it's not chainable in IE 11.
  12113. set.add(value);
  12114. return set;
  12115. }
  12116. /**
  12117. * A faster alternative to `Function#apply`, this function invokes `func`
  12118. * with the `this` binding of `thisArg` and the arguments of `args`.
  12119. *
  12120. * @private
  12121. * @param {Function} func The function to invoke.
  12122. * @param {*} thisArg The `this` binding of `func`.
  12123. * @param {Array} args The arguments to invoke `func` with.
  12124. * @returns {*} Returns the result of `func`.
  12125. */
  12126. function apply(func, thisArg, args) {
  12127. switch (args.length) {
  12128. case 0: return func.call(thisArg);
  12129. case 1: return func.call(thisArg, args[0]);
  12130. case 2: return func.call(thisArg, args[0], args[1]);
  12131. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  12132. }
  12133. return func.apply(thisArg, args);
  12134. }
  12135. /**
  12136. * A specialized version of `baseAggregator` for arrays.
  12137. *
  12138. * @private
  12139. * @param {Array} [array] The array to iterate over.
  12140. * @param {Function} setter The function to set `accumulator` values.
  12141. * @param {Function} iteratee The iteratee to transform keys.
  12142. * @param {Object} accumulator The initial aggregated object.
  12143. * @returns {Function} Returns `accumulator`.
  12144. */
  12145. function arrayAggregator(array, setter, iteratee, accumulator) {
  12146. var index = -1,
  12147. length = array == null ? 0 : array.length;
  12148. while (++index < length) {
  12149. var value = array[index];
  12150. setter(accumulator, value, iteratee(value), array);
  12151. }
  12152. return accumulator;
  12153. }
  12154. /**
  12155. * A specialized version of `_.forEach` for arrays without support for
  12156. * iteratee shorthands.
  12157. *
  12158. * @private
  12159. * @param {Array} [array] The array to iterate over.
  12160. * @param {Function} iteratee The function invoked per iteration.
  12161. * @returns {Array} Returns `array`.
  12162. */
  12163. function arrayEach(array, iteratee) {
  12164. var index = -1,
  12165. length = array == null ? 0 : array.length;
  12166. while (++index < length) {
  12167. if (iteratee(array[index], index, array) === false) {
  12168. break;
  12169. }
  12170. }
  12171. return array;
  12172. }
  12173. /**
  12174. * A specialized version of `_.forEachRight` for arrays without support for
  12175. * iteratee shorthands.
  12176. *
  12177. * @private
  12178. * @param {Array} [array] The array to iterate over.
  12179. * @param {Function} iteratee The function invoked per iteration.
  12180. * @returns {Array} Returns `array`.
  12181. */
  12182. function arrayEachRight(array, iteratee) {
  12183. var length = array == null ? 0 : array.length;
  12184. while (length--) {
  12185. if (iteratee(array[length], length, array) === false) {
  12186. break;
  12187. }
  12188. }
  12189. return array;
  12190. }
  12191. /**
  12192. * A specialized version of `_.every` for arrays without support for
  12193. * iteratee shorthands.
  12194. *
  12195. * @private
  12196. * @param {Array} [array] The array to iterate over.
  12197. * @param {Function} predicate The function invoked per iteration.
  12198. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  12199. * else `false`.
  12200. */
  12201. function arrayEvery(array, predicate) {
  12202. var index = -1,
  12203. length = array == null ? 0 : array.length;
  12204. while (++index < length) {
  12205. if (!predicate(array[index], index, array)) {
  12206. return false;
  12207. }
  12208. }
  12209. return true;
  12210. }
  12211. /**
  12212. * A specialized version of `_.filter` for arrays without support for
  12213. * iteratee shorthands.
  12214. *
  12215. * @private
  12216. * @param {Array} [array] The array to iterate over.
  12217. * @param {Function} predicate The function invoked per iteration.
  12218. * @returns {Array} Returns the new filtered array.
  12219. */
  12220. function arrayFilter(array, predicate) {
  12221. var index = -1,
  12222. length = array == null ? 0 : array.length,
  12223. resIndex = 0,
  12224. result = [];
  12225. while (++index < length) {
  12226. var value = array[index];
  12227. if (predicate(value, index, array)) {
  12228. result[resIndex++] = value;
  12229. }
  12230. }
  12231. return result;
  12232. }
  12233. /**
  12234. * A specialized version of `_.includes` for arrays without support for
  12235. * specifying an index to search from.
  12236. *
  12237. * @private
  12238. * @param {Array} [array] The array to inspect.
  12239. * @param {*} target The value to search for.
  12240. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  12241. */
  12242. function arrayIncludes(array, value) {
  12243. var length = array == null ? 0 : array.length;
  12244. return !!length && baseIndexOf(array, value, 0) > -1;
  12245. }
  12246. /**
  12247. * This function is like `arrayIncludes` except that it accepts a comparator.
  12248. *
  12249. * @private
  12250. * @param {Array} [array] The array to inspect.
  12251. * @param {*} target The value to search for.
  12252. * @param {Function} comparator The comparator invoked per element.
  12253. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  12254. */
  12255. function arrayIncludesWith(array, value, comparator) {
  12256. var index = -1,
  12257. length = array == null ? 0 : array.length;
  12258. while (++index < length) {
  12259. if (comparator(value, array[index])) {
  12260. return true;
  12261. }
  12262. }
  12263. return false;
  12264. }
  12265. /**
  12266. * A specialized version of `_.map` for arrays without support for iteratee
  12267. * shorthands.
  12268. *
  12269. * @private
  12270. * @param {Array} [array] The array to iterate over.
  12271. * @param {Function} iteratee The function invoked per iteration.
  12272. * @returns {Array} Returns the new mapped array.
  12273. */
  12274. function arrayMap(array, iteratee) {
  12275. var index = -1,
  12276. length = array == null ? 0 : array.length,
  12277. result = Array(length);
  12278. while (++index < length) {
  12279. result[index] = iteratee(array[index], index, array);
  12280. }
  12281. return result;
  12282. }
  12283. /**
  12284. * Appends the elements of `values` to `array`.
  12285. *
  12286. * @private
  12287. * @param {Array} array The array to modify.
  12288. * @param {Array} values The values to append.
  12289. * @returns {Array} Returns `array`.
  12290. */
  12291. function arrayPush(array, values) {
  12292. var index = -1,
  12293. length = values.length,
  12294. offset = array.length;
  12295. while (++index < length) {
  12296. array[offset + index] = values[index];
  12297. }
  12298. return array;
  12299. }
  12300. /**
  12301. * A specialized version of `_.reduce` for arrays without support for
  12302. * iteratee shorthands.
  12303. *
  12304. * @private
  12305. * @param {Array} [array] The array to iterate over.
  12306. * @param {Function} iteratee The function invoked per iteration.
  12307. * @param {*} [accumulator] The initial value.
  12308. * @param {boolean} [initAccum] Specify using the first element of `array` as
  12309. * the initial value.
  12310. * @returns {*} Returns the accumulated value.
  12311. */
  12312. function arrayReduce(array, iteratee, accumulator, initAccum) {
  12313. var index = -1,
  12314. length = array == null ? 0 : array.length;
  12315. if (initAccum && length) {
  12316. accumulator = array[++index];
  12317. }
  12318. while (++index < length) {
  12319. accumulator = iteratee(accumulator, array[index], index, array);
  12320. }
  12321. return accumulator;
  12322. }
  12323. /**
  12324. * A specialized version of `_.reduceRight` for arrays without support for
  12325. * iteratee shorthands.
  12326. *
  12327. * @private
  12328. * @param {Array} [array] The array to iterate over.
  12329. * @param {Function} iteratee The function invoked per iteration.
  12330. * @param {*} [accumulator] The initial value.
  12331. * @param {boolean} [initAccum] Specify using the last element of `array` as
  12332. * the initial value.
  12333. * @returns {*} Returns the accumulated value.
  12334. */
  12335. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  12336. var length = array == null ? 0 : array.length;
  12337. if (initAccum && length) {
  12338. accumulator = array[--length];
  12339. }
  12340. while (length--) {
  12341. accumulator = iteratee(accumulator, array[length], length, array);
  12342. }
  12343. return accumulator;
  12344. }
  12345. /**
  12346. * A specialized version of `_.some` for arrays without support for iteratee
  12347. * shorthands.
  12348. *
  12349. * @private
  12350. * @param {Array} [array] The array to iterate over.
  12351. * @param {Function} predicate The function invoked per iteration.
  12352. * @returns {boolean} Returns `true` if any element passes the predicate check,
  12353. * else `false`.
  12354. */
  12355. function arraySome(array, predicate) {
  12356. var index = -1,
  12357. length = array == null ? 0 : array.length;
  12358. while (++index < length) {
  12359. if (predicate(array[index], index, array)) {
  12360. return true;
  12361. }
  12362. }
  12363. return false;
  12364. }
  12365. /**
  12366. * Gets the size of an ASCII `string`.
  12367. *
  12368. * @private
  12369. * @param {string} string The string inspect.
  12370. * @returns {number} Returns the string size.
  12371. */
  12372. var asciiSize = baseProperty('length');
  12373. /**
  12374. * Converts an ASCII `string` to an array.
  12375. *
  12376. * @private
  12377. * @param {string} string The string to convert.
  12378. * @returns {Array} Returns the converted array.
  12379. */
  12380. function asciiToArray(string) {
  12381. return string.split('');
  12382. }
  12383. /**
  12384. * Splits an ASCII `string` into an array of its words.
  12385. *
  12386. * @private
  12387. * @param {string} The string to inspect.
  12388. * @returns {Array} Returns the words of `string`.
  12389. */
  12390. function asciiWords(string) {
  12391. return string.match(reAsciiWord) || [];
  12392. }
  12393. /**
  12394. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  12395. * without support for iteratee shorthands, which iterates over `collection`
  12396. * using `eachFunc`.
  12397. *
  12398. * @private
  12399. * @param {Array|Object} collection The collection to inspect.
  12400. * @param {Function} predicate The function invoked per iteration.
  12401. * @param {Function} eachFunc The function to iterate over `collection`.
  12402. * @returns {*} Returns the found element or its key, else `undefined`.
  12403. */
  12404. function baseFindKey(collection, predicate, eachFunc) {
  12405. var result;
  12406. eachFunc(collection, function(value, key, collection) {
  12407. if (predicate(value, key, collection)) {
  12408. result = key;
  12409. return false;
  12410. }
  12411. });
  12412. return result;
  12413. }
  12414. /**
  12415. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  12416. * support for iteratee shorthands.
  12417. *
  12418. * @private
  12419. * @param {Array} array The array to inspect.
  12420. * @param {Function} predicate The function invoked per iteration.
  12421. * @param {number} fromIndex The index to search from.
  12422. * @param {boolean} [fromRight] Specify iterating from right to left.
  12423. * @returns {number} Returns the index of the matched value, else `-1`.
  12424. */
  12425. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  12426. var length = array.length,
  12427. index = fromIndex + (fromRight ? 1 : -1);
  12428. while ((fromRight ? index-- : ++index < length)) {
  12429. if (predicate(array[index], index, array)) {
  12430. return index;
  12431. }
  12432. }
  12433. return -1;
  12434. }
  12435. /**
  12436. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  12437. *
  12438. * @private
  12439. * @param {Array} array The array to inspect.
  12440. * @param {*} value The value to search for.
  12441. * @param {number} fromIndex The index to search from.
  12442. * @returns {number} Returns the index of the matched value, else `-1`.
  12443. */
  12444. function baseIndexOf(array, value, fromIndex) {
  12445. return value === value
  12446. ? strictIndexOf(array, value, fromIndex)
  12447. : baseFindIndex(array, baseIsNaN, fromIndex);
  12448. }
  12449. /**
  12450. * This function is like `baseIndexOf` except that it accepts a comparator.
  12451. *
  12452. * @private
  12453. * @param {Array} array The array to inspect.
  12454. * @param {*} value The value to search for.
  12455. * @param {number} fromIndex The index to search from.
  12456. * @param {Function} comparator The comparator invoked per element.
  12457. * @returns {number} Returns the index of the matched value, else `-1`.
  12458. */
  12459. function baseIndexOfWith(array, value, fromIndex, comparator) {
  12460. var index = fromIndex - 1,
  12461. length = array.length;
  12462. while (++index < length) {
  12463. if (comparator(array[index], value)) {
  12464. return index;
  12465. }
  12466. }
  12467. return -1;
  12468. }
  12469. /**
  12470. * The base implementation of `_.isNaN` without support for number objects.
  12471. *
  12472. * @private
  12473. * @param {*} value The value to check.
  12474. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  12475. */
  12476. function baseIsNaN(value) {
  12477. return value !== value;
  12478. }
  12479. /**
  12480. * The base implementation of `_.mean` and `_.meanBy` without support for
  12481. * iteratee shorthands.
  12482. *
  12483. * @private
  12484. * @param {Array} array The array to iterate over.
  12485. * @param {Function} iteratee The function invoked per iteration.
  12486. * @returns {number} Returns the mean.
  12487. */
  12488. function baseMean(array, iteratee) {
  12489. var length = array == null ? 0 : array.length;
  12490. return length ? (baseSum(array, iteratee) / length) : NAN;
  12491. }
  12492. /**
  12493. * The base implementation of `_.property` without support for deep paths.
  12494. *
  12495. * @private
  12496. * @param {string} key The key of the property to get.
  12497. * @returns {Function} Returns the new accessor function.
  12498. */
  12499. function baseProperty(key) {
  12500. return function(object) {
  12501. return object == null ? undefined : object[key];
  12502. };
  12503. }
  12504. /**
  12505. * The base implementation of `_.propertyOf` without support for deep paths.
  12506. *
  12507. * @private
  12508. * @param {Object} object The object to query.
  12509. * @returns {Function} Returns the new accessor function.
  12510. */
  12511. function basePropertyOf(object) {
  12512. return function(key) {
  12513. return object == null ? undefined : object[key];
  12514. };
  12515. }
  12516. /**
  12517. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  12518. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  12519. *
  12520. * @private
  12521. * @param {Array|Object} collection The collection to iterate over.
  12522. * @param {Function} iteratee The function invoked per iteration.
  12523. * @param {*} accumulator The initial value.
  12524. * @param {boolean} initAccum Specify using the first or last element of
  12525. * `collection` as the initial value.
  12526. * @param {Function} eachFunc The function to iterate over `collection`.
  12527. * @returns {*} Returns the accumulated value.
  12528. */
  12529. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  12530. eachFunc(collection, function(value, index, collection) {
  12531. accumulator = initAccum
  12532. ? (initAccum = false, value)
  12533. : iteratee(accumulator, value, index, collection);
  12534. });
  12535. return accumulator;
  12536. }
  12537. /**
  12538. * The base implementation of `_.sortBy` which uses `comparer` to define the
  12539. * sort order of `array` and replaces criteria objects with their corresponding
  12540. * values.
  12541. *
  12542. * @private
  12543. * @param {Array} array The array to sort.
  12544. * @param {Function} comparer The function to define sort order.
  12545. * @returns {Array} Returns `array`.
  12546. */
  12547. function baseSortBy(array, comparer) {
  12548. var length = array.length;
  12549. array.sort(comparer);
  12550. while (length--) {
  12551. array[length] = array[length].value;
  12552. }
  12553. return array;
  12554. }
  12555. /**
  12556. * The base implementation of `_.sum` and `_.sumBy` without support for
  12557. * iteratee shorthands.
  12558. *
  12559. * @private
  12560. * @param {Array} array The array to iterate over.
  12561. * @param {Function} iteratee The function invoked per iteration.
  12562. * @returns {number} Returns the sum.
  12563. */
  12564. function baseSum(array, iteratee) {
  12565. var result,
  12566. index = -1,
  12567. length = array.length;
  12568. while (++index < length) {
  12569. var current = iteratee(array[index]);
  12570. if (current !== undefined) {
  12571. result = result === undefined ? current : (result + current);
  12572. }
  12573. }
  12574. return result;
  12575. }
  12576. /**
  12577. * The base implementation of `_.times` without support for iteratee shorthands
  12578. * or max array length checks.
  12579. *
  12580. * @private
  12581. * @param {number} n The number of times to invoke `iteratee`.
  12582. * @param {Function} iteratee The function invoked per iteration.
  12583. * @returns {Array} Returns the array of results.
  12584. */
  12585. function baseTimes(n, iteratee) {
  12586. var index = -1,
  12587. result = Array(n);
  12588. while (++index < n) {
  12589. result[index] = iteratee(index);
  12590. }
  12591. return result;
  12592. }
  12593. /**
  12594. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  12595. * of key-value pairs for `object` corresponding to the property names of `props`.
  12596. *
  12597. * @private
  12598. * @param {Object} object The object to query.
  12599. * @param {Array} props The property names to get values for.
  12600. * @returns {Object} Returns the key-value pairs.
  12601. */
  12602. function baseToPairs(object, props) {
  12603. return arrayMap(props, function(key) {
  12604. return [key, object[key]];
  12605. });
  12606. }
  12607. /**
  12608. * The base implementation of `_.unary` without support for storing metadata.
  12609. *
  12610. * @private
  12611. * @param {Function} func The function to cap arguments for.
  12612. * @returns {Function} Returns the new capped function.
  12613. */
  12614. function baseUnary(func) {
  12615. return function(value) {
  12616. return func(value);
  12617. };
  12618. }
  12619. /**
  12620. * The base implementation of `_.values` and `_.valuesIn` which creates an
  12621. * array of `object` property values corresponding to the property names
  12622. * of `props`.
  12623. *
  12624. * @private
  12625. * @param {Object} object The object to query.
  12626. * @param {Array} props The property names to get values for.
  12627. * @returns {Object} Returns the array of property values.
  12628. */
  12629. function baseValues(object, props) {
  12630. return arrayMap(props, function(key) {
  12631. return object[key];
  12632. });
  12633. }
  12634. /**
  12635. * Checks if a `cache` value for `key` exists.
  12636. *
  12637. * @private
  12638. * @param {Object} cache The cache to query.
  12639. * @param {string} key The key of the entry to check.
  12640. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  12641. */
  12642. function cacheHas(cache, key) {
  12643. return cache.has(key);
  12644. }
  12645. /**
  12646. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  12647. * that is not found in the character symbols.
  12648. *
  12649. * @private
  12650. * @param {Array} strSymbols The string symbols to inspect.
  12651. * @param {Array} chrSymbols The character symbols to find.
  12652. * @returns {number} Returns the index of the first unmatched string symbol.
  12653. */
  12654. function charsStartIndex(strSymbols, chrSymbols) {
  12655. var index = -1,
  12656. length = strSymbols.length;
  12657. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  12658. return index;
  12659. }
  12660. /**
  12661. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  12662. * that is not found in the character symbols.
  12663. *
  12664. * @private
  12665. * @param {Array} strSymbols The string symbols to inspect.
  12666. * @param {Array} chrSymbols The character symbols to find.
  12667. * @returns {number} Returns the index of the last unmatched string symbol.
  12668. */
  12669. function charsEndIndex(strSymbols, chrSymbols) {
  12670. var index = strSymbols.length;
  12671. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  12672. return index;
  12673. }
  12674. /**
  12675. * Gets the number of `placeholder` occurrences in `array`.
  12676. *
  12677. * @private
  12678. * @param {Array} array The array to inspect.
  12679. * @param {*} placeholder The placeholder to search for.
  12680. * @returns {number} Returns the placeholder count.
  12681. */
  12682. function countHolders(array, placeholder) {
  12683. var length = array.length,
  12684. result = 0;
  12685. while (length--) {
  12686. if (array[length] === placeholder) {
  12687. ++result;
  12688. }
  12689. }
  12690. return result;
  12691. }
  12692. /**
  12693. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  12694. * letters to basic Latin letters.
  12695. *
  12696. * @private
  12697. * @param {string} letter The matched letter to deburr.
  12698. * @returns {string} Returns the deburred letter.
  12699. */
  12700. var deburrLetter = basePropertyOf(deburredLetters);
  12701. /**
  12702. * Used by `_.escape` to convert characters to HTML entities.
  12703. *
  12704. * @private
  12705. * @param {string} chr The matched character to escape.
  12706. * @returns {string} Returns the escaped character.
  12707. */
  12708. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  12709. /**
  12710. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  12711. *
  12712. * @private
  12713. * @param {string} chr The matched character to escape.
  12714. * @returns {string} Returns the escaped character.
  12715. */
  12716. function escapeStringChar(chr) {
  12717. return '\\' + stringEscapes[chr];
  12718. }
  12719. /**
  12720. * Gets the value at `key` of `object`.
  12721. *
  12722. * @private
  12723. * @param {Object} [object] The object to query.
  12724. * @param {string} key The key of the property to get.
  12725. * @returns {*} Returns the property value.
  12726. */
  12727. function getValue(object, key) {
  12728. return object == null ? undefined : object[key];
  12729. }
  12730. /**
  12731. * Checks if `string` contains Unicode symbols.
  12732. *
  12733. * @private
  12734. * @param {string} string The string to inspect.
  12735. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  12736. */
  12737. function hasUnicode(string) {
  12738. return reHasUnicode.test(string);
  12739. }
  12740. /**
  12741. * Checks if `string` contains a word composed of Unicode symbols.
  12742. *
  12743. * @private
  12744. * @param {string} string The string to inspect.
  12745. * @returns {boolean} Returns `true` if a word is found, else `false`.
  12746. */
  12747. function hasUnicodeWord(string) {
  12748. return reHasUnicodeWord.test(string);
  12749. }
  12750. /**
  12751. * Converts `iterator` to an array.
  12752. *
  12753. * @private
  12754. * @param {Object} iterator The iterator to convert.
  12755. * @returns {Array} Returns the converted array.
  12756. */
  12757. function iteratorToArray(iterator) {
  12758. var data,
  12759. result = [];
  12760. while (!(data = iterator.next()).done) {
  12761. result.push(data.value);
  12762. }
  12763. return result;
  12764. }
  12765. /**
  12766. * Converts `map` to its key-value pairs.
  12767. *
  12768. * @private
  12769. * @param {Object} map The map to convert.
  12770. * @returns {Array} Returns the key-value pairs.
  12771. */
  12772. function mapToArray(map) {
  12773. var index = -1,
  12774. result = Array(map.size);
  12775. map.forEach(function(value, key) {
  12776. result[++index] = [key, value];
  12777. });
  12778. return result;
  12779. }
  12780. /**
  12781. * Creates a unary function that invokes `func` with its argument transformed.
  12782. *
  12783. * @private
  12784. * @param {Function} func The function to wrap.
  12785. * @param {Function} transform The argument transform.
  12786. * @returns {Function} Returns the new function.
  12787. */
  12788. function overArg(func, transform) {
  12789. return function(arg) {
  12790. return func(transform(arg));
  12791. };
  12792. }
  12793. /**
  12794. * Replaces all `placeholder` elements in `array` with an internal placeholder
  12795. * and returns an array of their indexes.
  12796. *
  12797. * @private
  12798. * @param {Array} array The array to modify.
  12799. * @param {*} placeholder The placeholder to replace.
  12800. * @returns {Array} Returns the new array of placeholder indexes.
  12801. */
  12802. function replaceHolders(array, placeholder) {
  12803. var index = -1,
  12804. length = array.length,
  12805. resIndex = 0,
  12806. result = [];
  12807. while (++index < length) {
  12808. var value = array[index];
  12809. if (value === placeholder || value === PLACEHOLDER) {
  12810. array[index] = PLACEHOLDER;
  12811. result[resIndex++] = index;
  12812. }
  12813. }
  12814. return result;
  12815. }
  12816. /**
  12817. * Converts `set` to an array of its values.
  12818. *
  12819. * @private
  12820. * @param {Object} set The set to convert.
  12821. * @returns {Array} Returns the values.
  12822. */
  12823. function setToArray(set) {
  12824. var index = -1,
  12825. result = Array(set.size);
  12826. set.forEach(function(value) {
  12827. result[++index] = value;
  12828. });
  12829. return result;
  12830. }
  12831. /**
  12832. * Converts `set` to its value-value pairs.
  12833. *
  12834. * @private
  12835. * @param {Object} set The set to convert.
  12836. * @returns {Array} Returns the value-value pairs.
  12837. */
  12838. function setToPairs(set) {
  12839. var index = -1,
  12840. result = Array(set.size);
  12841. set.forEach(function(value) {
  12842. result[++index] = [value, value];
  12843. });
  12844. return result;
  12845. }
  12846. /**
  12847. * A specialized version of `_.indexOf` which performs strict equality
  12848. * comparisons of values, i.e. `===`.
  12849. *
  12850. * @private
  12851. * @param {Array} array The array to inspect.
  12852. * @param {*} value The value to search for.
  12853. * @param {number} fromIndex The index to search from.
  12854. * @returns {number} Returns the index of the matched value, else `-1`.
  12855. */
  12856. function strictIndexOf(array, value, fromIndex) {
  12857. var index = fromIndex - 1,
  12858. length = array.length;
  12859. while (++index < length) {
  12860. if (array[index] === value) {
  12861. return index;
  12862. }
  12863. }
  12864. return -1;
  12865. }
  12866. /**
  12867. * A specialized version of `_.lastIndexOf` which performs strict equality
  12868. * comparisons of values, i.e. `===`.
  12869. *
  12870. * @private
  12871. * @param {Array} array The array to inspect.
  12872. * @param {*} value The value to search for.
  12873. * @param {number} fromIndex The index to search from.
  12874. * @returns {number} Returns the index of the matched value, else `-1`.
  12875. */
  12876. function strictLastIndexOf(array, value, fromIndex) {
  12877. var index = fromIndex + 1;
  12878. while (index--) {
  12879. if (array[index] === value) {
  12880. return index;
  12881. }
  12882. }
  12883. return index;
  12884. }
  12885. /**
  12886. * Gets the number of symbols in `string`.
  12887. *
  12888. * @private
  12889. * @param {string} string The string to inspect.
  12890. * @returns {number} Returns the string size.
  12891. */
  12892. function stringSize(string) {
  12893. return hasUnicode(string)
  12894. ? unicodeSize(string)
  12895. : asciiSize(string);
  12896. }
  12897. /**
  12898. * Converts `string` to an array.
  12899. *
  12900. * @private
  12901. * @param {string} string The string to convert.
  12902. * @returns {Array} Returns the converted array.
  12903. */
  12904. function stringToArray(string) {
  12905. return hasUnicode(string)
  12906. ? unicodeToArray(string)
  12907. : asciiToArray(string);
  12908. }
  12909. /**
  12910. * Used by `_.unescape` to convert HTML entities to characters.
  12911. *
  12912. * @private
  12913. * @param {string} chr The matched character to unescape.
  12914. * @returns {string} Returns the unescaped character.
  12915. */
  12916. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  12917. /**
  12918. * Gets the size of a Unicode `string`.
  12919. *
  12920. * @private
  12921. * @param {string} string The string inspect.
  12922. * @returns {number} Returns the string size.
  12923. */
  12924. function unicodeSize(string) {
  12925. var result = reUnicode.lastIndex = 0;
  12926. while (reUnicode.test(string)) {
  12927. ++result;
  12928. }
  12929. return result;
  12930. }
  12931. /**
  12932. * Converts a Unicode `string` to an array.
  12933. *
  12934. * @private
  12935. * @param {string} string The string to convert.
  12936. * @returns {Array} Returns the converted array.
  12937. */
  12938. function unicodeToArray(string) {
  12939. return string.match(reUnicode) || [];
  12940. }
  12941. /**
  12942. * Splits a Unicode `string` into an array of its words.
  12943. *
  12944. * @private
  12945. * @param {string} The string to inspect.
  12946. * @returns {Array} Returns the words of `string`.
  12947. */
  12948. function unicodeWords(string) {
  12949. return string.match(reUnicodeWord) || [];
  12950. }
  12951. /*--------------------------------------------------------------------------*/
  12952. /**
  12953. * Create a new pristine `lodash` function using the `context` object.
  12954. *
  12955. * @static
  12956. * @memberOf _
  12957. * @since 1.1.0
  12958. * @category Util
  12959. * @param {Object} [context=root] The context object.
  12960. * @returns {Function} Returns a new `lodash` function.
  12961. * @example
  12962. *
  12963. * _.mixin({ 'foo': _.constant('foo') });
  12964. *
  12965. * var lodash = _.runInContext();
  12966. * lodash.mixin({ 'bar': lodash.constant('bar') });
  12967. *
  12968. * _.isFunction(_.foo);
  12969. * // => true
  12970. * _.isFunction(_.bar);
  12971. * // => false
  12972. *
  12973. * lodash.isFunction(lodash.foo);
  12974. * // => false
  12975. * lodash.isFunction(lodash.bar);
  12976. * // => true
  12977. *
  12978. * // Create a suped-up `defer` in Node.js.
  12979. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  12980. */
  12981. var runInContext = (function runInContext(context) {
  12982. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  12983. /** Built-in constructor references. */
  12984. var Array = context.Array,
  12985. Date = context.Date,
  12986. Error = context.Error,
  12987. Function = context.Function,
  12988. Math = context.Math,
  12989. Object = context.Object,
  12990. RegExp = context.RegExp,
  12991. String = context.String,
  12992. TypeError = context.TypeError;
  12993. /** Used for built-in method references. */
  12994. var arrayProto = Array.prototype,
  12995. funcProto = Function.prototype,
  12996. objectProto = Object.prototype;
  12997. /** Used to detect overreaching core-js shims. */
  12998. var coreJsData = context['__core-js_shared__'];
  12999. /** Used to resolve the decompiled source of functions. */
  13000. var funcToString = funcProto.toString;
  13001. /** Used to check objects for own properties. */
  13002. var hasOwnProperty = objectProto.hasOwnProperty;
  13003. /** Used to generate unique IDs. */
  13004. var idCounter = 0;
  13005. /** Used to detect methods masquerading as native. */
  13006. var maskSrcKey = (function() {
  13007. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  13008. return uid ? ('Symbol(src)_1.' + uid) : '';
  13009. }());
  13010. /**
  13011. * Used to resolve the
  13012. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  13013. * of values.
  13014. */
  13015. var nativeObjectToString = objectProto.toString;
  13016. /** Used to infer the `Object` constructor. */
  13017. var objectCtorString = funcToString.call(Object);
  13018. /** Used to restore the original `_` reference in `_.noConflict`. */
  13019. var oldDash = root._;
  13020. /** Used to detect if a method is native. */
  13021. var reIsNative = RegExp('^' +
  13022. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  13023. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  13024. );
  13025. /** Built-in value references. */
  13026. var Buffer = moduleExports ? context.Buffer : undefined,
  13027. Symbol = context.Symbol,
  13028. Uint8Array = context.Uint8Array,
  13029. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  13030. getPrototype = overArg(Object.getPrototypeOf, Object),
  13031. objectCreate = Object.create,
  13032. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  13033. splice = arrayProto.splice,
  13034. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  13035. symIterator = Symbol ? Symbol.iterator : undefined,
  13036. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  13037. var defineProperty = (function() {
  13038. try {
  13039. var func = getNative(Object, 'defineProperty');
  13040. func({}, '', {});
  13041. return func;
  13042. } catch (e) {}
  13043. }());
  13044. /** Mocked built-ins. */
  13045. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  13046. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  13047. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  13048. /* Built-in method references for those with the same name as other `lodash` methods. */
  13049. var nativeCeil = Math.ceil,
  13050. nativeFloor = Math.floor,
  13051. nativeGetSymbols = Object.getOwnPropertySymbols,
  13052. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  13053. nativeIsFinite = context.isFinite,
  13054. nativeJoin = arrayProto.join,
  13055. nativeKeys = overArg(Object.keys, Object),
  13056. nativeMax = Math.max,
  13057. nativeMin = Math.min,
  13058. nativeNow = Date.now,
  13059. nativeParseInt = context.parseInt,
  13060. nativeRandom = Math.random,
  13061. nativeReverse = arrayProto.reverse;
  13062. /* Built-in method references that are verified to be native. */
  13063. var DataView = getNative(context, 'DataView'),
  13064. Map = getNative(context, 'Map'),
  13065. Promise = getNative(context, 'Promise'),
  13066. Set = getNative(context, 'Set'),
  13067. WeakMap = getNative(context, 'WeakMap'),
  13068. nativeCreate = getNative(Object, 'create');
  13069. /** Used to store function metadata. */
  13070. var metaMap = WeakMap && new WeakMap;
  13071. /** Used to lookup unminified function names. */
  13072. var realNames = {};
  13073. /** Used to detect maps, sets, and weakmaps. */
  13074. var dataViewCtorString = toSource(DataView),
  13075. mapCtorString = toSource(Map),
  13076. promiseCtorString = toSource(Promise),
  13077. setCtorString = toSource(Set),
  13078. weakMapCtorString = toSource(WeakMap);
  13079. /** Used to convert symbols to primitives and strings. */
  13080. var symbolProto = Symbol ? Symbol.prototype : undefined,
  13081. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  13082. symbolToString = symbolProto ? symbolProto.toString : undefined;
  13083. /*------------------------------------------------------------------------*/
  13084. /**
  13085. * Creates a `lodash` object which wraps `value` to enable implicit method
  13086. * chain sequences. Methods that operate on and return arrays, collections,
  13087. * and functions can be chained together. Methods that retrieve a single value
  13088. * or may return a primitive value will automatically end the chain sequence
  13089. * and return the unwrapped value. Otherwise, the value must be unwrapped
  13090. * with `_#value`.
  13091. *
  13092. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  13093. * enabled using `_.chain`.
  13094. *
  13095. * The execution of chained methods is lazy, that is, it's deferred until
  13096. * `_#value` is implicitly or explicitly called.
  13097. *
  13098. * Lazy evaluation allows several methods to support shortcut fusion.
  13099. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  13100. * the creation of intermediate arrays and can greatly reduce the number of
  13101. * iteratee executions. Sections of a chain sequence qualify for shortcut
  13102. * fusion if the section is applied to an array and iteratees accept only
  13103. * one argument. The heuristic for whether a section qualifies for shortcut
  13104. * fusion is subject to change.
  13105. *
  13106. * Chaining is supported in custom builds as long as the `_#value` method is
  13107. * directly or indirectly included in the build.
  13108. *
  13109. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  13110. *
  13111. * The wrapper `Array` methods are:
  13112. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  13113. *
  13114. * The wrapper `String` methods are:
  13115. * `replace` and `split`
  13116. *
  13117. * The wrapper methods that support shortcut fusion are:
  13118. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  13119. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  13120. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  13121. *
  13122. * The chainable wrapper methods are:
  13123. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  13124. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  13125. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  13126. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  13127. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  13128. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  13129. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  13130. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  13131. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  13132. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  13133. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  13134. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  13135. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  13136. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  13137. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  13138. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  13139. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  13140. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  13141. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  13142. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  13143. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  13144. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  13145. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  13146. * `zipObject`, `zipObjectDeep`, and `zipWith`
  13147. *
  13148. * The wrapper methods that are **not** chainable by default are:
  13149. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  13150. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  13151. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  13152. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  13153. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  13154. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  13155. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  13156. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  13157. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  13158. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  13159. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  13160. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  13161. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  13162. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  13163. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  13164. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  13165. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  13166. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  13167. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  13168. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  13169. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  13170. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  13171. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  13172. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  13173. * `upperFirst`, `value`, and `words`
  13174. *
  13175. * @name _
  13176. * @constructor
  13177. * @category Seq
  13178. * @param {*} value The value to wrap in a `lodash` instance.
  13179. * @returns {Object} Returns the new `lodash` wrapper instance.
  13180. * @example
  13181. *
  13182. * function square(n) {
  13183. * return n * n;
  13184. * }
  13185. *
  13186. * var wrapped = _([1, 2, 3]);
  13187. *
  13188. * // Returns an unwrapped value.
  13189. * wrapped.reduce(_.add);
  13190. * // => 6
  13191. *
  13192. * // Returns a wrapped value.
  13193. * var squares = wrapped.map(square);
  13194. *
  13195. * _.isArray(squares);
  13196. * // => false
  13197. *
  13198. * _.isArray(squares.value());
  13199. * // => true
  13200. */
  13201. function lodash(value) {
  13202. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  13203. if (value instanceof LodashWrapper) {
  13204. return value;
  13205. }
  13206. if (hasOwnProperty.call(value, '__wrapped__')) {
  13207. return wrapperClone(value);
  13208. }
  13209. }
  13210. return new LodashWrapper(value);
  13211. }
  13212. /**
  13213. * The base implementation of `_.create` without support for assigning
  13214. * properties to the created object.
  13215. *
  13216. * @private
  13217. * @param {Object} proto The object to inherit from.
  13218. * @returns {Object} Returns the new object.
  13219. */
  13220. var baseCreate = (function() {
  13221. function object() {}
  13222. return function(proto) {
  13223. if (!isObject(proto)) {
  13224. return {};
  13225. }
  13226. if (objectCreate) {
  13227. return objectCreate(proto);
  13228. }
  13229. object.prototype = proto;
  13230. var result = new object;
  13231. object.prototype = undefined;
  13232. return result;
  13233. };
  13234. }());
  13235. /**
  13236. * The function whose prototype chain sequence wrappers inherit from.
  13237. *
  13238. * @private
  13239. */
  13240. function baseLodash() {
  13241. // No operation performed.
  13242. }
  13243. /**
  13244. * The base constructor for creating `lodash` wrapper objects.
  13245. *
  13246. * @private
  13247. * @param {*} value The value to wrap.
  13248. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  13249. */
  13250. function LodashWrapper(value, chainAll) {
  13251. this.__wrapped__ = value;
  13252. this.__actions__ = [];
  13253. this.__chain__ = !!chainAll;
  13254. this.__index__ = 0;
  13255. this.__values__ = undefined;
  13256. }
  13257. /**
  13258. * By default, the template delimiters used by lodash are like those in
  13259. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  13260. * following template settings to use alternative delimiters.
  13261. *
  13262. * @static
  13263. * @memberOf _
  13264. * @type {Object}
  13265. */
  13266. lodash.templateSettings = {
  13267. /**
  13268. * Used to detect `data` property values to be HTML-escaped.
  13269. *
  13270. * @memberOf _.templateSettings
  13271. * @type {RegExp}
  13272. */
  13273. 'escape': reEscape,
  13274. /**
  13275. * Used to detect code to be evaluated.
  13276. *
  13277. * @memberOf _.templateSettings
  13278. * @type {RegExp}
  13279. */
  13280. 'evaluate': reEvaluate,
  13281. /**
  13282. * Used to detect `data` property values to inject.
  13283. *
  13284. * @memberOf _.templateSettings
  13285. * @type {RegExp}
  13286. */
  13287. 'interpolate': reInterpolate,
  13288. /**
  13289. * Used to reference the data object in the template text.
  13290. *
  13291. * @memberOf _.templateSettings
  13292. * @type {string}
  13293. */
  13294. 'variable': '',
  13295. /**
  13296. * Used to import variables into the compiled template.
  13297. *
  13298. * @memberOf _.templateSettings
  13299. * @type {Object}
  13300. */
  13301. 'imports': {
  13302. /**
  13303. * A reference to the `lodash` function.
  13304. *
  13305. * @memberOf _.templateSettings.imports
  13306. * @type {Function}
  13307. */
  13308. '_': lodash
  13309. }
  13310. };
  13311. // Ensure wrappers are instances of `baseLodash`.
  13312. lodash.prototype = baseLodash.prototype;
  13313. lodash.prototype.constructor = lodash;
  13314. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  13315. LodashWrapper.prototype.constructor = LodashWrapper;
  13316. /*------------------------------------------------------------------------*/
  13317. /**
  13318. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  13319. *
  13320. * @private
  13321. * @constructor
  13322. * @param {*} value The value to wrap.
  13323. */
  13324. function LazyWrapper(value) {
  13325. this.__wrapped__ = value;
  13326. this.__actions__ = [];
  13327. this.__dir__ = 1;
  13328. this.__filtered__ = false;
  13329. this.__iteratees__ = [];
  13330. this.__takeCount__ = MAX_ARRAY_LENGTH;
  13331. this.__views__ = [];
  13332. }
  13333. /**
  13334. * Creates a clone of the lazy wrapper object.
  13335. *
  13336. * @private
  13337. * @name clone
  13338. * @memberOf LazyWrapper
  13339. * @returns {Object} Returns the cloned `LazyWrapper` object.
  13340. */
  13341. function lazyClone() {
  13342. var result = new LazyWrapper(this.__wrapped__);
  13343. result.__actions__ = copyArray(this.__actions__);
  13344. result.__dir__ = this.__dir__;
  13345. result.__filtered__ = this.__filtered__;
  13346. result.__iteratees__ = copyArray(this.__iteratees__);
  13347. result.__takeCount__ = this.__takeCount__;
  13348. result.__views__ = copyArray(this.__views__);
  13349. return result;
  13350. }
  13351. /**
  13352. * Reverses the direction of lazy iteration.
  13353. *
  13354. * @private
  13355. * @name reverse
  13356. * @memberOf LazyWrapper
  13357. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  13358. */
  13359. function lazyReverse() {
  13360. if (this.__filtered__) {
  13361. var result = new LazyWrapper(this);
  13362. result.__dir__ = -1;
  13363. result.__filtered__ = true;
  13364. } else {
  13365. result = this.clone();
  13366. result.__dir__ *= -1;
  13367. }
  13368. return result;
  13369. }
  13370. /**
  13371. * Extracts the unwrapped value from its lazy wrapper.
  13372. *
  13373. * @private
  13374. * @name value
  13375. * @memberOf LazyWrapper
  13376. * @returns {*} Returns the unwrapped value.
  13377. */
  13378. function lazyValue() {
  13379. var array = this.__wrapped__.value(),
  13380. dir = this.__dir__,
  13381. isArr = isArray(array),
  13382. isRight = dir < 0,
  13383. arrLength = isArr ? array.length : 0,
  13384. view = getView(0, arrLength, this.__views__),
  13385. start = view.start,
  13386. end = view.end,
  13387. length = end - start,
  13388. index = isRight ? end : (start - 1),
  13389. iteratees = this.__iteratees__,
  13390. iterLength = iteratees.length,
  13391. resIndex = 0,
  13392. takeCount = nativeMin(length, this.__takeCount__);
  13393. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  13394. return baseWrapperValue(array, this.__actions__);
  13395. }
  13396. var result = [];
  13397. outer:
  13398. while (length-- && resIndex < takeCount) {
  13399. index += dir;
  13400. var iterIndex = -1,
  13401. value = array[index];
  13402. while (++iterIndex < iterLength) {
  13403. var data = iteratees[iterIndex],
  13404. iteratee = data.iteratee,
  13405. type = data.type,
  13406. computed = iteratee(value);
  13407. if (type == LAZY_MAP_FLAG) {
  13408. value = computed;
  13409. } else if (!computed) {
  13410. if (type == LAZY_FILTER_FLAG) {
  13411. continue outer;
  13412. } else {
  13413. break outer;
  13414. }
  13415. }
  13416. }
  13417. result[resIndex++] = value;
  13418. }
  13419. return result;
  13420. }
  13421. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  13422. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  13423. LazyWrapper.prototype.constructor = LazyWrapper;
  13424. /*------------------------------------------------------------------------*/
  13425. /**
  13426. * Creates a hash object.
  13427. *
  13428. * @private
  13429. * @constructor
  13430. * @param {Array} [entries] The key-value pairs to cache.
  13431. */
  13432. function Hash(entries) {
  13433. var index = -1,
  13434. length = entries == null ? 0 : entries.length;
  13435. this.clear();
  13436. while (++index < length) {
  13437. var entry = entries[index];
  13438. this.set(entry[0], entry[1]);
  13439. }
  13440. }
  13441. /**
  13442. * Removes all key-value entries from the hash.
  13443. *
  13444. * @private
  13445. * @name clear
  13446. * @memberOf Hash
  13447. */
  13448. function hashClear() {
  13449. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  13450. this.size = 0;
  13451. }
  13452. /**
  13453. * Removes `key` and its value from the hash.
  13454. *
  13455. * @private
  13456. * @name delete
  13457. * @memberOf Hash
  13458. * @param {Object} hash The hash to modify.
  13459. * @param {string} key The key of the value to remove.
  13460. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  13461. */
  13462. function hashDelete(key) {
  13463. var result = this.has(key) && delete this.__data__[key];
  13464. this.size -= result ? 1 : 0;
  13465. return result;
  13466. }
  13467. /**
  13468. * Gets the hash value for `key`.
  13469. *
  13470. * @private
  13471. * @name get
  13472. * @memberOf Hash
  13473. * @param {string} key The key of the value to get.
  13474. * @returns {*} Returns the entry value.
  13475. */
  13476. function hashGet(key) {
  13477. var data = this.__data__;
  13478. if (nativeCreate) {
  13479. var result = data[key];
  13480. return result === HASH_UNDEFINED ? undefined : result;
  13481. }
  13482. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  13483. }
  13484. /**
  13485. * Checks if a hash value for `key` exists.
  13486. *
  13487. * @private
  13488. * @name has
  13489. * @memberOf Hash
  13490. * @param {string} key The key of the entry to check.
  13491. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  13492. */
  13493. function hashHas(key) {
  13494. var data = this.__data__;
  13495. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  13496. }
  13497. /**
  13498. * Sets the hash `key` to `value`.
  13499. *
  13500. * @private
  13501. * @name set
  13502. * @memberOf Hash
  13503. * @param {string} key The key of the value to set.
  13504. * @param {*} value The value to set.
  13505. * @returns {Object} Returns the hash instance.
  13506. */
  13507. function hashSet(key, value) {
  13508. var data = this.__data__;
  13509. this.size += this.has(key) ? 0 : 1;
  13510. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  13511. return this;
  13512. }
  13513. // Add methods to `Hash`.
  13514. Hash.prototype.clear = hashClear;
  13515. Hash.prototype['delete'] = hashDelete;
  13516. Hash.prototype.get = hashGet;
  13517. Hash.prototype.has = hashHas;
  13518. Hash.prototype.set = hashSet;
  13519. /*------------------------------------------------------------------------*/
  13520. /**
  13521. * Creates an list cache object.
  13522. *
  13523. * @private
  13524. * @constructor
  13525. * @param {Array} [entries] The key-value pairs to cache.
  13526. */
  13527. function ListCache(entries) {
  13528. var index = -1,
  13529. length = entries == null ? 0 : entries.length;
  13530. this.clear();
  13531. while (++index < length) {
  13532. var entry = entries[index];
  13533. this.set(entry[0], entry[1]);
  13534. }
  13535. }
  13536. /**
  13537. * Removes all key-value entries from the list cache.
  13538. *
  13539. * @private
  13540. * @name clear
  13541. * @memberOf ListCache
  13542. */
  13543. function listCacheClear() {
  13544. this.__data__ = [];
  13545. this.size = 0;
  13546. }
  13547. /**
  13548. * Removes `key` and its value from the list cache.
  13549. *
  13550. * @private
  13551. * @name delete
  13552. * @memberOf ListCache
  13553. * @param {string} key The key of the value to remove.
  13554. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  13555. */
  13556. function listCacheDelete(key) {
  13557. var data = this.__data__,
  13558. index = assocIndexOf(data, key);
  13559. if (index < 0) {
  13560. return false;
  13561. }
  13562. var lastIndex = data.length - 1;
  13563. if (index == lastIndex) {
  13564. data.pop();
  13565. } else {
  13566. splice.call(data, index, 1);
  13567. }
  13568. --this.size;
  13569. return true;
  13570. }
  13571. /**
  13572. * Gets the list cache value for `key`.
  13573. *
  13574. * @private
  13575. * @name get
  13576. * @memberOf ListCache
  13577. * @param {string} key The key of the value to get.
  13578. * @returns {*} Returns the entry value.
  13579. */
  13580. function listCacheGet(key) {
  13581. var data = this.__data__,
  13582. index = assocIndexOf(data, key);
  13583. return index < 0 ? undefined : data[index][1];
  13584. }
  13585. /**
  13586. * Checks if a list cache value for `key` exists.
  13587. *
  13588. * @private
  13589. * @name has
  13590. * @memberOf ListCache
  13591. * @param {string} key The key of the entry to check.
  13592. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  13593. */
  13594. function listCacheHas(key) {
  13595. return assocIndexOf(this.__data__, key) > -1;
  13596. }
  13597. /**
  13598. * Sets the list cache `key` to `value`.
  13599. *
  13600. * @private
  13601. * @name set
  13602. * @memberOf ListCache
  13603. * @param {string} key The key of the value to set.
  13604. * @param {*} value The value to set.
  13605. * @returns {Object} Returns the list cache instance.
  13606. */
  13607. function listCacheSet(key, value) {
  13608. var data = this.__data__,
  13609. index = assocIndexOf(data, key);
  13610. if (index < 0) {
  13611. ++this.size;
  13612. data.push([key, value]);
  13613. } else {
  13614. data[index][1] = value;
  13615. }
  13616. return this;
  13617. }
  13618. // Add methods to `ListCache`.
  13619. ListCache.prototype.clear = listCacheClear;
  13620. ListCache.prototype['delete'] = listCacheDelete;
  13621. ListCache.prototype.get = listCacheGet;
  13622. ListCache.prototype.has = listCacheHas;
  13623. ListCache.prototype.set = listCacheSet;
  13624. /*------------------------------------------------------------------------*/
  13625. /**
  13626. * Creates a map cache object to store key-value pairs.
  13627. *
  13628. * @private
  13629. * @constructor
  13630. * @param {Array} [entries] The key-value pairs to cache.
  13631. */
  13632. function MapCache(entries) {
  13633. var index = -1,
  13634. length = entries == null ? 0 : entries.length;
  13635. this.clear();
  13636. while (++index < length) {
  13637. var entry = entries[index];
  13638. this.set(entry[0], entry[1]);
  13639. }
  13640. }
  13641. /**
  13642. * Removes all key-value entries from the map.
  13643. *
  13644. * @private
  13645. * @name clear
  13646. * @memberOf MapCache
  13647. */
  13648. function mapCacheClear() {
  13649. this.size = 0;
  13650. this.__data__ = {
  13651. 'hash': new Hash,
  13652. 'map': new (Map || ListCache),
  13653. 'string': new Hash
  13654. };
  13655. }
  13656. /**
  13657. * Removes `key` and its value from the map.
  13658. *
  13659. * @private
  13660. * @name delete
  13661. * @memberOf MapCache
  13662. * @param {string} key The key of the value to remove.
  13663. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  13664. */
  13665. function mapCacheDelete(key) {
  13666. var result = getMapData(this, key)['delete'](key);
  13667. this.size -= result ? 1 : 0;
  13668. return result;
  13669. }
  13670. /**
  13671. * Gets the map value for `key`.
  13672. *
  13673. * @private
  13674. * @name get
  13675. * @memberOf MapCache
  13676. * @param {string} key The key of the value to get.
  13677. * @returns {*} Returns the entry value.
  13678. */
  13679. function mapCacheGet(key) {
  13680. return getMapData(this, key).get(key);
  13681. }
  13682. /**
  13683. * Checks if a map value for `key` exists.
  13684. *
  13685. * @private
  13686. * @name has
  13687. * @memberOf MapCache
  13688. * @param {string} key The key of the entry to check.
  13689. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  13690. */
  13691. function mapCacheHas(key) {
  13692. return getMapData(this, key).has(key);
  13693. }
  13694. /**
  13695. * Sets the map `key` to `value`.
  13696. *
  13697. * @private
  13698. * @name set
  13699. * @memberOf MapCache
  13700. * @param {string} key The key of the value to set.
  13701. * @param {*} value The value to set.
  13702. * @returns {Object} Returns the map cache instance.
  13703. */
  13704. function mapCacheSet(key, value) {
  13705. var data = getMapData(this, key),
  13706. size = data.size;
  13707. data.set(key, value);
  13708. this.size += data.size == size ? 0 : 1;
  13709. return this;
  13710. }
  13711. // Add methods to `MapCache`.
  13712. MapCache.prototype.clear = mapCacheClear;
  13713. MapCache.prototype['delete'] = mapCacheDelete;
  13714. MapCache.prototype.get = mapCacheGet;
  13715. MapCache.prototype.has = mapCacheHas;
  13716. MapCache.prototype.set = mapCacheSet;
  13717. /*------------------------------------------------------------------------*/
  13718. /**
  13719. *
  13720. * Creates an array cache object to store unique values.
  13721. *
  13722. * @private
  13723. * @constructor
  13724. * @param {Array} [values] The values to cache.
  13725. */
  13726. function SetCache(values) {
  13727. var index = -1,
  13728. length = values == null ? 0 : values.length;
  13729. this.__data__ = new MapCache;
  13730. while (++index < length) {
  13731. this.add(values[index]);
  13732. }
  13733. }
  13734. /**
  13735. * Adds `value` to the array cache.
  13736. *
  13737. * @private
  13738. * @name add
  13739. * @memberOf SetCache
  13740. * @alias push
  13741. * @param {*} value The value to cache.
  13742. * @returns {Object} Returns the cache instance.
  13743. */
  13744. function setCacheAdd(value) {
  13745. this.__data__.set(value, HASH_UNDEFINED);
  13746. return this;
  13747. }
  13748. /**
  13749. * Checks if `value` is in the array cache.
  13750. *
  13751. * @private
  13752. * @name has
  13753. * @memberOf SetCache
  13754. * @param {*} value The value to search for.
  13755. * @returns {number} Returns `true` if `value` is found, else `false`.
  13756. */
  13757. function setCacheHas(value) {
  13758. return this.__data__.has(value);
  13759. }
  13760. // Add methods to `SetCache`.
  13761. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  13762. SetCache.prototype.has = setCacheHas;
  13763. /*------------------------------------------------------------------------*/
  13764. /**
  13765. * Creates a stack cache object to store key-value pairs.
  13766. *
  13767. * @private
  13768. * @constructor
  13769. * @param {Array} [entries] The key-value pairs to cache.
  13770. */
  13771. function Stack(entries) {
  13772. var data = this.__data__ = new ListCache(entries);
  13773. this.size = data.size;
  13774. }
  13775. /**
  13776. * Removes all key-value entries from the stack.
  13777. *
  13778. * @private
  13779. * @name clear
  13780. * @memberOf Stack
  13781. */
  13782. function stackClear() {
  13783. this.__data__ = new ListCache;
  13784. this.size = 0;
  13785. }
  13786. /**
  13787. * Removes `key` and its value from the stack.
  13788. *
  13789. * @private
  13790. * @name delete
  13791. * @memberOf Stack
  13792. * @param {string} key The key of the value to remove.
  13793. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  13794. */
  13795. function stackDelete(key) {
  13796. var data = this.__data__,
  13797. result = data['delete'](key);
  13798. this.size = data.size;
  13799. return result;
  13800. }
  13801. /**
  13802. * Gets the stack value for `key`.
  13803. *
  13804. * @private
  13805. * @name get
  13806. * @memberOf Stack
  13807. * @param {string} key The key of the value to get.
  13808. * @returns {*} Returns the entry value.
  13809. */
  13810. function stackGet(key) {
  13811. return this.__data__.get(key);
  13812. }
  13813. /**
  13814. * Checks if a stack value for `key` exists.
  13815. *
  13816. * @private
  13817. * @name has
  13818. * @memberOf Stack
  13819. * @param {string} key The key of the entry to check.
  13820. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  13821. */
  13822. function stackHas(key) {
  13823. return this.__data__.has(key);
  13824. }
  13825. /**
  13826. * Sets the stack `key` to `value`.
  13827. *
  13828. * @private
  13829. * @name set
  13830. * @memberOf Stack
  13831. * @param {string} key The key of the value to set.
  13832. * @param {*} value The value to set.
  13833. * @returns {Object} Returns the stack cache instance.
  13834. */
  13835. function stackSet(key, value) {
  13836. var data = this.__data__;
  13837. if (data instanceof ListCache) {
  13838. var pairs = data.__data__;
  13839. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  13840. pairs.push([key, value]);
  13841. this.size = ++data.size;
  13842. return this;
  13843. }
  13844. data = this.__data__ = new MapCache(pairs);
  13845. }
  13846. data.set(key, value);
  13847. this.size = data.size;
  13848. return this;
  13849. }
  13850. // Add methods to `Stack`.
  13851. Stack.prototype.clear = stackClear;
  13852. Stack.prototype['delete'] = stackDelete;
  13853. Stack.prototype.get = stackGet;
  13854. Stack.prototype.has = stackHas;
  13855. Stack.prototype.set = stackSet;
  13856. /*------------------------------------------------------------------------*/
  13857. /**
  13858. * Creates an array of the enumerable property names of the array-like `value`.
  13859. *
  13860. * @private
  13861. * @param {*} value The value to query.
  13862. * @param {boolean} inherited Specify returning inherited property names.
  13863. * @returns {Array} Returns the array of property names.
  13864. */
  13865. function arrayLikeKeys(value, inherited) {
  13866. var isArr = isArray(value),
  13867. isArg = !isArr && isArguments(value),
  13868. isBuff = !isArr && !isArg && isBuffer(value),
  13869. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  13870. skipIndexes = isArr || isArg || isBuff || isType,
  13871. result = skipIndexes ? baseTimes(value.length, String) : [],
  13872. length = result.length;
  13873. for (var key in value) {
  13874. if ((inherited || hasOwnProperty.call(value, key)) &&
  13875. !(skipIndexes && (
  13876. // Safari 9 has enumerable `arguments.length` in strict mode.
  13877. key == 'length' ||
  13878. // Node.js 0.10 has enumerable non-index properties on buffers.
  13879. (isBuff && (key == 'offset' || key == 'parent')) ||
  13880. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  13881. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  13882. // Skip index properties.
  13883. isIndex(key, length)
  13884. ))) {
  13885. result.push(key);
  13886. }
  13887. }
  13888. return result;
  13889. }
  13890. /**
  13891. * A specialized version of `_.sample` for arrays.
  13892. *
  13893. * @private
  13894. * @param {Array} array The array to sample.
  13895. * @returns {*} Returns the random element.
  13896. */
  13897. function arraySample(array) {
  13898. var length = array.length;
  13899. return length ? array[baseRandom(0, length - 1)] : undefined;
  13900. }
  13901. /**
  13902. * A specialized version of `_.sampleSize` for arrays.
  13903. *
  13904. * @private
  13905. * @param {Array} array The array to sample.
  13906. * @param {number} n The number of elements to sample.
  13907. * @returns {Array} Returns the random elements.
  13908. */
  13909. function arraySampleSize(array, n) {
  13910. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  13911. }
  13912. /**
  13913. * A specialized version of `_.shuffle` for arrays.
  13914. *
  13915. * @private
  13916. * @param {Array} array The array to shuffle.
  13917. * @returns {Array} Returns the new shuffled array.
  13918. */
  13919. function arrayShuffle(array) {
  13920. return shuffleSelf(copyArray(array));
  13921. }
  13922. /**
  13923. * This function is like `assignValue` except that it doesn't assign
  13924. * `undefined` values.
  13925. *
  13926. * @private
  13927. * @param {Object} object The object to modify.
  13928. * @param {string} key The key of the property to assign.
  13929. * @param {*} value The value to assign.
  13930. */
  13931. function assignMergeValue(object, key, value) {
  13932. if ((value !== undefined && !eq(object[key], value)) ||
  13933. (value === undefined && !(key in object))) {
  13934. baseAssignValue(object, key, value);
  13935. }
  13936. }
  13937. /**
  13938. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  13939. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  13940. * for equality comparisons.
  13941. *
  13942. * @private
  13943. * @param {Object} object The object to modify.
  13944. * @param {string} key The key of the property to assign.
  13945. * @param {*} value The value to assign.
  13946. */
  13947. function assignValue(object, key, value) {
  13948. var objValue = object[key];
  13949. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  13950. (value === undefined && !(key in object))) {
  13951. baseAssignValue(object, key, value);
  13952. }
  13953. }
  13954. /**
  13955. * Gets the index at which the `key` is found in `array` of key-value pairs.
  13956. *
  13957. * @private
  13958. * @param {Array} array The array to inspect.
  13959. * @param {*} key The key to search for.
  13960. * @returns {number} Returns the index of the matched value, else `-1`.
  13961. */
  13962. function assocIndexOf(array, key) {
  13963. var length = array.length;
  13964. while (length--) {
  13965. if (eq(array[length][0], key)) {
  13966. return length;
  13967. }
  13968. }
  13969. return -1;
  13970. }
  13971. /**
  13972. * Aggregates elements of `collection` on `accumulator` with keys transformed
  13973. * by `iteratee` and values set by `setter`.
  13974. *
  13975. * @private
  13976. * @param {Array|Object} collection The collection to iterate over.
  13977. * @param {Function} setter The function to set `accumulator` values.
  13978. * @param {Function} iteratee The iteratee to transform keys.
  13979. * @param {Object} accumulator The initial aggregated object.
  13980. * @returns {Function} Returns `accumulator`.
  13981. */
  13982. function baseAggregator(collection, setter, iteratee, accumulator) {
  13983. baseEach(collection, function(value, key, collection) {
  13984. setter(accumulator, value, iteratee(value), collection);
  13985. });
  13986. return accumulator;
  13987. }
  13988. /**
  13989. * The base implementation of `_.assign` without support for multiple sources
  13990. * or `customizer` functions.
  13991. *
  13992. * @private
  13993. * @param {Object} object The destination object.
  13994. * @param {Object} source The source object.
  13995. * @returns {Object} Returns `object`.
  13996. */
  13997. function baseAssign(object, source) {
  13998. return object && copyObject(source, keys(source), object);
  13999. }
  14000. /**
  14001. * The base implementation of `_.assignIn` without support for multiple sources
  14002. * or `customizer` functions.
  14003. *
  14004. * @private
  14005. * @param {Object} object The destination object.
  14006. * @param {Object} source The source object.
  14007. * @returns {Object} Returns `object`.
  14008. */
  14009. function baseAssignIn(object, source) {
  14010. return object && copyObject(source, keysIn(source), object);
  14011. }
  14012. /**
  14013. * The base implementation of `assignValue` and `assignMergeValue` without
  14014. * value checks.
  14015. *
  14016. * @private
  14017. * @param {Object} object The object to modify.
  14018. * @param {string} key The key of the property to assign.
  14019. * @param {*} value The value to assign.
  14020. */
  14021. function baseAssignValue(object, key, value) {
  14022. if (key == '__proto__' && defineProperty) {
  14023. defineProperty(object, key, {
  14024. 'configurable': true,
  14025. 'enumerable': true,
  14026. 'value': value,
  14027. 'writable': true
  14028. });
  14029. } else {
  14030. object[key] = value;
  14031. }
  14032. }
  14033. /**
  14034. * The base implementation of `_.at` without support for individual paths.
  14035. *
  14036. * @private
  14037. * @param {Object} object The object to iterate over.
  14038. * @param {string[]} paths The property paths to pick.
  14039. * @returns {Array} Returns the picked elements.
  14040. */
  14041. function baseAt(object, paths) {
  14042. var index = -1,
  14043. length = paths.length,
  14044. result = Array(length),
  14045. skip = object == null;
  14046. while (++index < length) {
  14047. result[index] = skip ? undefined : get(object, paths[index]);
  14048. }
  14049. return result;
  14050. }
  14051. /**
  14052. * The base implementation of `_.clamp` which doesn't coerce arguments.
  14053. *
  14054. * @private
  14055. * @param {number} number The number to clamp.
  14056. * @param {number} [lower] The lower bound.
  14057. * @param {number} upper The upper bound.
  14058. * @returns {number} Returns the clamped number.
  14059. */
  14060. function baseClamp(number, lower, upper) {
  14061. if (number === number) {
  14062. if (upper !== undefined) {
  14063. number = number <= upper ? number : upper;
  14064. }
  14065. if (lower !== undefined) {
  14066. number = number >= lower ? number : lower;
  14067. }
  14068. }
  14069. return number;
  14070. }
  14071. /**
  14072. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  14073. * traversed objects.
  14074. *
  14075. * @private
  14076. * @param {*} value The value to clone.
  14077. * @param {boolean} bitmask The bitmask flags.
  14078. * 1 - Deep clone
  14079. * 2 - Flatten inherited properties
  14080. * 4 - Clone symbols
  14081. * @param {Function} [customizer] The function to customize cloning.
  14082. * @param {string} [key] The key of `value`.
  14083. * @param {Object} [object] The parent object of `value`.
  14084. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  14085. * @returns {*} Returns the cloned value.
  14086. */
  14087. function baseClone(value, bitmask, customizer, key, object, stack) {
  14088. var result,
  14089. isDeep = bitmask & CLONE_DEEP_FLAG,
  14090. isFlat = bitmask & CLONE_FLAT_FLAG,
  14091. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  14092. if (customizer) {
  14093. result = object ? customizer(value, key, object, stack) : customizer(value);
  14094. }
  14095. if (result !== undefined) {
  14096. return result;
  14097. }
  14098. if (!isObject(value)) {
  14099. return value;
  14100. }
  14101. var isArr = isArray(value);
  14102. if (isArr) {
  14103. result = initCloneArray(value);
  14104. if (!isDeep) {
  14105. return copyArray(value, result);
  14106. }
  14107. } else {
  14108. var tag = getTag(value),
  14109. isFunc = tag == funcTag || tag == genTag;
  14110. if (isBuffer(value)) {
  14111. return cloneBuffer(value, isDeep);
  14112. }
  14113. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  14114. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  14115. if (!isDeep) {
  14116. return isFlat
  14117. ? copySymbolsIn(value, baseAssignIn(result, value))
  14118. : copySymbols(value, baseAssign(result, value));
  14119. }
  14120. } else {
  14121. if (!cloneableTags[tag]) {
  14122. return object ? value : {};
  14123. }
  14124. result = initCloneByTag(value, tag, baseClone, isDeep);
  14125. }
  14126. }
  14127. // Check for circular references and return its corresponding clone.
  14128. stack || (stack = new Stack);
  14129. var stacked = stack.get(value);
  14130. if (stacked) {
  14131. return stacked;
  14132. }
  14133. stack.set(value, result);
  14134. var keysFunc = isFull
  14135. ? (isFlat ? getAllKeysIn : getAllKeys)
  14136. : (isFlat ? keysIn : keys);
  14137. var props = isArr ? undefined : keysFunc(value);
  14138. arrayEach(props || value, function(subValue, key) {
  14139. if (props) {
  14140. key = subValue;
  14141. subValue = value[key];
  14142. }
  14143. // Recursively populate clone (susceptible to call stack limits).
  14144. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  14145. });
  14146. return result;
  14147. }
  14148. /**
  14149. * The base implementation of `_.conforms` which doesn't clone `source`.
  14150. *
  14151. * @private
  14152. * @param {Object} source The object of property predicates to conform to.
  14153. * @returns {Function} Returns the new spec function.
  14154. */
  14155. function baseConforms(source) {
  14156. var props = keys(source);
  14157. return function(object) {
  14158. return baseConformsTo(object, source, props);
  14159. };
  14160. }
  14161. /**
  14162. * The base implementation of `_.conformsTo` which accepts `props` to check.
  14163. *
  14164. * @private
  14165. * @param {Object} object The object to inspect.
  14166. * @param {Object} source The object of property predicates to conform to.
  14167. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  14168. */
  14169. function baseConformsTo(object, source, props) {
  14170. var length = props.length;
  14171. if (object == null) {
  14172. return !length;
  14173. }
  14174. object = Object(object);
  14175. while (length--) {
  14176. var key = props[length],
  14177. predicate = source[key],
  14178. value = object[key];
  14179. if ((value === undefined && !(key in object)) || !predicate(value)) {
  14180. return false;
  14181. }
  14182. }
  14183. return true;
  14184. }
  14185. /**
  14186. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  14187. * to provide to `func`.
  14188. *
  14189. * @private
  14190. * @param {Function} func The function to delay.
  14191. * @param {number} wait The number of milliseconds to delay invocation.
  14192. * @param {Array} args The arguments to provide to `func`.
  14193. * @returns {number|Object} Returns the timer id or timeout object.
  14194. */
  14195. function baseDelay(func, wait, args) {
  14196. if (typeof func != 'function') {
  14197. throw new TypeError(FUNC_ERROR_TEXT);
  14198. }
  14199. return setTimeout(function() { func.apply(undefined, args); }, wait);
  14200. }
  14201. /**
  14202. * The base implementation of methods like `_.difference` without support
  14203. * for excluding multiple arrays or iteratee shorthands.
  14204. *
  14205. * @private
  14206. * @param {Array} array The array to inspect.
  14207. * @param {Array} values The values to exclude.
  14208. * @param {Function} [iteratee] The iteratee invoked per element.
  14209. * @param {Function} [comparator] The comparator invoked per element.
  14210. * @returns {Array} Returns the new array of filtered values.
  14211. */
  14212. function baseDifference(array, values, iteratee, comparator) {
  14213. var index = -1,
  14214. includes = arrayIncludes,
  14215. isCommon = true,
  14216. length = array.length,
  14217. result = [],
  14218. valuesLength = values.length;
  14219. if (!length) {
  14220. return result;
  14221. }
  14222. if (iteratee) {
  14223. values = arrayMap(values, baseUnary(iteratee));
  14224. }
  14225. if (comparator) {
  14226. includes = arrayIncludesWith;
  14227. isCommon = false;
  14228. }
  14229. else if (values.length >= LARGE_ARRAY_SIZE) {
  14230. includes = cacheHas;
  14231. isCommon = false;
  14232. values = new SetCache(values);
  14233. }
  14234. outer:
  14235. while (++index < length) {
  14236. var value = array[index],
  14237. computed = iteratee == null ? value : iteratee(value);
  14238. value = (comparator || value !== 0) ? value : 0;
  14239. if (isCommon && computed === computed) {
  14240. var valuesIndex = valuesLength;
  14241. while (valuesIndex--) {
  14242. if (values[valuesIndex] === computed) {
  14243. continue outer;
  14244. }
  14245. }
  14246. result.push(value);
  14247. }
  14248. else if (!includes(values, computed, comparator)) {
  14249. result.push(value);
  14250. }
  14251. }
  14252. return result;
  14253. }
  14254. /**
  14255. * The base implementation of `_.forEach` without support for iteratee shorthands.
  14256. *
  14257. * @private
  14258. * @param {Array|Object} collection The collection to iterate over.
  14259. * @param {Function} iteratee The function invoked per iteration.
  14260. * @returns {Array|Object} Returns `collection`.
  14261. */
  14262. var baseEach = createBaseEach(baseForOwn);
  14263. /**
  14264. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  14265. *
  14266. * @private
  14267. * @param {Array|Object} collection The collection to iterate over.
  14268. * @param {Function} iteratee The function invoked per iteration.
  14269. * @returns {Array|Object} Returns `collection`.
  14270. */
  14271. var baseEachRight = createBaseEach(baseForOwnRight, true);
  14272. /**
  14273. * The base implementation of `_.every` without support for iteratee shorthands.
  14274. *
  14275. * @private
  14276. * @param {Array|Object} collection The collection to iterate over.
  14277. * @param {Function} predicate The function invoked per iteration.
  14278. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  14279. * else `false`
  14280. */
  14281. function baseEvery(collection, predicate) {
  14282. var result = true;
  14283. baseEach(collection, function(value, index, collection) {
  14284. result = !!predicate(value, index, collection);
  14285. return result;
  14286. });
  14287. return result;
  14288. }
  14289. /**
  14290. * The base implementation of methods like `_.max` and `_.min` which accepts a
  14291. * `comparator` to determine the extremum value.
  14292. *
  14293. * @private
  14294. * @param {Array} array The array to iterate over.
  14295. * @param {Function} iteratee The iteratee invoked per iteration.
  14296. * @param {Function} comparator The comparator used to compare values.
  14297. * @returns {*} Returns the extremum value.
  14298. */
  14299. function baseExtremum(array, iteratee, comparator) {
  14300. var index = -1,
  14301. length = array.length;
  14302. while (++index < length) {
  14303. var value = array[index],
  14304. current = iteratee(value);
  14305. if (current != null && (computed === undefined
  14306. ? (current === current && !isSymbol(current))
  14307. : comparator(current, computed)
  14308. )) {
  14309. var computed = current,
  14310. result = value;
  14311. }
  14312. }
  14313. return result;
  14314. }
  14315. /**
  14316. * The base implementation of `_.fill` without an iteratee call guard.
  14317. *
  14318. * @private
  14319. * @param {Array} array The array to fill.
  14320. * @param {*} value The value to fill `array` with.
  14321. * @param {number} [start=0] The start position.
  14322. * @param {number} [end=array.length] The end position.
  14323. * @returns {Array} Returns `array`.
  14324. */
  14325. function baseFill(array, value, start, end) {
  14326. var length = array.length;
  14327. start = toInteger(start);
  14328. if (start < 0) {
  14329. start = -start > length ? 0 : (length + start);
  14330. }
  14331. end = (end === undefined || end > length) ? length : toInteger(end);
  14332. if (end < 0) {
  14333. end += length;
  14334. }
  14335. end = start > end ? 0 : toLength(end);
  14336. while (start < end) {
  14337. array[start++] = value;
  14338. }
  14339. return array;
  14340. }
  14341. /**
  14342. * The base implementation of `_.filter` without support for iteratee shorthands.
  14343. *
  14344. * @private
  14345. * @param {Array|Object} collection The collection to iterate over.
  14346. * @param {Function} predicate The function invoked per iteration.
  14347. * @returns {Array} Returns the new filtered array.
  14348. */
  14349. function baseFilter(collection, predicate) {
  14350. var result = [];
  14351. baseEach(collection, function(value, index, collection) {
  14352. if (predicate(value, index, collection)) {
  14353. result.push(value);
  14354. }
  14355. });
  14356. return result;
  14357. }
  14358. /**
  14359. * The base implementation of `_.flatten` with support for restricting flattening.
  14360. *
  14361. * @private
  14362. * @param {Array} array The array to flatten.
  14363. * @param {number} depth The maximum recursion depth.
  14364. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  14365. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  14366. * @param {Array} [result=[]] The initial result value.
  14367. * @returns {Array} Returns the new flattened array.
  14368. */
  14369. function baseFlatten(array, depth, predicate, isStrict, result) {
  14370. var index = -1,
  14371. length = array.length;
  14372. predicate || (predicate = isFlattenable);
  14373. result || (result = []);
  14374. while (++index < length) {
  14375. var value = array[index];
  14376. if (depth > 0 && predicate(value)) {
  14377. if (depth > 1) {
  14378. // Recursively flatten arrays (susceptible to call stack limits).
  14379. baseFlatten(value, depth - 1, predicate, isStrict, result);
  14380. } else {
  14381. arrayPush(result, value);
  14382. }
  14383. } else if (!isStrict) {
  14384. result[result.length] = value;
  14385. }
  14386. }
  14387. return result;
  14388. }
  14389. /**
  14390. * The base implementation of `baseForOwn` which iterates over `object`
  14391. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  14392. * Iteratee functions may exit iteration early by explicitly returning `false`.
  14393. *
  14394. * @private
  14395. * @param {Object} object The object to iterate over.
  14396. * @param {Function} iteratee The function invoked per iteration.
  14397. * @param {Function} keysFunc The function to get the keys of `object`.
  14398. * @returns {Object} Returns `object`.
  14399. */
  14400. var baseFor = createBaseFor();
  14401. /**
  14402. * This function is like `baseFor` except that it iterates over properties
  14403. * in the opposite order.
  14404. *
  14405. * @private
  14406. * @param {Object} object The object to iterate over.
  14407. * @param {Function} iteratee The function invoked per iteration.
  14408. * @param {Function} keysFunc The function to get the keys of `object`.
  14409. * @returns {Object} Returns `object`.
  14410. */
  14411. var baseForRight = createBaseFor(true);
  14412. /**
  14413. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  14414. *
  14415. * @private
  14416. * @param {Object} object The object to iterate over.
  14417. * @param {Function} iteratee The function invoked per iteration.
  14418. * @returns {Object} Returns `object`.
  14419. */
  14420. function baseForOwn(object, iteratee) {
  14421. return object && baseFor(object, iteratee, keys);
  14422. }
  14423. /**
  14424. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  14425. *
  14426. * @private
  14427. * @param {Object} object The object to iterate over.
  14428. * @param {Function} iteratee The function invoked per iteration.
  14429. * @returns {Object} Returns `object`.
  14430. */
  14431. function baseForOwnRight(object, iteratee) {
  14432. return object && baseForRight(object, iteratee, keys);
  14433. }
  14434. /**
  14435. * The base implementation of `_.functions` which creates an array of
  14436. * `object` function property names filtered from `props`.
  14437. *
  14438. * @private
  14439. * @param {Object} object The object to inspect.
  14440. * @param {Array} props The property names to filter.
  14441. * @returns {Array} Returns the function names.
  14442. */
  14443. function baseFunctions(object, props) {
  14444. return arrayFilter(props, function(key) {
  14445. return isFunction(object[key]);
  14446. });
  14447. }
  14448. /**
  14449. * The base implementation of `_.get` without support for default values.
  14450. *
  14451. * @private
  14452. * @param {Object} object The object to query.
  14453. * @param {Array|string} path The path of the property to get.
  14454. * @returns {*} Returns the resolved value.
  14455. */
  14456. function baseGet(object, path) {
  14457. path = castPath(path, object);
  14458. var index = 0,
  14459. length = path.length;
  14460. while (object != null && index < length) {
  14461. object = object[toKey(path[index++])];
  14462. }
  14463. return (index && index == length) ? object : undefined;
  14464. }
  14465. /**
  14466. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  14467. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  14468. * symbols of `object`.
  14469. *
  14470. * @private
  14471. * @param {Object} object The object to query.
  14472. * @param {Function} keysFunc The function to get the keys of `object`.
  14473. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  14474. * @returns {Array} Returns the array of property names and symbols.
  14475. */
  14476. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  14477. var result = keysFunc(object);
  14478. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  14479. }
  14480. /**
  14481. * The base implementation of `getTag` without fallbacks for buggy environments.
  14482. *
  14483. * @private
  14484. * @param {*} value The value to query.
  14485. * @returns {string} Returns the `toStringTag`.
  14486. */
  14487. function baseGetTag(value) {
  14488. if (value == null) {
  14489. return value === undefined ? undefinedTag : nullTag;
  14490. }
  14491. return (symToStringTag && symToStringTag in Object(value))
  14492. ? getRawTag(value)
  14493. : objectToString(value);
  14494. }
  14495. /**
  14496. * The base implementation of `_.gt` which doesn't coerce arguments.
  14497. *
  14498. * @private
  14499. * @param {*} value The value to compare.
  14500. * @param {*} other The other value to compare.
  14501. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  14502. * else `false`.
  14503. */
  14504. function baseGt(value, other) {
  14505. return value > other;
  14506. }
  14507. /**
  14508. * The base implementation of `_.has` without support for deep paths.
  14509. *
  14510. * @private
  14511. * @param {Object} [object] The object to query.
  14512. * @param {Array|string} key The key to check.
  14513. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  14514. */
  14515. function baseHas(object, key) {
  14516. return object != null && hasOwnProperty.call(object, key);
  14517. }
  14518. /**
  14519. * The base implementation of `_.hasIn` without support for deep paths.
  14520. *
  14521. * @private
  14522. * @param {Object} [object] The object to query.
  14523. * @param {Array|string} key The key to check.
  14524. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  14525. */
  14526. function baseHasIn(object, key) {
  14527. return object != null && key in Object(object);
  14528. }
  14529. /**
  14530. * The base implementation of `_.inRange` which doesn't coerce arguments.
  14531. *
  14532. * @private
  14533. * @param {number} number The number to check.
  14534. * @param {number} start The start of the range.
  14535. * @param {number} end The end of the range.
  14536. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  14537. */
  14538. function baseInRange(number, start, end) {
  14539. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  14540. }
  14541. /**
  14542. * The base implementation of methods like `_.intersection`, without support
  14543. * for iteratee shorthands, that accepts an array of arrays to inspect.
  14544. *
  14545. * @private
  14546. * @param {Array} arrays The arrays to inspect.
  14547. * @param {Function} [iteratee] The iteratee invoked per element.
  14548. * @param {Function} [comparator] The comparator invoked per element.
  14549. * @returns {Array} Returns the new array of shared values.
  14550. */
  14551. function baseIntersection(arrays, iteratee, comparator) {
  14552. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  14553. length = arrays[0].length,
  14554. othLength = arrays.length,
  14555. othIndex = othLength,
  14556. caches = Array(othLength),
  14557. maxLength = Infinity,
  14558. result = [];
  14559. while (othIndex--) {
  14560. var array = arrays[othIndex];
  14561. if (othIndex && iteratee) {
  14562. array = arrayMap(array, baseUnary(iteratee));
  14563. }
  14564. maxLength = nativeMin(array.length, maxLength);
  14565. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  14566. ? new SetCache(othIndex && array)
  14567. : undefined;
  14568. }
  14569. array = arrays[0];
  14570. var index = -1,
  14571. seen = caches[0];
  14572. outer:
  14573. while (++index < length && result.length < maxLength) {
  14574. var value = array[index],
  14575. computed = iteratee ? iteratee(value) : value;
  14576. value = (comparator || value !== 0) ? value : 0;
  14577. if (!(seen
  14578. ? cacheHas(seen, computed)
  14579. : includes(result, computed, comparator)
  14580. )) {
  14581. othIndex = othLength;
  14582. while (--othIndex) {
  14583. var cache = caches[othIndex];
  14584. if (!(cache
  14585. ? cacheHas(cache, computed)
  14586. : includes(arrays[othIndex], computed, comparator))
  14587. ) {
  14588. continue outer;
  14589. }
  14590. }
  14591. if (seen) {
  14592. seen.push(computed);
  14593. }
  14594. result.push(value);
  14595. }
  14596. }
  14597. return result;
  14598. }
  14599. /**
  14600. * The base implementation of `_.invert` and `_.invertBy` which inverts
  14601. * `object` with values transformed by `iteratee` and set by `setter`.
  14602. *
  14603. * @private
  14604. * @param {Object} object The object to iterate over.
  14605. * @param {Function} setter The function to set `accumulator` values.
  14606. * @param {Function} iteratee The iteratee to transform values.
  14607. * @param {Object} accumulator The initial inverted object.
  14608. * @returns {Function} Returns `accumulator`.
  14609. */
  14610. function baseInverter(object, setter, iteratee, accumulator) {
  14611. baseForOwn(object, function(value, key, object) {
  14612. setter(accumulator, iteratee(value), key, object);
  14613. });
  14614. return accumulator;
  14615. }
  14616. /**
  14617. * The base implementation of `_.invoke` without support for individual
  14618. * method arguments.
  14619. *
  14620. * @private
  14621. * @param {Object} object The object to query.
  14622. * @param {Array|string} path The path of the method to invoke.
  14623. * @param {Array} args The arguments to invoke the method with.
  14624. * @returns {*} Returns the result of the invoked method.
  14625. */
  14626. function baseInvoke(object, path, args) {
  14627. path = castPath(path, object);
  14628. object = parent(object, path);
  14629. var func = object == null ? object : object[toKey(last(path))];
  14630. return func == null ? undefined : apply(func, object, args);
  14631. }
  14632. /**
  14633. * The base implementation of `_.isArguments`.
  14634. *
  14635. * @private
  14636. * @param {*} value The value to check.
  14637. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  14638. */
  14639. function baseIsArguments(value) {
  14640. return isObjectLike(value) && baseGetTag(value) == argsTag;
  14641. }
  14642. /**
  14643. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  14644. *
  14645. * @private
  14646. * @param {*} value The value to check.
  14647. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  14648. */
  14649. function baseIsArrayBuffer(value) {
  14650. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  14651. }
  14652. /**
  14653. * The base implementation of `_.isDate` without Node.js optimizations.
  14654. *
  14655. * @private
  14656. * @param {*} value The value to check.
  14657. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  14658. */
  14659. function baseIsDate(value) {
  14660. return isObjectLike(value) && baseGetTag(value) == dateTag;
  14661. }
  14662. /**
  14663. * The base implementation of `_.isEqual` which supports partial comparisons
  14664. * and tracks traversed objects.
  14665. *
  14666. * @private
  14667. * @param {*} value The value to compare.
  14668. * @param {*} other The other value to compare.
  14669. * @param {boolean} bitmask The bitmask flags.
  14670. * 1 - Unordered comparison
  14671. * 2 - Partial comparison
  14672. * @param {Function} [customizer] The function to customize comparisons.
  14673. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  14674. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  14675. */
  14676. function baseIsEqual(value, other, bitmask, customizer, stack) {
  14677. if (value === other) {
  14678. return true;
  14679. }
  14680. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  14681. return value !== value && other !== other;
  14682. }
  14683. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  14684. }
  14685. /**
  14686. * A specialized version of `baseIsEqual` for arrays and objects which performs
  14687. * deep comparisons and tracks traversed objects enabling objects with circular
  14688. * references to be compared.
  14689. *
  14690. * @private
  14691. * @param {Object} object The object to compare.
  14692. * @param {Object} other The other object to compare.
  14693. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  14694. * @param {Function} customizer The function to customize comparisons.
  14695. * @param {Function} equalFunc The function to determine equivalents of values.
  14696. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  14697. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  14698. */
  14699. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  14700. var objIsArr = isArray(object),
  14701. othIsArr = isArray(other),
  14702. objTag = objIsArr ? arrayTag : getTag(object),
  14703. othTag = othIsArr ? arrayTag : getTag(other);
  14704. objTag = objTag == argsTag ? objectTag : objTag;
  14705. othTag = othTag == argsTag ? objectTag : othTag;
  14706. var objIsObj = objTag == objectTag,
  14707. othIsObj = othTag == objectTag,
  14708. isSameTag = objTag == othTag;
  14709. if (isSameTag && isBuffer(object)) {
  14710. if (!isBuffer(other)) {
  14711. return false;
  14712. }
  14713. objIsArr = true;
  14714. objIsObj = false;
  14715. }
  14716. if (isSameTag && !objIsObj) {
  14717. stack || (stack = new Stack);
  14718. return (objIsArr || isTypedArray(object))
  14719. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  14720. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  14721. }
  14722. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  14723. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  14724. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  14725. if (objIsWrapped || othIsWrapped) {
  14726. var objUnwrapped = objIsWrapped ? object.value() : object,
  14727. othUnwrapped = othIsWrapped ? other.value() : other;
  14728. stack || (stack = new Stack);
  14729. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  14730. }
  14731. }
  14732. if (!isSameTag) {
  14733. return false;
  14734. }
  14735. stack || (stack = new Stack);
  14736. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  14737. }
  14738. /**
  14739. * The base implementation of `_.isMap` without Node.js optimizations.
  14740. *
  14741. * @private
  14742. * @param {*} value The value to check.
  14743. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  14744. */
  14745. function baseIsMap(value) {
  14746. return isObjectLike(value) && getTag(value) == mapTag;
  14747. }
  14748. /**
  14749. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  14750. *
  14751. * @private
  14752. * @param {Object} object The object to inspect.
  14753. * @param {Object} source The object of property values to match.
  14754. * @param {Array} matchData The property names, values, and compare flags to match.
  14755. * @param {Function} [customizer] The function to customize comparisons.
  14756. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  14757. */
  14758. function baseIsMatch(object, source, matchData, customizer) {
  14759. var index = matchData.length,
  14760. length = index,
  14761. noCustomizer = !customizer;
  14762. if (object == null) {
  14763. return !length;
  14764. }
  14765. object = Object(object);
  14766. while (index--) {
  14767. var data = matchData[index];
  14768. if ((noCustomizer && data[2])
  14769. ? data[1] !== object[data[0]]
  14770. : !(data[0] in object)
  14771. ) {
  14772. return false;
  14773. }
  14774. }
  14775. while (++index < length) {
  14776. data = matchData[index];
  14777. var key = data[0],
  14778. objValue = object[key],
  14779. srcValue = data[1];
  14780. if (noCustomizer && data[2]) {
  14781. if (objValue === undefined && !(key in object)) {
  14782. return false;
  14783. }
  14784. } else {
  14785. var stack = new Stack;
  14786. if (customizer) {
  14787. var result = customizer(objValue, srcValue, key, object, source, stack);
  14788. }
  14789. if (!(result === undefined
  14790. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  14791. : result
  14792. )) {
  14793. return false;
  14794. }
  14795. }
  14796. }
  14797. return true;
  14798. }
  14799. /**
  14800. * The base implementation of `_.isNative` without bad shim checks.
  14801. *
  14802. * @private
  14803. * @param {*} value The value to check.
  14804. * @returns {boolean} Returns `true` if `value` is a native function,
  14805. * else `false`.
  14806. */
  14807. function baseIsNative(value) {
  14808. if (!isObject(value) || isMasked(value)) {
  14809. return false;
  14810. }
  14811. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  14812. return pattern.test(toSource(value));
  14813. }
  14814. /**
  14815. * The base implementation of `_.isRegExp` without Node.js optimizations.
  14816. *
  14817. * @private
  14818. * @param {*} value The value to check.
  14819. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  14820. */
  14821. function baseIsRegExp(value) {
  14822. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  14823. }
  14824. /**
  14825. * The base implementation of `_.isSet` without Node.js optimizations.
  14826. *
  14827. * @private
  14828. * @param {*} value The value to check.
  14829. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  14830. */
  14831. function baseIsSet(value) {
  14832. return isObjectLike(value) && getTag(value) == setTag;
  14833. }
  14834. /**
  14835. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  14836. *
  14837. * @private
  14838. * @param {*} value The value to check.
  14839. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  14840. */
  14841. function baseIsTypedArray(value) {
  14842. return isObjectLike(value) &&
  14843. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  14844. }
  14845. /**
  14846. * The base implementation of `_.iteratee`.
  14847. *
  14848. * @private
  14849. * @param {*} [value=_.identity] The value to convert to an iteratee.
  14850. * @returns {Function} Returns the iteratee.
  14851. */
  14852. function baseIteratee(value) {
  14853. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  14854. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  14855. if (typeof value == 'function') {
  14856. return value;
  14857. }
  14858. if (value == null) {
  14859. return identity;
  14860. }
  14861. if (typeof value == 'object') {
  14862. return isArray(value)
  14863. ? baseMatchesProperty(value[0], value[1])
  14864. : baseMatches(value);
  14865. }
  14866. return property(value);
  14867. }
  14868. /**
  14869. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  14870. *
  14871. * @private
  14872. * @param {Object} object The object to query.
  14873. * @returns {Array} Returns the array of property names.
  14874. */
  14875. function baseKeys(object) {
  14876. if (!isPrototype(object)) {
  14877. return nativeKeys(object);
  14878. }
  14879. var result = [];
  14880. for (var key in Object(object)) {
  14881. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  14882. result.push(key);
  14883. }
  14884. }
  14885. return result;
  14886. }
  14887. /**
  14888. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  14889. *
  14890. * @private
  14891. * @param {Object} object The object to query.
  14892. * @returns {Array} Returns the array of property names.
  14893. */
  14894. function baseKeysIn(object) {
  14895. if (!isObject(object)) {
  14896. return nativeKeysIn(object);
  14897. }
  14898. var isProto = isPrototype(object),
  14899. result = [];
  14900. for (var key in object) {
  14901. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  14902. result.push(key);
  14903. }
  14904. }
  14905. return result;
  14906. }
  14907. /**
  14908. * The base implementation of `_.lt` which doesn't coerce arguments.
  14909. *
  14910. * @private
  14911. * @param {*} value The value to compare.
  14912. * @param {*} other The other value to compare.
  14913. * @returns {boolean} Returns `true` if `value` is less than `other`,
  14914. * else `false`.
  14915. */
  14916. function baseLt(value, other) {
  14917. return value < other;
  14918. }
  14919. /**
  14920. * The base implementation of `_.map` without support for iteratee shorthands.
  14921. *
  14922. * @private
  14923. * @param {Array|Object} collection The collection to iterate over.
  14924. * @param {Function} iteratee The function invoked per iteration.
  14925. * @returns {Array} Returns the new mapped array.
  14926. */
  14927. function baseMap(collection, iteratee) {
  14928. var index = -1,
  14929. result = isArrayLike(collection) ? Array(collection.length) : [];
  14930. baseEach(collection, function(value, key, collection) {
  14931. result[++index] = iteratee(value, key, collection);
  14932. });
  14933. return result;
  14934. }
  14935. /**
  14936. * The base implementation of `_.matches` which doesn't clone `source`.
  14937. *
  14938. * @private
  14939. * @param {Object} source The object of property values to match.
  14940. * @returns {Function} Returns the new spec function.
  14941. */
  14942. function baseMatches(source) {
  14943. var matchData = getMatchData(source);
  14944. if (matchData.length == 1 && matchData[0][2]) {
  14945. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  14946. }
  14947. return function(object) {
  14948. return object === source || baseIsMatch(object, source, matchData);
  14949. };
  14950. }
  14951. /**
  14952. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  14953. *
  14954. * @private
  14955. * @param {string} path The path of the property to get.
  14956. * @param {*} srcValue The value to match.
  14957. * @returns {Function} Returns the new spec function.
  14958. */
  14959. function baseMatchesProperty(path, srcValue) {
  14960. if (isKey(path) && isStrictComparable(srcValue)) {
  14961. return matchesStrictComparable(toKey(path), srcValue);
  14962. }
  14963. return function(object) {
  14964. var objValue = get(object, path);
  14965. return (objValue === undefined && objValue === srcValue)
  14966. ? hasIn(object, path)
  14967. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  14968. };
  14969. }
  14970. /**
  14971. * The base implementation of `_.merge` without support for multiple sources.
  14972. *
  14973. * @private
  14974. * @param {Object} object The destination object.
  14975. * @param {Object} source The source object.
  14976. * @param {number} srcIndex The index of `source`.
  14977. * @param {Function} [customizer] The function to customize merged values.
  14978. * @param {Object} [stack] Tracks traversed source values and their merged
  14979. * counterparts.
  14980. */
  14981. function baseMerge(object, source, srcIndex, customizer, stack) {
  14982. if (object === source) {
  14983. return;
  14984. }
  14985. baseFor(source, function(srcValue, key) {
  14986. if (isObject(srcValue)) {
  14987. stack || (stack = new Stack);
  14988. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  14989. }
  14990. else {
  14991. var newValue = customizer
  14992. ? customizer(object[key], srcValue, (key + ''), object, source, stack)
  14993. : undefined;
  14994. if (newValue === undefined) {
  14995. newValue = srcValue;
  14996. }
  14997. assignMergeValue(object, key, newValue);
  14998. }
  14999. }, keysIn);
  15000. }
  15001. /**
  15002. * A specialized version of `baseMerge` for arrays and objects which performs
  15003. * deep merges and tracks traversed objects enabling objects with circular
  15004. * references to be merged.
  15005. *
  15006. * @private
  15007. * @param {Object} object The destination object.
  15008. * @param {Object} source The source object.
  15009. * @param {string} key The key of the value to merge.
  15010. * @param {number} srcIndex The index of `source`.
  15011. * @param {Function} mergeFunc The function to merge values.
  15012. * @param {Function} [customizer] The function to customize assigned values.
  15013. * @param {Object} [stack] Tracks traversed source values and their merged
  15014. * counterparts.
  15015. */
  15016. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  15017. var objValue = object[key],
  15018. srcValue = source[key],
  15019. stacked = stack.get(srcValue);
  15020. if (stacked) {
  15021. assignMergeValue(object, key, stacked);
  15022. return;
  15023. }
  15024. var newValue = customizer
  15025. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  15026. : undefined;
  15027. var isCommon = newValue === undefined;
  15028. if (isCommon) {
  15029. var isArr = isArray(srcValue),
  15030. isBuff = !isArr && isBuffer(srcValue),
  15031. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  15032. newValue = srcValue;
  15033. if (isArr || isBuff || isTyped) {
  15034. if (isArray(objValue)) {
  15035. newValue = objValue;
  15036. }
  15037. else if (isArrayLikeObject(objValue)) {
  15038. newValue = copyArray(objValue);
  15039. }
  15040. else if (isBuff) {
  15041. isCommon = false;
  15042. newValue = cloneBuffer(srcValue, true);
  15043. }
  15044. else if (isTyped) {
  15045. isCommon = false;
  15046. newValue = cloneTypedArray(srcValue, true);
  15047. }
  15048. else {
  15049. newValue = [];
  15050. }
  15051. }
  15052. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  15053. newValue = objValue;
  15054. if (isArguments(objValue)) {
  15055. newValue = toPlainObject(objValue);
  15056. }
  15057. else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
  15058. newValue = initCloneObject(srcValue);
  15059. }
  15060. }
  15061. else {
  15062. isCommon = false;
  15063. }
  15064. }
  15065. if (isCommon) {
  15066. // Recursively merge objects and arrays (susceptible to call stack limits).
  15067. stack.set(srcValue, newValue);
  15068. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  15069. stack['delete'](srcValue);
  15070. }
  15071. assignMergeValue(object, key, newValue);
  15072. }
  15073. /**
  15074. * The base implementation of `_.nth` which doesn't coerce arguments.
  15075. *
  15076. * @private
  15077. * @param {Array} array The array to query.
  15078. * @param {number} n The index of the element to return.
  15079. * @returns {*} Returns the nth element of `array`.
  15080. */
  15081. function baseNth(array, n) {
  15082. var length = array.length;
  15083. if (!length) {
  15084. return;
  15085. }
  15086. n += n < 0 ? length : 0;
  15087. return isIndex(n, length) ? array[n] : undefined;
  15088. }
  15089. /**
  15090. * The base implementation of `_.orderBy` without param guards.
  15091. *
  15092. * @private
  15093. * @param {Array|Object} collection The collection to iterate over.
  15094. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  15095. * @param {string[]} orders The sort orders of `iteratees`.
  15096. * @returns {Array} Returns the new sorted array.
  15097. */
  15098. function baseOrderBy(collection, iteratees, orders) {
  15099. var index = -1;
  15100. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  15101. var result = baseMap(collection, function(value, key, collection) {
  15102. var criteria = arrayMap(iteratees, function(iteratee) {
  15103. return iteratee(value);
  15104. });
  15105. return { 'criteria': criteria, 'index': ++index, 'value': value };
  15106. });
  15107. return baseSortBy(result, function(object, other) {
  15108. return compareMultiple(object, other, orders);
  15109. });
  15110. }
  15111. /**
  15112. * The base implementation of `_.pick` without support for individual
  15113. * property identifiers.
  15114. *
  15115. * @private
  15116. * @param {Object} object The source object.
  15117. * @param {string[]} paths The property paths to pick.
  15118. * @returns {Object} Returns the new object.
  15119. */
  15120. function basePick(object, paths) {
  15121. return basePickBy(object, paths, function(value, path) {
  15122. return hasIn(object, path);
  15123. });
  15124. }
  15125. /**
  15126. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  15127. *
  15128. * @private
  15129. * @param {Object} object The source object.
  15130. * @param {string[]} paths The property paths to pick.
  15131. * @param {Function} predicate The function invoked per property.
  15132. * @returns {Object} Returns the new object.
  15133. */
  15134. function basePickBy(object, paths, predicate) {
  15135. var index = -1,
  15136. length = paths.length,
  15137. result = {};
  15138. while (++index < length) {
  15139. var path = paths[index],
  15140. value = baseGet(object, path);
  15141. if (predicate(value, path)) {
  15142. baseSet(result, castPath(path, object), value);
  15143. }
  15144. }
  15145. return result;
  15146. }
  15147. /**
  15148. * A specialized version of `baseProperty` which supports deep paths.
  15149. *
  15150. * @private
  15151. * @param {Array|string} path The path of the property to get.
  15152. * @returns {Function} Returns the new accessor function.
  15153. */
  15154. function basePropertyDeep(path) {
  15155. return function(object) {
  15156. return baseGet(object, path);
  15157. };
  15158. }
  15159. /**
  15160. * The base implementation of `_.pullAllBy` without support for iteratee
  15161. * shorthands.
  15162. *
  15163. * @private
  15164. * @param {Array} array The array to modify.
  15165. * @param {Array} values The values to remove.
  15166. * @param {Function} [iteratee] The iteratee invoked per element.
  15167. * @param {Function} [comparator] The comparator invoked per element.
  15168. * @returns {Array} Returns `array`.
  15169. */
  15170. function basePullAll(array, values, iteratee, comparator) {
  15171. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  15172. index = -1,
  15173. length = values.length,
  15174. seen = array;
  15175. if (array === values) {
  15176. values = copyArray(values);
  15177. }
  15178. if (iteratee) {
  15179. seen = arrayMap(array, baseUnary(iteratee));
  15180. }
  15181. while (++index < length) {
  15182. var fromIndex = 0,
  15183. value = values[index],
  15184. computed = iteratee ? iteratee(value) : value;
  15185. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  15186. if (seen !== array) {
  15187. splice.call(seen, fromIndex, 1);
  15188. }
  15189. splice.call(array, fromIndex, 1);
  15190. }
  15191. }
  15192. return array;
  15193. }
  15194. /**
  15195. * The base implementation of `_.pullAt` without support for individual
  15196. * indexes or capturing the removed elements.
  15197. *
  15198. * @private
  15199. * @param {Array} array The array to modify.
  15200. * @param {number[]} indexes The indexes of elements to remove.
  15201. * @returns {Array} Returns `array`.
  15202. */
  15203. function basePullAt(array, indexes) {
  15204. var length = array ? indexes.length : 0,
  15205. lastIndex = length - 1;
  15206. while (length--) {
  15207. var index = indexes[length];
  15208. if (length == lastIndex || index !== previous) {
  15209. var previous = index;
  15210. if (isIndex(index)) {
  15211. splice.call(array, index, 1);
  15212. } else {
  15213. baseUnset(array, index);
  15214. }
  15215. }
  15216. }
  15217. return array;
  15218. }
  15219. /**
  15220. * The base implementation of `_.random` without support for returning
  15221. * floating-point numbers.
  15222. *
  15223. * @private
  15224. * @param {number} lower The lower bound.
  15225. * @param {number} upper The upper bound.
  15226. * @returns {number} Returns the random number.
  15227. */
  15228. function baseRandom(lower, upper) {
  15229. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  15230. }
  15231. /**
  15232. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  15233. * coerce arguments.
  15234. *
  15235. * @private
  15236. * @param {number} start The start of the range.
  15237. * @param {number} end The end of the range.
  15238. * @param {number} step The value to increment or decrement by.
  15239. * @param {boolean} [fromRight] Specify iterating from right to left.
  15240. * @returns {Array} Returns the range of numbers.
  15241. */
  15242. function baseRange(start, end, step, fromRight) {
  15243. var index = -1,
  15244. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  15245. result = Array(length);
  15246. while (length--) {
  15247. result[fromRight ? length : ++index] = start;
  15248. start += step;
  15249. }
  15250. return result;
  15251. }
  15252. /**
  15253. * The base implementation of `_.repeat` which doesn't coerce arguments.
  15254. *
  15255. * @private
  15256. * @param {string} string The string to repeat.
  15257. * @param {number} n The number of times to repeat the string.
  15258. * @returns {string} Returns the repeated string.
  15259. */
  15260. function baseRepeat(string, n) {
  15261. var result = '';
  15262. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  15263. return result;
  15264. }
  15265. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  15266. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  15267. do {
  15268. if (n % 2) {
  15269. result += string;
  15270. }
  15271. n = nativeFloor(n / 2);
  15272. if (n) {
  15273. string += string;
  15274. }
  15275. } while (n);
  15276. return result;
  15277. }
  15278. /**
  15279. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  15280. *
  15281. * @private
  15282. * @param {Function} func The function to apply a rest parameter to.
  15283. * @param {number} [start=func.length-1] The start position of the rest parameter.
  15284. * @returns {Function} Returns the new function.
  15285. */
  15286. function baseRest(func, start) {
  15287. return setToString(overRest(func, start, identity), func + '');
  15288. }
  15289. /**
  15290. * The base implementation of `_.sample`.
  15291. *
  15292. * @private
  15293. * @param {Array|Object} collection The collection to sample.
  15294. * @returns {*} Returns the random element.
  15295. */
  15296. function baseSample(collection) {
  15297. return arraySample(values(collection));
  15298. }
  15299. /**
  15300. * The base implementation of `_.sampleSize` without param guards.
  15301. *
  15302. * @private
  15303. * @param {Array|Object} collection The collection to sample.
  15304. * @param {number} n The number of elements to sample.
  15305. * @returns {Array} Returns the random elements.
  15306. */
  15307. function baseSampleSize(collection, n) {
  15308. var array = values(collection);
  15309. return shuffleSelf(array, baseClamp(n, 0, array.length));
  15310. }
  15311. /**
  15312. * The base implementation of `_.set`.
  15313. *
  15314. * @private
  15315. * @param {Object} object The object to modify.
  15316. * @param {Array|string} path The path of the property to set.
  15317. * @param {*} value The value to set.
  15318. * @param {Function} [customizer] The function to customize path creation.
  15319. * @returns {Object} Returns `object`.
  15320. */
  15321. function baseSet(object, path, value, customizer) {
  15322. if (!isObject(object)) {
  15323. return object;
  15324. }
  15325. path = castPath(path, object);
  15326. var index = -1,
  15327. length = path.length,
  15328. lastIndex = length - 1,
  15329. nested = object;
  15330. while (nested != null && ++index < length) {
  15331. var key = toKey(path[index]),
  15332. newValue = value;
  15333. if (index != lastIndex) {
  15334. var objValue = nested[key];
  15335. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  15336. if (newValue === undefined) {
  15337. newValue = isObject(objValue)
  15338. ? objValue
  15339. : (isIndex(path[index + 1]) ? [] : {});
  15340. }
  15341. }
  15342. assignValue(nested, key, newValue);
  15343. nested = nested[key];
  15344. }
  15345. return object;
  15346. }
  15347. /**
  15348. * The base implementation of `setData` without support for hot loop shorting.
  15349. *
  15350. * @private
  15351. * @param {Function} func The function to associate metadata with.
  15352. * @param {*} data The metadata.
  15353. * @returns {Function} Returns `func`.
  15354. */
  15355. var baseSetData = !metaMap ? identity : function(func, data) {
  15356. metaMap.set(func, data);
  15357. return func;
  15358. };
  15359. /**
  15360. * The base implementation of `setToString` without support for hot loop shorting.
  15361. *
  15362. * @private
  15363. * @param {Function} func The function to modify.
  15364. * @param {Function} string The `toString` result.
  15365. * @returns {Function} Returns `func`.
  15366. */
  15367. var baseSetToString = !defineProperty ? identity : function(func, string) {
  15368. return defineProperty(func, 'toString', {
  15369. 'configurable': true,
  15370. 'enumerable': false,
  15371. 'value': constant(string),
  15372. 'writable': true
  15373. });
  15374. };
  15375. /**
  15376. * The base implementation of `_.shuffle`.
  15377. *
  15378. * @private
  15379. * @param {Array|Object} collection The collection to shuffle.
  15380. * @returns {Array} Returns the new shuffled array.
  15381. */
  15382. function baseShuffle(collection) {
  15383. return shuffleSelf(values(collection));
  15384. }
  15385. /**
  15386. * The base implementation of `_.slice` without an iteratee call guard.
  15387. *
  15388. * @private
  15389. * @param {Array} array The array to slice.
  15390. * @param {number} [start=0] The start position.
  15391. * @param {number} [end=array.length] The end position.
  15392. * @returns {Array} Returns the slice of `array`.
  15393. */
  15394. function baseSlice(array, start, end) {
  15395. var index = -1,
  15396. length = array.length;
  15397. if (start < 0) {
  15398. start = -start > length ? 0 : (length + start);
  15399. }
  15400. end = end > length ? length : end;
  15401. if (end < 0) {
  15402. end += length;
  15403. }
  15404. length = start > end ? 0 : ((end - start) >>> 0);
  15405. start >>>= 0;
  15406. var result = Array(length);
  15407. while (++index < length) {
  15408. result[index] = array[index + start];
  15409. }
  15410. return result;
  15411. }
  15412. /**
  15413. * The base implementation of `_.some` without support for iteratee shorthands.
  15414. *
  15415. * @private
  15416. * @param {Array|Object} collection The collection to iterate over.
  15417. * @param {Function} predicate The function invoked per iteration.
  15418. * @returns {boolean} Returns `true` if any element passes the predicate check,
  15419. * else `false`.
  15420. */
  15421. function baseSome(collection, predicate) {
  15422. var result;
  15423. baseEach(collection, function(value, index, collection) {
  15424. result = predicate(value, index, collection);
  15425. return !result;
  15426. });
  15427. return !!result;
  15428. }
  15429. /**
  15430. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  15431. * performs a binary search of `array` to determine the index at which `value`
  15432. * should be inserted into `array` in order to maintain its sort order.
  15433. *
  15434. * @private
  15435. * @param {Array} array The sorted array to inspect.
  15436. * @param {*} value The value to evaluate.
  15437. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  15438. * @returns {number} Returns the index at which `value` should be inserted
  15439. * into `array`.
  15440. */
  15441. function baseSortedIndex(array, value, retHighest) {
  15442. var low = 0,
  15443. high = array == null ? low : array.length;
  15444. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  15445. while (low < high) {
  15446. var mid = (low + high) >>> 1,
  15447. computed = array[mid];
  15448. if (computed !== null && !isSymbol(computed) &&
  15449. (retHighest ? (computed <= value) : (computed < value))) {
  15450. low = mid + 1;
  15451. } else {
  15452. high = mid;
  15453. }
  15454. }
  15455. return high;
  15456. }
  15457. return baseSortedIndexBy(array, value, identity, retHighest);
  15458. }
  15459. /**
  15460. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  15461. * which invokes `iteratee` for `value` and each element of `array` to compute
  15462. * their sort ranking. The iteratee is invoked with one argument; (value).
  15463. *
  15464. * @private
  15465. * @param {Array} array The sorted array to inspect.
  15466. * @param {*} value The value to evaluate.
  15467. * @param {Function} iteratee The iteratee invoked per element.
  15468. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  15469. * @returns {number} Returns the index at which `value` should be inserted
  15470. * into `array`.
  15471. */
  15472. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  15473. value = iteratee(value);
  15474. var low = 0,
  15475. high = array == null ? 0 : array.length,
  15476. valIsNaN = value !== value,
  15477. valIsNull = value === null,
  15478. valIsSymbol = isSymbol(value),
  15479. valIsUndefined = value === undefined;
  15480. while (low < high) {
  15481. var mid = nativeFloor((low + high) / 2),
  15482. computed = iteratee(array[mid]),
  15483. othIsDefined = computed !== undefined,
  15484. othIsNull = computed === null,
  15485. othIsReflexive = computed === computed,
  15486. othIsSymbol = isSymbol(computed);
  15487. if (valIsNaN) {
  15488. var setLow = retHighest || othIsReflexive;
  15489. } else if (valIsUndefined) {
  15490. setLow = othIsReflexive && (retHighest || othIsDefined);
  15491. } else if (valIsNull) {
  15492. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  15493. } else if (valIsSymbol) {
  15494. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  15495. } else if (othIsNull || othIsSymbol) {
  15496. setLow = false;
  15497. } else {
  15498. setLow = retHighest ? (computed <= value) : (computed < value);
  15499. }
  15500. if (setLow) {
  15501. low = mid + 1;
  15502. } else {
  15503. high = mid;
  15504. }
  15505. }
  15506. return nativeMin(high, MAX_ARRAY_INDEX);
  15507. }
  15508. /**
  15509. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  15510. * support for iteratee shorthands.
  15511. *
  15512. * @private
  15513. * @param {Array} array The array to inspect.
  15514. * @param {Function} [iteratee] The iteratee invoked per element.
  15515. * @returns {Array} Returns the new duplicate free array.
  15516. */
  15517. function baseSortedUniq(array, iteratee) {
  15518. var index = -1,
  15519. length = array.length,
  15520. resIndex = 0,
  15521. result = [];
  15522. while (++index < length) {
  15523. var value = array[index],
  15524. computed = iteratee ? iteratee(value) : value;
  15525. if (!index || !eq(computed, seen)) {
  15526. var seen = computed;
  15527. result[resIndex++] = value === 0 ? 0 : value;
  15528. }
  15529. }
  15530. return result;
  15531. }
  15532. /**
  15533. * The base implementation of `_.toNumber` which doesn't ensure correct
  15534. * conversions of binary, hexadecimal, or octal string values.
  15535. *
  15536. * @private
  15537. * @param {*} value The value to process.
  15538. * @returns {number} Returns the number.
  15539. */
  15540. function baseToNumber(value) {
  15541. if (typeof value == 'number') {
  15542. return value;
  15543. }
  15544. if (isSymbol(value)) {
  15545. return NAN;
  15546. }
  15547. return +value;
  15548. }
  15549. /**
  15550. * The base implementation of `_.toString` which doesn't convert nullish
  15551. * values to empty strings.
  15552. *
  15553. * @private
  15554. * @param {*} value The value to process.
  15555. * @returns {string} Returns the string.
  15556. */
  15557. function baseToString(value) {
  15558. // Exit early for strings to avoid a performance hit in some environments.
  15559. if (typeof value == 'string') {
  15560. return value;
  15561. }
  15562. if (isArray(value)) {
  15563. // Recursively convert values (susceptible to call stack limits).
  15564. return arrayMap(value, baseToString) + '';
  15565. }
  15566. if (isSymbol(value)) {
  15567. return symbolToString ? symbolToString.call(value) : '';
  15568. }
  15569. var result = (value + '');
  15570. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  15571. }
  15572. /**
  15573. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  15574. *
  15575. * @private
  15576. * @param {Array} array The array to inspect.
  15577. * @param {Function} [iteratee] The iteratee invoked per element.
  15578. * @param {Function} [comparator] The comparator invoked per element.
  15579. * @returns {Array} Returns the new duplicate free array.
  15580. */
  15581. function baseUniq(array, iteratee, comparator) {
  15582. var index = -1,
  15583. includes = arrayIncludes,
  15584. length = array.length,
  15585. isCommon = true,
  15586. result = [],
  15587. seen = result;
  15588. if (comparator) {
  15589. isCommon = false;
  15590. includes = arrayIncludesWith;
  15591. }
  15592. else if (length >= LARGE_ARRAY_SIZE) {
  15593. var set = iteratee ? null : createSet(array);
  15594. if (set) {
  15595. return setToArray(set);
  15596. }
  15597. isCommon = false;
  15598. includes = cacheHas;
  15599. seen = new SetCache;
  15600. }
  15601. else {
  15602. seen = iteratee ? [] : result;
  15603. }
  15604. outer:
  15605. while (++index < length) {
  15606. var value = array[index],
  15607. computed = iteratee ? iteratee(value) : value;
  15608. value = (comparator || value !== 0) ? value : 0;
  15609. if (isCommon && computed === computed) {
  15610. var seenIndex = seen.length;
  15611. while (seenIndex--) {
  15612. if (seen[seenIndex] === computed) {
  15613. continue outer;
  15614. }
  15615. }
  15616. if (iteratee) {
  15617. seen.push(computed);
  15618. }
  15619. result.push(value);
  15620. }
  15621. else if (!includes(seen, computed, comparator)) {
  15622. if (seen !== result) {
  15623. seen.push(computed);
  15624. }
  15625. result.push(value);
  15626. }
  15627. }
  15628. return result;
  15629. }
  15630. /**
  15631. * The base implementation of `_.unset`.
  15632. *
  15633. * @private
  15634. * @param {Object} object The object to modify.
  15635. * @param {Array|string} path The property path to unset.
  15636. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  15637. */
  15638. function baseUnset(object, path) {
  15639. path = castPath(path, object);
  15640. object = parent(object, path);
  15641. return object == null || delete object[toKey(last(path))];
  15642. }
  15643. /**
  15644. * The base implementation of `_.update`.
  15645. *
  15646. * @private
  15647. * @param {Object} object The object to modify.
  15648. * @param {Array|string} path The path of the property to update.
  15649. * @param {Function} updater The function to produce the updated value.
  15650. * @param {Function} [customizer] The function to customize path creation.
  15651. * @returns {Object} Returns `object`.
  15652. */
  15653. function baseUpdate(object, path, updater, customizer) {
  15654. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  15655. }
  15656. /**
  15657. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  15658. * without support for iteratee shorthands.
  15659. *
  15660. * @private
  15661. * @param {Array} array The array to query.
  15662. * @param {Function} predicate The function invoked per iteration.
  15663. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  15664. * @param {boolean} [fromRight] Specify iterating from right to left.
  15665. * @returns {Array} Returns the slice of `array`.
  15666. */
  15667. function baseWhile(array, predicate, isDrop, fromRight) {
  15668. var length = array.length,
  15669. index = fromRight ? length : -1;
  15670. while ((fromRight ? index-- : ++index < length) &&
  15671. predicate(array[index], index, array)) {}
  15672. return isDrop
  15673. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  15674. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  15675. }
  15676. /**
  15677. * The base implementation of `wrapperValue` which returns the result of
  15678. * performing a sequence of actions on the unwrapped `value`, where each
  15679. * successive action is supplied the return value of the previous.
  15680. *
  15681. * @private
  15682. * @param {*} value The unwrapped value.
  15683. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  15684. * @returns {*} Returns the resolved value.
  15685. */
  15686. function baseWrapperValue(value, actions) {
  15687. var result = value;
  15688. if (result instanceof LazyWrapper) {
  15689. result = result.value();
  15690. }
  15691. return arrayReduce(actions, function(result, action) {
  15692. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  15693. }, result);
  15694. }
  15695. /**
  15696. * The base implementation of methods like `_.xor`, without support for
  15697. * iteratee shorthands, that accepts an array of arrays to inspect.
  15698. *
  15699. * @private
  15700. * @param {Array} arrays The arrays to inspect.
  15701. * @param {Function} [iteratee] The iteratee invoked per element.
  15702. * @param {Function} [comparator] The comparator invoked per element.
  15703. * @returns {Array} Returns the new array of values.
  15704. */
  15705. function baseXor(arrays, iteratee, comparator) {
  15706. var length = arrays.length;
  15707. if (length < 2) {
  15708. return length ? baseUniq(arrays[0]) : [];
  15709. }
  15710. var index = -1,
  15711. result = Array(length);
  15712. while (++index < length) {
  15713. var array = arrays[index],
  15714. othIndex = -1;
  15715. while (++othIndex < length) {
  15716. if (othIndex != index) {
  15717. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  15718. }
  15719. }
  15720. }
  15721. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  15722. }
  15723. /**
  15724. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  15725. *
  15726. * @private
  15727. * @param {Array} props The property identifiers.
  15728. * @param {Array} values The property values.
  15729. * @param {Function} assignFunc The function to assign values.
  15730. * @returns {Object} Returns the new object.
  15731. */
  15732. function baseZipObject(props, values, assignFunc) {
  15733. var index = -1,
  15734. length = props.length,
  15735. valsLength = values.length,
  15736. result = {};
  15737. while (++index < length) {
  15738. var value = index < valsLength ? values[index] : undefined;
  15739. assignFunc(result, props[index], value);
  15740. }
  15741. return result;
  15742. }
  15743. /**
  15744. * Casts `value` to an empty array if it's not an array like object.
  15745. *
  15746. * @private
  15747. * @param {*} value The value to inspect.
  15748. * @returns {Array|Object} Returns the cast array-like object.
  15749. */
  15750. function castArrayLikeObject(value) {
  15751. return isArrayLikeObject(value) ? value : [];
  15752. }
  15753. /**
  15754. * Casts `value` to `identity` if it's not a function.
  15755. *
  15756. * @private
  15757. * @param {*} value The value to inspect.
  15758. * @returns {Function} Returns cast function.
  15759. */
  15760. function castFunction(value) {
  15761. return typeof value == 'function' ? value : identity;
  15762. }
  15763. /**
  15764. * Casts `value` to a path array if it's not one.
  15765. *
  15766. * @private
  15767. * @param {*} value The value to inspect.
  15768. * @param {Object} [object] The object to query keys on.
  15769. * @returns {Array} Returns the cast property path array.
  15770. */
  15771. function castPath(value, object) {
  15772. if (isArray(value)) {
  15773. return value;
  15774. }
  15775. return isKey(value, object) ? [value] : stringToPath(toString(value));
  15776. }
  15777. /**
  15778. * A `baseRest` alias which can be replaced with `identity` by module
  15779. * replacement plugins.
  15780. *
  15781. * @private
  15782. * @type {Function}
  15783. * @param {Function} func The function to apply a rest parameter to.
  15784. * @returns {Function} Returns the new function.
  15785. */
  15786. var castRest = baseRest;
  15787. /**
  15788. * Casts `array` to a slice if it's needed.
  15789. *
  15790. * @private
  15791. * @param {Array} array The array to inspect.
  15792. * @param {number} start The start position.
  15793. * @param {number} [end=array.length] The end position.
  15794. * @returns {Array} Returns the cast slice.
  15795. */
  15796. function castSlice(array, start, end) {
  15797. var length = array.length;
  15798. end = end === undefined ? length : end;
  15799. return (!start && end >= length) ? array : baseSlice(array, start, end);
  15800. }
  15801. /**
  15802. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  15803. *
  15804. * @private
  15805. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  15806. */
  15807. var clearTimeout = ctxClearTimeout || function(id) {
  15808. return root.clearTimeout(id);
  15809. };
  15810. /**
  15811. * Creates a clone of `buffer`.
  15812. *
  15813. * @private
  15814. * @param {Buffer} buffer The buffer to clone.
  15815. * @param {boolean} [isDeep] Specify a deep clone.
  15816. * @returns {Buffer} Returns the cloned buffer.
  15817. */
  15818. function cloneBuffer(buffer, isDeep) {
  15819. if (isDeep) {
  15820. return buffer.slice();
  15821. }
  15822. var length = buffer.length,
  15823. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  15824. buffer.copy(result);
  15825. return result;
  15826. }
  15827. /**
  15828. * Creates a clone of `arrayBuffer`.
  15829. *
  15830. * @private
  15831. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  15832. * @returns {ArrayBuffer} Returns the cloned array buffer.
  15833. */
  15834. function cloneArrayBuffer(arrayBuffer) {
  15835. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  15836. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  15837. return result;
  15838. }
  15839. /**
  15840. * Creates a clone of `dataView`.
  15841. *
  15842. * @private
  15843. * @param {Object} dataView The data view to clone.
  15844. * @param {boolean} [isDeep] Specify a deep clone.
  15845. * @returns {Object} Returns the cloned data view.
  15846. */
  15847. function cloneDataView(dataView, isDeep) {
  15848. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  15849. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  15850. }
  15851. /**
  15852. * Creates a clone of `map`.
  15853. *
  15854. * @private
  15855. * @param {Object} map The map to clone.
  15856. * @param {Function} cloneFunc The function to clone values.
  15857. * @param {boolean} [isDeep] Specify a deep clone.
  15858. * @returns {Object} Returns the cloned map.
  15859. */
  15860. function cloneMap(map, isDeep, cloneFunc) {
  15861. var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map);
  15862. return arrayReduce(array, addMapEntry, new map.constructor);
  15863. }
  15864. /**
  15865. * Creates a clone of `regexp`.
  15866. *
  15867. * @private
  15868. * @param {Object} regexp The regexp to clone.
  15869. * @returns {Object} Returns the cloned regexp.
  15870. */
  15871. function cloneRegExp(regexp) {
  15872. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  15873. result.lastIndex = regexp.lastIndex;
  15874. return result;
  15875. }
  15876. /**
  15877. * Creates a clone of `set`.
  15878. *
  15879. * @private
  15880. * @param {Object} set The set to clone.
  15881. * @param {Function} cloneFunc The function to clone values.
  15882. * @param {boolean} [isDeep] Specify a deep clone.
  15883. * @returns {Object} Returns the cloned set.
  15884. */
  15885. function cloneSet(set, isDeep, cloneFunc) {
  15886. var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set);
  15887. return arrayReduce(array, addSetEntry, new set.constructor);
  15888. }
  15889. /**
  15890. * Creates a clone of the `symbol` object.
  15891. *
  15892. * @private
  15893. * @param {Object} symbol The symbol object to clone.
  15894. * @returns {Object} Returns the cloned symbol object.
  15895. */
  15896. function cloneSymbol(symbol) {
  15897. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  15898. }
  15899. /**
  15900. * Creates a clone of `typedArray`.
  15901. *
  15902. * @private
  15903. * @param {Object} typedArray The typed array to clone.
  15904. * @param {boolean} [isDeep] Specify a deep clone.
  15905. * @returns {Object} Returns the cloned typed array.
  15906. */
  15907. function cloneTypedArray(typedArray, isDeep) {
  15908. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  15909. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  15910. }
  15911. /**
  15912. * Compares values to sort them in ascending order.
  15913. *
  15914. * @private
  15915. * @param {*} value The value to compare.
  15916. * @param {*} other The other value to compare.
  15917. * @returns {number} Returns the sort order indicator for `value`.
  15918. */
  15919. function compareAscending(value, other) {
  15920. if (value !== other) {
  15921. var valIsDefined = value !== undefined,
  15922. valIsNull = value === null,
  15923. valIsReflexive = value === value,
  15924. valIsSymbol = isSymbol(value);
  15925. var othIsDefined = other !== undefined,
  15926. othIsNull = other === null,
  15927. othIsReflexive = other === other,
  15928. othIsSymbol = isSymbol(other);
  15929. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  15930. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  15931. (valIsNull && othIsDefined && othIsReflexive) ||
  15932. (!valIsDefined && othIsReflexive) ||
  15933. !valIsReflexive) {
  15934. return 1;
  15935. }
  15936. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  15937. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  15938. (othIsNull && valIsDefined && valIsReflexive) ||
  15939. (!othIsDefined && valIsReflexive) ||
  15940. !othIsReflexive) {
  15941. return -1;
  15942. }
  15943. }
  15944. return 0;
  15945. }
  15946. /**
  15947. * Used by `_.orderBy` to compare multiple properties of a value to another
  15948. * and stable sort them.
  15949. *
  15950. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  15951. * specify an order of "desc" for descending or "asc" for ascending sort order
  15952. * of corresponding values.
  15953. *
  15954. * @private
  15955. * @param {Object} object The object to compare.
  15956. * @param {Object} other The other object to compare.
  15957. * @param {boolean[]|string[]} orders The order to sort by for each property.
  15958. * @returns {number} Returns the sort order indicator for `object`.
  15959. */
  15960. function compareMultiple(object, other, orders) {
  15961. var index = -1,
  15962. objCriteria = object.criteria,
  15963. othCriteria = other.criteria,
  15964. length = objCriteria.length,
  15965. ordersLength = orders.length;
  15966. while (++index < length) {
  15967. var result = compareAscending(objCriteria[index], othCriteria[index]);
  15968. if (result) {
  15969. if (index >= ordersLength) {
  15970. return result;
  15971. }
  15972. var order = orders[index];
  15973. return result * (order == 'desc' ? -1 : 1);
  15974. }
  15975. }
  15976. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  15977. // that causes it, under certain circumstances, to provide the same value for
  15978. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  15979. // for more details.
  15980. //
  15981. // This also ensures a stable sort in V8 and other engines.
  15982. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  15983. return object.index - other.index;
  15984. }
  15985. /**
  15986. * Creates an array that is the composition of partially applied arguments,
  15987. * placeholders, and provided arguments into a single array of arguments.
  15988. *
  15989. * @private
  15990. * @param {Array} args The provided arguments.
  15991. * @param {Array} partials The arguments to prepend to those provided.
  15992. * @param {Array} holders The `partials` placeholder indexes.
  15993. * @params {boolean} [isCurried] Specify composing for a curried function.
  15994. * @returns {Array} Returns the new array of composed arguments.
  15995. */
  15996. function composeArgs(args, partials, holders, isCurried) {
  15997. var argsIndex = -1,
  15998. argsLength = args.length,
  15999. holdersLength = holders.length,
  16000. leftIndex = -1,
  16001. leftLength = partials.length,
  16002. rangeLength = nativeMax(argsLength - holdersLength, 0),
  16003. result = Array(leftLength + rangeLength),
  16004. isUncurried = !isCurried;
  16005. while (++leftIndex < leftLength) {
  16006. result[leftIndex] = partials[leftIndex];
  16007. }
  16008. while (++argsIndex < holdersLength) {
  16009. if (isUncurried || argsIndex < argsLength) {
  16010. result[holders[argsIndex]] = args[argsIndex];
  16011. }
  16012. }
  16013. while (rangeLength--) {
  16014. result[leftIndex++] = args[argsIndex++];
  16015. }
  16016. return result;
  16017. }
  16018. /**
  16019. * This function is like `composeArgs` except that the arguments composition
  16020. * is tailored for `_.partialRight`.
  16021. *
  16022. * @private
  16023. * @param {Array} args The provided arguments.
  16024. * @param {Array} partials The arguments to append to those provided.
  16025. * @param {Array} holders The `partials` placeholder indexes.
  16026. * @params {boolean} [isCurried] Specify composing for a curried function.
  16027. * @returns {Array} Returns the new array of composed arguments.
  16028. */
  16029. function composeArgsRight(args, partials, holders, isCurried) {
  16030. var argsIndex = -1,
  16031. argsLength = args.length,
  16032. holdersIndex = -1,
  16033. holdersLength = holders.length,
  16034. rightIndex = -1,
  16035. rightLength = partials.length,
  16036. rangeLength = nativeMax(argsLength - holdersLength, 0),
  16037. result = Array(rangeLength + rightLength),
  16038. isUncurried = !isCurried;
  16039. while (++argsIndex < rangeLength) {
  16040. result[argsIndex] = args[argsIndex];
  16041. }
  16042. var offset = argsIndex;
  16043. while (++rightIndex < rightLength) {
  16044. result[offset + rightIndex] = partials[rightIndex];
  16045. }
  16046. while (++holdersIndex < holdersLength) {
  16047. if (isUncurried || argsIndex < argsLength) {
  16048. result[offset + holders[holdersIndex]] = args[argsIndex++];
  16049. }
  16050. }
  16051. return result;
  16052. }
  16053. /**
  16054. * Copies the values of `source` to `array`.
  16055. *
  16056. * @private
  16057. * @param {Array} source The array to copy values from.
  16058. * @param {Array} [array=[]] The array to copy values to.
  16059. * @returns {Array} Returns `array`.
  16060. */
  16061. function copyArray(source, array) {
  16062. var index = -1,
  16063. length = source.length;
  16064. array || (array = Array(length));
  16065. while (++index < length) {
  16066. array[index] = source[index];
  16067. }
  16068. return array;
  16069. }
  16070. /**
  16071. * Copies properties of `source` to `object`.
  16072. *
  16073. * @private
  16074. * @param {Object} source The object to copy properties from.
  16075. * @param {Array} props The property identifiers to copy.
  16076. * @param {Object} [object={}] The object to copy properties to.
  16077. * @param {Function} [customizer] The function to customize copied values.
  16078. * @returns {Object} Returns `object`.
  16079. */
  16080. function copyObject(source, props, object, customizer) {
  16081. var isNew = !object;
  16082. object || (object = {});
  16083. var index = -1,
  16084. length = props.length;
  16085. while (++index < length) {
  16086. var key = props[index];
  16087. var newValue = customizer
  16088. ? customizer(object[key], source[key], key, object, source)
  16089. : undefined;
  16090. if (newValue === undefined) {
  16091. newValue = source[key];
  16092. }
  16093. if (isNew) {
  16094. baseAssignValue(object, key, newValue);
  16095. } else {
  16096. assignValue(object, key, newValue);
  16097. }
  16098. }
  16099. return object;
  16100. }
  16101. /**
  16102. * Copies own symbols of `source` to `object`.
  16103. *
  16104. * @private
  16105. * @param {Object} source The object to copy symbols from.
  16106. * @param {Object} [object={}] The object to copy symbols to.
  16107. * @returns {Object} Returns `object`.
  16108. */
  16109. function copySymbols(source, object) {
  16110. return copyObject(source, getSymbols(source), object);
  16111. }
  16112. /**
  16113. * Copies own and inherited symbols of `source` to `object`.
  16114. *
  16115. * @private
  16116. * @param {Object} source The object to copy symbols from.
  16117. * @param {Object} [object={}] The object to copy symbols to.
  16118. * @returns {Object} Returns `object`.
  16119. */
  16120. function copySymbolsIn(source, object) {
  16121. return copyObject(source, getSymbolsIn(source), object);
  16122. }
  16123. /**
  16124. * Creates a function like `_.groupBy`.
  16125. *
  16126. * @private
  16127. * @param {Function} setter The function to set accumulator values.
  16128. * @param {Function} [initializer] The accumulator object initializer.
  16129. * @returns {Function} Returns the new aggregator function.
  16130. */
  16131. function createAggregator(setter, initializer) {
  16132. return function(collection, iteratee) {
  16133. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  16134. accumulator = initializer ? initializer() : {};
  16135. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  16136. };
  16137. }
  16138. /**
  16139. * Creates a function like `_.assign`.
  16140. *
  16141. * @private
  16142. * @param {Function} assigner The function to assign values.
  16143. * @returns {Function} Returns the new assigner function.
  16144. */
  16145. function createAssigner(assigner) {
  16146. return baseRest(function(object, sources) {
  16147. var index = -1,
  16148. length = sources.length,
  16149. customizer = length > 1 ? sources[length - 1] : undefined,
  16150. guard = length > 2 ? sources[2] : undefined;
  16151. customizer = (assigner.length > 3 && typeof customizer == 'function')
  16152. ? (length--, customizer)
  16153. : undefined;
  16154. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  16155. customizer = length < 3 ? undefined : customizer;
  16156. length = 1;
  16157. }
  16158. object = Object(object);
  16159. while (++index < length) {
  16160. var source = sources[index];
  16161. if (source) {
  16162. assigner(object, source, index, customizer);
  16163. }
  16164. }
  16165. return object;
  16166. });
  16167. }
  16168. /**
  16169. * Creates a `baseEach` or `baseEachRight` function.
  16170. *
  16171. * @private
  16172. * @param {Function} eachFunc The function to iterate over a collection.
  16173. * @param {boolean} [fromRight] Specify iterating from right to left.
  16174. * @returns {Function} Returns the new base function.
  16175. */
  16176. function createBaseEach(eachFunc, fromRight) {
  16177. return function(collection, iteratee) {
  16178. if (collection == null) {
  16179. return collection;
  16180. }
  16181. if (!isArrayLike(collection)) {
  16182. return eachFunc(collection, iteratee);
  16183. }
  16184. var length = collection.length,
  16185. index = fromRight ? length : -1,
  16186. iterable = Object(collection);
  16187. while ((fromRight ? index-- : ++index < length)) {
  16188. if (iteratee(iterable[index], index, iterable) === false) {
  16189. break;
  16190. }
  16191. }
  16192. return collection;
  16193. };
  16194. }
  16195. /**
  16196. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  16197. *
  16198. * @private
  16199. * @param {boolean} [fromRight] Specify iterating from right to left.
  16200. * @returns {Function} Returns the new base function.
  16201. */
  16202. function createBaseFor(fromRight) {
  16203. return function(object, iteratee, keysFunc) {
  16204. var index = -1,
  16205. iterable = Object(object),
  16206. props = keysFunc(object),
  16207. length = props.length;
  16208. while (length--) {
  16209. var key = props[fromRight ? length : ++index];
  16210. if (iteratee(iterable[key], key, iterable) === false) {
  16211. break;
  16212. }
  16213. }
  16214. return object;
  16215. };
  16216. }
  16217. /**
  16218. * Creates a function that wraps `func` to invoke it with the optional `this`
  16219. * binding of `thisArg`.
  16220. *
  16221. * @private
  16222. * @param {Function} func The function to wrap.
  16223. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  16224. * @param {*} [thisArg] The `this` binding of `func`.
  16225. * @returns {Function} Returns the new wrapped function.
  16226. */
  16227. function createBind(func, bitmask, thisArg) {
  16228. var isBind = bitmask & WRAP_BIND_FLAG,
  16229. Ctor = createCtor(func);
  16230. function wrapper() {
  16231. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  16232. return fn.apply(isBind ? thisArg : this, arguments);
  16233. }
  16234. return wrapper;
  16235. }
  16236. /**
  16237. * Creates a function like `_.lowerFirst`.
  16238. *
  16239. * @private
  16240. * @param {string} methodName The name of the `String` case method to use.
  16241. * @returns {Function} Returns the new case function.
  16242. */
  16243. function createCaseFirst(methodName) {
  16244. return function(string) {
  16245. string = toString(string);
  16246. var strSymbols = hasUnicode(string)
  16247. ? stringToArray(string)
  16248. : undefined;
  16249. var chr = strSymbols
  16250. ? strSymbols[0]
  16251. : string.charAt(0);
  16252. var trailing = strSymbols
  16253. ? castSlice(strSymbols, 1).join('')
  16254. : string.slice(1);
  16255. return chr[methodName]() + trailing;
  16256. };
  16257. }
  16258. /**
  16259. * Creates a function like `_.camelCase`.
  16260. *
  16261. * @private
  16262. * @param {Function} callback The function to combine each word.
  16263. * @returns {Function} Returns the new compounder function.
  16264. */
  16265. function createCompounder(callback) {
  16266. return function(string) {
  16267. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  16268. };
  16269. }
  16270. /**
  16271. * Creates a function that produces an instance of `Ctor` regardless of
  16272. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  16273. *
  16274. * @private
  16275. * @param {Function} Ctor The constructor to wrap.
  16276. * @returns {Function} Returns the new wrapped function.
  16277. */
  16278. function createCtor(Ctor) {
  16279. return function() {
  16280. // Use a `switch` statement to work with class constructors. See
  16281. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  16282. // for more details.
  16283. var args = arguments;
  16284. switch (args.length) {
  16285. case 0: return new Ctor;
  16286. case 1: return new Ctor(args[0]);
  16287. case 2: return new Ctor(args[0], args[1]);
  16288. case 3: return new Ctor(args[0], args[1], args[2]);
  16289. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  16290. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  16291. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  16292. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  16293. }
  16294. var thisBinding = baseCreate(Ctor.prototype),
  16295. result = Ctor.apply(thisBinding, args);
  16296. // Mimic the constructor's `return` behavior.
  16297. // See https://es5.github.io/#x13.2.2 for more details.
  16298. return isObject(result) ? result : thisBinding;
  16299. };
  16300. }
  16301. /**
  16302. * Creates a function that wraps `func` to enable currying.
  16303. *
  16304. * @private
  16305. * @param {Function} func The function to wrap.
  16306. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  16307. * @param {number} arity The arity of `func`.
  16308. * @returns {Function} Returns the new wrapped function.
  16309. */
  16310. function createCurry(func, bitmask, arity) {
  16311. var Ctor = createCtor(func);
  16312. function wrapper() {
  16313. var length = arguments.length,
  16314. args = Array(length),
  16315. index = length,
  16316. placeholder = getHolder(wrapper);
  16317. while (index--) {
  16318. args[index] = arguments[index];
  16319. }
  16320. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  16321. ? []
  16322. : replaceHolders(args, placeholder);
  16323. length -= holders.length;
  16324. if (length < arity) {
  16325. return createRecurry(
  16326. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  16327. args, holders, undefined, undefined, arity - length);
  16328. }
  16329. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  16330. return apply(fn, this, args);
  16331. }
  16332. return wrapper;
  16333. }
  16334. /**
  16335. * Creates a `_.find` or `_.findLast` function.
  16336. *
  16337. * @private
  16338. * @param {Function} findIndexFunc The function to find the collection index.
  16339. * @returns {Function} Returns the new find function.
  16340. */
  16341. function createFind(findIndexFunc) {
  16342. return function(collection, predicate, fromIndex) {
  16343. var iterable = Object(collection);
  16344. if (!isArrayLike(collection)) {
  16345. var iteratee = getIteratee(predicate, 3);
  16346. collection = keys(collection);
  16347. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  16348. }
  16349. var index = findIndexFunc(collection, predicate, fromIndex);
  16350. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  16351. };
  16352. }
  16353. /**
  16354. * Creates a `_.flow` or `_.flowRight` function.
  16355. *
  16356. * @private
  16357. * @param {boolean} [fromRight] Specify iterating from right to left.
  16358. * @returns {Function} Returns the new flow function.
  16359. */
  16360. function createFlow(fromRight) {
  16361. return flatRest(function(funcs) {
  16362. var length = funcs.length,
  16363. index = length,
  16364. prereq = LodashWrapper.prototype.thru;
  16365. if (fromRight) {
  16366. funcs.reverse();
  16367. }
  16368. while (index--) {
  16369. var func = funcs[index];
  16370. if (typeof func != 'function') {
  16371. throw new TypeError(FUNC_ERROR_TEXT);
  16372. }
  16373. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  16374. var wrapper = new LodashWrapper([], true);
  16375. }
  16376. }
  16377. index = wrapper ? index : length;
  16378. while (++index < length) {
  16379. func = funcs[index];
  16380. var funcName = getFuncName(func),
  16381. data = funcName == 'wrapper' ? getData(func) : undefined;
  16382. if (data && isLaziable(data[0]) &&
  16383. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  16384. !data[4].length && data[9] == 1
  16385. ) {
  16386. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  16387. } else {
  16388. wrapper = (func.length == 1 && isLaziable(func))
  16389. ? wrapper[funcName]()
  16390. : wrapper.thru(func);
  16391. }
  16392. }
  16393. return function() {
  16394. var args = arguments,
  16395. value = args[0];
  16396. if (wrapper && args.length == 1 && isArray(value)) {
  16397. return wrapper.plant(value).value();
  16398. }
  16399. var index = 0,
  16400. result = length ? funcs[index].apply(this, args) : value;
  16401. while (++index < length) {
  16402. result = funcs[index].call(this, result);
  16403. }
  16404. return result;
  16405. };
  16406. });
  16407. }
  16408. /**
  16409. * Creates a function that wraps `func` to invoke it with optional `this`
  16410. * binding of `thisArg`, partial application, and currying.
  16411. *
  16412. * @private
  16413. * @param {Function|string} func The function or method name to wrap.
  16414. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  16415. * @param {*} [thisArg] The `this` binding of `func`.
  16416. * @param {Array} [partials] The arguments to prepend to those provided to
  16417. * the new function.
  16418. * @param {Array} [holders] The `partials` placeholder indexes.
  16419. * @param {Array} [partialsRight] The arguments to append to those provided
  16420. * to the new function.
  16421. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  16422. * @param {Array} [argPos] The argument positions of the new function.
  16423. * @param {number} [ary] The arity cap of `func`.
  16424. * @param {number} [arity] The arity of `func`.
  16425. * @returns {Function} Returns the new wrapped function.
  16426. */
  16427. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  16428. var isAry = bitmask & WRAP_ARY_FLAG,
  16429. isBind = bitmask & WRAP_BIND_FLAG,
  16430. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  16431. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  16432. isFlip = bitmask & WRAP_FLIP_FLAG,
  16433. Ctor = isBindKey ? undefined : createCtor(func);
  16434. function wrapper() {
  16435. var length = arguments.length,
  16436. args = Array(length),
  16437. index = length;
  16438. while (index--) {
  16439. args[index] = arguments[index];
  16440. }
  16441. if (isCurried) {
  16442. var placeholder = getHolder(wrapper),
  16443. holdersCount = countHolders(args, placeholder);
  16444. }
  16445. if (partials) {
  16446. args = composeArgs(args, partials, holders, isCurried);
  16447. }
  16448. if (partialsRight) {
  16449. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  16450. }
  16451. length -= holdersCount;
  16452. if (isCurried && length < arity) {
  16453. var newHolders = replaceHolders(args, placeholder);
  16454. return createRecurry(
  16455. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  16456. args, newHolders, argPos, ary, arity - length
  16457. );
  16458. }
  16459. var thisBinding = isBind ? thisArg : this,
  16460. fn = isBindKey ? thisBinding[func] : func;
  16461. length = args.length;
  16462. if (argPos) {
  16463. args = reorder(args, argPos);
  16464. } else if (isFlip && length > 1) {
  16465. args.reverse();
  16466. }
  16467. if (isAry && ary < length) {
  16468. args.length = ary;
  16469. }
  16470. if (this && this !== root && this instanceof wrapper) {
  16471. fn = Ctor || createCtor(fn);
  16472. }
  16473. return fn.apply(thisBinding, args);
  16474. }
  16475. return wrapper;
  16476. }
  16477. /**
  16478. * Creates a function like `_.invertBy`.
  16479. *
  16480. * @private
  16481. * @param {Function} setter The function to set accumulator values.
  16482. * @param {Function} toIteratee The function to resolve iteratees.
  16483. * @returns {Function} Returns the new inverter function.
  16484. */
  16485. function createInverter(setter, toIteratee) {
  16486. return function(object, iteratee) {
  16487. return baseInverter(object, setter, toIteratee(iteratee), {});
  16488. };
  16489. }
  16490. /**
  16491. * Creates a function that performs a mathematical operation on two values.
  16492. *
  16493. * @private
  16494. * @param {Function} operator The function to perform the operation.
  16495. * @param {number} [defaultValue] The value used for `undefined` arguments.
  16496. * @returns {Function} Returns the new mathematical operation function.
  16497. */
  16498. function createMathOperation(operator, defaultValue) {
  16499. return function(value, other) {
  16500. var result;
  16501. if (value === undefined && other === undefined) {
  16502. return defaultValue;
  16503. }
  16504. if (value !== undefined) {
  16505. result = value;
  16506. }
  16507. if (other !== undefined) {
  16508. if (result === undefined) {
  16509. return other;
  16510. }
  16511. if (typeof value == 'string' || typeof other == 'string') {
  16512. value = baseToString(value);
  16513. other = baseToString(other);
  16514. } else {
  16515. value = baseToNumber(value);
  16516. other = baseToNumber(other);
  16517. }
  16518. result = operator(value, other);
  16519. }
  16520. return result;
  16521. };
  16522. }
  16523. /**
  16524. * Creates a function like `_.over`.
  16525. *
  16526. * @private
  16527. * @param {Function} arrayFunc The function to iterate over iteratees.
  16528. * @returns {Function} Returns the new over function.
  16529. */
  16530. function createOver(arrayFunc) {
  16531. return flatRest(function(iteratees) {
  16532. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  16533. return baseRest(function(args) {
  16534. var thisArg = this;
  16535. return arrayFunc(iteratees, function(iteratee) {
  16536. return apply(iteratee, thisArg, args);
  16537. });
  16538. });
  16539. });
  16540. }
  16541. /**
  16542. * Creates the padding for `string` based on `length`. The `chars` string
  16543. * is truncated if the number of characters exceeds `length`.
  16544. *
  16545. * @private
  16546. * @param {number} length The padding length.
  16547. * @param {string} [chars=' '] The string used as padding.
  16548. * @returns {string} Returns the padding for `string`.
  16549. */
  16550. function createPadding(length, chars) {
  16551. chars = chars === undefined ? ' ' : baseToString(chars);
  16552. var charsLength = chars.length;
  16553. if (charsLength < 2) {
  16554. return charsLength ? baseRepeat(chars, length) : chars;
  16555. }
  16556. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  16557. return hasUnicode(chars)
  16558. ? castSlice(stringToArray(result), 0, length).join('')
  16559. : result.slice(0, length);
  16560. }
  16561. /**
  16562. * Creates a function that wraps `func` to invoke it with the `this` binding
  16563. * of `thisArg` and `partials` prepended to the arguments it receives.
  16564. *
  16565. * @private
  16566. * @param {Function} func The function to wrap.
  16567. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  16568. * @param {*} thisArg The `this` binding of `func`.
  16569. * @param {Array} partials The arguments to prepend to those provided to
  16570. * the new function.
  16571. * @returns {Function} Returns the new wrapped function.
  16572. */
  16573. function createPartial(func, bitmask, thisArg, partials) {
  16574. var isBind = bitmask & WRAP_BIND_FLAG,
  16575. Ctor = createCtor(func);
  16576. function wrapper() {
  16577. var argsIndex = -1,
  16578. argsLength = arguments.length,
  16579. leftIndex = -1,
  16580. leftLength = partials.length,
  16581. args = Array(leftLength + argsLength),
  16582. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  16583. while (++leftIndex < leftLength) {
  16584. args[leftIndex] = partials[leftIndex];
  16585. }
  16586. while (argsLength--) {
  16587. args[leftIndex++] = arguments[++argsIndex];
  16588. }
  16589. return apply(fn, isBind ? thisArg : this, args);
  16590. }
  16591. return wrapper;
  16592. }
  16593. /**
  16594. * Creates a `_.range` or `_.rangeRight` function.
  16595. *
  16596. * @private
  16597. * @param {boolean} [fromRight] Specify iterating from right to left.
  16598. * @returns {Function} Returns the new range function.
  16599. */
  16600. function createRange(fromRight) {
  16601. return function(start, end, step) {
  16602. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  16603. end = step = undefined;
  16604. }
  16605. // Ensure the sign of `-0` is preserved.
  16606. start = toFinite(start);
  16607. if (end === undefined) {
  16608. end = start;
  16609. start = 0;
  16610. } else {
  16611. end = toFinite(end);
  16612. }
  16613. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  16614. return baseRange(start, end, step, fromRight);
  16615. };
  16616. }
  16617. /**
  16618. * Creates a function that performs a relational operation on two values.
  16619. *
  16620. * @private
  16621. * @param {Function} operator The function to perform the operation.
  16622. * @returns {Function} Returns the new relational operation function.
  16623. */
  16624. function createRelationalOperation(operator) {
  16625. return function(value, other) {
  16626. if (!(typeof value == 'string' && typeof other == 'string')) {
  16627. value = toNumber(value);
  16628. other = toNumber(other);
  16629. }
  16630. return operator(value, other);
  16631. };
  16632. }
  16633. /**
  16634. * Creates a function that wraps `func` to continue currying.
  16635. *
  16636. * @private
  16637. * @param {Function} func The function to wrap.
  16638. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  16639. * @param {Function} wrapFunc The function to create the `func` wrapper.
  16640. * @param {*} placeholder The placeholder value.
  16641. * @param {*} [thisArg] The `this` binding of `func`.
  16642. * @param {Array} [partials] The arguments to prepend to those provided to
  16643. * the new function.
  16644. * @param {Array} [holders] The `partials` placeholder indexes.
  16645. * @param {Array} [argPos] The argument positions of the new function.
  16646. * @param {number} [ary] The arity cap of `func`.
  16647. * @param {number} [arity] The arity of `func`.
  16648. * @returns {Function} Returns the new wrapped function.
  16649. */
  16650. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  16651. var isCurry = bitmask & WRAP_CURRY_FLAG,
  16652. newHolders = isCurry ? holders : undefined,
  16653. newHoldersRight = isCurry ? undefined : holders,
  16654. newPartials = isCurry ? partials : undefined,
  16655. newPartialsRight = isCurry ? undefined : partials;
  16656. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  16657. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  16658. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  16659. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  16660. }
  16661. var newData = [
  16662. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  16663. newHoldersRight, argPos, ary, arity
  16664. ];
  16665. var result = wrapFunc.apply(undefined, newData);
  16666. if (isLaziable(func)) {
  16667. setData(result, newData);
  16668. }
  16669. result.placeholder = placeholder;
  16670. return setWrapToString(result, func, bitmask);
  16671. }
  16672. /**
  16673. * Creates a function like `_.round`.
  16674. *
  16675. * @private
  16676. * @param {string} methodName The name of the `Math` method to use when rounding.
  16677. * @returns {Function} Returns the new round function.
  16678. */
  16679. function createRound(methodName) {
  16680. var func = Math[methodName];
  16681. return function(number, precision) {
  16682. number = toNumber(number);
  16683. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  16684. if (precision) {
  16685. // Shift with exponential notation to avoid floating-point issues.
  16686. // See [MDN](https://mdn.io/round#Examples) for more details.
  16687. var pair = (toString(number) + 'e').split('e'),
  16688. value = func(pair[0] + 'e' + (+pair[1] + precision));
  16689. pair = (toString(value) + 'e').split('e');
  16690. return +(pair[0] + 'e' + (+pair[1] - precision));
  16691. }
  16692. return func(number);
  16693. };
  16694. }
  16695. /**
  16696. * Creates a set object of `values`.
  16697. *
  16698. * @private
  16699. * @param {Array} values The values to add to the set.
  16700. * @returns {Object} Returns the new set.
  16701. */
  16702. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  16703. return new Set(values);
  16704. };
  16705. /**
  16706. * Creates a `_.toPairs` or `_.toPairsIn` function.
  16707. *
  16708. * @private
  16709. * @param {Function} keysFunc The function to get the keys of a given object.
  16710. * @returns {Function} Returns the new pairs function.
  16711. */
  16712. function createToPairs(keysFunc) {
  16713. return function(object) {
  16714. var tag = getTag(object);
  16715. if (tag == mapTag) {
  16716. return mapToArray(object);
  16717. }
  16718. if (tag == setTag) {
  16719. return setToPairs(object);
  16720. }
  16721. return baseToPairs(object, keysFunc(object));
  16722. };
  16723. }
  16724. /**
  16725. * Creates a function that either curries or invokes `func` with optional
  16726. * `this` binding and partially applied arguments.
  16727. *
  16728. * @private
  16729. * @param {Function|string} func The function or method name to wrap.
  16730. * @param {number} bitmask The bitmask flags.
  16731. * 1 - `_.bind`
  16732. * 2 - `_.bindKey`
  16733. * 4 - `_.curry` or `_.curryRight` of a bound function
  16734. * 8 - `_.curry`
  16735. * 16 - `_.curryRight`
  16736. * 32 - `_.partial`
  16737. * 64 - `_.partialRight`
  16738. * 128 - `_.rearg`
  16739. * 256 - `_.ary`
  16740. * 512 - `_.flip`
  16741. * @param {*} [thisArg] The `this` binding of `func`.
  16742. * @param {Array} [partials] The arguments to be partially applied.
  16743. * @param {Array} [holders] The `partials` placeholder indexes.
  16744. * @param {Array} [argPos] The argument positions of the new function.
  16745. * @param {number} [ary] The arity cap of `func`.
  16746. * @param {number} [arity] The arity of `func`.
  16747. * @returns {Function} Returns the new wrapped function.
  16748. */
  16749. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  16750. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  16751. if (!isBindKey && typeof func != 'function') {
  16752. throw new TypeError(FUNC_ERROR_TEXT);
  16753. }
  16754. var length = partials ? partials.length : 0;
  16755. if (!length) {
  16756. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  16757. partials = holders = undefined;
  16758. }
  16759. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  16760. arity = arity === undefined ? arity : toInteger(arity);
  16761. length -= holders ? holders.length : 0;
  16762. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  16763. var partialsRight = partials,
  16764. holdersRight = holders;
  16765. partials = holders = undefined;
  16766. }
  16767. var data = isBindKey ? undefined : getData(func);
  16768. var newData = [
  16769. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  16770. argPos, ary, arity
  16771. ];
  16772. if (data) {
  16773. mergeData(newData, data);
  16774. }
  16775. func = newData[0];
  16776. bitmask = newData[1];
  16777. thisArg = newData[2];
  16778. partials = newData[3];
  16779. holders = newData[4];
  16780. arity = newData[9] = newData[9] === undefined
  16781. ? (isBindKey ? 0 : func.length)
  16782. : nativeMax(newData[9] - length, 0);
  16783. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  16784. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  16785. }
  16786. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  16787. var result = createBind(func, bitmask, thisArg);
  16788. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  16789. result = createCurry(func, bitmask, arity);
  16790. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  16791. result = createPartial(func, bitmask, thisArg, partials);
  16792. } else {
  16793. result = createHybrid.apply(undefined, newData);
  16794. }
  16795. var setter = data ? baseSetData : setData;
  16796. return setWrapToString(setter(result, newData), func, bitmask);
  16797. }
  16798. /**
  16799. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  16800. * of source objects to the destination object for all destination properties
  16801. * that resolve to `undefined`.
  16802. *
  16803. * @private
  16804. * @param {*} objValue The destination value.
  16805. * @param {*} srcValue The source value.
  16806. * @param {string} key The key of the property to assign.
  16807. * @param {Object} object The parent object of `objValue`.
  16808. * @returns {*} Returns the value to assign.
  16809. */
  16810. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  16811. if (objValue === undefined ||
  16812. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  16813. return srcValue;
  16814. }
  16815. return objValue;
  16816. }
  16817. /**
  16818. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  16819. * objects into destination objects that are passed thru.
  16820. *
  16821. * @private
  16822. * @param {*} objValue The destination value.
  16823. * @param {*} srcValue The source value.
  16824. * @param {string} key The key of the property to merge.
  16825. * @param {Object} object The parent object of `objValue`.
  16826. * @param {Object} source The parent object of `srcValue`.
  16827. * @param {Object} [stack] Tracks traversed source values and their merged
  16828. * counterparts.
  16829. * @returns {*} Returns the value to assign.
  16830. */
  16831. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  16832. if (isObject(objValue) && isObject(srcValue)) {
  16833. // Recursively merge objects and arrays (susceptible to call stack limits).
  16834. stack.set(srcValue, objValue);
  16835. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  16836. stack['delete'](srcValue);
  16837. }
  16838. return objValue;
  16839. }
  16840. /**
  16841. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  16842. * objects.
  16843. *
  16844. * @private
  16845. * @param {*} value The value to inspect.
  16846. * @param {string} key The key of the property to inspect.
  16847. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  16848. */
  16849. function customOmitClone(value) {
  16850. return isPlainObject(value) ? undefined : value;
  16851. }
  16852. /**
  16853. * A specialized version of `baseIsEqualDeep` for arrays with support for
  16854. * partial deep comparisons.
  16855. *
  16856. * @private
  16857. * @param {Array} array The array to compare.
  16858. * @param {Array} other The other array to compare.
  16859. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  16860. * @param {Function} customizer The function to customize comparisons.
  16861. * @param {Function} equalFunc The function to determine equivalents of values.
  16862. * @param {Object} stack Tracks traversed `array` and `other` objects.
  16863. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  16864. */
  16865. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  16866. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  16867. arrLength = array.length,
  16868. othLength = other.length;
  16869. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  16870. return false;
  16871. }
  16872. // Assume cyclic values are equal.
  16873. var stacked = stack.get(array);
  16874. if (stacked && stack.get(other)) {
  16875. return stacked == other;
  16876. }
  16877. var index = -1,
  16878. result = true,
  16879. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  16880. stack.set(array, other);
  16881. stack.set(other, array);
  16882. // Ignore non-index properties.
  16883. while (++index < arrLength) {
  16884. var arrValue = array[index],
  16885. othValue = other[index];
  16886. if (customizer) {
  16887. var compared = isPartial
  16888. ? customizer(othValue, arrValue, index, other, array, stack)
  16889. : customizer(arrValue, othValue, index, array, other, stack);
  16890. }
  16891. if (compared !== undefined) {
  16892. if (compared) {
  16893. continue;
  16894. }
  16895. result = false;
  16896. break;
  16897. }
  16898. // Recursively compare arrays (susceptible to call stack limits).
  16899. if (seen) {
  16900. if (!arraySome(other, function(othValue, othIndex) {
  16901. if (!cacheHas(seen, othIndex) &&
  16902. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  16903. return seen.push(othIndex);
  16904. }
  16905. })) {
  16906. result = false;
  16907. break;
  16908. }
  16909. } else if (!(
  16910. arrValue === othValue ||
  16911. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  16912. )) {
  16913. result = false;
  16914. break;
  16915. }
  16916. }
  16917. stack['delete'](array);
  16918. stack['delete'](other);
  16919. return result;
  16920. }
  16921. /**
  16922. * A specialized version of `baseIsEqualDeep` for comparing objects of
  16923. * the same `toStringTag`.
  16924. *
  16925. * **Note:** This function only supports comparing values with tags of
  16926. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  16927. *
  16928. * @private
  16929. * @param {Object} object The object to compare.
  16930. * @param {Object} other The other object to compare.
  16931. * @param {string} tag The `toStringTag` of the objects to compare.
  16932. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  16933. * @param {Function} customizer The function to customize comparisons.
  16934. * @param {Function} equalFunc The function to determine equivalents of values.
  16935. * @param {Object} stack Tracks traversed `object` and `other` objects.
  16936. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  16937. */
  16938. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  16939. switch (tag) {
  16940. case dataViewTag:
  16941. if ((object.byteLength != other.byteLength) ||
  16942. (object.byteOffset != other.byteOffset)) {
  16943. return false;
  16944. }
  16945. object = object.buffer;
  16946. other = other.buffer;
  16947. case arrayBufferTag:
  16948. if ((object.byteLength != other.byteLength) ||
  16949. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  16950. return false;
  16951. }
  16952. return true;
  16953. case boolTag:
  16954. case dateTag:
  16955. case numberTag:
  16956. // Coerce booleans to `1` or `0` and dates to milliseconds.
  16957. // Invalid dates are coerced to `NaN`.
  16958. return eq(+object, +other);
  16959. case errorTag:
  16960. return object.name == other.name && object.message == other.message;
  16961. case regexpTag:
  16962. case stringTag:
  16963. // Coerce regexes to strings and treat strings, primitives and objects,
  16964. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  16965. // for more details.
  16966. return object == (other + '');
  16967. case mapTag:
  16968. var convert = mapToArray;
  16969. case setTag:
  16970. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  16971. convert || (convert = setToArray);
  16972. if (object.size != other.size && !isPartial) {
  16973. return false;
  16974. }
  16975. // Assume cyclic values are equal.
  16976. var stacked = stack.get(object);
  16977. if (stacked) {
  16978. return stacked == other;
  16979. }
  16980. bitmask |= COMPARE_UNORDERED_FLAG;
  16981. // Recursively compare objects (susceptible to call stack limits).
  16982. stack.set(object, other);
  16983. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  16984. stack['delete'](object);
  16985. return result;
  16986. case symbolTag:
  16987. if (symbolValueOf) {
  16988. return symbolValueOf.call(object) == symbolValueOf.call(other);
  16989. }
  16990. }
  16991. return false;
  16992. }
  16993. /**
  16994. * A specialized version of `baseIsEqualDeep` for objects with support for
  16995. * partial deep comparisons.
  16996. *
  16997. * @private
  16998. * @param {Object} object The object to compare.
  16999. * @param {Object} other The other object to compare.
  17000. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  17001. * @param {Function} customizer The function to customize comparisons.
  17002. * @param {Function} equalFunc The function to determine equivalents of values.
  17003. * @param {Object} stack Tracks traversed `object` and `other` objects.
  17004. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  17005. */
  17006. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  17007. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  17008. objProps = getAllKeys(object),
  17009. objLength = objProps.length,
  17010. othProps = getAllKeys(other),
  17011. othLength = othProps.length;
  17012. if (objLength != othLength && !isPartial) {
  17013. return false;
  17014. }
  17015. var index = objLength;
  17016. while (index--) {
  17017. var key = objProps[index];
  17018. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  17019. return false;
  17020. }
  17021. }
  17022. // Assume cyclic values are equal.
  17023. var stacked = stack.get(object);
  17024. if (stacked && stack.get(other)) {
  17025. return stacked == other;
  17026. }
  17027. var result = true;
  17028. stack.set(object, other);
  17029. stack.set(other, object);
  17030. var skipCtor = isPartial;
  17031. while (++index < objLength) {
  17032. key = objProps[index];
  17033. var objValue = object[key],
  17034. othValue = other[key];
  17035. if (customizer) {
  17036. var compared = isPartial
  17037. ? customizer(othValue, objValue, key, other, object, stack)
  17038. : customizer(objValue, othValue, key, object, other, stack);
  17039. }
  17040. // Recursively compare objects (susceptible to call stack limits).
  17041. if (!(compared === undefined
  17042. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  17043. : compared
  17044. )) {
  17045. result = false;
  17046. break;
  17047. }
  17048. skipCtor || (skipCtor = key == 'constructor');
  17049. }
  17050. if (result && !skipCtor) {
  17051. var objCtor = object.constructor,
  17052. othCtor = other.constructor;
  17053. // Non `Object` object instances with different constructors are not equal.
  17054. if (objCtor != othCtor &&
  17055. ('constructor' in object && 'constructor' in other) &&
  17056. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  17057. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  17058. result = false;
  17059. }
  17060. }
  17061. stack['delete'](object);
  17062. stack['delete'](other);
  17063. return result;
  17064. }
  17065. /**
  17066. * A specialized version of `baseRest` which flattens the rest array.
  17067. *
  17068. * @private
  17069. * @param {Function} func The function to apply a rest parameter to.
  17070. * @returns {Function} Returns the new function.
  17071. */
  17072. function flatRest(func) {
  17073. return setToString(overRest(func, undefined, flatten), func + '');
  17074. }
  17075. /**
  17076. * Creates an array of own enumerable property names and symbols of `object`.
  17077. *
  17078. * @private
  17079. * @param {Object} object The object to query.
  17080. * @returns {Array} Returns the array of property names and symbols.
  17081. */
  17082. function getAllKeys(object) {
  17083. return baseGetAllKeys(object, keys, getSymbols);
  17084. }
  17085. /**
  17086. * Creates an array of own and inherited enumerable property names and
  17087. * symbols of `object`.
  17088. *
  17089. * @private
  17090. * @param {Object} object The object to query.
  17091. * @returns {Array} Returns the array of property names and symbols.
  17092. */
  17093. function getAllKeysIn(object) {
  17094. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  17095. }
  17096. /**
  17097. * Gets metadata for `func`.
  17098. *
  17099. * @private
  17100. * @param {Function} func The function to query.
  17101. * @returns {*} Returns the metadata for `func`.
  17102. */
  17103. var getData = !metaMap ? noop : function(func) {
  17104. return metaMap.get(func);
  17105. };
  17106. /**
  17107. * Gets the name of `func`.
  17108. *
  17109. * @private
  17110. * @param {Function} func The function to query.
  17111. * @returns {string} Returns the function name.
  17112. */
  17113. function getFuncName(func) {
  17114. var result = (func.name + ''),
  17115. array = realNames[result],
  17116. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  17117. while (length--) {
  17118. var data = array[length],
  17119. otherFunc = data.func;
  17120. if (otherFunc == null || otherFunc == func) {
  17121. return data.name;
  17122. }
  17123. }
  17124. return result;
  17125. }
  17126. /**
  17127. * Gets the argument placeholder value for `func`.
  17128. *
  17129. * @private
  17130. * @param {Function} func The function to inspect.
  17131. * @returns {*} Returns the placeholder value.
  17132. */
  17133. function getHolder(func) {
  17134. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  17135. return object.placeholder;
  17136. }
  17137. /**
  17138. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  17139. * this function returns the custom method, otherwise it returns `baseIteratee`.
  17140. * If arguments are provided, the chosen function is invoked with them and
  17141. * its result is returned.
  17142. *
  17143. * @private
  17144. * @param {*} [value] The value to convert to an iteratee.
  17145. * @param {number} [arity] The arity of the created iteratee.
  17146. * @returns {Function} Returns the chosen function or its result.
  17147. */
  17148. function getIteratee() {
  17149. var result = lodash.iteratee || iteratee;
  17150. result = result === iteratee ? baseIteratee : result;
  17151. return arguments.length ? result(arguments[0], arguments[1]) : result;
  17152. }
  17153. /**
  17154. * Gets the data for `map`.
  17155. *
  17156. * @private
  17157. * @param {Object} map The map to query.
  17158. * @param {string} key The reference key.
  17159. * @returns {*} Returns the map data.
  17160. */
  17161. function getMapData(map, key) {
  17162. var data = map.__data__;
  17163. return isKeyable(key)
  17164. ? data[typeof key == 'string' ? 'string' : 'hash']
  17165. : data.map;
  17166. }
  17167. /**
  17168. * Gets the property names, values, and compare flags of `object`.
  17169. *
  17170. * @private
  17171. * @param {Object} object The object to query.
  17172. * @returns {Array} Returns the match data of `object`.
  17173. */
  17174. function getMatchData(object) {
  17175. var result = keys(object),
  17176. length = result.length;
  17177. while (length--) {
  17178. var key = result[length],
  17179. value = object[key];
  17180. result[length] = [key, value, isStrictComparable(value)];
  17181. }
  17182. return result;
  17183. }
  17184. /**
  17185. * Gets the native function at `key` of `object`.
  17186. *
  17187. * @private
  17188. * @param {Object} object The object to query.
  17189. * @param {string} key The key of the method to get.
  17190. * @returns {*} Returns the function if it's native, else `undefined`.
  17191. */
  17192. function getNative(object, key) {
  17193. var value = getValue(object, key);
  17194. return baseIsNative(value) ? value : undefined;
  17195. }
  17196. /**
  17197. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  17198. *
  17199. * @private
  17200. * @param {*} value The value to query.
  17201. * @returns {string} Returns the raw `toStringTag`.
  17202. */
  17203. function getRawTag(value) {
  17204. var isOwn = hasOwnProperty.call(value, symToStringTag),
  17205. tag = value[symToStringTag];
  17206. try {
  17207. value[symToStringTag] = undefined;
  17208. var unmasked = true;
  17209. } catch (e) {}
  17210. var result = nativeObjectToString.call(value);
  17211. if (unmasked) {
  17212. if (isOwn) {
  17213. value[symToStringTag] = tag;
  17214. } else {
  17215. delete value[symToStringTag];
  17216. }
  17217. }
  17218. return result;
  17219. }
  17220. /**
  17221. * Creates an array of the own enumerable symbols of `object`.
  17222. *
  17223. * @private
  17224. * @param {Object} object The object to query.
  17225. * @returns {Array} Returns the array of symbols.
  17226. */
  17227. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  17228. if (object == null) {
  17229. return [];
  17230. }
  17231. object = Object(object);
  17232. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  17233. return propertyIsEnumerable.call(object, symbol);
  17234. });
  17235. };
  17236. /**
  17237. * Creates an array of the own and inherited enumerable symbols of `object`.
  17238. *
  17239. * @private
  17240. * @param {Object} object The object to query.
  17241. * @returns {Array} Returns the array of symbols.
  17242. */
  17243. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  17244. var result = [];
  17245. while (object) {
  17246. arrayPush(result, getSymbols(object));
  17247. object = getPrototype(object);
  17248. }
  17249. return result;
  17250. };
  17251. /**
  17252. * Gets the `toStringTag` of `value`.
  17253. *
  17254. * @private
  17255. * @param {*} value The value to query.
  17256. * @returns {string} Returns the `toStringTag`.
  17257. */
  17258. var getTag = baseGetTag;
  17259. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  17260. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  17261. (Map && getTag(new Map) != mapTag) ||
  17262. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  17263. (Set && getTag(new Set) != setTag) ||
  17264. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  17265. getTag = function(value) {
  17266. var result = baseGetTag(value),
  17267. Ctor = result == objectTag ? value.constructor : undefined,
  17268. ctorString = Ctor ? toSource(Ctor) : '';
  17269. if (ctorString) {
  17270. switch (ctorString) {
  17271. case dataViewCtorString: return dataViewTag;
  17272. case mapCtorString: return mapTag;
  17273. case promiseCtorString: return promiseTag;
  17274. case setCtorString: return setTag;
  17275. case weakMapCtorString: return weakMapTag;
  17276. }
  17277. }
  17278. return result;
  17279. };
  17280. }
  17281. /**
  17282. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  17283. *
  17284. * @private
  17285. * @param {number} start The start of the view.
  17286. * @param {number} end The end of the view.
  17287. * @param {Array} transforms The transformations to apply to the view.
  17288. * @returns {Object} Returns an object containing the `start` and `end`
  17289. * positions of the view.
  17290. */
  17291. function getView(start, end, transforms) {
  17292. var index = -1,
  17293. length = transforms.length;
  17294. while (++index < length) {
  17295. var data = transforms[index],
  17296. size = data.size;
  17297. switch (data.type) {
  17298. case 'drop': start += size; break;
  17299. case 'dropRight': end -= size; break;
  17300. case 'take': end = nativeMin(end, start + size); break;
  17301. case 'takeRight': start = nativeMax(start, end - size); break;
  17302. }
  17303. }
  17304. return { 'start': start, 'end': end };
  17305. }
  17306. /**
  17307. * Extracts wrapper details from the `source` body comment.
  17308. *
  17309. * @private
  17310. * @param {string} source The source to inspect.
  17311. * @returns {Array} Returns the wrapper details.
  17312. */
  17313. function getWrapDetails(source) {
  17314. var match = source.match(reWrapDetails);
  17315. return match ? match[1].split(reSplitDetails) : [];
  17316. }
  17317. /**
  17318. * Checks if `path` exists on `object`.
  17319. *
  17320. * @private
  17321. * @param {Object} object The object to query.
  17322. * @param {Array|string} path The path to check.
  17323. * @param {Function} hasFunc The function to check properties.
  17324. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  17325. */
  17326. function hasPath(object, path, hasFunc) {
  17327. path = castPath(path, object);
  17328. var index = -1,
  17329. length = path.length,
  17330. result = false;
  17331. while (++index < length) {
  17332. var key = toKey(path[index]);
  17333. if (!(result = object != null && hasFunc(object, key))) {
  17334. break;
  17335. }
  17336. object = object[key];
  17337. }
  17338. if (result || ++index != length) {
  17339. return result;
  17340. }
  17341. length = object == null ? 0 : object.length;
  17342. return !!length && isLength(length) && isIndex(key, length) &&
  17343. (isArray(object) || isArguments(object));
  17344. }
  17345. /**
  17346. * Initializes an array clone.
  17347. *
  17348. * @private
  17349. * @param {Array} array The array to clone.
  17350. * @returns {Array} Returns the initialized clone.
  17351. */
  17352. function initCloneArray(array) {
  17353. var length = array.length,
  17354. result = array.constructor(length);
  17355. // Add properties assigned by `RegExp#exec`.
  17356. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  17357. result.index = array.index;
  17358. result.input = array.input;
  17359. }
  17360. return result;
  17361. }
  17362. /**
  17363. * Initializes an object clone.
  17364. *
  17365. * @private
  17366. * @param {Object} object The object to clone.
  17367. * @returns {Object} Returns the initialized clone.
  17368. */
  17369. function initCloneObject(object) {
  17370. return (typeof object.constructor == 'function' && !isPrototype(object))
  17371. ? baseCreate(getPrototype(object))
  17372. : {};
  17373. }
  17374. /**
  17375. * Initializes an object clone based on its `toStringTag`.
  17376. *
  17377. * **Note:** This function only supports cloning values with tags of
  17378. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  17379. *
  17380. * @private
  17381. * @param {Object} object The object to clone.
  17382. * @param {string} tag The `toStringTag` of the object to clone.
  17383. * @param {Function} cloneFunc The function to clone values.
  17384. * @param {boolean} [isDeep] Specify a deep clone.
  17385. * @returns {Object} Returns the initialized clone.
  17386. */
  17387. function initCloneByTag(object, tag, cloneFunc, isDeep) {
  17388. var Ctor = object.constructor;
  17389. switch (tag) {
  17390. case arrayBufferTag:
  17391. return cloneArrayBuffer(object);
  17392. case boolTag:
  17393. case dateTag:
  17394. return new Ctor(+object);
  17395. case dataViewTag:
  17396. return cloneDataView(object, isDeep);
  17397. case float32Tag: case float64Tag:
  17398. case int8Tag: case int16Tag: case int32Tag:
  17399. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  17400. return cloneTypedArray(object, isDeep);
  17401. case mapTag:
  17402. return cloneMap(object, isDeep, cloneFunc);
  17403. case numberTag:
  17404. case stringTag:
  17405. return new Ctor(object);
  17406. case regexpTag:
  17407. return cloneRegExp(object);
  17408. case setTag:
  17409. return cloneSet(object, isDeep, cloneFunc);
  17410. case symbolTag:
  17411. return cloneSymbol(object);
  17412. }
  17413. }
  17414. /**
  17415. * Inserts wrapper `details` in a comment at the top of the `source` body.
  17416. *
  17417. * @private
  17418. * @param {string} source The source to modify.
  17419. * @returns {Array} details The details to insert.
  17420. * @returns {string} Returns the modified source.
  17421. */
  17422. function insertWrapDetails(source, details) {
  17423. var length = details.length;
  17424. if (!length) {
  17425. return source;
  17426. }
  17427. var lastIndex = length - 1;
  17428. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  17429. details = details.join(length > 2 ? ', ' : ' ');
  17430. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  17431. }
  17432. /**
  17433. * Checks if `value` is a flattenable `arguments` object or array.
  17434. *
  17435. * @private
  17436. * @param {*} value The value to check.
  17437. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  17438. */
  17439. function isFlattenable(value) {
  17440. return isArray(value) || isArguments(value) ||
  17441. !!(spreadableSymbol && value && value[spreadableSymbol]);
  17442. }
  17443. /**
  17444. * Checks if `value` is a valid array-like index.
  17445. *
  17446. * @private
  17447. * @param {*} value The value to check.
  17448. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  17449. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  17450. */
  17451. function isIndex(value, length) {
  17452. length = length == null ? MAX_SAFE_INTEGER : length;
  17453. return !!length &&
  17454. (typeof value == 'number' || reIsUint.test(value)) &&
  17455. (value > -1 && value % 1 == 0 && value < length);
  17456. }
  17457. /**
  17458. * Checks if the given arguments are from an iteratee call.
  17459. *
  17460. * @private
  17461. * @param {*} value The potential iteratee value argument.
  17462. * @param {*} index The potential iteratee index or key argument.
  17463. * @param {*} object The potential iteratee object argument.
  17464. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  17465. * else `false`.
  17466. */
  17467. function isIterateeCall(value, index, object) {
  17468. if (!isObject(object)) {
  17469. return false;
  17470. }
  17471. var type = typeof index;
  17472. if (type == 'number'
  17473. ? (isArrayLike(object) && isIndex(index, object.length))
  17474. : (type == 'string' && index in object)
  17475. ) {
  17476. return eq(object[index], value);
  17477. }
  17478. return false;
  17479. }
  17480. /**
  17481. * Checks if `value` is a property name and not a property path.
  17482. *
  17483. * @private
  17484. * @param {*} value The value to check.
  17485. * @param {Object} [object] The object to query keys on.
  17486. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  17487. */
  17488. function isKey(value, object) {
  17489. if (isArray(value)) {
  17490. return false;
  17491. }
  17492. var type = typeof value;
  17493. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  17494. value == null || isSymbol(value)) {
  17495. return true;
  17496. }
  17497. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  17498. (object != null && value in Object(object));
  17499. }
  17500. /**
  17501. * Checks if `value` is suitable for use as unique object key.
  17502. *
  17503. * @private
  17504. * @param {*} value The value to check.
  17505. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  17506. */
  17507. function isKeyable(value) {
  17508. var type = typeof value;
  17509. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  17510. ? (value !== '__proto__')
  17511. : (value === null);
  17512. }
  17513. /**
  17514. * Checks if `func` has a lazy counterpart.
  17515. *
  17516. * @private
  17517. * @param {Function} func The function to check.
  17518. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  17519. * else `false`.
  17520. */
  17521. function isLaziable(func) {
  17522. var funcName = getFuncName(func),
  17523. other = lodash[funcName];
  17524. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  17525. return false;
  17526. }
  17527. if (func === other) {
  17528. return true;
  17529. }
  17530. var data = getData(other);
  17531. return !!data && func === data[0];
  17532. }
  17533. /**
  17534. * Checks if `func` has its source masked.
  17535. *
  17536. * @private
  17537. * @param {Function} func The function to check.
  17538. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  17539. */
  17540. function isMasked(func) {
  17541. return !!maskSrcKey && (maskSrcKey in func);
  17542. }
  17543. /**
  17544. * Checks if `func` is capable of being masked.
  17545. *
  17546. * @private
  17547. * @param {*} value The value to check.
  17548. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  17549. */
  17550. var isMaskable = coreJsData ? isFunction : stubFalse;
  17551. /**
  17552. * Checks if `value` is likely a prototype object.
  17553. *
  17554. * @private
  17555. * @param {*} value The value to check.
  17556. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  17557. */
  17558. function isPrototype(value) {
  17559. var Ctor = value && value.constructor,
  17560. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  17561. return value === proto;
  17562. }
  17563. /**
  17564. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  17565. *
  17566. * @private
  17567. * @param {*} value The value to check.
  17568. * @returns {boolean} Returns `true` if `value` if suitable for strict
  17569. * equality comparisons, else `false`.
  17570. */
  17571. function isStrictComparable(value) {
  17572. return value === value && !isObject(value);
  17573. }
  17574. /**
  17575. * A specialized version of `matchesProperty` for source values suitable
  17576. * for strict equality comparisons, i.e. `===`.
  17577. *
  17578. * @private
  17579. * @param {string} key The key of the property to get.
  17580. * @param {*} srcValue The value to match.
  17581. * @returns {Function} Returns the new spec function.
  17582. */
  17583. function matchesStrictComparable(key, srcValue) {
  17584. return function(object) {
  17585. if (object == null) {
  17586. return false;
  17587. }
  17588. return object[key] === srcValue &&
  17589. (srcValue !== undefined || (key in Object(object)));
  17590. };
  17591. }
  17592. /**
  17593. * A specialized version of `_.memoize` which clears the memoized function's
  17594. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  17595. *
  17596. * @private
  17597. * @param {Function} func The function to have its output memoized.
  17598. * @returns {Function} Returns the new memoized function.
  17599. */
  17600. function memoizeCapped(func) {
  17601. var result = memoize(func, function(key) {
  17602. if (cache.size === MAX_MEMOIZE_SIZE) {
  17603. cache.clear();
  17604. }
  17605. return key;
  17606. });
  17607. var cache = result.cache;
  17608. return result;
  17609. }
  17610. /**
  17611. * Merges the function metadata of `source` into `data`.
  17612. *
  17613. * Merging metadata reduces the number of wrappers used to invoke a function.
  17614. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  17615. * may be applied regardless of execution order. Methods like `_.ary` and
  17616. * `_.rearg` modify function arguments, making the order in which they are
  17617. * executed important, preventing the merging of metadata. However, we make
  17618. * an exception for a safe combined case where curried functions have `_.ary`
  17619. * and or `_.rearg` applied.
  17620. *
  17621. * @private
  17622. * @param {Array} data The destination metadata.
  17623. * @param {Array} source The source metadata.
  17624. * @returns {Array} Returns `data`.
  17625. */
  17626. function mergeData(data, source) {
  17627. var bitmask = data[1],
  17628. srcBitmask = source[1],
  17629. newBitmask = bitmask | srcBitmask,
  17630. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  17631. var isCombo =
  17632. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  17633. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  17634. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  17635. // Exit early if metadata can't be merged.
  17636. if (!(isCommon || isCombo)) {
  17637. return data;
  17638. }
  17639. // Use source `thisArg` if available.
  17640. if (srcBitmask & WRAP_BIND_FLAG) {
  17641. data[2] = source[2];
  17642. // Set when currying a bound function.
  17643. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  17644. }
  17645. // Compose partial arguments.
  17646. var value = source[3];
  17647. if (value) {
  17648. var partials = data[3];
  17649. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  17650. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  17651. }
  17652. // Compose partial right arguments.
  17653. value = source[5];
  17654. if (value) {
  17655. partials = data[5];
  17656. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  17657. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  17658. }
  17659. // Use source `argPos` if available.
  17660. value = source[7];
  17661. if (value) {
  17662. data[7] = value;
  17663. }
  17664. // Use source `ary` if it's smaller.
  17665. if (srcBitmask & WRAP_ARY_FLAG) {
  17666. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  17667. }
  17668. // Use source `arity` if one is not provided.
  17669. if (data[9] == null) {
  17670. data[9] = source[9];
  17671. }
  17672. // Use source `func` and merge bitmasks.
  17673. data[0] = source[0];
  17674. data[1] = newBitmask;
  17675. return data;
  17676. }
  17677. /**
  17678. * This function is like
  17679. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  17680. * except that it includes inherited enumerable properties.
  17681. *
  17682. * @private
  17683. * @param {Object} object The object to query.
  17684. * @returns {Array} Returns the array of property names.
  17685. */
  17686. function nativeKeysIn(object) {
  17687. var result = [];
  17688. if (object != null) {
  17689. for (var key in Object(object)) {
  17690. result.push(key);
  17691. }
  17692. }
  17693. return result;
  17694. }
  17695. /**
  17696. * Converts `value` to a string using `Object.prototype.toString`.
  17697. *
  17698. * @private
  17699. * @param {*} value The value to convert.
  17700. * @returns {string} Returns the converted string.
  17701. */
  17702. function objectToString(value) {
  17703. return nativeObjectToString.call(value);
  17704. }
  17705. /**
  17706. * A specialized version of `baseRest` which transforms the rest array.
  17707. *
  17708. * @private
  17709. * @param {Function} func The function to apply a rest parameter to.
  17710. * @param {number} [start=func.length-1] The start position of the rest parameter.
  17711. * @param {Function} transform The rest array transform.
  17712. * @returns {Function} Returns the new function.
  17713. */
  17714. function overRest(func, start, transform) {
  17715. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  17716. return function() {
  17717. var args = arguments,
  17718. index = -1,
  17719. length = nativeMax(args.length - start, 0),
  17720. array = Array(length);
  17721. while (++index < length) {
  17722. array[index] = args[start + index];
  17723. }
  17724. index = -1;
  17725. var otherArgs = Array(start + 1);
  17726. while (++index < start) {
  17727. otherArgs[index] = args[index];
  17728. }
  17729. otherArgs[start] = transform(array);
  17730. return apply(func, this, otherArgs);
  17731. };
  17732. }
  17733. /**
  17734. * Gets the parent value at `path` of `object`.
  17735. *
  17736. * @private
  17737. * @param {Object} object The object to query.
  17738. * @param {Array} path The path to get the parent value of.
  17739. * @returns {*} Returns the parent value.
  17740. */
  17741. function parent(object, path) {
  17742. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  17743. }
  17744. /**
  17745. * Reorder `array` according to the specified indexes where the element at
  17746. * the first index is assigned as the first element, the element at
  17747. * the second index is assigned as the second element, and so on.
  17748. *
  17749. * @private
  17750. * @param {Array} array The array to reorder.
  17751. * @param {Array} indexes The arranged array indexes.
  17752. * @returns {Array} Returns `array`.
  17753. */
  17754. function reorder(array, indexes) {
  17755. var arrLength = array.length,
  17756. length = nativeMin(indexes.length, arrLength),
  17757. oldArray = copyArray(array);
  17758. while (length--) {
  17759. var index = indexes[length];
  17760. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  17761. }
  17762. return array;
  17763. }
  17764. /**
  17765. * Sets metadata for `func`.
  17766. *
  17767. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  17768. * period of time, it will trip its breaker and transition to an identity
  17769. * function to avoid garbage collection pauses in V8. See
  17770. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  17771. * for more details.
  17772. *
  17773. * @private
  17774. * @param {Function} func The function to associate metadata with.
  17775. * @param {*} data The metadata.
  17776. * @returns {Function} Returns `func`.
  17777. */
  17778. var setData = shortOut(baseSetData);
  17779. /**
  17780. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  17781. *
  17782. * @private
  17783. * @param {Function} func The function to delay.
  17784. * @param {number} wait The number of milliseconds to delay invocation.
  17785. * @returns {number|Object} Returns the timer id or timeout object.
  17786. */
  17787. var setTimeout = ctxSetTimeout || function(func, wait) {
  17788. return root.setTimeout(func, wait);
  17789. };
  17790. /**
  17791. * Sets the `toString` method of `func` to return `string`.
  17792. *
  17793. * @private
  17794. * @param {Function} func The function to modify.
  17795. * @param {Function} string The `toString` result.
  17796. * @returns {Function} Returns `func`.
  17797. */
  17798. var setToString = shortOut(baseSetToString);
  17799. /**
  17800. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  17801. * with wrapper details in a comment at the top of the source body.
  17802. *
  17803. * @private
  17804. * @param {Function} wrapper The function to modify.
  17805. * @param {Function} reference The reference function.
  17806. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  17807. * @returns {Function} Returns `wrapper`.
  17808. */
  17809. function setWrapToString(wrapper, reference, bitmask) {
  17810. var source = (reference + '');
  17811. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  17812. }
  17813. /**
  17814. * Creates a function that'll short out and invoke `identity` instead
  17815. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  17816. * milliseconds.
  17817. *
  17818. * @private
  17819. * @param {Function} func The function to restrict.
  17820. * @returns {Function} Returns the new shortable function.
  17821. */
  17822. function shortOut(func) {
  17823. var count = 0,
  17824. lastCalled = 0;
  17825. return function() {
  17826. var stamp = nativeNow(),
  17827. remaining = HOT_SPAN - (stamp - lastCalled);
  17828. lastCalled = stamp;
  17829. if (remaining > 0) {
  17830. if (++count >= HOT_COUNT) {
  17831. return arguments[0];
  17832. }
  17833. } else {
  17834. count = 0;
  17835. }
  17836. return func.apply(undefined, arguments);
  17837. };
  17838. }
  17839. /**
  17840. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  17841. *
  17842. * @private
  17843. * @param {Array} array The array to shuffle.
  17844. * @param {number} [size=array.length] The size of `array`.
  17845. * @returns {Array} Returns `array`.
  17846. */
  17847. function shuffleSelf(array, size) {
  17848. var index = -1,
  17849. length = array.length,
  17850. lastIndex = length - 1;
  17851. size = size === undefined ? length : size;
  17852. while (++index < size) {
  17853. var rand = baseRandom(index, lastIndex),
  17854. value = array[rand];
  17855. array[rand] = array[index];
  17856. array[index] = value;
  17857. }
  17858. array.length = size;
  17859. return array;
  17860. }
  17861. /**
  17862. * Converts `string` to a property path array.
  17863. *
  17864. * @private
  17865. * @param {string} string The string to convert.
  17866. * @returns {Array} Returns the property path array.
  17867. */
  17868. var stringToPath = memoizeCapped(function(string) {
  17869. var result = [];
  17870. if (reLeadingDot.test(string)) {
  17871. result.push('');
  17872. }
  17873. string.replace(rePropName, function(match, number, quote, string) {
  17874. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  17875. });
  17876. return result;
  17877. });
  17878. /**
  17879. * Converts `value` to a string key if it's not a string or symbol.
  17880. *
  17881. * @private
  17882. * @param {*} value The value to inspect.
  17883. * @returns {string|symbol} Returns the key.
  17884. */
  17885. function toKey(value) {
  17886. if (typeof value == 'string' || isSymbol(value)) {
  17887. return value;
  17888. }
  17889. var result = (value + '');
  17890. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  17891. }
  17892. /**
  17893. * Converts `func` to its source code.
  17894. *
  17895. * @private
  17896. * @param {Function} func The function to convert.
  17897. * @returns {string} Returns the source code.
  17898. */
  17899. function toSource(func) {
  17900. if (func != null) {
  17901. try {
  17902. return funcToString.call(func);
  17903. } catch (e) {}
  17904. try {
  17905. return (func + '');
  17906. } catch (e) {}
  17907. }
  17908. return '';
  17909. }
  17910. /**
  17911. * Updates wrapper `details` based on `bitmask` flags.
  17912. *
  17913. * @private
  17914. * @returns {Array} details The details to modify.
  17915. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  17916. * @returns {Array} Returns `details`.
  17917. */
  17918. function updateWrapDetails(details, bitmask) {
  17919. arrayEach(wrapFlags, function(pair) {
  17920. var value = '_.' + pair[0];
  17921. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  17922. details.push(value);
  17923. }
  17924. });
  17925. return details.sort();
  17926. }
  17927. /**
  17928. * Creates a clone of `wrapper`.
  17929. *
  17930. * @private
  17931. * @param {Object} wrapper The wrapper to clone.
  17932. * @returns {Object} Returns the cloned wrapper.
  17933. */
  17934. function wrapperClone(wrapper) {
  17935. if (wrapper instanceof LazyWrapper) {
  17936. return wrapper.clone();
  17937. }
  17938. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  17939. result.__actions__ = copyArray(wrapper.__actions__);
  17940. result.__index__ = wrapper.__index__;
  17941. result.__values__ = wrapper.__values__;
  17942. return result;
  17943. }
  17944. /*------------------------------------------------------------------------*/
  17945. /**
  17946. * Creates an array of elements split into groups the length of `size`.
  17947. * If `array` can't be split evenly, the final chunk will be the remaining
  17948. * elements.
  17949. *
  17950. * @static
  17951. * @memberOf _
  17952. * @since 3.0.0
  17953. * @category Array
  17954. * @param {Array} array The array to process.
  17955. * @param {number} [size=1] The length of each chunk
  17956. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  17957. * @returns {Array} Returns the new array of chunks.
  17958. * @example
  17959. *
  17960. * _.chunk(['a', 'b', 'c', 'd'], 2);
  17961. * // => [['a', 'b'], ['c', 'd']]
  17962. *
  17963. * _.chunk(['a', 'b', 'c', 'd'], 3);
  17964. * // => [['a', 'b', 'c'], ['d']]
  17965. */
  17966. function chunk(array, size, guard) {
  17967. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  17968. size = 1;
  17969. } else {
  17970. size = nativeMax(toInteger(size), 0);
  17971. }
  17972. var length = array == null ? 0 : array.length;
  17973. if (!length || size < 1) {
  17974. return [];
  17975. }
  17976. var index = 0,
  17977. resIndex = 0,
  17978. result = Array(nativeCeil(length / size));
  17979. while (index < length) {
  17980. result[resIndex++] = baseSlice(array, index, (index += size));
  17981. }
  17982. return result;
  17983. }
  17984. /**
  17985. * Creates an array with all falsey values removed. The values `false`, `null`,
  17986. * `0`, `""`, `undefined`, and `NaN` are falsey.
  17987. *
  17988. * @static
  17989. * @memberOf _
  17990. * @since 0.1.0
  17991. * @category Array
  17992. * @param {Array} array The array to compact.
  17993. * @returns {Array} Returns the new array of filtered values.
  17994. * @example
  17995. *
  17996. * _.compact([0, 1, false, 2, '', 3]);
  17997. * // => [1, 2, 3]
  17998. */
  17999. function compact(array) {
  18000. var index = -1,
  18001. length = array == null ? 0 : array.length,
  18002. resIndex = 0,
  18003. result = [];
  18004. while (++index < length) {
  18005. var value = array[index];
  18006. if (value) {
  18007. result[resIndex++] = value;
  18008. }
  18009. }
  18010. return result;
  18011. }
  18012. /**
  18013. * Creates a new array concatenating `array` with any additional arrays
  18014. * and/or values.
  18015. *
  18016. * @static
  18017. * @memberOf _
  18018. * @since 4.0.0
  18019. * @category Array
  18020. * @param {Array} array The array to concatenate.
  18021. * @param {...*} [values] The values to concatenate.
  18022. * @returns {Array} Returns the new concatenated array.
  18023. * @example
  18024. *
  18025. * var array = [1];
  18026. * var other = _.concat(array, 2, [3], [[4]]);
  18027. *
  18028. * console.log(other);
  18029. * // => [1, 2, 3, [4]]
  18030. *
  18031. * console.log(array);
  18032. * // => [1]
  18033. */
  18034. function concat() {
  18035. var length = arguments.length;
  18036. if (!length) {
  18037. return [];
  18038. }
  18039. var args = Array(length - 1),
  18040. array = arguments[0],
  18041. index = length;
  18042. while (index--) {
  18043. args[index - 1] = arguments[index];
  18044. }
  18045. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  18046. }
  18047. /**
  18048. * Creates an array of `array` values not included in the other given arrays
  18049. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  18050. * for equality comparisons. The order and references of result values are
  18051. * determined by the first array.
  18052. *
  18053. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  18054. *
  18055. * @static
  18056. * @memberOf _
  18057. * @since 0.1.0
  18058. * @category Array
  18059. * @param {Array} array The array to inspect.
  18060. * @param {...Array} [values] The values to exclude.
  18061. * @returns {Array} Returns the new array of filtered values.
  18062. * @see _.without, _.xor
  18063. * @example
  18064. *
  18065. * _.difference([2, 1], [2, 3]);
  18066. * // => [1]
  18067. */
  18068. var difference = baseRest(function(array, values) {
  18069. return isArrayLikeObject(array)
  18070. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  18071. : [];
  18072. });
  18073. /**
  18074. * This method is like `_.difference` except that it accepts `iteratee` which
  18075. * is invoked for each element of `array` and `values` to generate the criterion
  18076. * by which they're compared. The order and references of result values are
  18077. * determined by the first array. The iteratee is invoked with one argument:
  18078. * (value).
  18079. *
  18080. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  18081. *
  18082. * @static
  18083. * @memberOf _
  18084. * @since 4.0.0
  18085. * @category Array
  18086. * @param {Array} array The array to inspect.
  18087. * @param {...Array} [values] The values to exclude.
  18088. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  18089. * @returns {Array} Returns the new array of filtered values.
  18090. * @example
  18091. *
  18092. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  18093. * // => [1.2]
  18094. *
  18095. * // The `_.property` iteratee shorthand.
  18096. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  18097. * // => [{ 'x': 2 }]
  18098. */
  18099. var differenceBy = baseRest(function(array, values) {
  18100. var iteratee = last(values);
  18101. if (isArrayLikeObject(iteratee)) {
  18102. iteratee = undefined;
  18103. }
  18104. return isArrayLikeObject(array)
  18105. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  18106. : [];
  18107. });
  18108. /**
  18109. * This method is like `_.difference` except that it accepts `comparator`
  18110. * which is invoked to compare elements of `array` to `values`. The order and
  18111. * references of result values are determined by the first array. The comparator
  18112. * is invoked with two arguments: (arrVal, othVal).
  18113. *
  18114. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  18115. *
  18116. * @static
  18117. * @memberOf _
  18118. * @since 4.0.0
  18119. * @category Array
  18120. * @param {Array} array The array to inspect.
  18121. * @param {...Array} [values] The values to exclude.
  18122. * @param {Function} [comparator] The comparator invoked per element.
  18123. * @returns {Array} Returns the new array of filtered values.
  18124. * @example
  18125. *
  18126. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  18127. *
  18128. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  18129. * // => [{ 'x': 2, 'y': 1 }]
  18130. */
  18131. var differenceWith = baseRest(function(array, values) {
  18132. var comparator = last(values);
  18133. if (isArrayLikeObject(comparator)) {
  18134. comparator = undefined;
  18135. }
  18136. return isArrayLikeObject(array)
  18137. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  18138. : [];
  18139. });
  18140. /**
  18141. * Creates a slice of `array` with `n` elements dropped from the beginning.
  18142. *
  18143. * @static
  18144. * @memberOf _
  18145. * @since 0.5.0
  18146. * @category Array
  18147. * @param {Array} array The array to query.
  18148. * @param {number} [n=1] The number of elements to drop.
  18149. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  18150. * @returns {Array} Returns the slice of `array`.
  18151. * @example
  18152. *
  18153. * _.drop([1, 2, 3]);
  18154. * // => [2, 3]
  18155. *
  18156. * _.drop([1, 2, 3], 2);
  18157. * // => [3]
  18158. *
  18159. * _.drop([1, 2, 3], 5);
  18160. * // => []
  18161. *
  18162. * _.drop([1, 2, 3], 0);
  18163. * // => [1, 2, 3]
  18164. */
  18165. function drop(array, n, guard) {
  18166. var length = array == null ? 0 : array.length;
  18167. if (!length) {
  18168. return [];
  18169. }
  18170. n = (guard || n === undefined) ? 1 : toInteger(n);
  18171. return baseSlice(array, n < 0 ? 0 : n, length);
  18172. }
  18173. /**
  18174. * Creates a slice of `array` with `n` elements dropped from the end.
  18175. *
  18176. * @static
  18177. * @memberOf _
  18178. * @since 3.0.0
  18179. * @category Array
  18180. * @param {Array} array The array to query.
  18181. * @param {number} [n=1] The number of elements to drop.
  18182. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  18183. * @returns {Array} Returns the slice of `array`.
  18184. * @example
  18185. *
  18186. * _.dropRight([1, 2, 3]);
  18187. * // => [1, 2]
  18188. *
  18189. * _.dropRight([1, 2, 3], 2);
  18190. * // => [1]
  18191. *
  18192. * _.dropRight([1, 2, 3], 5);
  18193. * // => []
  18194. *
  18195. * _.dropRight([1, 2, 3], 0);
  18196. * // => [1, 2, 3]
  18197. */
  18198. function dropRight(array, n, guard) {
  18199. var length = array == null ? 0 : array.length;
  18200. if (!length) {
  18201. return [];
  18202. }
  18203. n = (guard || n === undefined) ? 1 : toInteger(n);
  18204. n = length - n;
  18205. return baseSlice(array, 0, n < 0 ? 0 : n);
  18206. }
  18207. /**
  18208. * Creates a slice of `array` excluding elements dropped from the end.
  18209. * Elements are dropped until `predicate` returns falsey. The predicate is
  18210. * invoked with three arguments: (value, index, array).
  18211. *
  18212. * @static
  18213. * @memberOf _
  18214. * @since 3.0.0
  18215. * @category Array
  18216. * @param {Array} array The array to query.
  18217. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  18218. * @returns {Array} Returns the slice of `array`.
  18219. * @example
  18220. *
  18221. * var users = [
  18222. * { 'user': 'barney', 'active': true },
  18223. * { 'user': 'fred', 'active': false },
  18224. * { 'user': 'pebbles', 'active': false }
  18225. * ];
  18226. *
  18227. * _.dropRightWhile(users, function(o) { return !o.active; });
  18228. * // => objects for ['barney']
  18229. *
  18230. * // The `_.matches` iteratee shorthand.
  18231. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  18232. * // => objects for ['barney', 'fred']
  18233. *
  18234. * // The `_.matchesProperty` iteratee shorthand.
  18235. * _.dropRightWhile(users, ['active', false]);
  18236. * // => objects for ['barney']
  18237. *
  18238. * // The `_.property` iteratee shorthand.
  18239. * _.dropRightWhile(users, 'active');
  18240. * // => objects for ['barney', 'fred', 'pebbles']
  18241. */
  18242. function dropRightWhile(array, predicate) {
  18243. return (array && array.length)
  18244. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  18245. : [];
  18246. }
  18247. /**
  18248. * Creates a slice of `array` excluding elements dropped from the beginning.
  18249. * Elements are dropped until `predicate` returns falsey. The predicate is
  18250. * invoked with three arguments: (value, index, array).
  18251. *
  18252. * @static
  18253. * @memberOf _
  18254. * @since 3.0.0
  18255. * @category Array
  18256. * @param {Array} array The array to query.
  18257. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  18258. * @returns {Array} Returns the slice of `array`.
  18259. * @example
  18260. *
  18261. * var users = [
  18262. * { 'user': 'barney', 'active': false },
  18263. * { 'user': 'fred', 'active': false },
  18264. * { 'user': 'pebbles', 'active': true }
  18265. * ];
  18266. *
  18267. * _.dropWhile(users, function(o) { return !o.active; });
  18268. * // => objects for ['pebbles']
  18269. *
  18270. * // The `_.matches` iteratee shorthand.
  18271. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  18272. * // => objects for ['fred', 'pebbles']
  18273. *
  18274. * // The `_.matchesProperty` iteratee shorthand.
  18275. * _.dropWhile(users, ['active', false]);
  18276. * // => objects for ['pebbles']
  18277. *
  18278. * // The `_.property` iteratee shorthand.
  18279. * _.dropWhile(users, 'active');
  18280. * // => objects for ['barney', 'fred', 'pebbles']
  18281. */
  18282. function dropWhile(array, predicate) {
  18283. return (array && array.length)
  18284. ? baseWhile(array, getIteratee(predicate, 3), true)
  18285. : [];
  18286. }
  18287. /**
  18288. * Fills elements of `array` with `value` from `start` up to, but not
  18289. * including, `end`.
  18290. *
  18291. * **Note:** This method mutates `array`.
  18292. *
  18293. * @static
  18294. * @memberOf _
  18295. * @since 3.2.0
  18296. * @category Array
  18297. * @param {Array} array The array to fill.
  18298. * @param {*} value The value to fill `array` with.
  18299. * @param {number} [start=0] The start position.
  18300. * @param {number} [end=array.length] The end position.
  18301. * @returns {Array} Returns `array`.
  18302. * @example
  18303. *
  18304. * var array = [1, 2, 3];
  18305. *
  18306. * _.fill(array, 'a');
  18307. * console.log(array);
  18308. * // => ['a', 'a', 'a']
  18309. *
  18310. * _.fill(Array(3), 2);
  18311. * // => [2, 2, 2]
  18312. *
  18313. * _.fill([4, 6, 8, 10], '*', 1, 3);
  18314. * // => [4, '*', '*', 10]
  18315. */
  18316. function fill(array, value, start, end) {
  18317. var length = array == null ? 0 : array.length;
  18318. if (!length) {
  18319. return [];
  18320. }
  18321. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  18322. start = 0;
  18323. end = length;
  18324. }
  18325. return baseFill(array, value, start, end);
  18326. }
  18327. /**
  18328. * This method is like `_.find` except that it returns the index of the first
  18329. * element `predicate` returns truthy for instead of the element itself.
  18330. *
  18331. * @static
  18332. * @memberOf _
  18333. * @since 1.1.0
  18334. * @category Array
  18335. * @param {Array} array The array to inspect.
  18336. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  18337. * @param {number} [fromIndex=0] The index to search from.
  18338. * @returns {number} Returns the index of the found element, else `-1`.
  18339. * @example
  18340. *
  18341. * var users = [
  18342. * { 'user': 'barney', 'active': false },
  18343. * { 'user': 'fred', 'active': false },
  18344. * { 'user': 'pebbles', 'active': true }
  18345. * ];
  18346. *
  18347. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  18348. * // => 0
  18349. *
  18350. * // The `_.matches` iteratee shorthand.
  18351. * _.findIndex(users, { 'user': 'fred', 'active': false });
  18352. * // => 1
  18353. *
  18354. * // The `_.matchesProperty` iteratee shorthand.
  18355. * _.findIndex(users, ['active', false]);
  18356. * // => 0
  18357. *
  18358. * // The `_.property` iteratee shorthand.
  18359. * _.findIndex(users, 'active');
  18360. * // => 2
  18361. */
  18362. function findIndex(array, predicate, fromIndex) {
  18363. var length = array == null ? 0 : array.length;
  18364. if (!length) {
  18365. return -1;
  18366. }
  18367. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  18368. if (index < 0) {
  18369. index = nativeMax(length + index, 0);
  18370. }
  18371. return baseFindIndex(array, getIteratee(predicate, 3), index);
  18372. }
  18373. /**
  18374. * This method is like `_.findIndex` except that it iterates over elements
  18375. * of `collection` from right to left.
  18376. *
  18377. * @static
  18378. * @memberOf _
  18379. * @since 2.0.0
  18380. * @category Array
  18381. * @param {Array} array The array to inspect.
  18382. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  18383. * @param {number} [fromIndex=array.length-1] The index to search from.
  18384. * @returns {number} Returns the index of the found element, else `-1`.
  18385. * @example
  18386. *
  18387. * var users = [
  18388. * { 'user': 'barney', 'active': true },
  18389. * { 'user': 'fred', 'active': false },
  18390. * { 'user': 'pebbles', 'active': false }
  18391. * ];
  18392. *
  18393. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  18394. * // => 2
  18395. *
  18396. * // The `_.matches` iteratee shorthand.
  18397. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  18398. * // => 0
  18399. *
  18400. * // The `_.matchesProperty` iteratee shorthand.
  18401. * _.findLastIndex(users, ['active', false]);
  18402. * // => 2
  18403. *
  18404. * // The `_.property` iteratee shorthand.
  18405. * _.findLastIndex(users, 'active');
  18406. * // => 0
  18407. */
  18408. function findLastIndex(array, predicate, fromIndex) {
  18409. var length = array == null ? 0 : array.length;
  18410. if (!length) {
  18411. return -1;
  18412. }
  18413. var index = length - 1;
  18414. if (fromIndex !== undefined) {
  18415. index = toInteger(fromIndex);
  18416. index = fromIndex < 0
  18417. ? nativeMax(length + index, 0)
  18418. : nativeMin(index, length - 1);
  18419. }
  18420. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  18421. }
  18422. /**
  18423. * Flattens `array` a single level deep.
  18424. *
  18425. * @static
  18426. * @memberOf _
  18427. * @since 0.1.0
  18428. * @category Array
  18429. * @param {Array} array The array to flatten.
  18430. * @returns {Array} Returns the new flattened array.
  18431. * @example
  18432. *
  18433. * _.flatten([1, [2, [3, [4]], 5]]);
  18434. * // => [1, 2, [3, [4]], 5]
  18435. */
  18436. function flatten(array) {
  18437. var length = array == null ? 0 : array.length;
  18438. return length ? baseFlatten(array, 1) : [];
  18439. }
  18440. /**
  18441. * Recursively flattens `array`.
  18442. *
  18443. * @static
  18444. * @memberOf _
  18445. * @since 3.0.0
  18446. * @category Array
  18447. * @param {Array} array The array to flatten.
  18448. * @returns {Array} Returns the new flattened array.
  18449. * @example
  18450. *
  18451. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  18452. * // => [1, 2, 3, 4, 5]
  18453. */
  18454. function flattenDeep(array) {
  18455. var length = array == null ? 0 : array.length;
  18456. return length ? baseFlatten(array, INFINITY) : [];
  18457. }
  18458. /**
  18459. * Recursively flatten `array` up to `depth` times.
  18460. *
  18461. * @static
  18462. * @memberOf _
  18463. * @since 4.4.0
  18464. * @category Array
  18465. * @param {Array} array The array to flatten.
  18466. * @param {number} [depth=1] The maximum recursion depth.
  18467. * @returns {Array} Returns the new flattened array.
  18468. * @example
  18469. *
  18470. * var array = [1, [2, [3, [4]], 5]];
  18471. *
  18472. * _.flattenDepth(array, 1);
  18473. * // => [1, 2, [3, [4]], 5]
  18474. *
  18475. * _.flattenDepth(array, 2);
  18476. * // => [1, 2, 3, [4], 5]
  18477. */
  18478. function flattenDepth(array, depth) {
  18479. var length = array == null ? 0 : array.length;
  18480. if (!length) {
  18481. return [];
  18482. }
  18483. depth = depth === undefined ? 1 : toInteger(depth);
  18484. return baseFlatten(array, depth);
  18485. }
  18486. /**
  18487. * The inverse of `_.toPairs`; this method returns an object composed
  18488. * from key-value `pairs`.
  18489. *
  18490. * @static
  18491. * @memberOf _
  18492. * @since 4.0.0
  18493. * @category Array
  18494. * @param {Array} pairs The key-value pairs.
  18495. * @returns {Object} Returns the new object.
  18496. * @example
  18497. *
  18498. * _.fromPairs([['a', 1], ['b', 2]]);
  18499. * // => { 'a': 1, 'b': 2 }
  18500. */
  18501. function fromPairs(pairs) {
  18502. var index = -1,
  18503. length = pairs == null ? 0 : pairs.length,
  18504. result = {};
  18505. while (++index < length) {
  18506. var pair = pairs[index];
  18507. result[pair[0]] = pair[1];
  18508. }
  18509. return result;
  18510. }
  18511. /**
  18512. * Gets the first element of `array`.
  18513. *
  18514. * @static
  18515. * @memberOf _
  18516. * @since 0.1.0
  18517. * @alias first
  18518. * @category Array
  18519. * @param {Array} array The array to query.
  18520. * @returns {*} Returns the first element of `array`.
  18521. * @example
  18522. *
  18523. * _.head([1, 2, 3]);
  18524. * // => 1
  18525. *
  18526. * _.head([]);
  18527. * // => undefined
  18528. */
  18529. function head(array) {
  18530. return (array && array.length) ? array[0] : undefined;
  18531. }
  18532. /**
  18533. * Gets the index at which the first occurrence of `value` is found in `array`
  18534. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  18535. * for equality comparisons. If `fromIndex` is negative, it's used as the
  18536. * offset from the end of `array`.
  18537. *
  18538. * @static
  18539. * @memberOf _
  18540. * @since 0.1.0
  18541. * @category Array
  18542. * @param {Array} array The array to inspect.
  18543. * @param {*} value The value to search for.
  18544. * @param {number} [fromIndex=0] The index to search from.
  18545. * @returns {number} Returns the index of the matched value, else `-1`.
  18546. * @example
  18547. *
  18548. * _.indexOf([1, 2, 1, 2], 2);
  18549. * // => 1
  18550. *
  18551. * // Search from the `fromIndex`.
  18552. * _.indexOf([1, 2, 1, 2], 2, 2);
  18553. * // => 3
  18554. */
  18555. function indexOf(array, value, fromIndex) {
  18556. var length = array == null ? 0 : array.length;
  18557. if (!length) {
  18558. return -1;
  18559. }
  18560. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  18561. if (index < 0) {
  18562. index = nativeMax(length + index, 0);
  18563. }
  18564. return baseIndexOf(array, value, index);
  18565. }
  18566. /**
  18567. * Gets all but the last element of `array`.
  18568. *
  18569. * @static
  18570. * @memberOf _
  18571. * @since 0.1.0
  18572. * @category Array
  18573. * @param {Array} array The array to query.
  18574. * @returns {Array} Returns the slice of `array`.
  18575. * @example
  18576. *
  18577. * _.initial([1, 2, 3]);
  18578. * // => [1, 2]
  18579. */
  18580. function initial(array) {
  18581. var length = array == null ? 0 : array.length;
  18582. return length ? baseSlice(array, 0, -1) : [];
  18583. }
  18584. /**
  18585. * Creates an array of unique values that are included in all given arrays
  18586. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  18587. * for equality comparisons. The order and references of result values are
  18588. * determined by the first array.
  18589. *
  18590. * @static
  18591. * @memberOf _
  18592. * @since 0.1.0
  18593. * @category Array
  18594. * @param {...Array} [arrays] The arrays to inspect.
  18595. * @returns {Array} Returns the new array of intersecting values.
  18596. * @example
  18597. *
  18598. * _.intersection([2, 1], [2, 3]);
  18599. * // => [2]
  18600. */
  18601. var intersection = baseRest(function(arrays) {
  18602. var mapped = arrayMap(arrays, castArrayLikeObject);
  18603. return (mapped.length && mapped[0] === arrays[0])
  18604. ? baseIntersection(mapped)
  18605. : [];
  18606. });
  18607. /**
  18608. * This method is like `_.intersection` except that it accepts `iteratee`
  18609. * which is invoked for each element of each `arrays` to generate the criterion
  18610. * by which they're compared. The order and references of result values are
  18611. * determined by the first array. The iteratee is invoked with one argument:
  18612. * (value).
  18613. *
  18614. * @static
  18615. * @memberOf _
  18616. * @since 4.0.0
  18617. * @category Array
  18618. * @param {...Array} [arrays] The arrays to inspect.
  18619. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  18620. * @returns {Array} Returns the new array of intersecting values.
  18621. * @example
  18622. *
  18623. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  18624. * // => [2.1]
  18625. *
  18626. * // The `_.property` iteratee shorthand.
  18627. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  18628. * // => [{ 'x': 1 }]
  18629. */
  18630. var intersectionBy = baseRest(function(arrays) {
  18631. var iteratee = last(arrays),
  18632. mapped = arrayMap(arrays, castArrayLikeObject);
  18633. if (iteratee === last(mapped)) {
  18634. iteratee = undefined;
  18635. } else {
  18636. mapped.pop();
  18637. }
  18638. return (mapped.length && mapped[0] === arrays[0])
  18639. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  18640. : [];
  18641. });
  18642. /**
  18643. * This method is like `_.intersection` except that it accepts `comparator`
  18644. * which is invoked to compare elements of `arrays`. The order and references
  18645. * of result values are determined by the first array. The comparator is
  18646. * invoked with two arguments: (arrVal, othVal).
  18647. *
  18648. * @static
  18649. * @memberOf _
  18650. * @since 4.0.0
  18651. * @category Array
  18652. * @param {...Array} [arrays] The arrays to inspect.
  18653. * @param {Function} [comparator] The comparator invoked per element.
  18654. * @returns {Array} Returns the new array of intersecting values.
  18655. * @example
  18656. *
  18657. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  18658. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  18659. *
  18660. * _.intersectionWith(objects, others, _.isEqual);
  18661. * // => [{ 'x': 1, 'y': 2 }]
  18662. */
  18663. var intersectionWith = baseRest(function(arrays) {
  18664. var comparator = last(arrays),
  18665. mapped = arrayMap(arrays, castArrayLikeObject);
  18666. comparator = typeof comparator == 'function' ? comparator : undefined;
  18667. if (comparator) {
  18668. mapped.pop();
  18669. }
  18670. return (mapped.length && mapped[0] === arrays[0])
  18671. ? baseIntersection(mapped, undefined, comparator)
  18672. : [];
  18673. });
  18674. /**
  18675. * Converts all elements in `array` into a string separated by `separator`.
  18676. *
  18677. * @static
  18678. * @memberOf _
  18679. * @since 4.0.0
  18680. * @category Array
  18681. * @param {Array} array The array to convert.
  18682. * @param {string} [separator=','] The element separator.
  18683. * @returns {string} Returns the joined string.
  18684. * @example
  18685. *
  18686. * _.join(['a', 'b', 'c'], '~');
  18687. * // => 'a~b~c'
  18688. */
  18689. function join(array, separator) {
  18690. return array == null ? '' : nativeJoin.call(array, separator);
  18691. }
  18692. /**
  18693. * Gets the last element of `array`.
  18694. *
  18695. * @static
  18696. * @memberOf _
  18697. * @since 0.1.0
  18698. * @category Array
  18699. * @param {Array} array The array to query.
  18700. * @returns {*} Returns the last element of `array`.
  18701. * @example
  18702. *
  18703. * _.last([1, 2, 3]);
  18704. * // => 3
  18705. */
  18706. function last(array) {
  18707. var length = array == null ? 0 : array.length;
  18708. return length ? array[length - 1] : undefined;
  18709. }
  18710. /**
  18711. * This method is like `_.indexOf` except that it iterates over elements of
  18712. * `array` from right to left.
  18713. *
  18714. * @static
  18715. * @memberOf _
  18716. * @since 0.1.0
  18717. * @category Array
  18718. * @param {Array} array The array to inspect.
  18719. * @param {*} value The value to search for.
  18720. * @param {number} [fromIndex=array.length-1] The index to search from.
  18721. * @returns {number} Returns the index of the matched value, else `-1`.
  18722. * @example
  18723. *
  18724. * _.lastIndexOf([1, 2, 1, 2], 2);
  18725. * // => 3
  18726. *
  18727. * // Search from the `fromIndex`.
  18728. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  18729. * // => 1
  18730. */
  18731. function lastIndexOf(array, value, fromIndex) {
  18732. var length = array == null ? 0 : array.length;
  18733. if (!length) {
  18734. return -1;
  18735. }
  18736. var index = length;
  18737. if (fromIndex !== undefined) {
  18738. index = toInteger(fromIndex);
  18739. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  18740. }
  18741. return value === value
  18742. ? strictLastIndexOf(array, value, index)
  18743. : baseFindIndex(array, baseIsNaN, index, true);
  18744. }
  18745. /**
  18746. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  18747. * element from the end is returned.
  18748. *
  18749. * @static
  18750. * @memberOf _
  18751. * @since 4.11.0
  18752. * @category Array
  18753. * @param {Array} array The array to query.
  18754. * @param {number} [n=0] The index of the element to return.
  18755. * @returns {*} Returns the nth element of `array`.
  18756. * @example
  18757. *
  18758. * var array = ['a', 'b', 'c', 'd'];
  18759. *
  18760. * _.nth(array, 1);
  18761. * // => 'b'
  18762. *
  18763. * _.nth(array, -2);
  18764. * // => 'c';
  18765. */
  18766. function nth(array, n) {
  18767. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  18768. }
  18769. /**
  18770. * Removes all given values from `array` using
  18771. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  18772. * for equality comparisons.
  18773. *
  18774. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  18775. * to remove elements from an array by predicate.
  18776. *
  18777. * @static
  18778. * @memberOf _
  18779. * @since 2.0.0
  18780. * @category Array
  18781. * @param {Array} array The array to modify.
  18782. * @param {...*} [values] The values to remove.
  18783. * @returns {Array} Returns `array`.
  18784. * @example
  18785. *
  18786. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  18787. *
  18788. * _.pull(array, 'a', 'c');
  18789. * console.log(array);
  18790. * // => ['b', 'b']
  18791. */
  18792. var pull = baseRest(pullAll);
  18793. /**
  18794. * This method is like `_.pull` except that it accepts an array of values to remove.
  18795. *
  18796. * **Note:** Unlike `_.difference`, this method mutates `array`.
  18797. *
  18798. * @static
  18799. * @memberOf _
  18800. * @since 4.0.0
  18801. * @category Array
  18802. * @param {Array} array The array to modify.
  18803. * @param {Array} values The values to remove.
  18804. * @returns {Array} Returns `array`.
  18805. * @example
  18806. *
  18807. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  18808. *
  18809. * _.pullAll(array, ['a', 'c']);
  18810. * console.log(array);
  18811. * // => ['b', 'b']
  18812. */
  18813. function pullAll(array, values) {
  18814. return (array && array.length && values && values.length)
  18815. ? basePullAll(array, values)
  18816. : array;
  18817. }
  18818. /**
  18819. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  18820. * invoked for each element of `array` and `values` to generate the criterion
  18821. * by which they're compared. The iteratee is invoked with one argument: (value).
  18822. *
  18823. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  18824. *
  18825. * @static
  18826. * @memberOf _
  18827. * @since 4.0.0
  18828. * @category Array
  18829. * @param {Array} array The array to modify.
  18830. * @param {Array} values The values to remove.
  18831. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  18832. * @returns {Array} Returns `array`.
  18833. * @example
  18834. *
  18835. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  18836. *
  18837. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  18838. * console.log(array);
  18839. * // => [{ 'x': 2 }]
  18840. */
  18841. function pullAllBy(array, values, iteratee) {
  18842. return (array && array.length && values && values.length)
  18843. ? basePullAll(array, values, getIteratee(iteratee, 2))
  18844. : array;
  18845. }
  18846. /**
  18847. * This method is like `_.pullAll` except that it accepts `comparator` which
  18848. * is invoked to compare elements of `array` to `values`. The comparator is
  18849. * invoked with two arguments: (arrVal, othVal).
  18850. *
  18851. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  18852. *
  18853. * @static
  18854. * @memberOf _
  18855. * @since 4.6.0
  18856. * @category Array
  18857. * @param {Array} array The array to modify.
  18858. * @param {Array} values The values to remove.
  18859. * @param {Function} [comparator] The comparator invoked per element.
  18860. * @returns {Array} Returns `array`.
  18861. * @example
  18862. *
  18863. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  18864. *
  18865. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  18866. * console.log(array);
  18867. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  18868. */
  18869. function pullAllWith(array, values, comparator) {
  18870. return (array && array.length && values && values.length)
  18871. ? basePullAll(array, values, undefined, comparator)
  18872. : array;
  18873. }
  18874. /**
  18875. * Removes elements from `array` corresponding to `indexes` and returns an
  18876. * array of removed elements.
  18877. *
  18878. * **Note:** Unlike `_.at`, this method mutates `array`.
  18879. *
  18880. * @static
  18881. * @memberOf _
  18882. * @since 3.0.0
  18883. * @category Array
  18884. * @param {Array} array The array to modify.
  18885. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  18886. * @returns {Array} Returns the new array of removed elements.
  18887. * @example
  18888. *
  18889. * var array = ['a', 'b', 'c', 'd'];
  18890. * var pulled = _.pullAt(array, [1, 3]);
  18891. *
  18892. * console.log(array);
  18893. * // => ['a', 'c']
  18894. *
  18895. * console.log(pulled);
  18896. * // => ['b', 'd']
  18897. */
  18898. var pullAt = flatRest(function(array, indexes) {
  18899. var length = array == null ? 0 : array.length,
  18900. result = baseAt(array, indexes);
  18901. basePullAt(array, arrayMap(indexes, function(index) {
  18902. return isIndex(index, length) ? +index : index;
  18903. }).sort(compareAscending));
  18904. return result;
  18905. });
  18906. /**
  18907. * Removes all elements from `array` that `predicate` returns truthy for
  18908. * and returns an array of the removed elements. The predicate is invoked
  18909. * with three arguments: (value, index, array).
  18910. *
  18911. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  18912. * to pull elements from an array by value.
  18913. *
  18914. * @static
  18915. * @memberOf _
  18916. * @since 2.0.0
  18917. * @category Array
  18918. * @param {Array} array The array to modify.
  18919. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  18920. * @returns {Array} Returns the new array of removed elements.
  18921. * @example
  18922. *
  18923. * var array = [1, 2, 3, 4];
  18924. * var evens = _.remove(array, function(n) {
  18925. * return n % 2 == 0;
  18926. * });
  18927. *
  18928. * console.log(array);
  18929. * // => [1, 3]
  18930. *
  18931. * console.log(evens);
  18932. * // => [2, 4]
  18933. */
  18934. function remove(array, predicate) {
  18935. var result = [];
  18936. if (!(array && array.length)) {
  18937. return result;
  18938. }
  18939. var index = -1,
  18940. indexes = [],
  18941. length = array.length;
  18942. predicate = getIteratee(predicate, 3);
  18943. while (++index < length) {
  18944. var value = array[index];
  18945. if (predicate(value, index, array)) {
  18946. result.push(value);
  18947. indexes.push(index);
  18948. }
  18949. }
  18950. basePullAt(array, indexes);
  18951. return result;
  18952. }
  18953. /**
  18954. * Reverses `array` so that the first element becomes the last, the second
  18955. * element becomes the second to last, and so on.
  18956. *
  18957. * **Note:** This method mutates `array` and is based on
  18958. * [`Array#reverse`](https://mdn.io/Array/reverse).
  18959. *
  18960. * @static
  18961. * @memberOf _
  18962. * @since 4.0.0
  18963. * @category Array
  18964. * @param {Array} array The array to modify.
  18965. * @returns {Array} Returns `array`.
  18966. * @example
  18967. *
  18968. * var array = [1, 2, 3];
  18969. *
  18970. * _.reverse(array);
  18971. * // => [3, 2, 1]
  18972. *
  18973. * console.log(array);
  18974. * // => [3, 2, 1]
  18975. */
  18976. function reverse(array) {
  18977. return array == null ? array : nativeReverse.call(array);
  18978. }
  18979. /**
  18980. * Creates a slice of `array` from `start` up to, but not including, `end`.
  18981. *
  18982. * **Note:** This method is used instead of
  18983. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  18984. * returned.
  18985. *
  18986. * @static
  18987. * @memberOf _
  18988. * @since 3.0.0
  18989. * @category Array
  18990. * @param {Array} array The array to slice.
  18991. * @param {number} [start=0] The start position.
  18992. * @param {number} [end=array.length] The end position.
  18993. * @returns {Array} Returns the slice of `array`.
  18994. */
  18995. function slice(array, start, end) {
  18996. var length = array == null ? 0 : array.length;
  18997. if (!length) {
  18998. return [];
  18999. }
  19000. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  19001. start = 0;
  19002. end = length;
  19003. }
  19004. else {
  19005. start = start == null ? 0 : toInteger(start);
  19006. end = end === undefined ? length : toInteger(end);
  19007. }
  19008. return baseSlice(array, start, end);
  19009. }
  19010. /**
  19011. * Uses a binary search to determine the lowest index at which `value`
  19012. * should be inserted into `array` in order to maintain its sort order.
  19013. *
  19014. * @static
  19015. * @memberOf _
  19016. * @since 0.1.0
  19017. * @category Array
  19018. * @param {Array} array The sorted array to inspect.
  19019. * @param {*} value The value to evaluate.
  19020. * @returns {number} Returns the index at which `value` should be inserted
  19021. * into `array`.
  19022. * @example
  19023. *
  19024. * _.sortedIndex([30, 50], 40);
  19025. * // => 1
  19026. */
  19027. function sortedIndex(array, value) {
  19028. return baseSortedIndex(array, value);
  19029. }
  19030. /**
  19031. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  19032. * which is invoked for `value` and each element of `array` to compute their
  19033. * sort ranking. The iteratee is invoked with one argument: (value).
  19034. *
  19035. * @static
  19036. * @memberOf _
  19037. * @since 4.0.0
  19038. * @category Array
  19039. * @param {Array} array The sorted array to inspect.
  19040. * @param {*} value The value to evaluate.
  19041. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  19042. * @returns {number} Returns the index at which `value` should be inserted
  19043. * into `array`.
  19044. * @example
  19045. *
  19046. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  19047. *
  19048. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  19049. * // => 0
  19050. *
  19051. * // The `_.property` iteratee shorthand.
  19052. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  19053. * // => 0
  19054. */
  19055. function sortedIndexBy(array, value, iteratee) {
  19056. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  19057. }
  19058. /**
  19059. * This method is like `_.indexOf` except that it performs a binary
  19060. * search on a sorted `array`.
  19061. *
  19062. * @static
  19063. * @memberOf _
  19064. * @since 4.0.0
  19065. * @category Array
  19066. * @param {Array} array The array to inspect.
  19067. * @param {*} value The value to search for.
  19068. * @returns {number} Returns the index of the matched value, else `-1`.
  19069. * @example
  19070. *
  19071. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  19072. * // => 1
  19073. */
  19074. function sortedIndexOf(array, value) {
  19075. var length = array == null ? 0 : array.length;
  19076. if (length) {
  19077. var index = baseSortedIndex(array, value);
  19078. if (index < length && eq(array[index], value)) {
  19079. return index;
  19080. }
  19081. }
  19082. return -1;
  19083. }
  19084. /**
  19085. * This method is like `_.sortedIndex` except that it returns the highest
  19086. * index at which `value` should be inserted into `array` in order to
  19087. * maintain its sort order.
  19088. *
  19089. * @static
  19090. * @memberOf _
  19091. * @since 3.0.0
  19092. * @category Array
  19093. * @param {Array} array The sorted array to inspect.
  19094. * @param {*} value The value to evaluate.
  19095. * @returns {number} Returns the index at which `value` should be inserted
  19096. * into `array`.
  19097. * @example
  19098. *
  19099. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  19100. * // => 4
  19101. */
  19102. function sortedLastIndex(array, value) {
  19103. return baseSortedIndex(array, value, true);
  19104. }
  19105. /**
  19106. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  19107. * which is invoked for `value` and each element of `array` to compute their
  19108. * sort ranking. The iteratee is invoked with one argument: (value).
  19109. *
  19110. * @static
  19111. * @memberOf _
  19112. * @since 4.0.0
  19113. * @category Array
  19114. * @param {Array} array The sorted array to inspect.
  19115. * @param {*} value The value to evaluate.
  19116. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  19117. * @returns {number} Returns the index at which `value` should be inserted
  19118. * into `array`.
  19119. * @example
  19120. *
  19121. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  19122. *
  19123. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  19124. * // => 1
  19125. *
  19126. * // The `_.property` iteratee shorthand.
  19127. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  19128. * // => 1
  19129. */
  19130. function sortedLastIndexBy(array, value, iteratee) {
  19131. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  19132. }
  19133. /**
  19134. * This method is like `_.lastIndexOf` except that it performs a binary
  19135. * search on a sorted `array`.
  19136. *
  19137. * @static
  19138. * @memberOf _
  19139. * @since 4.0.0
  19140. * @category Array
  19141. * @param {Array} array The array to inspect.
  19142. * @param {*} value The value to search for.
  19143. * @returns {number} Returns the index of the matched value, else `-1`.
  19144. * @example
  19145. *
  19146. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  19147. * // => 3
  19148. */
  19149. function sortedLastIndexOf(array, value) {
  19150. var length = array == null ? 0 : array.length;
  19151. if (length) {
  19152. var index = baseSortedIndex(array, value, true) - 1;
  19153. if (eq(array[index], value)) {
  19154. return index;
  19155. }
  19156. }
  19157. return -1;
  19158. }
  19159. /**
  19160. * This method is like `_.uniq` except that it's designed and optimized
  19161. * for sorted arrays.
  19162. *
  19163. * @static
  19164. * @memberOf _
  19165. * @since 4.0.0
  19166. * @category Array
  19167. * @param {Array} array The array to inspect.
  19168. * @returns {Array} Returns the new duplicate free array.
  19169. * @example
  19170. *
  19171. * _.sortedUniq([1, 1, 2]);
  19172. * // => [1, 2]
  19173. */
  19174. function sortedUniq(array) {
  19175. return (array && array.length)
  19176. ? baseSortedUniq(array)
  19177. : [];
  19178. }
  19179. /**
  19180. * This method is like `_.uniqBy` except that it's designed and optimized
  19181. * for sorted arrays.
  19182. *
  19183. * @static
  19184. * @memberOf _
  19185. * @since 4.0.0
  19186. * @category Array
  19187. * @param {Array} array The array to inspect.
  19188. * @param {Function} [iteratee] The iteratee invoked per element.
  19189. * @returns {Array} Returns the new duplicate free array.
  19190. * @example
  19191. *
  19192. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  19193. * // => [1.1, 2.3]
  19194. */
  19195. function sortedUniqBy(array, iteratee) {
  19196. return (array && array.length)
  19197. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  19198. : [];
  19199. }
  19200. /**
  19201. * Gets all but the first element of `array`.
  19202. *
  19203. * @static
  19204. * @memberOf _
  19205. * @since 4.0.0
  19206. * @category Array
  19207. * @param {Array} array The array to query.
  19208. * @returns {Array} Returns the slice of `array`.
  19209. * @example
  19210. *
  19211. * _.tail([1, 2, 3]);
  19212. * // => [2, 3]
  19213. */
  19214. function tail(array) {
  19215. var length = array == null ? 0 : array.length;
  19216. return length ? baseSlice(array, 1, length) : [];
  19217. }
  19218. /**
  19219. * Creates a slice of `array` with `n` elements taken from the beginning.
  19220. *
  19221. * @static
  19222. * @memberOf _
  19223. * @since 0.1.0
  19224. * @category Array
  19225. * @param {Array} array The array to query.
  19226. * @param {number} [n=1] The number of elements to take.
  19227. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  19228. * @returns {Array} Returns the slice of `array`.
  19229. * @example
  19230. *
  19231. * _.take([1, 2, 3]);
  19232. * // => [1]
  19233. *
  19234. * _.take([1, 2, 3], 2);
  19235. * // => [1, 2]
  19236. *
  19237. * _.take([1, 2, 3], 5);
  19238. * // => [1, 2, 3]
  19239. *
  19240. * _.take([1, 2, 3], 0);
  19241. * // => []
  19242. */
  19243. function take(array, n, guard) {
  19244. if (!(array && array.length)) {
  19245. return [];
  19246. }
  19247. n = (guard || n === undefined) ? 1 : toInteger(n);
  19248. return baseSlice(array, 0, n < 0 ? 0 : n);
  19249. }
  19250. /**
  19251. * Creates a slice of `array` with `n` elements taken from the end.
  19252. *
  19253. * @static
  19254. * @memberOf _
  19255. * @since 3.0.0
  19256. * @category Array
  19257. * @param {Array} array The array to query.
  19258. * @param {number} [n=1] The number of elements to take.
  19259. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  19260. * @returns {Array} Returns the slice of `array`.
  19261. * @example
  19262. *
  19263. * _.takeRight([1, 2, 3]);
  19264. * // => [3]
  19265. *
  19266. * _.takeRight([1, 2, 3], 2);
  19267. * // => [2, 3]
  19268. *
  19269. * _.takeRight([1, 2, 3], 5);
  19270. * // => [1, 2, 3]
  19271. *
  19272. * _.takeRight([1, 2, 3], 0);
  19273. * // => []
  19274. */
  19275. function takeRight(array, n, guard) {
  19276. var length = array == null ? 0 : array.length;
  19277. if (!length) {
  19278. return [];
  19279. }
  19280. n = (guard || n === undefined) ? 1 : toInteger(n);
  19281. n = length - n;
  19282. return baseSlice(array, n < 0 ? 0 : n, length);
  19283. }
  19284. /**
  19285. * Creates a slice of `array` with elements taken from the end. Elements are
  19286. * taken until `predicate` returns falsey. The predicate is invoked with
  19287. * three arguments: (value, index, array).
  19288. *
  19289. * @static
  19290. * @memberOf _
  19291. * @since 3.0.0
  19292. * @category Array
  19293. * @param {Array} array The array to query.
  19294. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  19295. * @returns {Array} Returns the slice of `array`.
  19296. * @example
  19297. *
  19298. * var users = [
  19299. * { 'user': 'barney', 'active': true },
  19300. * { 'user': 'fred', 'active': false },
  19301. * { 'user': 'pebbles', 'active': false }
  19302. * ];
  19303. *
  19304. * _.takeRightWhile(users, function(o) { return !o.active; });
  19305. * // => objects for ['fred', 'pebbles']
  19306. *
  19307. * // The `_.matches` iteratee shorthand.
  19308. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  19309. * // => objects for ['pebbles']
  19310. *
  19311. * // The `_.matchesProperty` iteratee shorthand.
  19312. * _.takeRightWhile(users, ['active', false]);
  19313. * // => objects for ['fred', 'pebbles']
  19314. *
  19315. * // The `_.property` iteratee shorthand.
  19316. * _.takeRightWhile(users, 'active');
  19317. * // => []
  19318. */
  19319. function takeRightWhile(array, predicate) {
  19320. return (array && array.length)
  19321. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  19322. : [];
  19323. }
  19324. /**
  19325. * Creates a slice of `array` with elements taken from the beginning. Elements
  19326. * are taken until `predicate` returns falsey. The predicate is invoked with
  19327. * three arguments: (value, index, array).
  19328. *
  19329. * @static
  19330. * @memberOf _
  19331. * @since 3.0.0
  19332. * @category Array
  19333. * @param {Array} array The array to query.
  19334. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  19335. * @returns {Array} Returns the slice of `array`.
  19336. * @example
  19337. *
  19338. * var users = [
  19339. * { 'user': 'barney', 'active': false },
  19340. * { 'user': 'fred', 'active': false },
  19341. * { 'user': 'pebbles', 'active': true }
  19342. * ];
  19343. *
  19344. * _.takeWhile(users, function(o) { return !o.active; });
  19345. * // => objects for ['barney', 'fred']
  19346. *
  19347. * // The `_.matches` iteratee shorthand.
  19348. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  19349. * // => objects for ['barney']
  19350. *
  19351. * // The `_.matchesProperty` iteratee shorthand.
  19352. * _.takeWhile(users, ['active', false]);
  19353. * // => objects for ['barney', 'fred']
  19354. *
  19355. * // The `_.property` iteratee shorthand.
  19356. * _.takeWhile(users, 'active');
  19357. * // => []
  19358. */
  19359. function takeWhile(array, predicate) {
  19360. return (array && array.length)
  19361. ? baseWhile(array, getIteratee(predicate, 3))
  19362. : [];
  19363. }
  19364. /**
  19365. * Creates an array of unique values, in order, from all given arrays using
  19366. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  19367. * for equality comparisons.
  19368. *
  19369. * @static
  19370. * @memberOf _
  19371. * @since 0.1.0
  19372. * @category Array
  19373. * @param {...Array} [arrays] The arrays to inspect.
  19374. * @returns {Array} Returns the new array of combined values.
  19375. * @example
  19376. *
  19377. * _.union([2], [1, 2]);
  19378. * // => [2, 1]
  19379. */
  19380. var union = baseRest(function(arrays) {
  19381. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  19382. });
  19383. /**
  19384. * This method is like `_.union` except that it accepts `iteratee` which is
  19385. * invoked for each element of each `arrays` to generate the criterion by
  19386. * which uniqueness is computed. Result values are chosen from the first
  19387. * array in which the value occurs. The iteratee is invoked with one argument:
  19388. * (value).
  19389. *
  19390. * @static
  19391. * @memberOf _
  19392. * @since 4.0.0
  19393. * @category Array
  19394. * @param {...Array} [arrays] The arrays to inspect.
  19395. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  19396. * @returns {Array} Returns the new array of combined values.
  19397. * @example
  19398. *
  19399. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  19400. * // => [2.1, 1.2]
  19401. *
  19402. * // The `_.property` iteratee shorthand.
  19403. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  19404. * // => [{ 'x': 1 }, { 'x': 2 }]
  19405. */
  19406. var unionBy = baseRest(function(arrays) {
  19407. var iteratee = last(arrays);
  19408. if (isArrayLikeObject(iteratee)) {
  19409. iteratee = undefined;
  19410. }
  19411. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  19412. });
  19413. /**
  19414. * This method is like `_.union` except that it accepts `comparator` which
  19415. * is invoked to compare elements of `arrays`. Result values are chosen from
  19416. * the first array in which the value occurs. The comparator is invoked
  19417. * with two arguments: (arrVal, othVal).
  19418. *
  19419. * @static
  19420. * @memberOf _
  19421. * @since 4.0.0
  19422. * @category Array
  19423. * @param {...Array} [arrays] The arrays to inspect.
  19424. * @param {Function} [comparator] The comparator invoked per element.
  19425. * @returns {Array} Returns the new array of combined values.
  19426. * @example
  19427. *
  19428. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  19429. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  19430. *
  19431. * _.unionWith(objects, others, _.isEqual);
  19432. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  19433. */
  19434. var unionWith = baseRest(function(arrays) {
  19435. var comparator = last(arrays);
  19436. comparator = typeof comparator == 'function' ? comparator : undefined;
  19437. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  19438. });
  19439. /**
  19440. * Creates a duplicate-free version of an array, using
  19441. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  19442. * for equality comparisons, in which only the first occurrence of each element
  19443. * is kept. The order of result values is determined by the order they occur
  19444. * in the array.
  19445. *
  19446. * @static
  19447. * @memberOf _
  19448. * @since 0.1.0
  19449. * @category Array
  19450. * @param {Array} array The array to inspect.
  19451. * @returns {Array} Returns the new duplicate free array.
  19452. * @example
  19453. *
  19454. * _.uniq([2, 1, 2]);
  19455. * // => [2, 1]
  19456. */
  19457. function uniq(array) {
  19458. return (array && array.length) ? baseUniq(array) : [];
  19459. }
  19460. /**
  19461. * This method is like `_.uniq` except that it accepts `iteratee` which is
  19462. * invoked for each element in `array` to generate the criterion by which
  19463. * uniqueness is computed. The order of result values is determined by the
  19464. * order they occur in the array. The iteratee is invoked with one argument:
  19465. * (value).
  19466. *
  19467. * @static
  19468. * @memberOf _
  19469. * @since 4.0.0
  19470. * @category Array
  19471. * @param {Array} array The array to inspect.
  19472. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  19473. * @returns {Array} Returns the new duplicate free array.
  19474. * @example
  19475. *
  19476. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  19477. * // => [2.1, 1.2]
  19478. *
  19479. * // The `_.property` iteratee shorthand.
  19480. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  19481. * // => [{ 'x': 1 }, { 'x': 2 }]
  19482. */
  19483. function uniqBy(array, iteratee) {
  19484. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  19485. }
  19486. /**
  19487. * This method is like `_.uniq` except that it accepts `comparator` which
  19488. * is invoked to compare elements of `array`. The order of result values is
  19489. * determined by the order they occur in the array.The comparator is invoked
  19490. * with two arguments: (arrVal, othVal).
  19491. *
  19492. * @static
  19493. * @memberOf _
  19494. * @since 4.0.0
  19495. * @category Array
  19496. * @param {Array} array The array to inspect.
  19497. * @param {Function} [comparator] The comparator invoked per element.
  19498. * @returns {Array} Returns the new duplicate free array.
  19499. * @example
  19500. *
  19501. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  19502. *
  19503. * _.uniqWith(objects, _.isEqual);
  19504. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  19505. */
  19506. function uniqWith(array, comparator) {
  19507. comparator = typeof comparator == 'function' ? comparator : undefined;
  19508. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  19509. }
  19510. /**
  19511. * This method is like `_.zip` except that it accepts an array of grouped
  19512. * elements and creates an array regrouping the elements to their pre-zip
  19513. * configuration.
  19514. *
  19515. * @static
  19516. * @memberOf _
  19517. * @since 1.2.0
  19518. * @category Array
  19519. * @param {Array} array The array of grouped elements to process.
  19520. * @returns {Array} Returns the new array of regrouped elements.
  19521. * @example
  19522. *
  19523. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  19524. * // => [['a', 1, true], ['b', 2, false]]
  19525. *
  19526. * _.unzip(zipped);
  19527. * // => [['a', 'b'], [1, 2], [true, false]]
  19528. */
  19529. function unzip(array) {
  19530. if (!(array && array.length)) {
  19531. return [];
  19532. }
  19533. var length = 0;
  19534. array = arrayFilter(array, function(group) {
  19535. if (isArrayLikeObject(group)) {
  19536. length = nativeMax(group.length, length);
  19537. return true;
  19538. }
  19539. });
  19540. return baseTimes(length, function(index) {
  19541. return arrayMap(array, baseProperty(index));
  19542. });
  19543. }
  19544. /**
  19545. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  19546. * how regrouped values should be combined. The iteratee is invoked with the
  19547. * elements of each group: (...group).
  19548. *
  19549. * @static
  19550. * @memberOf _
  19551. * @since 3.8.0
  19552. * @category Array
  19553. * @param {Array} array The array of grouped elements to process.
  19554. * @param {Function} [iteratee=_.identity] The function to combine
  19555. * regrouped values.
  19556. * @returns {Array} Returns the new array of regrouped elements.
  19557. * @example
  19558. *
  19559. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  19560. * // => [[1, 10, 100], [2, 20, 200]]
  19561. *
  19562. * _.unzipWith(zipped, _.add);
  19563. * // => [3, 30, 300]
  19564. */
  19565. function unzipWith(array, iteratee) {
  19566. if (!(array && array.length)) {
  19567. return [];
  19568. }
  19569. var result = unzip(array);
  19570. if (iteratee == null) {
  19571. return result;
  19572. }
  19573. return arrayMap(result, function(group) {
  19574. return apply(iteratee, undefined, group);
  19575. });
  19576. }
  19577. /**
  19578. * Creates an array excluding all given values using
  19579. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  19580. * for equality comparisons.
  19581. *
  19582. * **Note:** Unlike `_.pull`, this method returns a new array.
  19583. *
  19584. * @static
  19585. * @memberOf _
  19586. * @since 0.1.0
  19587. * @category Array
  19588. * @param {Array} array The array to inspect.
  19589. * @param {...*} [values] The values to exclude.
  19590. * @returns {Array} Returns the new array of filtered values.
  19591. * @see _.difference, _.xor
  19592. * @example
  19593. *
  19594. * _.without([2, 1, 2, 3], 1, 2);
  19595. * // => [3]
  19596. */
  19597. var without = baseRest(function(array, values) {
  19598. return isArrayLikeObject(array)
  19599. ? baseDifference(array, values)
  19600. : [];
  19601. });
  19602. /**
  19603. * Creates an array of unique values that is the
  19604. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  19605. * of the given arrays. The order of result values is determined by the order
  19606. * they occur in the arrays.
  19607. *
  19608. * @static
  19609. * @memberOf _
  19610. * @since 2.4.0
  19611. * @category Array
  19612. * @param {...Array} [arrays] The arrays to inspect.
  19613. * @returns {Array} Returns the new array of filtered values.
  19614. * @see _.difference, _.without
  19615. * @example
  19616. *
  19617. * _.xor([2, 1], [2, 3]);
  19618. * // => [1, 3]
  19619. */
  19620. var xor = baseRest(function(arrays) {
  19621. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  19622. });
  19623. /**
  19624. * This method is like `_.xor` except that it accepts `iteratee` which is
  19625. * invoked for each element of each `arrays` to generate the criterion by
  19626. * which by which they're compared. The order of result values is determined
  19627. * by the order they occur in the arrays. The iteratee is invoked with one
  19628. * argument: (value).
  19629. *
  19630. * @static
  19631. * @memberOf _
  19632. * @since 4.0.0
  19633. * @category Array
  19634. * @param {...Array} [arrays] The arrays to inspect.
  19635. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  19636. * @returns {Array} Returns the new array of filtered values.
  19637. * @example
  19638. *
  19639. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  19640. * // => [1.2, 3.4]
  19641. *
  19642. * // The `_.property` iteratee shorthand.
  19643. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  19644. * // => [{ 'x': 2 }]
  19645. */
  19646. var xorBy = baseRest(function(arrays) {
  19647. var iteratee = last(arrays);
  19648. if (isArrayLikeObject(iteratee)) {
  19649. iteratee = undefined;
  19650. }
  19651. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  19652. });
  19653. /**
  19654. * This method is like `_.xor` except that it accepts `comparator` which is
  19655. * invoked to compare elements of `arrays`. The order of result values is
  19656. * determined by the order they occur in the arrays. The comparator is invoked
  19657. * with two arguments: (arrVal, othVal).
  19658. *
  19659. * @static
  19660. * @memberOf _
  19661. * @since 4.0.0
  19662. * @category Array
  19663. * @param {...Array} [arrays] The arrays to inspect.
  19664. * @param {Function} [comparator] The comparator invoked per element.
  19665. * @returns {Array} Returns the new array of filtered values.
  19666. * @example
  19667. *
  19668. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  19669. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  19670. *
  19671. * _.xorWith(objects, others, _.isEqual);
  19672. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  19673. */
  19674. var xorWith = baseRest(function(arrays) {
  19675. var comparator = last(arrays);
  19676. comparator = typeof comparator == 'function' ? comparator : undefined;
  19677. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  19678. });
  19679. /**
  19680. * Creates an array of grouped elements, the first of which contains the
  19681. * first elements of the given arrays, the second of which contains the
  19682. * second elements of the given arrays, and so on.
  19683. *
  19684. * @static
  19685. * @memberOf _
  19686. * @since 0.1.0
  19687. * @category Array
  19688. * @param {...Array} [arrays] The arrays to process.
  19689. * @returns {Array} Returns the new array of grouped elements.
  19690. * @example
  19691. *
  19692. * _.zip(['a', 'b'], [1, 2], [true, false]);
  19693. * // => [['a', 1, true], ['b', 2, false]]
  19694. */
  19695. var zip = baseRest(unzip);
  19696. /**
  19697. * This method is like `_.fromPairs` except that it accepts two arrays,
  19698. * one of property identifiers and one of corresponding values.
  19699. *
  19700. * @static
  19701. * @memberOf _
  19702. * @since 0.4.0
  19703. * @category Array
  19704. * @param {Array} [props=[]] The property identifiers.
  19705. * @param {Array} [values=[]] The property values.
  19706. * @returns {Object} Returns the new object.
  19707. * @example
  19708. *
  19709. * _.zipObject(['a', 'b'], [1, 2]);
  19710. * // => { 'a': 1, 'b': 2 }
  19711. */
  19712. function zipObject(props, values) {
  19713. return baseZipObject(props || [], values || [], assignValue);
  19714. }
  19715. /**
  19716. * This method is like `_.zipObject` except that it supports property paths.
  19717. *
  19718. * @static
  19719. * @memberOf _
  19720. * @since 4.1.0
  19721. * @category Array
  19722. * @param {Array} [props=[]] The property identifiers.
  19723. * @param {Array} [values=[]] The property values.
  19724. * @returns {Object} Returns the new object.
  19725. * @example
  19726. *
  19727. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  19728. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  19729. */
  19730. function zipObjectDeep(props, values) {
  19731. return baseZipObject(props || [], values || [], baseSet);
  19732. }
  19733. /**
  19734. * This method is like `_.zip` except that it accepts `iteratee` to specify
  19735. * how grouped values should be combined. The iteratee is invoked with the
  19736. * elements of each group: (...group).
  19737. *
  19738. * @static
  19739. * @memberOf _
  19740. * @since 3.8.0
  19741. * @category Array
  19742. * @param {...Array} [arrays] The arrays to process.
  19743. * @param {Function} [iteratee=_.identity] The function to combine
  19744. * grouped values.
  19745. * @returns {Array} Returns the new array of grouped elements.
  19746. * @example
  19747. *
  19748. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  19749. * return a + b + c;
  19750. * });
  19751. * // => [111, 222]
  19752. */
  19753. var zipWith = baseRest(function(arrays) {
  19754. var length = arrays.length,
  19755. iteratee = length > 1 ? arrays[length - 1] : undefined;
  19756. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  19757. return unzipWith(arrays, iteratee);
  19758. });
  19759. /*------------------------------------------------------------------------*/
  19760. /**
  19761. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  19762. * chain sequences enabled. The result of such sequences must be unwrapped
  19763. * with `_#value`.
  19764. *
  19765. * @static
  19766. * @memberOf _
  19767. * @since 1.3.0
  19768. * @category Seq
  19769. * @param {*} value The value to wrap.
  19770. * @returns {Object} Returns the new `lodash` wrapper instance.
  19771. * @example
  19772. *
  19773. * var users = [
  19774. * { 'user': 'barney', 'age': 36 },
  19775. * { 'user': 'fred', 'age': 40 },
  19776. * { 'user': 'pebbles', 'age': 1 }
  19777. * ];
  19778. *
  19779. * var youngest = _
  19780. * .chain(users)
  19781. * .sortBy('age')
  19782. * .map(function(o) {
  19783. * return o.user + ' is ' + o.age;
  19784. * })
  19785. * .head()
  19786. * .value();
  19787. * // => 'pebbles is 1'
  19788. */
  19789. function chain(value) {
  19790. var result = lodash(value);
  19791. result.__chain__ = true;
  19792. return result;
  19793. }
  19794. /**
  19795. * This method invokes `interceptor` and returns `value`. The interceptor
  19796. * is invoked with one argument; (value). The purpose of this method is to
  19797. * "tap into" a method chain sequence in order to modify intermediate results.
  19798. *
  19799. * @static
  19800. * @memberOf _
  19801. * @since 0.1.0
  19802. * @category Seq
  19803. * @param {*} value The value to provide to `interceptor`.
  19804. * @param {Function} interceptor The function to invoke.
  19805. * @returns {*} Returns `value`.
  19806. * @example
  19807. *
  19808. * _([1, 2, 3])
  19809. * .tap(function(array) {
  19810. * // Mutate input array.
  19811. * array.pop();
  19812. * })
  19813. * .reverse()
  19814. * .value();
  19815. * // => [2, 1]
  19816. */
  19817. function tap(value, interceptor) {
  19818. interceptor(value);
  19819. return value;
  19820. }
  19821. /**
  19822. * This method is like `_.tap` except that it returns the result of `interceptor`.
  19823. * The purpose of this method is to "pass thru" values replacing intermediate
  19824. * results in a method chain sequence.
  19825. *
  19826. * @static
  19827. * @memberOf _
  19828. * @since 3.0.0
  19829. * @category Seq
  19830. * @param {*} value The value to provide to `interceptor`.
  19831. * @param {Function} interceptor The function to invoke.
  19832. * @returns {*} Returns the result of `interceptor`.
  19833. * @example
  19834. *
  19835. * _(' abc ')
  19836. * .chain()
  19837. * .trim()
  19838. * .thru(function(value) {
  19839. * return [value];
  19840. * })
  19841. * .value();
  19842. * // => ['abc']
  19843. */
  19844. function thru(value, interceptor) {
  19845. return interceptor(value);
  19846. }
  19847. /**
  19848. * This method is the wrapper version of `_.at`.
  19849. *
  19850. * @name at
  19851. * @memberOf _
  19852. * @since 1.0.0
  19853. * @category Seq
  19854. * @param {...(string|string[])} [paths] The property paths to pick.
  19855. * @returns {Object} Returns the new `lodash` wrapper instance.
  19856. * @example
  19857. *
  19858. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  19859. *
  19860. * _(object).at(['a[0].b.c', 'a[1]']).value();
  19861. * // => [3, 4]
  19862. */
  19863. var wrapperAt = flatRest(function(paths) {
  19864. var length = paths.length,
  19865. start = length ? paths[0] : 0,
  19866. value = this.__wrapped__,
  19867. interceptor = function(object) { return baseAt(object, paths); };
  19868. if (length > 1 || this.__actions__.length ||
  19869. !(value instanceof LazyWrapper) || !isIndex(start)) {
  19870. return this.thru(interceptor);
  19871. }
  19872. value = value.slice(start, +start + (length ? 1 : 0));
  19873. value.__actions__.push({
  19874. 'func': thru,
  19875. 'args': [interceptor],
  19876. 'thisArg': undefined
  19877. });
  19878. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  19879. if (length && !array.length) {
  19880. array.push(undefined);
  19881. }
  19882. return array;
  19883. });
  19884. });
  19885. /**
  19886. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  19887. *
  19888. * @name chain
  19889. * @memberOf _
  19890. * @since 0.1.0
  19891. * @category Seq
  19892. * @returns {Object} Returns the new `lodash` wrapper instance.
  19893. * @example
  19894. *
  19895. * var users = [
  19896. * { 'user': 'barney', 'age': 36 },
  19897. * { 'user': 'fred', 'age': 40 }
  19898. * ];
  19899. *
  19900. * // A sequence without explicit chaining.
  19901. * _(users).head();
  19902. * // => { 'user': 'barney', 'age': 36 }
  19903. *
  19904. * // A sequence with explicit chaining.
  19905. * _(users)
  19906. * .chain()
  19907. * .head()
  19908. * .pick('user')
  19909. * .value();
  19910. * // => { 'user': 'barney' }
  19911. */
  19912. function wrapperChain() {
  19913. return chain(this);
  19914. }
  19915. /**
  19916. * Executes the chain sequence and returns the wrapped result.
  19917. *
  19918. * @name commit
  19919. * @memberOf _
  19920. * @since 3.2.0
  19921. * @category Seq
  19922. * @returns {Object} Returns the new `lodash` wrapper instance.
  19923. * @example
  19924. *
  19925. * var array = [1, 2];
  19926. * var wrapped = _(array).push(3);
  19927. *
  19928. * console.log(array);
  19929. * // => [1, 2]
  19930. *
  19931. * wrapped = wrapped.commit();
  19932. * console.log(array);
  19933. * // => [1, 2, 3]
  19934. *
  19935. * wrapped.last();
  19936. * // => 3
  19937. *
  19938. * console.log(array);
  19939. * // => [1, 2, 3]
  19940. */
  19941. function wrapperCommit() {
  19942. return new LodashWrapper(this.value(), this.__chain__);
  19943. }
  19944. /**
  19945. * Gets the next value on a wrapped object following the
  19946. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  19947. *
  19948. * @name next
  19949. * @memberOf _
  19950. * @since 4.0.0
  19951. * @category Seq
  19952. * @returns {Object} Returns the next iterator value.
  19953. * @example
  19954. *
  19955. * var wrapped = _([1, 2]);
  19956. *
  19957. * wrapped.next();
  19958. * // => { 'done': false, 'value': 1 }
  19959. *
  19960. * wrapped.next();
  19961. * // => { 'done': false, 'value': 2 }
  19962. *
  19963. * wrapped.next();
  19964. * // => { 'done': true, 'value': undefined }
  19965. */
  19966. function wrapperNext() {
  19967. if (this.__values__ === undefined) {
  19968. this.__values__ = toArray(this.value());
  19969. }
  19970. var done = this.__index__ >= this.__values__.length,
  19971. value = done ? undefined : this.__values__[this.__index__++];
  19972. return { 'done': done, 'value': value };
  19973. }
  19974. /**
  19975. * Enables the wrapper to be iterable.
  19976. *
  19977. * @name Symbol.iterator
  19978. * @memberOf _
  19979. * @since 4.0.0
  19980. * @category Seq
  19981. * @returns {Object} Returns the wrapper object.
  19982. * @example
  19983. *
  19984. * var wrapped = _([1, 2]);
  19985. *
  19986. * wrapped[Symbol.iterator]() === wrapped;
  19987. * // => true
  19988. *
  19989. * Array.from(wrapped);
  19990. * // => [1, 2]
  19991. */
  19992. function wrapperToIterator() {
  19993. return this;
  19994. }
  19995. /**
  19996. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  19997. *
  19998. * @name plant
  19999. * @memberOf _
  20000. * @since 3.2.0
  20001. * @category Seq
  20002. * @param {*} value The value to plant.
  20003. * @returns {Object} Returns the new `lodash` wrapper instance.
  20004. * @example
  20005. *
  20006. * function square(n) {
  20007. * return n * n;
  20008. * }
  20009. *
  20010. * var wrapped = _([1, 2]).map(square);
  20011. * var other = wrapped.plant([3, 4]);
  20012. *
  20013. * other.value();
  20014. * // => [9, 16]
  20015. *
  20016. * wrapped.value();
  20017. * // => [1, 4]
  20018. */
  20019. function wrapperPlant(value) {
  20020. var result,
  20021. parent = this;
  20022. while (parent instanceof baseLodash) {
  20023. var clone = wrapperClone(parent);
  20024. clone.__index__ = 0;
  20025. clone.__values__ = undefined;
  20026. if (result) {
  20027. previous.__wrapped__ = clone;
  20028. } else {
  20029. result = clone;
  20030. }
  20031. var previous = clone;
  20032. parent = parent.__wrapped__;
  20033. }
  20034. previous.__wrapped__ = value;
  20035. return result;
  20036. }
  20037. /**
  20038. * This method is the wrapper version of `_.reverse`.
  20039. *
  20040. * **Note:** This method mutates the wrapped array.
  20041. *
  20042. * @name reverse
  20043. * @memberOf _
  20044. * @since 0.1.0
  20045. * @category Seq
  20046. * @returns {Object} Returns the new `lodash` wrapper instance.
  20047. * @example
  20048. *
  20049. * var array = [1, 2, 3];
  20050. *
  20051. * _(array).reverse().value()
  20052. * // => [3, 2, 1]
  20053. *
  20054. * console.log(array);
  20055. * // => [3, 2, 1]
  20056. */
  20057. function wrapperReverse() {
  20058. var value = this.__wrapped__;
  20059. if (value instanceof LazyWrapper) {
  20060. var wrapped = value;
  20061. if (this.__actions__.length) {
  20062. wrapped = new LazyWrapper(this);
  20063. }
  20064. wrapped = wrapped.reverse();
  20065. wrapped.__actions__.push({
  20066. 'func': thru,
  20067. 'args': [reverse],
  20068. 'thisArg': undefined
  20069. });
  20070. return new LodashWrapper(wrapped, this.__chain__);
  20071. }
  20072. return this.thru(reverse);
  20073. }
  20074. /**
  20075. * Executes the chain sequence to resolve the unwrapped value.
  20076. *
  20077. * @name value
  20078. * @memberOf _
  20079. * @since 0.1.0
  20080. * @alias toJSON, valueOf
  20081. * @category Seq
  20082. * @returns {*} Returns the resolved unwrapped value.
  20083. * @example
  20084. *
  20085. * _([1, 2, 3]).value();
  20086. * // => [1, 2, 3]
  20087. */
  20088. function wrapperValue() {
  20089. return baseWrapperValue(this.__wrapped__, this.__actions__);
  20090. }
  20091. /*------------------------------------------------------------------------*/
  20092. /**
  20093. * Creates an object composed of keys generated from the results of running
  20094. * each element of `collection` thru `iteratee`. The corresponding value of
  20095. * each key is the number of times the key was returned by `iteratee`. The
  20096. * iteratee is invoked with one argument: (value).
  20097. *
  20098. * @static
  20099. * @memberOf _
  20100. * @since 0.5.0
  20101. * @category Collection
  20102. * @param {Array|Object} collection The collection to iterate over.
  20103. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  20104. * @returns {Object} Returns the composed aggregate object.
  20105. * @example
  20106. *
  20107. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  20108. * // => { '4': 1, '6': 2 }
  20109. *
  20110. * // The `_.property` iteratee shorthand.
  20111. * _.countBy(['one', 'two', 'three'], 'length');
  20112. * // => { '3': 2, '5': 1 }
  20113. */
  20114. var countBy = createAggregator(function(result, value, key) {
  20115. if (hasOwnProperty.call(result, key)) {
  20116. ++result[key];
  20117. } else {
  20118. baseAssignValue(result, key, 1);
  20119. }
  20120. });
  20121. /**
  20122. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  20123. * Iteration is stopped once `predicate` returns falsey. The predicate is
  20124. * invoked with three arguments: (value, index|key, collection).
  20125. *
  20126. * **Note:** This method returns `true` for
  20127. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  20128. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  20129. * elements of empty collections.
  20130. *
  20131. * @static
  20132. * @memberOf _
  20133. * @since 0.1.0
  20134. * @category Collection
  20135. * @param {Array|Object} collection The collection to iterate over.
  20136. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20137. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20138. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20139. * else `false`.
  20140. * @example
  20141. *
  20142. * _.every([true, 1, null, 'yes'], Boolean);
  20143. * // => false
  20144. *
  20145. * var users = [
  20146. * { 'user': 'barney', 'age': 36, 'active': false },
  20147. * { 'user': 'fred', 'age': 40, 'active': false }
  20148. * ];
  20149. *
  20150. * // The `_.matches` iteratee shorthand.
  20151. * _.every(users, { 'user': 'barney', 'active': false });
  20152. * // => false
  20153. *
  20154. * // The `_.matchesProperty` iteratee shorthand.
  20155. * _.every(users, ['active', false]);
  20156. * // => true
  20157. *
  20158. * // The `_.property` iteratee shorthand.
  20159. * _.every(users, 'active');
  20160. * // => false
  20161. */
  20162. function every(collection, predicate, guard) {
  20163. var func = isArray(collection) ? arrayEvery : baseEvery;
  20164. if (guard && isIterateeCall(collection, predicate, guard)) {
  20165. predicate = undefined;
  20166. }
  20167. return func(collection, getIteratee(predicate, 3));
  20168. }
  20169. /**
  20170. * Iterates over elements of `collection`, returning an array of all elements
  20171. * `predicate` returns truthy for. The predicate is invoked with three
  20172. * arguments: (value, index|key, collection).
  20173. *
  20174. * **Note:** Unlike `_.remove`, this method returns a new array.
  20175. *
  20176. * @static
  20177. * @memberOf _
  20178. * @since 0.1.0
  20179. * @category Collection
  20180. * @param {Array|Object} collection The collection to iterate over.
  20181. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20182. * @returns {Array} Returns the new filtered array.
  20183. * @see _.reject
  20184. * @example
  20185. *
  20186. * var users = [
  20187. * { 'user': 'barney', 'age': 36, 'active': true },
  20188. * { 'user': 'fred', 'age': 40, 'active': false }
  20189. * ];
  20190. *
  20191. * _.filter(users, function(o) { return !o.active; });
  20192. * // => objects for ['fred']
  20193. *
  20194. * // The `_.matches` iteratee shorthand.
  20195. * _.filter(users, { 'age': 36, 'active': true });
  20196. * // => objects for ['barney']
  20197. *
  20198. * // The `_.matchesProperty` iteratee shorthand.
  20199. * _.filter(users, ['active', false]);
  20200. * // => objects for ['fred']
  20201. *
  20202. * // The `_.property` iteratee shorthand.
  20203. * _.filter(users, 'active');
  20204. * // => objects for ['barney']
  20205. */
  20206. function filter(collection, predicate) {
  20207. var func = isArray(collection) ? arrayFilter : baseFilter;
  20208. return func(collection, getIteratee(predicate, 3));
  20209. }
  20210. /**
  20211. * Iterates over elements of `collection`, returning the first element
  20212. * `predicate` returns truthy for. The predicate is invoked with three
  20213. * arguments: (value, index|key, collection).
  20214. *
  20215. * @static
  20216. * @memberOf _
  20217. * @since 0.1.0
  20218. * @category Collection
  20219. * @param {Array|Object} collection The collection to inspect.
  20220. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20221. * @param {number} [fromIndex=0] The index to search from.
  20222. * @returns {*} Returns the matched element, else `undefined`.
  20223. * @example
  20224. *
  20225. * var users = [
  20226. * { 'user': 'barney', 'age': 36, 'active': true },
  20227. * { 'user': 'fred', 'age': 40, 'active': false },
  20228. * { 'user': 'pebbles', 'age': 1, 'active': true }
  20229. * ];
  20230. *
  20231. * _.find(users, function(o) { return o.age < 40; });
  20232. * // => object for 'barney'
  20233. *
  20234. * // The `_.matches` iteratee shorthand.
  20235. * _.find(users, { 'age': 1, 'active': true });
  20236. * // => object for 'pebbles'
  20237. *
  20238. * // The `_.matchesProperty` iteratee shorthand.
  20239. * _.find(users, ['active', false]);
  20240. * // => object for 'fred'
  20241. *
  20242. * // The `_.property` iteratee shorthand.
  20243. * _.find(users, 'active');
  20244. * // => object for 'barney'
  20245. */
  20246. var find = createFind(findIndex);
  20247. /**
  20248. * This method is like `_.find` except that it iterates over elements of
  20249. * `collection` from right to left.
  20250. *
  20251. * @static
  20252. * @memberOf _
  20253. * @since 2.0.0
  20254. * @category Collection
  20255. * @param {Array|Object} collection The collection to inspect.
  20256. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20257. * @param {number} [fromIndex=collection.length-1] The index to search from.
  20258. * @returns {*} Returns the matched element, else `undefined`.
  20259. * @example
  20260. *
  20261. * _.findLast([1, 2, 3, 4], function(n) {
  20262. * return n % 2 == 1;
  20263. * });
  20264. * // => 3
  20265. */
  20266. var findLast = createFind(findLastIndex);
  20267. /**
  20268. * Creates a flattened array of values by running each element in `collection`
  20269. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  20270. * with three arguments: (value, index|key, collection).
  20271. *
  20272. * @static
  20273. * @memberOf _
  20274. * @since 4.0.0
  20275. * @category Collection
  20276. * @param {Array|Object} collection The collection to iterate over.
  20277. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  20278. * @returns {Array} Returns the new flattened array.
  20279. * @example
  20280. *
  20281. * function duplicate(n) {
  20282. * return [n, n];
  20283. * }
  20284. *
  20285. * _.flatMap([1, 2], duplicate);
  20286. * // => [1, 1, 2, 2]
  20287. */
  20288. function flatMap(collection, iteratee) {
  20289. return baseFlatten(map(collection, iteratee), 1);
  20290. }
  20291. /**
  20292. * This method is like `_.flatMap` except that it recursively flattens the
  20293. * mapped results.
  20294. *
  20295. * @static
  20296. * @memberOf _
  20297. * @since 4.7.0
  20298. * @category Collection
  20299. * @param {Array|Object} collection The collection to iterate over.
  20300. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  20301. * @returns {Array} Returns the new flattened array.
  20302. * @example
  20303. *
  20304. * function duplicate(n) {
  20305. * return [[[n, n]]];
  20306. * }
  20307. *
  20308. * _.flatMapDeep([1, 2], duplicate);
  20309. * // => [1, 1, 2, 2]
  20310. */
  20311. function flatMapDeep(collection, iteratee) {
  20312. return baseFlatten(map(collection, iteratee), INFINITY);
  20313. }
  20314. /**
  20315. * This method is like `_.flatMap` except that it recursively flattens the
  20316. * mapped results up to `depth` times.
  20317. *
  20318. * @static
  20319. * @memberOf _
  20320. * @since 4.7.0
  20321. * @category Collection
  20322. * @param {Array|Object} collection The collection to iterate over.
  20323. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  20324. * @param {number} [depth=1] The maximum recursion depth.
  20325. * @returns {Array} Returns the new flattened array.
  20326. * @example
  20327. *
  20328. * function duplicate(n) {
  20329. * return [[[n, n]]];
  20330. * }
  20331. *
  20332. * _.flatMapDepth([1, 2], duplicate, 2);
  20333. * // => [[1, 1], [2, 2]]
  20334. */
  20335. function flatMapDepth(collection, iteratee, depth) {
  20336. depth = depth === undefined ? 1 : toInteger(depth);
  20337. return baseFlatten(map(collection, iteratee), depth);
  20338. }
  20339. /**
  20340. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  20341. * The iteratee is invoked with three arguments: (value, index|key, collection).
  20342. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20343. *
  20344. * **Note:** As with other "Collections" methods, objects with a "length"
  20345. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  20346. * or `_.forOwn` for object iteration.
  20347. *
  20348. * @static
  20349. * @memberOf _
  20350. * @since 0.1.0
  20351. * @alias each
  20352. * @category Collection
  20353. * @param {Array|Object} collection The collection to iterate over.
  20354. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  20355. * @returns {Array|Object} Returns `collection`.
  20356. * @see _.forEachRight
  20357. * @example
  20358. *
  20359. * _.forEach([1, 2], function(value) {
  20360. * console.log(value);
  20361. * });
  20362. * // => Logs `1` then `2`.
  20363. *
  20364. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  20365. * console.log(key);
  20366. * });
  20367. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  20368. */
  20369. function forEach(collection, iteratee) {
  20370. var func = isArray(collection) ? arrayEach : baseEach;
  20371. return func(collection, getIteratee(iteratee, 3));
  20372. }
  20373. /**
  20374. * This method is like `_.forEach` except that it iterates over elements of
  20375. * `collection` from right to left.
  20376. *
  20377. * @static
  20378. * @memberOf _
  20379. * @since 2.0.0
  20380. * @alias eachRight
  20381. * @category Collection
  20382. * @param {Array|Object} collection The collection to iterate over.
  20383. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  20384. * @returns {Array|Object} Returns `collection`.
  20385. * @see _.forEach
  20386. * @example
  20387. *
  20388. * _.forEachRight([1, 2], function(value) {
  20389. * console.log(value);
  20390. * });
  20391. * // => Logs `2` then `1`.
  20392. */
  20393. function forEachRight(collection, iteratee) {
  20394. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  20395. return func(collection, getIteratee(iteratee, 3));
  20396. }
  20397. /**
  20398. * Creates an object composed of keys generated from the results of running
  20399. * each element of `collection` thru `iteratee`. The order of grouped values
  20400. * is determined by the order they occur in `collection`. The corresponding
  20401. * value of each key is an array of elements responsible for generating the
  20402. * key. The iteratee is invoked with one argument: (value).
  20403. *
  20404. * @static
  20405. * @memberOf _
  20406. * @since 0.1.0
  20407. * @category Collection
  20408. * @param {Array|Object} collection The collection to iterate over.
  20409. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  20410. * @returns {Object} Returns the composed aggregate object.
  20411. * @example
  20412. *
  20413. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  20414. * // => { '4': [4.2], '6': [6.1, 6.3] }
  20415. *
  20416. * // The `_.property` iteratee shorthand.
  20417. * _.groupBy(['one', 'two', 'three'], 'length');
  20418. * // => { '3': ['one', 'two'], '5': ['three'] }
  20419. */
  20420. var groupBy = createAggregator(function(result, value, key) {
  20421. if (hasOwnProperty.call(result, key)) {
  20422. result[key].push(value);
  20423. } else {
  20424. baseAssignValue(result, key, [value]);
  20425. }
  20426. });
  20427. /**
  20428. * Checks if `value` is in `collection`. If `collection` is a string, it's
  20429. * checked for a substring of `value`, otherwise
  20430. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20431. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  20432. * the offset from the end of `collection`.
  20433. *
  20434. * @static
  20435. * @memberOf _
  20436. * @since 0.1.0
  20437. * @category Collection
  20438. * @param {Array|Object|string} collection The collection to inspect.
  20439. * @param {*} value The value to search for.
  20440. * @param {number} [fromIndex=0] The index to search from.
  20441. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  20442. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  20443. * @example
  20444. *
  20445. * _.includes([1, 2, 3], 1);
  20446. * // => true
  20447. *
  20448. * _.includes([1, 2, 3], 1, 2);
  20449. * // => false
  20450. *
  20451. * _.includes({ 'a': 1, 'b': 2 }, 1);
  20452. * // => true
  20453. *
  20454. * _.includes('abcd', 'bc');
  20455. * // => true
  20456. */
  20457. function includes(collection, value, fromIndex, guard) {
  20458. collection = isArrayLike(collection) ? collection : values(collection);
  20459. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  20460. var length = collection.length;
  20461. if (fromIndex < 0) {
  20462. fromIndex = nativeMax(length + fromIndex, 0);
  20463. }
  20464. return isString(collection)
  20465. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  20466. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  20467. }
  20468. /**
  20469. * Invokes the method at `path` of each element in `collection`, returning
  20470. * an array of the results of each invoked method. Any additional arguments
  20471. * are provided to each invoked method. If `path` is a function, it's invoked
  20472. * for, and `this` bound to, each element in `collection`.
  20473. *
  20474. * @static
  20475. * @memberOf _
  20476. * @since 4.0.0
  20477. * @category Collection
  20478. * @param {Array|Object} collection The collection to iterate over.
  20479. * @param {Array|Function|string} path The path of the method to invoke or
  20480. * the function invoked per iteration.
  20481. * @param {...*} [args] The arguments to invoke each method with.
  20482. * @returns {Array} Returns the array of results.
  20483. * @example
  20484. *
  20485. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  20486. * // => [[1, 5, 7], [1, 2, 3]]
  20487. *
  20488. * _.invokeMap([123, 456], String.prototype.split, '');
  20489. * // => [['1', '2', '3'], ['4', '5', '6']]
  20490. */
  20491. var invokeMap = baseRest(function(collection, path, args) {
  20492. var index = -1,
  20493. isFunc = typeof path == 'function',
  20494. result = isArrayLike(collection) ? Array(collection.length) : [];
  20495. baseEach(collection, function(value) {
  20496. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  20497. });
  20498. return result;
  20499. });
  20500. /**
  20501. * Creates an object composed of keys generated from the results of running
  20502. * each element of `collection` thru `iteratee`. The corresponding value of
  20503. * each key is the last element responsible for generating the key. The
  20504. * iteratee is invoked with one argument: (value).
  20505. *
  20506. * @static
  20507. * @memberOf _
  20508. * @since 4.0.0
  20509. * @category Collection
  20510. * @param {Array|Object} collection The collection to iterate over.
  20511. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  20512. * @returns {Object} Returns the composed aggregate object.
  20513. * @example
  20514. *
  20515. * var array = [
  20516. * { 'dir': 'left', 'code': 97 },
  20517. * { 'dir': 'right', 'code': 100 }
  20518. * ];
  20519. *
  20520. * _.keyBy(array, function(o) {
  20521. * return String.fromCharCode(o.code);
  20522. * });
  20523. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  20524. *
  20525. * _.keyBy(array, 'dir');
  20526. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  20527. */
  20528. var keyBy = createAggregator(function(result, value, key) {
  20529. baseAssignValue(result, key, value);
  20530. });
  20531. /**
  20532. * Creates an array of values by running each element in `collection` thru
  20533. * `iteratee`. The iteratee is invoked with three arguments:
  20534. * (value, index|key, collection).
  20535. *
  20536. * Many lodash methods are guarded to work as iteratees for methods like
  20537. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  20538. *
  20539. * The guarded methods are:
  20540. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  20541. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  20542. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  20543. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  20544. *
  20545. * @static
  20546. * @memberOf _
  20547. * @since 0.1.0
  20548. * @category Collection
  20549. * @param {Array|Object} collection The collection to iterate over.
  20550. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  20551. * @returns {Array} Returns the new mapped array.
  20552. * @example
  20553. *
  20554. * function square(n) {
  20555. * return n * n;
  20556. * }
  20557. *
  20558. * _.map([4, 8], square);
  20559. * // => [16, 64]
  20560. *
  20561. * _.map({ 'a': 4, 'b': 8 }, square);
  20562. * // => [16, 64] (iteration order is not guaranteed)
  20563. *
  20564. * var users = [
  20565. * { 'user': 'barney' },
  20566. * { 'user': 'fred' }
  20567. * ];
  20568. *
  20569. * // The `_.property` iteratee shorthand.
  20570. * _.map(users, 'user');
  20571. * // => ['barney', 'fred']
  20572. */
  20573. function map(collection, iteratee) {
  20574. var func = isArray(collection) ? arrayMap : baseMap;
  20575. return func(collection, getIteratee(iteratee, 3));
  20576. }
  20577. /**
  20578. * This method is like `_.sortBy` except that it allows specifying the sort
  20579. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  20580. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  20581. * descending or "asc" for ascending sort order of corresponding values.
  20582. *
  20583. * @static
  20584. * @memberOf _
  20585. * @since 4.0.0
  20586. * @category Collection
  20587. * @param {Array|Object} collection The collection to iterate over.
  20588. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  20589. * The iteratees to sort by.
  20590. * @param {string[]} [orders] The sort orders of `iteratees`.
  20591. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  20592. * @returns {Array} Returns the new sorted array.
  20593. * @example
  20594. *
  20595. * var users = [
  20596. * { 'user': 'fred', 'age': 48 },
  20597. * { 'user': 'barney', 'age': 34 },
  20598. * { 'user': 'fred', 'age': 40 },
  20599. * { 'user': 'barney', 'age': 36 }
  20600. * ];
  20601. *
  20602. * // Sort by `user` in ascending order and by `age` in descending order.
  20603. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  20604. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  20605. */
  20606. function orderBy(collection, iteratees, orders, guard) {
  20607. if (collection == null) {
  20608. return [];
  20609. }
  20610. if (!isArray(iteratees)) {
  20611. iteratees = iteratees == null ? [] : [iteratees];
  20612. }
  20613. orders = guard ? undefined : orders;
  20614. if (!isArray(orders)) {
  20615. orders = orders == null ? [] : [orders];
  20616. }
  20617. return baseOrderBy(collection, iteratees, orders);
  20618. }
  20619. /**
  20620. * Creates an array of elements split into two groups, the first of which
  20621. * contains elements `predicate` returns truthy for, the second of which
  20622. * contains elements `predicate` returns falsey for. The predicate is
  20623. * invoked with one argument: (value).
  20624. *
  20625. * @static
  20626. * @memberOf _
  20627. * @since 3.0.0
  20628. * @category Collection
  20629. * @param {Array|Object} collection The collection to iterate over.
  20630. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20631. * @returns {Array} Returns the array of grouped elements.
  20632. * @example
  20633. *
  20634. * var users = [
  20635. * { 'user': 'barney', 'age': 36, 'active': false },
  20636. * { 'user': 'fred', 'age': 40, 'active': true },
  20637. * { 'user': 'pebbles', 'age': 1, 'active': false }
  20638. * ];
  20639. *
  20640. * _.partition(users, function(o) { return o.active; });
  20641. * // => objects for [['fred'], ['barney', 'pebbles']]
  20642. *
  20643. * // The `_.matches` iteratee shorthand.
  20644. * _.partition(users, { 'age': 1, 'active': false });
  20645. * // => objects for [['pebbles'], ['barney', 'fred']]
  20646. *
  20647. * // The `_.matchesProperty` iteratee shorthand.
  20648. * _.partition(users, ['active', false]);
  20649. * // => objects for [['barney', 'pebbles'], ['fred']]
  20650. *
  20651. * // The `_.property` iteratee shorthand.
  20652. * _.partition(users, 'active');
  20653. * // => objects for [['fred'], ['barney', 'pebbles']]
  20654. */
  20655. var partition = createAggregator(function(result, value, key) {
  20656. result[key ? 0 : 1].push(value);
  20657. }, function() { return [[], []]; });
  20658. /**
  20659. * Reduces `collection` to a value which is the accumulated result of running
  20660. * each element in `collection` thru `iteratee`, where each successive
  20661. * invocation is supplied the return value of the previous. If `accumulator`
  20662. * is not given, the first element of `collection` is used as the initial
  20663. * value. The iteratee is invoked with four arguments:
  20664. * (accumulator, value, index|key, collection).
  20665. *
  20666. * Many lodash methods are guarded to work as iteratees for methods like
  20667. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  20668. *
  20669. * The guarded methods are:
  20670. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  20671. * and `sortBy`
  20672. *
  20673. * @static
  20674. * @memberOf _
  20675. * @since 0.1.0
  20676. * @category Collection
  20677. * @param {Array|Object} collection The collection to iterate over.
  20678. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  20679. * @param {*} [accumulator] The initial value.
  20680. * @returns {*} Returns the accumulated value.
  20681. * @see _.reduceRight
  20682. * @example
  20683. *
  20684. * _.reduce([1, 2], function(sum, n) {
  20685. * return sum + n;
  20686. * }, 0);
  20687. * // => 3
  20688. *
  20689. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  20690. * (result[value] || (result[value] = [])).push(key);
  20691. * return result;
  20692. * }, {});
  20693. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  20694. */
  20695. function reduce(collection, iteratee, accumulator) {
  20696. var func = isArray(collection) ? arrayReduce : baseReduce,
  20697. initAccum = arguments.length < 3;
  20698. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  20699. }
  20700. /**
  20701. * This method is like `_.reduce` except that it iterates over elements of
  20702. * `collection` from right to left.
  20703. *
  20704. * @static
  20705. * @memberOf _
  20706. * @since 0.1.0
  20707. * @category Collection
  20708. * @param {Array|Object} collection The collection to iterate over.
  20709. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  20710. * @param {*} [accumulator] The initial value.
  20711. * @returns {*} Returns the accumulated value.
  20712. * @see _.reduce
  20713. * @example
  20714. *
  20715. * var array = [[0, 1], [2, 3], [4, 5]];
  20716. *
  20717. * _.reduceRight(array, function(flattened, other) {
  20718. * return flattened.concat(other);
  20719. * }, []);
  20720. * // => [4, 5, 2, 3, 0, 1]
  20721. */
  20722. function reduceRight(collection, iteratee, accumulator) {
  20723. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  20724. initAccum = arguments.length < 3;
  20725. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  20726. }
  20727. /**
  20728. * The opposite of `_.filter`; this method returns the elements of `collection`
  20729. * that `predicate` does **not** return truthy for.
  20730. *
  20731. * @static
  20732. * @memberOf _
  20733. * @since 0.1.0
  20734. * @category Collection
  20735. * @param {Array|Object} collection The collection to iterate over.
  20736. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20737. * @returns {Array} Returns the new filtered array.
  20738. * @see _.filter
  20739. * @example
  20740. *
  20741. * var users = [
  20742. * { 'user': 'barney', 'age': 36, 'active': false },
  20743. * { 'user': 'fred', 'age': 40, 'active': true }
  20744. * ];
  20745. *
  20746. * _.reject(users, function(o) { return !o.active; });
  20747. * // => objects for ['fred']
  20748. *
  20749. * // The `_.matches` iteratee shorthand.
  20750. * _.reject(users, { 'age': 40, 'active': true });
  20751. * // => objects for ['barney']
  20752. *
  20753. * // The `_.matchesProperty` iteratee shorthand.
  20754. * _.reject(users, ['active', false]);
  20755. * // => objects for ['fred']
  20756. *
  20757. * // The `_.property` iteratee shorthand.
  20758. * _.reject(users, 'active');
  20759. * // => objects for ['barney']
  20760. */
  20761. function reject(collection, predicate) {
  20762. var func = isArray(collection) ? arrayFilter : baseFilter;
  20763. return func(collection, negate(getIteratee(predicate, 3)));
  20764. }
  20765. /**
  20766. * Gets a random element from `collection`.
  20767. *
  20768. * @static
  20769. * @memberOf _
  20770. * @since 2.0.0
  20771. * @category Collection
  20772. * @param {Array|Object} collection The collection to sample.
  20773. * @returns {*} Returns the random element.
  20774. * @example
  20775. *
  20776. * _.sample([1, 2, 3, 4]);
  20777. * // => 2
  20778. */
  20779. function sample(collection) {
  20780. var func = isArray(collection) ? arraySample : baseSample;
  20781. return func(collection);
  20782. }
  20783. /**
  20784. * Gets `n` random elements at unique keys from `collection` up to the
  20785. * size of `collection`.
  20786. *
  20787. * @static
  20788. * @memberOf _
  20789. * @since 4.0.0
  20790. * @category Collection
  20791. * @param {Array|Object} collection The collection to sample.
  20792. * @param {number} [n=1] The number of elements to sample.
  20793. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20794. * @returns {Array} Returns the random elements.
  20795. * @example
  20796. *
  20797. * _.sampleSize([1, 2, 3], 2);
  20798. * // => [3, 1]
  20799. *
  20800. * _.sampleSize([1, 2, 3], 4);
  20801. * // => [2, 3, 1]
  20802. */
  20803. function sampleSize(collection, n, guard) {
  20804. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  20805. n = 1;
  20806. } else {
  20807. n = toInteger(n);
  20808. }
  20809. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  20810. return func(collection, n);
  20811. }
  20812. /**
  20813. * Creates an array of shuffled values, using a version of the
  20814. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  20815. *
  20816. * @static
  20817. * @memberOf _
  20818. * @since 0.1.0
  20819. * @category Collection
  20820. * @param {Array|Object} collection The collection to shuffle.
  20821. * @returns {Array} Returns the new shuffled array.
  20822. * @example
  20823. *
  20824. * _.shuffle([1, 2, 3, 4]);
  20825. * // => [4, 1, 3, 2]
  20826. */
  20827. function shuffle(collection) {
  20828. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  20829. return func(collection);
  20830. }
  20831. /**
  20832. * Gets the size of `collection` by returning its length for array-like
  20833. * values or the number of own enumerable string keyed properties for objects.
  20834. *
  20835. * @static
  20836. * @memberOf _
  20837. * @since 0.1.0
  20838. * @category Collection
  20839. * @param {Array|Object|string} collection The collection to inspect.
  20840. * @returns {number} Returns the collection size.
  20841. * @example
  20842. *
  20843. * _.size([1, 2, 3]);
  20844. * // => 3
  20845. *
  20846. * _.size({ 'a': 1, 'b': 2 });
  20847. * // => 2
  20848. *
  20849. * _.size('pebbles');
  20850. * // => 7
  20851. */
  20852. function size(collection) {
  20853. if (collection == null) {
  20854. return 0;
  20855. }
  20856. if (isArrayLike(collection)) {
  20857. return isString(collection) ? stringSize(collection) : collection.length;
  20858. }
  20859. var tag = getTag(collection);
  20860. if (tag == mapTag || tag == setTag) {
  20861. return collection.size;
  20862. }
  20863. return baseKeys(collection).length;
  20864. }
  20865. /**
  20866. * Checks if `predicate` returns truthy for **any** element of `collection`.
  20867. * Iteration is stopped once `predicate` returns truthy. The predicate is
  20868. * invoked with three arguments: (value, index|key, collection).
  20869. *
  20870. * @static
  20871. * @memberOf _
  20872. * @since 0.1.0
  20873. * @category Collection
  20874. * @param {Array|Object} collection The collection to iterate over.
  20875. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20876. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20877. * @returns {boolean} Returns `true` if any element passes the predicate check,
  20878. * else `false`.
  20879. * @example
  20880. *
  20881. * _.some([null, 0, 'yes', false], Boolean);
  20882. * // => true
  20883. *
  20884. * var users = [
  20885. * { 'user': 'barney', 'active': true },
  20886. * { 'user': 'fred', 'active': false }
  20887. * ];
  20888. *
  20889. * // The `_.matches` iteratee shorthand.
  20890. * _.some(users, { 'user': 'barney', 'active': false });
  20891. * // => false
  20892. *
  20893. * // The `_.matchesProperty` iteratee shorthand.
  20894. * _.some(users, ['active', false]);
  20895. * // => true
  20896. *
  20897. * // The `_.property` iteratee shorthand.
  20898. * _.some(users, 'active');
  20899. * // => true
  20900. */
  20901. function some(collection, predicate, guard) {
  20902. var func = isArray(collection) ? arraySome : baseSome;
  20903. if (guard && isIterateeCall(collection, predicate, guard)) {
  20904. predicate = undefined;
  20905. }
  20906. return func(collection, getIteratee(predicate, 3));
  20907. }
  20908. /**
  20909. * Creates an array of elements, sorted in ascending order by the results of
  20910. * running each element in a collection thru each iteratee. This method
  20911. * performs a stable sort, that is, it preserves the original sort order of
  20912. * equal elements. The iteratees are invoked with one argument: (value).
  20913. *
  20914. * @static
  20915. * @memberOf _
  20916. * @since 0.1.0
  20917. * @category Collection
  20918. * @param {Array|Object} collection The collection to iterate over.
  20919. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  20920. * The iteratees to sort by.
  20921. * @returns {Array} Returns the new sorted array.
  20922. * @example
  20923. *
  20924. * var users = [
  20925. * { 'user': 'fred', 'age': 48 },
  20926. * { 'user': 'barney', 'age': 36 },
  20927. * { 'user': 'fred', 'age': 40 },
  20928. * { 'user': 'barney', 'age': 34 }
  20929. * ];
  20930. *
  20931. * _.sortBy(users, [function(o) { return o.user; }]);
  20932. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  20933. *
  20934. * _.sortBy(users, ['user', 'age']);
  20935. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  20936. */
  20937. var sortBy = baseRest(function(collection, iteratees) {
  20938. if (collection == null) {
  20939. return [];
  20940. }
  20941. var length = iteratees.length;
  20942. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  20943. iteratees = [];
  20944. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  20945. iteratees = [iteratees[0]];
  20946. }
  20947. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  20948. });
  20949. /*------------------------------------------------------------------------*/
  20950. /**
  20951. * Gets the timestamp of the number of milliseconds that have elapsed since
  20952. * the Unix epoch (1 January 1970 00:00:00 UTC).
  20953. *
  20954. * @static
  20955. * @memberOf _
  20956. * @since 2.4.0
  20957. * @category Date
  20958. * @returns {number} Returns the timestamp.
  20959. * @example
  20960. *
  20961. * _.defer(function(stamp) {
  20962. * console.log(_.now() - stamp);
  20963. * }, _.now());
  20964. * // => Logs the number of milliseconds it took for the deferred invocation.
  20965. */
  20966. var now = ctxNow || function() {
  20967. return root.Date.now();
  20968. };
  20969. /*------------------------------------------------------------------------*/
  20970. /**
  20971. * The opposite of `_.before`; this method creates a function that invokes
  20972. * `func` once it's called `n` or more times.
  20973. *
  20974. * @static
  20975. * @memberOf _
  20976. * @since 0.1.0
  20977. * @category Function
  20978. * @param {number} n The number of calls before `func` is invoked.
  20979. * @param {Function} func The function to restrict.
  20980. * @returns {Function} Returns the new restricted function.
  20981. * @example
  20982. *
  20983. * var saves = ['profile', 'settings'];
  20984. *
  20985. * var done = _.after(saves.length, function() {
  20986. * console.log('done saving!');
  20987. * });
  20988. *
  20989. * _.forEach(saves, function(type) {
  20990. * asyncSave({ 'type': type, 'complete': done });
  20991. * });
  20992. * // => Logs 'done saving!' after the two async saves have completed.
  20993. */
  20994. function after(n, func) {
  20995. if (typeof func != 'function') {
  20996. throw new TypeError(FUNC_ERROR_TEXT);
  20997. }
  20998. n = toInteger(n);
  20999. return function() {
  21000. if (--n < 1) {
  21001. return func.apply(this, arguments);
  21002. }
  21003. };
  21004. }
  21005. /**
  21006. * Creates a function that invokes `func`, with up to `n` arguments,
  21007. * ignoring any additional arguments.
  21008. *
  21009. * @static
  21010. * @memberOf _
  21011. * @since 3.0.0
  21012. * @category Function
  21013. * @param {Function} func The function to cap arguments for.
  21014. * @param {number} [n=func.length] The arity cap.
  21015. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21016. * @returns {Function} Returns the new capped function.
  21017. * @example
  21018. *
  21019. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  21020. * // => [6, 8, 10]
  21021. */
  21022. function ary(func, n, guard) {
  21023. n = guard ? undefined : n;
  21024. n = (func && n == null) ? func.length : n;
  21025. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  21026. }
  21027. /**
  21028. * Creates a function that invokes `func`, with the `this` binding and arguments
  21029. * of the created function, while it's called less than `n` times. Subsequent
  21030. * calls to the created function return the result of the last `func` invocation.
  21031. *
  21032. * @static
  21033. * @memberOf _
  21034. * @since 3.0.0
  21035. * @category Function
  21036. * @param {number} n The number of calls at which `func` is no longer invoked.
  21037. * @param {Function} func The function to restrict.
  21038. * @returns {Function} Returns the new restricted function.
  21039. * @example
  21040. *
  21041. * jQuery(element).on('click', _.before(5, addContactToList));
  21042. * // => Allows adding up to 4 contacts to the list.
  21043. */
  21044. function before(n, func) {
  21045. var result;
  21046. if (typeof func != 'function') {
  21047. throw new TypeError(FUNC_ERROR_TEXT);
  21048. }
  21049. n = toInteger(n);
  21050. return function() {
  21051. if (--n > 0) {
  21052. result = func.apply(this, arguments);
  21053. }
  21054. if (n <= 1) {
  21055. func = undefined;
  21056. }
  21057. return result;
  21058. };
  21059. }
  21060. /**
  21061. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  21062. * and `partials` prepended to the arguments it receives.
  21063. *
  21064. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  21065. * may be used as a placeholder for partially applied arguments.
  21066. *
  21067. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  21068. * property of bound functions.
  21069. *
  21070. * @static
  21071. * @memberOf _
  21072. * @since 0.1.0
  21073. * @category Function
  21074. * @param {Function} func The function to bind.
  21075. * @param {*} thisArg The `this` binding of `func`.
  21076. * @param {...*} [partials] The arguments to be partially applied.
  21077. * @returns {Function} Returns the new bound function.
  21078. * @example
  21079. *
  21080. * function greet(greeting, punctuation) {
  21081. * return greeting + ' ' + this.user + punctuation;
  21082. * }
  21083. *
  21084. * var object = { 'user': 'fred' };
  21085. *
  21086. * var bound = _.bind(greet, object, 'hi');
  21087. * bound('!');
  21088. * // => 'hi fred!'
  21089. *
  21090. * // Bound with placeholders.
  21091. * var bound = _.bind(greet, object, _, '!');
  21092. * bound('hi');
  21093. * // => 'hi fred!'
  21094. */
  21095. var bind = baseRest(function(func, thisArg, partials) {
  21096. var bitmask = WRAP_BIND_FLAG;
  21097. if (partials.length) {
  21098. var holders = replaceHolders(partials, getHolder(bind));
  21099. bitmask |= WRAP_PARTIAL_FLAG;
  21100. }
  21101. return createWrap(func, bitmask, thisArg, partials, holders);
  21102. });
  21103. /**
  21104. * Creates a function that invokes the method at `object[key]` with `partials`
  21105. * prepended to the arguments it receives.
  21106. *
  21107. * This method differs from `_.bind` by allowing bound functions to reference
  21108. * methods that may be redefined or don't yet exist. See
  21109. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  21110. * for more details.
  21111. *
  21112. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  21113. * builds, may be used as a placeholder for partially applied arguments.
  21114. *
  21115. * @static
  21116. * @memberOf _
  21117. * @since 0.10.0
  21118. * @category Function
  21119. * @param {Object} object The object to invoke the method on.
  21120. * @param {string} key The key of the method.
  21121. * @param {...*} [partials] The arguments to be partially applied.
  21122. * @returns {Function} Returns the new bound function.
  21123. * @example
  21124. *
  21125. * var object = {
  21126. * 'user': 'fred',
  21127. * 'greet': function(greeting, punctuation) {
  21128. * return greeting + ' ' + this.user + punctuation;
  21129. * }
  21130. * };
  21131. *
  21132. * var bound = _.bindKey(object, 'greet', 'hi');
  21133. * bound('!');
  21134. * // => 'hi fred!'
  21135. *
  21136. * object.greet = function(greeting, punctuation) {
  21137. * return greeting + 'ya ' + this.user + punctuation;
  21138. * };
  21139. *
  21140. * bound('!');
  21141. * // => 'hiya fred!'
  21142. *
  21143. * // Bound with placeholders.
  21144. * var bound = _.bindKey(object, 'greet', _, '!');
  21145. * bound('hi');
  21146. * // => 'hiya fred!'
  21147. */
  21148. var bindKey = baseRest(function(object, key, partials) {
  21149. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  21150. if (partials.length) {
  21151. var holders = replaceHolders(partials, getHolder(bindKey));
  21152. bitmask |= WRAP_PARTIAL_FLAG;
  21153. }
  21154. return createWrap(key, bitmask, object, partials, holders);
  21155. });
  21156. /**
  21157. * Creates a function that accepts arguments of `func` and either invokes
  21158. * `func` returning its result, if at least `arity` number of arguments have
  21159. * been provided, or returns a function that accepts the remaining `func`
  21160. * arguments, and so on. The arity of `func` may be specified if `func.length`
  21161. * is not sufficient.
  21162. *
  21163. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  21164. * may be used as a placeholder for provided arguments.
  21165. *
  21166. * **Note:** This method doesn't set the "length" property of curried functions.
  21167. *
  21168. * @static
  21169. * @memberOf _
  21170. * @since 2.0.0
  21171. * @category Function
  21172. * @param {Function} func The function to curry.
  21173. * @param {number} [arity=func.length] The arity of `func`.
  21174. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21175. * @returns {Function} Returns the new curried function.
  21176. * @example
  21177. *
  21178. * var abc = function(a, b, c) {
  21179. * return [a, b, c];
  21180. * };
  21181. *
  21182. * var curried = _.curry(abc);
  21183. *
  21184. * curried(1)(2)(3);
  21185. * // => [1, 2, 3]
  21186. *
  21187. * curried(1, 2)(3);
  21188. * // => [1, 2, 3]
  21189. *
  21190. * curried(1, 2, 3);
  21191. * // => [1, 2, 3]
  21192. *
  21193. * // Curried with placeholders.
  21194. * curried(1)(_, 3)(2);
  21195. * // => [1, 2, 3]
  21196. */
  21197. function curry(func, arity, guard) {
  21198. arity = guard ? undefined : arity;
  21199. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  21200. result.placeholder = curry.placeholder;
  21201. return result;
  21202. }
  21203. /**
  21204. * This method is like `_.curry` except that arguments are applied to `func`
  21205. * in the manner of `_.partialRight` instead of `_.partial`.
  21206. *
  21207. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  21208. * builds, may be used as a placeholder for provided arguments.
  21209. *
  21210. * **Note:** This method doesn't set the "length" property of curried functions.
  21211. *
  21212. * @static
  21213. * @memberOf _
  21214. * @since 3.0.0
  21215. * @category Function
  21216. * @param {Function} func The function to curry.
  21217. * @param {number} [arity=func.length] The arity of `func`.
  21218. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21219. * @returns {Function} Returns the new curried function.
  21220. * @example
  21221. *
  21222. * var abc = function(a, b, c) {
  21223. * return [a, b, c];
  21224. * };
  21225. *
  21226. * var curried = _.curryRight(abc);
  21227. *
  21228. * curried(3)(2)(1);
  21229. * // => [1, 2, 3]
  21230. *
  21231. * curried(2, 3)(1);
  21232. * // => [1, 2, 3]
  21233. *
  21234. * curried(1, 2, 3);
  21235. * // => [1, 2, 3]
  21236. *
  21237. * // Curried with placeholders.
  21238. * curried(3)(1, _)(2);
  21239. * // => [1, 2, 3]
  21240. */
  21241. function curryRight(func, arity, guard) {
  21242. arity = guard ? undefined : arity;
  21243. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  21244. result.placeholder = curryRight.placeholder;
  21245. return result;
  21246. }
  21247. /**
  21248. * Creates a debounced function that delays invoking `func` until after `wait`
  21249. * milliseconds have elapsed since the last time the debounced function was
  21250. * invoked. The debounced function comes with a `cancel` method to cancel
  21251. * delayed `func` invocations and a `flush` method to immediately invoke them.
  21252. * Provide `options` to indicate whether `func` should be invoked on the
  21253. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  21254. * with the last arguments provided to the debounced function. Subsequent
  21255. * calls to the debounced function return the result of the last `func`
  21256. * invocation.
  21257. *
  21258. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  21259. * invoked on the trailing edge of the timeout only if the debounced function
  21260. * is invoked more than once during the `wait` timeout.
  21261. *
  21262. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  21263. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  21264. *
  21265. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  21266. * for details over the differences between `_.debounce` and `_.throttle`.
  21267. *
  21268. * @static
  21269. * @memberOf _
  21270. * @since 0.1.0
  21271. * @category Function
  21272. * @param {Function} func The function to debounce.
  21273. * @param {number} [wait=0] The number of milliseconds to delay.
  21274. * @param {Object} [options={}] The options object.
  21275. * @param {boolean} [options.leading=false]
  21276. * Specify invoking on the leading edge of the timeout.
  21277. * @param {number} [options.maxWait]
  21278. * The maximum time `func` is allowed to be delayed before it's invoked.
  21279. * @param {boolean} [options.trailing=true]
  21280. * Specify invoking on the trailing edge of the timeout.
  21281. * @returns {Function} Returns the new debounced function.
  21282. * @example
  21283. *
  21284. * // Avoid costly calculations while the window size is in flux.
  21285. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  21286. *
  21287. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  21288. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  21289. * 'leading': true,
  21290. * 'trailing': false
  21291. * }));
  21292. *
  21293. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  21294. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  21295. * var source = new EventSource('/stream');
  21296. * jQuery(source).on('message', debounced);
  21297. *
  21298. * // Cancel the trailing debounced invocation.
  21299. * jQuery(window).on('popstate', debounced.cancel);
  21300. */
  21301. function debounce(func, wait, options) {
  21302. var lastArgs,
  21303. lastThis,
  21304. maxWait,
  21305. result,
  21306. timerId,
  21307. lastCallTime,
  21308. lastInvokeTime = 0,
  21309. leading = false,
  21310. maxing = false,
  21311. trailing = true;
  21312. if (typeof func != 'function') {
  21313. throw new TypeError(FUNC_ERROR_TEXT);
  21314. }
  21315. wait = toNumber(wait) || 0;
  21316. if (isObject(options)) {
  21317. leading = !!options.leading;
  21318. maxing = 'maxWait' in options;
  21319. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  21320. trailing = 'trailing' in options ? !!options.trailing : trailing;
  21321. }
  21322. function invokeFunc(time) {
  21323. var args = lastArgs,
  21324. thisArg = lastThis;
  21325. lastArgs = lastThis = undefined;
  21326. lastInvokeTime = time;
  21327. result = func.apply(thisArg, args);
  21328. return result;
  21329. }
  21330. function leadingEdge(time) {
  21331. // Reset any `maxWait` timer.
  21332. lastInvokeTime = time;
  21333. // Start the timer for the trailing edge.
  21334. timerId = setTimeout(timerExpired, wait);
  21335. // Invoke the leading edge.
  21336. return leading ? invokeFunc(time) : result;
  21337. }
  21338. function remainingWait(time) {
  21339. var timeSinceLastCall = time - lastCallTime,
  21340. timeSinceLastInvoke = time - lastInvokeTime,
  21341. result = wait - timeSinceLastCall;
  21342. return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
  21343. }
  21344. function shouldInvoke(time) {
  21345. var timeSinceLastCall = time - lastCallTime,
  21346. timeSinceLastInvoke = time - lastInvokeTime;
  21347. // Either this is the first call, activity has stopped and we're at the
  21348. // trailing edge, the system time has gone backwards and we're treating
  21349. // it as the trailing edge, or we've hit the `maxWait` limit.
  21350. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  21351. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  21352. }
  21353. function timerExpired() {
  21354. var time = now();
  21355. if (shouldInvoke(time)) {
  21356. return trailingEdge(time);
  21357. }
  21358. // Restart the timer.
  21359. timerId = setTimeout(timerExpired, remainingWait(time));
  21360. }
  21361. function trailingEdge(time) {
  21362. timerId = undefined;
  21363. // Only invoke if we have `lastArgs` which means `func` has been
  21364. // debounced at least once.
  21365. if (trailing && lastArgs) {
  21366. return invokeFunc(time);
  21367. }
  21368. lastArgs = lastThis = undefined;
  21369. return result;
  21370. }
  21371. function cancel() {
  21372. if (timerId !== undefined) {
  21373. clearTimeout(timerId);
  21374. }
  21375. lastInvokeTime = 0;
  21376. lastArgs = lastCallTime = lastThis = timerId = undefined;
  21377. }
  21378. function flush() {
  21379. return timerId === undefined ? result : trailingEdge(now());
  21380. }
  21381. function debounced() {
  21382. var time = now(),
  21383. isInvoking = shouldInvoke(time);
  21384. lastArgs = arguments;
  21385. lastThis = this;
  21386. lastCallTime = time;
  21387. if (isInvoking) {
  21388. if (timerId === undefined) {
  21389. return leadingEdge(lastCallTime);
  21390. }
  21391. if (maxing) {
  21392. // Handle invocations in a tight loop.
  21393. timerId = setTimeout(timerExpired, wait);
  21394. return invokeFunc(lastCallTime);
  21395. }
  21396. }
  21397. if (timerId === undefined) {
  21398. timerId = setTimeout(timerExpired, wait);
  21399. }
  21400. return result;
  21401. }
  21402. debounced.cancel = cancel;
  21403. debounced.flush = flush;
  21404. return debounced;
  21405. }
  21406. /**
  21407. * Defers invoking the `func` until the current call stack has cleared. Any
  21408. * additional arguments are provided to `func` when it's invoked.
  21409. *
  21410. * @static
  21411. * @memberOf _
  21412. * @since 0.1.0
  21413. * @category Function
  21414. * @param {Function} func The function to defer.
  21415. * @param {...*} [args] The arguments to invoke `func` with.
  21416. * @returns {number} Returns the timer id.
  21417. * @example
  21418. *
  21419. * _.defer(function(text) {
  21420. * console.log(text);
  21421. * }, 'deferred');
  21422. * // => Logs 'deferred' after one millisecond.
  21423. */
  21424. var defer = baseRest(function(func, args) {
  21425. return baseDelay(func, 1, args);
  21426. });
  21427. /**
  21428. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  21429. * provided to `func` when it's invoked.
  21430. *
  21431. * @static
  21432. * @memberOf _
  21433. * @since 0.1.0
  21434. * @category Function
  21435. * @param {Function} func The function to delay.
  21436. * @param {number} wait The number of milliseconds to delay invocation.
  21437. * @param {...*} [args] The arguments to invoke `func` with.
  21438. * @returns {number} Returns the timer id.
  21439. * @example
  21440. *
  21441. * _.delay(function(text) {
  21442. * console.log(text);
  21443. * }, 1000, 'later');
  21444. * // => Logs 'later' after one second.
  21445. */
  21446. var delay = baseRest(function(func, wait, args) {
  21447. return baseDelay(func, toNumber(wait) || 0, args);
  21448. });
  21449. /**
  21450. * Creates a function that invokes `func` with arguments reversed.
  21451. *
  21452. * @static
  21453. * @memberOf _
  21454. * @since 4.0.0
  21455. * @category Function
  21456. * @param {Function} func The function to flip arguments for.
  21457. * @returns {Function} Returns the new flipped function.
  21458. * @example
  21459. *
  21460. * var flipped = _.flip(function() {
  21461. * return _.toArray(arguments);
  21462. * });
  21463. *
  21464. * flipped('a', 'b', 'c', 'd');
  21465. * // => ['d', 'c', 'b', 'a']
  21466. */
  21467. function flip(func) {
  21468. return createWrap(func, WRAP_FLIP_FLAG);
  21469. }
  21470. /**
  21471. * Creates a function that memoizes the result of `func`. If `resolver` is
  21472. * provided, it determines the cache key for storing the result based on the
  21473. * arguments provided to the memoized function. By default, the first argument
  21474. * provided to the memoized function is used as the map cache key. The `func`
  21475. * is invoked with the `this` binding of the memoized function.
  21476. *
  21477. * **Note:** The cache is exposed as the `cache` property on the memoized
  21478. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  21479. * constructor with one whose instances implement the
  21480. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  21481. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  21482. *
  21483. * @static
  21484. * @memberOf _
  21485. * @since 0.1.0
  21486. * @category Function
  21487. * @param {Function} func The function to have its output memoized.
  21488. * @param {Function} [resolver] The function to resolve the cache key.
  21489. * @returns {Function} Returns the new memoized function.
  21490. * @example
  21491. *
  21492. * var object = { 'a': 1, 'b': 2 };
  21493. * var other = { 'c': 3, 'd': 4 };
  21494. *
  21495. * var values = _.memoize(_.values);
  21496. * values(object);
  21497. * // => [1, 2]
  21498. *
  21499. * values(other);
  21500. * // => [3, 4]
  21501. *
  21502. * object.a = 2;
  21503. * values(object);
  21504. * // => [1, 2]
  21505. *
  21506. * // Modify the result cache.
  21507. * values.cache.set(object, ['a', 'b']);
  21508. * values(object);
  21509. * // => ['a', 'b']
  21510. *
  21511. * // Replace `_.memoize.Cache`.
  21512. * _.memoize.Cache = WeakMap;
  21513. */
  21514. function memoize(func, resolver) {
  21515. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  21516. throw new TypeError(FUNC_ERROR_TEXT);
  21517. }
  21518. var memoized = function() {
  21519. var args = arguments,
  21520. key = resolver ? resolver.apply(this, args) : args[0],
  21521. cache = memoized.cache;
  21522. if (cache.has(key)) {
  21523. return cache.get(key);
  21524. }
  21525. var result = func.apply(this, args);
  21526. memoized.cache = cache.set(key, result) || cache;
  21527. return result;
  21528. };
  21529. memoized.cache = new (memoize.Cache || MapCache);
  21530. return memoized;
  21531. }
  21532. // Expose `MapCache`.
  21533. memoize.Cache = MapCache;
  21534. /**
  21535. * Creates a function that negates the result of the predicate `func`. The
  21536. * `func` predicate is invoked with the `this` binding and arguments of the
  21537. * created function.
  21538. *
  21539. * @static
  21540. * @memberOf _
  21541. * @since 3.0.0
  21542. * @category Function
  21543. * @param {Function} predicate The predicate to negate.
  21544. * @returns {Function} Returns the new negated function.
  21545. * @example
  21546. *
  21547. * function isEven(n) {
  21548. * return n % 2 == 0;
  21549. * }
  21550. *
  21551. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  21552. * // => [1, 3, 5]
  21553. */
  21554. function negate(predicate) {
  21555. if (typeof predicate != 'function') {
  21556. throw new TypeError(FUNC_ERROR_TEXT);
  21557. }
  21558. return function() {
  21559. var args = arguments;
  21560. switch (args.length) {
  21561. case 0: return !predicate.call(this);
  21562. case 1: return !predicate.call(this, args[0]);
  21563. case 2: return !predicate.call(this, args[0], args[1]);
  21564. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  21565. }
  21566. return !predicate.apply(this, args);
  21567. };
  21568. }
  21569. /**
  21570. * Creates a function that is restricted to invoking `func` once. Repeat calls
  21571. * to the function return the value of the first invocation. The `func` is
  21572. * invoked with the `this` binding and arguments of the created function.
  21573. *
  21574. * @static
  21575. * @memberOf _
  21576. * @since 0.1.0
  21577. * @category Function
  21578. * @param {Function} func The function to restrict.
  21579. * @returns {Function} Returns the new restricted function.
  21580. * @example
  21581. *
  21582. * var initialize = _.once(createApplication);
  21583. * initialize();
  21584. * initialize();
  21585. * // => `createApplication` is invoked once
  21586. */
  21587. function once(func) {
  21588. return before(2, func);
  21589. }
  21590. /**
  21591. * Creates a function that invokes `func` with its arguments transformed.
  21592. *
  21593. * @static
  21594. * @since 4.0.0
  21595. * @memberOf _
  21596. * @category Function
  21597. * @param {Function} func The function to wrap.
  21598. * @param {...(Function|Function[])} [transforms=[_.identity]]
  21599. * The argument transforms.
  21600. * @returns {Function} Returns the new function.
  21601. * @example
  21602. *
  21603. * function doubled(n) {
  21604. * return n * 2;
  21605. * }
  21606. *
  21607. * function square(n) {
  21608. * return n * n;
  21609. * }
  21610. *
  21611. * var func = _.overArgs(function(x, y) {
  21612. * return [x, y];
  21613. * }, [square, doubled]);
  21614. *
  21615. * func(9, 3);
  21616. * // => [81, 6]
  21617. *
  21618. * func(10, 5);
  21619. * // => [100, 10]
  21620. */
  21621. var overArgs = castRest(function(func, transforms) {
  21622. transforms = (transforms.length == 1 && isArray(transforms[0]))
  21623. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  21624. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  21625. var funcsLength = transforms.length;
  21626. return baseRest(function(args) {
  21627. var index = -1,
  21628. length = nativeMin(args.length, funcsLength);
  21629. while (++index < length) {
  21630. args[index] = transforms[index].call(this, args[index]);
  21631. }
  21632. return apply(func, this, args);
  21633. });
  21634. });
  21635. /**
  21636. * Creates a function that invokes `func` with `partials` prepended to the
  21637. * arguments it receives. This method is like `_.bind` except it does **not**
  21638. * alter the `this` binding.
  21639. *
  21640. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  21641. * builds, may be used as a placeholder for partially applied arguments.
  21642. *
  21643. * **Note:** This method doesn't set the "length" property of partially
  21644. * applied functions.
  21645. *
  21646. * @static
  21647. * @memberOf _
  21648. * @since 0.2.0
  21649. * @category Function
  21650. * @param {Function} func The function to partially apply arguments to.
  21651. * @param {...*} [partials] The arguments to be partially applied.
  21652. * @returns {Function} Returns the new partially applied function.
  21653. * @example
  21654. *
  21655. * function greet(greeting, name) {
  21656. * return greeting + ' ' + name;
  21657. * }
  21658. *
  21659. * var sayHelloTo = _.partial(greet, 'hello');
  21660. * sayHelloTo('fred');
  21661. * // => 'hello fred'
  21662. *
  21663. * // Partially applied with placeholders.
  21664. * var greetFred = _.partial(greet, _, 'fred');
  21665. * greetFred('hi');
  21666. * // => 'hi fred'
  21667. */
  21668. var partial = baseRest(function(func, partials) {
  21669. var holders = replaceHolders(partials, getHolder(partial));
  21670. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  21671. });
  21672. /**
  21673. * This method is like `_.partial` except that partially applied arguments
  21674. * are appended to the arguments it receives.
  21675. *
  21676. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  21677. * builds, may be used as a placeholder for partially applied arguments.
  21678. *
  21679. * **Note:** This method doesn't set the "length" property of partially
  21680. * applied functions.
  21681. *
  21682. * @static
  21683. * @memberOf _
  21684. * @since 1.0.0
  21685. * @category Function
  21686. * @param {Function} func The function to partially apply arguments to.
  21687. * @param {...*} [partials] The arguments to be partially applied.
  21688. * @returns {Function} Returns the new partially applied function.
  21689. * @example
  21690. *
  21691. * function greet(greeting, name) {
  21692. * return greeting + ' ' + name;
  21693. * }
  21694. *
  21695. * var greetFred = _.partialRight(greet, 'fred');
  21696. * greetFred('hi');
  21697. * // => 'hi fred'
  21698. *
  21699. * // Partially applied with placeholders.
  21700. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  21701. * sayHelloTo('fred');
  21702. * // => 'hello fred'
  21703. */
  21704. var partialRight = baseRest(function(func, partials) {
  21705. var holders = replaceHolders(partials, getHolder(partialRight));
  21706. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  21707. });
  21708. /**
  21709. * Creates a function that invokes `func` with arguments arranged according
  21710. * to the specified `indexes` where the argument value at the first index is
  21711. * provided as the first argument, the argument value at the second index is
  21712. * provided as the second argument, and so on.
  21713. *
  21714. * @static
  21715. * @memberOf _
  21716. * @since 3.0.0
  21717. * @category Function
  21718. * @param {Function} func The function to rearrange arguments for.
  21719. * @param {...(number|number[])} indexes The arranged argument indexes.
  21720. * @returns {Function} Returns the new function.
  21721. * @example
  21722. *
  21723. * var rearged = _.rearg(function(a, b, c) {
  21724. * return [a, b, c];
  21725. * }, [2, 0, 1]);
  21726. *
  21727. * rearged('b', 'c', 'a')
  21728. * // => ['a', 'b', 'c']
  21729. */
  21730. var rearg = flatRest(function(func, indexes) {
  21731. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  21732. });
  21733. /**
  21734. * Creates a function that invokes `func` with the `this` binding of the
  21735. * created function and arguments from `start` and beyond provided as
  21736. * an array.
  21737. *
  21738. * **Note:** This method is based on the
  21739. * [rest parameter](https://mdn.io/rest_parameters).
  21740. *
  21741. * @static
  21742. * @memberOf _
  21743. * @since 4.0.0
  21744. * @category Function
  21745. * @param {Function} func The function to apply a rest parameter to.
  21746. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21747. * @returns {Function} Returns the new function.
  21748. * @example
  21749. *
  21750. * var say = _.rest(function(what, names) {
  21751. * return what + ' ' + _.initial(names).join(', ') +
  21752. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  21753. * });
  21754. *
  21755. * say('hello', 'fred', 'barney', 'pebbles');
  21756. * // => 'hello fred, barney, & pebbles'
  21757. */
  21758. function rest(func, start) {
  21759. if (typeof func != 'function') {
  21760. throw new TypeError(FUNC_ERROR_TEXT);
  21761. }
  21762. start = start === undefined ? start : toInteger(start);
  21763. return baseRest(func, start);
  21764. }
  21765. /**
  21766. * Creates a function that invokes `func` with the `this` binding of the
  21767. * create function and an array of arguments much like
  21768. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  21769. *
  21770. * **Note:** This method is based on the
  21771. * [spread operator](https://mdn.io/spread_operator).
  21772. *
  21773. * @static
  21774. * @memberOf _
  21775. * @since 3.2.0
  21776. * @category Function
  21777. * @param {Function} func The function to spread arguments over.
  21778. * @param {number} [start=0] The start position of the spread.
  21779. * @returns {Function} Returns the new function.
  21780. * @example
  21781. *
  21782. * var say = _.spread(function(who, what) {
  21783. * return who + ' says ' + what;
  21784. * });
  21785. *
  21786. * say(['fred', 'hello']);
  21787. * // => 'fred says hello'
  21788. *
  21789. * var numbers = Promise.all([
  21790. * Promise.resolve(40),
  21791. * Promise.resolve(36)
  21792. * ]);
  21793. *
  21794. * numbers.then(_.spread(function(x, y) {
  21795. * return x + y;
  21796. * }));
  21797. * // => a Promise of 76
  21798. */
  21799. function spread(func, start) {
  21800. if (typeof func != 'function') {
  21801. throw new TypeError(FUNC_ERROR_TEXT);
  21802. }
  21803. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  21804. return baseRest(function(args) {
  21805. var array = args[start],
  21806. otherArgs = castSlice(args, 0, start);
  21807. if (array) {
  21808. arrayPush(otherArgs, array);
  21809. }
  21810. return apply(func, this, otherArgs);
  21811. });
  21812. }
  21813. /**
  21814. * Creates a throttled function that only invokes `func` at most once per
  21815. * every `wait` milliseconds. The throttled function comes with a `cancel`
  21816. * method to cancel delayed `func` invocations and a `flush` method to
  21817. * immediately invoke them. Provide `options` to indicate whether `func`
  21818. * should be invoked on the leading and/or trailing edge of the `wait`
  21819. * timeout. The `func` is invoked with the last arguments provided to the
  21820. * throttled function. Subsequent calls to the throttled function return the
  21821. * result of the last `func` invocation.
  21822. *
  21823. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  21824. * invoked on the trailing edge of the timeout only if the throttled function
  21825. * is invoked more than once during the `wait` timeout.
  21826. *
  21827. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  21828. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  21829. *
  21830. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  21831. * for details over the differences between `_.throttle` and `_.debounce`.
  21832. *
  21833. * @static
  21834. * @memberOf _
  21835. * @since 0.1.0
  21836. * @category Function
  21837. * @param {Function} func The function to throttle.
  21838. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  21839. * @param {Object} [options={}] The options object.
  21840. * @param {boolean} [options.leading=true]
  21841. * Specify invoking on the leading edge of the timeout.
  21842. * @param {boolean} [options.trailing=true]
  21843. * Specify invoking on the trailing edge of the timeout.
  21844. * @returns {Function} Returns the new throttled function.
  21845. * @example
  21846. *
  21847. * // Avoid excessively updating the position while scrolling.
  21848. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  21849. *
  21850. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  21851. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  21852. * jQuery(element).on('click', throttled);
  21853. *
  21854. * // Cancel the trailing throttled invocation.
  21855. * jQuery(window).on('popstate', throttled.cancel);
  21856. */
  21857. function throttle(func, wait, options) {
  21858. var leading = true,
  21859. trailing = true;
  21860. if (typeof func != 'function') {
  21861. throw new TypeError(FUNC_ERROR_TEXT);
  21862. }
  21863. if (isObject(options)) {
  21864. leading = 'leading' in options ? !!options.leading : leading;
  21865. trailing = 'trailing' in options ? !!options.trailing : trailing;
  21866. }
  21867. return debounce(func, wait, {
  21868. 'leading': leading,
  21869. 'maxWait': wait,
  21870. 'trailing': trailing
  21871. });
  21872. }
  21873. /**
  21874. * Creates a function that accepts up to one argument, ignoring any
  21875. * additional arguments.
  21876. *
  21877. * @static
  21878. * @memberOf _
  21879. * @since 4.0.0
  21880. * @category Function
  21881. * @param {Function} func The function to cap arguments for.
  21882. * @returns {Function} Returns the new capped function.
  21883. * @example
  21884. *
  21885. * _.map(['6', '8', '10'], _.unary(parseInt));
  21886. * // => [6, 8, 10]
  21887. */
  21888. function unary(func) {
  21889. return ary(func, 1);
  21890. }
  21891. /**
  21892. * Creates a function that provides `value` to `wrapper` as its first
  21893. * argument. Any additional arguments provided to the function are appended
  21894. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  21895. * binding of the created function.
  21896. *
  21897. * @static
  21898. * @memberOf _
  21899. * @since 0.1.0
  21900. * @category Function
  21901. * @param {*} value The value to wrap.
  21902. * @param {Function} [wrapper=identity] The wrapper function.
  21903. * @returns {Function} Returns the new function.
  21904. * @example
  21905. *
  21906. * var p = _.wrap(_.escape, function(func, text) {
  21907. * return '<p>' + func(text) + '</p>';
  21908. * });
  21909. *
  21910. * p('fred, barney, & pebbles');
  21911. * // => '<p>fred, barney, &amp; pebbles</p>'
  21912. */
  21913. function wrap(value, wrapper) {
  21914. return partial(castFunction(wrapper), value);
  21915. }
  21916. /*------------------------------------------------------------------------*/
  21917. /**
  21918. * Casts `value` as an array if it's not one.
  21919. *
  21920. * @static
  21921. * @memberOf _
  21922. * @since 4.4.0
  21923. * @category Lang
  21924. * @param {*} value The value to inspect.
  21925. * @returns {Array} Returns the cast array.
  21926. * @example
  21927. *
  21928. * _.castArray(1);
  21929. * // => [1]
  21930. *
  21931. * _.castArray({ 'a': 1 });
  21932. * // => [{ 'a': 1 }]
  21933. *
  21934. * _.castArray('abc');
  21935. * // => ['abc']
  21936. *
  21937. * _.castArray(null);
  21938. * // => [null]
  21939. *
  21940. * _.castArray(undefined);
  21941. * // => [undefined]
  21942. *
  21943. * _.castArray();
  21944. * // => []
  21945. *
  21946. * var array = [1, 2, 3];
  21947. * console.log(_.castArray(array) === array);
  21948. * // => true
  21949. */
  21950. function castArray() {
  21951. if (!arguments.length) {
  21952. return [];
  21953. }
  21954. var value = arguments[0];
  21955. return isArray(value) ? value : [value];
  21956. }
  21957. /**
  21958. * Creates a shallow clone of `value`.
  21959. *
  21960. * **Note:** This method is loosely based on the
  21961. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  21962. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  21963. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  21964. * arrays. The own enumerable properties of `arguments` objects are cloned
  21965. * as plain objects. An empty object is returned for uncloneable values such
  21966. * as error objects, functions, DOM nodes, and WeakMaps.
  21967. *
  21968. * @static
  21969. * @memberOf _
  21970. * @since 0.1.0
  21971. * @category Lang
  21972. * @param {*} value The value to clone.
  21973. * @returns {*} Returns the cloned value.
  21974. * @see _.cloneDeep
  21975. * @example
  21976. *
  21977. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  21978. *
  21979. * var shallow = _.clone(objects);
  21980. * console.log(shallow[0] === objects[0]);
  21981. * // => true
  21982. */
  21983. function clone(value) {
  21984. return baseClone(value, CLONE_SYMBOLS_FLAG);
  21985. }
  21986. /**
  21987. * This method is like `_.clone` except that it accepts `customizer` which
  21988. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  21989. * cloning is handled by the method instead. The `customizer` is invoked with
  21990. * up to four arguments; (value [, index|key, object, stack]).
  21991. *
  21992. * @static
  21993. * @memberOf _
  21994. * @since 4.0.0
  21995. * @category Lang
  21996. * @param {*} value The value to clone.
  21997. * @param {Function} [customizer] The function to customize cloning.
  21998. * @returns {*} Returns the cloned value.
  21999. * @see _.cloneDeepWith
  22000. * @example
  22001. *
  22002. * function customizer(value) {
  22003. * if (_.isElement(value)) {
  22004. * return value.cloneNode(false);
  22005. * }
  22006. * }
  22007. *
  22008. * var el = _.cloneWith(document.body, customizer);
  22009. *
  22010. * console.log(el === document.body);
  22011. * // => false
  22012. * console.log(el.nodeName);
  22013. * // => 'BODY'
  22014. * console.log(el.childNodes.length);
  22015. * // => 0
  22016. */
  22017. function cloneWith(value, customizer) {
  22018. customizer = typeof customizer == 'function' ? customizer : undefined;
  22019. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  22020. }
  22021. /**
  22022. * This method is like `_.clone` except that it recursively clones `value`.
  22023. *
  22024. * @static
  22025. * @memberOf _
  22026. * @since 1.0.0
  22027. * @category Lang
  22028. * @param {*} value The value to recursively clone.
  22029. * @returns {*} Returns the deep cloned value.
  22030. * @see _.clone
  22031. * @example
  22032. *
  22033. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  22034. *
  22035. * var deep = _.cloneDeep(objects);
  22036. * console.log(deep[0] === objects[0]);
  22037. * // => false
  22038. */
  22039. function cloneDeep(value) {
  22040. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  22041. }
  22042. /**
  22043. * This method is like `_.cloneWith` except that it recursively clones `value`.
  22044. *
  22045. * @static
  22046. * @memberOf _
  22047. * @since 4.0.0
  22048. * @category Lang
  22049. * @param {*} value The value to recursively clone.
  22050. * @param {Function} [customizer] The function to customize cloning.
  22051. * @returns {*} Returns the deep cloned value.
  22052. * @see _.cloneWith
  22053. * @example
  22054. *
  22055. * function customizer(value) {
  22056. * if (_.isElement(value)) {
  22057. * return value.cloneNode(true);
  22058. * }
  22059. * }
  22060. *
  22061. * var el = _.cloneDeepWith(document.body, customizer);
  22062. *
  22063. * console.log(el === document.body);
  22064. * // => false
  22065. * console.log(el.nodeName);
  22066. * // => 'BODY'
  22067. * console.log(el.childNodes.length);
  22068. * // => 20
  22069. */
  22070. function cloneDeepWith(value, customizer) {
  22071. customizer = typeof customizer == 'function' ? customizer : undefined;
  22072. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  22073. }
  22074. /**
  22075. * Checks if `object` conforms to `source` by invoking the predicate
  22076. * properties of `source` with the corresponding property values of `object`.
  22077. *
  22078. * **Note:** This method is equivalent to `_.conforms` when `source` is
  22079. * partially applied.
  22080. *
  22081. * @static
  22082. * @memberOf _
  22083. * @since 4.14.0
  22084. * @category Lang
  22085. * @param {Object} object The object to inspect.
  22086. * @param {Object} source The object of property predicates to conform to.
  22087. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  22088. * @example
  22089. *
  22090. * var object = { 'a': 1, 'b': 2 };
  22091. *
  22092. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  22093. * // => true
  22094. *
  22095. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  22096. * // => false
  22097. */
  22098. function conformsTo(object, source) {
  22099. return source == null || baseConformsTo(object, source, keys(source));
  22100. }
  22101. /**
  22102. * Performs a
  22103. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  22104. * comparison between two values to determine if they are equivalent.
  22105. *
  22106. * @static
  22107. * @memberOf _
  22108. * @since 4.0.0
  22109. * @category Lang
  22110. * @param {*} value The value to compare.
  22111. * @param {*} other The other value to compare.
  22112. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  22113. * @example
  22114. *
  22115. * var object = { 'a': 1 };
  22116. * var other = { 'a': 1 };
  22117. *
  22118. * _.eq(object, object);
  22119. * // => true
  22120. *
  22121. * _.eq(object, other);
  22122. * // => false
  22123. *
  22124. * _.eq('a', 'a');
  22125. * // => true
  22126. *
  22127. * _.eq('a', Object('a'));
  22128. * // => false
  22129. *
  22130. * _.eq(NaN, NaN);
  22131. * // => true
  22132. */
  22133. function eq(value, other) {
  22134. return value === other || (value !== value && other !== other);
  22135. }
  22136. /**
  22137. * Checks if `value` is greater than `other`.
  22138. *
  22139. * @static
  22140. * @memberOf _
  22141. * @since 3.9.0
  22142. * @category Lang
  22143. * @param {*} value The value to compare.
  22144. * @param {*} other The other value to compare.
  22145. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  22146. * else `false`.
  22147. * @see _.lt
  22148. * @example
  22149. *
  22150. * _.gt(3, 1);
  22151. * // => true
  22152. *
  22153. * _.gt(3, 3);
  22154. * // => false
  22155. *
  22156. * _.gt(1, 3);
  22157. * // => false
  22158. */
  22159. var gt = createRelationalOperation(baseGt);
  22160. /**
  22161. * Checks if `value` is greater than or equal to `other`.
  22162. *
  22163. * @static
  22164. * @memberOf _
  22165. * @since 3.9.0
  22166. * @category Lang
  22167. * @param {*} value The value to compare.
  22168. * @param {*} other The other value to compare.
  22169. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  22170. * `other`, else `false`.
  22171. * @see _.lte
  22172. * @example
  22173. *
  22174. * _.gte(3, 1);
  22175. * // => true
  22176. *
  22177. * _.gte(3, 3);
  22178. * // => true
  22179. *
  22180. * _.gte(1, 3);
  22181. * // => false
  22182. */
  22183. var gte = createRelationalOperation(function(value, other) {
  22184. return value >= other;
  22185. });
  22186. /**
  22187. * Checks if `value` is likely an `arguments` object.
  22188. *
  22189. * @static
  22190. * @memberOf _
  22191. * @since 0.1.0
  22192. * @category Lang
  22193. * @param {*} value The value to check.
  22194. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  22195. * else `false`.
  22196. * @example
  22197. *
  22198. * _.isArguments(function() { return arguments; }());
  22199. * // => true
  22200. *
  22201. * _.isArguments([1, 2, 3]);
  22202. * // => false
  22203. */
  22204. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  22205. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  22206. !propertyIsEnumerable.call(value, 'callee');
  22207. };
  22208. /**
  22209. * Checks if `value` is classified as an `Array` object.
  22210. *
  22211. * @static
  22212. * @memberOf _
  22213. * @since 0.1.0
  22214. * @category Lang
  22215. * @param {*} value The value to check.
  22216. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  22217. * @example
  22218. *
  22219. * _.isArray([1, 2, 3]);
  22220. * // => true
  22221. *
  22222. * _.isArray(document.body.children);
  22223. * // => false
  22224. *
  22225. * _.isArray('abc');
  22226. * // => false
  22227. *
  22228. * _.isArray(_.noop);
  22229. * // => false
  22230. */
  22231. var isArray = Array.isArray;
  22232. /**
  22233. * Checks if `value` is classified as an `ArrayBuffer` object.
  22234. *
  22235. * @static
  22236. * @memberOf _
  22237. * @since 4.3.0
  22238. * @category Lang
  22239. * @param {*} value The value to check.
  22240. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  22241. * @example
  22242. *
  22243. * _.isArrayBuffer(new ArrayBuffer(2));
  22244. * // => true
  22245. *
  22246. * _.isArrayBuffer(new Array(2));
  22247. * // => false
  22248. */
  22249. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  22250. /**
  22251. * Checks if `value` is array-like. A value is considered array-like if it's
  22252. * not a function and has a `value.length` that's an integer greater than or
  22253. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  22254. *
  22255. * @static
  22256. * @memberOf _
  22257. * @since 4.0.0
  22258. * @category Lang
  22259. * @param {*} value The value to check.
  22260. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  22261. * @example
  22262. *
  22263. * _.isArrayLike([1, 2, 3]);
  22264. * // => true
  22265. *
  22266. * _.isArrayLike(document.body.children);
  22267. * // => true
  22268. *
  22269. * _.isArrayLike('abc');
  22270. * // => true
  22271. *
  22272. * _.isArrayLike(_.noop);
  22273. * // => false
  22274. */
  22275. function isArrayLike(value) {
  22276. return value != null && isLength(value.length) && !isFunction(value);
  22277. }
  22278. /**
  22279. * This method is like `_.isArrayLike` except that it also checks if `value`
  22280. * is an object.
  22281. *
  22282. * @static
  22283. * @memberOf _
  22284. * @since 4.0.0
  22285. * @category Lang
  22286. * @param {*} value The value to check.
  22287. * @returns {boolean} Returns `true` if `value` is an array-like object,
  22288. * else `false`.
  22289. * @example
  22290. *
  22291. * _.isArrayLikeObject([1, 2, 3]);
  22292. * // => true
  22293. *
  22294. * _.isArrayLikeObject(document.body.children);
  22295. * // => true
  22296. *
  22297. * _.isArrayLikeObject('abc');
  22298. * // => false
  22299. *
  22300. * _.isArrayLikeObject(_.noop);
  22301. * // => false
  22302. */
  22303. function isArrayLikeObject(value) {
  22304. return isObjectLike(value) && isArrayLike(value);
  22305. }
  22306. /**
  22307. * Checks if `value` is classified as a boolean primitive or object.
  22308. *
  22309. * @static
  22310. * @memberOf _
  22311. * @since 0.1.0
  22312. * @category Lang
  22313. * @param {*} value The value to check.
  22314. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  22315. * @example
  22316. *
  22317. * _.isBoolean(false);
  22318. * // => true
  22319. *
  22320. * _.isBoolean(null);
  22321. * // => false
  22322. */
  22323. function isBoolean(value) {
  22324. return value === true || value === false ||
  22325. (isObjectLike(value) && baseGetTag(value) == boolTag);
  22326. }
  22327. /**
  22328. * Checks if `value` is a buffer.
  22329. *
  22330. * @static
  22331. * @memberOf _
  22332. * @since 4.3.0
  22333. * @category Lang
  22334. * @param {*} value The value to check.
  22335. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  22336. * @example
  22337. *
  22338. * _.isBuffer(new Buffer(2));
  22339. * // => true
  22340. *
  22341. * _.isBuffer(new Uint8Array(2));
  22342. * // => false
  22343. */
  22344. var isBuffer = nativeIsBuffer || stubFalse;
  22345. /**
  22346. * Checks if `value` is classified as a `Date` object.
  22347. *
  22348. * @static
  22349. * @memberOf _
  22350. * @since 0.1.0
  22351. * @category Lang
  22352. * @param {*} value The value to check.
  22353. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  22354. * @example
  22355. *
  22356. * _.isDate(new Date);
  22357. * // => true
  22358. *
  22359. * _.isDate('Mon April 23 2012');
  22360. * // => false
  22361. */
  22362. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  22363. /**
  22364. * Checks if `value` is likely a DOM element.
  22365. *
  22366. * @static
  22367. * @memberOf _
  22368. * @since 0.1.0
  22369. * @category Lang
  22370. * @param {*} value The value to check.
  22371. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  22372. * @example
  22373. *
  22374. * _.isElement(document.body);
  22375. * // => true
  22376. *
  22377. * _.isElement('<body>');
  22378. * // => false
  22379. */
  22380. function isElement(value) {
  22381. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  22382. }
  22383. /**
  22384. * Checks if `value` is an empty object, collection, map, or set.
  22385. *
  22386. * Objects are considered empty if they have no own enumerable string keyed
  22387. * properties.
  22388. *
  22389. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  22390. * jQuery-like collections are considered empty if they have a `length` of `0`.
  22391. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  22392. *
  22393. * @static
  22394. * @memberOf _
  22395. * @since 0.1.0
  22396. * @category Lang
  22397. * @param {*} value The value to check.
  22398. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  22399. * @example
  22400. *
  22401. * _.isEmpty(null);
  22402. * // => true
  22403. *
  22404. * _.isEmpty(true);
  22405. * // => true
  22406. *
  22407. * _.isEmpty(1);
  22408. * // => true
  22409. *
  22410. * _.isEmpty([1, 2, 3]);
  22411. * // => false
  22412. *
  22413. * _.isEmpty({ 'a': 1 });
  22414. * // => false
  22415. */
  22416. function isEmpty(value) {
  22417. if (value == null) {
  22418. return true;
  22419. }
  22420. if (isArrayLike(value) &&
  22421. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  22422. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  22423. return !value.length;
  22424. }
  22425. var tag = getTag(value);
  22426. if (tag == mapTag || tag == setTag) {
  22427. return !value.size;
  22428. }
  22429. if (isPrototype(value)) {
  22430. return !baseKeys(value).length;
  22431. }
  22432. for (var key in value) {
  22433. if (hasOwnProperty.call(value, key)) {
  22434. return false;
  22435. }
  22436. }
  22437. return true;
  22438. }
  22439. /**
  22440. * Performs a deep comparison between two values to determine if they are
  22441. * equivalent.
  22442. *
  22443. * **Note:** This method supports comparing arrays, array buffers, booleans,
  22444. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  22445. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  22446. * by their own, not inherited, enumerable properties. Functions and DOM
  22447. * nodes are compared by strict equality, i.e. `===`.
  22448. *
  22449. * @static
  22450. * @memberOf _
  22451. * @since 0.1.0
  22452. * @category Lang
  22453. * @param {*} value The value to compare.
  22454. * @param {*} other The other value to compare.
  22455. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  22456. * @example
  22457. *
  22458. * var object = { 'a': 1 };
  22459. * var other = { 'a': 1 };
  22460. *
  22461. * _.isEqual(object, other);
  22462. * // => true
  22463. *
  22464. * object === other;
  22465. * // => false
  22466. */
  22467. function isEqual(value, other) {
  22468. return baseIsEqual(value, other);
  22469. }
  22470. /**
  22471. * This method is like `_.isEqual` except that it accepts `customizer` which
  22472. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  22473. * are handled by the method instead. The `customizer` is invoked with up to
  22474. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  22475. *
  22476. * @static
  22477. * @memberOf _
  22478. * @since 4.0.0
  22479. * @category Lang
  22480. * @param {*} value The value to compare.
  22481. * @param {*} other The other value to compare.
  22482. * @param {Function} [customizer] The function to customize comparisons.
  22483. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  22484. * @example
  22485. *
  22486. * function isGreeting(value) {
  22487. * return /^h(?:i|ello)$/.test(value);
  22488. * }
  22489. *
  22490. * function customizer(objValue, othValue) {
  22491. * if (isGreeting(objValue) && isGreeting(othValue)) {
  22492. * return true;
  22493. * }
  22494. * }
  22495. *
  22496. * var array = ['hello', 'goodbye'];
  22497. * var other = ['hi', 'goodbye'];
  22498. *
  22499. * _.isEqualWith(array, other, customizer);
  22500. * // => true
  22501. */
  22502. function isEqualWith(value, other, customizer) {
  22503. customizer = typeof customizer == 'function' ? customizer : undefined;
  22504. var result = customizer ? customizer(value, other) : undefined;
  22505. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  22506. }
  22507. /**
  22508. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  22509. * `SyntaxError`, `TypeError`, or `URIError` object.
  22510. *
  22511. * @static
  22512. * @memberOf _
  22513. * @since 3.0.0
  22514. * @category Lang
  22515. * @param {*} value The value to check.
  22516. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  22517. * @example
  22518. *
  22519. * _.isError(new Error);
  22520. * // => true
  22521. *
  22522. * _.isError(Error);
  22523. * // => false
  22524. */
  22525. function isError(value) {
  22526. if (!isObjectLike(value)) {
  22527. return false;
  22528. }
  22529. var tag = baseGetTag(value);
  22530. return tag == errorTag || tag == domExcTag ||
  22531. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  22532. }
  22533. /**
  22534. * Checks if `value` is a finite primitive number.
  22535. *
  22536. * **Note:** This method is based on
  22537. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  22538. *
  22539. * @static
  22540. * @memberOf _
  22541. * @since 0.1.0
  22542. * @category Lang
  22543. * @param {*} value The value to check.
  22544. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  22545. * @example
  22546. *
  22547. * _.isFinite(3);
  22548. * // => true
  22549. *
  22550. * _.isFinite(Number.MIN_VALUE);
  22551. * // => true
  22552. *
  22553. * _.isFinite(Infinity);
  22554. * // => false
  22555. *
  22556. * _.isFinite('3');
  22557. * // => false
  22558. */
  22559. function isFinite(value) {
  22560. return typeof value == 'number' && nativeIsFinite(value);
  22561. }
  22562. /**
  22563. * Checks if `value` is classified as a `Function` object.
  22564. *
  22565. * @static
  22566. * @memberOf _
  22567. * @since 0.1.0
  22568. * @category Lang
  22569. * @param {*} value The value to check.
  22570. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  22571. * @example
  22572. *
  22573. * _.isFunction(_);
  22574. * // => true
  22575. *
  22576. * _.isFunction(/abc/);
  22577. * // => false
  22578. */
  22579. function isFunction(value) {
  22580. if (!isObject(value)) {
  22581. return false;
  22582. }
  22583. // The use of `Object#toString` avoids issues with the `typeof` operator
  22584. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  22585. var tag = baseGetTag(value);
  22586. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  22587. }
  22588. /**
  22589. * Checks if `value` is an integer.
  22590. *
  22591. * **Note:** This method is based on
  22592. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  22593. *
  22594. * @static
  22595. * @memberOf _
  22596. * @since 4.0.0
  22597. * @category Lang
  22598. * @param {*} value The value to check.
  22599. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  22600. * @example
  22601. *
  22602. * _.isInteger(3);
  22603. * // => true
  22604. *
  22605. * _.isInteger(Number.MIN_VALUE);
  22606. * // => false
  22607. *
  22608. * _.isInteger(Infinity);
  22609. * // => false
  22610. *
  22611. * _.isInteger('3');
  22612. * // => false
  22613. */
  22614. function isInteger(value) {
  22615. return typeof value == 'number' && value == toInteger(value);
  22616. }
  22617. /**
  22618. * Checks if `value` is a valid array-like length.
  22619. *
  22620. * **Note:** This method is loosely based on
  22621. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  22622. *
  22623. * @static
  22624. * @memberOf _
  22625. * @since 4.0.0
  22626. * @category Lang
  22627. * @param {*} value The value to check.
  22628. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  22629. * @example
  22630. *
  22631. * _.isLength(3);
  22632. * // => true
  22633. *
  22634. * _.isLength(Number.MIN_VALUE);
  22635. * // => false
  22636. *
  22637. * _.isLength(Infinity);
  22638. * // => false
  22639. *
  22640. * _.isLength('3');
  22641. * // => false
  22642. */
  22643. function isLength(value) {
  22644. return typeof value == 'number' &&
  22645. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  22646. }
  22647. /**
  22648. * Checks if `value` is the
  22649. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  22650. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  22651. *
  22652. * @static
  22653. * @memberOf _
  22654. * @since 0.1.0
  22655. * @category Lang
  22656. * @param {*} value The value to check.
  22657. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  22658. * @example
  22659. *
  22660. * _.isObject({});
  22661. * // => true
  22662. *
  22663. * _.isObject([1, 2, 3]);
  22664. * // => true
  22665. *
  22666. * _.isObject(_.noop);
  22667. * // => true
  22668. *
  22669. * _.isObject(null);
  22670. * // => false
  22671. */
  22672. function isObject(value) {
  22673. var type = typeof value;
  22674. return value != null && (type == 'object' || type == 'function');
  22675. }
  22676. /**
  22677. * Checks if `value` is object-like. A value is object-like if it's not `null`
  22678. * and has a `typeof` result of "object".
  22679. *
  22680. * @static
  22681. * @memberOf _
  22682. * @since 4.0.0
  22683. * @category Lang
  22684. * @param {*} value The value to check.
  22685. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  22686. * @example
  22687. *
  22688. * _.isObjectLike({});
  22689. * // => true
  22690. *
  22691. * _.isObjectLike([1, 2, 3]);
  22692. * // => true
  22693. *
  22694. * _.isObjectLike(_.noop);
  22695. * // => false
  22696. *
  22697. * _.isObjectLike(null);
  22698. * // => false
  22699. */
  22700. function isObjectLike(value) {
  22701. return value != null && typeof value == 'object';
  22702. }
  22703. /**
  22704. * Checks if `value` is classified as a `Map` object.
  22705. *
  22706. * @static
  22707. * @memberOf _
  22708. * @since 4.3.0
  22709. * @category Lang
  22710. * @param {*} value The value to check.
  22711. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  22712. * @example
  22713. *
  22714. * _.isMap(new Map);
  22715. * // => true
  22716. *
  22717. * _.isMap(new WeakMap);
  22718. * // => false
  22719. */
  22720. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  22721. /**
  22722. * Performs a partial deep comparison between `object` and `source` to
  22723. * determine if `object` contains equivalent property values.
  22724. *
  22725. * **Note:** This method is equivalent to `_.matches` when `source` is
  22726. * partially applied.
  22727. *
  22728. * Partial comparisons will match empty array and empty object `source`
  22729. * values against any array or object value, respectively. See `_.isEqual`
  22730. * for a list of supported value comparisons.
  22731. *
  22732. * @static
  22733. * @memberOf _
  22734. * @since 3.0.0
  22735. * @category Lang
  22736. * @param {Object} object The object to inspect.
  22737. * @param {Object} source The object of property values to match.
  22738. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  22739. * @example
  22740. *
  22741. * var object = { 'a': 1, 'b': 2 };
  22742. *
  22743. * _.isMatch(object, { 'b': 2 });
  22744. * // => true
  22745. *
  22746. * _.isMatch(object, { 'b': 1 });
  22747. * // => false
  22748. */
  22749. function isMatch(object, source) {
  22750. return object === source || baseIsMatch(object, source, getMatchData(source));
  22751. }
  22752. /**
  22753. * This method is like `_.isMatch` except that it accepts `customizer` which
  22754. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  22755. * are handled by the method instead. The `customizer` is invoked with five
  22756. * arguments: (objValue, srcValue, index|key, object, source).
  22757. *
  22758. * @static
  22759. * @memberOf _
  22760. * @since 4.0.0
  22761. * @category Lang
  22762. * @param {Object} object The object to inspect.
  22763. * @param {Object} source The object of property values to match.
  22764. * @param {Function} [customizer] The function to customize comparisons.
  22765. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  22766. * @example
  22767. *
  22768. * function isGreeting(value) {
  22769. * return /^h(?:i|ello)$/.test(value);
  22770. * }
  22771. *
  22772. * function customizer(objValue, srcValue) {
  22773. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  22774. * return true;
  22775. * }
  22776. * }
  22777. *
  22778. * var object = { 'greeting': 'hello' };
  22779. * var source = { 'greeting': 'hi' };
  22780. *
  22781. * _.isMatchWith(object, source, customizer);
  22782. * // => true
  22783. */
  22784. function isMatchWith(object, source, customizer) {
  22785. customizer = typeof customizer == 'function' ? customizer : undefined;
  22786. return baseIsMatch(object, source, getMatchData(source), customizer);
  22787. }
  22788. /**
  22789. * Checks if `value` is `NaN`.
  22790. *
  22791. * **Note:** This method is based on
  22792. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  22793. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  22794. * `undefined` and other non-number values.
  22795. *
  22796. * @static
  22797. * @memberOf _
  22798. * @since 0.1.0
  22799. * @category Lang
  22800. * @param {*} value The value to check.
  22801. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  22802. * @example
  22803. *
  22804. * _.isNaN(NaN);
  22805. * // => true
  22806. *
  22807. * _.isNaN(new Number(NaN));
  22808. * // => true
  22809. *
  22810. * isNaN(undefined);
  22811. * // => true
  22812. *
  22813. * _.isNaN(undefined);
  22814. * // => false
  22815. */
  22816. function isNaN(value) {
  22817. // An `NaN` primitive is the only value that is not equal to itself.
  22818. // Perform the `toStringTag` check first to avoid errors with some
  22819. // ActiveX objects in IE.
  22820. return isNumber(value) && value != +value;
  22821. }
  22822. /**
  22823. * Checks if `value` is a pristine native function.
  22824. *
  22825. * **Note:** This method can't reliably detect native functions in the presence
  22826. * of the core-js package because core-js circumvents this kind of detection.
  22827. * Despite multiple requests, the core-js maintainer has made it clear: any
  22828. * attempt to fix the detection will be obstructed. As a result, we're left
  22829. * with little choice but to throw an error. Unfortunately, this also affects
  22830. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  22831. * which rely on core-js.
  22832. *
  22833. * @static
  22834. * @memberOf _
  22835. * @since 3.0.0
  22836. * @category Lang
  22837. * @param {*} value The value to check.
  22838. * @returns {boolean} Returns `true` if `value` is a native function,
  22839. * else `false`.
  22840. * @example
  22841. *
  22842. * _.isNative(Array.prototype.push);
  22843. * // => true
  22844. *
  22845. * _.isNative(_);
  22846. * // => false
  22847. */
  22848. function isNative(value) {
  22849. if (isMaskable(value)) {
  22850. throw new Error(CORE_ERROR_TEXT);
  22851. }
  22852. return baseIsNative(value);
  22853. }
  22854. /**
  22855. * Checks if `value` is `null`.
  22856. *
  22857. * @static
  22858. * @memberOf _
  22859. * @since 0.1.0
  22860. * @category Lang
  22861. * @param {*} value The value to check.
  22862. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  22863. * @example
  22864. *
  22865. * _.isNull(null);
  22866. * // => true
  22867. *
  22868. * _.isNull(void 0);
  22869. * // => false
  22870. */
  22871. function isNull(value) {
  22872. return value === null;
  22873. }
  22874. /**
  22875. * Checks if `value` is `null` or `undefined`.
  22876. *
  22877. * @static
  22878. * @memberOf _
  22879. * @since 4.0.0
  22880. * @category Lang
  22881. * @param {*} value The value to check.
  22882. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  22883. * @example
  22884. *
  22885. * _.isNil(null);
  22886. * // => true
  22887. *
  22888. * _.isNil(void 0);
  22889. * // => true
  22890. *
  22891. * _.isNil(NaN);
  22892. * // => false
  22893. */
  22894. function isNil(value) {
  22895. return value == null;
  22896. }
  22897. /**
  22898. * Checks if `value` is classified as a `Number` primitive or object.
  22899. *
  22900. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  22901. * classified as numbers, use the `_.isFinite` method.
  22902. *
  22903. * @static
  22904. * @memberOf _
  22905. * @since 0.1.0
  22906. * @category Lang
  22907. * @param {*} value The value to check.
  22908. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  22909. * @example
  22910. *
  22911. * _.isNumber(3);
  22912. * // => true
  22913. *
  22914. * _.isNumber(Number.MIN_VALUE);
  22915. * // => true
  22916. *
  22917. * _.isNumber(Infinity);
  22918. * // => true
  22919. *
  22920. * _.isNumber('3');
  22921. * // => false
  22922. */
  22923. function isNumber(value) {
  22924. return typeof value == 'number' ||
  22925. (isObjectLike(value) && baseGetTag(value) == numberTag);
  22926. }
  22927. /**
  22928. * Checks if `value` is a plain object, that is, an object created by the
  22929. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  22930. *
  22931. * @static
  22932. * @memberOf _
  22933. * @since 0.8.0
  22934. * @category Lang
  22935. * @param {*} value The value to check.
  22936. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  22937. * @example
  22938. *
  22939. * function Foo() {
  22940. * this.a = 1;
  22941. * }
  22942. *
  22943. * _.isPlainObject(new Foo);
  22944. * // => false
  22945. *
  22946. * _.isPlainObject([1, 2, 3]);
  22947. * // => false
  22948. *
  22949. * _.isPlainObject({ 'x': 0, 'y': 0 });
  22950. * // => true
  22951. *
  22952. * _.isPlainObject(Object.create(null));
  22953. * // => true
  22954. */
  22955. function isPlainObject(value) {
  22956. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  22957. return false;
  22958. }
  22959. var proto = getPrototype(value);
  22960. if (proto === null) {
  22961. return true;
  22962. }
  22963. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  22964. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  22965. funcToString.call(Ctor) == objectCtorString;
  22966. }
  22967. /**
  22968. * Checks if `value` is classified as a `RegExp` object.
  22969. *
  22970. * @static
  22971. * @memberOf _
  22972. * @since 0.1.0
  22973. * @category Lang
  22974. * @param {*} value The value to check.
  22975. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  22976. * @example
  22977. *
  22978. * _.isRegExp(/abc/);
  22979. * // => true
  22980. *
  22981. * _.isRegExp('/abc/');
  22982. * // => false
  22983. */
  22984. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  22985. /**
  22986. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  22987. * double precision number which isn't the result of a rounded unsafe integer.
  22988. *
  22989. * **Note:** This method is based on
  22990. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  22991. *
  22992. * @static
  22993. * @memberOf _
  22994. * @since 4.0.0
  22995. * @category Lang
  22996. * @param {*} value The value to check.
  22997. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  22998. * @example
  22999. *
  23000. * _.isSafeInteger(3);
  23001. * // => true
  23002. *
  23003. * _.isSafeInteger(Number.MIN_VALUE);
  23004. * // => false
  23005. *
  23006. * _.isSafeInteger(Infinity);
  23007. * // => false
  23008. *
  23009. * _.isSafeInteger('3');
  23010. * // => false
  23011. */
  23012. function isSafeInteger(value) {
  23013. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  23014. }
  23015. /**
  23016. * Checks if `value` is classified as a `Set` object.
  23017. *
  23018. * @static
  23019. * @memberOf _
  23020. * @since 4.3.0
  23021. * @category Lang
  23022. * @param {*} value The value to check.
  23023. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  23024. * @example
  23025. *
  23026. * _.isSet(new Set);
  23027. * // => true
  23028. *
  23029. * _.isSet(new WeakSet);
  23030. * // => false
  23031. */
  23032. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  23033. /**
  23034. * Checks if `value` is classified as a `String` primitive or object.
  23035. *
  23036. * @static
  23037. * @since 0.1.0
  23038. * @memberOf _
  23039. * @category Lang
  23040. * @param {*} value The value to check.
  23041. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  23042. * @example
  23043. *
  23044. * _.isString('abc');
  23045. * // => true
  23046. *
  23047. * _.isString(1);
  23048. * // => false
  23049. */
  23050. function isString(value) {
  23051. return typeof value == 'string' ||
  23052. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  23053. }
  23054. /**
  23055. * Checks if `value` is classified as a `Symbol` primitive or object.
  23056. *
  23057. * @static
  23058. * @memberOf _
  23059. * @since 4.0.0
  23060. * @category Lang
  23061. * @param {*} value The value to check.
  23062. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  23063. * @example
  23064. *
  23065. * _.isSymbol(Symbol.iterator);
  23066. * // => true
  23067. *
  23068. * _.isSymbol('abc');
  23069. * // => false
  23070. */
  23071. function isSymbol(value) {
  23072. return typeof value == 'symbol' ||
  23073. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  23074. }
  23075. /**
  23076. * Checks if `value` is classified as a typed array.
  23077. *
  23078. * @static
  23079. * @memberOf _
  23080. * @since 3.0.0
  23081. * @category Lang
  23082. * @param {*} value The value to check.
  23083. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  23084. * @example
  23085. *
  23086. * _.isTypedArray(new Uint8Array);
  23087. * // => true
  23088. *
  23089. * _.isTypedArray([]);
  23090. * // => false
  23091. */
  23092. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  23093. /**
  23094. * Checks if `value` is `undefined`.
  23095. *
  23096. * @static
  23097. * @since 0.1.0
  23098. * @memberOf _
  23099. * @category Lang
  23100. * @param {*} value The value to check.
  23101. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  23102. * @example
  23103. *
  23104. * _.isUndefined(void 0);
  23105. * // => true
  23106. *
  23107. * _.isUndefined(null);
  23108. * // => false
  23109. */
  23110. function isUndefined(value) {
  23111. return value === undefined;
  23112. }
  23113. /**
  23114. * Checks if `value` is classified as a `WeakMap` object.
  23115. *
  23116. * @static
  23117. * @memberOf _
  23118. * @since 4.3.0
  23119. * @category Lang
  23120. * @param {*} value The value to check.
  23121. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  23122. * @example
  23123. *
  23124. * _.isWeakMap(new WeakMap);
  23125. * // => true
  23126. *
  23127. * _.isWeakMap(new Map);
  23128. * // => false
  23129. */
  23130. function isWeakMap(value) {
  23131. return isObjectLike(value) && getTag(value) == weakMapTag;
  23132. }
  23133. /**
  23134. * Checks if `value` is classified as a `WeakSet` object.
  23135. *
  23136. * @static
  23137. * @memberOf _
  23138. * @since 4.3.0
  23139. * @category Lang
  23140. * @param {*} value The value to check.
  23141. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  23142. * @example
  23143. *
  23144. * _.isWeakSet(new WeakSet);
  23145. * // => true
  23146. *
  23147. * _.isWeakSet(new Set);
  23148. * // => false
  23149. */
  23150. function isWeakSet(value) {
  23151. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  23152. }
  23153. /**
  23154. * Checks if `value` is less than `other`.
  23155. *
  23156. * @static
  23157. * @memberOf _
  23158. * @since 3.9.0
  23159. * @category Lang
  23160. * @param {*} value The value to compare.
  23161. * @param {*} other The other value to compare.
  23162. * @returns {boolean} Returns `true` if `value` is less than `other`,
  23163. * else `false`.
  23164. * @see _.gt
  23165. * @example
  23166. *
  23167. * _.lt(1, 3);
  23168. * // => true
  23169. *
  23170. * _.lt(3, 3);
  23171. * // => false
  23172. *
  23173. * _.lt(3, 1);
  23174. * // => false
  23175. */
  23176. var lt = createRelationalOperation(baseLt);
  23177. /**
  23178. * Checks if `value` is less than or equal to `other`.
  23179. *
  23180. * @static
  23181. * @memberOf _
  23182. * @since 3.9.0
  23183. * @category Lang
  23184. * @param {*} value The value to compare.
  23185. * @param {*} other The other value to compare.
  23186. * @returns {boolean} Returns `true` if `value` is less than or equal to
  23187. * `other`, else `false`.
  23188. * @see _.gte
  23189. * @example
  23190. *
  23191. * _.lte(1, 3);
  23192. * // => true
  23193. *
  23194. * _.lte(3, 3);
  23195. * // => true
  23196. *
  23197. * _.lte(3, 1);
  23198. * // => false
  23199. */
  23200. var lte = createRelationalOperation(function(value, other) {
  23201. return value <= other;
  23202. });
  23203. /**
  23204. * Converts `value` to an array.
  23205. *
  23206. * @static
  23207. * @since 0.1.0
  23208. * @memberOf _
  23209. * @category Lang
  23210. * @param {*} value The value to convert.
  23211. * @returns {Array} Returns the converted array.
  23212. * @example
  23213. *
  23214. * _.toArray({ 'a': 1, 'b': 2 });
  23215. * // => [1, 2]
  23216. *
  23217. * _.toArray('abc');
  23218. * // => ['a', 'b', 'c']
  23219. *
  23220. * _.toArray(1);
  23221. * // => []
  23222. *
  23223. * _.toArray(null);
  23224. * // => []
  23225. */
  23226. function toArray(value) {
  23227. if (!value) {
  23228. return [];
  23229. }
  23230. if (isArrayLike(value)) {
  23231. return isString(value) ? stringToArray(value) : copyArray(value);
  23232. }
  23233. if (symIterator && value[symIterator]) {
  23234. return iteratorToArray(value[symIterator]());
  23235. }
  23236. var tag = getTag(value),
  23237. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  23238. return func(value);
  23239. }
  23240. /**
  23241. * Converts `value` to a finite number.
  23242. *
  23243. * @static
  23244. * @memberOf _
  23245. * @since 4.12.0
  23246. * @category Lang
  23247. * @param {*} value The value to convert.
  23248. * @returns {number} Returns the converted number.
  23249. * @example
  23250. *
  23251. * _.toFinite(3.2);
  23252. * // => 3.2
  23253. *
  23254. * _.toFinite(Number.MIN_VALUE);
  23255. * // => 5e-324
  23256. *
  23257. * _.toFinite(Infinity);
  23258. * // => 1.7976931348623157e+308
  23259. *
  23260. * _.toFinite('3.2');
  23261. * // => 3.2
  23262. */
  23263. function toFinite(value) {
  23264. if (!value) {
  23265. return value === 0 ? value : 0;
  23266. }
  23267. value = toNumber(value);
  23268. if (value === INFINITY || value === -INFINITY) {
  23269. var sign = (value < 0 ? -1 : 1);
  23270. return sign * MAX_INTEGER;
  23271. }
  23272. return value === value ? value : 0;
  23273. }
  23274. /**
  23275. * Converts `value` to an integer.
  23276. *
  23277. * **Note:** This method is loosely based on
  23278. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  23279. *
  23280. * @static
  23281. * @memberOf _
  23282. * @since 4.0.0
  23283. * @category Lang
  23284. * @param {*} value The value to convert.
  23285. * @returns {number} Returns the converted integer.
  23286. * @example
  23287. *
  23288. * _.toInteger(3.2);
  23289. * // => 3
  23290. *
  23291. * _.toInteger(Number.MIN_VALUE);
  23292. * // => 0
  23293. *
  23294. * _.toInteger(Infinity);
  23295. * // => 1.7976931348623157e+308
  23296. *
  23297. * _.toInteger('3.2');
  23298. * // => 3
  23299. */
  23300. function toInteger(value) {
  23301. var result = toFinite(value),
  23302. remainder = result % 1;
  23303. return result === result ? (remainder ? result - remainder : result) : 0;
  23304. }
  23305. /**
  23306. * Converts `value` to an integer suitable for use as the length of an
  23307. * array-like object.
  23308. *
  23309. * **Note:** This method is based on
  23310. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  23311. *
  23312. * @static
  23313. * @memberOf _
  23314. * @since 4.0.0
  23315. * @category Lang
  23316. * @param {*} value The value to convert.
  23317. * @returns {number} Returns the converted integer.
  23318. * @example
  23319. *
  23320. * _.toLength(3.2);
  23321. * // => 3
  23322. *
  23323. * _.toLength(Number.MIN_VALUE);
  23324. * // => 0
  23325. *
  23326. * _.toLength(Infinity);
  23327. * // => 4294967295
  23328. *
  23329. * _.toLength('3.2');
  23330. * // => 3
  23331. */
  23332. function toLength(value) {
  23333. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  23334. }
  23335. /**
  23336. * Converts `value` to a number.
  23337. *
  23338. * @static
  23339. * @memberOf _
  23340. * @since 4.0.0
  23341. * @category Lang
  23342. * @param {*} value The value to process.
  23343. * @returns {number} Returns the number.
  23344. * @example
  23345. *
  23346. * _.toNumber(3.2);
  23347. * // => 3.2
  23348. *
  23349. * _.toNumber(Number.MIN_VALUE);
  23350. * // => 5e-324
  23351. *
  23352. * _.toNumber(Infinity);
  23353. * // => Infinity
  23354. *
  23355. * _.toNumber('3.2');
  23356. * // => 3.2
  23357. */
  23358. function toNumber(value) {
  23359. if (typeof value == 'number') {
  23360. return value;
  23361. }
  23362. if (isSymbol(value)) {
  23363. return NAN;
  23364. }
  23365. if (isObject(value)) {
  23366. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  23367. value = isObject(other) ? (other + '') : other;
  23368. }
  23369. if (typeof value != 'string') {
  23370. return value === 0 ? value : +value;
  23371. }
  23372. value = value.replace(reTrim, '');
  23373. var isBinary = reIsBinary.test(value);
  23374. return (isBinary || reIsOctal.test(value))
  23375. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  23376. : (reIsBadHex.test(value) ? NAN : +value);
  23377. }
  23378. /**
  23379. * Converts `value` to a plain object flattening inherited enumerable string
  23380. * keyed properties of `value` to own properties of the plain object.
  23381. *
  23382. * @static
  23383. * @memberOf _
  23384. * @since 3.0.0
  23385. * @category Lang
  23386. * @param {*} value The value to convert.
  23387. * @returns {Object} Returns the converted plain object.
  23388. * @example
  23389. *
  23390. * function Foo() {
  23391. * this.b = 2;
  23392. * }
  23393. *
  23394. * Foo.prototype.c = 3;
  23395. *
  23396. * _.assign({ 'a': 1 }, new Foo);
  23397. * // => { 'a': 1, 'b': 2 }
  23398. *
  23399. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  23400. * // => { 'a': 1, 'b': 2, 'c': 3 }
  23401. */
  23402. function toPlainObject(value) {
  23403. return copyObject(value, keysIn(value));
  23404. }
  23405. /**
  23406. * Converts `value` to a safe integer. A safe integer can be compared and
  23407. * represented correctly.
  23408. *
  23409. * @static
  23410. * @memberOf _
  23411. * @since 4.0.0
  23412. * @category Lang
  23413. * @param {*} value The value to convert.
  23414. * @returns {number} Returns the converted integer.
  23415. * @example
  23416. *
  23417. * _.toSafeInteger(3.2);
  23418. * // => 3
  23419. *
  23420. * _.toSafeInteger(Number.MIN_VALUE);
  23421. * // => 0
  23422. *
  23423. * _.toSafeInteger(Infinity);
  23424. * // => 9007199254740991
  23425. *
  23426. * _.toSafeInteger('3.2');
  23427. * // => 3
  23428. */
  23429. function toSafeInteger(value) {
  23430. return value
  23431. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  23432. : (value === 0 ? value : 0);
  23433. }
  23434. /**
  23435. * Converts `value` to a string. An empty string is returned for `null`
  23436. * and `undefined` values. The sign of `-0` is preserved.
  23437. *
  23438. * @static
  23439. * @memberOf _
  23440. * @since 4.0.0
  23441. * @category Lang
  23442. * @param {*} value The value to convert.
  23443. * @returns {string} Returns the converted string.
  23444. * @example
  23445. *
  23446. * _.toString(null);
  23447. * // => ''
  23448. *
  23449. * _.toString(-0);
  23450. * // => '-0'
  23451. *
  23452. * _.toString([1, 2, 3]);
  23453. * // => '1,2,3'
  23454. */
  23455. function toString(value) {
  23456. return value == null ? '' : baseToString(value);
  23457. }
  23458. /*------------------------------------------------------------------------*/
  23459. /**
  23460. * Assigns own enumerable string keyed properties of source objects to the
  23461. * destination object. Source objects are applied from left to right.
  23462. * Subsequent sources overwrite property assignments of previous sources.
  23463. *
  23464. * **Note:** This method mutates `object` and is loosely based on
  23465. * [`Object.assign`](https://mdn.io/Object/assign).
  23466. *
  23467. * @static
  23468. * @memberOf _
  23469. * @since 0.10.0
  23470. * @category Object
  23471. * @param {Object} object The destination object.
  23472. * @param {...Object} [sources] The source objects.
  23473. * @returns {Object} Returns `object`.
  23474. * @see _.assignIn
  23475. * @example
  23476. *
  23477. * function Foo() {
  23478. * this.a = 1;
  23479. * }
  23480. *
  23481. * function Bar() {
  23482. * this.c = 3;
  23483. * }
  23484. *
  23485. * Foo.prototype.b = 2;
  23486. * Bar.prototype.d = 4;
  23487. *
  23488. * _.assign({ 'a': 0 }, new Foo, new Bar);
  23489. * // => { 'a': 1, 'c': 3 }
  23490. */
  23491. var assign = createAssigner(function(object, source) {
  23492. if (isPrototype(source) || isArrayLike(source)) {
  23493. copyObject(source, keys(source), object);
  23494. return;
  23495. }
  23496. for (var key in source) {
  23497. if (hasOwnProperty.call(source, key)) {
  23498. assignValue(object, key, source[key]);
  23499. }
  23500. }
  23501. });
  23502. /**
  23503. * This method is like `_.assign` except that it iterates over own and
  23504. * inherited source properties.
  23505. *
  23506. * **Note:** This method mutates `object`.
  23507. *
  23508. * @static
  23509. * @memberOf _
  23510. * @since 4.0.0
  23511. * @alias extend
  23512. * @category Object
  23513. * @param {Object} object The destination object.
  23514. * @param {...Object} [sources] The source objects.
  23515. * @returns {Object} Returns `object`.
  23516. * @see _.assign
  23517. * @example
  23518. *
  23519. * function Foo() {
  23520. * this.a = 1;
  23521. * }
  23522. *
  23523. * function Bar() {
  23524. * this.c = 3;
  23525. * }
  23526. *
  23527. * Foo.prototype.b = 2;
  23528. * Bar.prototype.d = 4;
  23529. *
  23530. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  23531. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  23532. */
  23533. var assignIn = createAssigner(function(object, source) {
  23534. copyObject(source, keysIn(source), object);
  23535. });
  23536. /**
  23537. * This method is like `_.assignIn` except that it accepts `customizer`
  23538. * which is invoked to produce the assigned values. If `customizer` returns
  23539. * `undefined`, assignment is handled by the method instead. The `customizer`
  23540. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  23541. *
  23542. * **Note:** This method mutates `object`.
  23543. *
  23544. * @static
  23545. * @memberOf _
  23546. * @since 4.0.0
  23547. * @alias extendWith
  23548. * @category Object
  23549. * @param {Object} object The destination object.
  23550. * @param {...Object} sources The source objects.
  23551. * @param {Function} [customizer] The function to customize assigned values.
  23552. * @returns {Object} Returns `object`.
  23553. * @see _.assignWith
  23554. * @example
  23555. *
  23556. * function customizer(objValue, srcValue) {
  23557. * return _.isUndefined(objValue) ? srcValue : objValue;
  23558. * }
  23559. *
  23560. * var defaults = _.partialRight(_.assignInWith, customizer);
  23561. *
  23562. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  23563. * // => { 'a': 1, 'b': 2 }
  23564. */
  23565. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  23566. copyObject(source, keysIn(source), object, customizer);
  23567. });
  23568. /**
  23569. * This method is like `_.assign` except that it accepts `customizer`
  23570. * which is invoked to produce the assigned values. If `customizer` returns
  23571. * `undefined`, assignment is handled by the method instead. The `customizer`
  23572. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  23573. *
  23574. * **Note:** This method mutates `object`.
  23575. *
  23576. * @static
  23577. * @memberOf _
  23578. * @since 4.0.0
  23579. * @category Object
  23580. * @param {Object} object The destination object.
  23581. * @param {...Object} sources The source objects.
  23582. * @param {Function} [customizer] The function to customize assigned values.
  23583. * @returns {Object} Returns `object`.
  23584. * @see _.assignInWith
  23585. * @example
  23586. *
  23587. * function customizer(objValue, srcValue) {
  23588. * return _.isUndefined(objValue) ? srcValue : objValue;
  23589. * }
  23590. *
  23591. * var defaults = _.partialRight(_.assignWith, customizer);
  23592. *
  23593. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  23594. * // => { 'a': 1, 'b': 2 }
  23595. */
  23596. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  23597. copyObject(source, keys(source), object, customizer);
  23598. });
  23599. /**
  23600. * Creates an array of values corresponding to `paths` of `object`.
  23601. *
  23602. * @static
  23603. * @memberOf _
  23604. * @since 1.0.0
  23605. * @category Object
  23606. * @param {Object} object The object to iterate over.
  23607. * @param {...(string|string[])} [paths] The property paths to pick.
  23608. * @returns {Array} Returns the picked values.
  23609. * @example
  23610. *
  23611. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  23612. *
  23613. * _.at(object, ['a[0].b.c', 'a[1]']);
  23614. * // => [3, 4]
  23615. */
  23616. var at = flatRest(baseAt);
  23617. /**
  23618. * Creates an object that inherits from the `prototype` object. If a
  23619. * `properties` object is given, its own enumerable string keyed properties
  23620. * are assigned to the created object.
  23621. *
  23622. * @static
  23623. * @memberOf _
  23624. * @since 2.3.0
  23625. * @category Object
  23626. * @param {Object} prototype The object to inherit from.
  23627. * @param {Object} [properties] The properties to assign to the object.
  23628. * @returns {Object} Returns the new object.
  23629. * @example
  23630. *
  23631. * function Shape() {
  23632. * this.x = 0;
  23633. * this.y = 0;
  23634. * }
  23635. *
  23636. * function Circle() {
  23637. * Shape.call(this);
  23638. * }
  23639. *
  23640. * Circle.prototype = _.create(Shape.prototype, {
  23641. * 'constructor': Circle
  23642. * });
  23643. *
  23644. * var circle = new Circle;
  23645. * circle instanceof Circle;
  23646. * // => true
  23647. *
  23648. * circle instanceof Shape;
  23649. * // => true
  23650. */
  23651. function create(prototype, properties) {
  23652. var result = baseCreate(prototype);
  23653. return properties == null ? result : baseAssign(result, properties);
  23654. }
  23655. /**
  23656. * Assigns own and inherited enumerable string keyed properties of source
  23657. * objects to the destination object for all destination properties that
  23658. * resolve to `undefined`. Source objects are applied from left to right.
  23659. * Once a property is set, additional values of the same property are ignored.
  23660. *
  23661. * **Note:** This method mutates `object`.
  23662. *
  23663. * @static
  23664. * @since 0.1.0
  23665. * @memberOf _
  23666. * @category Object
  23667. * @param {Object} object The destination object.
  23668. * @param {...Object} [sources] The source objects.
  23669. * @returns {Object} Returns `object`.
  23670. * @see _.defaultsDeep
  23671. * @example
  23672. *
  23673. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  23674. * // => { 'a': 1, 'b': 2 }
  23675. */
  23676. var defaults = baseRest(function(args) {
  23677. args.push(undefined, customDefaultsAssignIn);
  23678. return apply(assignInWith, undefined, args);
  23679. });
  23680. /**
  23681. * This method is like `_.defaults` except that it recursively assigns
  23682. * default properties.
  23683. *
  23684. * **Note:** This method mutates `object`.
  23685. *
  23686. * @static
  23687. * @memberOf _
  23688. * @since 3.10.0
  23689. * @category Object
  23690. * @param {Object} object The destination object.
  23691. * @param {...Object} [sources] The source objects.
  23692. * @returns {Object} Returns `object`.
  23693. * @see _.defaults
  23694. * @example
  23695. *
  23696. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  23697. * // => { 'a': { 'b': 2, 'c': 3 } }
  23698. */
  23699. var defaultsDeep = baseRest(function(args) {
  23700. args.push(undefined, customDefaultsMerge);
  23701. return apply(mergeWith, undefined, args);
  23702. });
  23703. /**
  23704. * This method is like `_.find` except that it returns the key of the first
  23705. * element `predicate` returns truthy for instead of the element itself.
  23706. *
  23707. * @static
  23708. * @memberOf _
  23709. * @since 1.1.0
  23710. * @category Object
  23711. * @param {Object} object The object to inspect.
  23712. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  23713. * @returns {string|undefined} Returns the key of the matched element,
  23714. * else `undefined`.
  23715. * @example
  23716. *
  23717. * var users = {
  23718. * 'barney': { 'age': 36, 'active': true },
  23719. * 'fred': { 'age': 40, 'active': false },
  23720. * 'pebbles': { 'age': 1, 'active': true }
  23721. * };
  23722. *
  23723. * _.findKey(users, function(o) { return o.age < 40; });
  23724. * // => 'barney' (iteration order is not guaranteed)
  23725. *
  23726. * // The `_.matches` iteratee shorthand.
  23727. * _.findKey(users, { 'age': 1, 'active': true });
  23728. * // => 'pebbles'
  23729. *
  23730. * // The `_.matchesProperty` iteratee shorthand.
  23731. * _.findKey(users, ['active', false]);
  23732. * // => 'fred'
  23733. *
  23734. * // The `_.property` iteratee shorthand.
  23735. * _.findKey(users, 'active');
  23736. * // => 'barney'
  23737. */
  23738. function findKey(object, predicate) {
  23739. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  23740. }
  23741. /**
  23742. * This method is like `_.findKey` except that it iterates over elements of
  23743. * a collection in the opposite order.
  23744. *
  23745. * @static
  23746. * @memberOf _
  23747. * @since 2.0.0
  23748. * @category Object
  23749. * @param {Object} object The object to inspect.
  23750. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  23751. * @returns {string|undefined} Returns the key of the matched element,
  23752. * else `undefined`.
  23753. * @example
  23754. *
  23755. * var users = {
  23756. * 'barney': { 'age': 36, 'active': true },
  23757. * 'fred': { 'age': 40, 'active': false },
  23758. * 'pebbles': { 'age': 1, 'active': true }
  23759. * };
  23760. *
  23761. * _.findLastKey(users, function(o) { return o.age < 40; });
  23762. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  23763. *
  23764. * // The `_.matches` iteratee shorthand.
  23765. * _.findLastKey(users, { 'age': 36, 'active': true });
  23766. * // => 'barney'
  23767. *
  23768. * // The `_.matchesProperty` iteratee shorthand.
  23769. * _.findLastKey(users, ['active', false]);
  23770. * // => 'fred'
  23771. *
  23772. * // The `_.property` iteratee shorthand.
  23773. * _.findLastKey(users, 'active');
  23774. * // => 'pebbles'
  23775. */
  23776. function findLastKey(object, predicate) {
  23777. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  23778. }
  23779. /**
  23780. * Iterates over own and inherited enumerable string keyed properties of an
  23781. * object and invokes `iteratee` for each property. The iteratee is invoked
  23782. * with three arguments: (value, key, object). Iteratee functions may exit
  23783. * iteration early by explicitly returning `false`.
  23784. *
  23785. * @static
  23786. * @memberOf _
  23787. * @since 0.3.0
  23788. * @category Object
  23789. * @param {Object} object The object to iterate over.
  23790. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  23791. * @returns {Object} Returns `object`.
  23792. * @see _.forInRight
  23793. * @example
  23794. *
  23795. * function Foo() {
  23796. * this.a = 1;
  23797. * this.b = 2;
  23798. * }
  23799. *
  23800. * Foo.prototype.c = 3;
  23801. *
  23802. * _.forIn(new Foo, function(value, key) {
  23803. * console.log(key);
  23804. * });
  23805. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  23806. */
  23807. function forIn(object, iteratee) {
  23808. return object == null
  23809. ? object
  23810. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  23811. }
  23812. /**
  23813. * This method is like `_.forIn` except that it iterates over properties of
  23814. * `object` in the opposite order.
  23815. *
  23816. * @static
  23817. * @memberOf _
  23818. * @since 2.0.0
  23819. * @category Object
  23820. * @param {Object} object The object to iterate over.
  23821. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  23822. * @returns {Object} Returns `object`.
  23823. * @see _.forIn
  23824. * @example
  23825. *
  23826. * function Foo() {
  23827. * this.a = 1;
  23828. * this.b = 2;
  23829. * }
  23830. *
  23831. * Foo.prototype.c = 3;
  23832. *
  23833. * _.forInRight(new Foo, function(value, key) {
  23834. * console.log(key);
  23835. * });
  23836. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  23837. */
  23838. function forInRight(object, iteratee) {
  23839. return object == null
  23840. ? object
  23841. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  23842. }
  23843. /**
  23844. * Iterates over own enumerable string keyed properties of an object and
  23845. * invokes `iteratee` for each property. The iteratee is invoked with three
  23846. * arguments: (value, key, object). Iteratee functions may exit iteration
  23847. * early by explicitly returning `false`.
  23848. *
  23849. * @static
  23850. * @memberOf _
  23851. * @since 0.3.0
  23852. * @category Object
  23853. * @param {Object} object The object to iterate over.
  23854. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  23855. * @returns {Object} Returns `object`.
  23856. * @see _.forOwnRight
  23857. * @example
  23858. *
  23859. * function Foo() {
  23860. * this.a = 1;
  23861. * this.b = 2;
  23862. * }
  23863. *
  23864. * Foo.prototype.c = 3;
  23865. *
  23866. * _.forOwn(new Foo, function(value, key) {
  23867. * console.log(key);
  23868. * });
  23869. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  23870. */
  23871. function forOwn(object, iteratee) {
  23872. return object && baseForOwn(object, getIteratee(iteratee, 3));
  23873. }
  23874. /**
  23875. * This method is like `_.forOwn` except that it iterates over properties of
  23876. * `object` in the opposite order.
  23877. *
  23878. * @static
  23879. * @memberOf _
  23880. * @since 2.0.0
  23881. * @category Object
  23882. * @param {Object} object The object to iterate over.
  23883. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  23884. * @returns {Object} Returns `object`.
  23885. * @see _.forOwn
  23886. * @example
  23887. *
  23888. * function Foo() {
  23889. * this.a = 1;
  23890. * this.b = 2;
  23891. * }
  23892. *
  23893. * Foo.prototype.c = 3;
  23894. *
  23895. * _.forOwnRight(new Foo, function(value, key) {
  23896. * console.log(key);
  23897. * });
  23898. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  23899. */
  23900. function forOwnRight(object, iteratee) {
  23901. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  23902. }
  23903. /**
  23904. * Creates an array of function property names from own enumerable properties
  23905. * of `object`.
  23906. *
  23907. * @static
  23908. * @since 0.1.0
  23909. * @memberOf _
  23910. * @category Object
  23911. * @param {Object} object The object to inspect.
  23912. * @returns {Array} Returns the function names.
  23913. * @see _.functionsIn
  23914. * @example
  23915. *
  23916. * function Foo() {
  23917. * this.a = _.constant('a');
  23918. * this.b = _.constant('b');
  23919. * }
  23920. *
  23921. * Foo.prototype.c = _.constant('c');
  23922. *
  23923. * _.functions(new Foo);
  23924. * // => ['a', 'b']
  23925. */
  23926. function functions(object) {
  23927. return object == null ? [] : baseFunctions(object, keys(object));
  23928. }
  23929. /**
  23930. * Creates an array of function property names from own and inherited
  23931. * enumerable properties of `object`.
  23932. *
  23933. * @static
  23934. * @memberOf _
  23935. * @since 4.0.0
  23936. * @category Object
  23937. * @param {Object} object The object to inspect.
  23938. * @returns {Array} Returns the function names.
  23939. * @see _.functions
  23940. * @example
  23941. *
  23942. * function Foo() {
  23943. * this.a = _.constant('a');
  23944. * this.b = _.constant('b');
  23945. * }
  23946. *
  23947. * Foo.prototype.c = _.constant('c');
  23948. *
  23949. * _.functionsIn(new Foo);
  23950. * // => ['a', 'b', 'c']
  23951. */
  23952. function functionsIn(object) {
  23953. return object == null ? [] : baseFunctions(object, keysIn(object));
  23954. }
  23955. /**
  23956. * Gets the value at `path` of `object`. If the resolved value is
  23957. * `undefined`, the `defaultValue` is returned in its place.
  23958. *
  23959. * @static
  23960. * @memberOf _
  23961. * @since 3.7.0
  23962. * @category Object
  23963. * @param {Object} object The object to query.
  23964. * @param {Array|string} path The path of the property to get.
  23965. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  23966. * @returns {*} Returns the resolved value.
  23967. * @example
  23968. *
  23969. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  23970. *
  23971. * _.get(object, 'a[0].b.c');
  23972. * // => 3
  23973. *
  23974. * _.get(object, ['a', '0', 'b', 'c']);
  23975. * // => 3
  23976. *
  23977. * _.get(object, 'a.b.c', 'default');
  23978. * // => 'default'
  23979. */
  23980. function get(object, path, defaultValue) {
  23981. var result = object == null ? undefined : baseGet(object, path);
  23982. return result === undefined ? defaultValue : result;
  23983. }
  23984. /**
  23985. * Checks if `path` is a direct property of `object`.
  23986. *
  23987. * @static
  23988. * @since 0.1.0
  23989. * @memberOf _
  23990. * @category Object
  23991. * @param {Object} object The object to query.
  23992. * @param {Array|string} path The path to check.
  23993. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23994. * @example
  23995. *
  23996. * var object = { 'a': { 'b': 2 } };
  23997. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  23998. *
  23999. * _.has(object, 'a');
  24000. * // => true
  24001. *
  24002. * _.has(object, 'a.b');
  24003. * // => true
  24004. *
  24005. * _.has(object, ['a', 'b']);
  24006. * // => true
  24007. *
  24008. * _.has(other, 'a');
  24009. * // => false
  24010. */
  24011. function has(object, path) {
  24012. return object != null && hasPath(object, path, baseHas);
  24013. }
  24014. /**
  24015. * Checks if `path` is a direct or inherited property of `object`.
  24016. *
  24017. * @static
  24018. * @memberOf _
  24019. * @since 4.0.0
  24020. * @category Object
  24021. * @param {Object} object The object to query.
  24022. * @param {Array|string} path The path to check.
  24023. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  24024. * @example
  24025. *
  24026. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  24027. *
  24028. * _.hasIn(object, 'a');
  24029. * // => true
  24030. *
  24031. * _.hasIn(object, 'a.b');
  24032. * // => true
  24033. *
  24034. * _.hasIn(object, ['a', 'b']);
  24035. * // => true
  24036. *
  24037. * _.hasIn(object, 'b');
  24038. * // => false
  24039. */
  24040. function hasIn(object, path) {
  24041. return object != null && hasPath(object, path, baseHasIn);
  24042. }
  24043. /**
  24044. * Creates an object composed of the inverted keys and values of `object`.
  24045. * If `object` contains duplicate values, subsequent values overwrite
  24046. * property assignments of previous values.
  24047. *
  24048. * @static
  24049. * @memberOf _
  24050. * @since 0.7.0
  24051. * @category Object
  24052. * @param {Object} object The object to invert.
  24053. * @returns {Object} Returns the new inverted object.
  24054. * @example
  24055. *
  24056. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  24057. *
  24058. * _.invert(object);
  24059. * // => { '1': 'c', '2': 'b' }
  24060. */
  24061. var invert = createInverter(function(result, value, key) {
  24062. result[value] = key;
  24063. }, constant(identity));
  24064. /**
  24065. * This method is like `_.invert` except that the inverted object is generated
  24066. * from the results of running each element of `object` thru `iteratee`. The
  24067. * corresponding inverted value of each inverted key is an array of keys
  24068. * responsible for generating the inverted value. The iteratee is invoked
  24069. * with one argument: (value).
  24070. *
  24071. * @static
  24072. * @memberOf _
  24073. * @since 4.1.0
  24074. * @category Object
  24075. * @param {Object} object The object to invert.
  24076. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24077. * @returns {Object} Returns the new inverted object.
  24078. * @example
  24079. *
  24080. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  24081. *
  24082. * _.invertBy(object);
  24083. * // => { '1': ['a', 'c'], '2': ['b'] }
  24084. *
  24085. * _.invertBy(object, function(value) {
  24086. * return 'group' + value;
  24087. * });
  24088. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  24089. */
  24090. var invertBy = createInverter(function(result, value, key) {
  24091. if (hasOwnProperty.call(result, value)) {
  24092. result[value].push(key);
  24093. } else {
  24094. result[value] = [key];
  24095. }
  24096. }, getIteratee);
  24097. /**
  24098. * Invokes the method at `path` of `object`.
  24099. *
  24100. * @static
  24101. * @memberOf _
  24102. * @since 4.0.0
  24103. * @category Object
  24104. * @param {Object} object The object to query.
  24105. * @param {Array|string} path The path of the method to invoke.
  24106. * @param {...*} [args] The arguments to invoke the method with.
  24107. * @returns {*} Returns the result of the invoked method.
  24108. * @example
  24109. *
  24110. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  24111. *
  24112. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  24113. * // => [2, 3]
  24114. */
  24115. var invoke = baseRest(baseInvoke);
  24116. /**
  24117. * Creates an array of the own enumerable property names of `object`.
  24118. *
  24119. * **Note:** Non-object values are coerced to objects. See the
  24120. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24121. * for more details.
  24122. *
  24123. * @static
  24124. * @since 0.1.0
  24125. * @memberOf _
  24126. * @category Object
  24127. * @param {Object} object The object to query.
  24128. * @returns {Array} Returns the array of property names.
  24129. * @example
  24130. *
  24131. * function Foo() {
  24132. * this.a = 1;
  24133. * this.b = 2;
  24134. * }
  24135. *
  24136. * Foo.prototype.c = 3;
  24137. *
  24138. * _.keys(new Foo);
  24139. * // => ['a', 'b'] (iteration order is not guaranteed)
  24140. *
  24141. * _.keys('hi');
  24142. * // => ['0', '1']
  24143. */
  24144. function keys(object) {
  24145. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  24146. }
  24147. /**
  24148. * Creates an array of the own and inherited enumerable property names of `object`.
  24149. *
  24150. * **Note:** Non-object values are coerced to objects.
  24151. *
  24152. * @static
  24153. * @memberOf _
  24154. * @since 3.0.0
  24155. * @category Object
  24156. * @param {Object} object The object to query.
  24157. * @returns {Array} Returns the array of property names.
  24158. * @example
  24159. *
  24160. * function Foo() {
  24161. * this.a = 1;
  24162. * this.b = 2;
  24163. * }
  24164. *
  24165. * Foo.prototype.c = 3;
  24166. *
  24167. * _.keysIn(new Foo);
  24168. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  24169. */
  24170. function keysIn(object) {
  24171. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  24172. }
  24173. /**
  24174. * The opposite of `_.mapValues`; this method creates an object with the
  24175. * same values as `object` and keys generated by running each own enumerable
  24176. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  24177. * with three arguments: (value, key, object).
  24178. *
  24179. * @static
  24180. * @memberOf _
  24181. * @since 3.8.0
  24182. * @category Object
  24183. * @param {Object} object The object to iterate over.
  24184. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  24185. * @returns {Object} Returns the new mapped object.
  24186. * @see _.mapValues
  24187. * @example
  24188. *
  24189. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  24190. * return key + value;
  24191. * });
  24192. * // => { 'a1': 1, 'b2': 2 }
  24193. */
  24194. function mapKeys(object, iteratee) {
  24195. var result = {};
  24196. iteratee = getIteratee(iteratee, 3);
  24197. baseForOwn(object, function(value, key, object) {
  24198. baseAssignValue(result, iteratee(value, key, object), value);
  24199. });
  24200. return result;
  24201. }
  24202. /**
  24203. * Creates an object with the same keys as `object` and values generated
  24204. * by running each own enumerable string keyed property of `object` thru
  24205. * `iteratee`. The iteratee is invoked with three arguments:
  24206. * (value, key, object).
  24207. *
  24208. * @static
  24209. * @memberOf _
  24210. * @since 2.4.0
  24211. * @category Object
  24212. * @param {Object} object The object to iterate over.
  24213. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  24214. * @returns {Object} Returns the new mapped object.
  24215. * @see _.mapKeys
  24216. * @example
  24217. *
  24218. * var users = {
  24219. * 'fred': { 'user': 'fred', 'age': 40 },
  24220. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  24221. * };
  24222. *
  24223. * _.mapValues(users, function(o) { return o.age; });
  24224. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  24225. *
  24226. * // The `_.property` iteratee shorthand.
  24227. * _.mapValues(users, 'age');
  24228. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  24229. */
  24230. function mapValues(object, iteratee) {
  24231. var result = {};
  24232. iteratee = getIteratee(iteratee, 3);
  24233. baseForOwn(object, function(value, key, object) {
  24234. baseAssignValue(result, key, iteratee(value, key, object));
  24235. });
  24236. return result;
  24237. }
  24238. /**
  24239. * This method is like `_.assign` except that it recursively merges own and
  24240. * inherited enumerable string keyed properties of source objects into the
  24241. * destination object. Source properties that resolve to `undefined` are
  24242. * skipped if a destination value exists. Array and plain object properties
  24243. * are merged recursively. Other objects and value types are overridden by
  24244. * assignment. Source objects are applied from left to right. Subsequent
  24245. * sources overwrite property assignments of previous sources.
  24246. *
  24247. * **Note:** This method mutates `object`.
  24248. *
  24249. * @static
  24250. * @memberOf _
  24251. * @since 0.5.0
  24252. * @category Object
  24253. * @param {Object} object The destination object.
  24254. * @param {...Object} [sources] The source objects.
  24255. * @returns {Object} Returns `object`.
  24256. * @example
  24257. *
  24258. * var object = {
  24259. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  24260. * };
  24261. *
  24262. * var other = {
  24263. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  24264. * };
  24265. *
  24266. * _.merge(object, other);
  24267. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  24268. */
  24269. var merge = createAssigner(function(object, source, srcIndex) {
  24270. baseMerge(object, source, srcIndex);
  24271. });
  24272. /**
  24273. * This method is like `_.merge` except that it accepts `customizer` which
  24274. * is invoked to produce the merged values of the destination and source
  24275. * properties. If `customizer` returns `undefined`, merging is handled by the
  24276. * method instead. The `customizer` is invoked with six arguments:
  24277. * (objValue, srcValue, key, object, source, stack).
  24278. *
  24279. * **Note:** This method mutates `object`.
  24280. *
  24281. * @static
  24282. * @memberOf _
  24283. * @since 4.0.0
  24284. * @category Object
  24285. * @param {Object} object The destination object.
  24286. * @param {...Object} sources The source objects.
  24287. * @param {Function} customizer The function to customize assigned values.
  24288. * @returns {Object} Returns `object`.
  24289. * @example
  24290. *
  24291. * function customizer(objValue, srcValue) {
  24292. * if (_.isArray(objValue)) {
  24293. * return objValue.concat(srcValue);
  24294. * }
  24295. * }
  24296. *
  24297. * var object = { 'a': [1], 'b': [2] };
  24298. * var other = { 'a': [3], 'b': [4] };
  24299. *
  24300. * _.mergeWith(object, other, customizer);
  24301. * // => { 'a': [1, 3], 'b': [2, 4] }
  24302. */
  24303. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  24304. baseMerge(object, source, srcIndex, customizer);
  24305. });
  24306. /**
  24307. * The opposite of `_.pick`; this method creates an object composed of the
  24308. * own and inherited enumerable property paths of `object` that are not omitted.
  24309. *
  24310. * **Note:** This method is considerably slower than `_.pick`.
  24311. *
  24312. * @static
  24313. * @since 0.1.0
  24314. * @memberOf _
  24315. * @category Object
  24316. * @param {Object} object The source object.
  24317. * @param {...(string|string[])} [paths] The property paths to omit.
  24318. * @returns {Object} Returns the new object.
  24319. * @example
  24320. *
  24321. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  24322. *
  24323. * _.omit(object, ['a', 'c']);
  24324. * // => { 'b': '2' }
  24325. */
  24326. var omit = flatRest(function(object, paths) {
  24327. var result = {};
  24328. if (object == null) {
  24329. return result;
  24330. }
  24331. var isDeep = false;
  24332. paths = arrayMap(paths, function(path) {
  24333. path = castPath(path, object);
  24334. isDeep || (isDeep = path.length > 1);
  24335. return path;
  24336. });
  24337. copyObject(object, getAllKeysIn(object), result);
  24338. if (isDeep) {
  24339. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  24340. }
  24341. var length = paths.length;
  24342. while (length--) {
  24343. baseUnset(result, paths[length]);
  24344. }
  24345. return result;
  24346. });
  24347. /**
  24348. * The opposite of `_.pickBy`; this method creates an object composed of
  24349. * the own and inherited enumerable string keyed properties of `object` that
  24350. * `predicate` doesn't return truthy for. The predicate is invoked with two
  24351. * arguments: (value, key).
  24352. *
  24353. * @static
  24354. * @memberOf _
  24355. * @since 4.0.0
  24356. * @category Object
  24357. * @param {Object} object The source object.
  24358. * @param {Function} [predicate=_.identity] The function invoked per property.
  24359. * @returns {Object} Returns the new object.
  24360. * @example
  24361. *
  24362. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  24363. *
  24364. * _.omitBy(object, _.isNumber);
  24365. * // => { 'b': '2' }
  24366. */
  24367. function omitBy(object, predicate) {
  24368. return pickBy(object, negate(getIteratee(predicate)));
  24369. }
  24370. /**
  24371. * Creates an object composed of the picked `object` properties.
  24372. *
  24373. * @static
  24374. * @since 0.1.0
  24375. * @memberOf _
  24376. * @category Object
  24377. * @param {Object} object The source object.
  24378. * @param {...(string|string[])} [paths] The property paths to pick.
  24379. * @returns {Object} Returns the new object.
  24380. * @example
  24381. *
  24382. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  24383. *
  24384. * _.pick(object, ['a', 'c']);
  24385. * // => { 'a': 1, 'c': 3 }
  24386. */
  24387. var pick = flatRest(function(object, paths) {
  24388. return object == null ? {} : basePick(object, paths);
  24389. });
  24390. /**
  24391. * Creates an object composed of the `object` properties `predicate` returns
  24392. * truthy for. The predicate is invoked with two arguments: (value, key).
  24393. *
  24394. * @static
  24395. * @memberOf _
  24396. * @since 4.0.0
  24397. * @category Object
  24398. * @param {Object} object The source object.
  24399. * @param {Function} [predicate=_.identity] The function invoked per property.
  24400. * @returns {Object} Returns the new object.
  24401. * @example
  24402. *
  24403. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  24404. *
  24405. * _.pickBy(object, _.isNumber);
  24406. * // => { 'a': 1, 'c': 3 }
  24407. */
  24408. function pickBy(object, predicate) {
  24409. if (object == null) {
  24410. return {};
  24411. }
  24412. var props = arrayMap(getAllKeysIn(object), function(prop) {
  24413. return [prop];
  24414. });
  24415. predicate = getIteratee(predicate);
  24416. return basePickBy(object, props, function(value, path) {
  24417. return predicate(value, path[0]);
  24418. });
  24419. }
  24420. /**
  24421. * This method is like `_.get` except that if the resolved value is a
  24422. * function it's invoked with the `this` binding of its parent object and
  24423. * its result is returned.
  24424. *
  24425. * @static
  24426. * @since 0.1.0
  24427. * @memberOf _
  24428. * @category Object
  24429. * @param {Object} object The object to query.
  24430. * @param {Array|string} path The path of the property to resolve.
  24431. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  24432. * @returns {*} Returns the resolved value.
  24433. * @example
  24434. *
  24435. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  24436. *
  24437. * _.result(object, 'a[0].b.c1');
  24438. * // => 3
  24439. *
  24440. * _.result(object, 'a[0].b.c2');
  24441. * // => 4
  24442. *
  24443. * _.result(object, 'a[0].b.c3', 'default');
  24444. * // => 'default'
  24445. *
  24446. * _.result(object, 'a[0].b.c3', _.constant('default'));
  24447. * // => 'default'
  24448. */
  24449. function result(object, path, defaultValue) {
  24450. path = castPath(path, object);
  24451. var index = -1,
  24452. length = path.length;
  24453. // Ensure the loop is entered when path is empty.
  24454. if (!length) {
  24455. length = 1;
  24456. object = undefined;
  24457. }
  24458. while (++index < length) {
  24459. var value = object == null ? undefined : object[toKey(path[index])];
  24460. if (value === undefined) {
  24461. index = length;
  24462. value = defaultValue;
  24463. }
  24464. object = isFunction(value) ? value.call(object) : value;
  24465. }
  24466. return object;
  24467. }
  24468. /**
  24469. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  24470. * it's created. Arrays are created for missing index properties while objects
  24471. * are created for all other missing properties. Use `_.setWith` to customize
  24472. * `path` creation.
  24473. *
  24474. * **Note:** This method mutates `object`.
  24475. *
  24476. * @static
  24477. * @memberOf _
  24478. * @since 3.7.0
  24479. * @category Object
  24480. * @param {Object} object The object to modify.
  24481. * @param {Array|string} path The path of the property to set.
  24482. * @param {*} value The value to set.
  24483. * @returns {Object} Returns `object`.
  24484. * @example
  24485. *
  24486. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  24487. *
  24488. * _.set(object, 'a[0].b.c', 4);
  24489. * console.log(object.a[0].b.c);
  24490. * // => 4
  24491. *
  24492. * _.set(object, ['x', '0', 'y', 'z'], 5);
  24493. * console.log(object.x[0].y.z);
  24494. * // => 5
  24495. */
  24496. function set(object, path, value) {
  24497. return object == null ? object : baseSet(object, path, value);
  24498. }
  24499. /**
  24500. * This method is like `_.set` except that it accepts `customizer` which is
  24501. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  24502. * path creation is handled by the method instead. The `customizer` is invoked
  24503. * with three arguments: (nsValue, key, nsObject).
  24504. *
  24505. * **Note:** This method mutates `object`.
  24506. *
  24507. * @static
  24508. * @memberOf _
  24509. * @since 4.0.0
  24510. * @category Object
  24511. * @param {Object} object The object to modify.
  24512. * @param {Array|string} path The path of the property to set.
  24513. * @param {*} value The value to set.
  24514. * @param {Function} [customizer] The function to customize assigned values.
  24515. * @returns {Object} Returns `object`.
  24516. * @example
  24517. *
  24518. * var object = {};
  24519. *
  24520. * _.setWith(object, '[0][1]', 'a', Object);
  24521. * // => { '0': { '1': 'a' } }
  24522. */
  24523. function setWith(object, path, value, customizer) {
  24524. customizer = typeof customizer == 'function' ? customizer : undefined;
  24525. return object == null ? object : baseSet(object, path, value, customizer);
  24526. }
  24527. /**
  24528. * Creates an array of own enumerable string keyed-value pairs for `object`
  24529. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  24530. * entries are returned.
  24531. *
  24532. * @static
  24533. * @memberOf _
  24534. * @since 4.0.0
  24535. * @alias entries
  24536. * @category Object
  24537. * @param {Object} object The object to query.
  24538. * @returns {Array} Returns the key-value pairs.
  24539. * @example
  24540. *
  24541. * function Foo() {
  24542. * this.a = 1;
  24543. * this.b = 2;
  24544. * }
  24545. *
  24546. * Foo.prototype.c = 3;
  24547. *
  24548. * _.toPairs(new Foo);
  24549. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  24550. */
  24551. var toPairs = createToPairs(keys);
  24552. /**
  24553. * Creates an array of own and inherited enumerable string keyed-value pairs
  24554. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  24555. * or set, its entries are returned.
  24556. *
  24557. * @static
  24558. * @memberOf _
  24559. * @since 4.0.0
  24560. * @alias entriesIn
  24561. * @category Object
  24562. * @param {Object} object The object to query.
  24563. * @returns {Array} Returns the key-value pairs.
  24564. * @example
  24565. *
  24566. * function Foo() {
  24567. * this.a = 1;
  24568. * this.b = 2;
  24569. * }
  24570. *
  24571. * Foo.prototype.c = 3;
  24572. *
  24573. * _.toPairsIn(new Foo);
  24574. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  24575. */
  24576. var toPairsIn = createToPairs(keysIn);
  24577. /**
  24578. * An alternative to `_.reduce`; this method transforms `object` to a new
  24579. * `accumulator` object which is the result of running each of its own
  24580. * enumerable string keyed properties thru `iteratee`, with each invocation
  24581. * potentially mutating the `accumulator` object. If `accumulator` is not
  24582. * provided, a new object with the same `[[Prototype]]` will be used. The
  24583. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  24584. * Iteratee functions may exit iteration early by explicitly returning `false`.
  24585. *
  24586. * @static
  24587. * @memberOf _
  24588. * @since 1.3.0
  24589. * @category Object
  24590. * @param {Object} object The object to iterate over.
  24591. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  24592. * @param {*} [accumulator] The custom accumulator value.
  24593. * @returns {*} Returns the accumulated value.
  24594. * @example
  24595. *
  24596. * _.transform([2, 3, 4], function(result, n) {
  24597. * result.push(n *= n);
  24598. * return n % 2 == 0;
  24599. * }, []);
  24600. * // => [4, 9]
  24601. *
  24602. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  24603. * (result[value] || (result[value] = [])).push(key);
  24604. * }, {});
  24605. * // => { '1': ['a', 'c'], '2': ['b'] }
  24606. */
  24607. function transform(object, iteratee, accumulator) {
  24608. var isArr = isArray(object),
  24609. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  24610. iteratee = getIteratee(iteratee, 4);
  24611. if (accumulator == null) {
  24612. var Ctor = object && object.constructor;
  24613. if (isArrLike) {
  24614. accumulator = isArr ? new Ctor : [];
  24615. }
  24616. else if (isObject(object)) {
  24617. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  24618. }
  24619. else {
  24620. accumulator = {};
  24621. }
  24622. }
  24623. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  24624. return iteratee(accumulator, value, index, object);
  24625. });
  24626. return accumulator;
  24627. }
  24628. /**
  24629. * Removes the property at `path` of `object`.
  24630. *
  24631. * **Note:** This method mutates `object`.
  24632. *
  24633. * @static
  24634. * @memberOf _
  24635. * @since 4.0.0
  24636. * @category Object
  24637. * @param {Object} object The object to modify.
  24638. * @param {Array|string} path The path of the property to unset.
  24639. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  24640. * @example
  24641. *
  24642. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  24643. * _.unset(object, 'a[0].b.c');
  24644. * // => true
  24645. *
  24646. * console.log(object);
  24647. * // => { 'a': [{ 'b': {} }] };
  24648. *
  24649. * _.unset(object, ['a', '0', 'b', 'c']);
  24650. * // => true
  24651. *
  24652. * console.log(object);
  24653. * // => { 'a': [{ 'b': {} }] };
  24654. */
  24655. function unset(object, path) {
  24656. return object == null ? true : baseUnset(object, path);
  24657. }
  24658. /**
  24659. * This method is like `_.set` except that accepts `updater` to produce the
  24660. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  24661. * is invoked with one argument: (value).
  24662. *
  24663. * **Note:** This method mutates `object`.
  24664. *
  24665. * @static
  24666. * @memberOf _
  24667. * @since 4.6.0
  24668. * @category Object
  24669. * @param {Object} object The object to modify.
  24670. * @param {Array|string} path The path of the property to set.
  24671. * @param {Function} updater The function to produce the updated value.
  24672. * @returns {Object} Returns `object`.
  24673. * @example
  24674. *
  24675. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  24676. *
  24677. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  24678. * console.log(object.a[0].b.c);
  24679. * // => 9
  24680. *
  24681. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  24682. * console.log(object.x[0].y.z);
  24683. * // => 0
  24684. */
  24685. function update(object, path, updater) {
  24686. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  24687. }
  24688. /**
  24689. * This method is like `_.update` except that it accepts `customizer` which is
  24690. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  24691. * path creation is handled by the method instead. The `customizer` is invoked
  24692. * with three arguments: (nsValue, key, nsObject).
  24693. *
  24694. * **Note:** This method mutates `object`.
  24695. *
  24696. * @static
  24697. * @memberOf _
  24698. * @since 4.6.0
  24699. * @category Object
  24700. * @param {Object} object The object to modify.
  24701. * @param {Array|string} path The path of the property to set.
  24702. * @param {Function} updater The function to produce the updated value.
  24703. * @param {Function} [customizer] The function to customize assigned values.
  24704. * @returns {Object} Returns `object`.
  24705. * @example
  24706. *
  24707. * var object = {};
  24708. *
  24709. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  24710. * // => { '0': { '1': 'a' } }
  24711. */
  24712. function updateWith(object, path, updater, customizer) {
  24713. customizer = typeof customizer == 'function' ? customizer : undefined;
  24714. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  24715. }
  24716. /**
  24717. * Creates an array of the own enumerable string keyed property values of `object`.
  24718. *
  24719. * **Note:** Non-object values are coerced to objects.
  24720. *
  24721. * @static
  24722. * @since 0.1.0
  24723. * @memberOf _
  24724. * @category Object
  24725. * @param {Object} object The object to query.
  24726. * @returns {Array} Returns the array of property values.
  24727. * @example
  24728. *
  24729. * function Foo() {
  24730. * this.a = 1;
  24731. * this.b = 2;
  24732. * }
  24733. *
  24734. * Foo.prototype.c = 3;
  24735. *
  24736. * _.values(new Foo);
  24737. * // => [1, 2] (iteration order is not guaranteed)
  24738. *
  24739. * _.values('hi');
  24740. * // => ['h', 'i']
  24741. */
  24742. function values(object) {
  24743. return object == null ? [] : baseValues(object, keys(object));
  24744. }
  24745. /**
  24746. * Creates an array of the own and inherited enumerable string keyed property
  24747. * values of `object`.
  24748. *
  24749. * **Note:** Non-object values are coerced to objects.
  24750. *
  24751. * @static
  24752. * @memberOf _
  24753. * @since 3.0.0
  24754. * @category Object
  24755. * @param {Object} object The object to query.
  24756. * @returns {Array} Returns the array of property values.
  24757. * @example
  24758. *
  24759. * function Foo() {
  24760. * this.a = 1;
  24761. * this.b = 2;
  24762. * }
  24763. *
  24764. * Foo.prototype.c = 3;
  24765. *
  24766. * _.valuesIn(new Foo);
  24767. * // => [1, 2, 3] (iteration order is not guaranteed)
  24768. */
  24769. function valuesIn(object) {
  24770. return object == null ? [] : baseValues(object, keysIn(object));
  24771. }
  24772. /*------------------------------------------------------------------------*/
  24773. /**
  24774. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  24775. *
  24776. * @static
  24777. * @memberOf _
  24778. * @since 4.0.0
  24779. * @category Number
  24780. * @param {number} number The number to clamp.
  24781. * @param {number} [lower] The lower bound.
  24782. * @param {number} upper The upper bound.
  24783. * @returns {number} Returns the clamped number.
  24784. * @example
  24785. *
  24786. * _.clamp(-10, -5, 5);
  24787. * // => -5
  24788. *
  24789. * _.clamp(10, -5, 5);
  24790. * // => 5
  24791. */
  24792. function clamp(number, lower, upper) {
  24793. if (upper === undefined) {
  24794. upper = lower;
  24795. lower = undefined;
  24796. }
  24797. if (upper !== undefined) {
  24798. upper = toNumber(upper);
  24799. upper = upper === upper ? upper : 0;
  24800. }
  24801. if (lower !== undefined) {
  24802. lower = toNumber(lower);
  24803. lower = lower === lower ? lower : 0;
  24804. }
  24805. return baseClamp(toNumber(number), lower, upper);
  24806. }
  24807. /**
  24808. * Checks if `n` is between `start` and up to, but not including, `end`. If
  24809. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  24810. * If `start` is greater than `end` the params are swapped to support
  24811. * negative ranges.
  24812. *
  24813. * @static
  24814. * @memberOf _
  24815. * @since 3.3.0
  24816. * @category Number
  24817. * @param {number} number The number to check.
  24818. * @param {number} [start=0] The start of the range.
  24819. * @param {number} end The end of the range.
  24820. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  24821. * @see _.range, _.rangeRight
  24822. * @example
  24823. *
  24824. * _.inRange(3, 2, 4);
  24825. * // => true
  24826. *
  24827. * _.inRange(4, 8);
  24828. * // => true
  24829. *
  24830. * _.inRange(4, 2);
  24831. * // => false
  24832. *
  24833. * _.inRange(2, 2);
  24834. * // => false
  24835. *
  24836. * _.inRange(1.2, 2);
  24837. * // => true
  24838. *
  24839. * _.inRange(5.2, 4);
  24840. * // => false
  24841. *
  24842. * _.inRange(-3, -2, -6);
  24843. * // => true
  24844. */
  24845. function inRange(number, start, end) {
  24846. start = toFinite(start);
  24847. if (end === undefined) {
  24848. end = start;
  24849. start = 0;
  24850. } else {
  24851. end = toFinite(end);
  24852. }
  24853. number = toNumber(number);
  24854. return baseInRange(number, start, end);
  24855. }
  24856. /**
  24857. * Produces a random number between the inclusive `lower` and `upper` bounds.
  24858. * If only one argument is provided a number between `0` and the given number
  24859. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  24860. * floats, a floating-point number is returned instead of an integer.
  24861. *
  24862. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  24863. * floating-point values which can produce unexpected results.
  24864. *
  24865. * @static
  24866. * @memberOf _
  24867. * @since 0.7.0
  24868. * @category Number
  24869. * @param {number} [lower=0] The lower bound.
  24870. * @param {number} [upper=1] The upper bound.
  24871. * @param {boolean} [floating] Specify returning a floating-point number.
  24872. * @returns {number} Returns the random number.
  24873. * @example
  24874. *
  24875. * _.random(0, 5);
  24876. * // => an integer between 0 and 5
  24877. *
  24878. * _.random(5);
  24879. * // => also an integer between 0 and 5
  24880. *
  24881. * _.random(5, true);
  24882. * // => a floating-point number between 0 and 5
  24883. *
  24884. * _.random(1.2, 5.2);
  24885. * // => a floating-point number between 1.2 and 5.2
  24886. */
  24887. function random(lower, upper, floating) {
  24888. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  24889. upper = floating = undefined;
  24890. }
  24891. if (floating === undefined) {
  24892. if (typeof upper == 'boolean') {
  24893. floating = upper;
  24894. upper = undefined;
  24895. }
  24896. else if (typeof lower == 'boolean') {
  24897. floating = lower;
  24898. lower = undefined;
  24899. }
  24900. }
  24901. if (lower === undefined && upper === undefined) {
  24902. lower = 0;
  24903. upper = 1;
  24904. }
  24905. else {
  24906. lower = toFinite(lower);
  24907. if (upper === undefined) {
  24908. upper = lower;
  24909. lower = 0;
  24910. } else {
  24911. upper = toFinite(upper);
  24912. }
  24913. }
  24914. if (lower > upper) {
  24915. var temp = lower;
  24916. lower = upper;
  24917. upper = temp;
  24918. }
  24919. if (floating || lower % 1 || upper % 1) {
  24920. var rand = nativeRandom();
  24921. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  24922. }
  24923. return baseRandom(lower, upper);
  24924. }
  24925. /*------------------------------------------------------------------------*/
  24926. /**
  24927. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  24928. *
  24929. * @static
  24930. * @memberOf _
  24931. * @since 3.0.0
  24932. * @category String
  24933. * @param {string} [string=''] The string to convert.
  24934. * @returns {string} Returns the camel cased string.
  24935. * @example
  24936. *
  24937. * _.camelCase('Foo Bar');
  24938. * // => 'fooBar'
  24939. *
  24940. * _.camelCase('--foo-bar--');
  24941. * // => 'fooBar'
  24942. *
  24943. * _.camelCase('__FOO_BAR__');
  24944. * // => 'fooBar'
  24945. */
  24946. var camelCase = createCompounder(function(result, word, index) {
  24947. word = word.toLowerCase();
  24948. return result + (index ? capitalize(word) : word);
  24949. });
  24950. /**
  24951. * Converts the first character of `string` to upper case and the remaining
  24952. * to lower case.
  24953. *
  24954. * @static
  24955. * @memberOf _
  24956. * @since 3.0.0
  24957. * @category String
  24958. * @param {string} [string=''] The string to capitalize.
  24959. * @returns {string} Returns the capitalized string.
  24960. * @example
  24961. *
  24962. * _.capitalize('FRED');
  24963. * // => 'Fred'
  24964. */
  24965. function capitalize(string) {
  24966. return upperFirst(toString(string).toLowerCase());
  24967. }
  24968. /**
  24969. * Deburrs `string` by converting
  24970. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  24971. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  24972. * letters to basic Latin letters and removing
  24973. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  24974. *
  24975. * @static
  24976. * @memberOf _
  24977. * @since 3.0.0
  24978. * @category String
  24979. * @param {string} [string=''] The string to deburr.
  24980. * @returns {string} Returns the deburred string.
  24981. * @example
  24982. *
  24983. * _.deburr('déjà vu');
  24984. * // => 'deja vu'
  24985. */
  24986. function deburr(string) {
  24987. string = toString(string);
  24988. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  24989. }
  24990. /**
  24991. * Checks if `string` ends with the given target string.
  24992. *
  24993. * @static
  24994. * @memberOf _
  24995. * @since 3.0.0
  24996. * @category String
  24997. * @param {string} [string=''] The string to inspect.
  24998. * @param {string} [target] The string to search for.
  24999. * @param {number} [position=string.length] The position to search up to.
  25000. * @returns {boolean} Returns `true` if `string` ends with `target`,
  25001. * else `false`.
  25002. * @example
  25003. *
  25004. * _.endsWith('abc', 'c');
  25005. * // => true
  25006. *
  25007. * _.endsWith('abc', 'b');
  25008. * // => false
  25009. *
  25010. * _.endsWith('abc', 'b', 2);
  25011. * // => true
  25012. */
  25013. function endsWith(string, target, position) {
  25014. string = toString(string);
  25015. target = baseToString(target);
  25016. var length = string.length;
  25017. position = position === undefined
  25018. ? length
  25019. : baseClamp(toInteger(position), 0, length);
  25020. var end = position;
  25021. position -= target.length;
  25022. return position >= 0 && string.slice(position, end) == target;
  25023. }
  25024. /**
  25025. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  25026. * corresponding HTML entities.
  25027. *
  25028. * **Note:** No other characters are escaped. To escape additional
  25029. * characters use a third-party library like [_he_](https://mths.be/he).
  25030. *
  25031. * Though the ">" character is escaped for symmetry, characters like
  25032. * ">" and "/" don't need escaping in HTML and have no special meaning
  25033. * unless they're part of a tag or unquoted attribute value. See
  25034. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  25035. * (under "semi-related fun fact") for more details.
  25036. *
  25037. * When working with HTML you should always
  25038. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  25039. * XSS vectors.
  25040. *
  25041. * @static
  25042. * @since 0.1.0
  25043. * @memberOf _
  25044. * @category String
  25045. * @param {string} [string=''] The string to escape.
  25046. * @returns {string} Returns the escaped string.
  25047. * @example
  25048. *
  25049. * _.escape('fred, barney, & pebbles');
  25050. * // => 'fred, barney, &amp; pebbles'
  25051. */
  25052. function escape(string) {
  25053. string = toString(string);
  25054. return (string && reHasUnescapedHtml.test(string))
  25055. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  25056. : string;
  25057. }
  25058. /**
  25059. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  25060. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  25061. *
  25062. * @static
  25063. * @memberOf _
  25064. * @since 3.0.0
  25065. * @category String
  25066. * @param {string} [string=''] The string to escape.
  25067. * @returns {string} Returns the escaped string.
  25068. * @example
  25069. *
  25070. * _.escapeRegExp('[lodash](https://lodash.com/)');
  25071. * // => '\[lodash\]\(https://lodash\.com/\)'
  25072. */
  25073. function escapeRegExp(string) {
  25074. string = toString(string);
  25075. return (string && reHasRegExpChar.test(string))
  25076. ? string.replace(reRegExpChar, '\\$&')
  25077. : string;
  25078. }
  25079. /**
  25080. * Converts `string` to
  25081. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  25082. *
  25083. * @static
  25084. * @memberOf _
  25085. * @since 3.0.0
  25086. * @category String
  25087. * @param {string} [string=''] The string to convert.
  25088. * @returns {string} Returns the kebab cased string.
  25089. * @example
  25090. *
  25091. * _.kebabCase('Foo Bar');
  25092. * // => 'foo-bar'
  25093. *
  25094. * _.kebabCase('fooBar');
  25095. * // => 'foo-bar'
  25096. *
  25097. * _.kebabCase('__FOO_BAR__');
  25098. * // => 'foo-bar'
  25099. */
  25100. var kebabCase = createCompounder(function(result, word, index) {
  25101. return result + (index ? '-' : '') + word.toLowerCase();
  25102. });
  25103. /**
  25104. * Converts `string`, as space separated words, to lower case.
  25105. *
  25106. * @static
  25107. * @memberOf _
  25108. * @since 4.0.0
  25109. * @category String
  25110. * @param {string} [string=''] The string to convert.
  25111. * @returns {string} Returns the lower cased string.
  25112. * @example
  25113. *
  25114. * _.lowerCase('--Foo-Bar--');
  25115. * // => 'foo bar'
  25116. *
  25117. * _.lowerCase('fooBar');
  25118. * // => 'foo bar'
  25119. *
  25120. * _.lowerCase('__FOO_BAR__');
  25121. * // => 'foo bar'
  25122. */
  25123. var lowerCase = createCompounder(function(result, word, index) {
  25124. return result + (index ? ' ' : '') + word.toLowerCase();
  25125. });
  25126. /**
  25127. * Converts the first character of `string` to lower case.
  25128. *
  25129. * @static
  25130. * @memberOf _
  25131. * @since 4.0.0
  25132. * @category String
  25133. * @param {string} [string=''] The string to convert.
  25134. * @returns {string} Returns the converted string.
  25135. * @example
  25136. *
  25137. * _.lowerFirst('Fred');
  25138. * // => 'fred'
  25139. *
  25140. * _.lowerFirst('FRED');
  25141. * // => 'fRED'
  25142. */
  25143. var lowerFirst = createCaseFirst('toLowerCase');
  25144. /**
  25145. * Pads `string` on the left and right sides if it's shorter than `length`.
  25146. * Padding characters are truncated if they can't be evenly divided by `length`.
  25147. *
  25148. * @static
  25149. * @memberOf _
  25150. * @since 3.0.0
  25151. * @category String
  25152. * @param {string} [string=''] The string to pad.
  25153. * @param {number} [length=0] The padding length.
  25154. * @param {string} [chars=' '] The string used as padding.
  25155. * @returns {string} Returns the padded string.
  25156. * @example
  25157. *
  25158. * _.pad('abc', 8);
  25159. * // => ' abc '
  25160. *
  25161. * _.pad('abc', 8, '_-');
  25162. * // => '_-abc_-_'
  25163. *
  25164. * _.pad('abc', 3);
  25165. * // => 'abc'
  25166. */
  25167. function pad(string, length, chars) {
  25168. string = toString(string);
  25169. length = toInteger(length);
  25170. var strLength = length ? stringSize(string) : 0;
  25171. if (!length || strLength >= length) {
  25172. return string;
  25173. }
  25174. var mid = (length - strLength) / 2;
  25175. return (
  25176. createPadding(nativeFloor(mid), chars) +
  25177. string +
  25178. createPadding(nativeCeil(mid), chars)
  25179. );
  25180. }
  25181. /**
  25182. * Pads `string` on the right side if it's shorter than `length`. Padding
  25183. * characters are truncated if they exceed `length`.
  25184. *
  25185. * @static
  25186. * @memberOf _
  25187. * @since 4.0.0
  25188. * @category String
  25189. * @param {string} [string=''] The string to pad.
  25190. * @param {number} [length=0] The padding length.
  25191. * @param {string} [chars=' '] The string used as padding.
  25192. * @returns {string} Returns the padded string.
  25193. * @example
  25194. *
  25195. * _.padEnd('abc', 6);
  25196. * // => 'abc '
  25197. *
  25198. * _.padEnd('abc', 6, '_-');
  25199. * // => 'abc_-_'
  25200. *
  25201. * _.padEnd('abc', 3);
  25202. * // => 'abc'
  25203. */
  25204. function padEnd(string, length, chars) {
  25205. string = toString(string);
  25206. length = toInteger(length);
  25207. var strLength = length ? stringSize(string) : 0;
  25208. return (length && strLength < length)
  25209. ? (string + createPadding(length - strLength, chars))
  25210. : string;
  25211. }
  25212. /**
  25213. * Pads `string` on the left side if it's shorter than `length`. Padding
  25214. * characters are truncated if they exceed `length`.
  25215. *
  25216. * @static
  25217. * @memberOf _
  25218. * @since 4.0.0
  25219. * @category String
  25220. * @param {string} [string=''] The string to pad.
  25221. * @param {number} [length=0] The padding length.
  25222. * @param {string} [chars=' '] The string used as padding.
  25223. * @returns {string} Returns the padded string.
  25224. * @example
  25225. *
  25226. * _.padStart('abc', 6);
  25227. * // => ' abc'
  25228. *
  25229. * _.padStart('abc', 6, '_-');
  25230. * // => '_-_abc'
  25231. *
  25232. * _.padStart('abc', 3);
  25233. * // => 'abc'
  25234. */
  25235. function padStart(string, length, chars) {
  25236. string = toString(string);
  25237. length = toInteger(length);
  25238. var strLength = length ? stringSize(string) : 0;
  25239. return (length && strLength < length)
  25240. ? (createPadding(length - strLength, chars) + string)
  25241. : string;
  25242. }
  25243. /**
  25244. * Converts `string` to an integer of the specified radix. If `radix` is
  25245. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  25246. * hexadecimal, in which case a `radix` of `16` is used.
  25247. *
  25248. * **Note:** This method aligns with the
  25249. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  25250. *
  25251. * @static
  25252. * @memberOf _
  25253. * @since 1.1.0
  25254. * @category String
  25255. * @param {string} string The string to convert.
  25256. * @param {number} [radix=10] The radix to interpret `value` by.
  25257. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25258. * @returns {number} Returns the converted integer.
  25259. * @example
  25260. *
  25261. * _.parseInt('08');
  25262. * // => 8
  25263. *
  25264. * _.map(['6', '08', '10'], _.parseInt);
  25265. * // => [6, 8, 10]
  25266. */
  25267. function parseInt(string, radix, guard) {
  25268. if (guard || radix == null) {
  25269. radix = 0;
  25270. } else if (radix) {
  25271. radix = +radix;
  25272. }
  25273. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  25274. }
  25275. /**
  25276. * Repeats the given string `n` times.
  25277. *
  25278. * @static
  25279. * @memberOf _
  25280. * @since 3.0.0
  25281. * @category String
  25282. * @param {string} [string=''] The string to repeat.
  25283. * @param {number} [n=1] The number of times to repeat the string.
  25284. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25285. * @returns {string} Returns the repeated string.
  25286. * @example
  25287. *
  25288. * _.repeat('*', 3);
  25289. * // => '***'
  25290. *
  25291. * _.repeat('abc', 2);
  25292. * // => 'abcabc'
  25293. *
  25294. * _.repeat('abc', 0);
  25295. * // => ''
  25296. */
  25297. function repeat(string, n, guard) {
  25298. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  25299. n = 1;
  25300. } else {
  25301. n = toInteger(n);
  25302. }
  25303. return baseRepeat(toString(string), n);
  25304. }
  25305. /**
  25306. * Replaces matches for `pattern` in `string` with `replacement`.
  25307. *
  25308. * **Note:** This method is based on
  25309. * [`String#replace`](https://mdn.io/String/replace).
  25310. *
  25311. * @static
  25312. * @memberOf _
  25313. * @since 4.0.0
  25314. * @category String
  25315. * @param {string} [string=''] The string to modify.
  25316. * @param {RegExp|string} pattern The pattern to replace.
  25317. * @param {Function|string} replacement The match replacement.
  25318. * @returns {string} Returns the modified string.
  25319. * @example
  25320. *
  25321. * _.replace('Hi Fred', 'Fred', 'Barney');
  25322. * // => 'Hi Barney'
  25323. */
  25324. function replace() {
  25325. var args = arguments,
  25326. string = toString(args[0]);
  25327. return args.length < 3 ? string : string.replace(args[1], args[2]);
  25328. }
  25329. /**
  25330. * Converts `string` to
  25331. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  25332. *
  25333. * @static
  25334. * @memberOf _
  25335. * @since 3.0.0
  25336. * @category String
  25337. * @param {string} [string=''] The string to convert.
  25338. * @returns {string} Returns the snake cased string.
  25339. * @example
  25340. *
  25341. * _.snakeCase('Foo Bar');
  25342. * // => 'foo_bar'
  25343. *
  25344. * _.snakeCase('fooBar');
  25345. * // => 'foo_bar'
  25346. *
  25347. * _.snakeCase('--FOO-BAR--');
  25348. * // => 'foo_bar'
  25349. */
  25350. var snakeCase = createCompounder(function(result, word, index) {
  25351. return result + (index ? '_' : '') + word.toLowerCase();
  25352. });
  25353. /**
  25354. * Splits `string` by `separator`.
  25355. *
  25356. * **Note:** This method is based on
  25357. * [`String#split`](https://mdn.io/String/split).
  25358. *
  25359. * @static
  25360. * @memberOf _
  25361. * @since 4.0.0
  25362. * @category String
  25363. * @param {string} [string=''] The string to split.
  25364. * @param {RegExp|string} separator The separator pattern to split by.
  25365. * @param {number} [limit] The length to truncate results to.
  25366. * @returns {Array} Returns the string segments.
  25367. * @example
  25368. *
  25369. * _.split('a-b-c', '-', 2);
  25370. * // => ['a', 'b']
  25371. */
  25372. function split(string, separator, limit) {
  25373. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  25374. separator = limit = undefined;
  25375. }
  25376. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  25377. if (!limit) {
  25378. return [];
  25379. }
  25380. string = toString(string);
  25381. if (string && (
  25382. typeof separator == 'string' ||
  25383. (separator != null && !isRegExp(separator))
  25384. )) {
  25385. separator = baseToString(separator);
  25386. if (!separator && hasUnicode(string)) {
  25387. return castSlice(stringToArray(string), 0, limit);
  25388. }
  25389. }
  25390. return string.split(separator, limit);
  25391. }
  25392. /**
  25393. * Converts `string` to
  25394. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  25395. *
  25396. * @static
  25397. * @memberOf _
  25398. * @since 3.1.0
  25399. * @category String
  25400. * @param {string} [string=''] The string to convert.
  25401. * @returns {string} Returns the start cased string.
  25402. * @example
  25403. *
  25404. * _.startCase('--foo-bar--');
  25405. * // => 'Foo Bar'
  25406. *
  25407. * _.startCase('fooBar');
  25408. * // => 'Foo Bar'
  25409. *
  25410. * _.startCase('__FOO_BAR__');
  25411. * // => 'FOO BAR'
  25412. */
  25413. var startCase = createCompounder(function(result, word, index) {
  25414. return result + (index ? ' ' : '') + upperFirst(word);
  25415. });
  25416. /**
  25417. * Checks if `string` starts with the given target string.
  25418. *
  25419. * @static
  25420. * @memberOf _
  25421. * @since 3.0.0
  25422. * @category String
  25423. * @param {string} [string=''] The string to inspect.
  25424. * @param {string} [target] The string to search for.
  25425. * @param {number} [position=0] The position to search from.
  25426. * @returns {boolean} Returns `true` if `string` starts with `target`,
  25427. * else `false`.
  25428. * @example
  25429. *
  25430. * _.startsWith('abc', 'a');
  25431. * // => true
  25432. *
  25433. * _.startsWith('abc', 'b');
  25434. * // => false
  25435. *
  25436. * _.startsWith('abc', 'b', 1);
  25437. * // => true
  25438. */
  25439. function startsWith(string, target, position) {
  25440. string = toString(string);
  25441. position = position == null
  25442. ? 0
  25443. : baseClamp(toInteger(position), 0, string.length);
  25444. target = baseToString(target);
  25445. return string.slice(position, position + target.length) == target;
  25446. }
  25447. /**
  25448. * Creates a compiled template function that can interpolate data properties
  25449. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  25450. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  25451. * properties may be accessed as free variables in the template. If a setting
  25452. * object is given, it takes precedence over `_.templateSettings` values.
  25453. *
  25454. * **Note:** In the development build `_.template` utilizes
  25455. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  25456. * for easier debugging.
  25457. *
  25458. * For more information on precompiling templates see
  25459. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  25460. *
  25461. * For more information on Chrome extension sandboxes see
  25462. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  25463. *
  25464. * @static
  25465. * @since 0.1.0
  25466. * @memberOf _
  25467. * @category String
  25468. * @param {string} [string=''] The template string.
  25469. * @param {Object} [options={}] The options object.
  25470. * @param {RegExp} [options.escape=_.templateSettings.escape]
  25471. * The HTML "escape" delimiter.
  25472. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  25473. * The "evaluate" delimiter.
  25474. * @param {Object} [options.imports=_.templateSettings.imports]
  25475. * An object to import into the template as free variables.
  25476. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  25477. * The "interpolate" delimiter.
  25478. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  25479. * The sourceURL of the compiled template.
  25480. * @param {string} [options.variable='obj']
  25481. * The data object variable name.
  25482. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25483. * @returns {Function} Returns the compiled template function.
  25484. * @example
  25485. *
  25486. * // Use the "interpolate" delimiter to create a compiled template.
  25487. * var compiled = _.template('hello <%= user %>!');
  25488. * compiled({ 'user': 'fred' });
  25489. * // => 'hello fred!'
  25490. *
  25491. * // Use the HTML "escape" delimiter to escape data property values.
  25492. * var compiled = _.template('<b><%- value %></b>');
  25493. * compiled({ 'value': '<script>' });
  25494. * // => '<b>&lt;script&gt;</b>'
  25495. *
  25496. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  25497. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  25498. * compiled({ 'users': ['fred', 'barney'] });
  25499. * // => '<li>fred</li><li>barney</li>'
  25500. *
  25501. * // Use the internal `print` function in "evaluate" delimiters.
  25502. * var compiled = _.template('<% print("hello " + user); %>!');
  25503. * compiled({ 'user': 'barney' });
  25504. * // => 'hello barney!'
  25505. *
  25506. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  25507. * // Disable support by replacing the "interpolate" delimiter.
  25508. * var compiled = _.template('hello ${ user }!');
  25509. * compiled({ 'user': 'pebbles' });
  25510. * // => 'hello pebbles!'
  25511. *
  25512. * // Use backslashes to treat delimiters as plain text.
  25513. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  25514. * compiled({ 'value': 'ignored' });
  25515. * // => '<%- value %>'
  25516. *
  25517. * // Use the `imports` option to import `jQuery` as `jq`.
  25518. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  25519. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  25520. * compiled({ 'users': ['fred', 'barney'] });
  25521. * // => '<li>fred</li><li>barney</li>'
  25522. *
  25523. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  25524. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  25525. * compiled(data);
  25526. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  25527. *
  25528. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  25529. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  25530. * compiled.source;
  25531. * // => function(data) {
  25532. * // var __t, __p = '';
  25533. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  25534. * // return __p;
  25535. * // }
  25536. *
  25537. * // Use custom template delimiters.
  25538. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  25539. * var compiled = _.template('hello {{ user }}!');
  25540. * compiled({ 'user': 'mustache' });
  25541. * // => 'hello mustache!'
  25542. *
  25543. * // Use the `source` property to inline compiled templates for meaningful
  25544. * // line numbers in error messages and stack traces.
  25545. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  25546. * var JST = {\
  25547. * "main": ' + _.template(mainText).source + '\
  25548. * };\
  25549. * ');
  25550. */
  25551. function template(string, options, guard) {
  25552. // Based on John Resig's `tmpl` implementation
  25553. // (http://ejohn.org/blog/javascript-micro-templating/)
  25554. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  25555. var settings = lodash.templateSettings;
  25556. if (guard && isIterateeCall(string, options, guard)) {
  25557. options = undefined;
  25558. }
  25559. string = toString(string);
  25560. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  25561. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  25562. importsKeys = keys(imports),
  25563. importsValues = baseValues(imports, importsKeys);
  25564. var isEscaping,
  25565. isEvaluating,
  25566. index = 0,
  25567. interpolate = options.interpolate || reNoMatch,
  25568. source = "__p += '";
  25569. // Compile the regexp to match each delimiter.
  25570. var reDelimiters = RegExp(
  25571. (options.escape || reNoMatch).source + '|' +
  25572. interpolate.source + '|' +
  25573. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  25574. (options.evaluate || reNoMatch).source + '|$'
  25575. , 'g');
  25576. // Use a sourceURL for easier debugging.
  25577. var sourceURL = '//# sourceURL=' +
  25578. ('sourceURL' in options
  25579. ? options.sourceURL
  25580. : ('lodash.templateSources[' + (++templateCounter) + ']')
  25581. ) + '\n';
  25582. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  25583. interpolateValue || (interpolateValue = esTemplateValue);
  25584. // Escape characters that can't be included in string literals.
  25585. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  25586. // Replace delimiters with snippets.
  25587. if (escapeValue) {
  25588. isEscaping = true;
  25589. source += "' +\n__e(" + escapeValue + ") +\n'";
  25590. }
  25591. if (evaluateValue) {
  25592. isEvaluating = true;
  25593. source += "';\n" + evaluateValue + ";\n__p += '";
  25594. }
  25595. if (interpolateValue) {
  25596. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  25597. }
  25598. index = offset + match.length;
  25599. // The JS engine embedded in Adobe products needs `match` returned in
  25600. // order to produce the correct `offset` value.
  25601. return match;
  25602. });
  25603. source += "';\n";
  25604. // If `variable` is not specified wrap a with-statement around the generated
  25605. // code to add the data object to the top of the scope chain.
  25606. var variable = options.variable;
  25607. if (!variable) {
  25608. source = 'with (obj) {\n' + source + '\n}\n';
  25609. }
  25610. // Cleanup code by stripping empty strings.
  25611. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  25612. .replace(reEmptyStringMiddle, '$1')
  25613. .replace(reEmptyStringTrailing, '$1;');
  25614. // Frame code as the function body.
  25615. source = 'function(' + (variable || 'obj') + ') {\n' +
  25616. (variable
  25617. ? ''
  25618. : 'obj || (obj = {});\n'
  25619. ) +
  25620. "var __t, __p = ''" +
  25621. (isEscaping
  25622. ? ', __e = _.escape'
  25623. : ''
  25624. ) +
  25625. (isEvaluating
  25626. ? ', __j = Array.prototype.join;\n' +
  25627. "function print() { __p += __j.call(arguments, '') }\n"
  25628. : ';\n'
  25629. ) +
  25630. source +
  25631. 'return __p\n}';
  25632. var result = attempt(function() {
  25633. return Function(importsKeys, sourceURL + 'return ' + source)
  25634. .apply(undefined, importsValues);
  25635. });
  25636. // Provide the compiled function's source by its `toString` method or
  25637. // the `source` property as a convenience for inlining compiled templates.
  25638. result.source = source;
  25639. if (isError(result)) {
  25640. throw result;
  25641. }
  25642. return result;
  25643. }
  25644. /**
  25645. * Converts `string`, as a whole, to lower case just like
  25646. * [String#toLowerCase](https://mdn.io/toLowerCase).
  25647. *
  25648. * @static
  25649. * @memberOf _
  25650. * @since 4.0.0
  25651. * @category String
  25652. * @param {string} [string=''] The string to convert.
  25653. * @returns {string} Returns the lower cased string.
  25654. * @example
  25655. *
  25656. * _.toLower('--Foo-Bar--');
  25657. * // => '--foo-bar--'
  25658. *
  25659. * _.toLower('fooBar');
  25660. * // => 'foobar'
  25661. *
  25662. * _.toLower('__FOO_BAR__');
  25663. * // => '__foo_bar__'
  25664. */
  25665. function toLower(value) {
  25666. return toString(value).toLowerCase();
  25667. }
  25668. /**
  25669. * Converts `string`, as a whole, to upper case just like
  25670. * [String#toUpperCase](https://mdn.io/toUpperCase).
  25671. *
  25672. * @static
  25673. * @memberOf _
  25674. * @since 4.0.0
  25675. * @category String
  25676. * @param {string} [string=''] The string to convert.
  25677. * @returns {string} Returns the upper cased string.
  25678. * @example
  25679. *
  25680. * _.toUpper('--foo-bar--');
  25681. * // => '--FOO-BAR--'
  25682. *
  25683. * _.toUpper('fooBar');
  25684. * // => 'FOOBAR'
  25685. *
  25686. * _.toUpper('__foo_bar__');
  25687. * // => '__FOO_BAR__'
  25688. */
  25689. function toUpper(value) {
  25690. return toString(value).toUpperCase();
  25691. }
  25692. /**
  25693. * Removes leading and trailing whitespace or specified characters from `string`.
  25694. *
  25695. * @static
  25696. * @memberOf _
  25697. * @since 3.0.0
  25698. * @category String
  25699. * @param {string} [string=''] The string to trim.
  25700. * @param {string} [chars=whitespace] The characters to trim.
  25701. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25702. * @returns {string} Returns the trimmed string.
  25703. * @example
  25704. *
  25705. * _.trim(' abc ');
  25706. * // => 'abc'
  25707. *
  25708. * _.trim('-_-abc-_-', '_-');
  25709. * // => 'abc'
  25710. *
  25711. * _.map([' foo ', ' bar '], _.trim);
  25712. * // => ['foo', 'bar']
  25713. */
  25714. function trim(string, chars, guard) {
  25715. string = toString(string);
  25716. if (string && (guard || chars === undefined)) {
  25717. return string.replace(reTrim, '');
  25718. }
  25719. if (!string || !(chars = baseToString(chars))) {
  25720. return string;
  25721. }
  25722. var strSymbols = stringToArray(string),
  25723. chrSymbols = stringToArray(chars),
  25724. start = charsStartIndex(strSymbols, chrSymbols),
  25725. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  25726. return castSlice(strSymbols, start, end).join('');
  25727. }
  25728. /**
  25729. * Removes trailing whitespace or specified characters from `string`.
  25730. *
  25731. * @static
  25732. * @memberOf _
  25733. * @since 4.0.0
  25734. * @category String
  25735. * @param {string} [string=''] The string to trim.
  25736. * @param {string} [chars=whitespace] The characters to trim.
  25737. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25738. * @returns {string} Returns the trimmed string.
  25739. * @example
  25740. *
  25741. * _.trimEnd(' abc ');
  25742. * // => ' abc'
  25743. *
  25744. * _.trimEnd('-_-abc-_-', '_-');
  25745. * // => '-_-abc'
  25746. */
  25747. function trimEnd(string, chars, guard) {
  25748. string = toString(string);
  25749. if (string && (guard || chars === undefined)) {
  25750. return string.replace(reTrimEnd, '');
  25751. }
  25752. if (!string || !(chars = baseToString(chars))) {
  25753. return string;
  25754. }
  25755. var strSymbols = stringToArray(string),
  25756. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  25757. return castSlice(strSymbols, 0, end).join('');
  25758. }
  25759. /**
  25760. * Removes leading whitespace or specified characters from `string`.
  25761. *
  25762. * @static
  25763. * @memberOf _
  25764. * @since 4.0.0
  25765. * @category String
  25766. * @param {string} [string=''] The string to trim.
  25767. * @param {string} [chars=whitespace] The characters to trim.
  25768. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25769. * @returns {string} Returns the trimmed string.
  25770. * @example
  25771. *
  25772. * _.trimStart(' abc ');
  25773. * // => 'abc '
  25774. *
  25775. * _.trimStart('-_-abc-_-', '_-');
  25776. * // => 'abc-_-'
  25777. */
  25778. function trimStart(string, chars, guard) {
  25779. string = toString(string);
  25780. if (string && (guard || chars === undefined)) {
  25781. return string.replace(reTrimStart, '');
  25782. }
  25783. if (!string || !(chars = baseToString(chars))) {
  25784. return string;
  25785. }
  25786. var strSymbols = stringToArray(string),
  25787. start = charsStartIndex(strSymbols, stringToArray(chars));
  25788. return castSlice(strSymbols, start).join('');
  25789. }
  25790. /**
  25791. * Truncates `string` if it's longer than the given maximum string length.
  25792. * The last characters of the truncated string are replaced with the omission
  25793. * string which defaults to "...".
  25794. *
  25795. * @static
  25796. * @memberOf _
  25797. * @since 4.0.0
  25798. * @category String
  25799. * @param {string} [string=''] The string to truncate.
  25800. * @param {Object} [options={}] The options object.
  25801. * @param {number} [options.length=30] The maximum string length.
  25802. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  25803. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  25804. * @returns {string} Returns the truncated string.
  25805. * @example
  25806. *
  25807. * _.truncate('hi-diddly-ho there, neighborino');
  25808. * // => 'hi-diddly-ho there, neighbo...'
  25809. *
  25810. * _.truncate('hi-diddly-ho there, neighborino', {
  25811. * 'length': 24,
  25812. * 'separator': ' '
  25813. * });
  25814. * // => 'hi-diddly-ho there,...'
  25815. *
  25816. * _.truncate('hi-diddly-ho there, neighborino', {
  25817. * 'length': 24,
  25818. * 'separator': /,? +/
  25819. * });
  25820. * // => 'hi-diddly-ho there...'
  25821. *
  25822. * _.truncate('hi-diddly-ho there, neighborino', {
  25823. * 'omission': ' [...]'
  25824. * });
  25825. * // => 'hi-diddly-ho there, neig [...]'
  25826. */
  25827. function truncate(string, options) {
  25828. var length = DEFAULT_TRUNC_LENGTH,
  25829. omission = DEFAULT_TRUNC_OMISSION;
  25830. if (isObject(options)) {
  25831. var separator = 'separator' in options ? options.separator : separator;
  25832. length = 'length' in options ? toInteger(options.length) : length;
  25833. omission = 'omission' in options ? baseToString(options.omission) : omission;
  25834. }
  25835. string = toString(string);
  25836. var strLength = string.length;
  25837. if (hasUnicode(string)) {
  25838. var strSymbols = stringToArray(string);
  25839. strLength = strSymbols.length;
  25840. }
  25841. if (length >= strLength) {
  25842. return string;
  25843. }
  25844. var end = length - stringSize(omission);
  25845. if (end < 1) {
  25846. return omission;
  25847. }
  25848. var result = strSymbols
  25849. ? castSlice(strSymbols, 0, end).join('')
  25850. : string.slice(0, end);
  25851. if (separator === undefined) {
  25852. return result + omission;
  25853. }
  25854. if (strSymbols) {
  25855. end += (result.length - end);
  25856. }
  25857. if (isRegExp(separator)) {
  25858. if (string.slice(end).search(separator)) {
  25859. var match,
  25860. substring = result;
  25861. if (!separator.global) {
  25862. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  25863. }
  25864. separator.lastIndex = 0;
  25865. while ((match = separator.exec(substring))) {
  25866. var newEnd = match.index;
  25867. }
  25868. result = result.slice(0, newEnd === undefined ? end : newEnd);
  25869. }
  25870. } else if (string.indexOf(baseToString(separator), end) != end) {
  25871. var index = result.lastIndexOf(separator);
  25872. if (index > -1) {
  25873. result = result.slice(0, index);
  25874. }
  25875. }
  25876. return result + omission;
  25877. }
  25878. /**
  25879. * The inverse of `_.escape`; this method converts the HTML entities
  25880. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  25881. * their corresponding characters.
  25882. *
  25883. * **Note:** No other HTML entities are unescaped. To unescape additional
  25884. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  25885. *
  25886. * @static
  25887. * @memberOf _
  25888. * @since 0.6.0
  25889. * @category String
  25890. * @param {string} [string=''] The string to unescape.
  25891. * @returns {string} Returns the unescaped string.
  25892. * @example
  25893. *
  25894. * _.unescape('fred, barney, &amp; pebbles');
  25895. * // => 'fred, barney, & pebbles'
  25896. */
  25897. function unescape(string) {
  25898. string = toString(string);
  25899. return (string && reHasEscapedHtml.test(string))
  25900. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  25901. : string;
  25902. }
  25903. /**
  25904. * Converts `string`, as space separated words, to upper case.
  25905. *
  25906. * @static
  25907. * @memberOf _
  25908. * @since 4.0.0
  25909. * @category String
  25910. * @param {string} [string=''] The string to convert.
  25911. * @returns {string} Returns the upper cased string.
  25912. * @example
  25913. *
  25914. * _.upperCase('--foo-bar');
  25915. * // => 'FOO BAR'
  25916. *
  25917. * _.upperCase('fooBar');
  25918. * // => 'FOO BAR'
  25919. *
  25920. * _.upperCase('__foo_bar__');
  25921. * // => 'FOO BAR'
  25922. */
  25923. var upperCase = createCompounder(function(result, word, index) {
  25924. return result + (index ? ' ' : '') + word.toUpperCase();
  25925. });
  25926. /**
  25927. * Converts the first character of `string` to upper case.
  25928. *
  25929. * @static
  25930. * @memberOf _
  25931. * @since 4.0.0
  25932. * @category String
  25933. * @param {string} [string=''] The string to convert.
  25934. * @returns {string} Returns the converted string.
  25935. * @example
  25936. *
  25937. * _.upperFirst('fred');
  25938. * // => 'Fred'
  25939. *
  25940. * _.upperFirst('FRED');
  25941. * // => 'FRED'
  25942. */
  25943. var upperFirst = createCaseFirst('toUpperCase');
  25944. /**
  25945. * Splits `string` into an array of its words.
  25946. *
  25947. * @static
  25948. * @memberOf _
  25949. * @since 3.0.0
  25950. * @category String
  25951. * @param {string} [string=''] The string to inspect.
  25952. * @param {RegExp|string} [pattern] The pattern to match words.
  25953. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25954. * @returns {Array} Returns the words of `string`.
  25955. * @example
  25956. *
  25957. * _.words('fred, barney, & pebbles');
  25958. * // => ['fred', 'barney', 'pebbles']
  25959. *
  25960. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  25961. * // => ['fred', 'barney', '&', 'pebbles']
  25962. */
  25963. function words(string, pattern, guard) {
  25964. string = toString(string);
  25965. pattern = guard ? undefined : pattern;
  25966. if (pattern === undefined) {
  25967. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  25968. }
  25969. return string.match(pattern) || [];
  25970. }
  25971. /*------------------------------------------------------------------------*/
  25972. /**
  25973. * Attempts to invoke `func`, returning either the result or the caught error
  25974. * object. Any additional arguments are provided to `func` when it's invoked.
  25975. *
  25976. * @static
  25977. * @memberOf _
  25978. * @since 3.0.0
  25979. * @category Util
  25980. * @param {Function} func The function to attempt.
  25981. * @param {...*} [args] The arguments to invoke `func` with.
  25982. * @returns {*} Returns the `func` result or error object.
  25983. * @example
  25984. *
  25985. * // Avoid throwing errors for invalid selectors.
  25986. * var elements = _.attempt(function(selector) {
  25987. * return document.querySelectorAll(selector);
  25988. * }, '>_>');
  25989. *
  25990. * if (_.isError(elements)) {
  25991. * elements = [];
  25992. * }
  25993. */
  25994. var attempt = baseRest(function(func, args) {
  25995. try {
  25996. return apply(func, undefined, args);
  25997. } catch (e) {
  25998. return isError(e) ? e : new Error(e);
  25999. }
  26000. });
  26001. /**
  26002. * Binds methods of an object to the object itself, overwriting the existing
  26003. * method.
  26004. *
  26005. * **Note:** This method doesn't set the "length" property of bound functions.
  26006. *
  26007. * @static
  26008. * @since 0.1.0
  26009. * @memberOf _
  26010. * @category Util
  26011. * @param {Object} object The object to bind and assign the bound methods to.
  26012. * @param {...(string|string[])} methodNames The object method names to bind.
  26013. * @returns {Object} Returns `object`.
  26014. * @example
  26015. *
  26016. * var view = {
  26017. * 'label': 'docs',
  26018. * 'click': function() {
  26019. * console.log('clicked ' + this.label);
  26020. * }
  26021. * };
  26022. *
  26023. * _.bindAll(view, ['click']);
  26024. * jQuery(element).on('click', view.click);
  26025. * // => Logs 'clicked docs' when clicked.
  26026. */
  26027. var bindAll = flatRest(function(object, methodNames) {
  26028. arrayEach(methodNames, function(key) {
  26029. key = toKey(key);
  26030. baseAssignValue(object, key, bind(object[key], object));
  26031. });
  26032. return object;
  26033. });
  26034. /**
  26035. * Creates a function that iterates over `pairs` and invokes the corresponding
  26036. * function of the first predicate to return truthy. The predicate-function
  26037. * pairs are invoked with the `this` binding and arguments of the created
  26038. * function.
  26039. *
  26040. * @static
  26041. * @memberOf _
  26042. * @since 4.0.0
  26043. * @category Util
  26044. * @param {Array} pairs The predicate-function pairs.
  26045. * @returns {Function} Returns the new composite function.
  26046. * @example
  26047. *
  26048. * var func = _.cond([
  26049. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  26050. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  26051. * [_.stubTrue, _.constant('no match')]
  26052. * ]);
  26053. *
  26054. * func({ 'a': 1, 'b': 2 });
  26055. * // => 'matches A'
  26056. *
  26057. * func({ 'a': 0, 'b': 1 });
  26058. * // => 'matches B'
  26059. *
  26060. * func({ 'a': '1', 'b': '2' });
  26061. * // => 'no match'
  26062. */
  26063. function cond(pairs) {
  26064. var length = pairs == null ? 0 : pairs.length,
  26065. toIteratee = getIteratee();
  26066. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  26067. if (typeof pair[1] != 'function') {
  26068. throw new TypeError(FUNC_ERROR_TEXT);
  26069. }
  26070. return [toIteratee(pair[0]), pair[1]];
  26071. });
  26072. return baseRest(function(args) {
  26073. var index = -1;
  26074. while (++index < length) {
  26075. var pair = pairs[index];
  26076. if (apply(pair[0], this, args)) {
  26077. return apply(pair[1], this, args);
  26078. }
  26079. }
  26080. });
  26081. }
  26082. /**
  26083. * Creates a function that invokes the predicate properties of `source` with
  26084. * the corresponding property values of a given object, returning `true` if
  26085. * all predicates return truthy, else `false`.
  26086. *
  26087. * **Note:** The created function is equivalent to `_.conformsTo` with
  26088. * `source` partially applied.
  26089. *
  26090. * @static
  26091. * @memberOf _
  26092. * @since 4.0.0
  26093. * @category Util
  26094. * @param {Object} source The object of property predicates to conform to.
  26095. * @returns {Function} Returns the new spec function.
  26096. * @example
  26097. *
  26098. * var objects = [
  26099. * { 'a': 2, 'b': 1 },
  26100. * { 'a': 1, 'b': 2 }
  26101. * ];
  26102. *
  26103. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  26104. * // => [{ 'a': 1, 'b': 2 }]
  26105. */
  26106. function conforms(source) {
  26107. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  26108. }
  26109. /**
  26110. * Creates a function that returns `value`.
  26111. *
  26112. * @static
  26113. * @memberOf _
  26114. * @since 2.4.0
  26115. * @category Util
  26116. * @param {*} value The value to return from the new function.
  26117. * @returns {Function} Returns the new constant function.
  26118. * @example
  26119. *
  26120. * var objects = _.times(2, _.constant({ 'a': 1 }));
  26121. *
  26122. * console.log(objects);
  26123. * // => [{ 'a': 1 }, { 'a': 1 }]
  26124. *
  26125. * console.log(objects[0] === objects[1]);
  26126. * // => true
  26127. */
  26128. function constant(value) {
  26129. return function() {
  26130. return value;
  26131. };
  26132. }
  26133. /**
  26134. * Checks `value` to determine whether a default value should be returned in
  26135. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  26136. * or `undefined`.
  26137. *
  26138. * @static
  26139. * @memberOf _
  26140. * @since 4.14.0
  26141. * @category Util
  26142. * @param {*} value The value to check.
  26143. * @param {*} defaultValue The default value.
  26144. * @returns {*} Returns the resolved value.
  26145. * @example
  26146. *
  26147. * _.defaultTo(1, 10);
  26148. * // => 1
  26149. *
  26150. * _.defaultTo(undefined, 10);
  26151. * // => 10
  26152. */
  26153. function defaultTo(value, defaultValue) {
  26154. return (value == null || value !== value) ? defaultValue : value;
  26155. }
  26156. /**
  26157. * Creates a function that returns the result of invoking the given functions
  26158. * with the `this` binding of the created function, where each successive
  26159. * invocation is supplied the return value of the previous.
  26160. *
  26161. * @static
  26162. * @memberOf _
  26163. * @since 3.0.0
  26164. * @category Util
  26165. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  26166. * @returns {Function} Returns the new composite function.
  26167. * @see _.flowRight
  26168. * @example
  26169. *
  26170. * function square(n) {
  26171. * return n * n;
  26172. * }
  26173. *
  26174. * var addSquare = _.flow([_.add, square]);
  26175. * addSquare(1, 2);
  26176. * // => 9
  26177. */
  26178. var flow = createFlow();
  26179. /**
  26180. * This method is like `_.flow` except that it creates a function that
  26181. * invokes the given functions from right to left.
  26182. *
  26183. * @static
  26184. * @since 3.0.0
  26185. * @memberOf _
  26186. * @category Util
  26187. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  26188. * @returns {Function} Returns the new composite function.
  26189. * @see _.flow
  26190. * @example
  26191. *
  26192. * function square(n) {
  26193. * return n * n;
  26194. * }
  26195. *
  26196. * var addSquare = _.flowRight([square, _.add]);
  26197. * addSquare(1, 2);
  26198. * // => 9
  26199. */
  26200. var flowRight = createFlow(true);
  26201. /**
  26202. * This method returns the first argument it receives.
  26203. *
  26204. * @static
  26205. * @since 0.1.0
  26206. * @memberOf _
  26207. * @category Util
  26208. * @param {*} value Any value.
  26209. * @returns {*} Returns `value`.
  26210. * @example
  26211. *
  26212. * var object = { 'a': 1 };
  26213. *
  26214. * console.log(_.identity(object) === object);
  26215. * // => true
  26216. */
  26217. function identity(value) {
  26218. return value;
  26219. }
  26220. /**
  26221. * Creates a function that invokes `func` with the arguments of the created
  26222. * function. If `func` is a property name, the created function returns the
  26223. * property value for a given element. If `func` is an array or object, the
  26224. * created function returns `true` for elements that contain the equivalent
  26225. * source properties, otherwise it returns `false`.
  26226. *
  26227. * @static
  26228. * @since 4.0.0
  26229. * @memberOf _
  26230. * @category Util
  26231. * @param {*} [func=_.identity] The value to convert to a callback.
  26232. * @returns {Function} Returns the callback.
  26233. * @example
  26234. *
  26235. * var users = [
  26236. * { 'user': 'barney', 'age': 36, 'active': true },
  26237. * { 'user': 'fred', 'age': 40, 'active': false }
  26238. * ];
  26239. *
  26240. * // The `_.matches` iteratee shorthand.
  26241. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  26242. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  26243. *
  26244. * // The `_.matchesProperty` iteratee shorthand.
  26245. * _.filter(users, _.iteratee(['user', 'fred']));
  26246. * // => [{ 'user': 'fred', 'age': 40 }]
  26247. *
  26248. * // The `_.property` iteratee shorthand.
  26249. * _.map(users, _.iteratee('user'));
  26250. * // => ['barney', 'fred']
  26251. *
  26252. * // Create custom iteratee shorthands.
  26253. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  26254. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  26255. * return func.test(string);
  26256. * };
  26257. * });
  26258. *
  26259. * _.filter(['abc', 'def'], /ef/);
  26260. * // => ['def']
  26261. */
  26262. function iteratee(func) {
  26263. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  26264. }
  26265. /**
  26266. * Creates a function that performs a partial deep comparison between a given
  26267. * object and `source`, returning `true` if the given object has equivalent
  26268. * property values, else `false`.
  26269. *
  26270. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  26271. * partially applied.
  26272. *
  26273. * Partial comparisons will match empty array and empty object `source`
  26274. * values against any array or object value, respectively. See `_.isEqual`
  26275. * for a list of supported value comparisons.
  26276. *
  26277. * @static
  26278. * @memberOf _
  26279. * @since 3.0.0
  26280. * @category Util
  26281. * @param {Object} source The object of property values to match.
  26282. * @returns {Function} Returns the new spec function.
  26283. * @example
  26284. *
  26285. * var objects = [
  26286. * { 'a': 1, 'b': 2, 'c': 3 },
  26287. * { 'a': 4, 'b': 5, 'c': 6 }
  26288. * ];
  26289. *
  26290. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  26291. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  26292. */
  26293. function matches(source) {
  26294. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  26295. }
  26296. /**
  26297. * Creates a function that performs a partial deep comparison between the
  26298. * value at `path` of a given object to `srcValue`, returning `true` if the
  26299. * object value is equivalent, else `false`.
  26300. *
  26301. * **Note:** Partial comparisons will match empty array and empty object
  26302. * `srcValue` values against any array or object value, respectively. See
  26303. * `_.isEqual` for a list of supported value comparisons.
  26304. *
  26305. * @static
  26306. * @memberOf _
  26307. * @since 3.2.0
  26308. * @category Util
  26309. * @param {Array|string} path The path of the property to get.
  26310. * @param {*} srcValue The value to match.
  26311. * @returns {Function} Returns the new spec function.
  26312. * @example
  26313. *
  26314. * var objects = [
  26315. * { 'a': 1, 'b': 2, 'c': 3 },
  26316. * { 'a': 4, 'b': 5, 'c': 6 }
  26317. * ];
  26318. *
  26319. * _.find(objects, _.matchesProperty('a', 4));
  26320. * // => { 'a': 4, 'b': 5, 'c': 6 }
  26321. */
  26322. function matchesProperty(path, srcValue) {
  26323. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  26324. }
  26325. /**
  26326. * Creates a function that invokes the method at `path` of a given object.
  26327. * Any additional arguments are provided to the invoked method.
  26328. *
  26329. * @static
  26330. * @memberOf _
  26331. * @since 3.7.0
  26332. * @category Util
  26333. * @param {Array|string} path The path of the method to invoke.
  26334. * @param {...*} [args] The arguments to invoke the method with.
  26335. * @returns {Function} Returns the new invoker function.
  26336. * @example
  26337. *
  26338. * var objects = [
  26339. * { 'a': { 'b': _.constant(2) } },
  26340. * { 'a': { 'b': _.constant(1) } }
  26341. * ];
  26342. *
  26343. * _.map(objects, _.method('a.b'));
  26344. * // => [2, 1]
  26345. *
  26346. * _.map(objects, _.method(['a', 'b']));
  26347. * // => [2, 1]
  26348. */
  26349. var method = baseRest(function(path, args) {
  26350. return function(object) {
  26351. return baseInvoke(object, path, args);
  26352. };
  26353. });
  26354. /**
  26355. * The opposite of `_.method`; this method creates a function that invokes
  26356. * the method at a given path of `object`. Any additional arguments are
  26357. * provided to the invoked method.
  26358. *
  26359. * @static
  26360. * @memberOf _
  26361. * @since 3.7.0
  26362. * @category Util
  26363. * @param {Object} object The object to query.
  26364. * @param {...*} [args] The arguments to invoke the method with.
  26365. * @returns {Function} Returns the new invoker function.
  26366. * @example
  26367. *
  26368. * var array = _.times(3, _.constant),
  26369. * object = { 'a': array, 'b': array, 'c': array };
  26370. *
  26371. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  26372. * // => [2, 0]
  26373. *
  26374. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  26375. * // => [2, 0]
  26376. */
  26377. var methodOf = baseRest(function(object, args) {
  26378. return function(path) {
  26379. return baseInvoke(object, path, args);
  26380. };
  26381. });
  26382. /**
  26383. * Adds all own enumerable string keyed function properties of a source
  26384. * object to the destination object. If `object` is a function, then methods
  26385. * are added to its prototype as well.
  26386. *
  26387. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  26388. * avoid conflicts caused by modifying the original.
  26389. *
  26390. * @static
  26391. * @since 0.1.0
  26392. * @memberOf _
  26393. * @category Util
  26394. * @param {Function|Object} [object=lodash] The destination object.
  26395. * @param {Object} source The object of functions to add.
  26396. * @param {Object} [options={}] The options object.
  26397. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  26398. * @returns {Function|Object} Returns `object`.
  26399. * @example
  26400. *
  26401. * function vowels(string) {
  26402. * return _.filter(string, function(v) {
  26403. * return /[aeiou]/i.test(v);
  26404. * });
  26405. * }
  26406. *
  26407. * _.mixin({ 'vowels': vowels });
  26408. * _.vowels('fred');
  26409. * // => ['e']
  26410. *
  26411. * _('fred').vowels().value();
  26412. * // => ['e']
  26413. *
  26414. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  26415. * _('fred').vowels();
  26416. * // => ['e']
  26417. */
  26418. function mixin(object, source, options) {
  26419. var props = keys(source),
  26420. methodNames = baseFunctions(source, props);
  26421. if (options == null &&
  26422. !(isObject(source) && (methodNames.length || !props.length))) {
  26423. options = source;
  26424. source = object;
  26425. object = this;
  26426. methodNames = baseFunctions(source, keys(source));
  26427. }
  26428. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  26429. isFunc = isFunction(object);
  26430. arrayEach(methodNames, function(methodName) {
  26431. var func = source[methodName];
  26432. object[methodName] = func;
  26433. if (isFunc) {
  26434. object.prototype[methodName] = function() {
  26435. var chainAll = this.__chain__;
  26436. if (chain || chainAll) {
  26437. var result = object(this.__wrapped__),
  26438. actions = result.__actions__ = copyArray(this.__actions__);
  26439. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  26440. result.__chain__ = chainAll;
  26441. return result;
  26442. }
  26443. return func.apply(object, arrayPush([this.value()], arguments));
  26444. };
  26445. }
  26446. });
  26447. return object;
  26448. }
  26449. /**
  26450. * Reverts the `_` variable to its previous value and returns a reference to
  26451. * the `lodash` function.
  26452. *
  26453. * @static
  26454. * @since 0.1.0
  26455. * @memberOf _
  26456. * @category Util
  26457. * @returns {Function} Returns the `lodash` function.
  26458. * @example
  26459. *
  26460. * var lodash = _.noConflict();
  26461. */
  26462. function noConflict() {
  26463. if (root._ === this) {
  26464. root._ = oldDash;
  26465. }
  26466. return this;
  26467. }
  26468. /**
  26469. * This method returns `undefined`.
  26470. *
  26471. * @static
  26472. * @memberOf _
  26473. * @since 2.3.0
  26474. * @category Util
  26475. * @example
  26476. *
  26477. * _.times(2, _.noop);
  26478. * // => [undefined, undefined]
  26479. */
  26480. function noop() {
  26481. // No operation performed.
  26482. }
  26483. /**
  26484. * Creates a function that gets the argument at index `n`. If `n` is negative,
  26485. * the nth argument from the end is returned.
  26486. *
  26487. * @static
  26488. * @memberOf _
  26489. * @since 4.0.0
  26490. * @category Util
  26491. * @param {number} [n=0] The index of the argument to return.
  26492. * @returns {Function} Returns the new pass-thru function.
  26493. * @example
  26494. *
  26495. * var func = _.nthArg(1);
  26496. * func('a', 'b', 'c', 'd');
  26497. * // => 'b'
  26498. *
  26499. * var func = _.nthArg(-2);
  26500. * func('a', 'b', 'c', 'd');
  26501. * // => 'c'
  26502. */
  26503. function nthArg(n) {
  26504. n = toInteger(n);
  26505. return baseRest(function(args) {
  26506. return baseNth(args, n);
  26507. });
  26508. }
  26509. /**
  26510. * Creates a function that invokes `iteratees` with the arguments it receives
  26511. * and returns their results.
  26512. *
  26513. * @static
  26514. * @memberOf _
  26515. * @since 4.0.0
  26516. * @category Util
  26517. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  26518. * The iteratees to invoke.
  26519. * @returns {Function} Returns the new function.
  26520. * @example
  26521. *
  26522. * var func = _.over([Math.max, Math.min]);
  26523. *
  26524. * func(1, 2, 3, 4);
  26525. * // => [4, 1]
  26526. */
  26527. var over = createOver(arrayMap);
  26528. /**
  26529. * Creates a function that checks if **all** of the `predicates` return
  26530. * truthy when invoked with the arguments it receives.
  26531. *
  26532. * @static
  26533. * @memberOf _
  26534. * @since 4.0.0
  26535. * @category Util
  26536. * @param {...(Function|Function[])} [predicates=[_.identity]]
  26537. * The predicates to check.
  26538. * @returns {Function} Returns the new function.
  26539. * @example
  26540. *
  26541. * var func = _.overEvery([Boolean, isFinite]);
  26542. *
  26543. * func('1');
  26544. * // => true
  26545. *
  26546. * func(null);
  26547. * // => false
  26548. *
  26549. * func(NaN);
  26550. * // => false
  26551. */
  26552. var overEvery = createOver(arrayEvery);
  26553. /**
  26554. * Creates a function that checks if **any** of the `predicates` return
  26555. * truthy when invoked with the arguments it receives.
  26556. *
  26557. * @static
  26558. * @memberOf _
  26559. * @since 4.0.0
  26560. * @category Util
  26561. * @param {...(Function|Function[])} [predicates=[_.identity]]
  26562. * The predicates to check.
  26563. * @returns {Function} Returns the new function.
  26564. * @example
  26565. *
  26566. * var func = _.overSome([Boolean, isFinite]);
  26567. *
  26568. * func('1');
  26569. * // => true
  26570. *
  26571. * func(null);
  26572. * // => true
  26573. *
  26574. * func(NaN);
  26575. * // => false
  26576. */
  26577. var overSome = createOver(arraySome);
  26578. /**
  26579. * Creates a function that returns the value at `path` of a given object.
  26580. *
  26581. * @static
  26582. * @memberOf _
  26583. * @since 2.4.0
  26584. * @category Util
  26585. * @param {Array|string} path The path of the property to get.
  26586. * @returns {Function} Returns the new accessor function.
  26587. * @example
  26588. *
  26589. * var objects = [
  26590. * { 'a': { 'b': 2 } },
  26591. * { 'a': { 'b': 1 } }
  26592. * ];
  26593. *
  26594. * _.map(objects, _.property('a.b'));
  26595. * // => [2, 1]
  26596. *
  26597. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  26598. * // => [1, 2]
  26599. */
  26600. function property(path) {
  26601. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  26602. }
  26603. /**
  26604. * The opposite of `_.property`; this method creates a function that returns
  26605. * the value at a given path of `object`.
  26606. *
  26607. * @static
  26608. * @memberOf _
  26609. * @since 3.0.0
  26610. * @category Util
  26611. * @param {Object} object The object to query.
  26612. * @returns {Function} Returns the new accessor function.
  26613. * @example
  26614. *
  26615. * var array = [0, 1, 2],
  26616. * object = { 'a': array, 'b': array, 'c': array };
  26617. *
  26618. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  26619. * // => [2, 0]
  26620. *
  26621. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  26622. * // => [2, 0]
  26623. */
  26624. function propertyOf(object) {
  26625. return function(path) {
  26626. return object == null ? undefined : baseGet(object, path);
  26627. };
  26628. }
  26629. /**
  26630. * Creates an array of numbers (positive and/or negative) progressing from
  26631. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  26632. * `start` is specified without an `end` or `step`. If `end` is not specified,
  26633. * it's set to `start` with `start` then set to `0`.
  26634. *
  26635. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  26636. * floating-point values which can produce unexpected results.
  26637. *
  26638. * @static
  26639. * @since 0.1.0
  26640. * @memberOf _
  26641. * @category Util
  26642. * @param {number} [start=0] The start of the range.
  26643. * @param {number} end The end of the range.
  26644. * @param {number} [step=1] The value to increment or decrement by.
  26645. * @returns {Array} Returns the range of numbers.
  26646. * @see _.inRange, _.rangeRight
  26647. * @example
  26648. *
  26649. * _.range(4);
  26650. * // => [0, 1, 2, 3]
  26651. *
  26652. * _.range(-4);
  26653. * // => [0, -1, -2, -3]
  26654. *
  26655. * _.range(1, 5);
  26656. * // => [1, 2, 3, 4]
  26657. *
  26658. * _.range(0, 20, 5);
  26659. * // => [0, 5, 10, 15]
  26660. *
  26661. * _.range(0, -4, -1);
  26662. * // => [0, -1, -2, -3]
  26663. *
  26664. * _.range(1, 4, 0);
  26665. * // => [1, 1, 1]
  26666. *
  26667. * _.range(0);
  26668. * // => []
  26669. */
  26670. var range = createRange();
  26671. /**
  26672. * This method is like `_.range` except that it populates values in
  26673. * descending order.
  26674. *
  26675. * @static
  26676. * @memberOf _
  26677. * @since 4.0.0
  26678. * @category Util
  26679. * @param {number} [start=0] The start of the range.
  26680. * @param {number} end The end of the range.
  26681. * @param {number} [step=1] The value to increment or decrement by.
  26682. * @returns {Array} Returns the range of numbers.
  26683. * @see _.inRange, _.range
  26684. * @example
  26685. *
  26686. * _.rangeRight(4);
  26687. * // => [3, 2, 1, 0]
  26688. *
  26689. * _.rangeRight(-4);
  26690. * // => [-3, -2, -1, 0]
  26691. *
  26692. * _.rangeRight(1, 5);
  26693. * // => [4, 3, 2, 1]
  26694. *
  26695. * _.rangeRight(0, 20, 5);
  26696. * // => [15, 10, 5, 0]
  26697. *
  26698. * _.rangeRight(0, -4, -1);
  26699. * // => [-3, -2, -1, 0]
  26700. *
  26701. * _.rangeRight(1, 4, 0);
  26702. * // => [1, 1, 1]
  26703. *
  26704. * _.rangeRight(0);
  26705. * // => []
  26706. */
  26707. var rangeRight = createRange(true);
  26708. /**
  26709. * This method returns a new empty array.
  26710. *
  26711. * @static
  26712. * @memberOf _
  26713. * @since 4.13.0
  26714. * @category Util
  26715. * @returns {Array} Returns the new empty array.
  26716. * @example
  26717. *
  26718. * var arrays = _.times(2, _.stubArray);
  26719. *
  26720. * console.log(arrays);
  26721. * // => [[], []]
  26722. *
  26723. * console.log(arrays[0] === arrays[1]);
  26724. * // => false
  26725. */
  26726. function stubArray() {
  26727. return [];
  26728. }
  26729. /**
  26730. * This method returns `false`.
  26731. *
  26732. * @static
  26733. * @memberOf _
  26734. * @since 4.13.0
  26735. * @category Util
  26736. * @returns {boolean} Returns `false`.
  26737. * @example
  26738. *
  26739. * _.times(2, _.stubFalse);
  26740. * // => [false, false]
  26741. */
  26742. function stubFalse() {
  26743. return false;
  26744. }
  26745. /**
  26746. * This method returns a new empty object.
  26747. *
  26748. * @static
  26749. * @memberOf _
  26750. * @since 4.13.0
  26751. * @category Util
  26752. * @returns {Object} Returns the new empty object.
  26753. * @example
  26754. *
  26755. * var objects = _.times(2, _.stubObject);
  26756. *
  26757. * console.log(objects);
  26758. * // => [{}, {}]
  26759. *
  26760. * console.log(objects[0] === objects[1]);
  26761. * // => false
  26762. */
  26763. function stubObject() {
  26764. return {};
  26765. }
  26766. /**
  26767. * This method returns an empty string.
  26768. *
  26769. * @static
  26770. * @memberOf _
  26771. * @since 4.13.0
  26772. * @category Util
  26773. * @returns {string} Returns the empty string.
  26774. * @example
  26775. *
  26776. * _.times(2, _.stubString);
  26777. * // => ['', '']
  26778. */
  26779. function stubString() {
  26780. return '';
  26781. }
  26782. /**
  26783. * This method returns `true`.
  26784. *
  26785. * @static
  26786. * @memberOf _
  26787. * @since 4.13.0
  26788. * @category Util
  26789. * @returns {boolean} Returns `true`.
  26790. * @example
  26791. *
  26792. * _.times(2, _.stubTrue);
  26793. * // => [true, true]
  26794. */
  26795. function stubTrue() {
  26796. return true;
  26797. }
  26798. /**
  26799. * Invokes the iteratee `n` times, returning an array of the results of
  26800. * each invocation. The iteratee is invoked with one argument; (index).
  26801. *
  26802. * @static
  26803. * @since 0.1.0
  26804. * @memberOf _
  26805. * @category Util
  26806. * @param {number} n The number of times to invoke `iteratee`.
  26807. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26808. * @returns {Array} Returns the array of results.
  26809. * @example
  26810. *
  26811. * _.times(3, String);
  26812. * // => ['0', '1', '2']
  26813. *
  26814. * _.times(4, _.constant(0));
  26815. * // => [0, 0, 0, 0]
  26816. */
  26817. function times(n, iteratee) {
  26818. n = toInteger(n);
  26819. if (n < 1 || n > MAX_SAFE_INTEGER) {
  26820. return [];
  26821. }
  26822. var index = MAX_ARRAY_LENGTH,
  26823. length = nativeMin(n, MAX_ARRAY_LENGTH);
  26824. iteratee = getIteratee(iteratee);
  26825. n -= MAX_ARRAY_LENGTH;
  26826. var result = baseTimes(length, iteratee);
  26827. while (++index < n) {
  26828. iteratee(index);
  26829. }
  26830. return result;
  26831. }
  26832. /**
  26833. * Converts `value` to a property path array.
  26834. *
  26835. * @static
  26836. * @memberOf _
  26837. * @since 4.0.0
  26838. * @category Util
  26839. * @param {*} value The value to convert.
  26840. * @returns {Array} Returns the new property path array.
  26841. * @example
  26842. *
  26843. * _.toPath('a.b.c');
  26844. * // => ['a', 'b', 'c']
  26845. *
  26846. * _.toPath('a[0].b.c');
  26847. * // => ['a', '0', 'b', 'c']
  26848. */
  26849. function toPath(value) {
  26850. if (isArray(value)) {
  26851. return arrayMap(value, toKey);
  26852. }
  26853. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  26854. }
  26855. /**
  26856. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  26857. *
  26858. * @static
  26859. * @since 0.1.0
  26860. * @memberOf _
  26861. * @category Util
  26862. * @param {string} [prefix=''] The value to prefix the ID with.
  26863. * @returns {string} Returns the unique ID.
  26864. * @example
  26865. *
  26866. * _.uniqueId('contact_');
  26867. * // => 'contact_104'
  26868. *
  26869. * _.uniqueId();
  26870. * // => '105'
  26871. */
  26872. function uniqueId(prefix) {
  26873. var id = ++idCounter;
  26874. return toString(prefix) + id;
  26875. }
  26876. /*------------------------------------------------------------------------*/
  26877. /**
  26878. * Adds two numbers.
  26879. *
  26880. * @static
  26881. * @memberOf _
  26882. * @since 3.4.0
  26883. * @category Math
  26884. * @param {number} augend The first number in an addition.
  26885. * @param {number} addend The second number in an addition.
  26886. * @returns {number} Returns the total.
  26887. * @example
  26888. *
  26889. * _.add(6, 4);
  26890. * // => 10
  26891. */
  26892. var add = createMathOperation(function(augend, addend) {
  26893. return augend + addend;
  26894. }, 0);
  26895. /**
  26896. * Computes `number` rounded up to `precision`.
  26897. *
  26898. * @static
  26899. * @memberOf _
  26900. * @since 3.10.0
  26901. * @category Math
  26902. * @param {number} number The number to round up.
  26903. * @param {number} [precision=0] The precision to round up to.
  26904. * @returns {number} Returns the rounded up number.
  26905. * @example
  26906. *
  26907. * _.ceil(4.006);
  26908. * // => 5
  26909. *
  26910. * _.ceil(6.004, 2);
  26911. * // => 6.01
  26912. *
  26913. * _.ceil(6040, -2);
  26914. * // => 6100
  26915. */
  26916. var ceil = createRound('ceil');
  26917. /**
  26918. * Divide two numbers.
  26919. *
  26920. * @static
  26921. * @memberOf _
  26922. * @since 4.7.0
  26923. * @category Math
  26924. * @param {number} dividend The first number in a division.
  26925. * @param {number} divisor The second number in a division.
  26926. * @returns {number} Returns the quotient.
  26927. * @example
  26928. *
  26929. * _.divide(6, 4);
  26930. * // => 1.5
  26931. */
  26932. var divide = createMathOperation(function(dividend, divisor) {
  26933. return dividend / divisor;
  26934. }, 1);
  26935. /**
  26936. * Computes `number` rounded down to `precision`.
  26937. *
  26938. * @static
  26939. * @memberOf _
  26940. * @since 3.10.0
  26941. * @category Math
  26942. * @param {number} number The number to round down.
  26943. * @param {number} [precision=0] The precision to round down to.
  26944. * @returns {number} Returns the rounded down number.
  26945. * @example
  26946. *
  26947. * _.floor(4.006);
  26948. * // => 4
  26949. *
  26950. * _.floor(0.046, 2);
  26951. * // => 0.04
  26952. *
  26953. * _.floor(4060, -2);
  26954. * // => 4000
  26955. */
  26956. var floor = createRound('floor');
  26957. /**
  26958. * Computes the maximum value of `array`. If `array` is empty or falsey,
  26959. * `undefined` is returned.
  26960. *
  26961. * @static
  26962. * @since 0.1.0
  26963. * @memberOf _
  26964. * @category Math
  26965. * @param {Array} array The array to iterate over.
  26966. * @returns {*} Returns the maximum value.
  26967. * @example
  26968. *
  26969. * _.max([4, 2, 8, 6]);
  26970. * // => 8
  26971. *
  26972. * _.max([]);
  26973. * // => undefined
  26974. */
  26975. function max(array) {
  26976. return (array && array.length)
  26977. ? baseExtremum(array, identity, baseGt)
  26978. : undefined;
  26979. }
  26980. /**
  26981. * This method is like `_.max` except that it accepts `iteratee` which is
  26982. * invoked for each element in `array` to generate the criterion by which
  26983. * the value is ranked. The iteratee is invoked with one argument: (value).
  26984. *
  26985. * @static
  26986. * @memberOf _
  26987. * @since 4.0.0
  26988. * @category Math
  26989. * @param {Array} array The array to iterate over.
  26990. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26991. * @returns {*} Returns the maximum value.
  26992. * @example
  26993. *
  26994. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  26995. *
  26996. * _.maxBy(objects, function(o) { return o.n; });
  26997. * // => { 'n': 2 }
  26998. *
  26999. * // The `_.property` iteratee shorthand.
  27000. * _.maxBy(objects, 'n');
  27001. * // => { 'n': 2 }
  27002. */
  27003. function maxBy(array, iteratee) {
  27004. return (array && array.length)
  27005. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  27006. : undefined;
  27007. }
  27008. /**
  27009. * Computes the mean of the values in `array`.
  27010. *
  27011. * @static
  27012. * @memberOf _
  27013. * @since 4.0.0
  27014. * @category Math
  27015. * @param {Array} array The array to iterate over.
  27016. * @returns {number} Returns the mean.
  27017. * @example
  27018. *
  27019. * _.mean([4, 2, 8, 6]);
  27020. * // => 5
  27021. */
  27022. function mean(array) {
  27023. return baseMean(array, identity);
  27024. }
  27025. /**
  27026. * This method is like `_.mean` except that it accepts `iteratee` which is
  27027. * invoked for each element in `array` to generate the value to be averaged.
  27028. * The iteratee is invoked with one argument: (value).
  27029. *
  27030. * @static
  27031. * @memberOf _
  27032. * @since 4.7.0
  27033. * @category Math
  27034. * @param {Array} array The array to iterate over.
  27035. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27036. * @returns {number} Returns the mean.
  27037. * @example
  27038. *
  27039. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  27040. *
  27041. * _.meanBy(objects, function(o) { return o.n; });
  27042. * // => 5
  27043. *
  27044. * // The `_.property` iteratee shorthand.
  27045. * _.meanBy(objects, 'n');
  27046. * // => 5
  27047. */
  27048. function meanBy(array, iteratee) {
  27049. return baseMean(array, getIteratee(iteratee, 2));
  27050. }
  27051. /**
  27052. * Computes the minimum value of `array`. If `array` is empty or falsey,
  27053. * `undefined` is returned.
  27054. *
  27055. * @static
  27056. * @since 0.1.0
  27057. * @memberOf _
  27058. * @category Math
  27059. * @param {Array} array The array to iterate over.
  27060. * @returns {*} Returns the minimum value.
  27061. * @example
  27062. *
  27063. * _.min([4, 2, 8, 6]);
  27064. * // => 2
  27065. *
  27066. * _.min([]);
  27067. * // => undefined
  27068. */
  27069. function min(array) {
  27070. return (array && array.length)
  27071. ? baseExtremum(array, identity, baseLt)
  27072. : undefined;
  27073. }
  27074. /**
  27075. * This method is like `_.min` except that it accepts `iteratee` which is
  27076. * invoked for each element in `array` to generate the criterion by which
  27077. * the value is ranked. The iteratee is invoked with one argument: (value).
  27078. *
  27079. * @static
  27080. * @memberOf _
  27081. * @since 4.0.0
  27082. * @category Math
  27083. * @param {Array} array The array to iterate over.
  27084. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27085. * @returns {*} Returns the minimum value.
  27086. * @example
  27087. *
  27088. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  27089. *
  27090. * _.minBy(objects, function(o) { return o.n; });
  27091. * // => { 'n': 1 }
  27092. *
  27093. * // The `_.property` iteratee shorthand.
  27094. * _.minBy(objects, 'n');
  27095. * // => { 'n': 1 }
  27096. */
  27097. function minBy(array, iteratee) {
  27098. return (array && array.length)
  27099. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  27100. : undefined;
  27101. }
  27102. /**
  27103. * Multiply two numbers.
  27104. *
  27105. * @static
  27106. * @memberOf _
  27107. * @since 4.7.0
  27108. * @category Math
  27109. * @param {number} multiplier The first number in a multiplication.
  27110. * @param {number} multiplicand The second number in a multiplication.
  27111. * @returns {number} Returns the product.
  27112. * @example
  27113. *
  27114. * _.multiply(6, 4);
  27115. * // => 24
  27116. */
  27117. var multiply = createMathOperation(function(multiplier, multiplicand) {
  27118. return multiplier * multiplicand;
  27119. }, 1);
  27120. /**
  27121. * Computes `number` rounded to `precision`.
  27122. *
  27123. * @static
  27124. * @memberOf _
  27125. * @since 3.10.0
  27126. * @category Math
  27127. * @param {number} number The number to round.
  27128. * @param {number} [precision=0] The precision to round to.
  27129. * @returns {number} Returns the rounded number.
  27130. * @example
  27131. *
  27132. * _.round(4.006);
  27133. * // => 4
  27134. *
  27135. * _.round(4.006, 2);
  27136. * // => 4.01
  27137. *
  27138. * _.round(4060, -2);
  27139. * // => 4100
  27140. */
  27141. var round = createRound('round');
  27142. /**
  27143. * Subtract two numbers.
  27144. *
  27145. * @static
  27146. * @memberOf _
  27147. * @since 4.0.0
  27148. * @category Math
  27149. * @param {number} minuend The first number in a subtraction.
  27150. * @param {number} subtrahend The second number in a subtraction.
  27151. * @returns {number} Returns the difference.
  27152. * @example
  27153. *
  27154. * _.subtract(6, 4);
  27155. * // => 2
  27156. */
  27157. var subtract = createMathOperation(function(minuend, subtrahend) {
  27158. return minuend - subtrahend;
  27159. }, 0);
  27160. /**
  27161. * Computes the sum of the values in `array`.
  27162. *
  27163. * @static
  27164. * @memberOf _
  27165. * @since 3.4.0
  27166. * @category Math
  27167. * @param {Array} array The array to iterate over.
  27168. * @returns {number} Returns the sum.
  27169. * @example
  27170. *
  27171. * _.sum([4, 2, 8, 6]);
  27172. * // => 20
  27173. */
  27174. function sum(array) {
  27175. return (array && array.length)
  27176. ? baseSum(array, identity)
  27177. : 0;
  27178. }
  27179. /**
  27180. * This method is like `_.sum` except that it accepts `iteratee` which is
  27181. * invoked for each element in `array` to generate the value to be summed.
  27182. * The iteratee is invoked with one argument: (value).
  27183. *
  27184. * @static
  27185. * @memberOf _
  27186. * @since 4.0.0
  27187. * @category Math
  27188. * @param {Array} array The array to iterate over.
  27189. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27190. * @returns {number} Returns the sum.
  27191. * @example
  27192. *
  27193. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  27194. *
  27195. * _.sumBy(objects, function(o) { return o.n; });
  27196. * // => 20
  27197. *
  27198. * // The `_.property` iteratee shorthand.
  27199. * _.sumBy(objects, 'n');
  27200. * // => 20
  27201. */
  27202. function sumBy(array, iteratee) {
  27203. return (array && array.length)
  27204. ? baseSum(array, getIteratee(iteratee, 2))
  27205. : 0;
  27206. }
  27207. /*------------------------------------------------------------------------*/
  27208. // Add methods that return wrapped values in chain sequences.
  27209. lodash.after = after;
  27210. lodash.ary = ary;
  27211. lodash.assign = assign;
  27212. lodash.assignIn = assignIn;
  27213. lodash.assignInWith = assignInWith;
  27214. lodash.assignWith = assignWith;
  27215. lodash.at = at;
  27216. lodash.before = before;
  27217. lodash.bind = bind;
  27218. lodash.bindAll = bindAll;
  27219. lodash.bindKey = bindKey;
  27220. lodash.castArray = castArray;
  27221. lodash.chain = chain;
  27222. lodash.chunk = chunk;
  27223. lodash.compact = compact;
  27224. lodash.concat = concat;
  27225. lodash.cond = cond;
  27226. lodash.conforms = conforms;
  27227. lodash.constant = constant;
  27228. lodash.countBy = countBy;
  27229. lodash.create = create;
  27230. lodash.curry = curry;
  27231. lodash.curryRight = curryRight;
  27232. lodash.debounce = debounce;
  27233. lodash.defaults = defaults;
  27234. lodash.defaultsDeep = defaultsDeep;
  27235. lodash.defer = defer;
  27236. lodash.delay = delay;
  27237. lodash.difference = difference;
  27238. lodash.differenceBy = differenceBy;
  27239. lodash.differenceWith = differenceWith;
  27240. lodash.drop = drop;
  27241. lodash.dropRight = dropRight;
  27242. lodash.dropRightWhile = dropRightWhile;
  27243. lodash.dropWhile = dropWhile;
  27244. lodash.fill = fill;
  27245. lodash.filter = filter;
  27246. lodash.flatMap = flatMap;
  27247. lodash.flatMapDeep = flatMapDeep;
  27248. lodash.flatMapDepth = flatMapDepth;
  27249. lodash.flatten = flatten;
  27250. lodash.flattenDeep = flattenDeep;
  27251. lodash.flattenDepth = flattenDepth;
  27252. lodash.flip = flip;
  27253. lodash.flow = flow;
  27254. lodash.flowRight = flowRight;
  27255. lodash.fromPairs = fromPairs;
  27256. lodash.functions = functions;
  27257. lodash.functionsIn = functionsIn;
  27258. lodash.groupBy = groupBy;
  27259. lodash.initial = initial;
  27260. lodash.intersection = intersection;
  27261. lodash.intersectionBy = intersectionBy;
  27262. lodash.intersectionWith = intersectionWith;
  27263. lodash.invert = invert;
  27264. lodash.invertBy = invertBy;
  27265. lodash.invokeMap = invokeMap;
  27266. lodash.iteratee = iteratee;
  27267. lodash.keyBy = keyBy;
  27268. lodash.keys = keys;
  27269. lodash.keysIn = keysIn;
  27270. lodash.map = map;
  27271. lodash.mapKeys = mapKeys;
  27272. lodash.mapValues = mapValues;
  27273. lodash.matches = matches;
  27274. lodash.matchesProperty = matchesProperty;
  27275. lodash.memoize = memoize;
  27276. lodash.merge = merge;
  27277. lodash.mergeWith = mergeWith;
  27278. lodash.method = method;
  27279. lodash.methodOf = methodOf;
  27280. lodash.mixin = mixin;
  27281. lodash.negate = negate;
  27282. lodash.nthArg = nthArg;
  27283. lodash.omit = omit;
  27284. lodash.omitBy = omitBy;
  27285. lodash.once = once;
  27286. lodash.orderBy = orderBy;
  27287. lodash.over = over;
  27288. lodash.overArgs = overArgs;
  27289. lodash.overEvery = overEvery;
  27290. lodash.overSome = overSome;
  27291. lodash.partial = partial;
  27292. lodash.partialRight = partialRight;
  27293. lodash.partition = partition;
  27294. lodash.pick = pick;
  27295. lodash.pickBy = pickBy;
  27296. lodash.property = property;
  27297. lodash.propertyOf = propertyOf;
  27298. lodash.pull = pull;
  27299. lodash.pullAll = pullAll;
  27300. lodash.pullAllBy = pullAllBy;
  27301. lodash.pullAllWith = pullAllWith;
  27302. lodash.pullAt = pullAt;
  27303. lodash.range = range;
  27304. lodash.rangeRight = rangeRight;
  27305. lodash.rearg = rearg;
  27306. lodash.reject = reject;
  27307. lodash.remove = remove;
  27308. lodash.rest = rest;
  27309. lodash.reverse = reverse;
  27310. lodash.sampleSize = sampleSize;
  27311. lodash.set = set;
  27312. lodash.setWith = setWith;
  27313. lodash.shuffle = shuffle;
  27314. lodash.slice = slice;
  27315. lodash.sortBy = sortBy;
  27316. lodash.sortedUniq = sortedUniq;
  27317. lodash.sortedUniqBy = sortedUniqBy;
  27318. lodash.split = split;
  27319. lodash.spread = spread;
  27320. lodash.tail = tail;
  27321. lodash.take = take;
  27322. lodash.takeRight = takeRight;
  27323. lodash.takeRightWhile = takeRightWhile;
  27324. lodash.takeWhile = takeWhile;
  27325. lodash.tap = tap;
  27326. lodash.throttle = throttle;
  27327. lodash.thru = thru;
  27328. lodash.toArray = toArray;
  27329. lodash.toPairs = toPairs;
  27330. lodash.toPairsIn = toPairsIn;
  27331. lodash.toPath = toPath;
  27332. lodash.toPlainObject = toPlainObject;
  27333. lodash.transform = transform;
  27334. lodash.unary = unary;
  27335. lodash.union = union;
  27336. lodash.unionBy = unionBy;
  27337. lodash.unionWith = unionWith;
  27338. lodash.uniq = uniq;
  27339. lodash.uniqBy = uniqBy;
  27340. lodash.uniqWith = uniqWith;
  27341. lodash.unset = unset;
  27342. lodash.unzip = unzip;
  27343. lodash.unzipWith = unzipWith;
  27344. lodash.update = update;
  27345. lodash.updateWith = updateWith;
  27346. lodash.values = values;
  27347. lodash.valuesIn = valuesIn;
  27348. lodash.without = without;
  27349. lodash.words = words;
  27350. lodash.wrap = wrap;
  27351. lodash.xor = xor;
  27352. lodash.xorBy = xorBy;
  27353. lodash.xorWith = xorWith;
  27354. lodash.zip = zip;
  27355. lodash.zipObject = zipObject;
  27356. lodash.zipObjectDeep = zipObjectDeep;
  27357. lodash.zipWith = zipWith;
  27358. // Add aliases.
  27359. lodash.entries = toPairs;
  27360. lodash.entriesIn = toPairsIn;
  27361. lodash.extend = assignIn;
  27362. lodash.extendWith = assignInWith;
  27363. // Add methods to `lodash.prototype`.
  27364. mixin(lodash, lodash);
  27365. /*------------------------------------------------------------------------*/
  27366. // Add methods that return unwrapped values in chain sequences.
  27367. lodash.add = add;
  27368. lodash.attempt = attempt;
  27369. lodash.camelCase = camelCase;
  27370. lodash.capitalize = capitalize;
  27371. lodash.ceil = ceil;
  27372. lodash.clamp = clamp;
  27373. lodash.clone = clone;
  27374. lodash.cloneDeep = cloneDeep;
  27375. lodash.cloneDeepWith = cloneDeepWith;
  27376. lodash.cloneWith = cloneWith;
  27377. lodash.conformsTo = conformsTo;
  27378. lodash.deburr = deburr;
  27379. lodash.defaultTo = defaultTo;
  27380. lodash.divide = divide;
  27381. lodash.endsWith = endsWith;
  27382. lodash.eq = eq;
  27383. lodash.escape = escape;
  27384. lodash.escapeRegExp = escapeRegExp;
  27385. lodash.every = every;
  27386. lodash.find = find;
  27387. lodash.findIndex = findIndex;
  27388. lodash.findKey = findKey;
  27389. lodash.findLast = findLast;
  27390. lodash.findLastIndex = findLastIndex;
  27391. lodash.findLastKey = findLastKey;
  27392. lodash.floor = floor;
  27393. lodash.forEach = forEach;
  27394. lodash.forEachRight = forEachRight;
  27395. lodash.forIn = forIn;
  27396. lodash.forInRight = forInRight;
  27397. lodash.forOwn = forOwn;
  27398. lodash.forOwnRight = forOwnRight;
  27399. lodash.get = get;
  27400. lodash.gt = gt;
  27401. lodash.gte = gte;
  27402. lodash.has = has;
  27403. lodash.hasIn = hasIn;
  27404. lodash.head = head;
  27405. lodash.identity = identity;
  27406. lodash.includes = includes;
  27407. lodash.indexOf = indexOf;
  27408. lodash.inRange = inRange;
  27409. lodash.invoke = invoke;
  27410. lodash.isArguments = isArguments;
  27411. lodash.isArray = isArray;
  27412. lodash.isArrayBuffer = isArrayBuffer;
  27413. lodash.isArrayLike = isArrayLike;
  27414. lodash.isArrayLikeObject = isArrayLikeObject;
  27415. lodash.isBoolean = isBoolean;
  27416. lodash.isBuffer = isBuffer;
  27417. lodash.isDate = isDate;
  27418. lodash.isElement = isElement;
  27419. lodash.isEmpty = isEmpty;
  27420. lodash.isEqual = isEqual;
  27421. lodash.isEqualWith = isEqualWith;
  27422. lodash.isError = isError;
  27423. lodash.isFinite = isFinite;
  27424. lodash.isFunction = isFunction;
  27425. lodash.isInteger = isInteger;
  27426. lodash.isLength = isLength;
  27427. lodash.isMap = isMap;
  27428. lodash.isMatch = isMatch;
  27429. lodash.isMatchWith = isMatchWith;
  27430. lodash.isNaN = isNaN;
  27431. lodash.isNative = isNative;
  27432. lodash.isNil = isNil;
  27433. lodash.isNull = isNull;
  27434. lodash.isNumber = isNumber;
  27435. lodash.isObject = isObject;
  27436. lodash.isObjectLike = isObjectLike;
  27437. lodash.isPlainObject = isPlainObject;
  27438. lodash.isRegExp = isRegExp;
  27439. lodash.isSafeInteger = isSafeInteger;
  27440. lodash.isSet = isSet;
  27441. lodash.isString = isString;
  27442. lodash.isSymbol = isSymbol;
  27443. lodash.isTypedArray = isTypedArray;
  27444. lodash.isUndefined = isUndefined;
  27445. lodash.isWeakMap = isWeakMap;
  27446. lodash.isWeakSet = isWeakSet;
  27447. lodash.join = join;
  27448. lodash.kebabCase = kebabCase;
  27449. lodash.last = last;
  27450. lodash.lastIndexOf = lastIndexOf;
  27451. lodash.lowerCase = lowerCase;
  27452. lodash.lowerFirst = lowerFirst;
  27453. lodash.lt = lt;
  27454. lodash.lte = lte;
  27455. lodash.max = max;
  27456. lodash.maxBy = maxBy;
  27457. lodash.mean = mean;
  27458. lodash.meanBy = meanBy;
  27459. lodash.min = min;
  27460. lodash.minBy = minBy;
  27461. lodash.stubArray = stubArray;
  27462. lodash.stubFalse = stubFalse;
  27463. lodash.stubObject = stubObject;
  27464. lodash.stubString = stubString;
  27465. lodash.stubTrue = stubTrue;
  27466. lodash.multiply = multiply;
  27467. lodash.nth = nth;
  27468. lodash.noConflict = noConflict;
  27469. lodash.noop = noop;
  27470. lodash.now = now;
  27471. lodash.pad = pad;
  27472. lodash.padEnd = padEnd;
  27473. lodash.padStart = padStart;
  27474. lodash.parseInt = parseInt;
  27475. lodash.random = random;
  27476. lodash.reduce = reduce;
  27477. lodash.reduceRight = reduceRight;
  27478. lodash.repeat = repeat;
  27479. lodash.replace = replace;
  27480. lodash.result = result;
  27481. lodash.round = round;
  27482. lodash.runInContext = runInContext;
  27483. lodash.sample = sample;
  27484. lodash.size = size;
  27485. lodash.snakeCase = snakeCase;
  27486. lodash.some = some;
  27487. lodash.sortedIndex = sortedIndex;
  27488. lodash.sortedIndexBy = sortedIndexBy;
  27489. lodash.sortedIndexOf = sortedIndexOf;
  27490. lodash.sortedLastIndex = sortedLastIndex;
  27491. lodash.sortedLastIndexBy = sortedLastIndexBy;
  27492. lodash.sortedLastIndexOf = sortedLastIndexOf;
  27493. lodash.startCase = startCase;
  27494. lodash.startsWith = startsWith;
  27495. lodash.subtract = subtract;
  27496. lodash.sum = sum;
  27497. lodash.sumBy = sumBy;
  27498. lodash.template = template;
  27499. lodash.times = times;
  27500. lodash.toFinite = toFinite;
  27501. lodash.toInteger = toInteger;
  27502. lodash.toLength = toLength;
  27503. lodash.toLower = toLower;
  27504. lodash.toNumber = toNumber;
  27505. lodash.toSafeInteger = toSafeInteger;
  27506. lodash.toString = toString;
  27507. lodash.toUpper = toUpper;
  27508. lodash.trim = trim;
  27509. lodash.trimEnd = trimEnd;
  27510. lodash.trimStart = trimStart;
  27511. lodash.truncate = truncate;
  27512. lodash.unescape = unescape;
  27513. lodash.uniqueId = uniqueId;
  27514. lodash.upperCase = upperCase;
  27515. lodash.upperFirst = upperFirst;
  27516. // Add aliases.
  27517. lodash.each = forEach;
  27518. lodash.eachRight = forEachRight;
  27519. lodash.first = head;
  27520. mixin(lodash, (function() {
  27521. var source = {};
  27522. baseForOwn(lodash, function(func, methodName) {
  27523. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  27524. source[methodName] = func;
  27525. }
  27526. });
  27527. return source;
  27528. }()), { 'chain': false });
  27529. /*------------------------------------------------------------------------*/
  27530. /**
  27531. * The semantic version number.
  27532. *
  27533. * @static
  27534. * @memberOf _
  27535. * @type {string}
  27536. */
  27537. lodash.VERSION = VERSION;
  27538. // Assign default placeholders.
  27539. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  27540. lodash[methodName].placeholder = lodash;
  27541. });
  27542. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  27543. arrayEach(['drop', 'take'], function(methodName, index) {
  27544. LazyWrapper.prototype[methodName] = function(n) {
  27545. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  27546. var result = (this.__filtered__ && !index)
  27547. ? new LazyWrapper(this)
  27548. : this.clone();
  27549. if (result.__filtered__) {
  27550. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  27551. } else {
  27552. result.__views__.push({
  27553. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  27554. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  27555. });
  27556. }
  27557. return result;
  27558. };
  27559. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  27560. return this.reverse()[methodName](n).reverse();
  27561. };
  27562. });
  27563. // Add `LazyWrapper` methods that accept an `iteratee` value.
  27564. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  27565. var type = index + 1,
  27566. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  27567. LazyWrapper.prototype[methodName] = function(iteratee) {
  27568. var result = this.clone();
  27569. result.__iteratees__.push({
  27570. 'iteratee': getIteratee(iteratee, 3),
  27571. 'type': type
  27572. });
  27573. result.__filtered__ = result.__filtered__ || isFilter;
  27574. return result;
  27575. };
  27576. });
  27577. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  27578. arrayEach(['head', 'last'], function(methodName, index) {
  27579. var takeName = 'take' + (index ? 'Right' : '');
  27580. LazyWrapper.prototype[methodName] = function() {
  27581. return this[takeName](1).value()[0];
  27582. };
  27583. });
  27584. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  27585. arrayEach(['initial', 'tail'], function(methodName, index) {
  27586. var dropName = 'drop' + (index ? '' : 'Right');
  27587. LazyWrapper.prototype[methodName] = function() {
  27588. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  27589. };
  27590. });
  27591. LazyWrapper.prototype.compact = function() {
  27592. return this.filter(identity);
  27593. };
  27594. LazyWrapper.prototype.find = function(predicate) {
  27595. return this.filter(predicate).head();
  27596. };
  27597. LazyWrapper.prototype.findLast = function(predicate) {
  27598. return this.reverse().find(predicate);
  27599. };
  27600. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  27601. if (typeof path == 'function') {
  27602. return new LazyWrapper(this);
  27603. }
  27604. return this.map(function(value) {
  27605. return baseInvoke(value, path, args);
  27606. });
  27607. });
  27608. LazyWrapper.prototype.reject = function(predicate) {
  27609. return this.filter(negate(getIteratee(predicate)));
  27610. };
  27611. LazyWrapper.prototype.slice = function(start, end) {
  27612. start = toInteger(start);
  27613. var result = this;
  27614. if (result.__filtered__ && (start > 0 || end < 0)) {
  27615. return new LazyWrapper(result);
  27616. }
  27617. if (start < 0) {
  27618. result = result.takeRight(-start);
  27619. } else if (start) {
  27620. result = result.drop(start);
  27621. }
  27622. if (end !== undefined) {
  27623. end = toInteger(end);
  27624. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  27625. }
  27626. return result;
  27627. };
  27628. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  27629. return this.reverse().takeWhile(predicate).reverse();
  27630. };
  27631. LazyWrapper.prototype.toArray = function() {
  27632. return this.take(MAX_ARRAY_LENGTH);
  27633. };
  27634. // Add `LazyWrapper` methods to `lodash.prototype`.
  27635. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  27636. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  27637. isTaker = /^(?:head|last)$/.test(methodName),
  27638. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  27639. retUnwrapped = isTaker || /^find/.test(methodName);
  27640. if (!lodashFunc) {
  27641. return;
  27642. }
  27643. lodash.prototype[methodName] = function() {
  27644. var value = this.__wrapped__,
  27645. args = isTaker ? [1] : arguments,
  27646. isLazy = value instanceof LazyWrapper,
  27647. iteratee = args[0],
  27648. useLazy = isLazy || isArray(value);
  27649. var interceptor = function(value) {
  27650. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  27651. return (isTaker && chainAll) ? result[0] : result;
  27652. };
  27653. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  27654. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  27655. isLazy = useLazy = false;
  27656. }
  27657. var chainAll = this.__chain__,
  27658. isHybrid = !!this.__actions__.length,
  27659. isUnwrapped = retUnwrapped && !chainAll,
  27660. onlyLazy = isLazy && !isHybrid;
  27661. if (!retUnwrapped && useLazy) {
  27662. value = onlyLazy ? value : new LazyWrapper(this);
  27663. var result = func.apply(value, args);
  27664. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  27665. return new LodashWrapper(result, chainAll);
  27666. }
  27667. if (isUnwrapped && onlyLazy) {
  27668. return func.apply(this, args);
  27669. }
  27670. result = this.thru(interceptor);
  27671. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  27672. };
  27673. });
  27674. // Add `Array` methods to `lodash.prototype`.
  27675. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  27676. var func = arrayProto[methodName],
  27677. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  27678. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  27679. lodash.prototype[methodName] = function() {
  27680. var args = arguments;
  27681. if (retUnwrapped && !this.__chain__) {
  27682. var value = this.value();
  27683. return func.apply(isArray(value) ? value : [], args);
  27684. }
  27685. return this[chainName](function(value) {
  27686. return func.apply(isArray(value) ? value : [], args);
  27687. });
  27688. };
  27689. });
  27690. // Map minified method names to their real names.
  27691. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  27692. var lodashFunc = lodash[methodName];
  27693. if (lodashFunc) {
  27694. var key = (lodashFunc.name + ''),
  27695. names = realNames[key] || (realNames[key] = []);
  27696. names.push({ 'name': methodName, 'func': lodashFunc });
  27697. }
  27698. });
  27699. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  27700. 'name': 'wrapper',
  27701. 'func': undefined
  27702. }];
  27703. // Add methods to `LazyWrapper`.
  27704. LazyWrapper.prototype.clone = lazyClone;
  27705. LazyWrapper.prototype.reverse = lazyReverse;
  27706. LazyWrapper.prototype.value = lazyValue;
  27707. // Add chain sequence methods to the `lodash` wrapper.
  27708. lodash.prototype.at = wrapperAt;
  27709. lodash.prototype.chain = wrapperChain;
  27710. lodash.prototype.commit = wrapperCommit;
  27711. lodash.prototype.next = wrapperNext;
  27712. lodash.prototype.plant = wrapperPlant;
  27713. lodash.prototype.reverse = wrapperReverse;
  27714. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  27715. // Add lazy aliases.
  27716. lodash.prototype.first = lodash.prototype.head;
  27717. if (symIterator) {
  27718. lodash.prototype[symIterator] = wrapperToIterator;
  27719. }
  27720. return lodash;
  27721. });
  27722. /*--------------------------------------------------------------------------*/
  27723. // Export lodash.
  27724. var _ = runInContext();
  27725. // Some AMD build optimizers, like r.js, check for condition patterns like:
  27726. if (true) {
  27727. // Expose Lodash on the global object to prevent errors when Lodash is
  27728. // loaded by a script tag in the presence of an AMD loader.
  27729. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  27730. // Use `_.noConflict` to remove Lodash from the global object.
  27731. root._ = _;
  27732. // Define as an anonymous module so, through path mapping, it can be
  27733. // referenced as the "underscore" module.
  27734. !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
  27735. return _;
  27736. }.call(exports, __webpack_require__, exports, module),
  27737. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  27738. }
  27739. // Check for `exports` after `define` in case a build optimizer adds it.
  27740. else if (freeModule) {
  27741. // Export for Node.js.
  27742. (freeModule.exports = _)._ = _;
  27743. // Export for CommonJS support.
  27744. freeExports._ = _;
  27745. }
  27746. else {
  27747. // Export to the global object.
  27748. root._ = _;
  27749. }
  27750. }.call(this));
  27751. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9), __webpack_require__(38)(module)))
  27752. /***/ }),
  27753. /* 34 */
  27754. /***/ (function(module, exports, __webpack_require__) {
  27755. var Component = __webpack_require__(35)(
  27756. /* script */
  27757. __webpack_require__(30),
  27758. /* template */
  27759. __webpack_require__(36),
  27760. /* scopeId */
  27761. null,
  27762. /* cssModules */
  27763. null
  27764. )
  27765. Component.options.__file = "D:\\wampserver\\wamp\\www\\GitHub\\framework\\resources\\assets\\js\\components\\Example.vue"
  27766. if (Component.esModule && Object.keys(Component.esModule).some(function (key) {return key !== "default" && key !== "__esModule"})) {console.error("named exports are not supported in *.vue files.")}
  27767. if (Component.options.functional) {console.error("[vue-loader] Example.vue: functional components are not supported with templates, they should use render functions.")}
  27768. /* hot reload */
  27769. if (false) {(function () {
  27770. var hotAPI = require("vue-hot-reload-api")
  27771. hotAPI.install(require("vue"), false)
  27772. if (!hotAPI.compatible) return
  27773. module.hot.accept()
  27774. if (!module.hot.data) {
  27775. hotAPI.createRecord("data-v-0cd61db4", Component.options)
  27776. } else {
  27777. hotAPI.reload("data-v-0cd61db4", Component.options)
  27778. }
  27779. })()}
  27780. module.exports = Component.exports
  27781. /***/ }),
  27782. /* 35 */
  27783. /***/ (function(module, exports) {
  27784. module.exports = function normalizeComponent (
  27785. rawScriptExports,
  27786. compiledTemplate,
  27787. scopeId,
  27788. cssModules
  27789. ) {
  27790. var esModule
  27791. var scriptExports = rawScriptExports = rawScriptExports || {}
  27792. // ES6 modules interop
  27793. var type = typeof rawScriptExports.default
  27794. if (type === 'object' || type === 'function') {
  27795. esModule = rawScriptExports
  27796. scriptExports = rawScriptExports.default
  27797. }
  27798. // Vue.extend constructor export interop
  27799. var options = typeof scriptExports === 'function'
  27800. ? scriptExports.options
  27801. : scriptExports
  27802. // render functions
  27803. if (compiledTemplate) {
  27804. options.render = compiledTemplate.render
  27805. options.staticRenderFns = compiledTemplate.staticRenderFns
  27806. }
  27807. // scopedId
  27808. if (scopeId) {
  27809. options._scopeId = scopeId
  27810. }
  27811. // inject cssModules
  27812. if (cssModules) {
  27813. var computed = options.computed || (options.computed = {})
  27814. Object.keys(cssModules).forEach(function (key) {
  27815. var module = cssModules[key]
  27816. computed[key] = function () { return module }
  27817. })
  27818. }
  27819. return {
  27820. esModule: esModule,
  27821. exports: scriptExports,
  27822. options: options
  27823. }
  27824. }
  27825. /***/ }),
  27826. /* 36 */
  27827. /***/ (function(module, exports, __webpack_require__) {
  27828. module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
  27829. return _vm._m(0)
  27830. },staticRenderFns: [function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
  27831. return _c('div', {
  27832. staticClass: "container"
  27833. }, [_c('div', {
  27834. staticClass: "row"
  27835. }, [_c('div', {
  27836. staticClass: "col-md-8 col-md-offset-2"
  27837. }, [_c('div', {
  27838. staticClass: "panel panel-default"
  27839. }, [_c('div', {
  27840. staticClass: "panel-heading"
  27841. }, [_vm._v("Example Component")]), _vm._v(" "), _c('div', {
  27842. staticClass: "panel-body"
  27843. }, [_vm._v("\n I'm an example component!\n ")])])])])])
  27844. }]}
  27845. module.exports.render._withStripped = true
  27846. if (false) {
  27847. module.hot.accept()
  27848. if (module.hot.data) {
  27849. require("vue-hot-reload-api").rerender("data-v-0cd61db4", module.exports)
  27850. }
  27851. }
  27852. /***/ }),
  27853. /* 37 */
  27854. /***/ (function(module, exports, __webpack_require__) {
  27855. "use strict";
  27856. /* WEBPACK VAR INJECTION */(function(process, global) {/*!
  27857. * Vue.js v2.4.2
  27858. * (c) 2014-2017 Evan You
  27859. * Released under the MIT License.
  27860. */
  27861. /* */
  27862. // these helpers produces better vm code in JS engines due to their
  27863. // explicitness and function inlining
  27864. function isUndef (v) {
  27865. return v === undefined || v === null
  27866. }
  27867. function isDef (v) {
  27868. return v !== undefined && v !== null
  27869. }
  27870. function isTrue (v) {
  27871. return v === true
  27872. }
  27873. function isFalse (v) {
  27874. return v === false
  27875. }
  27876. /**
  27877. * Check if value is primitive
  27878. */
  27879. function isPrimitive (value) {
  27880. return (
  27881. typeof value === 'string' ||
  27882. typeof value === 'number' ||
  27883. typeof value === 'boolean'
  27884. )
  27885. }
  27886. /**
  27887. * Quick object check - this is primarily used to tell
  27888. * Objects from primitive values when we know the value
  27889. * is a JSON-compliant type.
  27890. */
  27891. function isObject (obj) {
  27892. return obj !== null && typeof obj === 'object'
  27893. }
  27894. var _toString = Object.prototype.toString;
  27895. /**
  27896. * Strict object type check. Only returns true
  27897. * for plain JavaScript objects.
  27898. */
  27899. function isPlainObject (obj) {
  27900. return _toString.call(obj) === '[object Object]'
  27901. }
  27902. function isRegExp (v) {
  27903. return _toString.call(v) === '[object RegExp]'
  27904. }
  27905. /**
  27906. * Check if val is a valid array index.
  27907. */
  27908. function isValidArrayIndex (val) {
  27909. var n = parseFloat(val);
  27910. return n >= 0 && Math.floor(n) === n && isFinite(val)
  27911. }
  27912. /**
  27913. * Convert a value to a string that is actually rendered.
  27914. */
  27915. function toString (val) {
  27916. return val == null
  27917. ? ''
  27918. : typeof val === 'object'
  27919. ? JSON.stringify(val, null, 2)
  27920. : String(val)
  27921. }
  27922. /**
  27923. * Convert a input value to a number for persistence.
  27924. * If the conversion fails, return original string.
  27925. */
  27926. function toNumber (val) {
  27927. var n = parseFloat(val);
  27928. return isNaN(n) ? val : n
  27929. }
  27930. /**
  27931. * Make a map and return a function for checking if a key
  27932. * is in that map.
  27933. */
  27934. function makeMap (
  27935. str,
  27936. expectsLowerCase
  27937. ) {
  27938. var map = Object.create(null);
  27939. var list = str.split(',');
  27940. for (var i = 0; i < list.length; i++) {
  27941. map[list[i]] = true;
  27942. }
  27943. return expectsLowerCase
  27944. ? function (val) { return map[val.toLowerCase()]; }
  27945. : function (val) { return map[val]; }
  27946. }
  27947. /**
  27948. * Check if a tag is a built-in tag.
  27949. */
  27950. var isBuiltInTag = makeMap('slot,component', true);
  27951. /**
  27952. * Check if a attribute is a reserved attribute.
  27953. */
  27954. var isReservedAttribute = makeMap('key,ref,slot,is');
  27955. /**
  27956. * Remove an item from an array
  27957. */
  27958. function remove (arr, item) {
  27959. if (arr.length) {
  27960. var index = arr.indexOf(item);
  27961. if (index > -1) {
  27962. return arr.splice(index, 1)
  27963. }
  27964. }
  27965. }
  27966. /**
  27967. * Check whether the object has the property.
  27968. */
  27969. var hasOwnProperty = Object.prototype.hasOwnProperty;
  27970. function hasOwn (obj, key) {
  27971. return hasOwnProperty.call(obj, key)
  27972. }
  27973. /**
  27974. * Create a cached version of a pure function.
  27975. */
  27976. function cached (fn) {
  27977. var cache = Object.create(null);
  27978. return (function cachedFn (str) {
  27979. var hit = cache[str];
  27980. return hit || (cache[str] = fn(str))
  27981. })
  27982. }
  27983. /**
  27984. * Camelize a hyphen-delimited string.
  27985. */
  27986. var camelizeRE = /-(\w)/g;
  27987. var camelize = cached(function (str) {
  27988. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  27989. });
  27990. /**
  27991. * Capitalize a string.
  27992. */
  27993. var capitalize = cached(function (str) {
  27994. return str.charAt(0).toUpperCase() + str.slice(1)
  27995. });
  27996. /**
  27997. * Hyphenate a camelCase string.
  27998. */
  27999. var hyphenateRE = /([^-])([A-Z])/g;
  28000. var hyphenate = cached(function (str) {
  28001. return str
  28002. .replace(hyphenateRE, '$1-$2')
  28003. .replace(hyphenateRE, '$1-$2')
  28004. .toLowerCase()
  28005. });
  28006. /**
  28007. * Simple bind, faster than native
  28008. */
  28009. function bind (fn, ctx) {
  28010. function boundFn (a) {
  28011. var l = arguments.length;
  28012. return l
  28013. ? l > 1
  28014. ? fn.apply(ctx, arguments)
  28015. : fn.call(ctx, a)
  28016. : fn.call(ctx)
  28017. }
  28018. // record original fn length
  28019. boundFn._length = fn.length;
  28020. return boundFn
  28021. }
  28022. /**
  28023. * Convert an Array-like object to a real Array.
  28024. */
  28025. function toArray (list, start) {
  28026. start = start || 0;
  28027. var i = list.length - start;
  28028. var ret = new Array(i);
  28029. while (i--) {
  28030. ret[i] = list[i + start];
  28031. }
  28032. return ret
  28033. }
  28034. /**
  28035. * Mix properties into target object.
  28036. */
  28037. function extend (to, _from) {
  28038. for (var key in _from) {
  28039. to[key] = _from[key];
  28040. }
  28041. return to
  28042. }
  28043. /**
  28044. * Merge an Array of Objects into a single Object.
  28045. */
  28046. function toObject (arr) {
  28047. var res = {};
  28048. for (var i = 0; i < arr.length; i++) {
  28049. if (arr[i]) {
  28050. extend(res, arr[i]);
  28051. }
  28052. }
  28053. return res
  28054. }
  28055. /**
  28056. * Perform no operation.
  28057. * Stubbing args to make Flow happy without leaving useless transpiled code
  28058. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
  28059. */
  28060. function noop (a, b, c) {}
  28061. /**
  28062. * Always return false.
  28063. */
  28064. var no = function (a, b, c) { return false; };
  28065. /**
  28066. * Return same value
  28067. */
  28068. var identity = function (_) { return _; };
  28069. /**
  28070. * Generate a static keys string from compiler modules.
  28071. */
  28072. function genStaticKeys (modules) {
  28073. return modules.reduce(function (keys, m) {
  28074. return keys.concat(m.staticKeys || [])
  28075. }, []).join(',')
  28076. }
  28077. /**
  28078. * Check if two values are loosely equal - that is,
  28079. * if they are plain objects, do they have the same shape?
  28080. */
  28081. function looseEqual (a, b) {
  28082. if (a === b) { return true }
  28083. var isObjectA = isObject(a);
  28084. var isObjectB = isObject(b);
  28085. if (isObjectA && isObjectB) {
  28086. try {
  28087. var isArrayA = Array.isArray(a);
  28088. var isArrayB = Array.isArray(b);
  28089. if (isArrayA && isArrayB) {
  28090. return a.length === b.length && a.every(function (e, i) {
  28091. return looseEqual(e, b[i])
  28092. })
  28093. } else if (!isArrayA && !isArrayB) {
  28094. var keysA = Object.keys(a);
  28095. var keysB = Object.keys(b);
  28096. return keysA.length === keysB.length && keysA.every(function (key) {
  28097. return looseEqual(a[key], b[key])
  28098. })
  28099. } else {
  28100. /* istanbul ignore next */
  28101. return false
  28102. }
  28103. } catch (e) {
  28104. /* istanbul ignore next */
  28105. return false
  28106. }
  28107. } else if (!isObjectA && !isObjectB) {
  28108. return String(a) === String(b)
  28109. } else {
  28110. return false
  28111. }
  28112. }
  28113. function looseIndexOf (arr, val) {
  28114. for (var i = 0; i < arr.length; i++) {
  28115. if (looseEqual(arr[i], val)) { return i }
  28116. }
  28117. return -1
  28118. }
  28119. /**
  28120. * Ensure a function is called only once.
  28121. */
  28122. function once (fn) {
  28123. var called = false;
  28124. return function () {
  28125. if (!called) {
  28126. called = true;
  28127. fn.apply(this, arguments);
  28128. }
  28129. }
  28130. }
  28131. var SSR_ATTR = 'data-server-rendered';
  28132. var ASSET_TYPES = [
  28133. 'component',
  28134. 'directive',
  28135. 'filter'
  28136. ];
  28137. var LIFECYCLE_HOOKS = [
  28138. 'beforeCreate',
  28139. 'created',
  28140. 'beforeMount',
  28141. 'mounted',
  28142. 'beforeUpdate',
  28143. 'updated',
  28144. 'beforeDestroy',
  28145. 'destroyed',
  28146. 'activated',
  28147. 'deactivated'
  28148. ];
  28149. /* */
  28150. var config = ({
  28151. /**
  28152. * Option merge strategies (used in core/util/options)
  28153. */
  28154. optionMergeStrategies: Object.create(null),
  28155. /**
  28156. * Whether to suppress warnings.
  28157. */
  28158. silent: false,
  28159. /**
  28160. * Show production mode tip message on boot?
  28161. */
  28162. productionTip: process.env.NODE_ENV !== 'production',
  28163. /**
  28164. * Whether to enable devtools
  28165. */
  28166. devtools: process.env.NODE_ENV !== 'production',
  28167. /**
  28168. * Whether to record perf
  28169. */
  28170. performance: false,
  28171. /**
  28172. * Error handler for watcher errors
  28173. */
  28174. errorHandler: null,
  28175. /**
  28176. * Warn handler for watcher warns
  28177. */
  28178. warnHandler: null,
  28179. /**
  28180. * Ignore certain custom elements
  28181. */
  28182. ignoredElements: [],
  28183. /**
  28184. * Custom user key aliases for v-on
  28185. */
  28186. keyCodes: Object.create(null),
  28187. /**
  28188. * Check if a tag is reserved so that it cannot be registered as a
  28189. * component. This is platform-dependent and may be overwritten.
  28190. */
  28191. isReservedTag: no,
  28192. /**
  28193. * Check if an attribute is reserved so that it cannot be used as a component
  28194. * prop. This is platform-dependent and may be overwritten.
  28195. */
  28196. isReservedAttr: no,
  28197. /**
  28198. * Check if a tag is an unknown element.
  28199. * Platform-dependent.
  28200. */
  28201. isUnknownElement: no,
  28202. /**
  28203. * Get the namespace of an element
  28204. */
  28205. getTagNamespace: noop,
  28206. /**
  28207. * Parse the real tag name for the specific platform.
  28208. */
  28209. parsePlatformTagName: identity,
  28210. /**
  28211. * Check if an attribute must be bound using property, e.g. value
  28212. * Platform-dependent.
  28213. */
  28214. mustUseProp: no,
  28215. /**
  28216. * Exposed for legacy reasons
  28217. */
  28218. _lifecycleHooks: LIFECYCLE_HOOKS
  28219. });
  28220. /* */
  28221. var emptyObject = Object.freeze({});
  28222. /**
  28223. * Check if a string starts with $ or _
  28224. */
  28225. function isReserved (str) {
  28226. var c = (str + '').charCodeAt(0);
  28227. return c === 0x24 || c === 0x5F
  28228. }
  28229. /**
  28230. * Define a property.
  28231. */
  28232. function def (obj, key, val, enumerable) {
  28233. Object.defineProperty(obj, key, {
  28234. value: val,
  28235. enumerable: !!enumerable,
  28236. writable: true,
  28237. configurable: true
  28238. });
  28239. }
  28240. /**
  28241. * Parse simple path.
  28242. */
  28243. var bailRE = /[^\w.$]/;
  28244. function parsePath (path) {
  28245. if (bailRE.test(path)) {
  28246. return
  28247. }
  28248. var segments = path.split('.');
  28249. return function (obj) {
  28250. for (var i = 0; i < segments.length; i++) {
  28251. if (!obj) { return }
  28252. obj = obj[segments[i]];
  28253. }
  28254. return obj
  28255. }
  28256. }
  28257. /* */
  28258. var warn = noop;
  28259. var tip = noop;
  28260. var formatComponentName = (null); // work around flow check
  28261. if (process.env.NODE_ENV !== 'production') {
  28262. var hasConsole = typeof console !== 'undefined';
  28263. var classifyRE = /(?:^|[-_])(\w)/g;
  28264. var classify = function (str) { return str
  28265. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  28266. .replace(/[-_]/g, ''); };
  28267. warn = function (msg, vm) {
  28268. var trace = vm ? generateComponentTrace(vm) : '';
  28269. if (config.warnHandler) {
  28270. config.warnHandler.call(null, msg, vm, trace);
  28271. } else if (hasConsole && (!config.silent)) {
  28272. console.error(("[Vue warn]: " + msg + trace));
  28273. }
  28274. };
  28275. tip = function (msg, vm) {
  28276. if (hasConsole && (!config.silent)) {
  28277. console.warn("[Vue tip]: " + msg + (
  28278. vm ? generateComponentTrace(vm) : ''
  28279. ));
  28280. }
  28281. };
  28282. formatComponentName = function (vm, includeFile) {
  28283. if (vm.$root === vm) {
  28284. return '<Root>'
  28285. }
  28286. var name = typeof vm === 'string'
  28287. ? vm
  28288. : typeof vm === 'function' && vm.options
  28289. ? vm.options.name
  28290. : vm._isVue
  28291. ? vm.$options.name || vm.$options._componentTag
  28292. : vm.name;
  28293. var file = vm._isVue && vm.$options.__file;
  28294. if (!name && file) {
  28295. var match = file.match(/([^/\\]+)\.vue$/);
  28296. name = match && match[1];
  28297. }
  28298. return (
  28299. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  28300. (file && includeFile !== false ? (" at " + file) : '')
  28301. )
  28302. };
  28303. var repeat = function (str, n) {
  28304. var res = '';
  28305. while (n) {
  28306. if (n % 2 === 1) { res += str; }
  28307. if (n > 1) { str += str; }
  28308. n >>= 1;
  28309. }
  28310. return res
  28311. };
  28312. var generateComponentTrace = function (vm) {
  28313. if (vm._isVue && vm.$parent) {
  28314. var tree = [];
  28315. var currentRecursiveSequence = 0;
  28316. while (vm) {
  28317. if (tree.length > 0) {
  28318. var last = tree[tree.length - 1];
  28319. if (last.constructor === vm.constructor) {
  28320. currentRecursiveSequence++;
  28321. vm = vm.$parent;
  28322. continue
  28323. } else if (currentRecursiveSequence > 0) {
  28324. tree[tree.length - 1] = [last, currentRecursiveSequence];
  28325. currentRecursiveSequence = 0;
  28326. }
  28327. }
  28328. tree.push(vm);
  28329. vm = vm.$parent;
  28330. }
  28331. return '\n\nfound in\n\n' + tree
  28332. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  28333. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  28334. : formatComponentName(vm))); })
  28335. .join('\n')
  28336. } else {
  28337. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  28338. }
  28339. };
  28340. }
  28341. /* */
  28342. function handleError (err, vm, info) {
  28343. if (config.errorHandler) {
  28344. config.errorHandler.call(null, err, vm, info);
  28345. } else {
  28346. if (process.env.NODE_ENV !== 'production') {
  28347. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  28348. }
  28349. /* istanbul ignore else */
  28350. if (inBrowser && typeof console !== 'undefined') {
  28351. console.error(err);
  28352. } else {
  28353. throw err
  28354. }
  28355. }
  28356. }
  28357. /* */
  28358. /* globals MutationObserver */
  28359. // can we use __proto__?
  28360. var hasProto = '__proto__' in {};
  28361. // Browser environment sniffing
  28362. var inBrowser = typeof window !== 'undefined';
  28363. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  28364. var isIE = UA && /msie|trident/.test(UA);
  28365. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  28366. var isEdge = UA && UA.indexOf('edge/') > 0;
  28367. var isAndroid = UA && UA.indexOf('android') > 0;
  28368. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  28369. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  28370. // Firefix has a "watch" function on Object.prototype...
  28371. var nativeWatch = ({}).watch;
  28372. var supportsPassive = false;
  28373. if (inBrowser) {
  28374. try {
  28375. var opts = {};
  28376. Object.defineProperty(opts, 'passive', ({
  28377. get: function get () {
  28378. /* istanbul ignore next */
  28379. supportsPassive = true;
  28380. }
  28381. })); // https://github.com/facebook/flow/issues/285
  28382. window.addEventListener('test-passive', null, opts);
  28383. } catch (e) {}
  28384. }
  28385. // this needs to be lazy-evaled because vue may be required before
  28386. // vue-server-renderer can set VUE_ENV
  28387. var _isServer;
  28388. var isServerRendering = function () {
  28389. if (_isServer === undefined) {
  28390. /* istanbul ignore if */
  28391. if (!inBrowser && typeof global !== 'undefined') {
  28392. // detect presence of vue-server-renderer and avoid
  28393. // Webpack shimming the process
  28394. _isServer = global['process'].env.VUE_ENV === 'server';
  28395. } else {
  28396. _isServer = false;
  28397. }
  28398. }
  28399. return _isServer
  28400. };
  28401. // detect devtools
  28402. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  28403. /* istanbul ignore next */
  28404. function isNative (Ctor) {
  28405. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  28406. }
  28407. var hasSymbol =
  28408. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  28409. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  28410. /**
  28411. * Defer a task to execute it asynchronously.
  28412. */
  28413. var nextTick = (function () {
  28414. var callbacks = [];
  28415. var pending = false;
  28416. var timerFunc;
  28417. function nextTickHandler () {
  28418. pending = false;
  28419. var copies = callbacks.slice(0);
  28420. callbacks.length = 0;
  28421. for (var i = 0; i < copies.length; i++) {
  28422. copies[i]();
  28423. }
  28424. }
  28425. // the nextTick behavior leverages the microtask queue, which can be accessed
  28426. // via either native Promise.then or MutationObserver.
  28427. // MutationObserver has wider support, however it is seriously bugged in
  28428. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  28429. // completely stops working after triggering a few times... so, if native
  28430. // Promise is available, we will use it:
  28431. /* istanbul ignore if */
  28432. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  28433. var p = Promise.resolve();
  28434. var logError = function (err) { console.error(err); };
  28435. timerFunc = function () {
  28436. p.then(nextTickHandler).catch(logError);
  28437. // in problematic UIWebViews, Promise.then doesn't completely break, but
  28438. // it can get stuck in a weird state where callbacks are pushed into the
  28439. // microtask queue but the queue isn't being flushed, until the browser
  28440. // needs to do some other work, e.g. handle a timer. Therefore we can
  28441. // "force" the microtask queue to be flushed by adding an empty timer.
  28442. if (isIOS) { setTimeout(noop); }
  28443. };
  28444. } else if (typeof MutationObserver !== 'undefined' && (
  28445. isNative(MutationObserver) ||
  28446. // PhantomJS and iOS 7.x
  28447. MutationObserver.toString() === '[object MutationObserverConstructor]'
  28448. )) {
  28449. // use MutationObserver where native Promise is not available,
  28450. // e.g. PhantomJS IE11, iOS7, Android 4.4
  28451. var counter = 1;
  28452. var observer = new MutationObserver(nextTickHandler);
  28453. var textNode = document.createTextNode(String(counter));
  28454. observer.observe(textNode, {
  28455. characterData: true
  28456. });
  28457. timerFunc = function () {
  28458. counter = (counter + 1) % 2;
  28459. textNode.data = String(counter);
  28460. };
  28461. } else {
  28462. // fallback to setTimeout
  28463. /* istanbul ignore next */
  28464. timerFunc = function () {
  28465. setTimeout(nextTickHandler, 0);
  28466. };
  28467. }
  28468. return function queueNextTick (cb, ctx) {
  28469. var _resolve;
  28470. callbacks.push(function () {
  28471. if (cb) {
  28472. try {
  28473. cb.call(ctx);
  28474. } catch (e) {
  28475. handleError(e, ctx, 'nextTick');
  28476. }
  28477. } else if (_resolve) {
  28478. _resolve(ctx);
  28479. }
  28480. });
  28481. if (!pending) {
  28482. pending = true;
  28483. timerFunc();
  28484. }
  28485. if (!cb && typeof Promise !== 'undefined') {
  28486. return new Promise(function (resolve, reject) {
  28487. _resolve = resolve;
  28488. })
  28489. }
  28490. }
  28491. })();
  28492. var _Set;
  28493. /* istanbul ignore if */
  28494. if (typeof Set !== 'undefined' && isNative(Set)) {
  28495. // use native Set when available.
  28496. _Set = Set;
  28497. } else {
  28498. // a non-standard Set polyfill that only works with primitive keys.
  28499. _Set = (function () {
  28500. function Set () {
  28501. this.set = Object.create(null);
  28502. }
  28503. Set.prototype.has = function has (key) {
  28504. return this.set[key] === true
  28505. };
  28506. Set.prototype.add = function add (key) {
  28507. this.set[key] = true;
  28508. };
  28509. Set.prototype.clear = function clear () {
  28510. this.set = Object.create(null);
  28511. };
  28512. return Set;
  28513. }());
  28514. }
  28515. /* */
  28516. var uid = 0;
  28517. /**
  28518. * A dep is an observable that can have multiple
  28519. * directives subscribing to it.
  28520. */
  28521. var Dep = function Dep () {
  28522. this.id = uid++;
  28523. this.subs = [];
  28524. };
  28525. Dep.prototype.addSub = function addSub (sub) {
  28526. this.subs.push(sub);
  28527. };
  28528. Dep.prototype.removeSub = function removeSub (sub) {
  28529. remove(this.subs, sub);
  28530. };
  28531. Dep.prototype.depend = function depend () {
  28532. if (Dep.target) {
  28533. Dep.target.addDep(this);
  28534. }
  28535. };
  28536. Dep.prototype.notify = function notify () {
  28537. // stabilize the subscriber list first
  28538. var subs = this.subs.slice();
  28539. for (var i = 0, l = subs.length; i < l; i++) {
  28540. subs[i].update();
  28541. }
  28542. };
  28543. // the current target watcher being evaluated.
  28544. // this is globally unique because there could be only one
  28545. // watcher being evaluated at any time.
  28546. Dep.target = null;
  28547. var targetStack = [];
  28548. function pushTarget (_target) {
  28549. if (Dep.target) { targetStack.push(Dep.target); }
  28550. Dep.target = _target;
  28551. }
  28552. function popTarget () {
  28553. Dep.target = targetStack.pop();
  28554. }
  28555. /*
  28556. * not type checking this file because flow doesn't play well with
  28557. * dynamically accessing methods on Array prototype
  28558. */
  28559. var arrayProto = Array.prototype;
  28560. var arrayMethods = Object.create(arrayProto);[
  28561. 'push',
  28562. 'pop',
  28563. 'shift',
  28564. 'unshift',
  28565. 'splice',
  28566. 'sort',
  28567. 'reverse'
  28568. ]
  28569. .forEach(function (method) {
  28570. // cache original method
  28571. var original = arrayProto[method];
  28572. def(arrayMethods, method, function mutator () {
  28573. var args = [], len = arguments.length;
  28574. while ( len-- ) args[ len ] = arguments[ len ];
  28575. var result = original.apply(this, args);
  28576. var ob = this.__ob__;
  28577. var inserted;
  28578. switch (method) {
  28579. case 'push':
  28580. case 'unshift':
  28581. inserted = args;
  28582. break
  28583. case 'splice':
  28584. inserted = args.slice(2);
  28585. break
  28586. }
  28587. if (inserted) { ob.observeArray(inserted); }
  28588. // notify change
  28589. ob.dep.notify();
  28590. return result
  28591. });
  28592. });
  28593. /* */
  28594. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  28595. /**
  28596. * By default, when a reactive property is set, the new value is
  28597. * also converted to become reactive. However when passing down props,
  28598. * we don't want to force conversion because the value may be a nested value
  28599. * under a frozen data structure. Converting it would defeat the optimization.
  28600. */
  28601. var observerState = {
  28602. shouldConvert: true
  28603. };
  28604. /**
  28605. * Observer class that are attached to each observed
  28606. * object. Once attached, the observer converts target
  28607. * object's property keys into getter/setters that
  28608. * collect dependencies and dispatches updates.
  28609. */
  28610. var Observer = function Observer (value) {
  28611. this.value = value;
  28612. this.dep = new Dep();
  28613. this.vmCount = 0;
  28614. def(value, '__ob__', this);
  28615. if (Array.isArray(value)) {
  28616. var augment = hasProto
  28617. ? protoAugment
  28618. : copyAugment;
  28619. augment(value, arrayMethods, arrayKeys);
  28620. this.observeArray(value);
  28621. } else {
  28622. this.walk(value);
  28623. }
  28624. };
  28625. /**
  28626. * Walk through each property and convert them into
  28627. * getter/setters. This method should only be called when
  28628. * value type is Object.
  28629. */
  28630. Observer.prototype.walk = function walk (obj) {
  28631. var keys = Object.keys(obj);
  28632. for (var i = 0; i < keys.length; i++) {
  28633. defineReactive$$1(obj, keys[i], obj[keys[i]]);
  28634. }
  28635. };
  28636. /**
  28637. * Observe a list of Array items.
  28638. */
  28639. Observer.prototype.observeArray = function observeArray (items) {
  28640. for (var i = 0, l = items.length; i < l; i++) {
  28641. observe(items[i]);
  28642. }
  28643. };
  28644. // helpers
  28645. /**
  28646. * Augment an target Object or Array by intercepting
  28647. * the prototype chain using __proto__
  28648. */
  28649. function protoAugment (target, src, keys) {
  28650. /* eslint-disable no-proto */
  28651. target.__proto__ = src;
  28652. /* eslint-enable no-proto */
  28653. }
  28654. /**
  28655. * Augment an target Object or Array by defining
  28656. * hidden properties.
  28657. */
  28658. /* istanbul ignore next */
  28659. function copyAugment (target, src, keys) {
  28660. for (var i = 0, l = keys.length; i < l; i++) {
  28661. var key = keys[i];
  28662. def(target, key, src[key]);
  28663. }
  28664. }
  28665. /**
  28666. * Attempt to create an observer instance for a value,
  28667. * returns the new observer if successfully observed,
  28668. * or the existing observer if the value already has one.
  28669. */
  28670. function observe (value, asRootData) {
  28671. if (!isObject(value)) {
  28672. return
  28673. }
  28674. var ob;
  28675. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  28676. ob = value.__ob__;
  28677. } else if (
  28678. observerState.shouldConvert &&
  28679. !isServerRendering() &&
  28680. (Array.isArray(value) || isPlainObject(value)) &&
  28681. Object.isExtensible(value) &&
  28682. !value._isVue
  28683. ) {
  28684. ob = new Observer(value);
  28685. }
  28686. if (asRootData && ob) {
  28687. ob.vmCount++;
  28688. }
  28689. return ob
  28690. }
  28691. /**
  28692. * Define a reactive property on an Object.
  28693. */
  28694. function defineReactive$$1 (
  28695. obj,
  28696. key,
  28697. val,
  28698. customSetter,
  28699. shallow
  28700. ) {
  28701. var dep = new Dep();
  28702. var property = Object.getOwnPropertyDescriptor(obj, key);
  28703. if (property && property.configurable === false) {
  28704. return
  28705. }
  28706. // cater for pre-defined getter/setters
  28707. var getter = property && property.get;
  28708. var setter = property && property.set;
  28709. var childOb = !shallow && observe(val);
  28710. Object.defineProperty(obj, key, {
  28711. enumerable: true,
  28712. configurable: true,
  28713. get: function reactiveGetter () {
  28714. var value = getter ? getter.call(obj) : val;
  28715. if (Dep.target) {
  28716. dep.depend();
  28717. if (childOb) {
  28718. childOb.dep.depend();
  28719. }
  28720. if (Array.isArray(value)) {
  28721. dependArray(value);
  28722. }
  28723. }
  28724. return value
  28725. },
  28726. set: function reactiveSetter (newVal) {
  28727. var value = getter ? getter.call(obj) : val;
  28728. /* eslint-disable no-self-compare */
  28729. if (newVal === value || (newVal !== newVal && value !== value)) {
  28730. return
  28731. }
  28732. /* eslint-enable no-self-compare */
  28733. if (process.env.NODE_ENV !== 'production' && customSetter) {
  28734. customSetter();
  28735. }
  28736. if (setter) {
  28737. setter.call(obj, newVal);
  28738. } else {
  28739. val = newVal;
  28740. }
  28741. childOb = !shallow && observe(newVal);
  28742. dep.notify();
  28743. }
  28744. });
  28745. }
  28746. /**
  28747. * Set a property on an object. Adds the new property and
  28748. * triggers change notification if the property doesn't
  28749. * already exist.
  28750. */
  28751. function set (target, key, val) {
  28752. if (Array.isArray(target) && isValidArrayIndex(key)) {
  28753. target.length = Math.max(target.length, key);
  28754. target.splice(key, 1, val);
  28755. return val
  28756. }
  28757. if (hasOwn(target, key)) {
  28758. target[key] = val;
  28759. return val
  28760. }
  28761. var ob = (target).__ob__;
  28762. if (target._isVue || (ob && ob.vmCount)) {
  28763. process.env.NODE_ENV !== 'production' && warn(
  28764. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  28765. 'at runtime - declare it upfront in the data option.'
  28766. );
  28767. return val
  28768. }
  28769. if (!ob) {
  28770. target[key] = val;
  28771. return val
  28772. }
  28773. defineReactive$$1(ob.value, key, val);
  28774. ob.dep.notify();
  28775. return val
  28776. }
  28777. /**
  28778. * Delete a property and trigger change if necessary.
  28779. */
  28780. function del (target, key) {
  28781. if (Array.isArray(target) && isValidArrayIndex(key)) {
  28782. target.splice(key, 1);
  28783. return
  28784. }
  28785. var ob = (target).__ob__;
  28786. if (target._isVue || (ob && ob.vmCount)) {
  28787. process.env.NODE_ENV !== 'production' && warn(
  28788. 'Avoid deleting properties on a Vue instance or its root $data ' +
  28789. '- just set it to null.'
  28790. );
  28791. return
  28792. }
  28793. if (!hasOwn(target, key)) {
  28794. return
  28795. }
  28796. delete target[key];
  28797. if (!ob) {
  28798. return
  28799. }
  28800. ob.dep.notify();
  28801. }
  28802. /**
  28803. * Collect dependencies on array elements when the array is touched, since
  28804. * we cannot intercept array element access like property getters.
  28805. */
  28806. function dependArray (value) {
  28807. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  28808. e = value[i];
  28809. e && e.__ob__ && e.__ob__.dep.depend();
  28810. if (Array.isArray(e)) {
  28811. dependArray(e);
  28812. }
  28813. }
  28814. }
  28815. /* */
  28816. /**
  28817. * Option overwriting strategies are functions that handle
  28818. * how to merge a parent option value and a child option
  28819. * value into the final value.
  28820. */
  28821. var strats = config.optionMergeStrategies;
  28822. /**
  28823. * Options with restrictions
  28824. */
  28825. if (process.env.NODE_ENV !== 'production') {
  28826. strats.el = strats.propsData = function (parent, child, vm, key) {
  28827. if (!vm) {
  28828. warn(
  28829. "option \"" + key + "\" can only be used during instance " +
  28830. 'creation with the `new` keyword.'
  28831. );
  28832. }
  28833. return defaultStrat(parent, child)
  28834. };
  28835. }
  28836. /**
  28837. * Helper that recursively merges two data objects together.
  28838. */
  28839. function mergeData (to, from) {
  28840. if (!from) { return to }
  28841. var key, toVal, fromVal;
  28842. var keys = Object.keys(from);
  28843. for (var i = 0; i < keys.length; i++) {
  28844. key = keys[i];
  28845. toVal = to[key];
  28846. fromVal = from[key];
  28847. if (!hasOwn(to, key)) {
  28848. set(to, key, fromVal);
  28849. } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
  28850. mergeData(toVal, fromVal);
  28851. }
  28852. }
  28853. return to
  28854. }
  28855. /**
  28856. * Data
  28857. */
  28858. function mergeDataOrFn (
  28859. parentVal,
  28860. childVal,
  28861. vm
  28862. ) {
  28863. if (!vm) {
  28864. // in a Vue.extend merge, both should be functions
  28865. if (!childVal) {
  28866. return parentVal
  28867. }
  28868. if (!parentVal) {
  28869. return childVal
  28870. }
  28871. // when parentVal & childVal are both present,
  28872. // we need to return a function that returns the
  28873. // merged result of both functions... no need to
  28874. // check if parentVal is a function here because
  28875. // it has to be a function to pass previous merges.
  28876. return function mergedDataFn () {
  28877. return mergeData(
  28878. typeof childVal === 'function' ? childVal.call(this) : childVal,
  28879. typeof parentVal === 'function' ? parentVal.call(this) : parentVal
  28880. )
  28881. }
  28882. } else if (parentVal || childVal) {
  28883. return function mergedInstanceDataFn () {
  28884. // instance merge
  28885. var instanceData = typeof childVal === 'function'
  28886. ? childVal.call(vm)
  28887. : childVal;
  28888. var defaultData = typeof parentVal === 'function'
  28889. ? parentVal.call(vm)
  28890. : undefined;
  28891. if (instanceData) {
  28892. return mergeData(instanceData, defaultData)
  28893. } else {
  28894. return defaultData
  28895. }
  28896. }
  28897. }
  28898. }
  28899. strats.data = function (
  28900. parentVal,
  28901. childVal,
  28902. vm
  28903. ) {
  28904. if (!vm) {
  28905. if (childVal && typeof childVal !== 'function') {
  28906. process.env.NODE_ENV !== 'production' && warn(
  28907. 'The "data" option should be a function ' +
  28908. 'that returns a per-instance value in component ' +
  28909. 'definitions.',
  28910. vm
  28911. );
  28912. return parentVal
  28913. }
  28914. return mergeDataOrFn.call(this, parentVal, childVal)
  28915. }
  28916. return mergeDataOrFn(parentVal, childVal, vm)
  28917. };
  28918. /**
  28919. * Hooks and props are merged as arrays.
  28920. */
  28921. function mergeHook (
  28922. parentVal,
  28923. childVal
  28924. ) {
  28925. return childVal
  28926. ? parentVal
  28927. ? parentVal.concat(childVal)
  28928. : Array.isArray(childVal)
  28929. ? childVal
  28930. : [childVal]
  28931. : parentVal
  28932. }
  28933. LIFECYCLE_HOOKS.forEach(function (hook) {
  28934. strats[hook] = mergeHook;
  28935. });
  28936. /**
  28937. * Assets
  28938. *
  28939. * When a vm is present (instance creation), we need to do
  28940. * a three-way merge between constructor options, instance
  28941. * options and parent options.
  28942. */
  28943. function mergeAssets (parentVal, childVal) {
  28944. var res = Object.create(parentVal || null);
  28945. return childVal
  28946. ? extend(res, childVal)
  28947. : res
  28948. }
  28949. ASSET_TYPES.forEach(function (type) {
  28950. strats[type + 's'] = mergeAssets;
  28951. });
  28952. /**
  28953. * Watchers.
  28954. *
  28955. * Watchers hashes should not overwrite one
  28956. * another, so we merge them as arrays.
  28957. */
  28958. strats.watch = function (parentVal, childVal) {
  28959. // work around Firefox's Object.prototype.watch...
  28960. if (parentVal === nativeWatch) { parentVal = undefined; }
  28961. if (childVal === nativeWatch) { childVal = undefined; }
  28962. /* istanbul ignore if */
  28963. if (!childVal) { return Object.create(parentVal || null) }
  28964. if (!parentVal) { return childVal }
  28965. var ret = {};
  28966. extend(ret, parentVal);
  28967. for (var key in childVal) {
  28968. var parent = ret[key];
  28969. var child = childVal[key];
  28970. if (parent && !Array.isArray(parent)) {
  28971. parent = [parent];
  28972. }
  28973. ret[key] = parent
  28974. ? parent.concat(child)
  28975. : Array.isArray(child) ? child : [child];
  28976. }
  28977. return ret
  28978. };
  28979. /**
  28980. * Other object hashes.
  28981. */
  28982. strats.props =
  28983. strats.methods =
  28984. strats.inject =
  28985. strats.computed = function (parentVal, childVal) {
  28986. if (!parentVal) { return childVal }
  28987. var ret = Object.create(null);
  28988. extend(ret, parentVal);
  28989. if (childVal) { extend(ret, childVal); }
  28990. return ret
  28991. };
  28992. strats.provide = mergeDataOrFn;
  28993. /**
  28994. * Default strategy.
  28995. */
  28996. var defaultStrat = function (parentVal, childVal) {
  28997. return childVal === undefined
  28998. ? parentVal
  28999. : childVal
  29000. };
  29001. /**
  29002. * Validate component names
  29003. */
  29004. function checkComponents (options) {
  29005. for (var key in options.components) {
  29006. var lower = key.toLowerCase();
  29007. if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
  29008. warn(
  29009. 'Do not use built-in or reserved HTML elements as component ' +
  29010. 'id: ' + key
  29011. );
  29012. }
  29013. }
  29014. }
  29015. /**
  29016. * Ensure all props option syntax are normalized into the
  29017. * Object-based format.
  29018. */
  29019. function normalizeProps (options) {
  29020. var props = options.props;
  29021. if (!props) { return }
  29022. var res = {};
  29023. var i, val, name;
  29024. if (Array.isArray(props)) {
  29025. i = props.length;
  29026. while (i--) {
  29027. val = props[i];
  29028. if (typeof val === 'string') {
  29029. name = camelize(val);
  29030. res[name] = { type: null };
  29031. } else if (process.env.NODE_ENV !== 'production') {
  29032. warn('props must be strings when using array syntax.');
  29033. }
  29034. }
  29035. } else if (isPlainObject(props)) {
  29036. for (var key in props) {
  29037. val = props[key];
  29038. name = camelize(key);
  29039. res[name] = isPlainObject(val)
  29040. ? val
  29041. : { type: val };
  29042. }
  29043. }
  29044. options.props = res;
  29045. }
  29046. /**
  29047. * Normalize all injections into Object-based format
  29048. */
  29049. function normalizeInject (options) {
  29050. var inject = options.inject;
  29051. if (Array.isArray(inject)) {
  29052. var normalized = options.inject = {};
  29053. for (var i = 0; i < inject.length; i++) {
  29054. normalized[inject[i]] = inject[i];
  29055. }
  29056. }
  29057. }
  29058. /**
  29059. * Normalize raw function directives into object format.
  29060. */
  29061. function normalizeDirectives (options) {
  29062. var dirs = options.directives;
  29063. if (dirs) {
  29064. for (var key in dirs) {
  29065. var def = dirs[key];
  29066. if (typeof def === 'function') {
  29067. dirs[key] = { bind: def, update: def };
  29068. }
  29069. }
  29070. }
  29071. }
  29072. /**
  29073. * Merge two option objects into a new one.
  29074. * Core utility used in both instantiation and inheritance.
  29075. */
  29076. function mergeOptions (
  29077. parent,
  29078. child,
  29079. vm
  29080. ) {
  29081. if (process.env.NODE_ENV !== 'production') {
  29082. checkComponents(child);
  29083. }
  29084. if (typeof child === 'function') {
  29085. child = child.options;
  29086. }
  29087. normalizeProps(child);
  29088. normalizeInject(child);
  29089. normalizeDirectives(child);
  29090. var extendsFrom = child.extends;
  29091. if (extendsFrom) {
  29092. parent = mergeOptions(parent, extendsFrom, vm);
  29093. }
  29094. if (child.mixins) {
  29095. for (var i = 0, l = child.mixins.length; i < l; i++) {
  29096. parent = mergeOptions(parent, child.mixins[i], vm);
  29097. }
  29098. }
  29099. var options = {};
  29100. var key;
  29101. for (key in parent) {
  29102. mergeField(key);
  29103. }
  29104. for (key in child) {
  29105. if (!hasOwn(parent, key)) {
  29106. mergeField(key);
  29107. }
  29108. }
  29109. function mergeField (key) {
  29110. var strat = strats[key] || defaultStrat;
  29111. options[key] = strat(parent[key], child[key], vm, key);
  29112. }
  29113. return options
  29114. }
  29115. /**
  29116. * Resolve an asset.
  29117. * This function is used because child instances need access
  29118. * to assets defined in its ancestor chain.
  29119. */
  29120. function resolveAsset (
  29121. options,
  29122. type,
  29123. id,
  29124. warnMissing
  29125. ) {
  29126. /* istanbul ignore if */
  29127. if (typeof id !== 'string') {
  29128. return
  29129. }
  29130. var assets = options[type];
  29131. // check local registration variations first
  29132. if (hasOwn(assets, id)) { return assets[id] }
  29133. var camelizedId = camelize(id);
  29134. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  29135. var PascalCaseId = capitalize(camelizedId);
  29136. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  29137. // fallback to prototype chain
  29138. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  29139. if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
  29140. warn(
  29141. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  29142. options
  29143. );
  29144. }
  29145. return res
  29146. }
  29147. /* */
  29148. function validateProp (
  29149. key,
  29150. propOptions,
  29151. propsData,
  29152. vm
  29153. ) {
  29154. var prop = propOptions[key];
  29155. var absent = !hasOwn(propsData, key);
  29156. var value = propsData[key];
  29157. // handle boolean props
  29158. if (isType(Boolean, prop.type)) {
  29159. if (absent && !hasOwn(prop, 'default')) {
  29160. value = false;
  29161. } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
  29162. value = true;
  29163. }
  29164. }
  29165. // check default value
  29166. if (value === undefined) {
  29167. value = getPropDefaultValue(vm, prop, key);
  29168. // since the default value is a fresh copy,
  29169. // make sure to observe it.
  29170. var prevShouldConvert = observerState.shouldConvert;
  29171. observerState.shouldConvert = true;
  29172. observe(value);
  29173. observerState.shouldConvert = prevShouldConvert;
  29174. }
  29175. if (process.env.NODE_ENV !== 'production') {
  29176. assertProp(prop, key, value, vm, absent);
  29177. }
  29178. return value
  29179. }
  29180. /**
  29181. * Get the default value of a prop.
  29182. */
  29183. function getPropDefaultValue (vm, prop, key) {
  29184. // no default, return undefined
  29185. if (!hasOwn(prop, 'default')) {
  29186. return undefined
  29187. }
  29188. var def = prop.default;
  29189. // warn against non-factory defaults for Object & Array
  29190. if (process.env.NODE_ENV !== 'production' && isObject(def)) {
  29191. warn(
  29192. 'Invalid default value for prop "' + key + '": ' +
  29193. 'Props with type Object/Array must use a factory function ' +
  29194. 'to return the default value.',
  29195. vm
  29196. );
  29197. }
  29198. // the raw prop value was also undefined from previous render,
  29199. // return previous default value to avoid unnecessary watcher trigger
  29200. if (vm && vm.$options.propsData &&
  29201. vm.$options.propsData[key] === undefined &&
  29202. vm._props[key] !== undefined
  29203. ) {
  29204. return vm._props[key]
  29205. }
  29206. // call factory function for non-Function types
  29207. // a value is Function if its prototype is function even across different execution context
  29208. return typeof def === 'function' && getType(prop.type) !== 'Function'
  29209. ? def.call(vm)
  29210. : def
  29211. }
  29212. /**
  29213. * Assert whether a prop is valid.
  29214. */
  29215. function assertProp (
  29216. prop,
  29217. name,
  29218. value,
  29219. vm,
  29220. absent
  29221. ) {
  29222. if (prop.required && absent) {
  29223. warn(
  29224. 'Missing required prop: "' + name + '"',
  29225. vm
  29226. );
  29227. return
  29228. }
  29229. if (value == null && !prop.required) {
  29230. return
  29231. }
  29232. var type = prop.type;
  29233. var valid = !type || type === true;
  29234. var expectedTypes = [];
  29235. if (type) {
  29236. if (!Array.isArray(type)) {
  29237. type = [type];
  29238. }
  29239. for (var i = 0; i < type.length && !valid; i++) {
  29240. var assertedType = assertType(value, type[i]);
  29241. expectedTypes.push(assertedType.expectedType || '');
  29242. valid = assertedType.valid;
  29243. }
  29244. }
  29245. if (!valid) {
  29246. warn(
  29247. 'Invalid prop: type check failed for prop "' + name + '".' +
  29248. ' Expected ' + expectedTypes.map(capitalize).join(', ') +
  29249. ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
  29250. vm
  29251. );
  29252. return
  29253. }
  29254. var validator = prop.validator;
  29255. if (validator) {
  29256. if (!validator(value)) {
  29257. warn(
  29258. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  29259. vm
  29260. );
  29261. }
  29262. }
  29263. }
  29264. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  29265. function assertType (value, type) {
  29266. var valid;
  29267. var expectedType = getType(type);
  29268. if (simpleCheckRE.test(expectedType)) {
  29269. valid = typeof value === expectedType.toLowerCase();
  29270. } else if (expectedType === 'Object') {
  29271. valid = isPlainObject(value);
  29272. } else if (expectedType === 'Array') {
  29273. valid = Array.isArray(value);
  29274. } else {
  29275. valid = value instanceof type;
  29276. }
  29277. return {
  29278. valid: valid,
  29279. expectedType: expectedType
  29280. }
  29281. }
  29282. /**
  29283. * Use function string name to check built-in types,
  29284. * because a simple equality check will fail when running
  29285. * across different vms / iframes.
  29286. */
  29287. function getType (fn) {
  29288. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  29289. return match ? match[1] : ''
  29290. }
  29291. function isType (type, fn) {
  29292. if (!Array.isArray(fn)) {
  29293. return getType(fn) === getType(type)
  29294. }
  29295. for (var i = 0, len = fn.length; i < len; i++) {
  29296. if (getType(fn[i]) === getType(type)) {
  29297. return true
  29298. }
  29299. }
  29300. /* istanbul ignore next */
  29301. return false
  29302. }
  29303. /* */
  29304. var mark;
  29305. var measure;
  29306. if (process.env.NODE_ENV !== 'production') {
  29307. var perf = inBrowser && window.performance;
  29308. /* istanbul ignore if */
  29309. if (
  29310. perf &&
  29311. perf.mark &&
  29312. perf.measure &&
  29313. perf.clearMarks &&
  29314. perf.clearMeasures
  29315. ) {
  29316. mark = function (tag) { return perf.mark(tag); };
  29317. measure = function (name, startTag, endTag) {
  29318. perf.measure(name, startTag, endTag);
  29319. perf.clearMarks(startTag);
  29320. perf.clearMarks(endTag);
  29321. perf.clearMeasures(name);
  29322. };
  29323. }
  29324. }
  29325. /* not type checking this file because flow doesn't play well with Proxy */
  29326. var initProxy;
  29327. if (process.env.NODE_ENV !== 'production') {
  29328. var allowedGlobals = makeMap(
  29329. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  29330. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  29331. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  29332. 'require' // for Webpack/Browserify
  29333. );
  29334. var warnNonPresent = function (target, key) {
  29335. warn(
  29336. "Property or method \"" + key + "\" is not defined on the instance but " +
  29337. "referenced during render. Make sure to declare reactive data " +
  29338. "properties in the data option.",
  29339. target
  29340. );
  29341. };
  29342. var hasProxy =
  29343. typeof Proxy !== 'undefined' &&
  29344. Proxy.toString().match(/native code/);
  29345. if (hasProxy) {
  29346. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta');
  29347. config.keyCodes = new Proxy(config.keyCodes, {
  29348. set: function set (target, key, value) {
  29349. if (isBuiltInModifier(key)) {
  29350. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  29351. return false
  29352. } else {
  29353. target[key] = value;
  29354. return true
  29355. }
  29356. }
  29357. });
  29358. }
  29359. var hasHandler = {
  29360. has: function has (target, key) {
  29361. var has = key in target;
  29362. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  29363. if (!has && !isAllowed) {
  29364. warnNonPresent(target, key);
  29365. }
  29366. return has || !isAllowed
  29367. }
  29368. };
  29369. var getHandler = {
  29370. get: function get (target, key) {
  29371. if (typeof key === 'string' && !(key in target)) {
  29372. warnNonPresent(target, key);
  29373. }
  29374. return target[key]
  29375. }
  29376. };
  29377. initProxy = function initProxy (vm) {
  29378. if (hasProxy) {
  29379. // determine which proxy handler to use
  29380. var options = vm.$options;
  29381. var handlers = options.render && options.render._withStripped
  29382. ? getHandler
  29383. : hasHandler;
  29384. vm._renderProxy = new Proxy(vm, handlers);
  29385. } else {
  29386. vm._renderProxy = vm;
  29387. }
  29388. };
  29389. }
  29390. /* */
  29391. var VNode = function VNode (
  29392. tag,
  29393. data,
  29394. children,
  29395. text,
  29396. elm,
  29397. context,
  29398. componentOptions,
  29399. asyncFactory
  29400. ) {
  29401. this.tag = tag;
  29402. this.data = data;
  29403. this.children = children;
  29404. this.text = text;
  29405. this.elm = elm;
  29406. this.ns = undefined;
  29407. this.context = context;
  29408. this.functionalContext = undefined;
  29409. this.key = data && data.key;
  29410. this.componentOptions = componentOptions;
  29411. this.componentInstance = undefined;
  29412. this.parent = undefined;
  29413. this.raw = false;
  29414. this.isStatic = false;
  29415. this.isRootInsert = true;
  29416. this.isComment = false;
  29417. this.isCloned = false;
  29418. this.isOnce = false;
  29419. this.asyncFactory = asyncFactory;
  29420. this.asyncMeta = undefined;
  29421. this.isAsyncPlaceholder = false;
  29422. };
  29423. var prototypeAccessors = { child: {} };
  29424. // DEPRECATED: alias for componentInstance for backwards compat.
  29425. /* istanbul ignore next */
  29426. prototypeAccessors.child.get = function () {
  29427. return this.componentInstance
  29428. };
  29429. Object.defineProperties( VNode.prototype, prototypeAccessors );
  29430. var createEmptyVNode = function (text) {
  29431. if ( text === void 0 ) text = '';
  29432. var node = new VNode();
  29433. node.text = text;
  29434. node.isComment = true;
  29435. return node
  29436. };
  29437. function createTextVNode (val) {
  29438. return new VNode(undefined, undefined, undefined, String(val))
  29439. }
  29440. // optimized shallow clone
  29441. // used for static nodes and slot nodes because they may be reused across
  29442. // multiple renders, cloning them avoids errors when DOM manipulations rely
  29443. // on their elm reference.
  29444. function cloneVNode (vnode) {
  29445. var cloned = new VNode(
  29446. vnode.tag,
  29447. vnode.data,
  29448. vnode.children,
  29449. vnode.text,
  29450. vnode.elm,
  29451. vnode.context,
  29452. vnode.componentOptions,
  29453. vnode.asyncFactory
  29454. );
  29455. cloned.ns = vnode.ns;
  29456. cloned.isStatic = vnode.isStatic;
  29457. cloned.key = vnode.key;
  29458. cloned.isComment = vnode.isComment;
  29459. cloned.isCloned = true;
  29460. return cloned
  29461. }
  29462. function cloneVNodes (vnodes) {
  29463. var len = vnodes.length;
  29464. var res = new Array(len);
  29465. for (var i = 0; i < len; i++) {
  29466. res[i] = cloneVNode(vnodes[i]);
  29467. }
  29468. return res
  29469. }
  29470. /* */
  29471. var normalizeEvent = cached(function (name) {
  29472. var passive = name.charAt(0) === '&';
  29473. name = passive ? name.slice(1) : name;
  29474. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  29475. name = once$$1 ? name.slice(1) : name;
  29476. var capture = name.charAt(0) === '!';
  29477. name = capture ? name.slice(1) : name;
  29478. return {
  29479. name: name,
  29480. once: once$$1,
  29481. capture: capture,
  29482. passive: passive
  29483. }
  29484. });
  29485. function createFnInvoker (fns) {
  29486. function invoker () {
  29487. var arguments$1 = arguments;
  29488. var fns = invoker.fns;
  29489. if (Array.isArray(fns)) {
  29490. var cloned = fns.slice();
  29491. for (var i = 0; i < cloned.length; i++) {
  29492. cloned[i].apply(null, arguments$1);
  29493. }
  29494. } else {
  29495. // return handler return value for single handlers
  29496. return fns.apply(null, arguments)
  29497. }
  29498. }
  29499. invoker.fns = fns;
  29500. return invoker
  29501. }
  29502. function updateListeners (
  29503. on,
  29504. oldOn,
  29505. add,
  29506. remove$$1,
  29507. vm
  29508. ) {
  29509. var name, cur, old, event;
  29510. for (name in on) {
  29511. cur = on[name];
  29512. old = oldOn[name];
  29513. event = normalizeEvent(name);
  29514. if (isUndef(cur)) {
  29515. process.env.NODE_ENV !== 'production' && warn(
  29516. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  29517. vm
  29518. );
  29519. } else if (isUndef(old)) {
  29520. if (isUndef(cur.fns)) {
  29521. cur = on[name] = createFnInvoker(cur);
  29522. }
  29523. add(event.name, cur, event.once, event.capture, event.passive);
  29524. } else if (cur !== old) {
  29525. old.fns = cur;
  29526. on[name] = old;
  29527. }
  29528. }
  29529. for (name in oldOn) {
  29530. if (isUndef(on[name])) {
  29531. event = normalizeEvent(name);
  29532. remove$$1(event.name, oldOn[name], event.capture);
  29533. }
  29534. }
  29535. }
  29536. /* */
  29537. function mergeVNodeHook (def, hookKey, hook) {
  29538. var invoker;
  29539. var oldHook = def[hookKey];
  29540. function wrappedHook () {
  29541. hook.apply(this, arguments);
  29542. // important: remove merged hook to ensure it's called only once
  29543. // and prevent memory leak
  29544. remove(invoker.fns, wrappedHook);
  29545. }
  29546. if (isUndef(oldHook)) {
  29547. // no existing hook
  29548. invoker = createFnInvoker([wrappedHook]);
  29549. } else {
  29550. /* istanbul ignore if */
  29551. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  29552. // already a merged invoker
  29553. invoker = oldHook;
  29554. invoker.fns.push(wrappedHook);
  29555. } else {
  29556. // existing plain hook
  29557. invoker = createFnInvoker([oldHook, wrappedHook]);
  29558. }
  29559. }
  29560. invoker.merged = true;
  29561. def[hookKey] = invoker;
  29562. }
  29563. /* */
  29564. function extractPropsFromVNodeData (
  29565. data,
  29566. Ctor,
  29567. tag
  29568. ) {
  29569. // we are only extracting raw values here.
  29570. // validation and default values are handled in the child
  29571. // component itself.
  29572. var propOptions = Ctor.options.props;
  29573. if (isUndef(propOptions)) {
  29574. return
  29575. }
  29576. var res = {};
  29577. var attrs = data.attrs;
  29578. var props = data.props;
  29579. if (isDef(attrs) || isDef(props)) {
  29580. for (var key in propOptions) {
  29581. var altKey = hyphenate(key);
  29582. if (process.env.NODE_ENV !== 'production') {
  29583. var keyInLowerCase = key.toLowerCase();
  29584. if (
  29585. key !== keyInLowerCase &&
  29586. attrs && hasOwn(attrs, keyInLowerCase)
  29587. ) {
  29588. tip(
  29589. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  29590. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  29591. " \"" + key + "\". " +
  29592. "Note that HTML attributes are case-insensitive and camelCased " +
  29593. "props need to use their kebab-case equivalents when using in-DOM " +
  29594. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  29595. );
  29596. }
  29597. }
  29598. checkProp(res, props, key, altKey, true) ||
  29599. checkProp(res, attrs, key, altKey, false);
  29600. }
  29601. }
  29602. return res
  29603. }
  29604. function checkProp (
  29605. res,
  29606. hash,
  29607. key,
  29608. altKey,
  29609. preserve
  29610. ) {
  29611. if (isDef(hash)) {
  29612. if (hasOwn(hash, key)) {
  29613. res[key] = hash[key];
  29614. if (!preserve) {
  29615. delete hash[key];
  29616. }
  29617. return true
  29618. } else if (hasOwn(hash, altKey)) {
  29619. res[key] = hash[altKey];
  29620. if (!preserve) {
  29621. delete hash[altKey];
  29622. }
  29623. return true
  29624. }
  29625. }
  29626. return false
  29627. }
  29628. /* */
  29629. // The template compiler attempts to minimize the need for normalization by
  29630. // statically analyzing the template at compile time.
  29631. //
  29632. // For plain HTML markup, normalization can be completely skipped because the
  29633. // generated render function is guaranteed to return Array<VNode>. There are
  29634. // two cases where extra normalization is needed:
  29635. // 1. When the children contains components - because a functional component
  29636. // may return an Array instead of a single root. In this case, just a simple
  29637. // normalization is needed - if any child is an Array, we flatten the whole
  29638. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  29639. // because functional components already normalize their own children.
  29640. function simpleNormalizeChildren (children) {
  29641. for (var i = 0; i < children.length; i++) {
  29642. if (Array.isArray(children[i])) {
  29643. return Array.prototype.concat.apply([], children)
  29644. }
  29645. }
  29646. return children
  29647. }
  29648. // 2. When the children contains constructs that always generated nested Arrays,
  29649. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  29650. // with hand-written render functions / JSX. In such cases a full normalization
  29651. // is needed to cater to all possible types of children values.
  29652. function normalizeChildren (children) {
  29653. return isPrimitive(children)
  29654. ? [createTextVNode(children)]
  29655. : Array.isArray(children)
  29656. ? normalizeArrayChildren(children)
  29657. : undefined
  29658. }
  29659. function isTextNode (node) {
  29660. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  29661. }
  29662. function normalizeArrayChildren (children, nestedIndex) {
  29663. var res = [];
  29664. var i, c, last;
  29665. for (i = 0; i < children.length; i++) {
  29666. c = children[i];
  29667. if (isUndef(c) || typeof c === 'boolean') { continue }
  29668. last = res[res.length - 1];
  29669. // nested
  29670. if (Array.isArray(c)) {
  29671. res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
  29672. } else if (isPrimitive(c)) {
  29673. if (isTextNode(last)) {
  29674. // merge adjacent text nodes
  29675. // this is necessary for SSR hydration because text nodes are
  29676. // essentially merged when rendered to HTML strings
  29677. (last).text += String(c);
  29678. } else if (c !== '') {
  29679. // convert primitive to vnode
  29680. res.push(createTextVNode(c));
  29681. }
  29682. } else {
  29683. if (isTextNode(c) && isTextNode(last)) {
  29684. // merge adjacent text nodes
  29685. res[res.length - 1] = createTextVNode(last.text + c.text);
  29686. } else {
  29687. // default key for nested array children (likely generated by v-for)
  29688. if (isTrue(children._isVList) &&
  29689. isDef(c.tag) &&
  29690. isUndef(c.key) &&
  29691. isDef(nestedIndex)) {
  29692. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  29693. }
  29694. res.push(c);
  29695. }
  29696. }
  29697. }
  29698. return res
  29699. }
  29700. /* */
  29701. function ensureCtor (comp, base) {
  29702. if (comp.__esModule && comp.default) {
  29703. comp = comp.default;
  29704. }
  29705. return isObject(comp)
  29706. ? base.extend(comp)
  29707. : comp
  29708. }
  29709. function createAsyncPlaceholder (
  29710. factory,
  29711. data,
  29712. context,
  29713. children,
  29714. tag
  29715. ) {
  29716. var node = createEmptyVNode();
  29717. node.asyncFactory = factory;
  29718. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  29719. return node
  29720. }
  29721. function resolveAsyncComponent (
  29722. factory,
  29723. baseCtor,
  29724. context
  29725. ) {
  29726. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  29727. return factory.errorComp
  29728. }
  29729. if (isDef(factory.resolved)) {
  29730. return factory.resolved
  29731. }
  29732. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  29733. return factory.loadingComp
  29734. }
  29735. if (isDef(factory.contexts)) {
  29736. // already pending
  29737. factory.contexts.push(context);
  29738. } else {
  29739. var contexts = factory.contexts = [context];
  29740. var sync = true;
  29741. var forceRender = function () {
  29742. for (var i = 0, l = contexts.length; i < l; i++) {
  29743. contexts[i].$forceUpdate();
  29744. }
  29745. };
  29746. var resolve = once(function (res) {
  29747. // cache resolved
  29748. factory.resolved = ensureCtor(res, baseCtor);
  29749. // invoke callbacks only if this is not a synchronous resolve
  29750. // (async resolves are shimmed as synchronous during SSR)
  29751. if (!sync) {
  29752. forceRender();
  29753. }
  29754. });
  29755. var reject = once(function (reason) {
  29756. process.env.NODE_ENV !== 'production' && warn(
  29757. "Failed to resolve async component: " + (String(factory)) +
  29758. (reason ? ("\nReason: " + reason) : '')
  29759. );
  29760. if (isDef(factory.errorComp)) {
  29761. factory.error = true;
  29762. forceRender();
  29763. }
  29764. });
  29765. var res = factory(resolve, reject);
  29766. if (isObject(res)) {
  29767. if (typeof res.then === 'function') {
  29768. // () => Promise
  29769. if (isUndef(factory.resolved)) {
  29770. res.then(resolve, reject);
  29771. }
  29772. } else if (isDef(res.component) && typeof res.component.then === 'function') {
  29773. res.component.then(resolve, reject);
  29774. if (isDef(res.error)) {
  29775. factory.errorComp = ensureCtor(res.error, baseCtor);
  29776. }
  29777. if (isDef(res.loading)) {
  29778. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  29779. if (res.delay === 0) {
  29780. factory.loading = true;
  29781. } else {
  29782. setTimeout(function () {
  29783. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  29784. factory.loading = true;
  29785. forceRender();
  29786. }
  29787. }, res.delay || 200);
  29788. }
  29789. }
  29790. if (isDef(res.timeout)) {
  29791. setTimeout(function () {
  29792. if (isUndef(factory.resolved)) {
  29793. reject(
  29794. process.env.NODE_ENV !== 'production'
  29795. ? ("timeout (" + (res.timeout) + "ms)")
  29796. : null
  29797. );
  29798. }
  29799. }, res.timeout);
  29800. }
  29801. }
  29802. }
  29803. sync = false;
  29804. // return in case resolved synchronously
  29805. return factory.loading
  29806. ? factory.loadingComp
  29807. : factory.resolved
  29808. }
  29809. }
  29810. /* */
  29811. function getFirstComponentChild (children) {
  29812. if (Array.isArray(children)) {
  29813. for (var i = 0; i < children.length; i++) {
  29814. var c = children[i];
  29815. if (isDef(c) && isDef(c.componentOptions)) {
  29816. return c
  29817. }
  29818. }
  29819. }
  29820. }
  29821. /* */
  29822. /* */
  29823. function initEvents (vm) {
  29824. vm._events = Object.create(null);
  29825. vm._hasHookEvent = false;
  29826. // init parent attached events
  29827. var listeners = vm.$options._parentListeners;
  29828. if (listeners) {
  29829. updateComponentListeners(vm, listeners);
  29830. }
  29831. }
  29832. var target;
  29833. function add (event, fn, once$$1) {
  29834. if (once$$1) {
  29835. target.$once(event, fn);
  29836. } else {
  29837. target.$on(event, fn);
  29838. }
  29839. }
  29840. function remove$1 (event, fn) {
  29841. target.$off(event, fn);
  29842. }
  29843. function updateComponentListeners (
  29844. vm,
  29845. listeners,
  29846. oldListeners
  29847. ) {
  29848. target = vm;
  29849. updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
  29850. }
  29851. function eventsMixin (Vue) {
  29852. var hookRE = /^hook:/;
  29853. Vue.prototype.$on = function (event, fn) {
  29854. var this$1 = this;
  29855. var vm = this;
  29856. if (Array.isArray(event)) {
  29857. for (var i = 0, l = event.length; i < l; i++) {
  29858. this$1.$on(event[i], fn);
  29859. }
  29860. } else {
  29861. (vm._events[event] || (vm._events[event] = [])).push(fn);
  29862. // optimize hook:event cost by using a boolean flag marked at registration
  29863. // instead of a hash lookup
  29864. if (hookRE.test(event)) {
  29865. vm._hasHookEvent = true;
  29866. }
  29867. }
  29868. return vm
  29869. };
  29870. Vue.prototype.$once = function (event, fn) {
  29871. var vm = this;
  29872. function on () {
  29873. vm.$off(event, on);
  29874. fn.apply(vm, arguments);
  29875. }
  29876. on.fn = fn;
  29877. vm.$on(event, on);
  29878. return vm
  29879. };
  29880. Vue.prototype.$off = function (event, fn) {
  29881. var this$1 = this;
  29882. var vm = this;
  29883. // all
  29884. if (!arguments.length) {
  29885. vm._events = Object.create(null);
  29886. return vm
  29887. }
  29888. // array of events
  29889. if (Array.isArray(event)) {
  29890. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  29891. this$1.$off(event[i$1], fn);
  29892. }
  29893. return vm
  29894. }
  29895. // specific event
  29896. var cbs = vm._events[event];
  29897. if (!cbs) {
  29898. return vm
  29899. }
  29900. if (arguments.length === 1) {
  29901. vm._events[event] = null;
  29902. return vm
  29903. }
  29904. // specific handler
  29905. var cb;
  29906. var i = cbs.length;
  29907. while (i--) {
  29908. cb = cbs[i];
  29909. if (cb === fn || cb.fn === fn) {
  29910. cbs.splice(i, 1);
  29911. break
  29912. }
  29913. }
  29914. return vm
  29915. };
  29916. Vue.prototype.$emit = function (event) {
  29917. var vm = this;
  29918. if (process.env.NODE_ENV !== 'production') {
  29919. var lowerCaseEvent = event.toLowerCase();
  29920. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  29921. tip(
  29922. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  29923. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  29924. "Note that HTML attributes are case-insensitive and you cannot use " +
  29925. "v-on to listen to camelCase events when using in-DOM templates. " +
  29926. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  29927. );
  29928. }
  29929. }
  29930. var cbs = vm._events[event];
  29931. if (cbs) {
  29932. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  29933. var args = toArray(arguments, 1);
  29934. for (var i = 0, l = cbs.length; i < l; i++) {
  29935. try {
  29936. cbs[i].apply(vm, args);
  29937. } catch (e) {
  29938. handleError(e, vm, ("event handler for \"" + event + "\""));
  29939. }
  29940. }
  29941. }
  29942. return vm
  29943. };
  29944. }
  29945. /* */
  29946. /**
  29947. * Runtime helper for resolving raw children VNodes into a slot object.
  29948. */
  29949. function resolveSlots (
  29950. children,
  29951. context
  29952. ) {
  29953. var slots = {};
  29954. if (!children) {
  29955. return slots
  29956. }
  29957. var defaultSlot = [];
  29958. for (var i = 0, l = children.length; i < l; i++) {
  29959. var child = children[i];
  29960. // named slots should only be respected if the vnode was rendered in the
  29961. // same context.
  29962. if ((child.context === context || child.functionalContext === context) &&
  29963. child.data && child.data.slot != null
  29964. ) {
  29965. var name = child.data.slot;
  29966. var slot = (slots[name] || (slots[name] = []));
  29967. if (child.tag === 'template') {
  29968. slot.push.apply(slot, child.children);
  29969. } else {
  29970. slot.push(child);
  29971. }
  29972. } else {
  29973. defaultSlot.push(child);
  29974. }
  29975. }
  29976. // ignore whitespace
  29977. if (!defaultSlot.every(isWhitespace)) {
  29978. slots.default = defaultSlot;
  29979. }
  29980. return slots
  29981. }
  29982. function isWhitespace (node) {
  29983. return node.isComment || node.text === ' '
  29984. }
  29985. function resolveScopedSlots (
  29986. fns, // see flow/vnode
  29987. res
  29988. ) {
  29989. res = res || {};
  29990. for (var i = 0; i < fns.length; i++) {
  29991. if (Array.isArray(fns[i])) {
  29992. resolveScopedSlots(fns[i], res);
  29993. } else {
  29994. res[fns[i].key] = fns[i].fn;
  29995. }
  29996. }
  29997. return res
  29998. }
  29999. /* */
  30000. var activeInstance = null;
  30001. var isUpdatingChildComponent = false;
  30002. function initLifecycle (vm) {
  30003. var options = vm.$options;
  30004. // locate first non-abstract parent
  30005. var parent = options.parent;
  30006. if (parent && !options.abstract) {
  30007. while (parent.$options.abstract && parent.$parent) {
  30008. parent = parent.$parent;
  30009. }
  30010. parent.$children.push(vm);
  30011. }
  30012. vm.$parent = parent;
  30013. vm.$root = parent ? parent.$root : vm;
  30014. vm.$children = [];
  30015. vm.$refs = {};
  30016. vm._watcher = null;
  30017. vm._inactive = null;
  30018. vm._directInactive = false;
  30019. vm._isMounted = false;
  30020. vm._isDestroyed = false;
  30021. vm._isBeingDestroyed = false;
  30022. }
  30023. function lifecycleMixin (Vue) {
  30024. Vue.prototype._update = function (vnode, hydrating) {
  30025. var vm = this;
  30026. if (vm._isMounted) {
  30027. callHook(vm, 'beforeUpdate');
  30028. }
  30029. var prevEl = vm.$el;
  30030. var prevVnode = vm._vnode;
  30031. var prevActiveInstance = activeInstance;
  30032. activeInstance = vm;
  30033. vm._vnode = vnode;
  30034. // Vue.prototype.__patch__ is injected in entry points
  30035. // based on the rendering backend used.
  30036. if (!prevVnode) {
  30037. // initial render
  30038. vm.$el = vm.__patch__(
  30039. vm.$el, vnode, hydrating, false /* removeOnly */,
  30040. vm.$options._parentElm,
  30041. vm.$options._refElm
  30042. );
  30043. // no need for the ref nodes after initial patch
  30044. // this prevents keeping a detached DOM tree in memory (#5851)
  30045. vm.$options._parentElm = vm.$options._refElm = null;
  30046. } else {
  30047. // updates
  30048. vm.$el = vm.__patch__(prevVnode, vnode);
  30049. }
  30050. activeInstance = prevActiveInstance;
  30051. // update __vue__ reference
  30052. if (prevEl) {
  30053. prevEl.__vue__ = null;
  30054. }
  30055. if (vm.$el) {
  30056. vm.$el.__vue__ = vm;
  30057. }
  30058. // if parent is an HOC, update its $el as well
  30059. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  30060. vm.$parent.$el = vm.$el;
  30061. }
  30062. // updated hook is called by the scheduler to ensure that children are
  30063. // updated in a parent's updated hook.
  30064. };
  30065. Vue.prototype.$forceUpdate = function () {
  30066. var vm = this;
  30067. if (vm._watcher) {
  30068. vm._watcher.update();
  30069. }
  30070. };
  30071. Vue.prototype.$destroy = function () {
  30072. var vm = this;
  30073. if (vm._isBeingDestroyed) {
  30074. return
  30075. }
  30076. callHook(vm, 'beforeDestroy');
  30077. vm._isBeingDestroyed = true;
  30078. // remove self from parent
  30079. var parent = vm.$parent;
  30080. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  30081. remove(parent.$children, vm);
  30082. }
  30083. // teardown watchers
  30084. if (vm._watcher) {
  30085. vm._watcher.teardown();
  30086. }
  30087. var i = vm._watchers.length;
  30088. while (i--) {
  30089. vm._watchers[i].teardown();
  30090. }
  30091. // remove reference from data ob
  30092. // frozen object may not have observer.
  30093. if (vm._data.__ob__) {
  30094. vm._data.__ob__.vmCount--;
  30095. }
  30096. // call the last hook...
  30097. vm._isDestroyed = true;
  30098. // invoke destroy hooks on current rendered tree
  30099. vm.__patch__(vm._vnode, null);
  30100. // fire destroyed hook
  30101. callHook(vm, 'destroyed');
  30102. // turn off all instance listeners.
  30103. vm.$off();
  30104. // remove __vue__ reference
  30105. if (vm.$el) {
  30106. vm.$el.__vue__ = null;
  30107. }
  30108. };
  30109. }
  30110. function mountComponent (
  30111. vm,
  30112. el,
  30113. hydrating
  30114. ) {
  30115. vm.$el = el;
  30116. if (!vm.$options.render) {
  30117. vm.$options.render = createEmptyVNode;
  30118. if (process.env.NODE_ENV !== 'production') {
  30119. /* istanbul ignore if */
  30120. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  30121. vm.$options.el || el) {
  30122. warn(
  30123. 'You are using the runtime-only build of Vue where the template ' +
  30124. 'compiler is not available. Either pre-compile the templates into ' +
  30125. 'render functions, or use the compiler-included build.',
  30126. vm
  30127. );
  30128. } else {
  30129. warn(
  30130. 'Failed to mount component: template or render function not defined.',
  30131. vm
  30132. );
  30133. }
  30134. }
  30135. }
  30136. callHook(vm, 'beforeMount');
  30137. var updateComponent;
  30138. /* istanbul ignore if */
  30139. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  30140. updateComponent = function () {
  30141. var name = vm._name;
  30142. var id = vm._uid;
  30143. var startTag = "vue-perf-start:" + id;
  30144. var endTag = "vue-perf-end:" + id;
  30145. mark(startTag);
  30146. var vnode = vm._render();
  30147. mark(endTag);
  30148. measure((name + " render"), startTag, endTag);
  30149. mark(startTag);
  30150. vm._update(vnode, hydrating);
  30151. mark(endTag);
  30152. measure((name + " patch"), startTag, endTag);
  30153. };
  30154. } else {
  30155. updateComponent = function () {
  30156. vm._update(vm._render(), hydrating);
  30157. };
  30158. }
  30159. vm._watcher = new Watcher(vm, updateComponent, noop);
  30160. hydrating = false;
  30161. // manually mounted instance, call mounted on self
  30162. // mounted is called for render-created child components in its inserted hook
  30163. if (vm.$vnode == null) {
  30164. vm._isMounted = true;
  30165. callHook(vm, 'mounted');
  30166. }
  30167. return vm
  30168. }
  30169. function updateChildComponent (
  30170. vm,
  30171. propsData,
  30172. listeners,
  30173. parentVnode,
  30174. renderChildren
  30175. ) {
  30176. if (process.env.NODE_ENV !== 'production') {
  30177. isUpdatingChildComponent = true;
  30178. }
  30179. // determine whether component has slot children
  30180. // we need to do this before overwriting $options._renderChildren
  30181. var hasChildren = !!(
  30182. renderChildren || // has new static slots
  30183. vm.$options._renderChildren || // has old static slots
  30184. parentVnode.data.scopedSlots || // has new scoped slots
  30185. vm.$scopedSlots !== emptyObject // has old scoped slots
  30186. );
  30187. vm.$options._parentVnode = parentVnode;
  30188. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  30189. if (vm._vnode) { // update child tree's parent
  30190. vm._vnode.parent = parentVnode;
  30191. }
  30192. vm.$options._renderChildren = renderChildren;
  30193. // update $attrs and $listensers hash
  30194. // these are also reactive so they may trigger child update if the child
  30195. // used them during render
  30196. vm.$attrs = parentVnode.data && parentVnode.data.attrs;
  30197. vm.$listeners = listeners;
  30198. // update props
  30199. if (propsData && vm.$options.props) {
  30200. observerState.shouldConvert = false;
  30201. var props = vm._props;
  30202. var propKeys = vm.$options._propKeys || [];
  30203. for (var i = 0; i < propKeys.length; i++) {
  30204. var key = propKeys[i];
  30205. props[key] = validateProp(key, vm.$options.props, propsData, vm);
  30206. }
  30207. observerState.shouldConvert = true;
  30208. // keep a copy of raw propsData
  30209. vm.$options.propsData = propsData;
  30210. }
  30211. // update listeners
  30212. if (listeners) {
  30213. var oldListeners = vm.$options._parentListeners;
  30214. vm.$options._parentListeners = listeners;
  30215. updateComponentListeners(vm, listeners, oldListeners);
  30216. }
  30217. // resolve slots + force update if has children
  30218. if (hasChildren) {
  30219. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  30220. vm.$forceUpdate();
  30221. }
  30222. if (process.env.NODE_ENV !== 'production') {
  30223. isUpdatingChildComponent = false;
  30224. }
  30225. }
  30226. function isInInactiveTree (vm) {
  30227. while (vm && (vm = vm.$parent)) {
  30228. if (vm._inactive) { return true }
  30229. }
  30230. return false
  30231. }
  30232. function activateChildComponent (vm, direct) {
  30233. if (direct) {
  30234. vm._directInactive = false;
  30235. if (isInInactiveTree(vm)) {
  30236. return
  30237. }
  30238. } else if (vm._directInactive) {
  30239. return
  30240. }
  30241. if (vm._inactive || vm._inactive === null) {
  30242. vm._inactive = false;
  30243. for (var i = 0; i < vm.$children.length; i++) {
  30244. activateChildComponent(vm.$children[i]);
  30245. }
  30246. callHook(vm, 'activated');
  30247. }
  30248. }
  30249. function deactivateChildComponent (vm, direct) {
  30250. if (direct) {
  30251. vm._directInactive = true;
  30252. if (isInInactiveTree(vm)) {
  30253. return
  30254. }
  30255. }
  30256. if (!vm._inactive) {
  30257. vm._inactive = true;
  30258. for (var i = 0; i < vm.$children.length; i++) {
  30259. deactivateChildComponent(vm.$children[i]);
  30260. }
  30261. callHook(vm, 'deactivated');
  30262. }
  30263. }
  30264. function callHook (vm, hook) {
  30265. var handlers = vm.$options[hook];
  30266. if (handlers) {
  30267. for (var i = 0, j = handlers.length; i < j; i++) {
  30268. try {
  30269. handlers[i].call(vm);
  30270. } catch (e) {
  30271. handleError(e, vm, (hook + " hook"));
  30272. }
  30273. }
  30274. }
  30275. if (vm._hasHookEvent) {
  30276. vm.$emit('hook:' + hook);
  30277. }
  30278. }
  30279. /* */
  30280. var MAX_UPDATE_COUNT = 100;
  30281. var queue = [];
  30282. var activatedChildren = [];
  30283. var has = {};
  30284. var circular = {};
  30285. var waiting = false;
  30286. var flushing = false;
  30287. var index = 0;
  30288. /**
  30289. * Reset the scheduler's state.
  30290. */
  30291. function resetSchedulerState () {
  30292. index = queue.length = activatedChildren.length = 0;
  30293. has = {};
  30294. if (process.env.NODE_ENV !== 'production') {
  30295. circular = {};
  30296. }
  30297. waiting = flushing = false;
  30298. }
  30299. /**
  30300. * Flush both queues and run the watchers.
  30301. */
  30302. function flushSchedulerQueue () {
  30303. flushing = true;
  30304. var watcher, id;
  30305. // Sort queue before flush.
  30306. // This ensures that:
  30307. // 1. Components are updated from parent to child. (because parent is always
  30308. // created before the child)
  30309. // 2. A component's user watchers are run before its render watcher (because
  30310. // user watchers are created before the render watcher)
  30311. // 3. If a component is destroyed during a parent component's watcher run,
  30312. // its watchers can be skipped.
  30313. queue.sort(function (a, b) { return a.id - b.id; });
  30314. // do not cache length because more watchers might be pushed
  30315. // as we run existing watchers
  30316. for (index = 0; index < queue.length; index++) {
  30317. watcher = queue[index];
  30318. id = watcher.id;
  30319. has[id] = null;
  30320. watcher.run();
  30321. // in dev build, check and stop circular updates.
  30322. if (process.env.NODE_ENV !== 'production' && has[id] != null) {
  30323. circular[id] = (circular[id] || 0) + 1;
  30324. if (circular[id] > MAX_UPDATE_COUNT) {
  30325. warn(
  30326. 'You may have an infinite update loop ' + (
  30327. watcher.user
  30328. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  30329. : "in a component render function."
  30330. ),
  30331. watcher.vm
  30332. );
  30333. break
  30334. }
  30335. }
  30336. }
  30337. // keep copies of post queues before resetting state
  30338. var activatedQueue = activatedChildren.slice();
  30339. var updatedQueue = queue.slice();
  30340. resetSchedulerState();
  30341. // call component updated and activated hooks
  30342. callActivatedHooks(activatedQueue);
  30343. callUpdatedHooks(updatedQueue);
  30344. // devtool hook
  30345. /* istanbul ignore if */
  30346. if (devtools && config.devtools) {
  30347. devtools.emit('flush');
  30348. }
  30349. }
  30350. function callUpdatedHooks (queue) {
  30351. var i = queue.length;
  30352. while (i--) {
  30353. var watcher = queue[i];
  30354. var vm = watcher.vm;
  30355. if (vm._watcher === watcher && vm._isMounted) {
  30356. callHook(vm, 'updated');
  30357. }
  30358. }
  30359. }
  30360. /**
  30361. * Queue a kept-alive component that was activated during patch.
  30362. * The queue will be processed after the entire tree has been patched.
  30363. */
  30364. function queueActivatedComponent (vm) {
  30365. // setting _inactive to false here so that a render function can
  30366. // rely on checking whether it's in an inactive tree (e.g. router-view)
  30367. vm._inactive = false;
  30368. activatedChildren.push(vm);
  30369. }
  30370. function callActivatedHooks (queue) {
  30371. for (var i = 0; i < queue.length; i++) {
  30372. queue[i]._inactive = true;
  30373. activateChildComponent(queue[i], true /* true */);
  30374. }
  30375. }
  30376. /**
  30377. * Push a watcher into the watcher queue.
  30378. * Jobs with duplicate IDs will be skipped unless it's
  30379. * pushed when the queue is being flushed.
  30380. */
  30381. function queueWatcher (watcher) {
  30382. var id = watcher.id;
  30383. if (has[id] == null) {
  30384. has[id] = true;
  30385. if (!flushing) {
  30386. queue.push(watcher);
  30387. } else {
  30388. // if already flushing, splice the watcher based on its id
  30389. // if already past its id, it will be run next immediately.
  30390. var i = queue.length - 1;
  30391. while (i > index && queue[i].id > watcher.id) {
  30392. i--;
  30393. }
  30394. queue.splice(i + 1, 0, watcher);
  30395. }
  30396. // queue the flush
  30397. if (!waiting) {
  30398. waiting = true;
  30399. nextTick(flushSchedulerQueue);
  30400. }
  30401. }
  30402. }
  30403. /* */
  30404. var uid$2 = 0;
  30405. /**
  30406. * A watcher parses an expression, collects dependencies,
  30407. * and fires callback when the expression value changes.
  30408. * This is used for both the $watch() api and directives.
  30409. */
  30410. var Watcher = function Watcher (
  30411. vm,
  30412. expOrFn,
  30413. cb,
  30414. options
  30415. ) {
  30416. this.vm = vm;
  30417. vm._watchers.push(this);
  30418. // options
  30419. if (options) {
  30420. this.deep = !!options.deep;
  30421. this.user = !!options.user;
  30422. this.lazy = !!options.lazy;
  30423. this.sync = !!options.sync;
  30424. } else {
  30425. this.deep = this.user = this.lazy = this.sync = false;
  30426. }
  30427. this.cb = cb;
  30428. this.id = ++uid$2; // uid for batching
  30429. this.active = true;
  30430. this.dirty = this.lazy; // for lazy watchers
  30431. this.deps = [];
  30432. this.newDeps = [];
  30433. this.depIds = new _Set();
  30434. this.newDepIds = new _Set();
  30435. this.expression = process.env.NODE_ENV !== 'production'
  30436. ? expOrFn.toString()
  30437. : '';
  30438. // parse expression for getter
  30439. if (typeof expOrFn === 'function') {
  30440. this.getter = expOrFn;
  30441. } else {
  30442. this.getter = parsePath(expOrFn);
  30443. if (!this.getter) {
  30444. this.getter = function () {};
  30445. process.env.NODE_ENV !== 'production' && warn(
  30446. "Failed watching path: \"" + expOrFn + "\" " +
  30447. 'Watcher only accepts simple dot-delimited paths. ' +
  30448. 'For full control, use a function instead.',
  30449. vm
  30450. );
  30451. }
  30452. }
  30453. this.value = this.lazy
  30454. ? undefined
  30455. : this.get();
  30456. };
  30457. /**
  30458. * Evaluate the getter, and re-collect dependencies.
  30459. */
  30460. Watcher.prototype.get = function get () {
  30461. pushTarget(this);
  30462. var value;
  30463. var vm = this.vm;
  30464. try {
  30465. value = this.getter.call(vm, vm);
  30466. } catch (e) {
  30467. if (this.user) {
  30468. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  30469. } else {
  30470. throw e
  30471. }
  30472. } finally {
  30473. // "touch" every property so they are all tracked as
  30474. // dependencies for deep watching
  30475. if (this.deep) {
  30476. traverse(value);
  30477. }
  30478. popTarget();
  30479. this.cleanupDeps();
  30480. }
  30481. return value
  30482. };
  30483. /**
  30484. * Add a dependency to this directive.
  30485. */
  30486. Watcher.prototype.addDep = function addDep (dep) {
  30487. var id = dep.id;
  30488. if (!this.newDepIds.has(id)) {
  30489. this.newDepIds.add(id);
  30490. this.newDeps.push(dep);
  30491. if (!this.depIds.has(id)) {
  30492. dep.addSub(this);
  30493. }
  30494. }
  30495. };
  30496. /**
  30497. * Clean up for dependency collection.
  30498. */
  30499. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  30500. var this$1 = this;
  30501. var i = this.deps.length;
  30502. while (i--) {
  30503. var dep = this$1.deps[i];
  30504. if (!this$1.newDepIds.has(dep.id)) {
  30505. dep.removeSub(this$1);
  30506. }
  30507. }
  30508. var tmp = this.depIds;
  30509. this.depIds = this.newDepIds;
  30510. this.newDepIds = tmp;
  30511. this.newDepIds.clear();
  30512. tmp = this.deps;
  30513. this.deps = this.newDeps;
  30514. this.newDeps = tmp;
  30515. this.newDeps.length = 0;
  30516. };
  30517. /**
  30518. * Subscriber interface.
  30519. * Will be called when a dependency changes.
  30520. */
  30521. Watcher.prototype.update = function update () {
  30522. /* istanbul ignore else */
  30523. if (this.lazy) {
  30524. this.dirty = true;
  30525. } else if (this.sync) {
  30526. this.run();
  30527. } else {
  30528. queueWatcher(this);
  30529. }
  30530. };
  30531. /**
  30532. * Scheduler job interface.
  30533. * Will be called by the scheduler.
  30534. */
  30535. Watcher.prototype.run = function run () {
  30536. if (this.active) {
  30537. var value = this.get();
  30538. if (
  30539. value !== this.value ||
  30540. // Deep watchers and watchers on Object/Arrays should fire even
  30541. // when the value is the same, because the value may
  30542. // have mutated.
  30543. isObject(value) ||
  30544. this.deep
  30545. ) {
  30546. // set new value
  30547. var oldValue = this.value;
  30548. this.value = value;
  30549. if (this.user) {
  30550. try {
  30551. this.cb.call(this.vm, value, oldValue);
  30552. } catch (e) {
  30553. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  30554. }
  30555. } else {
  30556. this.cb.call(this.vm, value, oldValue);
  30557. }
  30558. }
  30559. }
  30560. };
  30561. /**
  30562. * Evaluate the value of the watcher.
  30563. * This only gets called for lazy watchers.
  30564. */
  30565. Watcher.prototype.evaluate = function evaluate () {
  30566. this.value = this.get();
  30567. this.dirty = false;
  30568. };
  30569. /**
  30570. * Depend on all deps collected by this watcher.
  30571. */
  30572. Watcher.prototype.depend = function depend () {
  30573. var this$1 = this;
  30574. var i = this.deps.length;
  30575. while (i--) {
  30576. this$1.deps[i].depend();
  30577. }
  30578. };
  30579. /**
  30580. * Remove self from all dependencies' subscriber list.
  30581. */
  30582. Watcher.prototype.teardown = function teardown () {
  30583. var this$1 = this;
  30584. if (this.active) {
  30585. // remove self from vm's watcher list
  30586. // this is a somewhat expensive operation so we skip it
  30587. // if the vm is being destroyed.
  30588. if (!this.vm._isBeingDestroyed) {
  30589. remove(this.vm._watchers, this);
  30590. }
  30591. var i = this.deps.length;
  30592. while (i--) {
  30593. this$1.deps[i].removeSub(this$1);
  30594. }
  30595. this.active = false;
  30596. }
  30597. };
  30598. /**
  30599. * Recursively traverse an object to evoke all converted
  30600. * getters, so that every nested property inside the object
  30601. * is collected as a "deep" dependency.
  30602. */
  30603. var seenObjects = new _Set();
  30604. function traverse (val) {
  30605. seenObjects.clear();
  30606. _traverse(val, seenObjects);
  30607. }
  30608. function _traverse (val, seen) {
  30609. var i, keys;
  30610. var isA = Array.isArray(val);
  30611. if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
  30612. return
  30613. }
  30614. if (val.__ob__) {
  30615. var depId = val.__ob__.dep.id;
  30616. if (seen.has(depId)) {
  30617. return
  30618. }
  30619. seen.add(depId);
  30620. }
  30621. if (isA) {
  30622. i = val.length;
  30623. while (i--) { _traverse(val[i], seen); }
  30624. } else {
  30625. keys = Object.keys(val);
  30626. i = keys.length;
  30627. while (i--) { _traverse(val[keys[i]], seen); }
  30628. }
  30629. }
  30630. /* */
  30631. var sharedPropertyDefinition = {
  30632. enumerable: true,
  30633. configurable: true,
  30634. get: noop,
  30635. set: noop
  30636. };
  30637. function proxy (target, sourceKey, key) {
  30638. sharedPropertyDefinition.get = function proxyGetter () {
  30639. return this[sourceKey][key]
  30640. };
  30641. sharedPropertyDefinition.set = function proxySetter (val) {
  30642. this[sourceKey][key] = val;
  30643. };
  30644. Object.defineProperty(target, key, sharedPropertyDefinition);
  30645. }
  30646. function initState (vm) {
  30647. vm._watchers = [];
  30648. var opts = vm.$options;
  30649. if (opts.props) { initProps(vm, opts.props); }
  30650. if (opts.methods) { initMethods(vm, opts.methods); }
  30651. if (opts.data) {
  30652. initData(vm);
  30653. } else {
  30654. observe(vm._data = {}, true /* asRootData */);
  30655. }
  30656. if (opts.computed) { initComputed(vm, opts.computed); }
  30657. if (opts.watch && opts.watch !== nativeWatch) {
  30658. initWatch(vm, opts.watch);
  30659. }
  30660. }
  30661. function checkOptionType (vm, name) {
  30662. var option = vm.$options[name];
  30663. if (!isPlainObject(option)) {
  30664. warn(
  30665. ("component option \"" + name + "\" should be an object."),
  30666. vm
  30667. );
  30668. }
  30669. }
  30670. function initProps (vm, propsOptions) {
  30671. var propsData = vm.$options.propsData || {};
  30672. var props = vm._props = {};
  30673. // cache prop keys so that future props updates can iterate using Array
  30674. // instead of dynamic object key enumeration.
  30675. var keys = vm.$options._propKeys = [];
  30676. var isRoot = !vm.$parent;
  30677. // root instance props should be converted
  30678. observerState.shouldConvert = isRoot;
  30679. var loop = function ( key ) {
  30680. keys.push(key);
  30681. var value = validateProp(key, propsOptions, propsData, vm);
  30682. /* istanbul ignore else */
  30683. if (process.env.NODE_ENV !== 'production') {
  30684. if (isReservedAttribute(key) || config.isReservedAttr(key)) {
  30685. warn(
  30686. ("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
  30687. vm
  30688. );
  30689. }
  30690. defineReactive$$1(props, key, value, function () {
  30691. if (vm.$parent && !isUpdatingChildComponent) {
  30692. warn(
  30693. "Avoid mutating a prop directly since the value will be " +
  30694. "overwritten whenever the parent component re-renders. " +
  30695. "Instead, use a data or computed property based on the prop's " +
  30696. "value. Prop being mutated: \"" + key + "\"",
  30697. vm
  30698. );
  30699. }
  30700. });
  30701. } else {
  30702. defineReactive$$1(props, key, value);
  30703. }
  30704. // static props are already proxied on the component's prototype
  30705. // during Vue.extend(). We only need to proxy props defined at
  30706. // instantiation here.
  30707. if (!(key in vm)) {
  30708. proxy(vm, "_props", key);
  30709. }
  30710. };
  30711. for (var key in propsOptions) loop( key );
  30712. observerState.shouldConvert = true;
  30713. }
  30714. function initData (vm) {
  30715. var data = vm.$options.data;
  30716. data = vm._data = typeof data === 'function'
  30717. ? getData(data, vm)
  30718. : data || {};
  30719. if (!isPlainObject(data)) {
  30720. data = {};
  30721. process.env.NODE_ENV !== 'production' && warn(
  30722. 'data functions should return an object:\n' +
  30723. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  30724. vm
  30725. );
  30726. }
  30727. // proxy data on instance
  30728. var keys = Object.keys(data);
  30729. var props = vm.$options.props;
  30730. var methods = vm.$options.methods;
  30731. var i = keys.length;
  30732. while (i--) {
  30733. var key = keys[i];
  30734. if (process.env.NODE_ENV !== 'production') {
  30735. if (methods && hasOwn(methods, key)) {
  30736. warn(
  30737. ("method \"" + key + "\" has already been defined as a data property."),
  30738. vm
  30739. );
  30740. }
  30741. }
  30742. if (props && hasOwn(props, key)) {
  30743. process.env.NODE_ENV !== 'production' && warn(
  30744. "The data property \"" + key + "\" is already declared as a prop. " +
  30745. "Use prop default value instead.",
  30746. vm
  30747. );
  30748. } else if (!isReserved(key)) {
  30749. proxy(vm, "_data", key);
  30750. }
  30751. }
  30752. // observe data
  30753. observe(data, true /* asRootData */);
  30754. }
  30755. function getData (data, vm) {
  30756. try {
  30757. return data.call(vm)
  30758. } catch (e) {
  30759. handleError(e, vm, "data()");
  30760. return {}
  30761. }
  30762. }
  30763. var computedWatcherOptions = { lazy: true };
  30764. function initComputed (vm, computed) {
  30765. process.env.NODE_ENV !== 'production' && checkOptionType(vm, 'computed');
  30766. var watchers = vm._computedWatchers = Object.create(null);
  30767. for (var key in computed) {
  30768. var userDef = computed[key];
  30769. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  30770. if (process.env.NODE_ENV !== 'production' && getter == null) {
  30771. warn(
  30772. ("Getter is missing for computed property \"" + key + "\"."),
  30773. vm
  30774. );
  30775. }
  30776. // create internal watcher for the computed property.
  30777. watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
  30778. // component-defined computed properties are already defined on the
  30779. // component prototype. We only need to define computed properties defined
  30780. // at instantiation here.
  30781. if (!(key in vm)) {
  30782. defineComputed(vm, key, userDef);
  30783. } else if (process.env.NODE_ENV !== 'production') {
  30784. if (key in vm.$data) {
  30785. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  30786. } else if (vm.$options.props && key in vm.$options.props) {
  30787. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  30788. }
  30789. }
  30790. }
  30791. }
  30792. function defineComputed (target, key, userDef) {
  30793. if (typeof userDef === 'function') {
  30794. sharedPropertyDefinition.get = createComputedGetter(key);
  30795. sharedPropertyDefinition.set = noop;
  30796. } else {
  30797. sharedPropertyDefinition.get = userDef.get
  30798. ? userDef.cache !== false
  30799. ? createComputedGetter(key)
  30800. : userDef.get
  30801. : noop;
  30802. sharedPropertyDefinition.set = userDef.set
  30803. ? userDef.set
  30804. : noop;
  30805. }
  30806. if (process.env.NODE_ENV !== 'production' &&
  30807. sharedPropertyDefinition.set === noop) {
  30808. sharedPropertyDefinition.set = function () {
  30809. warn(
  30810. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  30811. this
  30812. );
  30813. };
  30814. }
  30815. Object.defineProperty(target, key, sharedPropertyDefinition);
  30816. }
  30817. function createComputedGetter (key) {
  30818. return function computedGetter () {
  30819. var watcher = this._computedWatchers && this._computedWatchers[key];
  30820. if (watcher) {
  30821. if (watcher.dirty) {
  30822. watcher.evaluate();
  30823. }
  30824. if (Dep.target) {
  30825. watcher.depend();
  30826. }
  30827. return watcher.value
  30828. }
  30829. }
  30830. }
  30831. function initMethods (vm, methods) {
  30832. process.env.NODE_ENV !== 'production' && checkOptionType(vm, 'methods');
  30833. var props = vm.$options.props;
  30834. for (var key in methods) {
  30835. vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
  30836. if (process.env.NODE_ENV !== 'production') {
  30837. if (methods[key] == null) {
  30838. warn(
  30839. "method \"" + key + "\" has an undefined value in the component definition. " +
  30840. "Did you reference the function correctly?",
  30841. vm
  30842. );
  30843. }
  30844. if (props && hasOwn(props, key)) {
  30845. warn(
  30846. ("method \"" + key + "\" has already been defined as a prop."),
  30847. vm
  30848. );
  30849. }
  30850. }
  30851. }
  30852. }
  30853. function initWatch (vm, watch) {
  30854. process.env.NODE_ENV !== 'production' && checkOptionType(vm, 'watch');
  30855. for (var key in watch) {
  30856. var handler = watch[key];
  30857. if (Array.isArray(handler)) {
  30858. for (var i = 0; i < handler.length; i++) {
  30859. createWatcher(vm, key, handler[i]);
  30860. }
  30861. } else {
  30862. createWatcher(vm, key, handler);
  30863. }
  30864. }
  30865. }
  30866. function createWatcher (
  30867. vm,
  30868. keyOrFn,
  30869. handler,
  30870. options
  30871. ) {
  30872. if (isPlainObject(handler)) {
  30873. options = handler;
  30874. handler = handler.handler;
  30875. }
  30876. if (typeof handler === 'string') {
  30877. handler = vm[handler];
  30878. }
  30879. return vm.$watch(keyOrFn, handler, options)
  30880. }
  30881. function stateMixin (Vue) {
  30882. // flow somehow has problems with directly declared definition object
  30883. // when using Object.defineProperty, so we have to procedurally build up
  30884. // the object here.
  30885. var dataDef = {};
  30886. dataDef.get = function () { return this._data };
  30887. var propsDef = {};
  30888. propsDef.get = function () { return this._props };
  30889. if (process.env.NODE_ENV !== 'production') {
  30890. dataDef.set = function (newData) {
  30891. warn(
  30892. 'Avoid replacing instance root $data. ' +
  30893. 'Use nested data properties instead.',
  30894. this
  30895. );
  30896. };
  30897. propsDef.set = function () {
  30898. warn("$props is readonly.", this);
  30899. };
  30900. }
  30901. Object.defineProperty(Vue.prototype, '$data', dataDef);
  30902. Object.defineProperty(Vue.prototype, '$props', propsDef);
  30903. Vue.prototype.$set = set;
  30904. Vue.prototype.$delete = del;
  30905. Vue.prototype.$watch = function (
  30906. expOrFn,
  30907. cb,
  30908. options
  30909. ) {
  30910. var vm = this;
  30911. if (isPlainObject(cb)) {
  30912. return createWatcher(vm, expOrFn, cb, options)
  30913. }
  30914. options = options || {};
  30915. options.user = true;
  30916. var watcher = new Watcher(vm, expOrFn, cb, options);
  30917. if (options.immediate) {
  30918. cb.call(vm, watcher.value);
  30919. }
  30920. return function unwatchFn () {
  30921. watcher.teardown();
  30922. }
  30923. };
  30924. }
  30925. /* */
  30926. function initProvide (vm) {
  30927. var provide = vm.$options.provide;
  30928. if (provide) {
  30929. vm._provided = typeof provide === 'function'
  30930. ? provide.call(vm)
  30931. : provide;
  30932. }
  30933. }
  30934. function initInjections (vm) {
  30935. var result = resolveInject(vm.$options.inject, vm);
  30936. if (result) {
  30937. observerState.shouldConvert = false;
  30938. Object.keys(result).forEach(function (key) {
  30939. /* istanbul ignore else */
  30940. if (process.env.NODE_ENV !== 'production') {
  30941. defineReactive$$1(vm, key, result[key], function () {
  30942. warn(
  30943. "Avoid mutating an injected value directly since the changes will be " +
  30944. "overwritten whenever the provided component re-renders. " +
  30945. "injection being mutated: \"" + key + "\"",
  30946. vm
  30947. );
  30948. });
  30949. } else {
  30950. defineReactive$$1(vm, key, result[key]);
  30951. }
  30952. });
  30953. observerState.shouldConvert = true;
  30954. }
  30955. }
  30956. function resolveInject (inject, vm) {
  30957. if (inject) {
  30958. // inject is :any because flow is not smart enough to figure out cached
  30959. var result = Object.create(null);
  30960. var keys = hasSymbol
  30961. ? Reflect.ownKeys(inject)
  30962. : Object.keys(inject);
  30963. for (var i = 0; i < keys.length; i++) {
  30964. var key = keys[i];
  30965. var provideKey = inject[key];
  30966. var source = vm;
  30967. while (source) {
  30968. if (source._provided && provideKey in source._provided) {
  30969. result[key] = source._provided[provideKey];
  30970. break
  30971. }
  30972. source = source.$parent;
  30973. }
  30974. if (process.env.NODE_ENV !== 'production' && !source) {
  30975. warn(("Injection \"" + key + "\" not found"), vm);
  30976. }
  30977. }
  30978. return result
  30979. }
  30980. }
  30981. /* */
  30982. function createFunctionalComponent (
  30983. Ctor,
  30984. propsData,
  30985. data,
  30986. context,
  30987. children
  30988. ) {
  30989. var props = {};
  30990. var propOptions = Ctor.options.props;
  30991. if (isDef(propOptions)) {
  30992. for (var key in propOptions) {
  30993. props[key] = validateProp(key, propOptions, propsData || {});
  30994. }
  30995. } else {
  30996. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  30997. if (isDef(data.props)) { mergeProps(props, data.props); }
  30998. }
  30999. // ensure the createElement function in functional components
  31000. // gets a unique context - this is necessary for correct named slot check
  31001. var _context = Object.create(context);
  31002. var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); };
  31003. var vnode = Ctor.options.render.call(null, h, {
  31004. data: data,
  31005. props: props,
  31006. children: children,
  31007. parent: context,
  31008. listeners: data.on || {},
  31009. injections: resolveInject(Ctor.options.inject, context),
  31010. slots: function () { return resolveSlots(children, context); }
  31011. });
  31012. if (vnode instanceof VNode) {
  31013. vnode.functionalContext = context;
  31014. vnode.functionalOptions = Ctor.options;
  31015. if (data.slot) {
  31016. (vnode.data || (vnode.data = {})).slot = data.slot;
  31017. }
  31018. }
  31019. return vnode
  31020. }
  31021. function mergeProps (to, from) {
  31022. for (var key in from) {
  31023. to[camelize(key)] = from[key];
  31024. }
  31025. }
  31026. /* */
  31027. // hooks to be invoked on component VNodes during patch
  31028. var componentVNodeHooks = {
  31029. init: function init (
  31030. vnode,
  31031. hydrating,
  31032. parentElm,
  31033. refElm
  31034. ) {
  31035. if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
  31036. var child = vnode.componentInstance = createComponentInstanceForVnode(
  31037. vnode,
  31038. activeInstance,
  31039. parentElm,
  31040. refElm
  31041. );
  31042. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  31043. } else if (vnode.data.keepAlive) {
  31044. // kept-alive components, treat as a patch
  31045. var mountedNode = vnode; // work around flow
  31046. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  31047. }
  31048. },
  31049. prepatch: function prepatch (oldVnode, vnode) {
  31050. var options = vnode.componentOptions;
  31051. var child = vnode.componentInstance = oldVnode.componentInstance;
  31052. updateChildComponent(
  31053. child,
  31054. options.propsData, // updated props
  31055. options.listeners, // updated listeners
  31056. vnode, // new parent vnode
  31057. options.children // new children
  31058. );
  31059. },
  31060. insert: function insert (vnode) {
  31061. var context = vnode.context;
  31062. var componentInstance = vnode.componentInstance;
  31063. if (!componentInstance._isMounted) {
  31064. componentInstance._isMounted = true;
  31065. callHook(componentInstance, 'mounted');
  31066. }
  31067. if (vnode.data.keepAlive) {
  31068. if (context._isMounted) {
  31069. // vue-router#1212
  31070. // During updates, a kept-alive component's child components may
  31071. // change, so directly walking the tree here may call activated hooks
  31072. // on incorrect children. Instead we push them into a queue which will
  31073. // be processed after the whole patch process ended.
  31074. queueActivatedComponent(componentInstance);
  31075. } else {
  31076. activateChildComponent(componentInstance, true /* direct */);
  31077. }
  31078. }
  31079. },
  31080. destroy: function destroy (vnode) {
  31081. var componentInstance = vnode.componentInstance;
  31082. if (!componentInstance._isDestroyed) {
  31083. if (!vnode.data.keepAlive) {
  31084. componentInstance.$destroy();
  31085. } else {
  31086. deactivateChildComponent(componentInstance, true /* direct */);
  31087. }
  31088. }
  31089. }
  31090. };
  31091. var hooksToMerge = Object.keys(componentVNodeHooks);
  31092. function createComponent (
  31093. Ctor,
  31094. data,
  31095. context,
  31096. children,
  31097. tag
  31098. ) {
  31099. if (isUndef(Ctor)) {
  31100. return
  31101. }
  31102. var baseCtor = context.$options._base;
  31103. // plain options object: turn it into a constructor
  31104. if (isObject(Ctor)) {
  31105. Ctor = baseCtor.extend(Ctor);
  31106. }
  31107. // if at this stage it's not a constructor or an async component factory,
  31108. // reject.
  31109. if (typeof Ctor !== 'function') {
  31110. if (process.env.NODE_ENV !== 'production') {
  31111. warn(("Invalid Component definition: " + (String(Ctor))), context);
  31112. }
  31113. return
  31114. }
  31115. // async component
  31116. var asyncFactory;
  31117. if (isUndef(Ctor.cid)) {
  31118. asyncFactory = Ctor;
  31119. Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
  31120. if (Ctor === undefined) {
  31121. // return a placeholder node for async component, which is rendered
  31122. // as a comment node but preserves all the raw information for the node.
  31123. // the information will be used for async server-rendering and hydration.
  31124. return createAsyncPlaceholder(
  31125. asyncFactory,
  31126. data,
  31127. context,
  31128. children,
  31129. tag
  31130. )
  31131. }
  31132. }
  31133. data = data || {};
  31134. // resolve constructor options in case global mixins are applied after
  31135. // component constructor creation
  31136. resolveConstructorOptions(Ctor);
  31137. // transform component v-model data into props & events
  31138. if (isDef(data.model)) {
  31139. transformModel(Ctor.options, data);
  31140. }
  31141. // extract props
  31142. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  31143. // functional component
  31144. if (isTrue(Ctor.options.functional)) {
  31145. return createFunctionalComponent(Ctor, propsData, data, context, children)
  31146. }
  31147. // extract listeners, since these needs to be treated as
  31148. // child component listeners instead of DOM listeners
  31149. var listeners = data.on;
  31150. // replace with listeners with .native modifier
  31151. // so it gets processed during parent component patch.
  31152. data.on = data.nativeOn;
  31153. if (isTrue(Ctor.options.abstract)) {
  31154. // abstract components do not keep anything
  31155. // other than props & listeners & slot
  31156. // work around flow
  31157. var slot = data.slot;
  31158. data = {};
  31159. if (slot) {
  31160. data.slot = slot;
  31161. }
  31162. }
  31163. // merge component management hooks onto the placeholder node
  31164. mergeHooks(data);
  31165. // return a placeholder vnode
  31166. var name = Ctor.options.name || tag;
  31167. var vnode = new VNode(
  31168. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  31169. data, undefined, undefined, undefined, context,
  31170. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  31171. asyncFactory
  31172. );
  31173. return vnode
  31174. }
  31175. function createComponentInstanceForVnode (
  31176. vnode, // we know it's MountedComponentVNode but flow doesn't
  31177. parent, // activeInstance in lifecycle state
  31178. parentElm,
  31179. refElm
  31180. ) {
  31181. var vnodeComponentOptions = vnode.componentOptions;
  31182. var options = {
  31183. _isComponent: true,
  31184. parent: parent,
  31185. propsData: vnodeComponentOptions.propsData,
  31186. _componentTag: vnodeComponentOptions.tag,
  31187. _parentVnode: vnode,
  31188. _parentListeners: vnodeComponentOptions.listeners,
  31189. _renderChildren: vnodeComponentOptions.children,
  31190. _parentElm: parentElm || null,
  31191. _refElm: refElm || null
  31192. };
  31193. // check inline-template render functions
  31194. var inlineTemplate = vnode.data.inlineTemplate;
  31195. if (isDef(inlineTemplate)) {
  31196. options.render = inlineTemplate.render;
  31197. options.staticRenderFns = inlineTemplate.staticRenderFns;
  31198. }
  31199. return new vnodeComponentOptions.Ctor(options)
  31200. }
  31201. function mergeHooks (data) {
  31202. if (!data.hook) {
  31203. data.hook = {};
  31204. }
  31205. for (var i = 0; i < hooksToMerge.length; i++) {
  31206. var key = hooksToMerge[i];
  31207. var fromParent = data.hook[key];
  31208. var ours = componentVNodeHooks[key];
  31209. data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  31210. }
  31211. }
  31212. function mergeHook$1 (one, two) {
  31213. return function (a, b, c, d) {
  31214. one(a, b, c, d);
  31215. two(a, b, c, d);
  31216. }
  31217. }
  31218. // transform component v-model info (value and callback) into
  31219. // prop and event handler respectively.
  31220. function transformModel (options, data) {
  31221. var prop = (options.model && options.model.prop) || 'value';
  31222. var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
  31223. var on = data.on || (data.on = {});
  31224. if (isDef(on[event])) {
  31225. on[event] = [data.model.callback].concat(on[event]);
  31226. } else {
  31227. on[event] = data.model.callback;
  31228. }
  31229. }
  31230. /* */
  31231. var SIMPLE_NORMALIZE = 1;
  31232. var ALWAYS_NORMALIZE = 2;
  31233. // wrapper function for providing a more flexible interface
  31234. // without getting yelled at by flow
  31235. function createElement (
  31236. context,
  31237. tag,
  31238. data,
  31239. children,
  31240. normalizationType,
  31241. alwaysNormalize
  31242. ) {
  31243. if (Array.isArray(data) || isPrimitive(data)) {
  31244. normalizationType = children;
  31245. children = data;
  31246. data = undefined;
  31247. }
  31248. if (isTrue(alwaysNormalize)) {
  31249. normalizationType = ALWAYS_NORMALIZE;
  31250. }
  31251. return _createElement(context, tag, data, children, normalizationType)
  31252. }
  31253. function _createElement (
  31254. context,
  31255. tag,
  31256. data,
  31257. children,
  31258. normalizationType
  31259. ) {
  31260. if (isDef(data) && isDef((data).__ob__)) {
  31261. process.env.NODE_ENV !== 'production' && warn(
  31262. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  31263. 'Always create fresh vnode data objects in each render!',
  31264. context
  31265. );
  31266. return createEmptyVNode()
  31267. }
  31268. // object syntax in v-bind
  31269. if (isDef(data) && isDef(data.is)) {
  31270. tag = data.is;
  31271. }
  31272. if (!tag) {
  31273. // in case of component :is set to falsy value
  31274. return createEmptyVNode()
  31275. }
  31276. // warn against non-primitive key
  31277. if (process.env.NODE_ENV !== 'production' &&
  31278. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  31279. ) {
  31280. warn(
  31281. 'Avoid using non-primitive value as key, ' +
  31282. 'use string/number value instead.',
  31283. context
  31284. );
  31285. }
  31286. // support single function children as default scoped slot
  31287. if (Array.isArray(children) &&
  31288. typeof children[0] === 'function'
  31289. ) {
  31290. data = data || {};
  31291. data.scopedSlots = { default: children[0] };
  31292. children.length = 0;
  31293. }
  31294. if (normalizationType === ALWAYS_NORMALIZE) {
  31295. children = normalizeChildren(children);
  31296. } else if (normalizationType === SIMPLE_NORMALIZE) {
  31297. children = simpleNormalizeChildren(children);
  31298. }
  31299. var vnode, ns;
  31300. if (typeof tag === 'string') {
  31301. var Ctor;
  31302. ns = config.getTagNamespace(tag);
  31303. if (config.isReservedTag(tag)) {
  31304. // platform built-in elements
  31305. vnode = new VNode(
  31306. config.parsePlatformTagName(tag), data, children,
  31307. undefined, undefined, context
  31308. );
  31309. } else if (isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  31310. // component
  31311. vnode = createComponent(Ctor, data, context, children, tag);
  31312. } else {
  31313. // unknown or unlisted namespaced elements
  31314. // check at runtime because it may get assigned a namespace when its
  31315. // parent normalizes children
  31316. vnode = new VNode(
  31317. tag, data, children,
  31318. undefined, undefined, context
  31319. );
  31320. }
  31321. } else {
  31322. // direct component options / constructor
  31323. vnode = createComponent(tag, data, context, children);
  31324. }
  31325. if (isDef(vnode)) {
  31326. if (ns) { applyNS(vnode, ns); }
  31327. return vnode
  31328. } else {
  31329. return createEmptyVNode()
  31330. }
  31331. }
  31332. function applyNS (vnode, ns) {
  31333. vnode.ns = ns;
  31334. if (vnode.tag === 'foreignObject') {
  31335. // use default namespace inside foreignObject
  31336. return
  31337. }
  31338. if (isDef(vnode.children)) {
  31339. for (var i = 0, l = vnode.children.length; i < l; i++) {
  31340. var child = vnode.children[i];
  31341. if (isDef(child.tag) && isUndef(child.ns)) {
  31342. applyNS(child, ns);
  31343. }
  31344. }
  31345. }
  31346. }
  31347. /* */
  31348. /**
  31349. * Runtime helper for rendering v-for lists.
  31350. */
  31351. function renderList (
  31352. val,
  31353. render
  31354. ) {
  31355. var ret, i, l, keys, key;
  31356. if (Array.isArray(val) || typeof val === 'string') {
  31357. ret = new Array(val.length);
  31358. for (i = 0, l = val.length; i < l; i++) {
  31359. ret[i] = render(val[i], i);
  31360. }
  31361. } else if (typeof val === 'number') {
  31362. ret = new Array(val);
  31363. for (i = 0; i < val; i++) {
  31364. ret[i] = render(i + 1, i);
  31365. }
  31366. } else if (isObject(val)) {
  31367. keys = Object.keys(val);
  31368. ret = new Array(keys.length);
  31369. for (i = 0, l = keys.length; i < l; i++) {
  31370. key = keys[i];
  31371. ret[i] = render(val[key], key, i);
  31372. }
  31373. }
  31374. if (isDef(ret)) {
  31375. (ret)._isVList = true;
  31376. }
  31377. return ret
  31378. }
  31379. /* */
  31380. /**
  31381. * Runtime helper for rendering <slot>
  31382. */
  31383. function renderSlot (
  31384. name,
  31385. fallback,
  31386. props,
  31387. bindObject
  31388. ) {
  31389. var scopedSlotFn = this.$scopedSlots[name];
  31390. if (scopedSlotFn) { // scoped slot
  31391. props = props || {};
  31392. if (bindObject) {
  31393. props = extend(extend({}, bindObject), props);
  31394. }
  31395. return scopedSlotFn(props) || fallback
  31396. } else {
  31397. var slotNodes = this.$slots[name];
  31398. // warn duplicate slot usage
  31399. if (slotNodes && process.env.NODE_ENV !== 'production') {
  31400. slotNodes._rendered && warn(
  31401. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  31402. "- this will likely cause render errors.",
  31403. this
  31404. );
  31405. slotNodes._rendered = true;
  31406. }
  31407. return slotNodes || fallback
  31408. }
  31409. }
  31410. /* */
  31411. /**
  31412. * Runtime helper for resolving filters
  31413. */
  31414. function resolveFilter (id) {
  31415. return resolveAsset(this.$options, 'filters', id, true) || identity
  31416. }
  31417. /* */
  31418. /**
  31419. * Runtime helper for checking keyCodes from config.
  31420. */
  31421. function checkKeyCodes (
  31422. eventKeyCode,
  31423. key,
  31424. builtInAlias
  31425. ) {
  31426. var keyCodes = config.keyCodes[key] || builtInAlias;
  31427. if (Array.isArray(keyCodes)) {
  31428. return keyCodes.indexOf(eventKeyCode) === -1
  31429. } else {
  31430. return keyCodes !== eventKeyCode
  31431. }
  31432. }
  31433. /* */
  31434. /**
  31435. * Runtime helper for merging v-bind="object" into a VNode's data.
  31436. */
  31437. function bindObjectProps (
  31438. data,
  31439. tag,
  31440. value,
  31441. asProp,
  31442. isSync
  31443. ) {
  31444. if (value) {
  31445. if (!isObject(value)) {
  31446. process.env.NODE_ENV !== 'production' && warn(
  31447. 'v-bind without argument expects an Object or Array value',
  31448. this
  31449. );
  31450. } else {
  31451. if (Array.isArray(value)) {
  31452. value = toObject(value);
  31453. }
  31454. var hash;
  31455. var loop = function ( key ) {
  31456. if (
  31457. key === 'class' ||
  31458. key === 'style' ||
  31459. isReservedAttribute(key)
  31460. ) {
  31461. hash = data;
  31462. } else {
  31463. var type = data.attrs && data.attrs.type;
  31464. hash = asProp || config.mustUseProp(tag, type, key)
  31465. ? data.domProps || (data.domProps = {})
  31466. : data.attrs || (data.attrs = {});
  31467. }
  31468. if (!(key in hash)) {
  31469. hash[key] = value[key];
  31470. if (isSync) {
  31471. var on = data.on || (data.on = {});
  31472. on[("update:" + key)] = function ($event) {
  31473. value[key] = $event;
  31474. };
  31475. }
  31476. }
  31477. };
  31478. for (var key in value) loop( key );
  31479. }
  31480. }
  31481. return data
  31482. }
  31483. /* */
  31484. /**
  31485. * Runtime helper for rendering static trees.
  31486. */
  31487. function renderStatic (
  31488. index,
  31489. isInFor
  31490. ) {
  31491. var tree = this._staticTrees[index];
  31492. // if has already-rendered static tree and not inside v-for,
  31493. // we can reuse the same tree by doing a shallow clone.
  31494. if (tree && !isInFor) {
  31495. return Array.isArray(tree)
  31496. ? cloneVNodes(tree)
  31497. : cloneVNode(tree)
  31498. }
  31499. // otherwise, render a fresh tree.
  31500. tree = this._staticTrees[index] =
  31501. this.$options.staticRenderFns[index].call(this._renderProxy);
  31502. markStatic(tree, ("__static__" + index), false);
  31503. return tree
  31504. }
  31505. /**
  31506. * Runtime helper for v-once.
  31507. * Effectively it means marking the node as static with a unique key.
  31508. */
  31509. function markOnce (
  31510. tree,
  31511. index,
  31512. key
  31513. ) {
  31514. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  31515. return tree
  31516. }
  31517. function markStatic (
  31518. tree,
  31519. key,
  31520. isOnce
  31521. ) {
  31522. if (Array.isArray(tree)) {
  31523. for (var i = 0; i < tree.length; i++) {
  31524. if (tree[i] && typeof tree[i] !== 'string') {
  31525. markStaticNode(tree[i], (key + "_" + i), isOnce);
  31526. }
  31527. }
  31528. } else {
  31529. markStaticNode(tree, key, isOnce);
  31530. }
  31531. }
  31532. function markStaticNode (node, key, isOnce) {
  31533. node.isStatic = true;
  31534. node.key = key;
  31535. node.isOnce = isOnce;
  31536. }
  31537. /* */
  31538. function bindObjectListeners (data, value) {
  31539. if (value) {
  31540. if (!isPlainObject(value)) {
  31541. process.env.NODE_ENV !== 'production' && warn(
  31542. 'v-on without argument expects an Object value',
  31543. this
  31544. );
  31545. } else {
  31546. var on = data.on = data.on ? extend({}, data.on) : {};
  31547. for (var key in value) {
  31548. var existing = on[key];
  31549. var ours = value[key];
  31550. on[key] = existing ? [].concat(ours, existing) : ours;
  31551. }
  31552. }
  31553. }
  31554. return data
  31555. }
  31556. /* */
  31557. function initRender (vm) {
  31558. vm._vnode = null; // the root of the child tree
  31559. vm._staticTrees = null;
  31560. var parentVnode = vm.$vnode = vm.$options._parentVnode; // the placeholder node in parent tree
  31561. var renderContext = parentVnode && parentVnode.context;
  31562. vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext);
  31563. vm.$scopedSlots = emptyObject;
  31564. // bind the createElement fn to this instance
  31565. // so that we get proper render context inside it.
  31566. // args order: tag, data, children, normalizationType, alwaysNormalize
  31567. // internal version is used by render functions compiled from templates
  31568. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  31569. // normalization is always applied for the public version, used in
  31570. // user-written render functions.
  31571. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  31572. // $attrs & $listeners are exposed for easier HOC creation.
  31573. // they need to be reactive so that HOCs using them are always updated
  31574. var parentData = parentVnode && parentVnode.data;
  31575. /* istanbul ignore else */
  31576. if (process.env.NODE_ENV !== 'production') {
  31577. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, function () {
  31578. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  31579. }, true);
  31580. defineReactive$$1(vm, '$listeners', vm.$options._parentListeners, function () {
  31581. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  31582. }, true);
  31583. } else {
  31584. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, null, true);
  31585. defineReactive$$1(vm, '$listeners', vm.$options._parentListeners, null, true);
  31586. }
  31587. }
  31588. function renderMixin (Vue) {
  31589. Vue.prototype.$nextTick = function (fn) {
  31590. return nextTick(fn, this)
  31591. };
  31592. Vue.prototype._render = function () {
  31593. var vm = this;
  31594. var ref = vm.$options;
  31595. var render = ref.render;
  31596. var staticRenderFns = ref.staticRenderFns;
  31597. var _parentVnode = ref._parentVnode;
  31598. if (vm._isMounted) {
  31599. // clone slot nodes on re-renders
  31600. for (var key in vm.$slots) {
  31601. vm.$slots[key] = cloneVNodes(vm.$slots[key]);
  31602. }
  31603. }
  31604. vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;
  31605. if (staticRenderFns && !vm._staticTrees) {
  31606. vm._staticTrees = [];
  31607. }
  31608. // set parent vnode. this allows render functions to have access
  31609. // to the data on the placeholder node.
  31610. vm.$vnode = _parentVnode;
  31611. // render self
  31612. var vnode;
  31613. try {
  31614. vnode = render.call(vm._renderProxy, vm.$createElement);
  31615. } catch (e) {
  31616. handleError(e, vm, "render function");
  31617. // return error render result,
  31618. // or previous vnode to prevent render error causing blank component
  31619. /* istanbul ignore else */
  31620. if (process.env.NODE_ENV !== 'production') {
  31621. vnode = vm.$options.renderError
  31622. ? vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e)
  31623. : vm._vnode;
  31624. } else {
  31625. vnode = vm._vnode;
  31626. }
  31627. }
  31628. // return empty vnode in case the render function errored out
  31629. if (!(vnode instanceof VNode)) {
  31630. if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
  31631. warn(
  31632. 'Multiple root nodes returned from render function. Render function ' +
  31633. 'should return a single root node.',
  31634. vm
  31635. );
  31636. }
  31637. vnode = createEmptyVNode();
  31638. }
  31639. // set parent
  31640. vnode.parent = _parentVnode;
  31641. return vnode
  31642. };
  31643. // internal render helpers.
  31644. // these are exposed on the instance prototype to reduce generated render
  31645. // code size.
  31646. Vue.prototype._o = markOnce;
  31647. Vue.prototype._n = toNumber;
  31648. Vue.prototype._s = toString;
  31649. Vue.prototype._l = renderList;
  31650. Vue.prototype._t = renderSlot;
  31651. Vue.prototype._q = looseEqual;
  31652. Vue.prototype._i = looseIndexOf;
  31653. Vue.prototype._m = renderStatic;
  31654. Vue.prototype._f = resolveFilter;
  31655. Vue.prototype._k = checkKeyCodes;
  31656. Vue.prototype._b = bindObjectProps;
  31657. Vue.prototype._v = createTextVNode;
  31658. Vue.prototype._e = createEmptyVNode;
  31659. Vue.prototype._u = resolveScopedSlots;
  31660. Vue.prototype._g = bindObjectListeners;
  31661. }
  31662. /* */
  31663. var uid$1 = 0;
  31664. function initMixin (Vue) {
  31665. Vue.prototype._init = function (options) {
  31666. var vm = this;
  31667. // a uid
  31668. vm._uid = uid$1++;
  31669. var startTag, endTag;
  31670. /* istanbul ignore if */
  31671. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  31672. startTag = "vue-perf-init:" + (vm._uid);
  31673. endTag = "vue-perf-end:" + (vm._uid);
  31674. mark(startTag);
  31675. }
  31676. // a flag to avoid this being observed
  31677. vm._isVue = true;
  31678. // merge options
  31679. if (options && options._isComponent) {
  31680. // optimize internal component instantiation
  31681. // since dynamic options merging is pretty slow, and none of the
  31682. // internal component options needs special treatment.
  31683. initInternalComponent(vm, options);
  31684. } else {
  31685. vm.$options = mergeOptions(
  31686. resolveConstructorOptions(vm.constructor),
  31687. options || {},
  31688. vm
  31689. );
  31690. }
  31691. /* istanbul ignore else */
  31692. if (process.env.NODE_ENV !== 'production') {
  31693. initProxy(vm);
  31694. } else {
  31695. vm._renderProxy = vm;
  31696. }
  31697. // expose real self
  31698. vm._self = vm;
  31699. initLifecycle(vm);
  31700. initEvents(vm);
  31701. initRender(vm);
  31702. callHook(vm, 'beforeCreate');
  31703. initInjections(vm); // resolve injections before data/props
  31704. initState(vm);
  31705. initProvide(vm); // resolve provide after data/props
  31706. callHook(vm, 'created');
  31707. /* istanbul ignore if */
  31708. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  31709. vm._name = formatComponentName(vm, false);
  31710. mark(endTag);
  31711. measure(((vm._name) + " init"), startTag, endTag);
  31712. }
  31713. if (vm.$options.el) {
  31714. vm.$mount(vm.$options.el);
  31715. }
  31716. };
  31717. }
  31718. function initInternalComponent (vm, options) {
  31719. var opts = vm.$options = Object.create(vm.constructor.options);
  31720. // doing this because it's faster than dynamic enumeration.
  31721. opts.parent = options.parent;
  31722. opts.propsData = options.propsData;
  31723. opts._parentVnode = options._parentVnode;
  31724. opts._parentListeners = options._parentListeners;
  31725. opts._renderChildren = options._renderChildren;
  31726. opts._componentTag = options._componentTag;
  31727. opts._parentElm = options._parentElm;
  31728. opts._refElm = options._refElm;
  31729. if (options.render) {
  31730. opts.render = options.render;
  31731. opts.staticRenderFns = options.staticRenderFns;
  31732. }
  31733. }
  31734. function resolveConstructorOptions (Ctor) {
  31735. var options = Ctor.options;
  31736. if (Ctor.super) {
  31737. var superOptions = resolveConstructorOptions(Ctor.super);
  31738. var cachedSuperOptions = Ctor.superOptions;
  31739. if (superOptions !== cachedSuperOptions) {
  31740. // super option changed,
  31741. // need to resolve new options.
  31742. Ctor.superOptions = superOptions;
  31743. // check if there are any late-modified/attached options (#4976)
  31744. var modifiedOptions = resolveModifiedOptions(Ctor);
  31745. // update base extend options
  31746. if (modifiedOptions) {
  31747. extend(Ctor.extendOptions, modifiedOptions);
  31748. }
  31749. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  31750. if (options.name) {
  31751. options.components[options.name] = Ctor;
  31752. }
  31753. }
  31754. }
  31755. return options
  31756. }
  31757. function resolveModifiedOptions (Ctor) {
  31758. var modified;
  31759. var latest = Ctor.options;
  31760. var extended = Ctor.extendOptions;
  31761. var sealed = Ctor.sealedOptions;
  31762. for (var key in latest) {
  31763. if (latest[key] !== sealed[key]) {
  31764. if (!modified) { modified = {}; }
  31765. modified[key] = dedupe(latest[key], extended[key], sealed[key]);
  31766. }
  31767. }
  31768. return modified
  31769. }
  31770. function dedupe (latest, extended, sealed) {
  31771. // compare latest and sealed to ensure lifecycle hooks won't be duplicated
  31772. // between merges
  31773. if (Array.isArray(latest)) {
  31774. var res = [];
  31775. sealed = Array.isArray(sealed) ? sealed : [sealed];
  31776. extended = Array.isArray(extended) ? extended : [extended];
  31777. for (var i = 0; i < latest.length; i++) {
  31778. // push original options and not sealed options to exclude duplicated options
  31779. if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) {
  31780. res.push(latest[i]);
  31781. }
  31782. }
  31783. return res
  31784. } else {
  31785. return latest
  31786. }
  31787. }
  31788. function Vue$3 (options) {
  31789. if (process.env.NODE_ENV !== 'production' &&
  31790. !(this instanceof Vue$3)
  31791. ) {
  31792. warn('Vue is a constructor and should be called with the `new` keyword');
  31793. }
  31794. this._init(options);
  31795. }
  31796. initMixin(Vue$3);
  31797. stateMixin(Vue$3);
  31798. eventsMixin(Vue$3);
  31799. lifecycleMixin(Vue$3);
  31800. renderMixin(Vue$3);
  31801. /* */
  31802. function initUse (Vue) {
  31803. Vue.use = function (plugin) {
  31804. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  31805. if (installedPlugins.indexOf(plugin) > -1) {
  31806. return this
  31807. }
  31808. // additional parameters
  31809. var args = toArray(arguments, 1);
  31810. args.unshift(this);
  31811. if (typeof plugin.install === 'function') {
  31812. plugin.install.apply(plugin, args);
  31813. } else if (typeof plugin === 'function') {
  31814. plugin.apply(null, args);
  31815. }
  31816. installedPlugins.push(plugin);
  31817. return this
  31818. };
  31819. }
  31820. /* */
  31821. function initMixin$1 (Vue) {
  31822. Vue.mixin = function (mixin) {
  31823. this.options = mergeOptions(this.options, mixin);
  31824. return this
  31825. };
  31826. }
  31827. /* */
  31828. function initExtend (Vue) {
  31829. /**
  31830. * Each instance constructor, including Vue, has a unique
  31831. * cid. This enables us to create wrapped "child
  31832. * constructors" for prototypal inheritance and cache them.
  31833. */
  31834. Vue.cid = 0;
  31835. var cid = 1;
  31836. /**
  31837. * Class inheritance
  31838. */
  31839. Vue.extend = function (extendOptions) {
  31840. extendOptions = extendOptions || {};
  31841. var Super = this;
  31842. var SuperId = Super.cid;
  31843. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  31844. if (cachedCtors[SuperId]) {
  31845. return cachedCtors[SuperId]
  31846. }
  31847. var name = extendOptions.name || Super.options.name;
  31848. if (process.env.NODE_ENV !== 'production') {
  31849. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  31850. warn(
  31851. 'Invalid component name: "' + name + '". Component names ' +
  31852. 'can only contain alphanumeric characters and the hyphen, ' +
  31853. 'and must start with a letter.'
  31854. );
  31855. }
  31856. }
  31857. var Sub = function VueComponent (options) {
  31858. this._init(options);
  31859. };
  31860. Sub.prototype = Object.create(Super.prototype);
  31861. Sub.prototype.constructor = Sub;
  31862. Sub.cid = cid++;
  31863. Sub.options = mergeOptions(
  31864. Super.options,
  31865. extendOptions
  31866. );
  31867. Sub['super'] = Super;
  31868. // For props and computed properties, we define the proxy getters on
  31869. // the Vue instances at extension time, on the extended prototype. This
  31870. // avoids Object.defineProperty calls for each instance created.
  31871. if (Sub.options.props) {
  31872. initProps$1(Sub);
  31873. }
  31874. if (Sub.options.computed) {
  31875. initComputed$1(Sub);
  31876. }
  31877. // allow further extension/mixin/plugin usage
  31878. Sub.extend = Super.extend;
  31879. Sub.mixin = Super.mixin;
  31880. Sub.use = Super.use;
  31881. // create asset registers, so extended classes
  31882. // can have their private assets too.
  31883. ASSET_TYPES.forEach(function (type) {
  31884. Sub[type] = Super[type];
  31885. });
  31886. // enable recursive self-lookup
  31887. if (name) {
  31888. Sub.options.components[name] = Sub;
  31889. }
  31890. // keep a reference to the super options at extension time.
  31891. // later at instantiation we can check if Super's options have
  31892. // been updated.
  31893. Sub.superOptions = Super.options;
  31894. Sub.extendOptions = extendOptions;
  31895. Sub.sealedOptions = extend({}, Sub.options);
  31896. // cache constructor
  31897. cachedCtors[SuperId] = Sub;
  31898. return Sub
  31899. };
  31900. }
  31901. function initProps$1 (Comp) {
  31902. var props = Comp.options.props;
  31903. for (var key in props) {
  31904. proxy(Comp.prototype, "_props", key);
  31905. }
  31906. }
  31907. function initComputed$1 (Comp) {
  31908. var computed = Comp.options.computed;
  31909. for (var key in computed) {
  31910. defineComputed(Comp.prototype, key, computed[key]);
  31911. }
  31912. }
  31913. /* */
  31914. function initAssetRegisters (Vue) {
  31915. /**
  31916. * Create asset registration methods.
  31917. */
  31918. ASSET_TYPES.forEach(function (type) {
  31919. Vue[type] = function (
  31920. id,
  31921. definition
  31922. ) {
  31923. if (!definition) {
  31924. return this.options[type + 's'][id]
  31925. } else {
  31926. /* istanbul ignore if */
  31927. if (process.env.NODE_ENV !== 'production') {
  31928. if (type === 'component' && config.isReservedTag(id)) {
  31929. warn(
  31930. 'Do not use built-in or reserved HTML elements as component ' +
  31931. 'id: ' + id
  31932. );
  31933. }
  31934. }
  31935. if (type === 'component' && isPlainObject(definition)) {
  31936. definition.name = definition.name || id;
  31937. definition = this.options._base.extend(definition);
  31938. }
  31939. if (type === 'directive' && typeof definition === 'function') {
  31940. definition = { bind: definition, update: definition };
  31941. }
  31942. this.options[type + 's'][id] = definition;
  31943. return definition
  31944. }
  31945. };
  31946. });
  31947. }
  31948. /* */
  31949. var patternTypes = [String, RegExp, Array];
  31950. function getComponentName (opts) {
  31951. return opts && (opts.Ctor.options.name || opts.tag)
  31952. }
  31953. function matches (pattern, name) {
  31954. if (Array.isArray(pattern)) {
  31955. return pattern.indexOf(name) > -1
  31956. } else if (typeof pattern === 'string') {
  31957. return pattern.split(',').indexOf(name) > -1
  31958. } else if (isRegExp(pattern)) {
  31959. return pattern.test(name)
  31960. }
  31961. /* istanbul ignore next */
  31962. return false
  31963. }
  31964. function pruneCache (cache, current, filter) {
  31965. for (var key in cache) {
  31966. var cachedNode = cache[key];
  31967. if (cachedNode) {
  31968. var name = getComponentName(cachedNode.componentOptions);
  31969. if (name && !filter(name)) {
  31970. if (cachedNode !== current) {
  31971. pruneCacheEntry(cachedNode);
  31972. }
  31973. cache[key] = null;
  31974. }
  31975. }
  31976. }
  31977. }
  31978. function pruneCacheEntry (vnode) {
  31979. if (vnode) {
  31980. vnode.componentInstance.$destroy();
  31981. }
  31982. }
  31983. var KeepAlive = {
  31984. name: 'keep-alive',
  31985. abstract: true,
  31986. props: {
  31987. include: patternTypes,
  31988. exclude: patternTypes
  31989. },
  31990. created: function created () {
  31991. this.cache = Object.create(null);
  31992. },
  31993. destroyed: function destroyed () {
  31994. var this$1 = this;
  31995. for (var key in this$1.cache) {
  31996. pruneCacheEntry(this$1.cache[key]);
  31997. }
  31998. },
  31999. watch: {
  32000. include: function include (val) {
  32001. pruneCache(this.cache, this._vnode, function (name) { return matches(val, name); });
  32002. },
  32003. exclude: function exclude (val) {
  32004. pruneCache(this.cache, this._vnode, function (name) { return !matches(val, name); });
  32005. }
  32006. },
  32007. render: function render () {
  32008. var vnode = getFirstComponentChild(this.$slots.default);
  32009. var componentOptions = vnode && vnode.componentOptions;
  32010. if (componentOptions) {
  32011. // check pattern
  32012. var name = getComponentName(componentOptions);
  32013. if (name && (
  32014. (this.include && !matches(this.include, name)) ||
  32015. (this.exclude && matches(this.exclude, name))
  32016. )) {
  32017. return vnode
  32018. }
  32019. var key = vnode.key == null
  32020. // same constructor may get registered as different local components
  32021. // so cid alone is not enough (#3269)
  32022. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  32023. : vnode.key;
  32024. if (this.cache[key]) {
  32025. vnode.componentInstance = this.cache[key].componentInstance;
  32026. } else {
  32027. this.cache[key] = vnode;
  32028. }
  32029. vnode.data.keepAlive = true;
  32030. }
  32031. return vnode
  32032. }
  32033. };
  32034. var builtInComponents = {
  32035. KeepAlive: KeepAlive
  32036. };
  32037. /* */
  32038. function initGlobalAPI (Vue) {
  32039. // config
  32040. var configDef = {};
  32041. configDef.get = function () { return config; };
  32042. if (process.env.NODE_ENV !== 'production') {
  32043. configDef.set = function () {
  32044. warn(
  32045. 'Do not replace the Vue.config object, set individual fields instead.'
  32046. );
  32047. };
  32048. }
  32049. Object.defineProperty(Vue, 'config', configDef);
  32050. // exposed util methods.
  32051. // NOTE: these are not considered part of the public API - avoid relying on
  32052. // them unless you are aware of the risk.
  32053. Vue.util = {
  32054. warn: warn,
  32055. extend: extend,
  32056. mergeOptions: mergeOptions,
  32057. defineReactive: defineReactive$$1
  32058. };
  32059. Vue.set = set;
  32060. Vue.delete = del;
  32061. Vue.nextTick = nextTick;
  32062. Vue.options = Object.create(null);
  32063. ASSET_TYPES.forEach(function (type) {
  32064. Vue.options[type + 's'] = Object.create(null);
  32065. });
  32066. // this is used to identify the "base" constructor to extend all plain-object
  32067. // components with in Weex's multi-instance scenarios.
  32068. Vue.options._base = Vue;
  32069. extend(Vue.options.components, builtInComponents);
  32070. initUse(Vue);
  32071. initMixin$1(Vue);
  32072. initExtend(Vue);
  32073. initAssetRegisters(Vue);
  32074. }
  32075. initGlobalAPI(Vue$3);
  32076. Object.defineProperty(Vue$3.prototype, '$isServer', {
  32077. get: isServerRendering
  32078. });
  32079. Object.defineProperty(Vue$3.prototype, '$ssrContext', {
  32080. get: function get () {
  32081. /* istanbul ignore next */
  32082. return this.$vnode && this.$vnode.ssrContext
  32083. }
  32084. });
  32085. Vue$3.version = '2.4.2';
  32086. /* */
  32087. // these are reserved for web because they are directly compiled away
  32088. // during template compilation
  32089. var isReservedAttr = makeMap('style,class');
  32090. // attributes that should be using props for binding
  32091. var acceptValue = makeMap('input,textarea,option,select');
  32092. var mustUseProp = function (tag, type, attr) {
  32093. return (
  32094. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  32095. (attr === 'selected' && tag === 'option') ||
  32096. (attr === 'checked' && tag === 'input') ||
  32097. (attr === 'muted' && tag === 'video')
  32098. )
  32099. };
  32100. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  32101. var isBooleanAttr = makeMap(
  32102. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  32103. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  32104. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  32105. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  32106. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  32107. 'truespeed,typemustmatch,visible'
  32108. );
  32109. var xlinkNS = 'http://www.w3.org/1999/xlink';
  32110. var isXlink = function (name) {
  32111. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  32112. };
  32113. var getXlinkProp = function (name) {
  32114. return isXlink(name) ? name.slice(6, name.length) : ''
  32115. };
  32116. var isFalsyAttrValue = function (val) {
  32117. return val == null || val === false
  32118. };
  32119. /* */
  32120. function genClassForVnode (vnode) {
  32121. var data = vnode.data;
  32122. var parentNode = vnode;
  32123. var childNode = vnode;
  32124. while (isDef(childNode.componentInstance)) {
  32125. childNode = childNode.componentInstance._vnode;
  32126. if (childNode.data) {
  32127. data = mergeClassData(childNode.data, data);
  32128. }
  32129. }
  32130. while (isDef(parentNode = parentNode.parent)) {
  32131. if (parentNode.data) {
  32132. data = mergeClassData(data, parentNode.data);
  32133. }
  32134. }
  32135. return renderClass(data.staticClass, data.class)
  32136. }
  32137. function mergeClassData (child, parent) {
  32138. return {
  32139. staticClass: concat(child.staticClass, parent.staticClass),
  32140. class: isDef(child.class)
  32141. ? [child.class, parent.class]
  32142. : parent.class
  32143. }
  32144. }
  32145. function renderClass (
  32146. staticClass,
  32147. dynamicClass
  32148. ) {
  32149. if (isDef(staticClass) || isDef(dynamicClass)) {
  32150. return concat(staticClass, stringifyClass(dynamicClass))
  32151. }
  32152. /* istanbul ignore next */
  32153. return ''
  32154. }
  32155. function concat (a, b) {
  32156. return a ? b ? (a + ' ' + b) : a : (b || '')
  32157. }
  32158. function stringifyClass (value) {
  32159. if (Array.isArray(value)) {
  32160. return stringifyArray(value)
  32161. }
  32162. if (isObject(value)) {
  32163. return stringifyObject(value)
  32164. }
  32165. if (typeof value === 'string') {
  32166. return value
  32167. }
  32168. /* istanbul ignore next */
  32169. return ''
  32170. }
  32171. function stringifyArray (value) {
  32172. var res = '';
  32173. var stringified;
  32174. for (var i = 0, l = value.length; i < l; i++) {
  32175. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  32176. if (res) { res += ' '; }
  32177. res += stringified;
  32178. }
  32179. }
  32180. return res
  32181. }
  32182. function stringifyObject (value) {
  32183. var res = '';
  32184. for (var key in value) {
  32185. if (value[key]) {
  32186. if (res) { res += ' '; }
  32187. res += key;
  32188. }
  32189. }
  32190. return res
  32191. }
  32192. /* */
  32193. var namespaceMap = {
  32194. svg: 'http://www.w3.org/2000/svg',
  32195. math: 'http://www.w3.org/1998/Math/MathML'
  32196. };
  32197. var isHTMLTag = makeMap(
  32198. 'html,body,base,head,link,meta,style,title,' +
  32199. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  32200. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  32201. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  32202. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  32203. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  32204. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  32205. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  32206. 'output,progress,select,textarea,' +
  32207. 'details,dialog,menu,menuitem,summary,' +
  32208. 'content,element,shadow,template,blockquote,iframe,tfoot'
  32209. );
  32210. // this map is intentionally selective, only covering SVG elements that may
  32211. // contain child elements.
  32212. var isSVG = makeMap(
  32213. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  32214. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  32215. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  32216. true
  32217. );
  32218. var isPreTag = function (tag) { return tag === 'pre'; };
  32219. var isReservedTag = function (tag) {
  32220. return isHTMLTag(tag) || isSVG(tag)
  32221. };
  32222. function getTagNamespace (tag) {
  32223. if (isSVG(tag)) {
  32224. return 'svg'
  32225. }
  32226. // basic support for MathML
  32227. // note it doesn't support other MathML elements being component roots
  32228. if (tag === 'math') {
  32229. return 'math'
  32230. }
  32231. }
  32232. var unknownElementCache = Object.create(null);
  32233. function isUnknownElement (tag) {
  32234. /* istanbul ignore if */
  32235. if (!inBrowser) {
  32236. return true
  32237. }
  32238. if (isReservedTag(tag)) {
  32239. return false
  32240. }
  32241. tag = tag.toLowerCase();
  32242. /* istanbul ignore if */
  32243. if (unknownElementCache[tag] != null) {
  32244. return unknownElementCache[tag]
  32245. }
  32246. var el = document.createElement(tag);
  32247. if (tag.indexOf('-') > -1) {
  32248. // http://stackoverflow.com/a/28210364/1070244
  32249. return (unknownElementCache[tag] = (
  32250. el.constructor === window.HTMLUnknownElement ||
  32251. el.constructor === window.HTMLElement
  32252. ))
  32253. } else {
  32254. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  32255. }
  32256. }
  32257. /* */
  32258. /**
  32259. * Query an element selector if it's not an element already.
  32260. */
  32261. function query (el) {
  32262. if (typeof el === 'string') {
  32263. var selected = document.querySelector(el);
  32264. if (!selected) {
  32265. process.env.NODE_ENV !== 'production' && warn(
  32266. 'Cannot find element: ' + el
  32267. );
  32268. return document.createElement('div')
  32269. }
  32270. return selected
  32271. } else {
  32272. return el
  32273. }
  32274. }
  32275. /* */
  32276. function createElement$1 (tagName, vnode) {
  32277. var elm = document.createElement(tagName);
  32278. if (tagName !== 'select') {
  32279. return elm
  32280. }
  32281. // false or null will remove the attribute but undefined will not
  32282. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  32283. elm.setAttribute('multiple', 'multiple');
  32284. }
  32285. return elm
  32286. }
  32287. function createElementNS (namespace, tagName) {
  32288. return document.createElementNS(namespaceMap[namespace], tagName)
  32289. }
  32290. function createTextNode (text) {
  32291. return document.createTextNode(text)
  32292. }
  32293. function createComment (text) {
  32294. return document.createComment(text)
  32295. }
  32296. function insertBefore (parentNode, newNode, referenceNode) {
  32297. parentNode.insertBefore(newNode, referenceNode);
  32298. }
  32299. function removeChild (node, child) {
  32300. node.removeChild(child);
  32301. }
  32302. function appendChild (node, child) {
  32303. node.appendChild(child);
  32304. }
  32305. function parentNode (node) {
  32306. return node.parentNode
  32307. }
  32308. function nextSibling (node) {
  32309. return node.nextSibling
  32310. }
  32311. function tagName (node) {
  32312. return node.tagName
  32313. }
  32314. function setTextContent (node, text) {
  32315. node.textContent = text;
  32316. }
  32317. function setAttribute (node, key, val) {
  32318. node.setAttribute(key, val);
  32319. }
  32320. var nodeOps = Object.freeze({
  32321. createElement: createElement$1,
  32322. createElementNS: createElementNS,
  32323. createTextNode: createTextNode,
  32324. createComment: createComment,
  32325. insertBefore: insertBefore,
  32326. removeChild: removeChild,
  32327. appendChild: appendChild,
  32328. parentNode: parentNode,
  32329. nextSibling: nextSibling,
  32330. tagName: tagName,
  32331. setTextContent: setTextContent,
  32332. setAttribute: setAttribute
  32333. });
  32334. /* */
  32335. var ref = {
  32336. create: function create (_, vnode) {
  32337. registerRef(vnode);
  32338. },
  32339. update: function update (oldVnode, vnode) {
  32340. if (oldVnode.data.ref !== vnode.data.ref) {
  32341. registerRef(oldVnode, true);
  32342. registerRef(vnode);
  32343. }
  32344. },
  32345. destroy: function destroy (vnode) {
  32346. registerRef(vnode, true);
  32347. }
  32348. };
  32349. function registerRef (vnode, isRemoval) {
  32350. var key = vnode.data.ref;
  32351. if (!key) { return }
  32352. var vm = vnode.context;
  32353. var ref = vnode.componentInstance || vnode.elm;
  32354. var refs = vm.$refs;
  32355. if (isRemoval) {
  32356. if (Array.isArray(refs[key])) {
  32357. remove(refs[key], ref);
  32358. } else if (refs[key] === ref) {
  32359. refs[key] = undefined;
  32360. }
  32361. } else {
  32362. if (vnode.data.refInFor) {
  32363. if (!Array.isArray(refs[key])) {
  32364. refs[key] = [ref];
  32365. } else if (refs[key].indexOf(ref) < 0) {
  32366. // $flow-disable-line
  32367. refs[key].push(ref);
  32368. }
  32369. } else {
  32370. refs[key] = ref;
  32371. }
  32372. }
  32373. }
  32374. /**
  32375. * Virtual DOM patching algorithm based on Snabbdom by
  32376. * Simon Friis Vindum (@paldepind)
  32377. * Licensed under the MIT License
  32378. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  32379. *
  32380. * modified by Evan You (@yyx990803)
  32381. *
  32382. /*
  32383. * Not type-checking this because this file is perf-critical and the cost
  32384. * of making flow understand it is not worth it.
  32385. */
  32386. var emptyNode = new VNode('', {}, []);
  32387. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  32388. function sameVnode (a, b) {
  32389. return (
  32390. a.key === b.key && (
  32391. (
  32392. a.tag === b.tag &&
  32393. a.isComment === b.isComment &&
  32394. isDef(a.data) === isDef(b.data) &&
  32395. sameInputType(a, b)
  32396. ) || (
  32397. isTrue(a.isAsyncPlaceholder) &&
  32398. a.asyncFactory === b.asyncFactory &&
  32399. isUndef(b.asyncFactory.error)
  32400. )
  32401. )
  32402. )
  32403. }
  32404. // Some browsers do not support dynamically changing type for <input>
  32405. // so they need to be treated as different nodes
  32406. function sameInputType (a, b) {
  32407. if (a.tag !== 'input') { return true }
  32408. var i;
  32409. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  32410. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  32411. return typeA === typeB
  32412. }
  32413. function createKeyToOldIdx (children, beginIdx, endIdx) {
  32414. var i, key;
  32415. var map = {};
  32416. for (i = beginIdx; i <= endIdx; ++i) {
  32417. key = children[i].key;
  32418. if (isDef(key)) { map[key] = i; }
  32419. }
  32420. return map
  32421. }
  32422. function createPatchFunction (backend) {
  32423. var i, j;
  32424. var cbs = {};
  32425. var modules = backend.modules;
  32426. var nodeOps = backend.nodeOps;
  32427. for (i = 0; i < hooks.length; ++i) {
  32428. cbs[hooks[i]] = [];
  32429. for (j = 0; j < modules.length; ++j) {
  32430. if (isDef(modules[j][hooks[i]])) {
  32431. cbs[hooks[i]].push(modules[j][hooks[i]]);
  32432. }
  32433. }
  32434. }
  32435. function emptyNodeAt (elm) {
  32436. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  32437. }
  32438. function createRmCb (childElm, listeners) {
  32439. function remove$$1 () {
  32440. if (--remove$$1.listeners === 0) {
  32441. removeNode(childElm);
  32442. }
  32443. }
  32444. remove$$1.listeners = listeners;
  32445. return remove$$1
  32446. }
  32447. function removeNode (el) {
  32448. var parent = nodeOps.parentNode(el);
  32449. // element may have already been removed due to v-html / v-text
  32450. if (isDef(parent)) {
  32451. nodeOps.removeChild(parent, el);
  32452. }
  32453. }
  32454. var inPre = 0;
  32455. function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
  32456. vnode.isRootInsert = !nested; // for transition enter check
  32457. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  32458. return
  32459. }
  32460. var data = vnode.data;
  32461. var children = vnode.children;
  32462. var tag = vnode.tag;
  32463. if (isDef(tag)) {
  32464. if (process.env.NODE_ENV !== 'production') {
  32465. if (data && data.pre) {
  32466. inPre++;
  32467. }
  32468. if (
  32469. !inPre &&
  32470. !vnode.ns &&
  32471. !(config.ignoredElements.length && config.ignoredElements.indexOf(tag) > -1) &&
  32472. config.isUnknownElement(tag)
  32473. ) {
  32474. warn(
  32475. 'Unknown custom element: <' + tag + '> - did you ' +
  32476. 'register the component correctly? For recursive components, ' +
  32477. 'make sure to provide the "name" option.',
  32478. vnode.context
  32479. );
  32480. }
  32481. }
  32482. vnode.elm = vnode.ns
  32483. ? nodeOps.createElementNS(vnode.ns, tag)
  32484. : nodeOps.createElement(tag, vnode);
  32485. setScope(vnode);
  32486. /* istanbul ignore if */
  32487. {
  32488. createChildren(vnode, children, insertedVnodeQueue);
  32489. if (isDef(data)) {
  32490. invokeCreateHooks(vnode, insertedVnodeQueue);
  32491. }
  32492. insert(parentElm, vnode.elm, refElm);
  32493. }
  32494. if (process.env.NODE_ENV !== 'production' && data && data.pre) {
  32495. inPre--;
  32496. }
  32497. } else if (isTrue(vnode.isComment)) {
  32498. vnode.elm = nodeOps.createComment(vnode.text);
  32499. insert(parentElm, vnode.elm, refElm);
  32500. } else {
  32501. vnode.elm = nodeOps.createTextNode(vnode.text);
  32502. insert(parentElm, vnode.elm, refElm);
  32503. }
  32504. }
  32505. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  32506. var i = vnode.data;
  32507. if (isDef(i)) {
  32508. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  32509. if (isDef(i = i.hook) && isDef(i = i.init)) {
  32510. i(vnode, false /* hydrating */, parentElm, refElm);
  32511. }
  32512. // after calling the init hook, if the vnode is a child component
  32513. // it should've created a child instance and mounted it. the child
  32514. // component also has set the placeholder vnode's elm.
  32515. // in that case we can just return the element and be done.
  32516. if (isDef(vnode.componentInstance)) {
  32517. initComponent(vnode, insertedVnodeQueue);
  32518. if (isTrue(isReactivated)) {
  32519. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  32520. }
  32521. return true
  32522. }
  32523. }
  32524. }
  32525. function initComponent (vnode, insertedVnodeQueue) {
  32526. if (isDef(vnode.data.pendingInsert)) {
  32527. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  32528. vnode.data.pendingInsert = null;
  32529. }
  32530. vnode.elm = vnode.componentInstance.$el;
  32531. if (isPatchable(vnode)) {
  32532. invokeCreateHooks(vnode, insertedVnodeQueue);
  32533. setScope(vnode);
  32534. } else {
  32535. // empty component root.
  32536. // skip all element-related modules except for ref (#3455)
  32537. registerRef(vnode);
  32538. // make sure to invoke the insert hook
  32539. insertedVnodeQueue.push(vnode);
  32540. }
  32541. }
  32542. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  32543. var i;
  32544. // hack for #4339: a reactivated component with inner transition
  32545. // does not trigger because the inner node's created hooks are not called
  32546. // again. It's not ideal to involve module-specific logic in here but
  32547. // there doesn't seem to be a better way to do it.
  32548. var innerNode = vnode;
  32549. while (innerNode.componentInstance) {
  32550. innerNode = innerNode.componentInstance._vnode;
  32551. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  32552. for (i = 0; i < cbs.activate.length; ++i) {
  32553. cbs.activate[i](emptyNode, innerNode);
  32554. }
  32555. insertedVnodeQueue.push(innerNode);
  32556. break
  32557. }
  32558. }
  32559. // unlike a newly created component,
  32560. // a reactivated keep-alive component doesn't insert itself
  32561. insert(parentElm, vnode.elm, refElm);
  32562. }
  32563. function insert (parent, elm, ref$$1) {
  32564. if (isDef(parent)) {
  32565. if (isDef(ref$$1)) {
  32566. if (ref$$1.parentNode === parent) {
  32567. nodeOps.insertBefore(parent, elm, ref$$1);
  32568. }
  32569. } else {
  32570. nodeOps.appendChild(parent, elm);
  32571. }
  32572. }
  32573. }
  32574. function createChildren (vnode, children, insertedVnodeQueue) {
  32575. if (Array.isArray(children)) {
  32576. for (var i = 0; i < children.length; ++i) {
  32577. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
  32578. }
  32579. } else if (isPrimitive(vnode.text)) {
  32580. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
  32581. }
  32582. }
  32583. function isPatchable (vnode) {
  32584. while (vnode.componentInstance) {
  32585. vnode = vnode.componentInstance._vnode;
  32586. }
  32587. return isDef(vnode.tag)
  32588. }
  32589. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  32590. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  32591. cbs.create[i$1](emptyNode, vnode);
  32592. }
  32593. i = vnode.data.hook; // Reuse variable
  32594. if (isDef(i)) {
  32595. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  32596. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  32597. }
  32598. }
  32599. // set scope id attribute for scoped CSS.
  32600. // this is implemented as a special case to avoid the overhead
  32601. // of going through the normal attribute patching process.
  32602. function setScope (vnode) {
  32603. var i;
  32604. var ancestor = vnode;
  32605. while (ancestor) {
  32606. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  32607. nodeOps.setAttribute(vnode.elm, i, '');
  32608. }
  32609. ancestor = ancestor.parent;
  32610. }
  32611. // for slot content they should also get the scopeId from the host instance.
  32612. if (isDef(i = activeInstance) &&
  32613. i !== vnode.context &&
  32614. isDef(i = i.$options._scopeId)
  32615. ) {
  32616. nodeOps.setAttribute(vnode.elm, i, '');
  32617. }
  32618. }
  32619. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  32620. for (; startIdx <= endIdx; ++startIdx) {
  32621. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
  32622. }
  32623. }
  32624. function invokeDestroyHook (vnode) {
  32625. var i, j;
  32626. var data = vnode.data;
  32627. if (isDef(data)) {
  32628. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  32629. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  32630. }
  32631. if (isDef(i = vnode.children)) {
  32632. for (j = 0; j < vnode.children.length; ++j) {
  32633. invokeDestroyHook(vnode.children[j]);
  32634. }
  32635. }
  32636. }
  32637. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  32638. for (; startIdx <= endIdx; ++startIdx) {
  32639. var ch = vnodes[startIdx];
  32640. if (isDef(ch)) {
  32641. if (isDef(ch.tag)) {
  32642. removeAndInvokeRemoveHook(ch);
  32643. invokeDestroyHook(ch);
  32644. } else { // Text node
  32645. removeNode(ch.elm);
  32646. }
  32647. }
  32648. }
  32649. }
  32650. function removeAndInvokeRemoveHook (vnode, rm) {
  32651. if (isDef(rm) || isDef(vnode.data)) {
  32652. var i;
  32653. var listeners = cbs.remove.length + 1;
  32654. if (isDef(rm)) {
  32655. // we have a recursively passed down rm callback
  32656. // increase the listeners count
  32657. rm.listeners += listeners;
  32658. } else {
  32659. // directly removing
  32660. rm = createRmCb(vnode.elm, listeners);
  32661. }
  32662. // recursively invoke hooks on child component root node
  32663. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  32664. removeAndInvokeRemoveHook(i, rm);
  32665. }
  32666. for (i = 0; i < cbs.remove.length; ++i) {
  32667. cbs.remove[i](vnode, rm);
  32668. }
  32669. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  32670. i(vnode, rm);
  32671. } else {
  32672. rm();
  32673. }
  32674. } else {
  32675. removeNode(vnode.elm);
  32676. }
  32677. }
  32678. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  32679. var oldStartIdx = 0;
  32680. var newStartIdx = 0;
  32681. var oldEndIdx = oldCh.length - 1;
  32682. var oldStartVnode = oldCh[0];
  32683. var oldEndVnode = oldCh[oldEndIdx];
  32684. var newEndIdx = newCh.length - 1;
  32685. var newStartVnode = newCh[0];
  32686. var newEndVnode = newCh[newEndIdx];
  32687. var oldKeyToIdx, idxInOld, elmToMove, refElm;
  32688. // removeOnly is a special flag used only by <transition-group>
  32689. // to ensure removed elements stay in correct relative positions
  32690. // during leaving transitions
  32691. var canMove = !removeOnly;
  32692. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  32693. if (isUndef(oldStartVnode)) {
  32694. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  32695. } else if (isUndef(oldEndVnode)) {
  32696. oldEndVnode = oldCh[--oldEndIdx];
  32697. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  32698. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  32699. oldStartVnode = oldCh[++oldStartIdx];
  32700. newStartVnode = newCh[++newStartIdx];
  32701. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  32702. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  32703. oldEndVnode = oldCh[--oldEndIdx];
  32704. newEndVnode = newCh[--newEndIdx];
  32705. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  32706. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  32707. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  32708. oldStartVnode = oldCh[++oldStartIdx];
  32709. newEndVnode = newCh[--newEndIdx];
  32710. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  32711. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  32712. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  32713. oldEndVnode = oldCh[--oldEndIdx];
  32714. newStartVnode = newCh[++newStartIdx];
  32715. } else {
  32716. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  32717. idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : null;
  32718. if (isUndef(idxInOld)) { // New element
  32719. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  32720. newStartVnode = newCh[++newStartIdx];
  32721. } else {
  32722. elmToMove = oldCh[idxInOld];
  32723. /* istanbul ignore if */
  32724. if (process.env.NODE_ENV !== 'production' && !elmToMove) {
  32725. warn(
  32726. 'It seems there are duplicate keys that is causing an update error. ' +
  32727. 'Make sure each v-for item has a unique key.'
  32728. );
  32729. }
  32730. if (sameVnode(elmToMove, newStartVnode)) {
  32731. patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
  32732. oldCh[idxInOld] = undefined;
  32733. canMove && nodeOps.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);
  32734. newStartVnode = newCh[++newStartIdx];
  32735. } else {
  32736. // same key but different element. treat as new element
  32737. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  32738. newStartVnode = newCh[++newStartIdx];
  32739. }
  32740. }
  32741. }
  32742. }
  32743. if (oldStartIdx > oldEndIdx) {
  32744. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  32745. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  32746. } else if (newStartIdx > newEndIdx) {
  32747. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  32748. }
  32749. }
  32750. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  32751. if (oldVnode === vnode) {
  32752. return
  32753. }
  32754. var elm = vnode.elm = oldVnode.elm;
  32755. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  32756. if (isDef(vnode.asyncFactory.resolved)) {
  32757. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  32758. } else {
  32759. vnode.isAsyncPlaceholder = true;
  32760. }
  32761. return
  32762. }
  32763. // reuse element for static trees.
  32764. // note we only do this if the vnode is cloned -
  32765. // if the new node is not cloned it means the render functions have been
  32766. // reset by the hot-reload-api and we need to do a proper re-render.
  32767. if (isTrue(vnode.isStatic) &&
  32768. isTrue(oldVnode.isStatic) &&
  32769. vnode.key === oldVnode.key &&
  32770. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  32771. ) {
  32772. vnode.componentInstance = oldVnode.componentInstance;
  32773. return
  32774. }
  32775. var i;
  32776. var data = vnode.data;
  32777. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  32778. i(oldVnode, vnode);
  32779. }
  32780. var oldCh = oldVnode.children;
  32781. var ch = vnode.children;
  32782. if (isDef(data) && isPatchable(vnode)) {
  32783. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  32784. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  32785. }
  32786. if (isUndef(vnode.text)) {
  32787. if (isDef(oldCh) && isDef(ch)) {
  32788. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  32789. } else if (isDef(ch)) {
  32790. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  32791. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  32792. } else if (isDef(oldCh)) {
  32793. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  32794. } else if (isDef(oldVnode.text)) {
  32795. nodeOps.setTextContent(elm, '');
  32796. }
  32797. } else if (oldVnode.text !== vnode.text) {
  32798. nodeOps.setTextContent(elm, vnode.text);
  32799. }
  32800. if (isDef(data)) {
  32801. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  32802. }
  32803. }
  32804. function invokeInsertHook (vnode, queue, initial) {
  32805. // delay insert hooks for component root nodes, invoke them after the
  32806. // element is really inserted
  32807. if (isTrue(initial) && isDef(vnode.parent)) {
  32808. vnode.parent.data.pendingInsert = queue;
  32809. } else {
  32810. for (var i = 0; i < queue.length; ++i) {
  32811. queue[i].data.hook.insert(queue[i]);
  32812. }
  32813. }
  32814. }
  32815. var bailed = false;
  32816. // list of modules that can skip create hook during hydration because they
  32817. // are already rendered on the client or has no need for initialization
  32818. var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
  32819. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  32820. function hydrate (elm, vnode, insertedVnodeQueue) {
  32821. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  32822. vnode.elm = elm;
  32823. vnode.isAsyncPlaceholder = true;
  32824. return true
  32825. }
  32826. if (process.env.NODE_ENV !== 'production') {
  32827. if (!assertNodeMatch(elm, vnode)) {
  32828. return false
  32829. }
  32830. }
  32831. vnode.elm = elm;
  32832. var tag = vnode.tag;
  32833. var data = vnode.data;
  32834. var children = vnode.children;
  32835. if (isDef(data)) {
  32836. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  32837. if (isDef(i = vnode.componentInstance)) {
  32838. // child component. it should have hydrated its own tree.
  32839. initComponent(vnode, insertedVnodeQueue);
  32840. return true
  32841. }
  32842. }
  32843. if (isDef(tag)) {
  32844. if (isDef(children)) {
  32845. // empty element, allow client to pick up and populate children
  32846. if (!elm.hasChildNodes()) {
  32847. createChildren(vnode, children, insertedVnodeQueue);
  32848. } else {
  32849. var childrenMatch = true;
  32850. var childNode = elm.firstChild;
  32851. for (var i$1 = 0; i$1 < children.length; i$1++) {
  32852. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
  32853. childrenMatch = false;
  32854. break
  32855. }
  32856. childNode = childNode.nextSibling;
  32857. }
  32858. // if childNode is not null, it means the actual childNodes list is
  32859. // longer than the virtual children list.
  32860. if (!childrenMatch || childNode) {
  32861. if (process.env.NODE_ENV !== 'production' &&
  32862. typeof console !== 'undefined' &&
  32863. !bailed
  32864. ) {
  32865. bailed = true;
  32866. console.warn('Parent: ', elm);
  32867. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  32868. }
  32869. return false
  32870. }
  32871. }
  32872. }
  32873. if (isDef(data)) {
  32874. for (var key in data) {
  32875. if (!isRenderedModule(key)) {
  32876. invokeCreateHooks(vnode, insertedVnodeQueue);
  32877. break
  32878. }
  32879. }
  32880. }
  32881. } else if (elm.data !== vnode.text) {
  32882. elm.data = vnode.text;
  32883. }
  32884. return true
  32885. }
  32886. function assertNodeMatch (node, vnode) {
  32887. if (isDef(vnode.tag)) {
  32888. return (
  32889. vnode.tag.indexOf('vue-component') === 0 ||
  32890. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  32891. )
  32892. } else {
  32893. return node.nodeType === (vnode.isComment ? 8 : 3)
  32894. }
  32895. }
  32896. return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
  32897. if (isUndef(vnode)) {
  32898. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  32899. return
  32900. }
  32901. var isInitialPatch = false;
  32902. var insertedVnodeQueue = [];
  32903. if (isUndef(oldVnode)) {
  32904. // empty mount (likely as component), create new root element
  32905. isInitialPatch = true;
  32906. createElm(vnode, insertedVnodeQueue, parentElm, refElm);
  32907. } else {
  32908. var isRealElement = isDef(oldVnode.nodeType);
  32909. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  32910. // patch existing root node
  32911. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  32912. } else {
  32913. if (isRealElement) {
  32914. // mounting to a real element
  32915. // check if this is server-rendered content and if we can perform
  32916. // a successful hydration.
  32917. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  32918. oldVnode.removeAttribute(SSR_ATTR);
  32919. hydrating = true;
  32920. }
  32921. if (isTrue(hydrating)) {
  32922. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  32923. invokeInsertHook(vnode, insertedVnodeQueue, true);
  32924. return oldVnode
  32925. } else if (process.env.NODE_ENV !== 'production') {
  32926. warn(
  32927. 'The client-side rendered virtual DOM tree is not matching ' +
  32928. 'server-rendered content. This is likely caused by incorrect ' +
  32929. 'HTML markup, for example nesting block-level elements inside ' +
  32930. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  32931. 'full client-side render.'
  32932. );
  32933. }
  32934. }
  32935. // either not server-rendered, or hydration failed.
  32936. // create an empty node and replace it
  32937. oldVnode = emptyNodeAt(oldVnode);
  32938. }
  32939. // replacing existing element
  32940. var oldElm = oldVnode.elm;
  32941. var parentElm$1 = nodeOps.parentNode(oldElm);
  32942. createElm(
  32943. vnode,
  32944. insertedVnodeQueue,
  32945. // extremely rare edge case: do not insert if old element is in a
  32946. // leaving transition. Only happens when combining transition +
  32947. // keep-alive + HOCs. (#4590)
  32948. oldElm._leaveCb ? null : parentElm$1,
  32949. nodeOps.nextSibling(oldElm)
  32950. );
  32951. if (isDef(vnode.parent)) {
  32952. // component root element replaced.
  32953. // update parent placeholder node element, recursively
  32954. var ancestor = vnode.parent;
  32955. while (ancestor) {
  32956. ancestor.elm = vnode.elm;
  32957. ancestor = ancestor.parent;
  32958. }
  32959. if (isPatchable(vnode)) {
  32960. for (var i = 0; i < cbs.create.length; ++i) {
  32961. cbs.create[i](emptyNode, vnode.parent);
  32962. }
  32963. }
  32964. }
  32965. if (isDef(parentElm$1)) {
  32966. removeVnodes(parentElm$1, [oldVnode], 0, 0);
  32967. } else if (isDef(oldVnode.tag)) {
  32968. invokeDestroyHook(oldVnode);
  32969. }
  32970. }
  32971. }
  32972. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  32973. return vnode.elm
  32974. }
  32975. }
  32976. /* */
  32977. var directives = {
  32978. create: updateDirectives,
  32979. update: updateDirectives,
  32980. destroy: function unbindDirectives (vnode) {
  32981. updateDirectives(vnode, emptyNode);
  32982. }
  32983. };
  32984. function updateDirectives (oldVnode, vnode) {
  32985. if (oldVnode.data.directives || vnode.data.directives) {
  32986. _update(oldVnode, vnode);
  32987. }
  32988. }
  32989. function _update (oldVnode, vnode) {
  32990. var isCreate = oldVnode === emptyNode;
  32991. var isDestroy = vnode === emptyNode;
  32992. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  32993. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  32994. var dirsWithInsert = [];
  32995. var dirsWithPostpatch = [];
  32996. var key, oldDir, dir;
  32997. for (key in newDirs) {
  32998. oldDir = oldDirs[key];
  32999. dir = newDirs[key];
  33000. if (!oldDir) {
  33001. // new directive, bind
  33002. callHook$1(dir, 'bind', vnode, oldVnode);
  33003. if (dir.def && dir.def.inserted) {
  33004. dirsWithInsert.push(dir);
  33005. }
  33006. } else {
  33007. // existing directive, update
  33008. dir.oldValue = oldDir.value;
  33009. callHook$1(dir, 'update', vnode, oldVnode);
  33010. if (dir.def && dir.def.componentUpdated) {
  33011. dirsWithPostpatch.push(dir);
  33012. }
  33013. }
  33014. }
  33015. if (dirsWithInsert.length) {
  33016. var callInsert = function () {
  33017. for (var i = 0; i < dirsWithInsert.length; i++) {
  33018. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  33019. }
  33020. };
  33021. if (isCreate) {
  33022. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert);
  33023. } else {
  33024. callInsert();
  33025. }
  33026. }
  33027. if (dirsWithPostpatch.length) {
  33028. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
  33029. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  33030. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  33031. }
  33032. });
  33033. }
  33034. if (!isCreate) {
  33035. for (key in oldDirs) {
  33036. if (!newDirs[key]) {
  33037. // no longer present, unbind
  33038. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  33039. }
  33040. }
  33041. }
  33042. }
  33043. var emptyModifiers = Object.create(null);
  33044. function normalizeDirectives$1 (
  33045. dirs,
  33046. vm
  33047. ) {
  33048. var res = Object.create(null);
  33049. if (!dirs) {
  33050. return res
  33051. }
  33052. var i, dir;
  33053. for (i = 0; i < dirs.length; i++) {
  33054. dir = dirs[i];
  33055. if (!dir.modifiers) {
  33056. dir.modifiers = emptyModifiers;
  33057. }
  33058. res[getRawDirName(dir)] = dir;
  33059. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  33060. }
  33061. return res
  33062. }
  33063. function getRawDirName (dir) {
  33064. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  33065. }
  33066. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  33067. var fn = dir.def && dir.def[hook];
  33068. if (fn) {
  33069. try {
  33070. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  33071. } catch (e) {
  33072. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  33073. }
  33074. }
  33075. }
  33076. var baseModules = [
  33077. ref,
  33078. directives
  33079. ];
  33080. /* */
  33081. function updateAttrs (oldVnode, vnode) {
  33082. var opts = vnode.componentOptions;
  33083. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  33084. return
  33085. }
  33086. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  33087. return
  33088. }
  33089. var key, cur, old;
  33090. var elm = vnode.elm;
  33091. var oldAttrs = oldVnode.data.attrs || {};
  33092. var attrs = vnode.data.attrs || {};
  33093. // clone observed objects, as the user probably wants to mutate it
  33094. if (isDef(attrs.__ob__)) {
  33095. attrs = vnode.data.attrs = extend({}, attrs);
  33096. }
  33097. for (key in attrs) {
  33098. cur = attrs[key];
  33099. old = oldAttrs[key];
  33100. if (old !== cur) {
  33101. setAttr(elm, key, cur);
  33102. }
  33103. }
  33104. // #4391: in IE9, setting type can reset value for input[type=radio]
  33105. /* istanbul ignore if */
  33106. if (isIE9 && attrs.value !== oldAttrs.value) {
  33107. setAttr(elm, 'value', attrs.value);
  33108. }
  33109. for (key in oldAttrs) {
  33110. if (isUndef(attrs[key])) {
  33111. if (isXlink(key)) {
  33112. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  33113. } else if (!isEnumeratedAttr(key)) {
  33114. elm.removeAttribute(key);
  33115. }
  33116. }
  33117. }
  33118. }
  33119. function setAttr (el, key, value) {
  33120. if (isBooleanAttr(key)) {
  33121. // set attribute for blank value
  33122. // e.g. <option disabled>Select one</option>
  33123. if (isFalsyAttrValue(value)) {
  33124. el.removeAttribute(key);
  33125. } else {
  33126. el.setAttribute(key, key);
  33127. }
  33128. } else if (isEnumeratedAttr(key)) {
  33129. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  33130. } else if (isXlink(key)) {
  33131. if (isFalsyAttrValue(value)) {
  33132. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  33133. } else {
  33134. el.setAttributeNS(xlinkNS, key, value);
  33135. }
  33136. } else {
  33137. if (isFalsyAttrValue(value)) {
  33138. el.removeAttribute(key);
  33139. } else {
  33140. el.setAttribute(key, value);
  33141. }
  33142. }
  33143. }
  33144. var attrs = {
  33145. create: updateAttrs,
  33146. update: updateAttrs
  33147. };
  33148. /* */
  33149. function updateClass (oldVnode, vnode) {
  33150. var el = vnode.elm;
  33151. var data = vnode.data;
  33152. var oldData = oldVnode.data;
  33153. if (
  33154. isUndef(data.staticClass) &&
  33155. isUndef(data.class) && (
  33156. isUndef(oldData) || (
  33157. isUndef(oldData.staticClass) &&
  33158. isUndef(oldData.class)
  33159. )
  33160. )
  33161. ) {
  33162. return
  33163. }
  33164. var cls = genClassForVnode(vnode);
  33165. // handle transition classes
  33166. var transitionClass = el._transitionClasses;
  33167. if (isDef(transitionClass)) {
  33168. cls = concat(cls, stringifyClass(transitionClass));
  33169. }
  33170. // set the class
  33171. if (cls !== el._prevClass) {
  33172. el.setAttribute('class', cls);
  33173. el._prevClass = cls;
  33174. }
  33175. }
  33176. var klass = {
  33177. create: updateClass,
  33178. update: updateClass
  33179. };
  33180. /* */
  33181. var validDivisionCharRE = /[\w).+\-_$\]]/;
  33182. function parseFilters (exp) {
  33183. var inSingle = false;
  33184. var inDouble = false;
  33185. var inTemplateString = false;
  33186. var inRegex = false;
  33187. var curly = 0;
  33188. var square = 0;
  33189. var paren = 0;
  33190. var lastFilterIndex = 0;
  33191. var c, prev, i, expression, filters;
  33192. for (i = 0; i < exp.length; i++) {
  33193. prev = c;
  33194. c = exp.charCodeAt(i);
  33195. if (inSingle) {
  33196. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  33197. } else if (inDouble) {
  33198. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  33199. } else if (inTemplateString) {
  33200. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  33201. } else if (inRegex) {
  33202. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  33203. } else if (
  33204. c === 0x7C && // pipe
  33205. exp.charCodeAt(i + 1) !== 0x7C &&
  33206. exp.charCodeAt(i - 1) !== 0x7C &&
  33207. !curly && !square && !paren
  33208. ) {
  33209. if (expression === undefined) {
  33210. // first filter, end of expression
  33211. lastFilterIndex = i + 1;
  33212. expression = exp.slice(0, i).trim();
  33213. } else {
  33214. pushFilter();
  33215. }
  33216. } else {
  33217. switch (c) {
  33218. case 0x22: inDouble = true; break // "
  33219. case 0x27: inSingle = true; break // '
  33220. case 0x60: inTemplateString = true; break // `
  33221. case 0x28: paren++; break // (
  33222. case 0x29: paren--; break // )
  33223. case 0x5B: square++; break // [
  33224. case 0x5D: square--; break // ]
  33225. case 0x7B: curly++; break // {
  33226. case 0x7D: curly--; break // }
  33227. }
  33228. if (c === 0x2f) { // /
  33229. var j = i - 1;
  33230. var p = (void 0);
  33231. // find first non-whitespace prev char
  33232. for (; j >= 0; j--) {
  33233. p = exp.charAt(j);
  33234. if (p !== ' ') { break }
  33235. }
  33236. if (!p || !validDivisionCharRE.test(p)) {
  33237. inRegex = true;
  33238. }
  33239. }
  33240. }
  33241. }
  33242. if (expression === undefined) {
  33243. expression = exp.slice(0, i).trim();
  33244. } else if (lastFilterIndex !== 0) {
  33245. pushFilter();
  33246. }
  33247. function pushFilter () {
  33248. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  33249. lastFilterIndex = i + 1;
  33250. }
  33251. if (filters) {
  33252. for (i = 0; i < filters.length; i++) {
  33253. expression = wrapFilter(expression, filters[i]);
  33254. }
  33255. }
  33256. return expression
  33257. }
  33258. function wrapFilter (exp, filter) {
  33259. var i = filter.indexOf('(');
  33260. if (i < 0) {
  33261. // _f: resolveFilter
  33262. return ("_f(\"" + filter + "\")(" + exp + ")")
  33263. } else {
  33264. var name = filter.slice(0, i);
  33265. var args = filter.slice(i + 1);
  33266. return ("_f(\"" + name + "\")(" + exp + "," + args)
  33267. }
  33268. }
  33269. /* */
  33270. function baseWarn (msg) {
  33271. console.error(("[Vue compiler]: " + msg));
  33272. }
  33273. function pluckModuleFunction (
  33274. modules,
  33275. key
  33276. ) {
  33277. return modules
  33278. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  33279. : []
  33280. }
  33281. function addProp (el, name, value) {
  33282. (el.props || (el.props = [])).push({ name: name, value: value });
  33283. }
  33284. function addAttr (el, name, value) {
  33285. (el.attrs || (el.attrs = [])).push({ name: name, value: value });
  33286. }
  33287. function addDirective (
  33288. el,
  33289. name,
  33290. rawName,
  33291. value,
  33292. arg,
  33293. modifiers
  33294. ) {
  33295. (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
  33296. }
  33297. function addHandler (
  33298. el,
  33299. name,
  33300. value,
  33301. modifiers,
  33302. important,
  33303. warn
  33304. ) {
  33305. // warn prevent and passive modifier
  33306. /* istanbul ignore if */
  33307. if (
  33308. process.env.NODE_ENV !== 'production' && warn &&
  33309. modifiers && modifiers.prevent && modifiers.passive
  33310. ) {
  33311. warn(
  33312. 'passive and prevent can\'t be used together. ' +
  33313. 'Passive handler can\'t prevent default event.'
  33314. );
  33315. }
  33316. // check capture modifier
  33317. if (modifiers && modifiers.capture) {
  33318. delete modifiers.capture;
  33319. name = '!' + name; // mark the event as captured
  33320. }
  33321. if (modifiers && modifiers.once) {
  33322. delete modifiers.once;
  33323. name = '~' + name; // mark the event as once
  33324. }
  33325. /* istanbul ignore if */
  33326. if (modifiers && modifiers.passive) {
  33327. delete modifiers.passive;
  33328. name = '&' + name; // mark the event as passive
  33329. }
  33330. var events;
  33331. if (modifiers && modifiers.native) {
  33332. delete modifiers.native;
  33333. events = el.nativeEvents || (el.nativeEvents = {});
  33334. } else {
  33335. events = el.events || (el.events = {});
  33336. }
  33337. var newHandler = { value: value, modifiers: modifiers };
  33338. var handlers = events[name];
  33339. /* istanbul ignore if */
  33340. if (Array.isArray(handlers)) {
  33341. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  33342. } else if (handlers) {
  33343. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  33344. } else {
  33345. events[name] = newHandler;
  33346. }
  33347. }
  33348. function getBindingAttr (
  33349. el,
  33350. name,
  33351. getStatic
  33352. ) {
  33353. var dynamicValue =
  33354. getAndRemoveAttr(el, ':' + name) ||
  33355. getAndRemoveAttr(el, 'v-bind:' + name);
  33356. if (dynamicValue != null) {
  33357. return parseFilters(dynamicValue)
  33358. } else if (getStatic !== false) {
  33359. var staticValue = getAndRemoveAttr(el, name);
  33360. if (staticValue != null) {
  33361. return JSON.stringify(staticValue)
  33362. }
  33363. }
  33364. }
  33365. function getAndRemoveAttr (el, name) {
  33366. var val;
  33367. if ((val = el.attrsMap[name]) != null) {
  33368. var list = el.attrsList;
  33369. for (var i = 0, l = list.length; i < l; i++) {
  33370. if (list[i].name === name) {
  33371. list.splice(i, 1);
  33372. break
  33373. }
  33374. }
  33375. }
  33376. return val
  33377. }
  33378. /* */
  33379. /**
  33380. * Cross-platform code generation for component v-model
  33381. */
  33382. function genComponentModel (
  33383. el,
  33384. value,
  33385. modifiers
  33386. ) {
  33387. var ref = modifiers || {};
  33388. var number = ref.number;
  33389. var trim = ref.trim;
  33390. var baseValueExpression = '$$v';
  33391. var valueExpression = baseValueExpression;
  33392. if (trim) {
  33393. valueExpression =
  33394. "(typeof " + baseValueExpression + " === 'string'" +
  33395. "? " + baseValueExpression + ".trim()" +
  33396. ": " + baseValueExpression + ")";
  33397. }
  33398. if (number) {
  33399. valueExpression = "_n(" + valueExpression + ")";
  33400. }
  33401. var assignment = genAssignmentCode(value, valueExpression);
  33402. el.model = {
  33403. value: ("(" + value + ")"),
  33404. expression: ("\"" + value + "\""),
  33405. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  33406. };
  33407. }
  33408. /**
  33409. * Cross-platform codegen helper for generating v-model value assignment code.
  33410. */
  33411. function genAssignmentCode (
  33412. value,
  33413. assignment
  33414. ) {
  33415. var modelRs = parseModel(value);
  33416. if (modelRs.idx === null) {
  33417. return (value + "=" + assignment)
  33418. } else {
  33419. return ("$set(" + (modelRs.exp) + ", " + (modelRs.idx) + ", " + assignment + ")")
  33420. }
  33421. }
  33422. /**
  33423. * parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
  33424. *
  33425. * for loop possible cases:
  33426. *
  33427. * - test
  33428. * - test[idx]
  33429. * - test[test1[idx]]
  33430. * - test["a"][idx]
  33431. * - xxx.test[a[a].test1[idx]]
  33432. * - test.xxx.a["asa"][test1[idx]]
  33433. *
  33434. */
  33435. var len;
  33436. var str;
  33437. var chr;
  33438. var index$1;
  33439. var expressionPos;
  33440. var expressionEndPos;
  33441. function parseModel (val) {
  33442. str = val;
  33443. len = str.length;
  33444. index$1 = expressionPos = expressionEndPos = 0;
  33445. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  33446. return {
  33447. exp: val,
  33448. idx: null
  33449. }
  33450. }
  33451. while (!eof()) {
  33452. chr = next();
  33453. /* istanbul ignore if */
  33454. if (isStringStart(chr)) {
  33455. parseString(chr);
  33456. } else if (chr === 0x5B) {
  33457. parseBracket(chr);
  33458. }
  33459. }
  33460. return {
  33461. exp: val.substring(0, expressionPos),
  33462. idx: val.substring(expressionPos + 1, expressionEndPos)
  33463. }
  33464. }
  33465. function next () {
  33466. return str.charCodeAt(++index$1)
  33467. }
  33468. function eof () {
  33469. return index$1 >= len
  33470. }
  33471. function isStringStart (chr) {
  33472. return chr === 0x22 || chr === 0x27
  33473. }
  33474. function parseBracket (chr) {
  33475. var inBracket = 1;
  33476. expressionPos = index$1;
  33477. while (!eof()) {
  33478. chr = next();
  33479. if (isStringStart(chr)) {
  33480. parseString(chr);
  33481. continue
  33482. }
  33483. if (chr === 0x5B) { inBracket++; }
  33484. if (chr === 0x5D) { inBracket--; }
  33485. if (inBracket === 0) {
  33486. expressionEndPos = index$1;
  33487. break
  33488. }
  33489. }
  33490. }
  33491. function parseString (chr) {
  33492. var stringQuote = chr;
  33493. while (!eof()) {
  33494. chr = next();
  33495. if (chr === stringQuote) {
  33496. break
  33497. }
  33498. }
  33499. }
  33500. /* */
  33501. var warn$1;
  33502. // in some cases, the event used has to be determined at runtime
  33503. // so we used some reserved tokens during compile.
  33504. var RANGE_TOKEN = '__r';
  33505. var CHECKBOX_RADIO_TOKEN = '__c';
  33506. function model (
  33507. el,
  33508. dir,
  33509. _warn
  33510. ) {
  33511. warn$1 = _warn;
  33512. var value = dir.value;
  33513. var modifiers = dir.modifiers;
  33514. var tag = el.tag;
  33515. var type = el.attrsMap.type;
  33516. if (process.env.NODE_ENV !== 'production') {
  33517. var dynamicType = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  33518. if (tag === 'input' && dynamicType) {
  33519. warn$1(
  33520. "<input :type=\"" + dynamicType + "\" v-model=\"" + value + "\">:\n" +
  33521. "v-model does not support dynamic input types. Use v-if branches instead."
  33522. );
  33523. }
  33524. // inputs with type="file" are read only and setting the input's
  33525. // value will throw an error.
  33526. if (tag === 'input' && type === 'file') {
  33527. warn$1(
  33528. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  33529. "File inputs are read only. Use a v-on:change listener instead."
  33530. );
  33531. }
  33532. }
  33533. if (el.component) {
  33534. genComponentModel(el, value, modifiers);
  33535. // component v-model doesn't need extra runtime
  33536. return false
  33537. } else if (tag === 'select') {
  33538. genSelect(el, value, modifiers);
  33539. } else if (tag === 'input' && type === 'checkbox') {
  33540. genCheckboxModel(el, value, modifiers);
  33541. } else if (tag === 'input' && type === 'radio') {
  33542. genRadioModel(el, value, modifiers);
  33543. } else if (tag === 'input' || tag === 'textarea') {
  33544. genDefaultModel(el, value, modifiers);
  33545. } else if (!config.isReservedTag(tag)) {
  33546. genComponentModel(el, value, modifiers);
  33547. // component v-model doesn't need extra runtime
  33548. return false
  33549. } else if (process.env.NODE_ENV !== 'production') {
  33550. warn$1(
  33551. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  33552. "v-model is not supported on this element type. " +
  33553. 'If you are working with contenteditable, it\'s recommended to ' +
  33554. 'wrap a library dedicated for that purpose inside a custom component.'
  33555. );
  33556. }
  33557. // ensure runtime directive metadata
  33558. return true
  33559. }
  33560. function genCheckboxModel (
  33561. el,
  33562. value,
  33563. modifiers
  33564. ) {
  33565. var number = modifiers && modifiers.number;
  33566. var valueBinding = getBindingAttr(el, 'value') || 'null';
  33567. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  33568. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  33569. addProp(el, 'checked',
  33570. "Array.isArray(" + value + ")" +
  33571. "?_i(" + value + "," + valueBinding + ")>-1" + (
  33572. trueValueBinding === 'true'
  33573. ? (":(" + value + ")")
  33574. : (":_q(" + value + "," + trueValueBinding + ")")
  33575. )
  33576. );
  33577. addHandler(el, CHECKBOX_RADIO_TOKEN,
  33578. "var $$a=" + value + "," +
  33579. '$$el=$event.target,' +
  33580. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  33581. 'if(Array.isArray($$a)){' +
  33582. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  33583. '$$i=_i($$a,$$v);' +
  33584. "if($$el.checked){$$i<0&&(" + value + "=$$a.concat($$v))}" +
  33585. "else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
  33586. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  33587. null, true
  33588. );
  33589. }
  33590. function genRadioModel (
  33591. el,
  33592. value,
  33593. modifiers
  33594. ) {
  33595. var number = modifiers && modifiers.number;
  33596. var valueBinding = getBindingAttr(el, 'value') || 'null';
  33597. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  33598. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  33599. addHandler(el, CHECKBOX_RADIO_TOKEN, genAssignmentCode(value, valueBinding), null, true);
  33600. }
  33601. function genSelect (
  33602. el,
  33603. value,
  33604. modifiers
  33605. ) {
  33606. var number = modifiers && modifiers.number;
  33607. var selectedVal = "Array.prototype.filter" +
  33608. ".call($event.target.options,function(o){return o.selected})" +
  33609. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  33610. "return " + (number ? '_n(val)' : 'val') + "})";
  33611. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  33612. var code = "var $$selectedVal = " + selectedVal + ";";
  33613. code = code + " " + (genAssignmentCode(value, assignment));
  33614. addHandler(el, 'change', code, null, true);
  33615. }
  33616. function genDefaultModel (
  33617. el,
  33618. value,
  33619. modifiers
  33620. ) {
  33621. var type = el.attrsMap.type;
  33622. var ref = modifiers || {};
  33623. var lazy = ref.lazy;
  33624. var number = ref.number;
  33625. var trim = ref.trim;
  33626. var needCompositionGuard = !lazy && type !== 'range';
  33627. var event = lazy
  33628. ? 'change'
  33629. : type === 'range'
  33630. ? RANGE_TOKEN
  33631. : 'input';
  33632. var valueExpression = '$event.target.value';
  33633. if (trim) {
  33634. valueExpression = "$event.target.value.trim()";
  33635. }
  33636. if (number) {
  33637. valueExpression = "_n(" + valueExpression + ")";
  33638. }
  33639. var code = genAssignmentCode(value, valueExpression);
  33640. if (needCompositionGuard) {
  33641. code = "if($event.target.composing)return;" + code;
  33642. }
  33643. addProp(el, 'value', ("(" + value + ")"));
  33644. addHandler(el, event, code, null, true);
  33645. if (trim || number) {
  33646. addHandler(el, 'blur', '$forceUpdate()');
  33647. }
  33648. }
  33649. /* */
  33650. // normalize v-model event tokens that can only be determined at runtime.
  33651. // it's important to place the event as the first in the array because
  33652. // the whole point is ensuring the v-model callback gets called before
  33653. // user-attached handlers.
  33654. function normalizeEvents (on) {
  33655. var event;
  33656. /* istanbul ignore if */
  33657. if (isDef(on[RANGE_TOKEN])) {
  33658. // IE input[type=range] only supports `change` event
  33659. event = isIE ? 'change' : 'input';
  33660. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  33661. delete on[RANGE_TOKEN];
  33662. }
  33663. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  33664. // Chrome fires microtasks in between click/change, leads to #4521
  33665. event = isChrome ? 'click' : 'change';
  33666. on[event] = [].concat(on[CHECKBOX_RADIO_TOKEN], on[event] || []);
  33667. delete on[CHECKBOX_RADIO_TOKEN];
  33668. }
  33669. }
  33670. var target$1;
  33671. function add$1 (
  33672. event,
  33673. handler,
  33674. once$$1,
  33675. capture,
  33676. passive
  33677. ) {
  33678. if (once$$1) {
  33679. var oldHandler = handler;
  33680. var _target = target$1; // save current target element in closure
  33681. handler = function (ev) {
  33682. var res = arguments.length === 1
  33683. ? oldHandler(ev)
  33684. : oldHandler.apply(null, arguments);
  33685. if (res !== null) {
  33686. remove$2(event, handler, capture, _target);
  33687. }
  33688. };
  33689. }
  33690. target$1.addEventListener(
  33691. event,
  33692. handler,
  33693. supportsPassive
  33694. ? { capture: capture, passive: passive }
  33695. : capture
  33696. );
  33697. }
  33698. function remove$2 (
  33699. event,
  33700. handler,
  33701. capture,
  33702. _target
  33703. ) {
  33704. (_target || target$1).removeEventListener(event, handler, capture);
  33705. }
  33706. function updateDOMListeners (oldVnode, vnode) {
  33707. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  33708. return
  33709. }
  33710. var on = vnode.data.on || {};
  33711. var oldOn = oldVnode.data.on || {};
  33712. target$1 = vnode.elm;
  33713. normalizeEvents(on);
  33714. updateListeners(on, oldOn, add$1, remove$2, vnode.context);
  33715. }
  33716. var events = {
  33717. create: updateDOMListeners,
  33718. update: updateDOMListeners
  33719. };
  33720. /* */
  33721. function updateDOMProps (oldVnode, vnode) {
  33722. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  33723. return
  33724. }
  33725. var key, cur;
  33726. var elm = vnode.elm;
  33727. var oldProps = oldVnode.data.domProps || {};
  33728. var props = vnode.data.domProps || {};
  33729. // clone observed objects, as the user probably wants to mutate it
  33730. if (isDef(props.__ob__)) {
  33731. props = vnode.data.domProps = extend({}, props);
  33732. }
  33733. for (key in oldProps) {
  33734. if (isUndef(props[key])) {
  33735. elm[key] = '';
  33736. }
  33737. }
  33738. for (key in props) {
  33739. cur = props[key];
  33740. // ignore children if the node has textContent or innerHTML,
  33741. // as these will throw away existing DOM nodes and cause removal errors
  33742. // on subsequent patches (#3360)
  33743. if (key === 'textContent' || key === 'innerHTML') {
  33744. if (vnode.children) { vnode.children.length = 0; }
  33745. if (cur === oldProps[key]) { continue }
  33746. }
  33747. if (key === 'value') {
  33748. // store value as _value as well since
  33749. // non-string values will be stringified
  33750. elm._value = cur;
  33751. // avoid resetting cursor position when value is the same
  33752. var strCur = isUndef(cur) ? '' : String(cur);
  33753. if (shouldUpdateValue(elm, vnode, strCur)) {
  33754. elm.value = strCur;
  33755. }
  33756. } else {
  33757. elm[key] = cur;
  33758. }
  33759. }
  33760. }
  33761. // check platforms/web/util/attrs.js acceptValue
  33762. function shouldUpdateValue (
  33763. elm,
  33764. vnode,
  33765. checkVal
  33766. ) {
  33767. return (!elm.composing && (
  33768. vnode.tag === 'option' ||
  33769. isDirty(elm, checkVal) ||
  33770. isInputChanged(elm, checkVal)
  33771. ))
  33772. }
  33773. function isDirty (elm, checkVal) {
  33774. // return true when textbox (.number and .trim) loses focus and its value is
  33775. // not equal to the updated value
  33776. var notInFocus = true;
  33777. // #6157
  33778. // work around IE bug when accessing document.activeElement in an iframe
  33779. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  33780. return notInFocus && elm.value !== checkVal
  33781. }
  33782. function isInputChanged (elm, newVal) {
  33783. var value = elm.value;
  33784. var modifiers = elm._vModifiers; // injected by v-model runtime
  33785. if (isDef(modifiers) && modifiers.number) {
  33786. return toNumber(value) !== toNumber(newVal)
  33787. }
  33788. if (isDef(modifiers) && modifiers.trim) {
  33789. return value.trim() !== newVal.trim()
  33790. }
  33791. return value !== newVal
  33792. }
  33793. var domProps = {
  33794. create: updateDOMProps,
  33795. update: updateDOMProps
  33796. };
  33797. /* */
  33798. var parseStyleText = cached(function (cssText) {
  33799. var res = {};
  33800. var listDelimiter = /;(?![^(]*\))/g;
  33801. var propertyDelimiter = /:(.+)/;
  33802. cssText.split(listDelimiter).forEach(function (item) {
  33803. if (item) {
  33804. var tmp = item.split(propertyDelimiter);
  33805. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  33806. }
  33807. });
  33808. return res
  33809. });
  33810. // merge static and dynamic style data on the same vnode
  33811. function normalizeStyleData (data) {
  33812. var style = normalizeStyleBinding(data.style);
  33813. // static style is pre-processed into an object during compilation
  33814. // and is always a fresh object, so it's safe to merge into it
  33815. return data.staticStyle
  33816. ? extend(data.staticStyle, style)
  33817. : style
  33818. }
  33819. // normalize possible array / string values into Object
  33820. function normalizeStyleBinding (bindingStyle) {
  33821. if (Array.isArray(bindingStyle)) {
  33822. return toObject(bindingStyle)
  33823. }
  33824. if (typeof bindingStyle === 'string') {
  33825. return parseStyleText(bindingStyle)
  33826. }
  33827. return bindingStyle
  33828. }
  33829. /**
  33830. * parent component style should be after child's
  33831. * so that parent component's style could override it
  33832. */
  33833. function getStyle (vnode, checkChild) {
  33834. var res = {};
  33835. var styleData;
  33836. if (checkChild) {
  33837. var childNode = vnode;
  33838. while (childNode.componentInstance) {
  33839. childNode = childNode.componentInstance._vnode;
  33840. if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
  33841. extend(res, styleData);
  33842. }
  33843. }
  33844. }
  33845. if ((styleData = normalizeStyleData(vnode.data))) {
  33846. extend(res, styleData);
  33847. }
  33848. var parentNode = vnode;
  33849. while ((parentNode = parentNode.parent)) {
  33850. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  33851. extend(res, styleData);
  33852. }
  33853. }
  33854. return res
  33855. }
  33856. /* */
  33857. var cssVarRE = /^--/;
  33858. var importantRE = /\s*!important$/;
  33859. var setProp = function (el, name, val) {
  33860. /* istanbul ignore if */
  33861. if (cssVarRE.test(name)) {
  33862. el.style.setProperty(name, val);
  33863. } else if (importantRE.test(val)) {
  33864. el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  33865. } else {
  33866. var normalizedName = normalize(name);
  33867. if (Array.isArray(val)) {
  33868. // Support values array created by autoprefixer, e.g.
  33869. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  33870. // Set them one by one, and the browser will only set those it can recognize
  33871. for (var i = 0, len = val.length; i < len; i++) {
  33872. el.style[normalizedName] = val[i];
  33873. }
  33874. } else {
  33875. el.style[normalizedName] = val;
  33876. }
  33877. }
  33878. };
  33879. var vendorNames = ['Webkit', 'Moz', 'ms'];
  33880. var emptyStyle;
  33881. var normalize = cached(function (prop) {
  33882. emptyStyle = emptyStyle || document.createElement('div').style;
  33883. prop = camelize(prop);
  33884. if (prop !== 'filter' && (prop in emptyStyle)) {
  33885. return prop
  33886. }
  33887. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  33888. for (var i = 0; i < vendorNames.length; i++) {
  33889. var name = vendorNames[i] + capName;
  33890. if (name in emptyStyle) {
  33891. return name
  33892. }
  33893. }
  33894. });
  33895. function updateStyle (oldVnode, vnode) {
  33896. var data = vnode.data;
  33897. var oldData = oldVnode.data;
  33898. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  33899. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  33900. ) {
  33901. return
  33902. }
  33903. var cur, name;
  33904. var el = vnode.elm;
  33905. var oldStaticStyle = oldData.staticStyle;
  33906. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  33907. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  33908. var oldStyle = oldStaticStyle || oldStyleBinding;
  33909. var style = normalizeStyleBinding(vnode.data.style) || {};
  33910. // store normalized style under a different key for next diff
  33911. // make sure to clone it if it's reactive, since the user likley wants
  33912. // to mutate it.
  33913. vnode.data.normalizedStyle = isDef(style.__ob__)
  33914. ? extend({}, style)
  33915. : style;
  33916. var newStyle = getStyle(vnode, true);
  33917. for (name in oldStyle) {
  33918. if (isUndef(newStyle[name])) {
  33919. setProp(el, name, '');
  33920. }
  33921. }
  33922. for (name in newStyle) {
  33923. cur = newStyle[name];
  33924. if (cur !== oldStyle[name]) {
  33925. // ie9 setting to null has no effect, must use empty string
  33926. setProp(el, name, cur == null ? '' : cur);
  33927. }
  33928. }
  33929. }
  33930. var style = {
  33931. create: updateStyle,
  33932. update: updateStyle
  33933. };
  33934. /* */
  33935. /**
  33936. * Add class with compatibility for SVG since classList is not supported on
  33937. * SVG elements in IE
  33938. */
  33939. function addClass (el, cls) {
  33940. /* istanbul ignore if */
  33941. if (!cls || !(cls = cls.trim())) {
  33942. return
  33943. }
  33944. /* istanbul ignore else */
  33945. if (el.classList) {
  33946. if (cls.indexOf(' ') > -1) {
  33947. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  33948. } else {
  33949. el.classList.add(cls);
  33950. }
  33951. } else {
  33952. var cur = " " + (el.getAttribute('class') || '') + " ";
  33953. if (cur.indexOf(' ' + cls + ' ') < 0) {
  33954. el.setAttribute('class', (cur + cls).trim());
  33955. }
  33956. }
  33957. }
  33958. /**
  33959. * Remove class with compatibility for SVG since classList is not supported on
  33960. * SVG elements in IE
  33961. */
  33962. function removeClass (el, cls) {
  33963. /* istanbul ignore if */
  33964. if (!cls || !(cls = cls.trim())) {
  33965. return
  33966. }
  33967. /* istanbul ignore else */
  33968. if (el.classList) {
  33969. if (cls.indexOf(' ') > -1) {
  33970. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  33971. } else {
  33972. el.classList.remove(cls);
  33973. }
  33974. if (!el.classList.length) {
  33975. el.removeAttribute('class');
  33976. }
  33977. } else {
  33978. var cur = " " + (el.getAttribute('class') || '') + " ";
  33979. var tar = ' ' + cls + ' ';
  33980. while (cur.indexOf(tar) >= 0) {
  33981. cur = cur.replace(tar, ' ');
  33982. }
  33983. cur = cur.trim();
  33984. if (cur) {
  33985. el.setAttribute('class', cur);
  33986. } else {
  33987. el.removeAttribute('class');
  33988. }
  33989. }
  33990. }
  33991. /* */
  33992. function resolveTransition (def$$1) {
  33993. if (!def$$1) {
  33994. return
  33995. }
  33996. /* istanbul ignore else */
  33997. if (typeof def$$1 === 'object') {
  33998. var res = {};
  33999. if (def$$1.css !== false) {
  34000. extend(res, autoCssTransition(def$$1.name || 'v'));
  34001. }
  34002. extend(res, def$$1);
  34003. return res
  34004. } else if (typeof def$$1 === 'string') {
  34005. return autoCssTransition(def$$1)
  34006. }
  34007. }
  34008. var autoCssTransition = cached(function (name) {
  34009. return {
  34010. enterClass: (name + "-enter"),
  34011. enterToClass: (name + "-enter-to"),
  34012. enterActiveClass: (name + "-enter-active"),
  34013. leaveClass: (name + "-leave"),
  34014. leaveToClass: (name + "-leave-to"),
  34015. leaveActiveClass: (name + "-leave-active")
  34016. }
  34017. });
  34018. var hasTransition = inBrowser && !isIE9;
  34019. var TRANSITION = 'transition';
  34020. var ANIMATION = 'animation';
  34021. // Transition property/event sniffing
  34022. var transitionProp = 'transition';
  34023. var transitionEndEvent = 'transitionend';
  34024. var animationProp = 'animation';
  34025. var animationEndEvent = 'animationend';
  34026. if (hasTransition) {
  34027. /* istanbul ignore if */
  34028. if (window.ontransitionend === undefined &&
  34029. window.onwebkittransitionend !== undefined
  34030. ) {
  34031. transitionProp = 'WebkitTransition';
  34032. transitionEndEvent = 'webkitTransitionEnd';
  34033. }
  34034. if (window.onanimationend === undefined &&
  34035. window.onwebkitanimationend !== undefined
  34036. ) {
  34037. animationProp = 'WebkitAnimation';
  34038. animationEndEvent = 'webkitAnimationEnd';
  34039. }
  34040. }
  34041. // binding to window is necessary to make hot reload work in IE in strict mode
  34042. var raf = inBrowser && window.requestAnimationFrame
  34043. ? window.requestAnimationFrame.bind(window)
  34044. : setTimeout;
  34045. function nextFrame (fn) {
  34046. raf(function () {
  34047. raf(fn);
  34048. });
  34049. }
  34050. function addTransitionClass (el, cls) {
  34051. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  34052. if (transitionClasses.indexOf(cls) < 0) {
  34053. transitionClasses.push(cls);
  34054. addClass(el, cls);
  34055. }
  34056. }
  34057. function removeTransitionClass (el, cls) {
  34058. if (el._transitionClasses) {
  34059. remove(el._transitionClasses, cls);
  34060. }
  34061. removeClass(el, cls);
  34062. }
  34063. function whenTransitionEnds (
  34064. el,
  34065. expectedType,
  34066. cb
  34067. ) {
  34068. var ref = getTransitionInfo(el, expectedType);
  34069. var type = ref.type;
  34070. var timeout = ref.timeout;
  34071. var propCount = ref.propCount;
  34072. if (!type) { return cb() }
  34073. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  34074. var ended = 0;
  34075. var end = function () {
  34076. el.removeEventListener(event, onEnd);
  34077. cb();
  34078. };
  34079. var onEnd = function (e) {
  34080. if (e.target === el) {
  34081. if (++ended >= propCount) {
  34082. end();
  34083. }
  34084. }
  34085. };
  34086. setTimeout(function () {
  34087. if (ended < propCount) {
  34088. end();
  34089. }
  34090. }, timeout + 1);
  34091. el.addEventListener(event, onEnd);
  34092. }
  34093. var transformRE = /\b(transform|all)(,|$)/;
  34094. function getTransitionInfo (el, expectedType) {
  34095. var styles = window.getComputedStyle(el);
  34096. var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
  34097. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  34098. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  34099. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  34100. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  34101. var animationTimeout = getTimeout(animationDelays, animationDurations);
  34102. var type;
  34103. var timeout = 0;
  34104. var propCount = 0;
  34105. /* istanbul ignore if */
  34106. if (expectedType === TRANSITION) {
  34107. if (transitionTimeout > 0) {
  34108. type = TRANSITION;
  34109. timeout = transitionTimeout;
  34110. propCount = transitionDurations.length;
  34111. }
  34112. } else if (expectedType === ANIMATION) {
  34113. if (animationTimeout > 0) {
  34114. type = ANIMATION;
  34115. timeout = animationTimeout;
  34116. propCount = animationDurations.length;
  34117. }
  34118. } else {
  34119. timeout = Math.max(transitionTimeout, animationTimeout);
  34120. type = timeout > 0
  34121. ? transitionTimeout > animationTimeout
  34122. ? TRANSITION
  34123. : ANIMATION
  34124. : null;
  34125. propCount = type
  34126. ? type === TRANSITION
  34127. ? transitionDurations.length
  34128. : animationDurations.length
  34129. : 0;
  34130. }
  34131. var hasTransform =
  34132. type === TRANSITION &&
  34133. transformRE.test(styles[transitionProp + 'Property']);
  34134. return {
  34135. type: type,
  34136. timeout: timeout,
  34137. propCount: propCount,
  34138. hasTransform: hasTransform
  34139. }
  34140. }
  34141. function getTimeout (delays, durations) {
  34142. /* istanbul ignore next */
  34143. while (delays.length < durations.length) {
  34144. delays = delays.concat(delays);
  34145. }
  34146. return Math.max.apply(null, durations.map(function (d, i) {
  34147. return toMs(d) + toMs(delays[i])
  34148. }))
  34149. }
  34150. function toMs (s) {
  34151. return Number(s.slice(0, -1)) * 1000
  34152. }
  34153. /* */
  34154. function enter (vnode, toggleDisplay) {
  34155. var el = vnode.elm;
  34156. // call leave callback now
  34157. if (isDef(el._leaveCb)) {
  34158. el._leaveCb.cancelled = true;
  34159. el._leaveCb();
  34160. }
  34161. var data = resolveTransition(vnode.data.transition);
  34162. if (isUndef(data)) {
  34163. return
  34164. }
  34165. /* istanbul ignore if */
  34166. if (isDef(el._enterCb) || el.nodeType !== 1) {
  34167. return
  34168. }
  34169. var css = data.css;
  34170. var type = data.type;
  34171. var enterClass = data.enterClass;
  34172. var enterToClass = data.enterToClass;
  34173. var enterActiveClass = data.enterActiveClass;
  34174. var appearClass = data.appearClass;
  34175. var appearToClass = data.appearToClass;
  34176. var appearActiveClass = data.appearActiveClass;
  34177. var beforeEnter = data.beforeEnter;
  34178. var enter = data.enter;
  34179. var afterEnter = data.afterEnter;
  34180. var enterCancelled = data.enterCancelled;
  34181. var beforeAppear = data.beforeAppear;
  34182. var appear = data.appear;
  34183. var afterAppear = data.afterAppear;
  34184. var appearCancelled = data.appearCancelled;
  34185. var duration = data.duration;
  34186. // activeInstance will always be the <transition> component managing this
  34187. // transition. One edge case to check is when the <transition> is placed
  34188. // as the root node of a child component. In that case we need to check
  34189. // <transition>'s parent for appear check.
  34190. var context = activeInstance;
  34191. var transitionNode = activeInstance.$vnode;
  34192. while (transitionNode && transitionNode.parent) {
  34193. transitionNode = transitionNode.parent;
  34194. context = transitionNode.context;
  34195. }
  34196. var isAppear = !context._isMounted || !vnode.isRootInsert;
  34197. if (isAppear && !appear && appear !== '') {
  34198. return
  34199. }
  34200. var startClass = isAppear && appearClass
  34201. ? appearClass
  34202. : enterClass;
  34203. var activeClass = isAppear && appearActiveClass
  34204. ? appearActiveClass
  34205. : enterActiveClass;
  34206. var toClass = isAppear && appearToClass
  34207. ? appearToClass
  34208. : enterToClass;
  34209. var beforeEnterHook = isAppear
  34210. ? (beforeAppear || beforeEnter)
  34211. : beforeEnter;
  34212. var enterHook = isAppear
  34213. ? (typeof appear === 'function' ? appear : enter)
  34214. : enter;
  34215. var afterEnterHook = isAppear
  34216. ? (afterAppear || afterEnter)
  34217. : afterEnter;
  34218. var enterCancelledHook = isAppear
  34219. ? (appearCancelled || enterCancelled)
  34220. : enterCancelled;
  34221. var explicitEnterDuration = toNumber(
  34222. isObject(duration)
  34223. ? duration.enter
  34224. : duration
  34225. );
  34226. if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
  34227. checkDuration(explicitEnterDuration, 'enter', vnode);
  34228. }
  34229. var expectsCSS = css !== false && !isIE9;
  34230. var userWantsControl = getHookArgumentsLength(enterHook);
  34231. var cb = el._enterCb = once(function () {
  34232. if (expectsCSS) {
  34233. removeTransitionClass(el, toClass);
  34234. removeTransitionClass(el, activeClass);
  34235. }
  34236. if (cb.cancelled) {
  34237. if (expectsCSS) {
  34238. removeTransitionClass(el, startClass);
  34239. }
  34240. enterCancelledHook && enterCancelledHook(el);
  34241. } else {
  34242. afterEnterHook && afterEnterHook(el);
  34243. }
  34244. el._enterCb = null;
  34245. });
  34246. if (!vnode.data.show) {
  34247. // remove pending leave element on enter by injecting an insert hook
  34248. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
  34249. var parent = el.parentNode;
  34250. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  34251. if (pendingNode &&
  34252. pendingNode.tag === vnode.tag &&
  34253. pendingNode.elm._leaveCb
  34254. ) {
  34255. pendingNode.elm._leaveCb();
  34256. }
  34257. enterHook && enterHook(el, cb);
  34258. });
  34259. }
  34260. // start enter transition
  34261. beforeEnterHook && beforeEnterHook(el);
  34262. if (expectsCSS) {
  34263. addTransitionClass(el, startClass);
  34264. addTransitionClass(el, activeClass);
  34265. nextFrame(function () {
  34266. addTransitionClass(el, toClass);
  34267. removeTransitionClass(el, startClass);
  34268. if (!cb.cancelled && !userWantsControl) {
  34269. if (isValidDuration(explicitEnterDuration)) {
  34270. setTimeout(cb, explicitEnterDuration);
  34271. } else {
  34272. whenTransitionEnds(el, type, cb);
  34273. }
  34274. }
  34275. });
  34276. }
  34277. if (vnode.data.show) {
  34278. toggleDisplay && toggleDisplay();
  34279. enterHook && enterHook(el, cb);
  34280. }
  34281. if (!expectsCSS && !userWantsControl) {
  34282. cb();
  34283. }
  34284. }
  34285. function leave (vnode, rm) {
  34286. var el = vnode.elm;
  34287. // call enter callback now
  34288. if (isDef(el._enterCb)) {
  34289. el._enterCb.cancelled = true;
  34290. el._enterCb();
  34291. }
  34292. var data = resolveTransition(vnode.data.transition);
  34293. if (isUndef(data)) {
  34294. return rm()
  34295. }
  34296. /* istanbul ignore if */
  34297. if (isDef(el._leaveCb) || el.nodeType !== 1) {
  34298. return
  34299. }
  34300. var css = data.css;
  34301. var type = data.type;
  34302. var leaveClass = data.leaveClass;
  34303. var leaveToClass = data.leaveToClass;
  34304. var leaveActiveClass = data.leaveActiveClass;
  34305. var beforeLeave = data.beforeLeave;
  34306. var leave = data.leave;
  34307. var afterLeave = data.afterLeave;
  34308. var leaveCancelled = data.leaveCancelled;
  34309. var delayLeave = data.delayLeave;
  34310. var duration = data.duration;
  34311. var expectsCSS = css !== false && !isIE9;
  34312. var userWantsControl = getHookArgumentsLength(leave);
  34313. var explicitLeaveDuration = toNumber(
  34314. isObject(duration)
  34315. ? duration.leave
  34316. : duration
  34317. );
  34318. if (process.env.NODE_ENV !== 'production' && isDef(explicitLeaveDuration)) {
  34319. checkDuration(explicitLeaveDuration, 'leave', vnode);
  34320. }
  34321. var cb = el._leaveCb = once(function () {
  34322. if (el.parentNode && el.parentNode._pending) {
  34323. el.parentNode._pending[vnode.key] = null;
  34324. }
  34325. if (expectsCSS) {
  34326. removeTransitionClass(el, leaveToClass);
  34327. removeTransitionClass(el, leaveActiveClass);
  34328. }
  34329. if (cb.cancelled) {
  34330. if (expectsCSS) {
  34331. removeTransitionClass(el, leaveClass);
  34332. }
  34333. leaveCancelled && leaveCancelled(el);
  34334. } else {
  34335. rm();
  34336. afterLeave && afterLeave(el);
  34337. }
  34338. el._leaveCb = null;
  34339. });
  34340. if (delayLeave) {
  34341. delayLeave(performLeave);
  34342. } else {
  34343. performLeave();
  34344. }
  34345. function performLeave () {
  34346. // the delayed leave may have already been cancelled
  34347. if (cb.cancelled) {
  34348. return
  34349. }
  34350. // record leaving element
  34351. if (!vnode.data.show) {
  34352. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  34353. }
  34354. beforeLeave && beforeLeave(el);
  34355. if (expectsCSS) {
  34356. addTransitionClass(el, leaveClass);
  34357. addTransitionClass(el, leaveActiveClass);
  34358. nextFrame(function () {
  34359. addTransitionClass(el, leaveToClass);
  34360. removeTransitionClass(el, leaveClass);
  34361. if (!cb.cancelled && !userWantsControl) {
  34362. if (isValidDuration(explicitLeaveDuration)) {
  34363. setTimeout(cb, explicitLeaveDuration);
  34364. } else {
  34365. whenTransitionEnds(el, type, cb);
  34366. }
  34367. }
  34368. });
  34369. }
  34370. leave && leave(el, cb);
  34371. if (!expectsCSS && !userWantsControl) {
  34372. cb();
  34373. }
  34374. }
  34375. }
  34376. // only used in dev mode
  34377. function checkDuration (val, name, vnode) {
  34378. if (typeof val !== 'number') {
  34379. warn(
  34380. "<transition> explicit " + name + " duration is not a valid number - " +
  34381. "got " + (JSON.stringify(val)) + ".",
  34382. vnode.context
  34383. );
  34384. } else if (isNaN(val)) {
  34385. warn(
  34386. "<transition> explicit " + name + " duration is NaN - " +
  34387. 'the duration expression might be incorrect.',
  34388. vnode.context
  34389. );
  34390. }
  34391. }
  34392. function isValidDuration (val) {
  34393. return typeof val === 'number' && !isNaN(val)
  34394. }
  34395. /**
  34396. * Normalize a transition hook's argument length. The hook may be:
  34397. * - a merged hook (invoker) with the original in .fns
  34398. * - a wrapped component method (check ._length)
  34399. * - a plain function (.length)
  34400. */
  34401. function getHookArgumentsLength (fn) {
  34402. if (isUndef(fn)) {
  34403. return false
  34404. }
  34405. var invokerFns = fn.fns;
  34406. if (isDef(invokerFns)) {
  34407. // invoker
  34408. return getHookArgumentsLength(
  34409. Array.isArray(invokerFns)
  34410. ? invokerFns[0]
  34411. : invokerFns
  34412. )
  34413. } else {
  34414. return (fn._length || fn.length) > 1
  34415. }
  34416. }
  34417. function _enter (_, vnode) {
  34418. if (vnode.data.show !== true) {
  34419. enter(vnode);
  34420. }
  34421. }
  34422. var transition = inBrowser ? {
  34423. create: _enter,
  34424. activate: _enter,
  34425. remove: function remove$$1 (vnode, rm) {
  34426. /* istanbul ignore else */
  34427. if (vnode.data.show !== true) {
  34428. leave(vnode, rm);
  34429. } else {
  34430. rm();
  34431. }
  34432. }
  34433. } : {};
  34434. var platformModules = [
  34435. attrs,
  34436. klass,
  34437. events,
  34438. domProps,
  34439. style,
  34440. transition
  34441. ];
  34442. /* */
  34443. // the directive module should be applied last, after all
  34444. // built-in modules have been applied.
  34445. var modules = platformModules.concat(baseModules);
  34446. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  34447. /**
  34448. * Not type checking this file because flow doesn't like attaching
  34449. * properties to Elements.
  34450. */
  34451. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  34452. /* istanbul ignore if */
  34453. if (isIE9) {
  34454. // http://www.matts411.com/post/internet-explorer-9-oninput/
  34455. document.addEventListener('selectionchange', function () {
  34456. var el = document.activeElement;
  34457. if (el && el.vmodel) {
  34458. trigger(el, 'input');
  34459. }
  34460. });
  34461. }
  34462. var model$1 = {
  34463. inserted: function inserted (el, binding, vnode) {
  34464. if (vnode.tag === 'select') {
  34465. var cb = function () {
  34466. setSelected(el, binding, vnode.context);
  34467. };
  34468. cb();
  34469. /* istanbul ignore if */
  34470. if (isIE || isEdge) {
  34471. setTimeout(cb, 0);
  34472. }
  34473. el._vOptions = [].map.call(el.options, getValue);
  34474. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  34475. el._vModifiers = binding.modifiers;
  34476. if (!binding.modifiers.lazy) {
  34477. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  34478. // switching focus before confirming composition choice
  34479. // this also fixes the issue where some browsers e.g. iOS Chrome
  34480. // fires "change" instead of "input" on autocomplete.
  34481. el.addEventListener('change', onCompositionEnd);
  34482. if (!isAndroid) {
  34483. el.addEventListener('compositionstart', onCompositionStart);
  34484. el.addEventListener('compositionend', onCompositionEnd);
  34485. }
  34486. /* istanbul ignore if */
  34487. if (isIE9) {
  34488. el.vmodel = true;
  34489. }
  34490. }
  34491. }
  34492. },
  34493. componentUpdated: function componentUpdated (el, binding, vnode) {
  34494. if (vnode.tag === 'select') {
  34495. setSelected(el, binding, vnode.context);
  34496. // in case the options rendered by v-for have changed,
  34497. // it's possible that the value is out-of-sync with the rendered options.
  34498. // detect such cases and filter out values that no longer has a matching
  34499. // option in the DOM.
  34500. var prevOptions = el._vOptions;
  34501. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  34502. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  34503. trigger(el, 'change');
  34504. }
  34505. }
  34506. }
  34507. };
  34508. function setSelected (el, binding, vm) {
  34509. var value = binding.value;
  34510. var isMultiple = el.multiple;
  34511. if (isMultiple && !Array.isArray(value)) {
  34512. process.env.NODE_ENV !== 'production' && warn(
  34513. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  34514. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  34515. vm
  34516. );
  34517. return
  34518. }
  34519. var selected, option;
  34520. for (var i = 0, l = el.options.length; i < l; i++) {
  34521. option = el.options[i];
  34522. if (isMultiple) {
  34523. selected = looseIndexOf(value, getValue(option)) > -1;
  34524. if (option.selected !== selected) {
  34525. option.selected = selected;
  34526. }
  34527. } else {
  34528. if (looseEqual(getValue(option), value)) {
  34529. if (el.selectedIndex !== i) {
  34530. el.selectedIndex = i;
  34531. }
  34532. return
  34533. }
  34534. }
  34535. }
  34536. if (!isMultiple) {
  34537. el.selectedIndex = -1;
  34538. }
  34539. }
  34540. function getValue (option) {
  34541. return '_value' in option
  34542. ? option._value
  34543. : option.value
  34544. }
  34545. function onCompositionStart (e) {
  34546. e.target.composing = true;
  34547. }
  34548. function onCompositionEnd (e) {
  34549. // prevent triggering an input event for no reason
  34550. if (!e.target.composing) { return }
  34551. e.target.composing = false;
  34552. trigger(e.target, 'input');
  34553. }
  34554. function trigger (el, type) {
  34555. var e = document.createEvent('HTMLEvents');
  34556. e.initEvent(type, true, true);
  34557. el.dispatchEvent(e);
  34558. }
  34559. /* */
  34560. // recursively search for possible transition defined inside the component root
  34561. function locateNode (vnode) {
  34562. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  34563. ? locateNode(vnode.componentInstance._vnode)
  34564. : vnode
  34565. }
  34566. var show = {
  34567. bind: function bind (el, ref, vnode) {
  34568. var value = ref.value;
  34569. vnode = locateNode(vnode);
  34570. var transition$$1 = vnode.data && vnode.data.transition;
  34571. var originalDisplay = el.__vOriginalDisplay =
  34572. el.style.display === 'none' ? '' : el.style.display;
  34573. if (value && transition$$1) {
  34574. vnode.data.show = true;
  34575. enter(vnode, function () {
  34576. el.style.display = originalDisplay;
  34577. });
  34578. } else {
  34579. el.style.display = value ? originalDisplay : 'none';
  34580. }
  34581. },
  34582. update: function update (el, ref, vnode) {
  34583. var value = ref.value;
  34584. var oldValue = ref.oldValue;
  34585. /* istanbul ignore if */
  34586. if (value === oldValue) { return }
  34587. vnode = locateNode(vnode);
  34588. var transition$$1 = vnode.data && vnode.data.transition;
  34589. if (transition$$1) {
  34590. vnode.data.show = true;
  34591. if (value) {
  34592. enter(vnode, function () {
  34593. el.style.display = el.__vOriginalDisplay;
  34594. });
  34595. } else {
  34596. leave(vnode, function () {
  34597. el.style.display = 'none';
  34598. });
  34599. }
  34600. } else {
  34601. el.style.display = value ? el.__vOriginalDisplay : 'none';
  34602. }
  34603. },
  34604. unbind: function unbind (
  34605. el,
  34606. binding,
  34607. vnode,
  34608. oldVnode,
  34609. isDestroy
  34610. ) {
  34611. if (!isDestroy) {
  34612. el.style.display = el.__vOriginalDisplay;
  34613. }
  34614. }
  34615. };
  34616. var platformDirectives = {
  34617. model: model$1,
  34618. show: show
  34619. };
  34620. /* */
  34621. // Provides transition support for a single element/component.
  34622. // supports transition mode (out-in / in-out)
  34623. var transitionProps = {
  34624. name: String,
  34625. appear: Boolean,
  34626. css: Boolean,
  34627. mode: String,
  34628. type: String,
  34629. enterClass: String,
  34630. leaveClass: String,
  34631. enterToClass: String,
  34632. leaveToClass: String,
  34633. enterActiveClass: String,
  34634. leaveActiveClass: String,
  34635. appearClass: String,
  34636. appearActiveClass: String,
  34637. appearToClass: String,
  34638. duration: [Number, String, Object]
  34639. };
  34640. // in case the child is also an abstract component, e.g. <keep-alive>
  34641. // we want to recursively retrieve the real component to be rendered
  34642. function getRealChild (vnode) {
  34643. var compOptions = vnode && vnode.componentOptions;
  34644. if (compOptions && compOptions.Ctor.options.abstract) {
  34645. return getRealChild(getFirstComponentChild(compOptions.children))
  34646. } else {
  34647. return vnode
  34648. }
  34649. }
  34650. function extractTransitionData (comp) {
  34651. var data = {};
  34652. var options = comp.$options;
  34653. // props
  34654. for (var key in options.propsData) {
  34655. data[key] = comp[key];
  34656. }
  34657. // events.
  34658. // extract listeners and pass them directly to the transition methods
  34659. var listeners = options._parentListeners;
  34660. for (var key$1 in listeners) {
  34661. data[camelize(key$1)] = listeners[key$1];
  34662. }
  34663. return data
  34664. }
  34665. function placeholder (h, rawChild) {
  34666. if (/\d-keep-alive$/.test(rawChild.tag)) {
  34667. return h('keep-alive', {
  34668. props: rawChild.componentOptions.propsData
  34669. })
  34670. }
  34671. }
  34672. function hasParentTransition (vnode) {
  34673. while ((vnode = vnode.parent)) {
  34674. if (vnode.data.transition) {
  34675. return true
  34676. }
  34677. }
  34678. }
  34679. function isSameChild (child, oldChild) {
  34680. return oldChild.key === child.key && oldChild.tag === child.tag
  34681. }
  34682. function isAsyncPlaceholder (node) {
  34683. return node.isComment && node.asyncFactory
  34684. }
  34685. var Transition = {
  34686. name: 'transition',
  34687. props: transitionProps,
  34688. abstract: true,
  34689. render: function render (h) {
  34690. var this$1 = this;
  34691. var children = this.$options._renderChildren;
  34692. if (!children) {
  34693. return
  34694. }
  34695. // filter out text nodes (possible whitespaces)
  34696. children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
  34697. /* istanbul ignore if */
  34698. if (!children.length) {
  34699. return
  34700. }
  34701. // warn multiple elements
  34702. if (process.env.NODE_ENV !== 'production' && children.length > 1) {
  34703. warn(
  34704. '<transition> can only be used on a single element. Use ' +
  34705. '<transition-group> for lists.',
  34706. this.$parent
  34707. );
  34708. }
  34709. var mode = this.mode;
  34710. // warn invalid mode
  34711. if (process.env.NODE_ENV !== 'production' &&
  34712. mode && mode !== 'in-out' && mode !== 'out-in'
  34713. ) {
  34714. warn(
  34715. 'invalid <transition> mode: ' + mode,
  34716. this.$parent
  34717. );
  34718. }
  34719. var rawChild = children[0];
  34720. // if this is a component root node and the component's
  34721. // parent container node also has transition, skip.
  34722. if (hasParentTransition(this.$vnode)) {
  34723. return rawChild
  34724. }
  34725. // apply transition data to child
  34726. // use getRealChild() to ignore abstract components e.g. keep-alive
  34727. var child = getRealChild(rawChild);
  34728. /* istanbul ignore if */
  34729. if (!child) {
  34730. return rawChild
  34731. }
  34732. if (this._leaving) {
  34733. return placeholder(h, rawChild)
  34734. }
  34735. // ensure a key that is unique to the vnode type and to this transition
  34736. // component instance. This key will be used to remove pending leaving nodes
  34737. // during entering.
  34738. var id = "__transition-" + (this._uid) + "-";
  34739. child.key = child.key == null
  34740. ? child.isComment
  34741. ? id + 'comment'
  34742. : id + child.tag
  34743. : isPrimitive(child.key)
  34744. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  34745. : child.key;
  34746. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  34747. var oldRawChild = this._vnode;
  34748. var oldChild = getRealChild(oldRawChild);
  34749. // mark v-show
  34750. // so that the transition module can hand over the control to the directive
  34751. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  34752. child.data.show = true;
  34753. }
  34754. if (
  34755. oldChild &&
  34756. oldChild.data &&
  34757. !isSameChild(child, oldChild) &&
  34758. !isAsyncPlaceholder(oldChild)
  34759. ) {
  34760. // replace old child transition data with fresh one
  34761. // important for dynamic transitions!
  34762. var oldData = oldChild && (oldChild.data.transition = extend({}, data));
  34763. // handle transition mode
  34764. if (mode === 'out-in') {
  34765. // return placeholder node and queue update when leave finishes
  34766. this._leaving = true;
  34767. mergeVNodeHook(oldData, 'afterLeave', function () {
  34768. this$1._leaving = false;
  34769. this$1.$forceUpdate();
  34770. });
  34771. return placeholder(h, rawChild)
  34772. } else if (mode === 'in-out') {
  34773. if (isAsyncPlaceholder(child)) {
  34774. return oldRawChild
  34775. }
  34776. var delayedLeave;
  34777. var performLeave = function () { delayedLeave(); };
  34778. mergeVNodeHook(data, 'afterEnter', performLeave);
  34779. mergeVNodeHook(data, 'enterCancelled', performLeave);
  34780. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  34781. }
  34782. }
  34783. return rawChild
  34784. }
  34785. };
  34786. /* */
  34787. // Provides transition support for list items.
  34788. // supports move transitions using the FLIP technique.
  34789. // Because the vdom's children update algorithm is "unstable" - i.e.
  34790. // it doesn't guarantee the relative positioning of removed elements,
  34791. // we force transition-group to update its children into two passes:
  34792. // in the first pass, we remove all nodes that need to be removed,
  34793. // triggering their leaving transition; in the second pass, we insert/move
  34794. // into the final desired state. This way in the second pass removed
  34795. // nodes will remain where they should be.
  34796. var props = extend({
  34797. tag: String,
  34798. moveClass: String
  34799. }, transitionProps);
  34800. delete props.mode;
  34801. var TransitionGroup = {
  34802. props: props,
  34803. render: function render (h) {
  34804. var tag = this.tag || this.$vnode.data.tag || 'span';
  34805. var map = Object.create(null);
  34806. var prevChildren = this.prevChildren = this.children;
  34807. var rawChildren = this.$slots.default || [];
  34808. var children = this.children = [];
  34809. var transitionData = extractTransitionData(this);
  34810. for (var i = 0; i < rawChildren.length; i++) {
  34811. var c = rawChildren[i];
  34812. if (c.tag) {
  34813. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  34814. children.push(c);
  34815. map[c.key] = c
  34816. ;(c.data || (c.data = {})).transition = transitionData;
  34817. } else if (process.env.NODE_ENV !== 'production') {
  34818. var opts = c.componentOptions;
  34819. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  34820. warn(("<transition-group> children must be keyed: <" + name + ">"));
  34821. }
  34822. }
  34823. }
  34824. if (prevChildren) {
  34825. var kept = [];
  34826. var removed = [];
  34827. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  34828. var c$1 = prevChildren[i$1];
  34829. c$1.data.transition = transitionData;
  34830. c$1.data.pos = c$1.elm.getBoundingClientRect();
  34831. if (map[c$1.key]) {
  34832. kept.push(c$1);
  34833. } else {
  34834. removed.push(c$1);
  34835. }
  34836. }
  34837. this.kept = h(tag, null, kept);
  34838. this.removed = removed;
  34839. }
  34840. return h(tag, null, children)
  34841. },
  34842. beforeUpdate: function beforeUpdate () {
  34843. // force removing pass
  34844. this.__patch__(
  34845. this._vnode,
  34846. this.kept,
  34847. false, // hydrating
  34848. true // removeOnly (!important, avoids unnecessary moves)
  34849. );
  34850. this._vnode = this.kept;
  34851. },
  34852. updated: function updated () {
  34853. var children = this.prevChildren;
  34854. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  34855. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  34856. return
  34857. }
  34858. // we divide the work into three loops to avoid mixing DOM reads and writes
  34859. // in each iteration - which helps prevent layout thrashing.
  34860. children.forEach(callPendingCbs);
  34861. children.forEach(recordPosition);
  34862. children.forEach(applyTranslation);
  34863. // force reflow to put everything in position
  34864. var body = document.body;
  34865. var f = body.offsetHeight; // eslint-disable-line
  34866. children.forEach(function (c) {
  34867. if (c.data.moved) {
  34868. var el = c.elm;
  34869. var s = el.style;
  34870. addTransitionClass(el, moveClass);
  34871. s.transform = s.WebkitTransform = s.transitionDuration = '';
  34872. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  34873. if (!e || /transform$/.test(e.propertyName)) {
  34874. el.removeEventListener(transitionEndEvent, cb);
  34875. el._moveCb = null;
  34876. removeTransitionClass(el, moveClass);
  34877. }
  34878. });
  34879. }
  34880. });
  34881. },
  34882. methods: {
  34883. hasMove: function hasMove (el, moveClass) {
  34884. /* istanbul ignore if */
  34885. if (!hasTransition) {
  34886. return false
  34887. }
  34888. /* istanbul ignore if */
  34889. if (this._hasMove) {
  34890. return this._hasMove
  34891. }
  34892. // Detect whether an element with the move class applied has
  34893. // CSS transitions. Since the element may be inside an entering
  34894. // transition at this very moment, we make a clone of it and remove
  34895. // all other transition classes applied to ensure only the move class
  34896. // is applied.
  34897. var clone = el.cloneNode();
  34898. if (el._transitionClasses) {
  34899. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  34900. }
  34901. addClass(clone, moveClass);
  34902. clone.style.display = 'none';
  34903. this.$el.appendChild(clone);
  34904. var info = getTransitionInfo(clone);
  34905. this.$el.removeChild(clone);
  34906. return (this._hasMove = info.hasTransform)
  34907. }
  34908. }
  34909. };
  34910. function callPendingCbs (c) {
  34911. /* istanbul ignore if */
  34912. if (c.elm._moveCb) {
  34913. c.elm._moveCb();
  34914. }
  34915. /* istanbul ignore if */
  34916. if (c.elm._enterCb) {
  34917. c.elm._enterCb();
  34918. }
  34919. }
  34920. function recordPosition (c) {
  34921. c.data.newPos = c.elm.getBoundingClientRect();
  34922. }
  34923. function applyTranslation (c) {
  34924. var oldPos = c.data.pos;
  34925. var newPos = c.data.newPos;
  34926. var dx = oldPos.left - newPos.left;
  34927. var dy = oldPos.top - newPos.top;
  34928. if (dx || dy) {
  34929. c.data.moved = true;
  34930. var s = c.elm.style;
  34931. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  34932. s.transitionDuration = '0s';
  34933. }
  34934. }
  34935. var platformComponents = {
  34936. Transition: Transition,
  34937. TransitionGroup: TransitionGroup
  34938. };
  34939. /* */
  34940. // install platform specific utils
  34941. Vue$3.config.mustUseProp = mustUseProp;
  34942. Vue$3.config.isReservedTag = isReservedTag;
  34943. Vue$3.config.isReservedAttr = isReservedAttr;
  34944. Vue$3.config.getTagNamespace = getTagNamespace;
  34945. Vue$3.config.isUnknownElement = isUnknownElement;
  34946. // install platform runtime directives & components
  34947. extend(Vue$3.options.directives, platformDirectives);
  34948. extend(Vue$3.options.components, platformComponents);
  34949. // install platform patch function
  34950. Vue$3.prototype.__patch__ = inBrowser ? patch : noop;
  34951. // public mount method
  34952. Vue$3.prototype.$mount = function (
  34953. el,
  34954. hydrating
  34955. ) {
  34956. el = el && inBrowser ? query(el) : undefined;
  34957. return mountComponent(this, el, hydrating)
  34958. };
  34959. // devtools global hook
  34960. /* istanbul ignore next */
  34961. setTimeout(function () {
  34962. if (config.devtools) {
  34963. if (devtools) {
  34964. devtools.emit('init', Vue$3);
  34965. } else if (process.env.NODE_ENV !== 'production' && isChrome) {
  34966. console[console.info ? 'info' : 'log'](
  34967. 'Download the Vue Devtools extension for a better development experience:\n' +
  34968. 'https://github.com/vuejs/vue-devtools'
  34969. );
  34970. }
  34971. }
  34972. if (process.env.NODE_ENV !== 'production' &&
  34973. config.productionTip !== false &&
  34974. inBrowser && typeof console !== 'undefined'
  34975. ) {
  34976. console[console.info ? 'info' : 'log'](
  34977. "You are running Vue in development mode.\n" +
  34978. "Make sure to turn on production mode when deploying for production.\n" +
  34979. "See more tips at https://vuejs.org/guide/deployment.html"
  34980. );
  34981. }
  34982. }, 0);
  34983. /* */
  34984. // check whether current browser encodes a char inside attribute values
  34985. function shouldDecode (content, encoded) {
  34986. var div = document.createElement('div');
  34987. div.innerHTML = "<div a=\"" + content + "\"/>";
  34988. return div.innerHTML.indexOf(encoded) > 0
  34989. }
  34990. // #3663
  34991. // IE encodes newlines inside attribute values while other browsers don't
  34992. var shouldDecodeNewlines = inBrowser ? shouldDecode('\n', '&#10;') : false;
  34993. /* */
  34994. var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
  34995. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  34996. var buildRegex = cached(function (delimiters) {
  34997. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  34998. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  34999. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  35000. });
  35001. function parseText (
  35002. text,
  35003. delimiters
  35004. ) {
  35005. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  35006. if (!tagRE.test(text)) {
  35007. return
  35008. }
  35009. var tokens = [];
  35010. var lastIndex = tagRE.lastIndex = 0;
  35011. var match, index;
  35012. while ((match = tagRE.exec(text))) {
  35013. index = match.index;
  35014. // push text token
  35015. if (index > lastIndex) {
  35016. tokens.push(JSON.stringify(text.slice(lastIndex, index)));
  35017. }
  35018. // tag token
  35019. var exp = parseFilters(match[1].trim());
  35020. tokens.push(("_s(" + exp + ")"));
  35021. lastIndex = index + match[0].length;
  35022. }
  35023. if (lastIndex < text.length) {
  35024. tokens.push(JSON.stringify(text.slice(lastIndex)));
  35025. }
  35026. return tokens.join('+')
  35027. }
  35028. /* */
  35029. function transformNode (el, options) {
  35030. var warn = options.warn || baseWarn;
  35031. var staticClass = getAndRemoveAttr(el, 'class');
  35032. if (process.env.NODE_ENV !== 'production' && staticClass) {
  35033. var expression = parseText(staticClass, options.delimiters);
  35034. if (expression) {
  35035. warn(
  35036. "class=\"" + staticClass + "\": " +
  35037. 'Interpolation inside attributes has been removed. ' +
  35038. 'Use v-bind or the colon shorthand instead. For example, ' +
  35039. 'instead of <div class="{{ val }}">, use <div :class="val">.'
  35040. );
  35041. }
  35042. }
  35043. if (staticClass) {
  35044. el.staticClass = JSON.stringify(staticClass);
  35045. }
  35046. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  35047. if (classBinding) {
  35048. el.classBinding = classBinding;
  35049. }
  35050. }
  35051. function genData (el) {
  35052. var data = '';
  35053. if (el.staticClass) {
  35054. data += "staticClass:" + (el.staticClass) + ",";
  35055. }
  35056. if (el.classBinding) {
  35057. data += "class:" + (el.classBinding) + ",";
  35058. }
  35059. return data
  35060. }
  35061. var klass$1 = {
  35062. staticKeys: ['staticClass'],
  35063. transformNode: transformNode,
  35064. genData: genData
  35065. };
  35066. /* */
  35067. function transformNode$1 (el, options) {
  35068. var warn = options.warn || baseWarn;
  35069. var staticStyle = getAndRemoveAttr(el, 'style');
  35070. if (staticStyle) {
  35071. /* istanbul ignore if */
  35072. if (process.env.NODE_ENV !== 'production') {
  35073. var expression = parseText(staticStyle, options.delimiters);
  35074. if (expression) {
  35075. warn(
  35076. "style=\"" + staticStyle + "\": " +
  35077. 'Interpolation inside attributes has been removed. ' +
  35078. 'Use v-bind or the colon shorthand instead. For example, ' +
  35079. 'instead of <div style="{{ val }}">, use <div :style="val">.'
  35080. );
  35081. }
  35082. }
  35083. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  35084. }
  35085. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  35086. if (styleBinding) {
  35087. el.styleBinding = styleBinding;
  35088. }
  35089. }
  35090. function genData$1 (el) {
  35091. var data = '';
  35092. if (el.staticStyle) {
  35093. data += "staticStyle:" + (el.staticStyle) + ",";
  35094. }
  35095. if (el.styleBinding) {
  35096. data += "style:(" + (el.styleBinding) + "),";
  35097. }
  35098. return data
  35099. }
  35100. var style$1 = {
  35101. staticKeys: ['staticStyle'],
  35102. transformNode: transformNode$1,
  35103. genData: genData$1
  35104. };
  35105. var modules$1 = [
  35106. klass$1,
  35107. style$1
  35108. ];
  35109. /* */
  35110. function text (el, dir) {
  35111. if (dir.value) {
  35112. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
  35113. }
  35114. }
  35115. /* */
  35116. function html (el, dir) {
  35117. if (dir.value) {
  35118. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
  35119. }
  35120. }
  35121. var directives$1 = {
  35122. model: model,
  35123. text: text,
  35124. html: html
  35125. };
  35126. /* */
  35127. var isUnaryTag = makeMap(
  35128. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  35129. 'link,meta,param,source,track,wbr'
  35130. );
  35131. // Elements that you can, intentionally, leave open
  35132. // (and which close themselves)
  35133. var canBeLeftOpenTag = makeMap(
  35134. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  35135. );
  35136. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  35137. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  35138. var isNonPhrasingTag = makeMap(
  35139. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  35140. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  35141. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  35142. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  35143. 'title,tr,track'
  35144. );
  35145. /* */
  35146. var baseOptions = {
  35147. expectHTML: true,
  35148. modules: modules$1,
  35149. directives: directives$1,
  35150. isPreTag: isPreTag,
  35151. isUnaryTag: isUnaryTag,
  35152. mustUseProp: mustUseProp,
  35153. canBeLeftOpenTag: canBeLeftOpenTag,
  35154. isReservedTag: isReservedTag,
  35155. getTagNamespace: getTagNamespace,
  35156. staticKeys: genStaticKeys(modules$1)
  35157. };
  35158. /* */
  35159. var decoder;
  35160. var he = {
  35161. decode: function decode (html) {
  35162. decoder = decoder || document.createElement('div');
  35163. decoder.innerHTML = html;
  35164. return decoder.textContent
  35165. }
  35166. };
  35167. /**
  35168. * Not type-checking this file because it's mostly vendor code.
  35169. */
  35170. /*!
  35171. * HTML Parser By John Resig (ejohn.org)
  35172. * Modified by Juriy "kangax" Zaytsev
  35173. * Original code by Erik Arvidsson, Mozilla Public License
  35174. * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
  35175. */
  35176. // Regular Expressions for parsing tags and attributes
  35177. var singleAttrIdentifier = /([^\s"'<>/=]+)/;
  35178. var singleAttrAssign = /(?:=)/;
  35179. var singleAttrValues = [
  35180. // attr value double quotes
  35181. /"([^"]*)"+/.source,
  35182. // attr value, single quotes
  35183. /'([^']*)'+/.source,
  35184. // attr value, no quotes
  35185. /([^\s"'=<>`]+)/.source
  35186. ];
  35187. var attribute = new RegExp(
  35188. '^\\s*' + singleAttrIdentifier.source +
  35189. '(?:\\s*(' + singleAttrAssign.source + ')' +
  35190. '\\s*(?:' + singleAttrValues.join('|') + '))?'
  35191. );
  35192. // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
  35193. // but for Vue templates we can enforce a simple charset
  35194. var ncname = '[a-zA-Z_][\\w\\-\\.]*';
  35195. var qnameCapture = '((?:' + ncname + '\\:)?' + ncname + ')';
  35196. var startTagOpen = new RegExp('^<' + qnameCapture);
  35197. var startTagClose = /^\s*(\/?)>/;
  35198. var endTag = new RegExp('^<\\/' + qnameCapture + '[^>]*>');
  35199. var doctype = /^<!DOCTYPE [^>]+>/i;
  35200. var comment = /^<!--/;
  35201. var conditionalComment = /^<!\[/;
  35202. var IS_REGEX_CAPTURING_BROKEN = false;
  35203. 'x'.replace(/x(.)?/g, function (m, g) {
  35204. IS_REGEX_CAPTURING_BROKEN = g === '';
  35205. });
  35206. // Special Elements (can contain anything)
  35207. var isPlainTextElement = makeMap('script,style,textarea', true);
  35208. var reCache = {};
  35209. var decodingMap = {
  35210. '&lt;': '<',
  35211. '&gt;': '>',
  35212. '&quot;': '"',
  35213. '&amp;': '&',
  35214. '&#10;': '\n'
  35215. };
  35216. var encodedAttr = /&(?:lt|gt|quot|amp);/g;
  35217. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10);/g;
  35218. // #5992
  35219. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  35220. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  35221. function decodeAttr (value, shouldDecodeNewlines) {
  35222. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  35223. return value.replace(re, function (match) { return decodingMap[match]; })
  35224. }
  35225. function parseHTML (html, options) {
  35226. var stack = [];
  35227. var expectHTML = options.expectHTML;
  35228. var isUnaryTag$$1 = options.isUnaryTag || no;
  35229. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  35230. var index = 0;
  35231. var last, lastTag;
  35232. while (html) {
  35233. last = html;
  35234. // Make sure we're not in a plaintext content element like script/style
  35235. if (!lastTag || !isPlainTextElement(lastTag)) {
  35236. var textEnd = html.indexOf('<');
  35237. if (textEnd === 0) {
  35238. // Comment:
  35239. if (comment.test(html)) {
  35240. var commentEnd = html.indexOf('-->');
  35241. if (commentEnd >= 0) {
  35242. if (options.shouldKeepComment) {
  35243. options.comment(html.substring(4, commentEnd));
  35244. }
  35245. advance(commentEnd + 3);
  35246. continue
  35247. }
  35248. }
  35249. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  35250. if (conditionalComment.test(html)) {
  35251. var conditionalEnd = html.indexOf(']>');
  35252. if (conditionalEnd >= 0) {
  35253. advance(conditionalEnd + 2);
  35254. continue
  35255. }
  35256. }
  35257. // Doctype:
  35258. var doctypeMatch = html.match(doctype);
  35259. if (doctypeMatch) {
  35260. advance(doctypeMatch[0].length);
  35261. continue
  35262. }
  35263. // End tag:
  35264. var endTagMatch = html.match(endTag);
  35265. if (endTagMatch) {
  35266. var curIndex = index;
  35267. advance(endTagMatch[0].length);
  35268. parseEndTag(endTagMatch[1], curIndex, index);
  35269. continue
  35270. }
  35271. // Start tag:
  35272. var startTagMatch = parseStartTag();
  35273. if (startTagMatch) {
  35274. handleStartTag(startTagMatch);
  35275. if (shouldIgnoreFirstNewline(lastTag, html)) {
  35276. advance(1);
  35277. }
  35278. continue
  35279. }
  35280. }
  35281. var text = (void 0), rest = (void 0), next = (void 0);
  35282. if (textEnd >= 0) {
  35283. rest = html.slice(textEnd);
  35284. while (
  35285. !endTag.test(rest) &&
  35286. !startTagOpen.test(rest) &&
  35287. !comment.test(rest) &&
  35288. !conditionalComment.test(rest)
  35289. ) {
  35290. // < in plain text, be forgiving and treat it as text
  35291. next = rest.indexOf('<', 1);
  35292. if (next < 0) { break }
  35293. textEnd += next;
  35294. rest = html.slice(textEnd);
  35295. }
  35296. text = html.substring(0, textEnd);
  35297. advance(textEnd);
  35298. }
  35299. if (textEnd < 0) {
  35300. text = html;
  35301. html = '';
  35302. }
  35303. if (options.chars && text) {
  35304. options.chars(text);
  35305. }
  35306. } else {
  35307. var endTagLength = 0;
  35308. var stackedTag = lastTag.toLowerCase();
  35309. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  35310. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  35311. endTagLength = endTag.length;
  35312. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  35313. text = text
  35314. .replace(/<!--([\s\S]*?)-->/g, '$1')
  35315. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  35316. }
  35317. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  35318. text = text.slice(1);
  35319. }
  35320. if (options.chars) {
  35321. options.chars(text);
  35322. }
  35323. return ''
  35324. });
  35325. index += html.length - rest$1.length;
  35326. html = rest$1;
  35327. parseEndTag(stackedTag, index - endTagLength, index);
  35328. }
  35329. if (html === last) {
  35330. options.chars && options.chars(html);
  35331. if (process.env.NODE_ENV !== 'production' && !stack.length && options.warn) {
  35332. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
  35333. }
  35334. break
  35335. }
  35336. }
  35337. // Clean up any remaining tags
  35338. parseEndTag();
  35339. function advance (n) {
  35340. index += n;
  35341. html = html.substring(n);
  35342. }
  35343. function parseStartTag () {
  35344. var start = html.match(startTagOpen);
  35345. if (start) {
  35346. var match = {
  35347. tagName: start[1],
  35348. attrs: [],
  35349. start: index
  35350. };
  35351. advance(start[0].length);
  35352. var end, attr;
  35353. while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
  35354. advance(attr[0].length);
  35355. match.attrs.push(attr);
  35356. }
  35357. if (end) {
  35358. match.unarySlash = end[1];
  35359. advance(end[0].length);
  35360. match.end = index;
  35361. return match
  35362. }
  35363. }
  35364. }
  35365. function handleStartTag (match) {
  35366. var tagName = match.tagName;
  35367. var unarySlash = match.unarySlash;
  35368. if (expectHTML) {
  35369. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  35370. parseEndTag(lastTag);
  35371. }
  35372. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  35373. parseEndTag(tagName);
  35374. }
  35375. }
  35376. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  35377. var l = match.attrs.length;
  35378. var attrs = new Array(l);
  35379. for (var i = 0; i < l; i++) {
  35380. var args = match.attrs[i];
  35381. // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
  35382. if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
  35383. if (args[3] === '') { delete args[3]; }
  35384. if (args[4] === '') { delete args[4]; }
  35385. if (args[5] === '') { delete args[5]; }
  35386. }
  35387. var value = args[3] || args[4] || args[5] || '';
  35388. attrs[i] = {
  35389. name: args[1],
  35390. value: decodeAttr(
  35391. value,
  35392. options.shouldDecodeNewlines
  35393. )
  35394. };
  35395. }
  35396. if (!unary) {
  35397. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
  35398. lastTag = tagName;
  35399. }
  35400. if (options.start) {
  35401. options.start(tagName, attrs, unary, match.start, match.end);
  35402. }
  35403. }
  35404. function parseEndTag (tagName, start, end) {
  35405. var pos, lowerCasedTagName;
  35406. if (start == null) { start = index; }
  35407. if (end == null) { end = index; }
  35408. if (tagName) {
  35409. lowerCasedTagName = tagName.toLowerCase();
  35410. }
  35411. // Find the closest opened tag of the same type
  35412. if (tagName) {
  35413. for (pos = stack.length - 1; pos >= 0; pos--) {
  35414. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  35415. break
  35416. }
  35417. }
  35418. } else {
  35419. // If no tag name is provided, clean shop
  35420. pos = 0;
  35421. }
  35422. if (pos >= 0) {
  35423. // Close all the open elements, up the stack
  35424. for (var i = stack.length - 1; i >= pos; i--) {
  35425. if (process.env.NODE_ENV !== 'production' &&
  35426. (i > pos || !tagName) &&
  35427. options.warn
  35428. ) {
  35429. options.warn(
  35430. ("tag <" + (stack[i].tag) + "> has no matching end tag.")
  35431. );
  35432. }
  35433. if (options.end) {
  35434. options.end(stack[i].tag, start, end);
  35435. }
  35436. }
  35437. // Remove the open elements from the stack
  35438. stack.length = pos;
  35439. lastTag = pos && stack[pos - 1].tag;
  35440. } else if (lowerCasedTagName === 'br') {
  35441. if (options.start) {
  35442. options.start(tagName, [], true, start, end);
  35443. }
  35444. } else if (lowerCasedTagName === 'p') {
  35445. if (options.start) {
  35446. options.start(tagName, [], false, start, end);
  35447. }
  35448. if (options.end) {
  35449. options.end(tagName, start, end);
  35450. }
  35451. }
  35452. }
  35453. }
  35454. /* */
  35455. var onRE = /^@|^v-on:/;
  35456. var dirRE = /^v-|^@|^:/;
  35457. var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
  35458. var forIteratorRE = /\((\{[^}]*\}|[^,]*),([^,]*)(?:,([^,]*))?\)/;
  35459. var argRE = /:(.*)$/;
  35460. var bindRE = /^:|^v-bind:/;
  35461. var modifierRE = /\.[^.]+/g;
  35462. var decodeHTMLCached = cached(he.decode);
  35463. // configurable state
  35464. var warn$2;
  35465. var delimiters;
  35466. var transforms;
  35467. var preTransforms;
  35468. var postTransforms;
  35469. var platformIsPreTag;
  35470. var platformMustUseProp;
  35471. var platformGetTagNamespace;
  35472. /**
  35473. * Convert HTML string to AST.
  35474. */
  35475. function parse (
  35476. template,
  35477. options
  35478. ) {
  35479. warn$2 = options.warn || baseWarn;
  35480. platformIsPreTag = options.isPreTag || no;
  35481. platformMustUseProp = options.mustUseProp || no;
  35482. platformGetTagNamespace = options.getTagNamespace || no;
  35483. transforms = pluckModuleFunction(options.modules, 'transformNode');
  35484. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  35485. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  35486. delimiters = options.delimiters;
  35487. var stack = [];
  35488. var preserveWhitespace = options.preserveWhitespace !== false;
  35489. var root;
  35490. var currentParent;
  35491. var inVPre = false;
  35492. var inPre = false;
  35493. var warned = false;
  35494. function warnOnce (msg) {
  35495. if (!warned) {
  35496. warned = true;
  35497. warn$2(msg);
  35498. }
  35499. }
  35500. function endPre (element) {
  35501. // check pre state
  35502. if (element.pre) {
  35503. inVPre = false;
  35504. }
  35505. if (platformIsPreTag(element.tag)) {
  35506. inPre = false;
  35507. }
  35508. }
  35509. parseHTML(template, {
  35510. warn: warn$2,
  35511. expectHTML: options.expectHTML,
  35512. isUnaryTag: options.isUnaryTag,
  35513. canBeLeftOpenTag: options.canBeLeftOpenTag,
  35514. shouldDecodeNewlines: options.shouldDecodeNewlines,
  35515. shouldKeepComment: options.comments,
  35516. start: function start (tag, attrs, unary) {
  35517. // check namespace.
  35518. // inherit parent ns if there is one
  35519. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  35520. // handle IE svg bug
  35521. /* istanbul ignore if */
  35522. if (isIE && ns === 'svg') {
  35523. attrs = guardIESVGBug(attrs);
  35524. }
  35525. var element = {
  35526. type: 1,
  35527. tag: tag,
  35528. attrsList: attrs,
  35529. attrsMap: makeAttrsMap(attrs),
  35530. parent: currentParent,
  35531. children: []
  35532. };
  35533. if (ns) {
  35534. element.ns = ns;
  35535. }
  35536. if (isForbiddenTag(element) && !isServerRendering()) {
  35537. element.forbidden = true;
  35538. process.env.NODE_ENV !== 'production' && warn$2(
  35539. 'Templates should only be responsible for mapping the state to the ' +
  35540. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  35541. "<" + tag + ">" + ', as they will not be parsed.'
  35542. );
  35543. }
  35544. // apply pre-transforms
  35545. for (var i = 0; i < preTransforms.length; i++) {
  35546. preTransforms[i](element, options);
  35547. }
  35548. if (!inVPre) {
  35549. processPre(element);
  35550. if (element.pre) {
  35551. inVPre = true;
  35552. }
  35553. }
  35554. if (platformIsPreTag(element.tag)) {
  35555. inPre = true;
  35556. }
  35557. if (inVPre) {
  35558. processRawAttrs(element);
  35559. } else {
  35560. processFor(element);
  35561. processIf(element);
  35562. processOnce(element);
  35563. processKey(element);
  35564. // determine whether this is a plain element after
  35565. // removing structural attributes
  35566. element.plain = !element.key && !attrs.length;
  35567. processRef(element);
  35568. processSlot(element);
  35569. processComponent(element);
  35570. for (var i$1 = 0; i$1 < transforms.length; i$1++) {
  35571. transforms[i$1](element, options);
  35572. }
  35573. processAttrs(element);
  35574. }
  35575. function checkRootConstraints (el) {
  35576. if (process.env.NODE_ENV !== 'production') {
  35577. if (el.tag === 'slot' || el.tag === 'template') {
  35578. warnOnce(
  35579. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  35580. 'contain multiple nodes.'
  35581. );
  35582. }
  35583. if (el.attrsMap.hasOwnProperty('v-for')) {
  35584. warnOnce(
  35585. 'Cannot use v-for on stateful component root element because ' +
  35586. 'it renders multiple elements.'
  35587. );
  35588. }
  35589. }
  35590. }
  35591. // tree management
  35592. if (!root) {
  35593. root = element;
  35594. checkRootConstraints(root);
  35595. } else if (!stack.length) {
  35596. // allow root elements with v-if, v-else-if and v-else
  35597. if (root.if && (element.elseif || element.else)) {
  35598. checkRootConstraints(element);
  35599. addIfCondition(root, {
  35600. exp: element.elseif,
  35601. block: element
  35602. });
  35603. } else if (process.env.NODE_ENV !== 'production') {
  35604. warnOnce(
  35605. "Component template should contain exactly one root element. " +
  35606. "If you are using v-if on multiple elements, " +
  35607. "use v-else-if to chain them instead."
  35608. );
  35609. }
  35610. }
  35611. if (currentParent && !element.forbidden) {
  35612. if (element.elseif || element.else) {
  35613. processIfConditions(element, currentParent);
  35614. } else if (element.slotScope) { // scoped slot
  35615. currentParent.plain = false;
  35616. var name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  35617. } else {
  35618. currentParent.children.push(element);
  35619. element.parent = currentParent;
  35620. }
  35621. }
  35622. if (!unary) {
  35623. currentParent = element;
  35624. stack.push(element);
  35625. } else {
  35626. endPre(element);
  35627. }
  35628. // apply post-transforms
  35629. for (var i$2 = 0; i$2 < postTransforms.length; i$2++) {
  35630. postTransforms[i$2](element, options);
  35631. }
  35632. },
  35633. end: function end () {
  35634. // remove trailing whitespace
  35635. var element = stack[stack.length - 1];
  35636. var lastNode = element.children[element.children.length - 1];
  35637. if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
  35638. element.children.pop();
  35639. }
  35640. // pop stack
  35641. stack.length -= 1;
  35642. currentParent = stack[stack.length - 1];
  35643. endPre(element);
  35644. },
  35645. chars: function chars (text) {
  35646. if (!currentParent) {
  35647. if (process.env.NODE_ENV !== 'production') {
  35648. if (text === template) {
  35649. warnOnce(
  35650. 'Component template requires a root element, rather than just text.'
  35651. );
  35652. } else if ((text = text.trim())) {
  35653. warnOnce(
  35654. ("text \"" + text + "\" outside root element will be ignored.")
  35655. );
  35656. }
  35657. }
  35658. return
  35659. }
  35660. // IE textarea placeholder bug
  35661. /* istanbul ignore if */
  35662. if (isIE &&
  35663. currentParent.tag === 'textarea' &&
  35664. currentParent.attrsMap.placeholder === text
  35665. ) {
  35666. return
  35667. }
  35668. var children = currentParent.children;
  35669. text = inPre || text.trim()
  35670. ? isTextTag(currentParent) ? text : decodeHTMLCached(text)
  35671. // only preserve whitespace if its not right after a starting tag
  35672. : preserveWhitespace && children.length ? ' ' : '';
  35673. if (text) {
  35674. var expression;
  35675. if (!inVPre && text !== ' ' && (expression = parseText(text, delimiters))) {
  35676. children.push({
  35677. type: 2,
  35678. expression: expression,
  35679. text: text
  35680. });
  35681. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  35682. children.push({
  35683. type: 3,
  35684. text: text
  35685. });
  35686. }
  35687. }
  35688. },
  35689. comment: function comment (text) {
  35690. currentParent.children.push({
  35691. type: 3,
  35692. text: text,
  35693. isComment: true
  35694. });
  35695. }
  35696. });
  35697. return root
  35698. }
  35699. function processPre (el) {
  35700. if (getAndRemoveAttr(el, 'v-pre') != null) {
  35701. el.pre = true;
  35702. }
  35703. }
  35704. function processRawAttrs (el) {
  35705. var l = el.attrsList.length;
  35706. if (l) {
  35707. var attrs = el.attrs = new Array(l);
  35708. for (var i = 0; i < l; i++) {
  35709. attrs[i] = {
  35710. name: el.attrsList[i].name,
  35711. value: JSON.stringify(el.attrsList[i].value)
  35712. };
  35713. }
  35714. } else if (!el.pre) {
  35715. // non root node in pre blocks with no attributes
  35716. el.plain = true;
  35717. }
  35718. }
  35719. function processKey (el) {
  35720. var exp = getBindingAttr(el, 'key');
  35721. if (exp) {
  35722. if (process.env.NODE_ENV !== 'production' && el.tag === 'template') {
  35723. warn$2("<template> cannot be keyed. Place the key on real elements instead.");
  35724. }
  35725. el.key = exp;
  35726. }
  35727. }
  35728. function processRef (el) {
  35729. var ref = getBindingAttr(el, 'ref');
  35730. if (ref) {
  35731. el.ref = ref;
  35732. el.refInFor = checkInFor(el);
  35733. }
  35734. }
  35735. function processFor (el) {
  35736. var exp;
  35737. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  35738. var inMatch = exp.match(forAliasRE);
  35739. if (!inMatch) {
  35740. process.env.NODE_ENV !== 'production' && warn$2(
  35741. ("Invalid v-for expression: " + exp)
  35742. );
  35743. return
  35744. }
  35745. el.for = inMatch[2].trim();
  35746. var alias = inMatch[1].trim();
  35747. var iteratorMatch = alias.match(forIteratorRE);
  35748. if (iteratorMatch) {
  35749. el.alias = iteratorMatch[1].trim();
  35750. el.iterator1 = iteratorMatch[2].trim();
  35751. if (iteratorMatch[3]) {
  35752. el.iterator2 = iteratorMatch[3].trim();
  35753. }
  35754. } else {
  35755. el.alias = alias;
  35756. }
  35757. }
  35758. }
  35759. function processIf (el) {
  35760. var exp = getAndRemoveAttr(el, 'v-if');
  35761. if (exp) {
  35762. el.if = exp;
  35763. addIfCondition(el, {
  35764. exp: exp,
  35765. block: el
  35766. });
  35767. } else {
  35768. if (getAndRemoveAttr(el, 'v-else') != null) {
  35769. el.else = true;
  35770. }
  35771. var elseif = getAndRemoveAttr(el, 'v-else-if');
  35772. if (elseif) {
  35773. el.elseif = elseif;
  35774. }
  35775. }
  35776. }
  35777. function processIfConditions (el, parent) {
  35778. var prev = findPrevElement(parent.children);
  35779. if (prev && prev.if) {
  35780. addIfCondition(prev, {
  35781. exp: el.elseif,
  35782. block: el
  35783. });
  35784. } else if (process.env.NODE_ENV !== 'production') {
  35785. warn$2(
  35786. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  35787. "used on element <" + (el.tag) + "> without corresponding v-if."
  35788. );
  35789. }
  35790. }
  35791. function findPrevElement (children) {
  35792. var i = children.length;
  35793. while (i--) {
  35794. if (children[i].type === 1) {
  35795. return children[i]
  35796. } else {
  35797. if (process.env.NODE_ENV !== 'production' && children[i].text !== ' ') {
  35798. warn$2(
  35799. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  35800. "will be ignored."
  35801. );
  35802. }
  35803. children.pop();
  35804. }
  35805. }
  35806. }
  35807. function addIfCondition (el, condition) {
  35808. if (!el.ifConditions) {
  35809. el.ifConditions = [];
  35810. }
  35811. el.ifConditions.push(condition);
  35812. }
  35813. function processOnce (el) {
  35814. var once$$1 = getAndRemoveAttr(el, 'v-once');
  35815. if (once$$1 != null) {
  35816. el.once = true;
  35817. }
  35818. }
  35819. function processSlot (el) {
  35820. if (el.tag === 'slot') {
  35821. el.slotName = getBindingAttr(el, 'name');
  35822. if (process.env.NODE_ENV !== 'production' && el.key) {
  35823. warn$2(
  35824. "`key` does not work on <slot> because slots are abstract outlets " +
  35825. "and can possibly expand into multiple elements. " +
  35826. "Use the key on a wrapping element instead."
  35827. );
  35828. }
  35829. } else {
  35830. var slotTarget = getBindingAttr(el, 'slot');
  35831. if (slotTarget) {
  35832. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  35833. }
  35834. if (el.tag === 'template') {
  35835. el.slotScope = getAndRemoveAttr(el, 'scope');
  35836. }
  35837. }
  35838. }
  35839. function processComponent (el) {
  35840. var binding;
  35841. if ((binding = getBindingAttr(el, 'is'))) {
  35842. el.component = binding;
  35843. }
  35844. if (getAndRemoveAttr(el, 'inline-template') != null) {
  35845. el.inlineTemplate = true;
  35846. }
  35847. }
  35848. function processAttrs (el) {
  35849. var list = el.attrsList;
  35850. var i, l, name, rawName, value, modifiers, isProp;
  35851. for (i = 0, l = list.length; i < l; i++) {
  35852. name = rawName = list[i].name;
  35853. value = list[i].value;
  35854. if (dirRE.test(name)) {
  35855. // mark element as dynamic
  35856. el.hasBindings = true;
  35857. // modifiers
  35858. modifiers = parseModifiers(name);
  35859. if (modifiers) {
  35860. name = name.replace(modifierRE, '');
  35861. }
  35862. if (bindRE.test(name)) { // v-bind
  35863. name = name.replace(bindRE, '');
  35864. value = parseFilters(value);
  35865. isProp = false;
  35866. if (modifiers) {
  35867. if (modifiers.prop) {
  35868. isProp = true;
  35869. name = camelize(name);
  35870. if (name === 'innerHtml') { name = 'innerHTML'; }
  35871. }
  35872. if (modifiers.camel) {
  35873. name = camelize(name);
  35874. }
  35875. if (modifiers.sync) {
  35876. addHandler(
  35877. el,
  35878. ("update:" + (camelize(name))),
  35879. genAssignmentCode(value, "$event")
  35880. );
  35881. }
  35882. }
  35883. if (isProp || (
  35884. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  35885. )) {
  35886. addProp(el, name, value);
  35887. } else {
  35888. addAttr(el, name, value);
  35889. }
  35890. } else if (onRE.test(name)) { // v-on
  35891. name = name.replace(onRE, '');
  35892. addHandler(el, name, value, modifiers, false, warn$2);
  35893. } else { // normal directives
  35894. name = name.replace(dirRE, '');
  35895. // parse arg
  35896. var argMatch = name.match(argRE);
  35897. var arg = argMatch && argMatch[1];
  35898. if (arg) {
  35899. name = name.slice(0, -(arg.length + 1));
  35900. }
  35901. addDirective(el, name, rawName, value, arg, modifiers);
  35902. if (process.env.NODE_ENV !== 'production' && name === 'model') {
  35903. checkForAliasModel(el, value);
  35904. }
  35905. }
  35906. } else {
  35907. // literal attribute
  35908. if (process.env.NODE_ENV !== 'production') {
  35909. var expression = parseText(value, delimiters);
  35910. if (expression) {
  35911. warn$2(
  35912. name + "=\"" + value + "\": " +
  35913. 'Interpolation inside attributes has been removed. ' +
  35914. 'Use v-bind or the colon shorthand instead. For example, ' +
  35915. 'instead of <div id="{{ val }}">, use <div :id="val">.'
  35916. );
  35917. }
  35918. }
  35919. addAttr(el, name, JSON.stringify(value));
  35920. }
  35921. }
  35922. }
  35923. function checkInFor (el) {
  35924. var parent = el;
  35925. while (parent) {
  35926. if (parent.for !== undefined) {
  35927. return true
  35928. }
  35929. parent = parent.parent;
  35930. }
  35931. return false
  35932. }
  35933. function parseModifiers (name) {
  35934. var match = name.match(modifierRE);
  35935. if (match) {
  35936. var ret = {};
  35937. match.forEach(function (m) { ret[m.slice(1)] = true; });
  35938. return ret
  35939. }
  35940. }
  35941. function makeAttrsMap (attrs) {
  35942. var map = {};
  35943. for (var i = 0, l = attrs.length; i < l; i++) {
  35944. if (
  35945. process.env.NODE_ENV !== 'production' &&
  35946. map[attrs[i].name] && !isIE && !isEdge
  35947. ) {
  35948. warn$2('duplicate attribute: ' + attrs[i].name);
  35949. }
  35950. map[attrs[i].name] = attrs[i].value;
  35951. }
  35952. return map
  35953. }
  35954. // for script (e.g. type="x/template") or style, do not decode content
  35955. function isTextTag (el) {
  35956. return el.tag === 'script' || el.tag === 'style'
  35957. }
  35958. function isForbiddenTag (el) {
  35959. return (
  35960. el.tag === 'style' ||
  35961. (el.tag === 'script' && (
  35962. !el.attrsMap.type ||
  35963. el.attrsMap.type === 'text/javascript'
  35964. ))
  35965. )
  35966. }
  35967. var ieNSBug = /^xmlns:NS\d+/;
  35968. var ieNSPrefix = /^NS\d+:/;
  35969. /* istanbul ignore next */
  35970. function guardIESVGBug (attrs) {
  35971. var res = [];
  35972. for (var i = 0; i < attrs.length; i++) {
  35973. var attr = attrs[i];
  35974. if (!ieNSBug.test(attr.name)) {
  35975. attr.name = attr.name.replace(ieNSPrefix, '');
  35976. res.push(attr);
  35977. }
  35978. }
  35979. return res
  35980. }
  35981. function checkForAliasModel (el, value) {
  35982. var _el = el;
  35983. while (_el) {
  35984. if (_el.for && _el.alias === value) {
  35985. warn$2(
  35986. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  35987. "You are binding v-model directly to a v-for iteration alias. " +
  35988. "This will not be able to modify the v-for source array because " +
  35989. "writing to the alias is like modifying a function local variable. " +
  35990. "Consider using an array of objects and use v-model on an object property instead."
  35991. );
  35992. }
  35993. _el = _el.parent;
  35994. }
  35995. }
  35996. /* */
  35997. var isStaticKey;
  35998. var isPlatformReservedTag;
  35999. var genStaticKeysCached = cached(genStaticKeys$1);
  36000. /**
  36001. * Goal of the optimizer: walk the generated template AST tree
  36002. * and detect sub-trees that are purely static, i.e. parts of
  36003. * the DOM that never needs to change.
  36004. *
  36005. * Once we detect these sub-trees, we can:
  36006. *
  36007. * 1. Hoist them into constants, so that we no longer need to
  36008. * create fresh nodes for them on each re-render;
  36009. * 2. Completely skip them in the patching process.
  36010. */
  36011. function optimize (root, options) {
  36012. if (!root) { return }
  36013. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  36014. isPlatformReservedTag = options.isReservedTag || no;
  36015. // first pass: mark all non-static nodes.
  36016. markStatic$1(root);
  36017. // second pass: mark static roots.
  36018. markStaticRoots(root, false);
  36019. }
  36020. function genStaticKeys$1 (keys) {
  36021. return makeMap(
  36022. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
  36023. (keys ? ',' + keys : '')
  36024. )
  36025. }
  36026. function markStatic$1 (node) {
  36027. node.static = isStatic(node);
  36028. if (node.type === 1) {
  36029. // do not make component slot content static. this avoids
  36030. // 1. components not able to mutate slot nodes
  36031. // 2. static slot content fails for hot-reloading
  36032. if (
  36033. !isPlatformReservedTag(node.tag) &&
  36034. node.tag !== 'slot' &&
  36035. node.attrsMap['inline-template'] == null
  36036. ) {
  36037. return
  36038. }
  36039. for (var i = 0, l = node.children.length; i < l; i++) {
  36040. var child = node.children[i];
  36041. markStatic$1(child);
  36042. if (!child.static) {
  36043. node.static = false;
  36044. }
  36045. }
  36046. if (node.ifConditions) {
  36047. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  36048. var block = node.ifConditions[i$1].block;
  36049. markStatic$1(block);
  36050. if (!block.static) {
  36051. node.static = false;
  36052. }
  36053. }
  36054. }
  36055. }
  36056. }
  36057. function markStaticRoots (node, isInFor) {
  36058. if (node.type === 1) {
  36059. if (node.static || node.once) {
  36060. node.staticInFor = isInFor;
  36061. }
  36062. // For a node to qualify as a static root, it should have children that
  36063. // are not just static text. Otherwise the cost of hoisting out will
  36064. // outweigh the benefits and it's better off to just always render it fresh.
  36065. if (node.static && node.children.length && !(
  36066. node.children.length === 1 &&
  36067. node.children[0].type === 3
  36068. )) {
  36069. node.staticRoot = true;
  36070. return
  36071. } else {
  36072. node.staticRoot = false;
  36073. }
  36074. if (node.children) {
  36075. for (var i = 0, l = node.children.length; i < l; i++) {
  36076. markStaticRoots(node.children[i], isInFor || !!node.for);
  36077. }
  36078. }
  36079. if (node.ifConditions) {
  36080. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  36081. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  36082. }
  36083. }
  36084. }
  36085. }
  36086. function isStatic (node) {
  36087. if (node.type === 2) { // expression
  36088. return false
  36089. }
  36090. if (node.type === 3) { // text
  36091. return true
  36092. }
  36093. return !!(node.pre || (
  36094. !node.hasBindings && // no dynamic bindings
  36095. !node.if && !node.for && // not v-if or v-for or v-else
  36096. !isBuiltInTag(node.tag) && // not a built-in
  36097. isPlatformReservedTag(node.tag) && // not a component
  36098. !isDirectChildOfTemplateFor(node) &&
  36099. Object.keys(node).every(isStaticKey)
  36100. ))
  36101. }
  36102. function isDirectChildOfTemplateFor (node) {
  36103. while (node.parent) {
  36104. node = node.parent;
  36105. if (node.tag !== 'template') {
  36106. return false
  36107. }
  36108. if (node.for) {
  36109. return true
  36110. }
  36111. }
  36112. return false
  36113. }
  36114. /* */
  36115. var fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  36116. var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
  36117. // keyCode aliases
  36118. var keyCodes = {
  36119. esc: 27,
  36120. tab: 9,
  36121. enter: 13,
  36122. space: 32,
  36123. up: 38,
  36124. left: 37,
  36125. right: 39,
  36126. down: 40,
  36127. 'delete': [8, 46]
  36128. };
  36129. // #4868: modifiers that prevent the execution of the listener
  36130. // need to explicitly return null so that we can determine whether to remove
  36131. // the listener for .once
  36132. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  36133. var modifierCode = {
  36134. stop: '$event.stopPropagation();',
  36135. prevent: '$event.preventDefault();',
  36136. self: genGuard("$event.target !== $event.currentTarget"),
  36137. ctrl: genGuard("!$event.ctrlKey"),
  36138. shift: genGuard("!$event.shiftKey"),
  36139. alt: genGuard("!$event.altKey"),
  36140. meta: genGuard("!$event.metaKey"),
  36141. left: genGuard("'button' in $event && $event.button !== 0"),
  36142. middle: genGuard("'button' in $event && $event.button !== 1"),
  36143. right: genGuard("'button' in $event && $event.button !== 2")
  36144. };
  36145. function genHandlers (
  36146. events,
  36147. isNative,
  36148. warn
  36149. ) {
  36150. var res = isNative ? 'nativeOn:{' : 'on:{';
  36151. for (var name in events) {
  36152. var handler = events[name];
  36153. // #5330: warn click.right, since right clicks do not actually fire click events.
  36154. if (process.env.NODE_ENV !== 'production' &&
  36155. name === 'click' &&
  36156. handler && handler.modifiers && handler.modifiers.right
  36157. ) {
  36158. warn(
  36159. "Use \"contextmenu\" instead of \"click.right\" since right clicks " +
  36160. "do not actually fire \"click\" events."
  36161. );
  36162. }
  36163. res += "\"" + name + "\":" + (genHandler(name, handler)) + ",";
  36164. }
  36165. return res.slice(0, -1) + '}'
  36166. }
  36167. function genHandler (
  36168. name,
  36169. handler
  36170. ) {
  36171. if (!handler) {
  36172. return 'function(){}'
  36173. }
  36174. if (Array.isArray(handler)) {
  36175. return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
  36176. }
  36177. var isMethodPath = simplePathRE.test(handler.value);
  36178. var isFunctionExpression = fnExpRE.test(handler.value);
  36179. if (!handler.modifiers) {
  36180. return isMethodPath || isFunctionExpression
  36181. ? handler.value
  36182. : ("function($event){" + (handler.value) + "}") // inline statement
  36183. } else {
  36184. var code = '';
  36185. var genModifierCode = '';
  36186. var keys = [];
  36187. for (var key in handler.modifiers) {
  36188. if (modifierCode[key]) {
  36189. genModifierCode += modifierCode[key];
  36190. // left/right
  36191. if (keyCodes[key]) {
  36192. keys.push(key);
  36193. }
  36194. } else {
  36195. keys.push(key);
  36196. }
  36197. }
  36198. if (keys.length) {
  36199. code += genKeyFilter(keys);
  36200. }
  36201. // Make sure modifiers like prevent and stop get executed after key filtering
  36202. if (genModifierCode) {
  36203. code += genModifierCode;
  36204. }
  36205. var handlerCode = isMethodPath
  36206. ? handler.value + '($event)'
  36207. : isFunctionExpression
  36208. ? ("(" + (handler.value) + ")($event)")
  36209. : handler.value;
  36210. return ("function($event){" + code + handlerCode + "}")
  36211. }
  36212. }
  36213. function genKeyFilter (keys) {
  36214. return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
  36215. }
  36216. function genFilterCode (key) {
  36217. var keyVal = parseInt(key, 10);
  36218. if (keyVal) {
  36219. return ("$event.keyCode!==" + keyVal)
  36220. }
  36221. var alias = keyCodes[key];
  36222. return ("_k($event.keyCode," + (JSON.stringify(key)) + (alias ? ',' + JSON.stringify(alias) : '') + ")")
  36223. }
  36224. /* */
  36225. function on (el, dir) {
  36226. if (process.env.NODE_ENV !== 'production' && dir.modifiers) {
  36227. warn("v-on without argument does not support modifiers.");
  36228. }
  36229. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  36230. }
  36231. /* */
  36232. function bind$1 (el, dir) {
  36233. el.wrapData = function (code) {
  36234. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  36235. };
  36236. }
  36237. /* */
  36238. var baseDirectives = {
  36239. on: on,
  36240. bind: bind$1,
  36241. cloak: noop
  36242. };
  36243. /* */
  36244. var CodegenState = function CodegenState (options) {
  36245. this.options = options;
  36246. this.warn = options.warn || baseWarn;
  36247. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  36248. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  36249. this.directives = extend(extend({}, baseDirectives), options.directives);
  36250. var isReservedTag = options.isReservedTag || no;
  36251. this.maybeComponent = function (el) { return !isReservedTag(el.tag); };
  36252. this.onceId = 0;
  36253. this.staticRenderFns = [];
  36254. };
  36255. function generate (
  36256. ast,
  36257. options
  36258. ) {
  36259. var state = new CodegenState(options);
  36260. var code = ast ? genElement(ast, state) : '_c("div")';
  36261. return {
  36262. render: ("with(this){return " + code + "}"),
  36263. staticRenderFns: state.staticRenderFns
  36264. }
  36265. }
  36266. function genElement (el, state) {
  36267. if (el.staticRoot && !el.staticProcessed) {
  36268. return genStatic(el, state)
  36269. } else if (el.once && !el.onceProcessed) {
  36270. return genOnce(el, state)
  36271. } else if (el.for && !el.forProcessed) {
  36272. return genFor(el, state)
  36273. } else if (el.if && !el.ifProcessed) {
  36274. return genIf(el, state)
  36275. } else if (el.tag === 'template' && !el.slotTarget) {
  36276. return genChildren(el, state) || 'void 0'
  36277. } else if (el.tag === 'slot') {
  36278. return genSlot(el, state)
  36279. } else {
  36280. // component or element
  36281. var code;
  36282. if (el.component) {
  36283. code = genComponent(el.component, el, state);
  36284. } else {
  36285. var data = el.plain ? undefined : genData$2(el, state);
  36286. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  36287. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  36288. }
  36289. // module transforms
  36290. for (var i = 0; i < state.transforms.length; i++) {
  36291. code = state.transforms[i](el, code);
  36292. }
  36293. return code
  36294. }
  36295. }
  36296. // hoist static sub-trees out
  36297. function genStatic (el, state) {
  36298. el.staticProcessed = true;
  36299. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  36300. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  36301. }
  36302. // v-once
  36303. function genOnce (el, state) {
  36304. el.onceProcessed = true;
  36305. if (el.if && !el.ifProcessed) {
  36306. return genIf(el, state)
  36307. } else if (el.staticInFor) {
  36308. var key = '';
  36309. var parent = el.parent;
  36310. while (parent) {
  36311. if (parent.for) {
  36312. key = parent.key;
  36313. break
  36314. }
  36315. parent = parent.parent;
  36316. }
  36317. if (!key) {
  36318. process.env.NODE_ENV !== 'production' && state.warn(
  36319. "v-once can only be used inside v-for that is keyed. "
  36320. );
  36321. return genElement(el, state)
  36322. }
  36323. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + (key ? ("," + key) : "") + ")")
  36324. } else {
  36325. return genStatic(el, state)
  36326. }
  36327. }
  36328. function genIf (
  36329. el,
  36330. state,
  36331. altGen,
  36332. altEmpty
  36333. ) {
  36334. el.ifProcessed = true; // avoid recursion
  36335. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  36336. }
  36337. function genIfConditions (
  36338. conditions,
  36339. state,
  36340. altGen,
  36341. altEmpty
  36342. ) {
  36343. if (!conditions.length) {
  36344. return altEmpty || '_e()'
  36345. }
  36346. var condition = conditions.shift();
  36347. if (condition.exp) {
  36348. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  36349. } else {
  36350. return ("" + (genTernaryExp(condition.block)))
  36351. }
  36352. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  36353. function genTernaryExp (el) {
  36354. return altGen
  36355. ? altGen(el, state)
  36356. : el.once
  36357. ? genOnce(el, state)
  36358. : genElement(el, state)
  36359. }
  36360. }
  36361. function genFor (
  36362. el,
  36363. state,
  36364. altGen,
  36365. altHelper
  36366. ) {
  36367. var exp = el.for;
  36368. var alias = el.alias;
  36369. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  36370. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  36371. if (process.env.NODE_ENV !== 'production' &&
  36372. state.maybeComponent(el) &&
  36373. el.tag !== 'slot' &&
  36374. el.tag !== 'template' &&
  36375. !el.key
  36376. ) {
  36377. state.warn(
  36378. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  36379. "v-for should have explicit keys. " +
  36380. "See https://vuejs.org/guide/list.html#key for more info.",
  36381. true /* tip */
  36382. );
  36383. }
  36384. el.forProcessed = true; // avoid recursion
  36385. return (altHelper || '_l') + "((" + exp + ")," +
  36386. "function(" + alias + iterator1 + iterator2 + "){" +
  36387. "return " + ((altGen || genElement)(el, state)) +
  36388. '})'
  36389. }
  36390. function genData$2 (el, state) {
  36391. var data = '{';
  36392. // directives first.
  36393. // directives may mutate the el's other properties before they are generated.
  36394. var dirs = genDirectives(el, state);
  36395. if (dirs) { data += dirs + ','; }
  36396. // key
  36397. if (el.key) {
  36398. data += "key:" + (el.key) + ",";
  36399. }
  36400. // ref
  36401. if (el.ref) {
  36402. data += "ref:" + (el.ref) + ",";
  36403. }
  36404. if (el.refInFor) {
  36405. data += "refInFor:true,";
  36406. }
  36407. // pre
  36408. if (el.pre) {
  36409. data += "pre:true,";
  36410. }
  36411. // record original tag name for components using "is" attribute
  36412. if (el.component) {
  36413. data += "tag:\"" + (el.tag) + "\",";
  36414. }
  36415. // module data generation functions
  36416. for (var i = 0; i < state.dataGenFns.length; i++) {
  36417. data += state.dataGenFns[i](el);
  36418. }
  36419. // attributes
  36420. if (el.attrs) {
  36421. data += "attrs:{" + (genProps(el.attrs)) + "},";
  36422. }
  36423. // DOM props
  36424. if (el.props) {
  36425. data += "domProps:{" + (genProps(el.props)) + "},";
  36426. }
  36427. // event handlers
  36428. if (el.events) {
  36429. data += (genHandlers(el.events, false, state.warn)) + ",";
  36430. }
  36431. if (el.nativeEvents) {
  36432. data += (genHandlers(el.nativeEvents, true, state.warn)) + ",";
  36433. }
  36434. // slot target
  36435. if (el.slotTarget) {
  36436. data += "slot:" + (el.slotTarget) + ",";
  36437. }
  36438. // scoped slots
  36439. if (el.scopedSlots) {
  36440. data += (genScopedSlots(el.scopedSlots, state)) + ",";
  36441. }
  36442. // component v-model
  36443. if (el.model) {
  36444. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  36445. }
  36446. // inline-template
  36447. if (el.inlineTemplate) {
  36448. var inlineTemplate = genInlineTemplate(el, state);
  36449. if (inlineTemplate) {
  36450. data += inlineTemplate + ",";
  36451. }
  36452. }
  36453. data = data.replace(/,$/, '') + '}';
  36454. // v-bind data wrap
  36455. if (el.wrapData) {
  36456. data = el.wrapData(data);
  36457. }
  36458. // v-on data wrap
  36459. if (el.wrapListeners) {
  36460. data = el.wrapListeners(data);
  36461. }
  36462. return data
  36463. }
  36464. function genDirectives (el, state) {
  36465. var dirs = el.directives;
  36466. if (!dirs) { return }
  36467. var res = 'directives:[';
  36468. var hasRuntime = false;
  36469. var i, l, dir, needRuntime;
  36470. for (i = 0, l = dirs.length; i < l; i++) {
  36471. dir = dirs[i];
  36472. needRuntime = true;
  36473. var gen = state.directives[dir.name];
  36474. if (gen) {
  36475. // compile-time directive that manipulates AST.
  36476. // returns true if it also needs a runtime counterpart.
  36477. needRuntime = !!gen(el, dir, state.warn);
  36478. }
  36479. if (needRuntime) {
  36480. hasRuntime = true;
  36481. 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))) : '') + "},";
  36482. }
  36483. }
  36484. if (hasRuntime) {
  36485. return res.slice(0, -1) + ']'
  36486. }
  36487. }
  36488. function genInlineTemplate (el, state) {
  36489. var ast = el.children[0];
  36490. if (process.env.NODE_ENV !== 'production' && (
  36491. el.children.length > 1 || ast.type !== 1
  36492. )) {
  36493. state.warn('Inline-template components must have exactly one child element.');
  36494. }
  36495. if (ast.type === 1) {
  36496. var inlineRenderFns = generate(ast, state.options);
  36497. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  36498. }
  36499. }
  36500. function genScopedSlots (
  36501. slots,
  36502. state
  36503. ) {
  36504. return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
  36505. return genScopedSlot(key, slots[key], state)
  36506. }).join(',')) + "])")
  36507. }
  36508. function genScopedSlot (
  36509. key,
  36510. el,
  36511. state
  36512. ) {
  36513. if (el.for && !el.forProcessed) {
  36514. return genForScopedSlot(key, el, state)
  36515. }
  36516. return "{key:" + key + ",fn:function(" + (String(el.attrsMap.scope)) + "){" +
  36517. "return " + (el.tag === 'template'
  36518. ? genChildren(el, state) || 'void 0'
  36519. : genElement(el, state)) + "}}"
  36520. }
  36521. function genForScopedSlot (
  36522. key,
  36523. el,
  36524. state
  36525. ) {
  36526. var exp = el.for;
  36527. var alias = el.alias;
  36528. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  36529. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  36530. el.forProcessed = true; // avoid recursion
  36531. return "_l((" + exp + ")," +
  36532. "function(" + alias + iterator1 + iterator2 + "){" +
  36533. "return " + (genScopedSlot(key, el, state)) +
  36534. '})'
  36535. }
  36536. function genChildren (
  36537. el,
  36538. state,
  36539. checkSkip,
  36540. altGenElement,
  36541. altGenNode
  36542. ) {
  36543. var children = el.children;
  36544. if (children.length) {
  36545. var el$1 = children[0];
  36546. // optimize single v-for
  36547. if (children.length === 1 &&
  36548. el$1.for &&
  36549. el$1.tag !== 'template' &&
  36550. el$1.tag !== 'slot'
  36551. ) {
  36552. return (altGenElement || genElement)(el$1, state)
  36553. }
  36554. var normalizationType = checkSkip
  36555. ? getNormalizationType(children, state.maybeComponent)
  36556. : 0;
  36557. var gen = altGenNode || genNode;
  36558. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
  36559. }
  36560. }
  36561. // determine the normalization needed for the children array.
  36562. // 0: no normalization needed
  36563. // 1: simple normalization needed (possible 1-level deep nested array)
  36564. // 2: full normalization needed
  36565. function getNormalizationType (
  36566. children,
  36567. maybeComponent
  36568. ) {
  36569. var res = 0;
  36570. for (var i = 0; i < children.length; i++) {
  36571. var el = children[i];
  36572. if (el.type !== 1) {
  36573. continue
  36574. }
  36575. if (needsNormalization(el) ||
  36576. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  36577. res = 2;
  36578. break
  36579. }
  36580. if (maybeComponent(el) ||
  36581. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  36582. res = 1;
  36583. }
  36584. }
  36585. return res
  36586. }
  36587. function needsNormalization (el) {
  36588. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  36589. }
  36590. function genNode (node, state) {
  36591. if (node.type === 1) {
  36592. return genElement(node, state)
  36593. } if (node.type === 3 && node.isComment) {
  36594. return genComment(node)
  36595. } else {
  36596. return genText(node)
  36597. }
  36598. }
  36599. function genText (text) {
  36600. return ("_v(" + (text.type === 2
  36601. ? text.expression // no need for () because already wrapped in _s()
  36602. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  36603. }
  36604. function genComment (comment) {
  36605. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  36606. }
  36607. function genSlot (el, state) {
  36608. var slotName = el.slotName || '"default"';
  36609. var children = genChildren(el, state);
  36610. var res = "_t(" + slotName + (children ? ("," + children) : '');
  36611. var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
  36612. var bind$$1 = el.attrsMap['v-bind'];
  36613. if ((attrs || bind$$1) && !children) {
  36614. res += ",null";
  36615. }
  36616. if (attrs) {
  36617. res += "," + attrs;
  36618. }
  36619. if (bind$$1) {
  36620. res += (attrs ? '' : ',null') + "," + bind$$1;
  36621. }
  36622. return res + ')'
  36623. }
  36624. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  36625. function genComponent (
  36626. componentName,
  36627. el,
  36628. state
  36629. ) {
  36630. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  36631. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  36632. }
  36633. function genProps (props) {
  36634. var res = '';
  36635. for (var i = 0; i < props.length; i++) {
  36636. var prop = props[i];
  36637. res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
  36638. }
  36639. return res.slice(0, -1)
  36640. }
  36641. // #3895, #4268
  36642. function transformSpecialNewlines (text) {
  36643. return text
  36644. .replace(/\u2028/g, '\\u2028')
  36645. .replace(/\u2029/g, '\\u2029')
  36646. }
  36647. /* */
  36648. // these keywords should not appear inside expressions, but operators like
  36649. // typeof, instanceof and in are allowed
  36650. var prohibitedKeywordRE = new RegExp('\\b' + (
  36651. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  36652. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  36653. 'extends,finally,continue,debugger,function,arguments'
  36654. ).split(',').join('\\b|\\b') + '\\b');
  36655. // these unary operators should not be used as property/method names
  36656. var unaryOperatorsRE = new RegExp('\\b' + (
  36657. 'delete,typeof,void'
  36658. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  36659. // check valid identifier for v-for
  36660. var identRE = /[A-Za-z_$][\w$]*/;
  36661. // strip strings in expressions
  36662. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  36663. // detect problematic expressions in a template
  36664. function detectErrors (ast) {
  36665. var errors = [];
  36666. if (ast) {
  36667. checkNode(ast, errors);
  36668. }
  36669. return errors
  36670. }
  36671. function checkNode (node, errors) {
  36672. if (node.type === 1) {
  36673. for (var name in node.attrsMap) {
  36674. if (dirRE.test(name)) {
  36675. var value = node.attrsMap[name];
  36676. if (value) {
  36677. if (name === 'v-for') {
  36678. checkFor(node, ("v-for=\"" + value + "\""), errors);
  36679. } else if (onRE.test(name)) {
  36680. checkEvent(value, (name + "=\"" + value + "\""), errors);
  36681. } else {
  36682. checkExpression(value, (name + "=\"" + value + "\""), errors);
  36683. }
  36684. }
  36685. }
  36686. }
  36687. if (node.children) {
  36688. for (var i = 0; i < node.children.length; i++) {
  36689. checkNode(node.children[i], errors);
  36690. }
  36691. }
  36692. } else if (node.type === 2) {
  36693. checkExpression(node.expression, node.text, errors);
  36694. }
  36695. }
  36696. function checkEvent (exp, text, errors) {
  36697. var stipped = exp.replace(stripStringRE, '');
  36698. var keywordMatch = stipped.match(unaryOperatorsRE);
  36699. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  36700. errors.push(
  36701. "avoid using JavaScript unary operator as property name: " +
  36702. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  36703. );
  36704. }
  36705. checkExpression(exp, text, errors);
  36706. }
  36707. function checkFor (node, text, errors) {
  36708. checkExpression(node.for || '', text, errors);
  36709. checkIdentifier(node.alias, 'v-for alias', text, errors);
  36710. checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
  36711. checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
  36712. }
  36713. function checkIdentifier (ident, type, text, errors) {
  36714. if (typeof ident === 'string' && !identRE.test(ident)) {
  36715. errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
  36716. }
  36717. }
  36718. function checkExpression (exp, text, errors) {
  36719. try {
  36720. new Function(("return " + exp));
  36721. } catch (e) {
  36722. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  36723. if (keywordMatch) {
  36724. errors.push(
  36725. "avoid using JavaScript keyword as property name: " +
  36726. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  36727. );
  36728. } else {
  36729. errors.push(("invalid expression: " + (text.trim())));
  36730. }
  36731. }
  36732. }
  36733. /* */
  36734. function createFunction (code, errors) {
  36735. try {
  36736. return new Function(code)
  36737. } catch (err) {
  36738. errors.push({ err: err, code: code });
  36739. return noop
  36740. }
  36741. }
  36742. function createCompileToFunctionFn (compile) {
  36743. var cache = Object.create(null);
  36744. return function compileToFunctions (
  36745. template,
  36746. options,
  36747. vm
  36748. ) {
  36749. options = options || {};
  36750. /* istanbul ignore if */
  36751. if (process.env.NODE_ENV !== 'production') {
  36752. // detect possible CSP restriction
  36753. try {
  36754. new Function('return 1');
  36755. } catch (e) {
  36756. if (e.toString().match(/unsafe-eval|CSP/)) {
  36757. warn(
  36758. 'It seems you are using the standalone build of Vue.js in an ' +
  36759. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  36760. 'The template compiler cannot work in this environment. Consider ' +
  36761. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  36762. 'templates into render functions.'
  36763. );
  36764. }
  36765. }
  36766. }
  36767. // check cache
  36768. var key = options.delimiters
  36769. ? String(options.delimiters) + template
  36770. : template;
  36771. if (cache[key]) {
  36772. return cache[key]
  36773. }
  36774. // compile
  36775. var compiled = compile(template, options);
  36776. // check compilation errors/tips
  36777. if (process.env.NODE_ENV !== 'production') {
  36778. if (compiled.errors && compiled.errors.length) {
  36779. warn(
  36780. "Error compiling template:\n\n" + template + "\n\n" +
  36781. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  36782. vm
  36783. );
  36784. }
  36785. if (compiled.tips && compiled.tips.length) {
  36786. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  36787. }
  36788. }
  36789. // turn code into functions
  36790. var res = {};
  36791. var fnGenErrors = [];
  36792. res.render = createFunction(compiled.render, fnGenErrors);
  36793. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  36794. return createFunction(code, fnGenErrors)
  36795. });
  36796. // check function generation errors.
  36797. // this should only happen if there is a bug in the compiler itself.
  36798. // mostly for codegen development use
  36799. /* istanbul ignore if */
  36800. if (process.env.NODE_ENV !== 'production') {
  36801. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  36802. warn(
  36803. "Failed to generate render function:\n\n" +
  36804. fnGenErrors.map(function (ref) {
  36805. var err = ref.err;
  36806. var code = ref.code;
  36807. return ((err.toString()) + " in\n\n" + code + "\n");
  36808. }).join('\n'),
  36809. vm
  36810. );
  36811. }
  36812. }
  36813. return (cache[key] = res)
  36814. }
  36815. }
  36816. /* */
  36817. function createCompilerCreator (baseCompile) {
  36818. return function createCompiler (baseOptions) {
  36819. function compile (
  36820. template,
  36821. options
  36822. ) {
  36823. var finalOptions = Object.create(baseOptions);
  36824. var errors = [];
  36825. var tips = [];
  36826. finalOptions.warn = function (msg, tip) {
  36827. (tip ? tips : errors).push(msg);
  36828. };
  36829. if (options) {
  36830. // merge custom modules
  36831. if (options.modules) {
  36832. finalOptions.modules =
  36833. (baseOptions.modules || []).concat(options.modules);
  36834. }
  36835. // merge custom directives
  36836. if (options.directives) {
  36837. finalOptions.directives = extend(
  36838. Object.create(baseOptions.directives),
  36839. options.directives
  36840. );
  36841. }
  36842. // copy other options
  36843. for (var key in options) {
  36844. if (key !== 'modules' && key !== 'directives') {
  36845. finalOptions[key] = options[key];
  36846. }
  36847. }
  36848. }
  36849. var compiled = baseCompile(template, finalOptions);
  36850. if (process.env.NODE_ENV !== 'production') {
  36851. errors.push.apply(errors, detectErrors(compiled.ast));
  36852. }
  36853. compiled.errors = errors;
  36854. compiled.tips = tips;
  36855. return compiled
  36856. }
  36857. return {
  36858. compile: compile,
  36859. compileToFunctions: createCompileToFunctionFn(compile)
  36860. }
  36861. }
  36862. }
  36863. /* */
  36864. // `createCompilerCreator` allows creating compilers that use alternative
  36865. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  36866. // Here we just export a default compiler using the default parts.
  36867. var createCompiler = createCompilerCreator(function baseCompile (
  36868. template,
  36869. options
  36870. ) {
  36871. var ast = parse(template.trim(), options);
  36872. optimize(ast, options);
  36873. var code = generate(ast, options);
  36874. return {
  36875. ast: ast,
  36876. render: code.render,
  36877. staticRenderFns: code.staticRenderFns
  36878. }
  36879. });
  36880. /* */
  36881. var ref$1 = createCompiler(baseOptions);
  36882. var compileToFunctions = ref$1.compileToFunctions;
  36883. /* */
  36884. var idToTemplate = cached(function (id) {
  36885. var el = query(id);
  36886. return el && el.innerHTML
  36887. });
  36888. var mount = Vue$3.prototype.$mount;
  36889. Vue$3.prototype.$mount = function (
  36890. el,
  36891. hydrating
  36892. ) {
  36893. el = el && query(el);
  36894. /* istanbul ignore if */
  36895. if (el === document.body || el === document.documentElement) {
  36896. process.env.NODE_ENV !== 'production' && warn(
  36897. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  36898. );
  36899. return this
  36900. }
  36901. var options = this.$options;
  36902. // resolve template/el and convert to render function
  36903. if (!options.render) {
  36904. var template = options.template;
  36905. if (template) {
  36906. if (typeof template === 'string') {
  36907. if (template.charAt(0) === '#') {
  36908. template = idToTemplate(template);
  36909. /* istanbul ignore if */
  36910. if (process.env.NODE_ENV !== 'production' && !template) {
  36911. warn(
  36912. ("Template element not found or is empty: " + (options.template)),
  36913. this
  36914. );
  36915. }
  36916. }
  36917. } else if (template.nodeType) {
  36918. template = template.innerHTML;
  36919. } else {
  36920. if (process.env.NODE_ENV !== 'production') {
  36921. warn('invalid template option:' + template, this);
  36922. }
  36923. return this
  36924. }
  36925. } else if (el) {
  36926. template = getOuterHTML(el);
  36927. }
  36928. if (template) {
  36929. /* istanbul ignore if */
  36930. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  36931. mark('compile');
  36932. }
  36933. var ref = compileToFunctions(template, {
  36934. shouldDecodeNewlines: shouldDecodeNewlines,
  36935. delimiters: options.delimiters,
  36936. comments: options.comments
  36937. }, this);
  36938. var render = ref.render;
  36939. var staticRenderFns = ref.staticRenderFns;
  36940. options.render = render;
  36941. options.staticRenderFns = staticRenderFns;
  36942. /* istanbul ignore if */
  36943. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  36944. mark('compile end');
  36945. measure(((this._name) + " compile"), 'compile', 'compile end');
  36946. }
  36947. }
  36948. }
  36949. return mount.call(this, el, hydrating)
  36950. };
  36951. /**
  36952. * Get outerHTML of elements, taking care
  36953. * of SVG elements in IE as well.
  36954. */
  36955. function getOuterHTML (el) {
  36956. if (el.outerHTML) {
  36957. return el.outerHTML
  36958. } else {
  36959. var container = document.createElement('div');
  36960. container.appendChild(el.cloneNode(true));
  36961. return container.innerHTML
  36962. }
  36963. }
  36964. Vue$3.compile = compileToFunctions;
  36965. module.exports = Vue$3;
  36966. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(9)))
  36967. /***/ }),
  36968. /* 38 */
  36969. /***/ (function(module, exports) {
  36970. module.exports = function(module) {
  36971. if(!module.webpackPolyfill) {
  36972. module.deprecate = function() {};
  36973. module.paths = [];
  36974. // module.parent = undefined by default
  36975. if(!module.children) module.children = [];
  36976. Object.defineProperty(module, "loaded", {
  36977. enumerable: true,
  36978. get: function() {
  36979. return module.l;
  36980. }
  36981. });
  36982. Object.defineProperty(module, "id", {
  36983. enumerable: true,
  36984. get: function() {
  36985. return module.i;
  36986. }
  36987. });
  36988. module.webpackPolyfill = 1;
  36989. }
  36990. return module;
  36991. };
  36992. /***/ }),
  36993. /* 39 */
  36994. /***/ (function(module, exports, __webpack_require__) {
  36995. __webpack_require__(10);
  36996. module.exports = __webpack_require__(11);
  36997. /***/ })
  36998. /******/ ]);