app.js 1.2 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, {
  40. /******/ configurable: false,
  41. /******/ enumerable: true,
  42. /******/ get: getter
  43. /******/ });
  44. /******/ }
  45. /******/ };
  46. /******/
  47. /******/ // getDefaultExport function for compatibility with non-harmony modules
  48. /******/ __webpack_require__.n = function(module) {
  49. /******/ var getter = module && module.__esModule ?
  50. /******/ function getDefault() { return module['default']; } :
  51. /******/ function getModuleExports() { return module; };
  52. /******/ __webpack_require__.d(getter, 'a', getter);
  53. /******/ return getter;
  54. /******/ };
  55. /******/
  56. /******/ // Object.prototype.hasOwnProperty.call
  57. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  58. /******/
  59. /******/ // __webpack_public_path__
  60. /******/ __webpack_require__.p = "";
  61. /******/
  62. /******/ // Load entry module and return exports
  63. /******/ return __webpack_require__(__webpack_require__.s = 9);
  64. /******/ })
  65. /************************************************************************/
  66. /******/ ([
  67. /* 0 */
  68. /***/ (function(module, exports, __webpack_require__) {
  69. "use strict";
  70. var bind = __webpack_require__(3);
  71. var isBuffer = __webpack_require__(18);
  72. /*global toString:true*/
  73. // utils is a library of generic helper functions non-specific to axios
  74. var toString = Object.prototype.toString;
  75. /**
  76. * Determine if a value is an Array
  77. *
  78. * @param {Object} val The value to test
  79. * @returns {boolean} True if value is an Array, otherwise false
  80. */
  81. function isArray(val) {
  82. return toString.call(val) === '[object Array]';
  83. }
  84. /**
  85. * Determine if a value is an ArrayBuffer
  86. *
  87. * @param {Object} val The value to test
  88. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  89. */
  90. function isArrayBuffer(val) {
  91. return toString.call(val) === '[object ArrayBuffer]';
  92. }
  93. /**
  94. * Determine if a value is a FormData
  95. *
  96. * @param {Object} val The value to test
  97. * @returns {boolean} True if value is an FormData, otherwise false
  98. */
  99. function isFormData(val) {
  100. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  101. }
  102. /**
  103. * Determine if a value is a view on an ArrayBuffer
  104. *
  105. * @param {Object} val The value to test
  106. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  107. */
  108. function isArrayBufferView(val) {
  109. var result;
  110. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  111. result = ArrayBuffer.isView(val);
  112. } else {
  113. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  114. }
  115. return result;
  116. }
  117. /**
  118. * Determine if a value is a String
  119. *
  120. * @param {Object} val The value to test
  121. * @returns {boolean} True if value is a String, otherwise false
  122. */
  123. function isString(val) {
  124. return typeof val === 'string';
  125. }
  126. /**
  127. * Determine if a value is a Number
  128. *
  129. * @param {Object} val The value to test
  130. * @returns {boolean} True if value is a Number, otherwise false
  131. */
  132. function isNumber(val) {
  133. return typeof val === 'number';
  134. }
  135. /**
  136. * Determine if a value is undefined
  137. *
  138. * @param {Object} val The value to test
  139. * @returns {boolean} True if the value is undefined, otherwise false
  140. */
  141. function isUndefined(val) {
  142. return typeof val === 'undefined';
  143. }
  144. /**
  145. * Determine if a value is an Object
  146. *
  147. * @param {Object} val The value to test
  148. * @returns {boolean} True if value is an Object, otherwise false
  149. */
  150. function isObject(val) {
  151. return val !== null && typeof val === 'object';
  152. }
  153. /**
  154. * Determine if a value is a Date
  155. *
  156. * @param {Object} val The value to test
  157. * @returns {boolean} True if value is a Date, otherwise false
  158. */
  159. function isDate(val) {
  160. return toString.call(val) === '[object Date]';
  161. }
  162. /**
  163. * Determine if a value is a File
  164. *
  165. * @param {Object} val The value to test
  166. * @returns {boolean} True if value is a File, otherwise false
  167. */
  168. function isFile(val) {
  169. return toString.call(val) === '[object File]';
  170. }
  171. /**
  172. * Determine if a value is a Blob
  173. *
  174. * @param {Object} val The value to test
  175. * @returns {boolean} True if value is a Blob, otherwise false
  176. */
  177. function isBlob(val) {
  178. return toString.call(val) === '[object Blob]';
  179. }
  180. /**
  181. * Determine if a value is a Function
  182. *
  183. * @param {Object} val The value to test
  184. * @returns {boolean} True if value is a Function, otherwise false
  185. */
  186. function isFunction(val) {
  187. return toString.call(val) === '[object Function]';
  188. }
  189. /**
  190. * Determine if a value is a Stream
  191. *
  192. * @param {Object} val The value to test
  193. * @returns {boolean} True if value is a Stream, otherwise false
  194. */
  195. function isStream(val) {
  196. return isObject(val) && isFunction(val.pipe);
  197. }
  198. /**
  199. * Determine if a value is a URLSearchParams object
  200. *
  201. * @param {Object} val The value to test
  202. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  203. */
  204. function isURLSearchParams(val) {
  205. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  206. }
  207. /**
  208. * Trim excess whitespace off the beginning and end of a string
  209. *
  210. * @param {String} str The String to trim
  211. * @returns {String} The String freed of excess whitespace
  212. */
  213. function trim(str) {
  214. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  215. }
  216. /**
  217. * Determine if we're running in a standard browser environment
  218. *
  219. * This allows axios to run in a web worker, and react-native.
  220. * Both environments support XMLHttpRequest, but not fully standard globals.
  221. *
  222. * web workers:
  223. * typeof window -> undefined
  224. * typeof document -> undefined
  225. *
  226. * react-native:
  227. * navigator.product -> 'ReactNative'
  228. */
  229. function isStandardBrowserEnv() {
  230. if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
  231. return false;
  232. }
  233. return (
  234. typeof window !== 'undefined' &&
  235. typeof document !== 'undefined'
  236. );
  237. }
  238. /**
  239. * Iterate over an Array or an Object invoking a function for each item.
  240. *
  241. * If `obj` is an Array callback will be called passing
  242. * the value, index, and complete array for each item.
  243. *
  244. * If 'obj' is an Object callback will be called passing
  245. * the value, key, and complete object for each property.
  246. *
  247. * @param {Object|Array} obj The object to iterate
  248. * @param {Function} fn The callback to invoke for each item
  249. */
  250. function forEach(obj, fn) {
  251. // Don't bother if no value provided
  252. if (obj === null || typeof obj === 'undefined') {
  253. return;
  254. }
  255. // Force an array if not already something iterable
  256. if (typeof obj !== 'object') {
  257. /*eslint no-param-reassign:0*/
  258. obj = [obj];
  259. }
  260. if (isArray(obj)) {
  261. // Iterate over array values
  262. for (var i = 0, l = obj.length; i < l; i++) {
  263. fn.call(null, obj[i], i, obj);
  264. }
  265. } else {
  266. // Iterate over object keys
  267. for (var key in obj) {
  268. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  269. fn.call(null, obj[key], key, obj);
  270. }
  271. }
  272. }
  273. }
  274. /**
  275. * Accepts varargs expecting each argument to be an object, then
  276. * immutably merges the properties of each object and returns result.
  277. *
  278. * When multiple objects contain the same key the later object in
  279. * the arguments list will take precedence.
  280. *
  281. * Example:
  282. *
  283. * ```js
  284. * var result = merge({foo: 123}, {foo: 456});
  285. * console.log(result.foo); // outputs 456
  286. * ```
  287. *
  288. * @param {Object} obj1 Object to merge
  289. * @returns {Object} Result of all merge properties
  290. */
  291. function merge(/* obj1, obj2, obj3, ... */) {
  292. var result = {};
  293. function assignValue(val, key) {
  294. if (typeof result[key] === 'object' && typeof val === 'object') {
  295. result[key] = merge(result[key], val);
  296. } else {
  297. result[key] = val;
  298. }
  299. }
  300. for (var i = 0, l = arguments.length; i < l; i++) {
  301. forEach(arguments[i], assignValue);
  302. }
  303. return result;
  304. }
  305. /**
  306. * Extends object a by mutably adding to it the properties of object b.
  307. *
  308. * @param {Object} a The object to be extended
  309. * @param {Object} b The object to copy properties from
  310. * @param {Object} thisArg The object to bind function to
  311. * @return {Object} The resulting value of object a
  312. */
  313. function extend(a, b, thisArg) {
  314. forEach(b, function assignValue(val, key) {
  315. if (thisArg && typeof val === 'function') {
  316. a[key] = bind(val, thisArg);
  317. } else {
  318. a[key] = val;
  319. }
  320. });
  321. return a;
  322. }
  323. module.exports = {
  324. isArray: isArray,
  325. isArrayBuffer: isArrayBuffer,
  326. isBuffer: isBuffer,
  327. isFormData: isFormData,
  328. isArrayBufferView: isArrayBufferView,
  329. isString: isString,
  330. isNumber: isNumber,
  331. isObject: isObject,
  332. isUndefined: isUndefined,
  333. isDate: isDate,
  334. isFile: isFile,
  335. isBlob: isBlob,
  336. isFunction: isFunction,
  337. isStream: isStream,
  338. isURLSearchParams: isURLSearchParams,
  339. isStandardBrowserEnv: isStandardBrowserEnv,
  340. forEach: forEach,
  341. merge: merge,
  342. extend: extend,
  343. trim: trim
  344. };
  345. /***/ }),
  346. /* 1 */
  347. /***/ (function(module, exports) {
  348. var g;
  349. // This works in non-strict mode
  350. g = (function() {
  351. return this;
  352. })();
  353. try {
  354. // This works if eval is allowed (see CSP)
  355. g = g || Function("return this")() || (1,eval)("this");
  356. } catch(e) {
  357. // This works if the window reference is available
  358. if(typeof window === "object")
  359. g = window;
  360. }
  361. // g can still be undefined, but nothing to do about it...
  362. // We return undefined, instead of nothing here, so it's
  363. // easier to handle this case. if(!global) { ...}
  364. module.exports = g;
  365. /***/ }),
  366. /* 2 */
  367. /***/ (function(module, exports, __webpack_require__) {
  368. "use strict";
  369. /* WEBPACK VAR INJECTION */(function(process) {
  370. var utils = __webpack_require__(0);
  371. var normalizeHeaderName = __webpack_require__(20);
  372. var DEFAULT_CONTENT_TYPE = {
  373. 'Content-Type': 'application/x-www-form-urlencoded'
  374. };
  375. function setContentTypeIfUnset(headers, value) {
  376. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  377. headers['Content-Type'] = value;
  378. }
  379. }
  380. function getDefaultAdapter() {
  381. var adapter;
  382. if (typeof XMLHttpRequest !== 'undefined') {
  383. // For browsers use XHR adapter
  384. adapter = __webpack_require__(5);
  385. } else if (typeof process !== 'undefined') {
  386. // For node use HTTP adapter
  387. adapter = __webpack_require__(5);
  388. }
  389. return adapter;
  390. }
  391. var defaults = {
  392. adapter: getDefaultAdapter(),
  393. transformRequest: [function transformRequest(data, headers) {
  394. normalizeHeaderName(headers, 'Content-Type');
  395. if (utils.isFormData(data) ||
  396. utils.isArrayBuffer(data) ||
  397. utils.isBuffer(data) ||
  398. utils.isStream(data) ||
  399. utils.isFile(data) ||
  400. utils.isBlob(data)
  401. ) {
  402. return data;
  403. }
  404. if (utils.isArrayBufferView(data)) {
  405. return data.buffer;
  406. }
  407. if (utils.isURLSearchParams(data)) {
  408. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  409. return data.toString();
  410. }
  411. if (utils.isObject(data)) {
  412. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  413. return JSON.stringify(data);
  414. }
  415. return data;
  416. }],
  417. transformResponse: [function transformResponse(data) {
  418. /*eslint no-param-reassign:0*/
  419. if (typeof data === 'string') {
  420. try {
  421. data = JSON.parse(data);
  422. } catch (e) { /* Ignore */ }
  423. }
  424. return data;
  425. }],
  426. timeout: 0,
  427. xsrfCookieName: 'XSRF-TOKEN',
  428. xsrfHeaderName: 'X-XSRF-TOKEN',
  429. maxContentLength: -1,
  430. validateStatus: function validateStatus(status) {
  431. return status >= 200 && status < 300;
  432. }
  433. };
  434. defaults.headers = {
  435. common: {
  436. 'Accept': 'application/json, text/plain, */*'
  437. }
  438. };
  439. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  440. defaults.headers[method] = {};
  441. });
  442. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  443. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  444. });
  445. module.exports = defaults;
  446. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4)))
  447. /***/ }),
  448. /* 3 */
  449. /***/ (function(module, exports, __webpack_require__) {
  450. "use strict";
  451. module.exports = function bind(fn, thisArg) {
  452. return function wrap() {
  453. var args = new Array(arguments.length);
  454. for (var i = 0; i < args.length; i++) {
  455. args[i] = arguments[i];
  456. }
  457. return fn.apply(thisArg, args);
  458. };
  459. };
  460. /***/ }),
  461. /* 4 */
  462. /***/ (function(module, exports) {
  463. // shim for using process in browser
  464. var process = module.exports = {};
  465. // cached from whatever global is present so that test runners that stub it
  466. // don't break things. But we need to wrap it in a try catch in case it is
  467. // wrapped in strict mode code which doesn't define any globals. It's inside a
  468. // function because try/catches deoptimize in certain engines.
  469. var cachedSetTimeout;
  470. var cachedClearTimeout;
  471. function defaultSetTimout() {
  472. throw new Error('setTimeout has not been defined');
  473. }
  474. function defaultClearTimeout () {
  475. throw new Error('clearTimeout has not been defined');
  476. }
  477. (function () {
  478. try {
  479. if (typeof setTimeout === 'function') {
  480. cachedSetTimeout = setTimeout;
  481. } else {
  482. cachedSetTimeout = defaultSetTimout;
  483. }
  484. } catch (e) {
  485. cachedSetTimeout = defaultSetTimout;
  486. }
  487. try {
  488. if (typeof clearTimeout === 'function') {
  489. cachedClearTimeout = clearTimeout;
  490. } else {
  491. cachedClearTimeout = defaultClearTimeout;
  492. }
  493. } catch (e) {
  494. cachedClearTimeout = defaultClearTimeout;
  495. }
  496. } ())
  497. function runTimeout(fun) {
  498. if (cachedSetTimeout === setTimeout) {
  499. //normal enviroments in sane situations
  500. return setTimeout(fun, 0);
  501. }
  502. // if setTimeout wasn't available but was latter defined
  503. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  504. cachedSetTimeout = setTimeout;
  505. return setTimeout(fun, 0);
  506. }
  507. try {
  508. // when when somebody has screwed with setTimeout but no I.E. maddness
  509. return cachedSetTimeout(fun, 0);
  510. } catch(e){
  511. try {
  512. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  513. return cachedSetTimeout.call(null, fun, 0);
  514. } catch(e){
  515. // 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
  516. return cachedSetTimeout.call(this, fun, 0);
  517. }
  518. }
  519. }
  520. function runClearTimeout(marker) {
  521. if (cachedClearTimeout === clearTimeout) {
  522. //normal enviroments in sane situations
  523. return clearTimeout(marker);
  524. }
  525. // if clearTimeout wasn't available but was latter defined
  526. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  527. cachedClearTimeout = clearTimeout;
  528. return clearTimeout(marker);
  529. }
  530. try {
  531. // when when somebody has screwed with setTimeout but no I.E. maddness
  532. return cachedClearTimeout(marker);
  533. } catch (e){
  534. try {
  535. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  536. return cachedClearTimeout.call(null, marker);
  537. } catch (e){
  538. // 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.
  539. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  540. return cachedClearTimeout.call(this, marker);
  541. }
  542. }
  543. }
  544. var queue = [];
  545. var draining = false;
  546. var currentQueue;
  547. var queueIndex = -1;
  548. function cleanUpNextTick() {
  549. if (!draining || !currentQueue) {
  550. return;
  551. }
  552. draining = false;
  553. if (currentQueue.length) {
  554. queue = currentQueue.concat(queue);
  555. } else {
  556. queueIndex = -1;
  557. }
  558. if (queue.length) {
  559. drainQueue();
  560. }
  561. }
  562. function drainQueue() {
  563. if (draining) {
  564. return;
  565. }
  566. var timeout = runTimeout(cleanUpNextTick);
  567. draining = true;
  568. var len = queue.length;
  569. while(len) {
  570. currentQueue = queue;
  571. queue = [];
  572. while (++queueIndex < len) {
  573. if (currentQueue) {
  574. currentQueue[queueIndex].run();
  575. }
  576. }
  577. queueIndex = -1;
  578. len = queue.length;
  579. }
  580. currentQueue = null;
  581. draining = false;
  582. runClearTimeout(timeout);
  583. }
  584. process.nextTick = function (fun) {
  585. var args = new Array(arguments.length - 1);
  586. if (arguments.length > 1) {
  587. for (var i = 1; i < arguments.length; i++) {
  588. args[i - 1] = arguments[i];
  589. }
  590. }
  591. queue.push(new Item(fun, args));
  592. if (queue.length === 1 && !draining) {
  593. runTimeout(drainQueue);
  594. }
  595. };
  596. // v8 likes predictible objects
  597. function Item(fun, array) {
  598. this.fun = fun;
  599. this.array = array;
  600. }
  601. Item.prototype.run = function () {
  602. this.fun.apply(null, this.array);
  603. };
  604. process.title = 'browser';
  605. process.browser = true;
  606. process.env = {};
  607. process.argv = [];
  608. process.version = ''; // empty string to avoid regexp issues
  609. process.versions = {};
  610. function noop() {}
  611. process.on = noop;
  612. process.addListener = noop;
  613. process.once = noop;
  614. process.off = noop;
  615. process.removeListener = noop;
  616. process.removeAllListeners = noop;
  617. process.emit = noop;
  618. process.prependListener = noop;
  619. process.prependOnceListener = noop;
  620. process.listeners = function (name) { return [] }
  621. process.binding = function (name) {
  622. throw new Error('process.binding is not supported');
  623. };
  624. process.cwd = function () { return '/' };
  625. process.chdir = function (dir) {
  626. throw new Error('process.chdir is not supported');
  627. };
  628. process.umask = function() { return 0; };
  629. /***/ }),
  630. /* 5 */
  631. /***/ (function(module, exports, __webpack_require__) {
  632. "use strict";
  633. var utils = __webpack_require__(0);
  634. var settle = __webpack_require__(21);
  635. var buildURL = __webpack_require__(23);
  636. var parseHeaders = __webpack_require__(24);
  637. var isURLSameOrigin = __webpack_require__(25);
  638. var createError = __webpack_require__(6);
  639. var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(26);
  640. module.exports = function xhrAdapter(config) {
  641. return new Promise(function dispatchXhrRequest(resolve, reject) {
  642. var requestData = config.data;
  643. var requestHeaders = config.headers;
  644. if (utils.isFormData(requestData)) {
  645. delete requestHeaders['Content-Type']; // Let the browser set it
  646. }
  647. var request = new XMLHttpRequest();
  648. var loadEvent = 'onreadystatechange';
  649. var xDomain = false;
  650. // For IE 8/9 CORS support
  651. // Only supports POST and GET calls and doesn't returns the response headers.
  652. // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
  653. if ("development" !== 'test' &&
  654. typeof window !== 'undefined' &&
  655. window.XDomainRequest && !('withCredentials' in request) &&
  656. !isURLSameOrigin(config.url)) {
  657. request = new window.XDomainRequest();
  658. loadEvent = 'onload';
  659. xDomain = true;
  660. request.onprogress = function handleProgress() {};
  661. request.ontimeout = function handleTimeout() {};
  662. }
  663. // HTTP basic authentication
  664. if (config.auth) {
  665. var username = config.auth.username || '';
  666. var password = config.auth.password || '';
  667. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  668. }
  669. request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
  670. // Set the request timeout in MS
  671. request.timeout = config.timeout;
  672. // Listen for ready state
  673. request[loadEvent] = function handleLoad() {
  674. if (!request || (request.readyState !== 4 && !xDomain)) {
  675. return;
  676. }
  677. // The request errored out and we didn't get a response, this will be
  678. // handled by onerror instead
  679. // With one exception: request that using file: protocol, most browsers
  680. // will return status as 0 even though it's a successful request
  681. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  682. return;
  683. }
  684. // Prepare the response
  685. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  686. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  687. var response = {
  688. data: responseData,
  689. // IE sends 1223 instead of 204 (https://github.com/axios/axios/issues/201)
  690. status: request.status === 1223 ? 204 : request.status,
  691. statusText: request.status === 1223 ? 'No Content' : request.statusText,
  692. headers: responseHeaders,
  693. config: config,
  694. request: request
  695. };
  696. settle(resolve, reject, response);
  697. // Clean up request
  698. request = null;
  699. };
  700. // Handle low level network errors
  701. request.onerror = function handleError() {
  702. // Real errors are hidden from us by the browser
  703. // onerror should only fire if it's a network error
  704. reject(createError('Network Error', config, null, request));
  705. // Clean up request
  706. request = null;
  707. };
  708. // Handle timeout
  709. request.ontimeout = function handleTimeout() {
  710. reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
  711. request));
  712. // Clean up request
  713. request = null;
  714. };
  715. // Add xsrf header
  716. // This is only done if running in a standard browser environment.
  717. // Specifically not if we're in a web worker, or react-native.
  718. if (utils.isStandardBrowserEnv()) {
  719. var cookies = __webpack_require__(27);
  720. // Add xsrf header
  721. var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
  722. cookies.read(config.xsrfCookieName) :
  723. undefined;
  724. if (xsrfValue) {
  725. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  726. }
  727. }
  728. // Add headers to the request
  729. if ('setRequestHeader' in request) {
  730. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  731. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  732. // Remove Content-Type if data is undefined
  733. delete requestHeaders[key];
  734. } else {
  735. // Otherwise add header to the request
  736. request.setRequestHeader(key, val);
  737. }
  738. });
  739. }
  740. // Add withCredentials to request if needed
  741. if (config.withCredentials) {
  742. request.withCredentials = true;
  743. }
  744. // Add responseType to request if needed
  745. if (config.responseType) {
  746. try {
  747. request.responseType = config.responseType;
  748. } catch (e) {
  749. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  750. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  751. if (config.responseType !== 'json') {
  752. throw e;
  753. }
  754. }
  755. }
  756. // Handle progress if needed
  757. if (typeof config.onDownloadProgress === 'function') {
  758. request.addEventListener('progress', config.onDownloadProgress);
  759. }
  760. // Not all browsers support upload events
  761. if (typeof config.onUploadProgress === 'function' && request.upload) {
  762. request.upload.addEventListener('progress', config.onUploadProgress);
  763. }
  764. if (config.cancelToken) {
  765. // Handle cancellation
  766. config.cancelToken.promise.then(function onCanceled(cancel) {
  767. if (!request) {
  768. return;
  769. }
  770. request.abort();
  771. reject(cancel);
  772. // Clean up request
  773. request = null;
  774. });
  775. }
  776. if (requestData === undefined) {
  777. requestData = null;
  778. }
  779. // Send the request
  780. request.send(requestData);
  781. });
  782. };
  783. /***/ }),
  784. /* 6 */
  785. /***/ (function(module, exports, __webpack_require__) {
  786. "use strict";
  787. var enhanceError = __webpack_require__(22);
  788. /**
  789. * Create an Error with the specified message, config, error code, request and response.
  790. *
  791. * @param {string} message The error message.
  792. * @param {Object} config The config.
  793. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  794. * @param {Object} [request] The request.
  795. * @param {Object} [response] The response.
  796. * @returns {Error} The created error.
  797. */
  798. module.exports = function createError(message, config, code, request, response) {
  799. var error = new Error(message);
  800. return enhanceError(error, config, code, request, response);
  801. };
  802. /***/ }),
  803. /* 7 */
  804. /***/ (function(module, exports, __webpack_require__) {
  805. "use strict";
  806. module.exports = function isCancel(value) {
  807. return !!(value && value.__CANCEL__);
  808. };
  809. /***/ }),
  810. /* 8 */
  811. /***/ (function(module, exports, __webpack_require__) {
  812. "use strict";
  813. /**
  814. * A `Cancel` is an object that is thrown when an operation is canceled.
  815. *
  816. * @class
  817. * @param {string=} message The message.
  818. */
  819. function Cancel(message) {
  820. this.message = message;
  821. }
  822. Cancel.prototype.toString = function toString() {
  823. return 'Cancel' + (this.message ? ': ' + this.message : '');
  824. };
  825. Cancel.prototype.__CANCEL__ = true;
  826. module.exports = Cancel;
  827. /***/ }),
  828. /* 9 */
  829. /***/ (function(module, exports, __webpack_require__) {
  830. __webpack_require__(10);
  831. module.exports = __webpack_require__(43);
  832. /***/ }),
  833. /* 10 */
  834. /***/ (function(module, exports, __webpack_require__) {
  835. /**
  836. * First we will load all of this project's JavaScript dependencies which
  837. * includes Vue and other libraries. It is a great starting point when
  838. * building robust, powerful web applications using Vue and Laravel.
  839. */
  840. __webpack_require__(11);
  841. window.Vue = __webpack_require__(35);
  842. /**
  843. * Next, we will create a fresh Vue application instance and attach it to
  844. * the page. Then, you may begin adding components to this application
  845. * or customize the JavaScript scaffolding to fit your unique needs.
  846. */
  847. Vue.component('example-component', __webpack_require__(39));
  848. var app = new Vue({
  849. el: '#app'
  850. });
  851. /***/ }),
  852. /* 11 */
  853. /***/ (function(module, exports, __webpack_require__) {
  854. window._ = __webpack_require__(12);
  855. /**
  856. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  857. * for JavaScript based Bootstrap features such as modals and tabs. This
  858. * code may be modified to fit the specific needs of your application.
  859. */
  860. try {
  861. window.$ = window.jQuery = __webpack_require__(14);
  862. __webpack_require__(15);
  863. } catch (e) {}
  864. /**
  865. * We'll load the axios HTTP library which allows us to easily issue requests
  866. * to our Laravel back-end. This library automatically handles sending the
  867. * CSRF token as a header based on the value of the "XSRF" token cookie.
  868. */
  869. window.axios = __webpack_require__(16);
  870. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  871. /**
  872. * Next we will register the CSRF Token as a common header with Axios so that
  873. * all outgoing HTTP requests automatically have it attached. This is just
  874. * a simple convenience so we don't have to attach every token manually.
  875. */
  876. var token = document.head.querySelector('meta[name="csrf-token"]');
  877. if (token) {
  878. window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
  879. } else {
  880. console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
  881. }
  882. /**
  883. * Echo exposes an expressive API for subscribing to channels and listening
  884. * for events that are broadcast by Laravel. Echo and event broadcasting
  885. * allows your team to easily build robust real-time web applications.
  886. */
  887. // import Echo from 'laravel-echo'
  888. // window.Pusher = require('pusher-js');
  889. // window.Echo = new Echo({
  890. // broadcaster: 'pusher',
  891. // key: 'your-pusher-key',
  892. // cluster: 'mt1',
  893. // encrypted: true
  894. // });
  895. /***/ }),
  896. /* 12 */
  897. /***/ (function(module, exports, __webpack_require__) {
  898. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  899. * @license
  900. * Lodash <https://lodash.com/>
  901. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  902. * Released under MIT license <https://lodash.com/license>
  903. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  904. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  905. */
  906. ;(function() {
  907. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  908. var undefined;
  909. /** Used as the semantic version number. */
  910. var VERSION = '4.17.21';
  911. /** Used as the size to enable large array optimizations. */
  912. var LARGE_ARRAY_SIZE = 200;
  913. /** Error message constants. */
  914. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  915. FUNC_ERROR_TEXT = 'Expected a function',
  916. INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
  917. /** Used to stand-in for `undefined` hash values. */
  918. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  919. /** Used as the maximum memoize cache size. */
  920. var MAX_MEMOIZE_SIZE = 500;
  921. /** Used as the internal argument placeholder. */
  922. var PLACEHOLDER = '__lodash_placeholder__';
  923. /** Used to compose bitmasks for cloning. */
  924. var CLONE_DEEP_FLAG = 1,
  925. CLONE_FLAT_FLAG = 2,
  926. CLONE_SYMBOLS_FLAG = 4;
  927. /** Used to compose bitmasks for value comparisons. */
  928. var COMPARE_PARTIAL_FLAG = 1,
  929. COMPARE_UNORDERED_FLAG = 2;
  930. /** Used to compose bitmasks for function metadata. */
  931. var WRAP_BIND_FLAG = 1,
  932. WRAP_BIND_KEY_FLAG = 2,
  933. WRAP_CURRY_BOUND_FLAG = 4,
  934. WRAP_CURRY_FLAG = 8,
  935. WRAP_CURRY_RIGHT_FLAG = 16,
  936. WRAP_PARTIAL_FLAG = 32,
  937. WRAP_PARTIAL_RIGHT_FLAG = 64,
  938. WRAP_ARY_FLAG = 128,
  939. WRAP_REARG_FLAG = 256,
  940. WRAP_FLIP_FLAG = 512;
  941. /** Used as default options for `_.truncate`. */
  942. var DEFAULT_TRUNC_LENGTH = 30,
  943. DEFAULT_TRUNC_OMISSION = '...';
  944. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  945. var HOT_COUNT = 800,
  946. HOT_SPAN = 16;
  947. /** Used to indicate the type of lazy iteratees. */
  948. var LAZY_FILTER_FLAG = 1,
  949. LAZY_MAP_FLAG = 2,
  950. LAZY_WHILE_FLAG = 3;
  951. /** Used as references for various `Number` constants. */
  952. var INFINITY = 1 / 0,
  953. MAX_SAFE_INTEGER = 9007199254740991,
  954. MAX_INTEGER = 1.7976931348623157e+308,
  955. NAN = 0 / 0;
  956. /** Used as references for the maximum length and index of an array. */
  957. var MAX_ARRAY_LENGTH = 4294967295,
  958. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  959. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  960. /** Used to associate wrap methods with their bit flags. */
  961. var wrapFlags = [
  962. ['ary', WRAP_ARY_FLAG],
  963. ['bind', WRAP_BIND_FLAG],
  964. ['bindKey', WRAP_BIND_KEY_FLAG],
  965. ['curry', WRAP_CURRY_FLAG],
  966. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  967. ['flip', WRAP_FLIP_FLAG],
  968. ['partial', WRAP_PARTIAL_FLAG],
  969. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  970. ['rearg', WRAP_REARG_FLAG]
  971. ];
  972. /** `Object#toString` result references. */
  973. var argsTag = '[object Arguments]',
  974. arrayTag = '[object Array]',
  975. asyncTag = '[object AsyncFunction]',
  976. boolTag = '[object Boolean]',
  977. dateTag = '[object Date]',
  978. domExcTag = '[object DOMException]',
  979. errorTag = '[object Error]',
  980. funcTag = '[object Function]',
  981. genTag = '[object GeneratorFunction]',
  982. mapTag = '[object Map]',
  983. numberTag = '[object Number]',
  984. nullTag = '[object Null]',
  985. objectTag = '[object Object]',
  986. promiseTag = '[object Promise]',
  987. proxyTag = '[object Proxy]',
  988. regexpTag = '[object RegExp]',
  989. setTag = '[object Set]',
  990. stringTag = '[object String]',
  991. symbolTag = '[object Symbol]',
  992. undefinedTag = '[object Undefined]',
  993. weakMapTag = '[object WeakMap]',
  994. weakSetTag = '[object WeakSet]';
  995. var arrayBufferTag = '[object ArrayBuffer]',
  996. dataViewTag = '[object DataView]',
  997. float32Tag = '[object Float32Array]',
  998. float64Tag = '[object Float64Array]',
  999. int8Tag = '[object Int8Array]',
  1000. int16Tag = '[object Int16Array]',
  1001. int32Tag = '[object Int32Array]',
  1002. uint8Tag = '[object Uint8Array]',
  1003. uint8ClampedTag = '[object Uint8ClampedArray]',
  1004. uint16Tag = '[object Uint16Array]',
  1005. uint32Tag = '[object Uint32Array]';
  1006. /** Used to match empty string literals in compiled template source. */
  1007. var reEmptyStringLeading = /\b__p \+= '';/g,
  1008. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  1009. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  1010. /** Used to match HTML entities and HTML characters. */
  1011. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  1012. reUnescapedHtml = /[&<>"']/g,
  1013. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  1014. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  1015. /** Used to match template delimiters. */
  1016. var reEscape = /<%-([\s\S]+?)%>/g,
  1017. reEvaluate = /<%([\s\S]+?)%>/g,
  1018. reInterpolate = /<%=([\s\S]+?)%>/g;
  1019. /** Used to match property names within property paths. */
  1020. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  1021. reIsPlainProp = /^\w*$/,
  1022. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1023. /**
  1024. * Used to match `RegExp`
  1025. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  1026. */
  1027. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  1028. reHasRegExpChar = RegExp(reRegExpChar.source);
  1029. /** Used to match leading whitespace. */
  1030. var reTrimStart = /^\s+/;
  1031. /** Used to match a single whitespace character. */
  1032. var reWhitespace = /\s/;
  1033. /** Used to match wrap detail comments. */
  1034. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  1035. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  1036. reSplitDetails = /,? & /;
  1037. /** Used to match words composed of alphanumeric characters. */
  1038. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  1039. /**
  1040. * Used to validate the `validate` option in `_.template` variable.
  1041. *
  1042. * Forbids characters which could potentially change the meaning of the function argument definition:
  1043. * - "()," (modification of function parameters)
  1044. * - "=" (default value)
  1045. * - "[]{}" (destructuring of function parameters)
  1046. * - "/" (beginning of a comment)
  1047. * - whitespace
  1048. */
  1049. var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
  1050. /** Used to match backslashes in property paths. */
  1051. var reEscapeChar = /\\(\\)?/g;
  1052. /**
  1053. * Used to match
  1054. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  1055. */
  1056. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  1057. /** Used to match `RegExp` flags from their coerced string values. */
  1058. var reFlags = /\w*$/;
  1059. /** Used to detect bad signed hexadecimal string values. */
  1060. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  1061. /** Used to detect binary string values. */
  1062. var reIsBinary = /^0b[01]+$/i;
  1063. /** Used to detect host constructors (Safari). */
  1064. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1065. /** Used to detect octal string values. */
  1066. var reIsOctal = /^0o[0-7]+$/i;
  1067. /** Used to detect unsigned integer values. */
  1068. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1069. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  1070. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  1071. /** Used to ensure capturing order of template delimiters. */
  1072. var reNoMatch = /($^)/;
  1073. /** Used to match unescaped characters in compiled string literals. */
  1074. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  1075. /** Used to compose unicode character classes. */
  1076. var rsAstralRange = '\\ud800-\\udfff',
  1077. rsComboMarksRange = '\\u0300-\\u036f',
  1078. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  1079. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  1080. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  1081. rsDingbatRange = '\\u2700-\\u27bf',
  1082. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  1083. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  1084. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  1085. rsPunctuationRange = '\\u2000-\\u206f',
  1086. 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',
  1087. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  1088. rsVarRange = '\\ufe0e\\ufe0f',
  1089. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  1090. /** Used to compose unicode capture groups. */
  1091. var rsApos = "['\u2019]",
  1092. rsAstral = '[' + rsAstralRange + ']',
  1093. rsBreak = '[' + rsBreakRange + ']',
  1094. rsCombo = '[' + rsComboRange + ']',
  1095. rsDigits = '\\d+',
  1096. rsDingbat = '[' + rsDingbatRange + ']',
  1097. rsLower = '[' + rsLowerRange + ']',
  1098. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  1099. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  1100. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  1101. rsNonAstral = '[^' + rsAstralRange + ']',
  1102. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  1103. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  1104. rsUpper = '[' + rsUpperRange + ']',
  1105. rsZWJ = '\\u200d';
  1106. /** Used to compose unicode regexes. */
  1107. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  1108. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  1109. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  1110. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  1111. reOptMod = rsModifier + '?',
  1112. rsOptVar = '[' + rsVarRange + ']?',
  1113. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  1114. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  1115. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  1116. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  1117. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  1118. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  1119. /** Used to match apostrophes. */
  1120. var reApos = RegExp(rsApos, 'g');
  1121. /**
  1122. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  1123. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  1124. */
  1125. var reComboMark = RegExp(rsCombo, 'g');
  1126. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  1127. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  1128. /** Used to match complex or compound words. */
  1129. var reUnicodeWord = RegExp([
  1130. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  1131. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  1132. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  1133. rsUpper + '+' + rsOptContrUpper,
  1134. rsOrdUpper,
  1135. rsOrdLower,
  1136. rsDigits,
  1137. rsEmoji
  1138. ].join('|'), 'g');
  1139. /** 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/). */
  1140. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  1141. /** Used to detect strings that need a more robust regexp to match words. */
  1142. 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 ]/;
  1143. /** Used to assign default `context` object properties. */
  1144. var contextProps = [
  1145. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  1146. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  1147. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  1148. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  1149. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  1150. ];
  1151. /** Used to make template sourceURLs easier to identify. */
  1152. var templateCounter = -1;
  1153. /** Used to identify `toStringTag` values of typed arrays. */
  1154. var typedArrayTags = {};
  1155. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  1156. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  1157. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  1158. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  1159. typedArrayTags[uint32Tag] = true;
  1160. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  1161. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  1162. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  1163. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  1164. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  1165. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  1166. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  1167. typedArrayTags[weakMapTag] = false;
  1168. /** Used to identify `toStringTag` values supported by `_.clone`. */
  1169. var cloneableTags = {};
  1170. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  1171. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  1172. cloneableTags[boolTag] = cloneableTags[dateTag] =
  1173. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  1174. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  1175. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  1176. cloneableTags[numberTag] = cloneableTags[objectTag] =
  1177. cloneableTags[regexpTag] = cloneableTags[setTag] =
  1178. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  1179. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  1180. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  1181. cloneableTags[errorTag] = cloneableTags[funcTag] =
  1182. cloneableTags[weakMapTag] = false;
  1183. /** Used to map Latin Unicode letters to basic Latin letters. */
  1184. var deburredLetters = {
  1185. // Latin-1 Supplement block.
  1186. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  1187. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  1188. '\xc7': 'C', '\xe7': 'c',
  1189. '\xd0': 'D', '\xf0': 'd',
  1190. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  1191. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  1192. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  1193. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  1194. '\xd1': 'N', '\xf1': 'n',
  1195. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  1196. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  1197. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  1198. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  1199. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  1200. '\xc6': 'Ae', '\xe6': 'ae',
  1201. '\xde': 'Th', '\xfe': 'th',
  1202. '\xdf': 'ss',
  1203. // Latin Extended-A block.
  1204. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  1205. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  1206. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  1207. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  1208. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  1209. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  1210. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  1211. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  1212. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  1213. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  1214. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  1215. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  1216. '\u0134': 'J', '\u0135': 'j',
  1217. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  1218. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  1219. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  1220. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  1221. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  1222. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  1223. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  1224. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  1225. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  1226. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  1227. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  1228. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  1229. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  1230. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  1231. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  1232. '\u0174': 'W', '\u0175': 'w',
  1233. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  1234. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  1235. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  1236. '\u0132': 'IJ', '\u0133': 'ij',
  1237. '\u0152': 'Oe', '\u0153': 'oe',
  1238. '\u0149': "'n", '\u017f': 's'
  1239. };
  1240. /** Used to map characters to HTML entities. */
  1241. var htmlEscapes = {
  1242. '&': '&amp;',
  1243. '<': '&lt;',
  1244. '>': '&gt;',
  1245. '"': '&quot;',
  1246. "'": '&#39;'
  1247. };
  1248. /** Used to map HTML entities to characters. */
  1249. var htmlUnescapes = {
  1250. '&amp;': '&',
  1251. '&lt;': '<',
  1252. '&gt;': '>',
  1253. '&quot;': '"',
  1254. '&#39;': "'"
  1255. };
  1256. /** Used to escape characters for inclusion in compiled string literals. */
  1257. var stringEscapes = {
  1258. '\\': '\\',
  1259. "'": "'",
  1260. '\n': 'n',
  1261. '\r': 'r',
  1262. '\u2028': 'u2028',
  1263. '\u2029': 'u2029'
  1264. };
  1265. /** Built-in method references without a dependency on `root`. */
  1266. var freeParseFloat = parseFloat,
  1267. freeParseInt = parseInt;
  1268. /** Detect free variable `global` from Node.js. */
  1269. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  1270. /** Detect free variable `self`. */
  1271. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  1272. /** Used as a reference to the global object. */
  1273. var root = freeGlobal || freeSelf || Function('return this')();
  1274. /** Detect free variable `exports`. */
  1275. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  1276. /** Detect free variable `module`. */
  1277. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  1278. /** Detect the popular CommonJS extension `module.exports`. */
  1279. var moduleExports = freeModule && freeModule.exports === freeExports;
  1280. /** Detect free variable `process` from Node.js. */
  1281. var freeProcess = moduleExports && freeGlobal.process;
  1282. /** Used to access faster Node.js helpers. */
  1283. var nodeUtil = (function() {
  1284. try {
  1285. // Use `util.types` for Node.js 10+.
  1286. var types = freeModule && freeModule.require && freeModule.require('util').types;
  1287. if (types) {
  1288. return types;
  1289. }
  1290. // Legacy `process.binding('util')` for Node.js < 10.
  1291. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  1292. } catch (e) {}
  1293. }());
  1294. /* Node.js helper references. */
  1295. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  1296. nodeIsDate = nodeUtil && nodeUtil.isDate,
  1297. nodeIsMap = nodeUtil && nodeUtil.isMap,
  1298. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  1299. nodeIsSet = nodeUtil && nodeUtil.isSet,
  1300. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  1301. /*--------------------------------------------------------------------------*/
  1302. /**
  1303. * A faster alternative to `Function#apply`, this function invokes `func`
  1304. * with the `this` binding of `thisArg` and the arguments of `args`.
  1305. *
  1306. * @private
  1307. * @param {Function} func The function to invoke.
  1308. * @param {*} thisArg The `this` binding of `func`.
  1309. * @param {Array} args The arguments to invoke `func` with.
  1310. * @returns {*} Returns the result of `func`.
  1311. */
  1312. function apply(func, thisArg, args) {
  1313. switch (args.length) {
  1314. case 0: return func.call(thisArg);
  1315. case 1: return func.call(thisArg, args[0]);
  1316. case 2: return func.call(thisArg, args[0], args[1]);
  1317. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  1318. }
  1319. return func.apply(thisArg, args);
  1320. }
  1321. /**
  1322. * A specialized version of `baseAggregator` for arrays.
  1323. *
  1324. * @private
  1325. * @param {Array} [array] The array to iterate over.
  1326. * @param {Function} setter The function to set `accumulator` values.
  1327. * @param {Function} iteratee The iteratee to transform keys.
  1328. * @param {Object} accumulator The initial aggregated object.
  1329. * @returns {Function} Returns `accumulator`.
  1330. */
  1331. function arrayAggregator(array, setter, iteratee, accumulator) {
  1332. var index = -1,
  1333. length = array == null ? 0 : array.length;
  1334. while (++index < length) {
  1335. var value = array[index];
  1336. setter(accumulator, value, iteratee(value), array);
  1337. }
  1338. return accumulator;
  1339. }
  1340. /**
  1341. * A specialized version of `_.forEach` for arrays without support for
  1342. * iteratee shorthands.
  1343. *
  1344. * @private
  1345. * @param {Array} [array] The array to iterate over.
  1346. * @param {Function} iteratee The function invoked per iteration.
  1347. * @returns {Array} Returns `array`.
  1348. */
  1349. function arrayEach(array, iteratee) {
  1350. var index = -1,
  1351. length = array == null ? 0 : array.length;
  1352. while (++index < length) {
  1353. if (iteratee(array[index], index, array) === false) {
  1354. break;
  1355. }
  1356. }
  1357. return array;
  1358. }
  1359. /**
  1360. * A specialized version of `_.forEachRight` for arrays without support for
  1361. * iteratee shorthands.
  1362. *
  1363. * @private
  1364. * @param {Array} [array] The array to iterate over.
  1365. * @param {Function} iteratee The function invoked per iteration.
  1366. * @returns {Array} Returns `array`.
  1367. */
  1368. function arrayEachRight(array, iteratee) {
  1369. var length = array == null ? 0 : array.length;
  1370. while (length--) {
  1371. if (iteratee(array[length], length, array) === false) {
  1372. break;
  1373. }
  1374. }
  1375. return array;
  1376. }
  1377. /**
  1378. * A specialized version of `_.every` for arrays without support for
  1379. * iteratee shorthands.
  1380. *
  1381. * @private
  1382. * @param {Array} [array] The array to iterate over.
  1383. * @param {Function} predicate The function invoked per iteration.
  1384. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  1385. * else `false`.
  1386. */
  1387. function arrayEvery(array, predicate) {
  1388. var index = -1,
  1389. length = array == null ? 0 : array.length;
  1390. while (++index < length) {
  1391. if (!predicate(array[index], index, array)) {
  1392. return false;
  1393. }
  1394. }
  1395. return true;
  1396. }
  1397. /**
  1398. * A specialized version of `_.filter` for arrays without support for
  1399. * iteratee shorthands.
  1400. *
  1401. * @private
  1402. * @param {Array} [array] The array to iterate over.
  1403. * @param {Function} predicate The function invoked per iteration.
  1404. * @returns {Array} Returns the new filtered array.
  1405. */
  1406. function arrayFilter(array, predicate) {
  1407. var index = -1,
  1408. length = array == null ? 0 : array.length,
  1409. resIndex = 0,
  1410. result = [];
  1411. while (++index < length) {
  1412. var value = array[index];
  1413. if (predicate(value, index, array)) {
  1414. result[resIndex++] = value;
  1415. }
  1416. }
  1417. return result;
  1418. }
  1419. /**
  1420. * A specialized version of `_.includes` for arrays without support for
  1421. * specifying an index to search from.
  1422. *
  1423. * @private
  1424. * @param {Array} [array] The array to inspect.
  1425. * @param {*} target The value to search for.
  1426. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1427. */
  1428. function arrayIncludes(array, value) {
  1429. var length = array == null ? 0 : array.length;
  1430. return !!length && baseIndexOf(array, value, 0) > -1;
  1431. }
  1432. /**
  1433. * This function is like `arrayIncludes` except that it accepts a comparator.
  1434. *
  1435. * @private
  1436. * @param {Array} [array] The array to inspect.
  1437. * @param {*} target The value to search for.
  1438. * @param {Function} comparator The comparator invoked per element.
  1439. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1440. */
  1441. function arrayIncludesWith(array, value, comparator) {
  1442. var index = -1,
  1443. length = array == null ? 0 : array.length;
  1444. while (++index < length) {
  1445. if (comparator(value, array[index])) {
  1446. return true;
  1447. }
  1448. }
  1449. return false;
  1450. }
  1451. /**
  1452. * A specialized version of `_.map` for arrays without support for iteratee
  1453. * shorthands.
  1454. *
  1455. * @private
  1456. * @param {Array} [array] The array to iterate over.
  1457. * @param {Function} iteratee The function invoked per iteration.
  1458. * @returns {Array} Returns the new mapped array.
  1459. */
  1460. function arrayMap(array, iteratee) {
  1461. var index = -1,
  1462. length = array == null ? 0 : array.length,
  1463. result = Array(length);
  1464. while (++index < length) {
  1465. result[index] = iteratee(array[index], index, array);
  1466. }
  1467. return result;
  1468. }
  1469. /**
  1470. * Appends the elements of `values` to `array`.
  1471. *
  1472. * @private
  1473. * @param {Array} array The array to modify.
  1474. * @param {Array} values The values to append.
  1475. * @returns {Array} Returns `array`.
  1476. */
  1477. function arrayPush(array, values) {
  1478. var index = -1,
  1479. length = values.length,
  1480. offset = array.length;
  1481. while (++index < length) {
  1482. array[offset + index] = values[index];
  1483. }
  1484. return array;
  1485. }
  1486. /**
  1487. * A specialized version of `_.reduce` for arrays without support for
  1488. * iteratee shorthands.
  1489. *
  1490. * @private
  1491. * @param {Array} [array] The array to iterate over.
  1492. * @param {Function} iteratee The function invoked per iteration.
  1493. * @param {*} [accumulator] The initial value.
  1494. * @param {boolean} [initAccum] Specify using the first element of `array` as
  1495. * the initial value.
  1496. * @returns {*} Returns the accumulated value.
  1497. */
  1498. function arrayReduce(array, iteratee, accumulator, initAccum) {
  1499. var index = -1,
  1500. length = array == null ? 0 : array.length;
  1501. if (initAccum && length) {
  1502. accumulator = array[++index];
  1503. }
  1504. while (++index < length) {
  1505. accumulator = iteratee(accumulator, array[index], index, array);
  1506. }
  1507. return accumulator;
  1508. }
  1509. /**
  1510. * A specialized version of `_.reduceRight` for arrays without support for
  1511. * iteratee shorthands.
  1512. *
  1513. * @private
  1514. * @param {Array} [array] The array to iterate over.
  1515. * @param {Function} iteratee The function invoked per iteration.
  1516. * @param {*} [accumulator] The initial value.
  1517. * @param {boolean} [initAccum] Specify using the last element of `array` as
  1518. * the initial value.
  1519. * @returns {*} Returns the accumulated value.
  1520. */
  1521. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  1522. var length = array == null ? 0 : array.length;
  1523. if (initAccum && length) {
  1524. accumulator = array[--length];
  1525. }
  1526. while (length--) {
  1527. accumulator = iteratee(accumulator, array[length], length, array);
  1528. }
  1529. return accumulator;
  1530. }
  1531. /**
  1532. * A specialized version of `_.some` for arrays without support for iteratee
  1533. * shorthands.
  1534. *
  1535. * @private
  1536. * @param {Array} [array] The array to iterate over.
  1537. * @param {Function} predicate The function invoked per iteration.
  1538. * @returns {boolean} Returns `true` if any element passes the predicate check,
  1539. * else `false`.
  1540. */
  1541. function arraySome(array, predicate) {
  1542. var index = -1,
  1543. length = array == null ? 0 : array.length;
  1544. while (++index < length) {
  1545. if (predicate(array[index], index, array)) {
  1546. return true;
  1547. }
  1548. }
  1549. return false;
  1550. }
  1551. /**
  1552. * Gets the size of an ASCII `string`.
  1553. *
  1554. * @private
  1555. * @param {string} string The string inspect.
  1556. * @returns {number} Returns the string size.
  1557. */
  1558. var asciiSize = baseProperty('length');
  1559. /**
  1560. * Converts an ASCII `string` to an array.
  1561. *
  1562. * @private
  1563. * @param {string} string The string to convert.
  1564. * @returns {Array} Returns the converted array.
  1565. */
  1566. function asciiToArray(string) {
  1567. return string.split('');
  1568. }
  1569. /**
  1570. * Splits an ASCII `string` into an array of its words.
  1571. *
  1572. * @private
  1573. * @param {string} The string to inspect.
  1574. * @returns {Array} Returns the words of `string`.
  1575. */
  1576. function asciiWords(string) {
  1577. return string.match(reAsciiWord) || [];
  1578. }
  1579. /**
  1580. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  1581. * without support for iteratee shorthands, which iterates over `collection`
  1582. * using `eachFunc`.
  1583. *
  1584. * @private
  1585. * @param {Array|Object} collection The collection to inspect.
  1586. * @param {Function} predicate The function invoked per iteration.
  1587. * @param {Function} eachFunc The function to iterate over `collection`.
  1588. * @returns {*} Returns the found element or its key, else `undefined`.
  1589. */
  1590. function baseFindKey(collection, predicate, eachFunc) {
  1591. var result;
  1592. eachFunc(collection, function(value, key, collection) {
  1593. if (predicate(value, key, collection)) {
  1594. result = key;
  1595. return false;
  1596. }
  1597. });
  1598. return result;
  1599. }
  1600. /**
  1601. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  1602. * support for iteratee shorthands.
  1603. *
  1604. * @private
  1605. * @param {Array} array The array to inspect.
  1606. * @param {Function} predicate The function invoked per iteration.
  1607. * @param {number} fromIndex The index to search from.
  1608. * @param {boolean} [fromRight] Specify iterating from right to left.
  1609. * @returns {number} Returns the index of the matched value, else `-1`.
  1610. */
  1611. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  1612. var length = array.length,
  1613. index = fromIndex + (fromRight ? 1 : -1);
  1614. while ((fromRight ? index-- : ++index < length)) {
  1615. if (predicate(array[index], index, array)) {
  1616. return index;
  1617. }
  1618. }
  1619. return -1;
  1620. }
  1621. /**
  1622. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  1623. *
  1624. * @private
  1625. * @param {Array} array The array to inspect.
  1626. * @param {*} value The value to search for.
  1627. * @param {number} fromIndex The index to search from.
  1628. * @returns {number} Returns the index of the matched value, else `-1`.
  1629. */
  1630. function baseIndexOf(array, value, fromIndex) {
  1631. return value === value
  1632. ? strictIndexOf(array, value, fromIndex)
  1633. : baseFindIndex(array, baseIsNaN, fromIndex);
  1634. }
  1635. /**
  1636. * This function is like `baseIndexOf` except that it accepts a comparator.
  1637. *
  1638. * @private
  1639. * @param {Array} array The array to inspect.
  1640. * @param {*} value The value to search for.
  1641. * @param {number} fromIndex The index to search from.
  1642. * @param {Function} comparator The comparator invoked per element.
  1643. * @returns {number} Returns the index of the matched value, else `-1`.
  1644. */
  1645. function baseIndexOfWith(array, value, fromIndex, comparator) {
  1646. var index = fromIndex - 1,
  1647. length = array.length;
  1648. while (++index < length) {
  1649. if (comparator(array[index], value)) {
  1650. return index;
  1651. }
  1652. }
  1653. return -1;
  1654. }
  1655. /**
  1656. * The base implementation of `_.isNaN` without support for number objects.
  1657. *
  1658. * @private
  1659. * @param {*} value The value to check.
  1660. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  1661. */
  1662. function baseIsNaN(value) {
  1663. return value !== value;
  1664. }
  1665. /**
  1666. * The base implementation of `_.mean` and `_.meanBy` without support for
  1667. * iteratee shorthands.
  1668. *
  1669. * @private
  1670. * @param {Array} array The array to iterate over.
  1671. * @param {Function} iteratee The function invoked per iteration.
  1672. * @returns {number} Returns the mean.
  1673. */
  1674. function baseMean(array, iteratee) {
  1675. var length = array == null ? 0 : array.length;
  1676. return length ? (baseSum(array, iteratee) / length) : NAN;
  1677. }
  1678. /**
  1679. * The base implementation of `_.property` without support for deep paths.
  1680. *
  1681. * @private
  1682. * @param {string} key The key of the property to get.
  1683. * @returns {Function} Returns the new accessor function.
  1684. */
  1685. function baseProperty(key) {
  1686. return function(object) {
  1687. return object == null ? undefined : object[key];
  1688. };
  1689. }
  1690. /**
  1691. * The base implementation of `_.propertyOf` without support for deep paths.
  1692. *
  1693. * @private
  1694. * @param {Object} object The object to query.
  1695. * @returns {Function} Returns the new accessor function.
  1696. */
  1697. function basePropertyOf(object) {
  1698. return function(key) {
  1699. return object == null ? undefined : object[key];
  1700. };
  1701. }
  1702. /**
  1703. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  1704. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  1705. *
  1706. * @private
  1707. * @param {Array|Object} collection The collection to iterate over.
  1708. * @param {Function} iteratee The function invoked per iteration.
  1709. * @param {*} accumulator The initial value.
  1710. * @param {boolean} initAccum Specify using the first or last element of
  1711. * `collection` as the initial value.
  1712. * @param {Function} eachFunc The function to iterate over `collection`.
  1713. * @returns {*} Returns the accumulated value.
  1714. */
  1715. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  1716. eachFunc(collection, function(value, index, collection) {
  1717. accumulator = initAccum
  1718. ? (initAccum = false, value)
  1719. : iteratee(accumulator, value, index, collection);
  1720. });
  1721. return accumulator;
  1722. }
  1723. /**
  1724. * The base implementation of `_.sortBy` which uses `comparer` to define the
  1725. * sort order of `array` and replaces criteria objects with their corresponding
  1726. * values.
  1727. *
  1728. * @private
  1729. * @param {Array} array The array to sort.
  1730. * @param {Function} comparer The function to define sort order.
  1731. * @returns {Array} Returns `array`.
  1732. */
  1733. function baseSortBy(array, comparer) {
  1734. var length = array.length;
  1735. array.sort(comparer);
  1736. while (length--) {
  1737. array[length] = array[length].value;
  1738. }
  1739. return array;
  1740. }
  1741. /**
  1742. * The base implementation of `_.sum` and `_.sumBy` without support for
  1743. * iteratee shorthands.
  1744. *
  1745. * @private
  1746. * @param {Array} array The array to iterate over.
  1747. * @param {Function} iteratee The function invoked per iteration.
  1748. * @returns {number} Returns the sum.
  1749. */
  1750. function baseSum(array, iteratee) {
  1751. var result,
  1752. index = -1,
  1753. length = array.length;
  1754. while (++index < length) {
  1755. var current = iteratee(array[index]);
  1756. if (current !== undefined) {
  1757. result = result === undefined ? current : (result + current);
  1758. }
  1759. }
  1760. return result;
  1761. }
  1762. /**
  1763. * The base implementation of `_.times` without support for iteratee shorthands
  1764. * or max array length checks.
  1765. *
  1766. * @private
  1767. * @param {number} n The number of times to invoke `iteratee`.
  1768. * @param {Function} iteratee The function invoked per iteration.
  1769. * @returns {Array} Returns the array of results.
  1770. */
  1771. function baseTimes(n, iteratee) {
  1772. var index = -1,
  1773. result = Array(n);
  1774. while (++index < n) {
  1775. result[index] = iteratee(index);
  1776. }
  1777. return result;
  1778. }
  1779. /**
  1780. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  1781. * of key-value pairs for `object` corresponding to the property names of `props`.
  1782. *
  1783. * @private
  1784. * @param {Object} object The object to query.
  1785. * @param {Array} props The property names to get values for.
  1786. * @returns {Object} Returns the key-value pairs.
  1787. */
  1788. function baseToPairs(object, props) {
  1789. return arrayMap(props, function(key) {
  1790. return [key, object[key]];
  1791. });
  1792. }
  1793. /**
  1794. * The base implementation of `_.trim`.
  1795. *
  1796. * @private
  1797. * @param {string} string The string to trim.
  1798. * @returns {string} Returns the trimmed string.
  1799. */
  1800. function baseTrim(string) {
  1801. return string
  1802. ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
  1803. : string;
  1804. }
  1805. /**
  1806. * The base implementation of `_.unary` without support for storing metadata.
  1807. *
  1808. * @private
  1809. * @param {Function} func The function to cap arguments for.
  1810. * @returns {Function} Returns the new capped function.
  1811. */
  1812. function baseUnary(func) {
  1813. return function(value) {
  1814. return func(value);
  1815. };
  1816. }
  1817. /**
  1818. * The base implementation of `_.values` and `_.valuesIn` which creates an
  1819. * array of `object` property values corresponding to the property names
  1820. * of `props`.
  1821. *
  1822. * @private
  1823. * @param {Object} object The object to query.
  1824. * @param {Array} props The property names to get values for.
  1825. * @returns {Object} Returns the array of property values.
  1826. */
  1827. function baseValues(object, props) {
  1828. return arrayMap(props, function(key) {
  1829. return object[key];
  1830. });
  1831. }
  1832. /**
  1833. * Checks if a `cache` value for `key` exists.
  1834. *
  1835. * @private
  1836. * @param {Object} cache The cache to query.
  1837. * @param {string} key The key of the entry to check.
  1838. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1839. */
  1840. function cacheHas(cache, key) {
  1841. return cache.has(key);
  1842. }
  1843. /**
  1844. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  1845. * that is not found in the character symbols.
  1846. *
  1847. * @private
  1848. * @param {Array} strSymbols The string symbols to inspect.
  1849. * @param {Array} chrSymbols The character symbols to find.
  1850. * @returns {number} Returns the index of the first unmatched string symbol.
  1851. */
  1852. function charsStartIndex(strSymbols, chrSymbols) {
  1853. var index = -1,
  1854. length = strSymbols.length;
  1855. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  1856. return index;
  1857. }
  1858. /**
  1859. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  1860. * that is not found in the character symbols.
  1861. *
  1862. * @private
  1863. * @param {Array} strSymbols The string symbols to inspect.
  1864. * @param {Array} chrSymbols The character symbols to find.
  1865. * @returns {number} Returns the index of the last unmatched string symbol.
  1866. */
  1867. function charsEndIndex(strSymbols, chrSymbols) {
  1868. var index = strSymbols.length;
  1869. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  1870. return index;
  1871. }
  1872. /**
  1873. * Gets the number of `placeholder` occurrences in `array`.
  1874. *
  1875. * @private
  1876. * @param {Array} array The array to inspect.
  1877. * @param {*} placeholder The placeholder to search for.
  1878. * @returns {number} Returns the placeholder count.
  1879. */
  1880. function countHolders(array, placeholder) {
  1881. var length = array.length,
  1882. result = 0;
  1883. while (length--) {
  1884. if (array[length] === placeholder) {
  1885. ++result;
  1886. }
  1887. }
  1888. return result;
  1889. }
  1890. /**
  1891. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  1892. * letters to basic Latin letters.
  1893. *
  1894. * @private
  1895. * @param {string} letter The matched letter to deburr.
  1896. * @returns {string} Returns the deburred letter.
  1897. */
  1898. var deburrLetter = basePropertyOf(deburredLetters);
  1899. /**
  1900. * Used by `_.escape` to convert characters to HTML entities.
  1901. *
  1902. * @private
  1903. * @param {string} chr The matched character to escape.
  1904. * @returns {string} Returns the escaped character.
  1905. */
  1906. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  1907. /**
  1908. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  1909. *
  1910. * @private
  1911. * @param {string} chr The matched character to escape.
  1912. * @returns {string} Returns the escaped character.
  1913. */
  1914. function escapeStringChar(chr) {
  1915. return '\\' + stringEscapes[chr];
  1916. }
  1917. /**
  1918. * Gets the value at `key` of `object`.
  1919. *
  1920. * @private
  1921. * @param {Object} [object] The object to query.
  1922. * @param {string} key The key of the property to get.
  1923. * @returns {*} Returns the property value.
  1924. */
  1925. function getValue(object, key) {
  1926. return object == null ? undefined : object[key];
  1927. }
  1928. /**
  1929. * Checks if `string` contains Unicode symbols.
  1930. *
  1931. * @private
  1932. * @param {string} string The string to inspect.
  1933. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  1934. */
  1935. function hasUnicode(string) {
  1936. return reHasUnicode.test(string);
  1937. }
  1938. /**
  1939. * Checks if `string` contains a word composed of Unicode symbols.
  1940. *
  1941. * @private
  1942. * @param {string} string The string to inspect.
  1943. * @returns {boolean} Returns `true` if a word is found, else `false`.
  1944. */
  1945. function hasUnicodeWord(string) {
  1946. return reHasUnicodeWord.test(string);
  1947. }
  1948. /**
  1949. * Converts `iterator` to an array.
  1950. *
  1951. * @private
  1952. * @param {Object} iterator The iterator to convert.
  1953. * @returns {Array} Returns the converted array.
  1954. */
  1955. function iteratorToArray(iterator) {
  1956. var data,
  1957. result = [];
  1958. while (!(data = iterator.next()).done) {
  1959. result.push(data.value);
  1960. }
  1961. return result;
  1962. }
  1963. /**
  1964. * Converts `map` to its key-value pairs.
  1965. *
  1966. * @private
  1967. * @param {Object} map The map to convert.
  1968. * @returns {Array} Returns the key-value pairs.
  1969. */
  1970. function mapToArray(map) {
  1971. var index = -1,
  1972. result = Array(map.size);
  1973. map.forEach(function(value, key) {
  1974. result[++index] = [key, value];
  1975. });
  1976. return result;
  1977. }
  1978. /**
  1979. * Creates a unary function that invokes `func` with its argument transformed.
  1980. *
  1981. * @private
  1982. * @param {Function} func The function to wrap.
  1983. * @param {Function} transform The argument transform.
  1984. * @returns {Function} Returns the new function.
  1985. */
  1986. function overArg(func, transform) {
  1987. return function(arg) {
  1988. return func(transform(arg));
  1989. };
  1990. }
  1991. /**
  1992. * Replaces all `placeholder` elements in `array` with an internal placeholder
  1993. * and returns an array of their indexes.
  1994. *
  1995. * @private
  1996. * @param {Array} array The array to modify.
  1997. * @param {*} placeholder The placeholder to replace.
  1998. * @returns {Array} Returns the new array of placeholder indexes.
  1999. */
  2000. function replaceHolders(array, placeholder) {
  2001. var index = -1,
  2002. length = array.length,
  2003. resIndex = 0,
  2004. result = [];
  2005. while (++index < length) {
  2006. var value = array[index];
  2007. if (value === placeholder || value === PLACEHOLDER) {
  2008. array[index] = PLACEHOLDER;
  2009. result[resIndex++] = index;
  2010. }
  2011. }
  2012. return result;
  2013. }
  2014. /**
  2015. * Converts `set` to an array of its values.
  2016. *
  2017. * @private
  2018. * @param {Object} set The set to convert.
  2019. * @returns {Array} Returns the values.
  2020. */
  2021. function setToArray(set) {
  2022. var index = -1,
  2023. result = Array(set.size);
  2024. set.forEach(function(value) {
  2025. result[++index] = value;
  2026. });
  2027. return result;
  2028. }
  2029. /**
  2030. * Converts `set` to its value-value pairs.
  2031. *
  2032. * @private
  2033. * @param {Object} set The set to convert.
  2034. * @returns {Array} Returns the value-value pairs.
  2035. */
  2036. function setToPairs(set) {
  2037. var index = -1,
  2038. result = Array(set.size);
  2039. set.forEach(function(value) {
  2040. result[++index] = [value, value];
  2041. });
  2042. return result;
  2043. }
  2044. /**
  2045. * A specialized version of `_.indexOf` which performs strict equality
  2046. * comparisons of values, i.e. `===`.
  2047. *
  2048. * @private
  2049. * @param {Array} array The array to inspect.
  2050. * @param {*} value The value to search for.
  2051. * @param {number} fromIndex The index to search from.
  2052. * @returns {number} Returns the index of the matched value, else `-1`.
  2053. */
  2054. function strictIndexOf(array, value, fromIndex) {
  2055. var index = fromIndex - 1,
  2056. length = array.length;
  2057. while (++index < length) {
  2058. if (array[index] === value) {
  2059. return index;
  2060. }
  2061. }
  2062. return -1;
  2063. }
  2064. /**
  2065. * A specialized version of `_.lastIndexOf` which performs strict equality
  2066. * comparisons of values, i.e. `===`.
  2067. *
  2068. * @private
  2069. * @param {Array} array The array to inspect.
  2070. * @param {*} value The value to search for.
  2071. * @param {number} fromIndex The index to search from.
  2072. * @returns {number} Returns the index of the matched value, else `-1`.
  2073. */
  2074. function strictLastIndexOf(array, value, fromIndex) {
  2075. var index = fromIndex + 1;
  2076. while (index--) {
  2077. if (array[index] === value) {
  2078. return index;
  2079. }
  2080. }
  2081. return index;
  2082. }
  2083. /**
  2084. * Gets the number of symbols in `string`.
  2085. *
  2086. * @private
  2087. * @param {string} string The string to inspect.
  2088. * @returns {number} Returns the string size.
  2089. */
  2090. function stringSize(string) {
  2091. return hasUnicode(string)
  2092. ? unicodeSize(string)
  2093. : asciiSize(string);
  2094. }
  2095. /**
  2096. * Converts `string` to an array.
  2097. *
  2098. * @private
  2099. * @param {string} string The string to convert.
  2100. * @returns {Array} Returns the converted array.
  2101. */
  2102. function stringToArray(string) {
  2103. return hasUnicode(string)
  2104. ? unicodeToArray(string)
  2105. : asciiToArray(string);
  2106. }
  2107. /**
  2108. * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
  2109. * character of `string`.
  2110. *
  2111. * @private
  2112. * @param {string} string The string to inspect.
  2113. * @returns {number} Returns the index of the last non-whitespace character.
  2114. */
  2115. function trimmedEndIndex(string) {
  2116. var index = string.length;
  2117. while (index-- && reWhitespace.test(string.charAt(index))) {}
  2118. return index;
  2119. }
  2120. /**
  2121. * Used by `_.unescape` to convert HTML entities to characters.
  2122. *
  2123. * @private
  2124. * @param {string} chr The matched character to unescape.
  2125. * @returns {string} Returns the unescaped character.
  2126. */
  2127. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  2128. /**
  2129. * Gets the size of a Unicode `string`.
  2130. *
  2131. * @private
  2132. * @param {string} string The string inspect.
  2133. * @returns {number} Returns the string size.
  2134. */
  2135. function unicodeSize(string) {
  2136. var result = reUnicode.lastIndex = 0;
  2137. while (reUnicode.test(string)) {
  2138. ++result;
  2139. }
  2140. return result;
  2141. }
  2142. /**
  2143. * Converts a Unicode `string` to an array.
  2144. *
  2145. * @private
  2146. * @param {string} string The string to convert.
  2147. * @returns {Array} Returns the converted array.
  2148. */
  2149. function unicodeToArray(string) {
  2150. return string.match(reUnicode) || [];
  2151. }
  2152. /**
  2153. * Splits a Unicode `string` into an array of its words.
  2154. *
  2155. * @private
  2156. * @param {string} The string to inspect.
  2157. * @returns {Array} Returns the words of `string`.
  2158. */
  2159. function unicodeWords(string) {
  2160. return string.match(reUnicodeWord) || [];
  2161. }
  2162. /*--------------------------------------------------------------------------*/
  2163. /**
  2164. * Create a new pristine `lodash` function using the `context` object.
  2165. *
  2166. * @static
  2167. * @memberOf _
  2168. * @since 1.1.0
  2169. * @category Util
  2170. * @param {Object} [context=root] The context object.
  2171. * @returns {Function} Returns a new `lodash` function.
  2172. * @example
  2173. *
  2174. * _.mixin({ 'foo': _.constant('foo') });
  2175. *
  2176. * var lodash = _.runInContext();
  2177. * lodash.mixin({ 'bar': lodash.constant('bar') });
  2178. *
  2179. * _.isFunction(_.foo);
  2180. * // => true
  2181. * _.isFunction(_.bar);
  2182. * // => false
  2183. *
  2184. * lodash.isFunction(lodash.foo);
  2185. * // => false
  2186. * lodash.isFunction(lodash.bar);
  2187. * // => true
  2188. *
  2189. * // Create a suped-up `defer` in Node.js.
  2190. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  2191. */
  2192. var runInContext = (function runInContext(context) {
  2193. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  2194. /** Built-in constructor references. */
  2195. var Array = context.Array,
  2196. Date = context.Date,
  2197. Error = context.Error,
  2198. Function = context.Function,
  2199. Math = context.Math,
  2200. Object = context.Object,
  2201. RegExp = context.RegExp,
  2202. String = context.String,
  2203. TypeError = context.TypeError;
  2204. /** Used for built-in method references. */
  2205. var arrayProto = Array.prototype,
  2206. funcProto = Function.prototype,
  2207. objectProto = Object.prototype;
  2208. /** Used to detect overreaching core-js shims. */
  2209. var coreJsData = context['__core-js_shared__'];
  2210. /** Used to resolve the decompiled source of functions. */
  2211. var funcToString = funcProto.toString;
  2212. /** Used to check objects for own properties. */
  2213. var hasOwnProperty = objectProto.hasOwnProperty;
  2214. /** Used to generate unique IDs. */
  2215. var idCounter = 0;
  2216. /** Used to detect methods masquerading as native. */
  2217. var maskSrcKey = (function() {
  2218. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  2219. return uid ? ('Symbol(src)_1.' + uid) : '';
  2220. }());
  2221. /**
  2222. * Used to resolve the
  2223. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  2224. * of values.
  2225. */
  2226. var nativeObjectToString = objectProto.toString;
  2227. /** Used to infer the `Object` constructor. */
  2228. var objectCtorString = funcToString.call(Object);
  2229. /** Used to restore the original `_` reference in `_.noConflict`. */
  2230. var oldDash = root._;
  2231. /** Used to detect if a method is native. */
  2232. var reIsNative = RegExp('^' +
  2233. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  2234. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  2235. );
  2236. /** Built-in value references. */
  2237. var Buffer = moduleExports ? context.Buffer : undefined,
  2238. Symbol = context.Symbol,
  2239. Uint8Array = context.Uint8Array,
  2240. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  2241. getPrototype = overArg(Object.getPrototypeOf, Object),
  2242. objectCreate = Object.create,
  2243. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  2244. splice = arrayProto.splice,
  2245. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  2246. symIterator = Symbol ? Symbol.iterator : undefined,
  2247. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  2248. var defineProperty = (function() {
  2249. try {
  2250. var func = getNative(Object, 'defineProperty');
  2251. func({}, '', {});
  2252. return func;
  2253. } catch (e) {}
  2254. }());
  2255. /** Mocked built-ins. */
  2256. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  2257. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  2258. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  2259. /* Built-in method references for those with the same name as other `lodash` methods. */
  2260. var nativeCeil = Math.ceil,
  2261. nativeFloor = Math.floor,
  2262. nativeGetSymbols = Object.getOwnPropertySymbols,
  2263. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  2264. nativeIsFinite = context.isFinite,
  2265. nativeJoin = arrayProto.join,
  2266. nativeKeys = overArg(Object.keys, Object),
  2267. nativeMax = Math.max,
  2268. nativeMin = Math.min,
  2269. nativeNow = Date.now,
  2270. nativeParseInt = context.parseInt,
  2271. nativeRandom = Math.random,
  2272. nativeReverse = arrayProto.reverse;
  2273. /* Built-in method references that are verified to be native. */
  2274. var DataView = getNative(context, 'DataView'),
  2275. Map = getNative(context, 'Map'),
  2276. Promise = getNative(context, 'Promise'),
  2277. Set = getNative(context, 'Set'),
  2278. WeakMap = getNative(context, 'WeakMap'),
  2279. nativeCreate = getNative(Object, 'create');
  2280. /** Used to store function metadata. */
  2281. var metaMap = WeakMap && new WeakMap;
  2282. /** Used to lookup unminified function names. */
  2283. var realNames = {};
  2284. /** Used to detect maps, sets, and weakmaps. */
  2285. var dataViewCtorString = toSource(DataView),
  2286. mapCtorString = toSource(Map),
  2287. promiseCtorString = toSource(Promise),
  2288. setCtorString = toSource(Set),
  2289. weakMapCtorString = toSource(WeakMap);
  2290. /** Used to convert symbols to primitives and strings. */
  2291. var symbolProto = Symbol ? Symbol.prototype : undefined,
  2292. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  2293. symbolToString = symbolProto ? symbolProto.toString : undefined;
  2294. /*------------------------------------------------------------------------*/
  2295. /**
  2296. * Creates a `lodash` object which wraps `value` to enable implicit method
  2297. * chain sequences. Methods that operate on and return arrays, collections,
  2298. * and functions can be chained together. Methods that retrieve a single value
  2299. * or may return a primitive value will automatically end the chain sequence
  2300. * and return the unwrapped value. Otherwise, the value must be unwrapped
  2301. * with `_#value`.
  2302. *
  2303. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  2304. * enabled using `_.chain`.
  2305. *
  2306. * The execution of chained methods is lazy, that is, it's deferred until
  2307. * `_#value` is implicitly or explicitly called.
  2308. *
  2309. * Lazy evaluation allows several methods to support shortcut fusion.
  2310. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  2311. * the creation of intermediate arrays and can greatly reduce the number of
  2312. * iteratee executions. Sections of a chain sequence qualify for shortcut
  2313. * fusion if the section is applied to an array and iteratees accept only
  2314. * one argument. The heuristic for whether a section qualifies for shortcut
  2315. * fusion is subject to change.
  2316. *
  2317. * Chaining is supported in custom builds as long as the `_#value` method is
  2318. * directly or indirectly included in the build.
  2319. *
  2320. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  2321. *
  2322. * The wrapper `Array` methods are:
  2323. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  2324. *
  2325. * The wrapper `String` methods are:
  2326. * `replace` and `split`
  2327. *
  2328. * The wrapper methods that support shortcut fusion are:
  2329. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  2330. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  2331. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  2332. *
  2333. * The chainable wrapper methods are:
  2334. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  2335. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  2336. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  2337. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  2338. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  2339. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  2340. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  2341. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  2342. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  2343. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  2344. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  2345. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  2346. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  2347. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  2348. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  2349. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  2350. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  2351. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  2352. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  2353. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  2354. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  2355. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  2356. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  2357. * `zipObject`, `zipObjectDeep`, and `zipWith`
  2358. *
  2359. * The wrapper methods that are **not** chainable by default are:
  2360. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  2361. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  2362. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  2363. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  2364. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  2365. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  2366. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  2367. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  2368. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  2369. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  2370. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  2371. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  2372. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  2373. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  2374. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  2375. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  2376. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  2377. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  2378. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  2379. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  2380. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  2381. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  2382. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  2383. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  2384. * `upperFirst`, `value`, and `words`
  2385. *
  2386. * @name _
  2387. * @constructor
  2388. * @category Seq
  2389. * @param {*} value The value to wrap in a `lodash` instance.
  2390. * @returns {Object} Returns the new `lodash` wrapper instance.
  2391. * @example
  2392. *
  2393. * function square(n) {
  2394. * return n * n;
  2395. * }
  2396. *
  2397. * var wrapped = _([1, 2, 3]);
  2398. *
  2399. * // Returns an unwrapped value.
  2400. * wrapped.reduce(_.add);
  2401. * // => 6
  2402. *
  2403. * // Returns a wrapped value.
  2404. * var squares = wrapped.map(square);
  2405. *
  2406. * _.isArray(squares);
  2407. * // => false
  2408. *
  2409. * _.isArray(squares.value());
  2410. * // => true
  2411. */
  2412. function lodash(value) {
  2413. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  2414. if (value instanceof LodashWrapper) {
  2415. return value;
  2416. }
  2417. if (hasOwnProperty.call(value, '__wrapped__')) {
  2418. return wrapperClone(value);
  2419. }
  2420. }
  2421. return new LodashWrapper(value);
  2422. }
  2423. /**
  2424. * The base implementation of `_.create` without support for assigning
  2425. * properties to the created object.
  2426. *
  2427. * @private
  2428. * @param {Object} proto The object to inherit from.
  2429. * @returns {Object} Returns the new object.
  2430. */
  2431. var baseCreate = (function() {
  2432. function object() {}
  2433. return function(proto) {
  2434. if (!isObject(proto)) {
  2435. return {};
  2436. }
  2437. if (objectCreate) {
  2438. return objectCreate(proto);
  2439. }
  2440. object.prototype = proto;
  2441. var result = new object;
  2442. object.prototype = undefined;
  2443. return result;
  2444. };
  2445. }());
  2446. /**
  2447. * The function whose prototype chain sequence wrappers inherit from.
  2448. *
  2449. * @private
  2450. */
  2451. function baseLodash() {
  2452. // No operation performed.
  2453. }
  2454. /**
  2455. * The base constructor for creating `lodash` wrapper objects.
  2456. *
  2457. * @private
  2458. * @param {*} value The value to wrap.
  2459. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  2460. */
  2461. function LodashWrapper(value, chainAll) {
  2462. this.__wrapped__ = value;
  2463. this.__actions__ = [];
  2464. this.__chain__ = !!chainAll;
  2465. this.__index__ = 0;
  2466. this.__values__ = undefined;
  2467. }
  2468. /**
  2469. * By default, the template delimiters used by lodash are like those in
  2470. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  2471. * following template settings to use alternative delimiters.
  2472. *
  2473. * @static
  2474. * @memberOf _
  2475. * @type {Object}
  2476. */
  2477. lodash.templateSettings = {
  2478. /**
  2479. * Used to detect `data` property values to be HTML-escaped.
  2480. *
  2481. * @memberOf _.templateSettings
  2482. * @type {RegExp}
  2483. */
  2484. 'escape': reEscape,
  2485. /**
  2486. * Used to detect code to be evaluated.
  2487. *
  2488. * @memberOf _.templateSettings
  2489. * @type {RegExp}
  2490. */
  2491. 'evaluate': reEvaluate,
  2492. /**
  2493. * Used to detect `data` property values to inject.
  2494. *
  2495. * @memberOf _.templateSettings
  2496. * @type {RegExp}
  2497. */
  2498. 'interpolate': reInterpolate,
  2499. /**
  2500. * Used to reference the data object in the template text.
  2501. *
  2502. * @memberOf _.templateSettings
  2503. * @type {string}
  2504. */
  2505. 'variable': '',
  2506. /**
  2507. * Used to import variables into the compiled template.
  2508. *
  2509. * @memberOf _.templateSettings
  2510. * @type {Object}
  2511. */
  2512. 'imports': {
  2513. /**
  2514. * A reference to the `lodash` function.
  2515. *
  2516. * @memberOf _.templateSettings.imports
  2517. * @type {Function}
  2518. */
  2519. '_': lodash
  2520. }
  2521. };
  2522. // Ensure wrappers are instances of `baseLodash`.
  2523. lodash.prototype = baseLodash.prototype;
  2524. lodash.prototype.constructor = lodash;
  2525. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  2526. LodashWrapper.prototype.constructor = LodashWrapper;
  2527. /*------------------------------------------------------------------------*/
  2528. /**
  2529. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  2530. *
  2531. * @private
  2532. * @constructor
  2533. * @param {*} value The value to wrap.
  2534. */
  2535. function LazyWrapper(value) {
  2536. this.__wrapped__ = value;
  2537. this.__actions__ = [];
  2538. this.__dir__ = 1;
  2539. this.__filtered__ = false;
  2540. this.__iteratees__ = [];
  2541. this.__takeCount__ = MAX_ARRAY_LENGTH;
  2542. this.__views__ = [];
  2543. }
  2544. /**
  2545. * Creates a clone of the lazy wrapper object.
  2546. *
  2547. * @private
  2548. * @name clone
  2549. * @memberOf LazyWrapper
  2550. * @returns {Object} Returns the cloned `LazyWrapper` object.
  2551. */
  2552. function lazyClone() {
  2553. var result = new LazyWrapper(this.__wrapped__);
  2554. result.__actions__ = copyArray(this.__actions__);
  2555. result.__dir__ = this.__dir__;
  2556. result.__filtered__ = this.__filtered__;
  2557. result.__iteratees__ = copyArray(this.__iteratees__);
  2558. result.__takeCount__ = this.__takeCount__;
  2559. result.__views__ = copyArray(this.__views__);
  2560. return result;
  2561. }
  2562. /**
  2563. * Reverses the direction of lazy iteration.
  2564. *
  2565. * @private
  2566. * @name reverse
  2567. * @memberOf LazyWrapper
  2568. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  2569. */
  2570. function lazyReverse() {
  2571. if (this.__filtered__) {
  2572. var result = new LazyWrapper(this);
  2573. result.__dir__ = -1;
  2574. result.__filtered__ = true;
  2575. } else {
  2576. result = this.clone();
  2577. result.__dir__ *= -1;
  2578. }
  2579. return result;
  2580. }
  2581. /**
  2582. * Extracts the unwrapped value from its lazy wrapper.
  2583. *
  2584. * @private
  2585. * @name value
  2586. * @memberOf LazyWrapper
  2587. * @returns {*} Returns the unwrapped value.
  2588. */
  2589. function lazyValue() {
  2590. var array = this.__wrapped__.value(),
  2591. dir = this.__dir__,
  2592. isArr = isArray(array),
  2593. isRight = dir < 0,
  2594. arrLength = isArr ? array.length : 0,
  2595. view = getView(0, arrLength, this.__views__),
  2596. start = view.start,
  2597. end = view.end,
  2598. length = end - start,
  2599. index = isRight ? end : (start - 1),
  2600. iteratees = this.__iteratees__,
  2601. iterLength = iteratees.length,
  2602. resIndex = 0,
  2603. takeCount = nativeMin(length, this.__takeCount__);
  2604. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  2605. return baseWrapperValue(array, this.__actions__);
  2606. }
  2607. var result = [];
  2608. outer:
  2609. while (length-- && resIndex < takeCount) {
  2610. index += dir;
  2611. var iterIndex = -1,
  2612. value = array[index];
  2613. while (++iterIndex < iterLength) {
  2614. var data = iteratees[iterIndex],
  2615. iteratee = data.iteratee,
  2616. type = data.type,
  2617. computed = iteratee(value);
  2618. if (type == LAZY_MAP_FLAG) {
  2619. value = computed;
  2620. } else if (!computed) {
  2621. if (type == LAZY_FILTER_FLAG) {
  2622. continue outer;
  2623. } else {
  2624. break outer;
  2625. }
  2626. }
  2627. }
  2628. result[resIndex++] = value;
  2629. }
  2630. return result;
  2631. }
  2632. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  2633. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  2634. LazyWrapper.prototype.constructor = LazyWrapper;
  2635. /*------------------------------------------------------------------------*/
  2636. /**
  2637. * Creates a hash object.
  2638. *
  2639. * @private
  2640. * @constructor
  2641. * @param {Array} [entries] The key-value pairs to cache.
  2642. */
  2643. function Hash(entries) {
  2644. var index = -1,
  2645. length = entries == null ? 0 : entries.length;
  2646. this.clear();
  2647. while (++index < length) {
  2648. var entry = entries[index];
  2649. this.set(entry[0], entry[1]);
  2650. }
  2651. }
  2652. /**
  2653. * Removes all key-value entries from the hash.
  2654. *
  2655. * @private
  2656. * @name clear
  2657. * @memberOf Hash
  2658. */
  2659. function hashClear() {
  2660. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  2661. this.size = 0;
  2662. }
  2663. /**
  2664. * Removes `key` and its value from the hash.
  2665. *
  2666. * @private
  2667. * @name delete
  2668. * @memberOf Hash
  2669. * @param {Object} hash The hash to modify.
  2670. * @param {string} key The key of the value to remove.
  2671. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2672. */
  2673. function hashDelete(key) {
  2674. var result = this.has(key) && delete this.__data__[key];
  2675. this.size -= result ? 1 : 0;
  2676. return result;
  2677. }
  2678. /**
  2679. * Gets the hash value for `key`.
  2680. *
  2681. * @private
  2682. * @name get
  2683. * @memberOf Hash
  2684. * @param {string} key The key of the value to get.
  2685. * @returns {*} Returns the entry value.
  2686. */
  2687. function hashGet(key) {
  2688. var data = this.__data__;
  2689. if (nativeCreate) {
  2690. var result = data[key];
  2691. return result === HASH_UNDEFINED ? undefined : result;
  2692. }
  2693. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  2694. }
  2695. /**
  2696. * Checks if a hash value for `key` exists.
  2697. *
  2698. * @private
  2699. * @name has
  2700. * @memberOf Hash
  2701. * @param {string} key The key of the entry to check.
  2702. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2703. */
  2704. function hashHas(key) {
  2705. var data = this.__data__;
  2706. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  2707. }
  2708. /**
  2709. * Sets the hash `key` to `value`.
  2710. *
  2711. * @private
  2712. * @name set
  2713. * @memberOf Hash
  2714. * @param {string} key The key of the value to set.
  2715. * @param {*} value The value to set.
  2716. * @returns {Object} Returns the hash instance.
  2717. */
  2718. function hashSet(key, value) {
  2719. var data = this.__data__;
  2720. this.size += this.has(key) ? 0 : 1;
  2721. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  2722. return this;
  2723. }
  2724. // Add methods to `Hash`.
  2725. Hash.prototype.clear = hashClear;
  2726. Hash.prototype['delete'] = hashDelete;
  2727. Hash.prototype.get = hashGet;
  2728. Hash.prototype.has = hashHas;
  2729. Hash.prototype.set = hashSet;
  2730. /*------------------------------------------------------------------------*/
  2731. /**
  2732. * Creates an list cache object.
  2733. *
  2734. * @private
  2735. * @constructor
  2736. * @param {Array} [entries] The key-value pairs to cache.
  2737. */
  2738. function ListCache(entries) {
  2739. var index = -1,
  2740. length = entries == null ? 0 : entries.length;
  2741. this.clear();
  2742. while (++index < length) {
  2743. var entry = entries[index];
  2744. this.set(entry[0], entry[1]);
  2745. }
  2746. }
  2747. /**
  2748. * Removes all key-value entries from the list cache.
  2749. *
  2750. * @private
  2751. * @name clear
  2752. * @memberOf ListCache
  2753. */
  2754. function listCacheClear() {
  2755. this.__data__ = [];
  2756. this.size = 0;
  2757. }
  2758. /**
  2759. * Removes `key` and its value from the list cache.
  2760. *
  2761. * @private
  2762. * @name delete
  2763. * @memberOf ListCache
  2764. * @param {string} key The key of the value to remove.
  2765. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2766. */
  2767. function listCacheDelete(key) {
  2768. var data = this.__data__,
  2769. index = assocIndexOf(data, key);
  2770. if (index < 0) {
  2771. return false;
  2772. }
  2773. var lastIndex = data.length - 1;
  2774. if (index == lastIndex) {
  2775. data.pop();
  2776. } else {
  2777. splice.call(data, index, 1);
  2778. }
  2779. --this.size;
  2780. return true;
  2781. }
  2782. /**
  2783. * Gets the list cache value for `key`.
  2784. *
  2785. * @private
  2786. * @name get
  2787. * @memberOf ListCache
  2788. * @param {string} key The key of the value to get.
  2789. * @returns {*} Returns the entry value.
  2790. */
  2791. function listCacheGet(key) {
  2792. var data = this.__data__,
  2793. index = assocIndexOf(data, key);
  2794. return index < 0 ? undefined : data[index][1];
  2795. }
  2796. /**
  2797. * Checks if a list cache value for `key` exists.
  2798. *
  2799. * @private
  2800. * @name has
  2801. * @memberOf ListCache
  2802. * @param {string} key The key of the entry to check.
  2803. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2804. */
  2805. function listCacheHas(key) {
  2806. return assocIndexOf(this.__data__, key) > -1;
  2807. }
  2808. /**
  2809. * Sets the list cache `key` to `value`.
  2810. *
  2811. * @private
  2812. * @name set
  2813. * @memberOf ListCache
  2814. * @param {string} key The key of the value to set.
  2815. * @param {*} value The value to set.
  2816. * @returns {Object} Returns the list cache instance.
  2817. */
  2818. function listCacheSet(key, value) {
  2819. var data = this.__data__,
  2820. index = assocIndexOf(data, key);
  2821. if (index < 0) {
  2822. ++this.size;
  2823. data.push([key, value]);
  2824. } else {
  2825. data[index][1] = value;
  2826. }
  2827. return this;
  2828. }
  2829. // Add methods to `ListCache`.
  2830. ListCache.prototype.clear = listCacheClear;
  2831. ListCache.prototype['delete'] = listCacheDelete;
  2832. ListCache.prototype.get = listCacheGet;
  2833. ListCache.prototype.has = listCacheHas;
  2834. ListCache.prototype.set = listCacheSet;
  2835. /*------------------------------------------------------------------------*/
  2836. /**
  2837. * Creates a map cache object to store key-value pairs.
  2838. *
  2839. * @private
  2840. * @constructor
  2841. * @param {Array} [entries] The key-value pairs to cache.
  2842. */
  2843. function MapCache(entries) {
  2844. var index = -1,
  2845. length = entries == null ? 0 : entries.length;
  2846. this.clear();
  2847. while (++index < length) {
  2848. var entry = entries[index];
  2849. this.set(entry[0], entry[1]);
  2850. }
  2851. }
  2852. /**
  2853. * Removes all key-value entries from the map.
  2854. *
  2855. * @private
  2856. * @name clear
  2857. * @memberOf MapCache
  2858. */
  2859. function mapCacheClear() {
  2860. this.size = 0;
  2861. this.__data__ = {
  2862. 'hash': new Hash,
  2863. 'map': new (Map || ListCache),
  2864. 'string': new Hash
  2865. };
  2866. }
  2867. /**
  2868. * Removes `key` and its value from the map.
  2869. *
  2870. * @private
  2871. * @name delete
  2872. * @memberOf MapCache
  2873. * @param {string} key The key of the value to remove.
  2874. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2875. */
  2876. function mapCacheDelete(key) {
  2877. var result = getMapData(this, key)['delete'](key);
  2878. this.size -= result ? 1 : 0;
  2879. return result;
  2880. }
  2881. /**
  2882. * Gets the map value for `key`.
  2883. *
  2884. * @private
  2885. * @name get
  2886. * @memberOf MapCache
  2887. * @param {string} key The key of the value to get.
  2888. * @returns {*} Returns the entry value.
  2889. */
  2890. function mapCacheGet(key) {
  2891. return getMapData(this, key).get(key);
  2892. }
  2893. /**
  2894. * Checks if a map value for `key` exists.
  2895. *
  2896. * @private
  2897. * @name has
  2898. * @memberOf MapCache
  2899. * @param {string} key The key of the entry to check.
  2900. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2901. */
  2902. function mapCacheHas(key) {
  2903. return getMapData(this, key).has(key);
  2904. }
  2905. /**
  2906. * Sets the map `key` to `value`.
  2907. *
  2908. * @private
  2909. * @name set
  2910. * @memberOf MapCache
  2911. * @param {string} key The key of the value to set.
  2912. * @param {*} value The value to set.
  2913. * @returns {Object} Returns the map cache instance.
  2914. */
  2915. function mapCacheSet(key, value) {
  2916. var data = getMapData(this, key),
  2917. size = data.size;
  2918. data.set(key, value);
  2919. this.size += data.size == size ? 0 : 1;
  2920. return this;
  2921. }
  2922. // Add methods to `MapCache`.
  2923. MapCache.prototype.clear = mapCacheClear;
  2924. MapCache.prototype['delete'] = mapCacheDelete;
  2925. MapCache.prototype.get = mapCacheGet;
  2926. MapCache.prototype.has = mapCacheHas;
  2927. MapCache.prototype.set = mapCacheSet;
  2928. /*------------------------------------------------------------------------*/
  2929. /**
  2930. *
  2931. * Creates an array cache object to store unique values.
  2932. *
  2933. * @private
  2934. * @constructor
  2935. * @param {Array} [values] The values to cache.
  2936. */
  2937. function SetCache(values) {
  2938. var index = -1,
  2939. length = values == null ? 0 : values.length;
  2940. this.__data__ = new MapCache;
  2941. while (++index < length) {
  2942. this.add(values[index]);
  2943. }
  2944. }
  2945. /**
  2946. * Adds `value` to the array cache.
  2947. *
  2948. * @private
  2949. * @name add
  2950. * @memberOf SetCache
  2951. * @alias push
  2952. * @param {*} value The value to cache.
  2953. * @returns {Object} Returns the cache instance.
  2954. */
  2955. function setCacheAdd(value) {
  2956. this.__data__.set(value, HASH_UNDEFINED);
  2957. return this;
  2958. }
  2959. /**
  2960. * Checks if `value` is in the array cache.
  2961. *
  2962. * @private
  2963. * @name has
  2964. * @memberOf SetCache
  2965. * @param {*} value The value to search for.
  2966. * @returns {number} Returns `true` if `value` is found, else `false`.
  2967. */
  2968. function setCacheHas(value) {
  2969. return this.__data__.has(value);
  2970. }
  2971. // Add methods to `SetCache`.
  2972. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  2973. SetCache.prototype.has = setCacheHas;
  2974. /*------------------------------------------------------------------------*/
  2975. /**
  2976. * Creates a stack cache object to store key-value pairs.
  2977. *
  2978. * @private
  2979. * @constructor
  2980. * @param {Array} [entries] The key-value pairs to cache.
  2981. */
  2982. function Stack(entries) {
  2983. var data = this.__data__ = new ListCache(entries);
  2984. this.size = data.size;
  2985. }
  2986. /**
  2987. * Removes all key-value entries from the stack.
  2988. *
  2989. * @private
  2990. * @name clear
  2991. * @memberOf Stack
  2992. */
  2993. function stackClear() {
  2994. this.__data__ = new ListCache;
  2995. this.size = 0;
  2996. }
  2997. /**
  2998. * Removes `key` and its value from the stack.
  2999. *
  3000. * @private
  3001. * @name delete
  3002. * @memberOf Stack
  3003. * @param {string} key The key of the value to remove.
  3004. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3005. */
  3006. function stackDelete(key) {
  3007. var data = this.__data__,
  3008. result = data['delete'](key);
  3009. this.size = data.size;
  3010. return result;
  3011. }
  3012. /**
  3013. * Gets the stack value for `key`.
  3014. *
  3015. * @private
  3016. * @name get
  3017. * @memberOf Stack
  3018. * @param {string} key The key of the value to get.
  3019. * @returns {*} Returns the entry value.
  3020. */
  3021. function stackGet(key) {
  3022. return this.__data__.get(key);
  3023. }
  3024. /**
  3025. * Checks if a stack value for `key` exists.
  3026. *
  3027. * @private
  3028. * @name has
  3029. * @memberOf Stack
  3030. * @param {string} key The key of the entry to check.
  3031. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3032. */
  3033. function stackHas(key) {
  3034. return this.__data__.has(key);
  3035. }
  3036. /**
  3037. * Sets the stack `key` to `value`.
  3038. *
  3039. * @private
  3040. * @name set
  3041. * @memberOf Stack
  3042. * @param {string} key The key of the value to set.
  3043. * @param {*} value The value to set.
  3044. * @returns {Object} Returns the stack cache instance.
  3045. */
  3046. function stackSet(key, value) {
  3047. var data = this.__data__;
  3048. if (data instanceof ListCache) {
  3049. var pairs = data.__data__;
  3050. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  3051. pairs.push([key, value]);
  3052. this.size = ++data.size;
  3053. return this;
  3054. }
  3055. data = this.__data__ = new MapCache(pairs);
  3056. }
  3057. data.set(key, value);
  3058. this.size = data.size;
  3059. return this;
  3060. }
  3061. // Add methods to `Stack`.
  3062. Stack.prototype.clear = stackClear;
  3063. Stack.prototype['delete'] = stackDelete;
  3064. Stack.prototype.get = stackGet;
  3065. Stack.prototype.has = stackHas;
  3066. Stack.prototype.set = stackSet;
  3067. /*------------------------------------------------------------------------*/
  3068. /**
  3069. * Creates an array of the enumerable property names of the array-like `value`.
  3070. *
  3071. * @private
  3072. * @param {*} value The value to query.
  3073. * @param {boolean} inherited Specify returning inherited property names.
  3074. * @returns {Array} Returns the array of property names.
  3075. */
  3076. function arrayLikeKeys(value, inherited) {
  3077. var isArr = isArray(value),
  3078. isArg = !isArr && isArguments(value),
  3079. isBuff = !isArr && !isArg && isBuffer(value),
  3080. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  3081. skipIndexes = isArr || isArg || isBuff || isType,
  3082. result = skipIndexes ? baseTimes(value.length, String) : [],
  3083. length = result.length;
  3084. for (var key in value) {
  3085. if ((inherited || hasOwnProperty.call(value, key)) &&
  3086. !(skipIndexes && (
  3087. // Safari 9 has enumerable `arguments.length` in strict mode.
  3088. key == 'length' ||
  3089. // Node.js 0.10 has enumerable non-index properties on buffers.
  3090. (isBuff && (key == 'offset' || key == 'parent')) ||
  3091. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  3092. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  3093. // Skip index properties.
  3094. isIndex(key, length)
  3095. ))) {
  3096. result.push(key);
  3097. }
  3098. }
  3099. return result;
  3100. }
  3101. /**
  3102. * A specialized version of `_.sample` for arrays.
  3103. *
  3104. * @private
  3105. * @param {Array} array The array to sample.
  3106. * @returns {*} Returns the random element.
  3107. */
  3108. function arraySample(array) {
  3109. var length = array.length;
  3110. return length ? array[baseRandom(0, length - 1)] : undefined;
  3111. }
  3112. /**
  3113. * A specialized version of `_.sampleSize` for arrays.
  3114. *
  3115. * @private
  3116. * @param {Array} array The array to sample.
  3117. * @param {number} n The number of elements to sample.
  3118. * @returns {Array} Returns the random elements.
  3119. */
  3120. function arraySampleSize(array, n) {
  3121. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  3122. }
  3123. /**
  3124. * A specialized version of `_.shuffle` for arrays.
  3125. *
  3126. * @private
  3127. * @param {Array} array The array to shuffle.
  3128. * @returns {Array} Returns the new shuffled array.
  3129. */
  3130. function arrayShuffle(array) {
  3131. return shuffleSelf(copyArray(array));
  3132. }
  3133. /**
  3134. * This function is like `assignValue` except that it doesn't assign
  3135. * `undefined` values.
  3136. *
  3137. * @private
  3138. * @param {Object} object The object to modify.
  3139. * @param {string} key The key of the property to assign.
  3140. * @param {*} value The value to assign.
  3141. */
  3142. function assignMergeValue(object, key, value) {
  3143. if ((value !== undefined && !eq(object[key], value)) ||
  3144. (value === undefined && !(key in object))) {
  3145. baseAssignValue(object, key, value);
  3146. }
  3147. }
  3148. /**
  3149. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  3150. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3151. * for equality comparisons.
  3152. *
  3153. * @private
  3154. * @param {Object} object The object to modify.
  3155. * @param {string} key The key of the property to assign.
  3156. * @param {*} value The value to assign.
  3157. */
  3158. function assignValue(object, key, value) {
  3159. var objValue = object[key];
  3160. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  3161. (value === undefined && !(key in object))) {
  3162. baseAssignValue(object, key, value);
  3163. }
  3164. }
  3165. /**
  3166. * Gets the index at which the `key` is found in `array` of key-value pairs.
  3167. *
  3168. * @private
  3169. * @param {Array} array The array to inspect.
  3170. * @param {*} key The key to search for.
  3171. * @returns {number} Returns the index of the matched value, else `-1`.
  3172. */
  3173. function assocIndexOf(array, key) {
  3174. var length = array.length;
  3175. while (length--) {
  3176. if (eq(array[length][0], key)) {
  3177. return length;
  3178. }
  3179. }
  3180. return -1;
  3181. }
  3182. /**
  3183. * Aggregates elements of `collection` on `accumulator` with keys transformed
  3184. * by `iteratee` and values set by `setter`.
  3185. *
  3186. * @private
  3187. * @param {Array|Object} collection The collection to iterate over.
  3188. * @param {Function} setter The function to set `accumulator` values.
  3189. * @param {Function} iteratee The iteratee to transform keys.
  3190. * @param {Object} accumulator The initial aggregated object.
  3191. * @returns {Function} Returns `accumulator`.
  3192. */
  3193. function baseAggregator(collection, setter, iteratee, accumulator) {
  3194. baseEach(collection, function(value, key, collection) {
  3195. setter(accumulator, value, iteratee(value), collection);
  3196. });
  3197. return accumulator;
  3198. }
  3199. /**
  3200. * The base implementation of `_.assign` without support for multiple sources
  3201. * or `customizer` functions.
  3202. *
  3203. * @private
  3204. * @param {Object} object The destination object.
  3205. * @param {Object} source The source object.
  3206. * @returns {Object} Returns `object`.
  3207. */
  3208. function baseAssign(object, source) {
  3209. return object && copyObject(source, keys(source), object);
  3210. }
  3211. /**
  3212. * The base implementation of `_.assignIn` without support for multiple sources
  3213. * or `customizer` functions.
  3214. *
  3215. * @private
  3216. * @param {Object} object The destination object.
  3217. * @param {Object} source The source object.
  3218. * @returns {Object} Returns `object`.
  3219. */
  3220. function baseAssignIn(object, source) {
  3221. return object && copyObject(source, keysIn(source), object);
  3222. }
  3223. /**
  3224. * The base implementation of `assignValue` and `assignMergeValue` without
  3225. * value checks.
  3226. *
  3227. * @private
  3228. * @param {Object} object The object to modify.
  3229. * @param {string} key The key of the property to assign.
  3230. * @param {*} value The value to assign.
  3231. */
  3232. function baseAssignValue(object, key, value) {
  3233. if (key == '__proto__' && defineProperty) {
  3234. defineProperty(object, key, {
  3235. 'configurable': true,
  3236. 'enumerable': true,
  3237. 'value': value,
  3238. 'writable': true
  3239. });
  3240. } else {
  3241. object[key] = value;
  3242. }
  3243. }
  3244. /**
  3245. * The base implementation of `_.at` without support for individual paths.
  3246. *
  3247. * @private
  3248. * @param {Object} object The object to iterate over.
  3249. * @param {string[]} paths The property paths to pick.
  3250. * @returns {Array} Returns the picked elements.
  3251. */
  3252. function baseAt(object, paths) {
  3253. var index = -1,
  3254. length = paths.length,
  3255. result = Array(length),
  3256. skip = object == null;
  3257. while (++index < length) {
  3258. result[index] = skip ? undefined : get(object, paths[index]);
  3259. }
  3260. return result;
  3261. }
  3262. /**
  3263. * The base implementation of `_.clamp` which doesn't coerce arguments.
  3264. *
  3265. * @private
  3266. * @param {number} number The number to clamp.
  3267. * @param {number} [lower] The lower bound.
  3268. * @param {number} upper The upper bound.
  3269. * @returns {number} Returns the clamped number.
  3270. */
  3271. function baseClamp(number, lower, upper) {
  3272. if (number === number) {
  3273. if (upper !== undefined) {
  3274. number = number <= upper ? number : upper;
  3275. }
  3276. if (lower !== undefined) {
  3277. number = number >= lower ? number : lower;
  3278. }
  3279. }
  3280. return number;
  3281. }
  3282. /**
  3283. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  3284. * traversed objects.
  3285. *
  3286. * @private
  3287. * @param {*} value The value to clone.
  3288. * @param {boolean} bitmask The bitmask flags.
  3289. * 1 - Deep clone
  3290. * 2 - Flatten inherited properties
  3291. * 4 - Clone symbols
  3292. * @param {Function} [customizer] The function to customize cloning.
  3293. * @param {string} [key] The key of `value`.
  3294. * @param {Object} [object] The parent object of `value`.
  3295. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  3296. * @returns {*} Returns the cloned value.
  3297. */
  3298. function baseClone(value, bitmask, customizer, key, object, stack) {
  3299. var result,
  3300. isDeep = bitmask & CLONE_DEEP_FLAG,
  3301. isFlat = bitmask & CLONE_FLAT_FLAG,
  3302. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  3303. if (customizer) {
  3304. result = object ? customizer(value, key, object, stack) : customizer(value);
  3305. }
  3306. if (result !== undefined) {
  3307. return result;
  3308. }
  3309. if (!isObject(value)) {
  3310. return value;
  3311. }
  3312. var isArr = isArray(value);
  3313. if (isArr) {
  3314. result = initCloneArray(value);
  3315. if (!isDeep) {
  3316. return copyArray(value, result);
  3317. }
  3318. } else {
  3319. var tag = getTag(value),
  3320. isFunc = tag == funcTag || tag == genTag;
  3321. if (isBuffer(value)) {
  3322. return cloneBuffer(value, isDeep);
  3323. }
  3324. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  3325. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  3326. if (!isDeep) {
  3327. return isFlat
  3328. ? copySymbolsIn(value, baseAssignIn(result, value))
  3329. : copySymbols(value, baseAssign(result, value));
  3330. }
  3331. } else {
  3332. if (!cloneableTags[tag]) {
  3333. return object ? value : {};
  3334. }
  3335. result = initCloneByTag(value, tag, isDeep);
  3336. }
  3337. }
  3338. // Check for circular references and return its corresponding clone.
  3339. stack || (stack = new Stack);
  3340. var stacked = stack.get(value);
  3341. if (stacked) {
  3342. return stacked;
  3343. }
  3344. stack.set(value, result);
  3345. if (isSet(value)) {
  3346. value.forEach(function(subValue) {
  3347. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  3348. });
  3349. } else if (isMap(value)) {
  3350. value.forEach(function(subValue, key) {
  3351. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  3352. });
  3353. }
  3354. var keysFunc = isFull
  3355. ? (isFlat ? getAllKeysIn : getAllKeys)
  3356. : (isFlat ? keysIn : keys);
  3357. var props = isArr ? undefined : keysFunc(value);
  3358. arrayEach(props || value, function(subValue, key) {
  3359. if (props) {
  3360. key = subValue;
  3361. subValue = value[key];
  3362. }
  3363. // Recursively populate clone (susceptible to call stack limits).
  3364. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  3365. });
  3366. return result;
  3367. }
  3368. /**
  3369. * The base implementation of `_.conforms` which doesn't clone `source`.
  3370. *
  3371. * @private
  3372. * @param {Object} source The object of property predicates to conform to.
  3373. * @returns {Function} Returns the new spec function.
  3374. */
  3375. function baseConforms(source) {
  3376. var props = keys(source);
  3377. return function(object) {
  3378. return baseConformsTo(object, source, props);
  3379. };
  3380. }
  3381. /**
  3382. * The base implementation of `_.conformsTo` which accepts `props` to check.
  3383. *
  3384. * @private
  3385. * @param {Object} object The object to inspect.
  3386. * @param {Object} source The object of property predicates to conform to.
  3387. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  3388. */
  3389. function baseConformsTo(object, source, props) {
  3390. var length = props.length;
  3391. if (object == null) {
  3392. return !length;
  3393. }
  3394. object = Object(object);
  3395. while (length--) {
  3396. var key = props[length],
  3397. predicate = source[key],
  3398. value = object[key];
  3399. if ((value === undefined && !(key in object)) || !predicate(value)) {
  3400. return false;
  3401. }
  3402. }
  3403. return true;
  3404. }
  3405. /**
  3406. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  3407. * to provide to `func`.
  3408. *
  3409. * @private
  3410. * @param {Function} func The function to delay.
  3411. * @param {number} wait The number of milliseconds to delay invocation.
  3412. * @param {Array} args The arguments to provide to `func`.
  3413. * @returns {number|Object} Returns the timer id or timeout object.
  3414. */
  3415. function baseDelay(func, wait, args) {
  3416. if (typeof func != 'function') {
  3417. throw new TypeError(FUNC_ERROR_TEXT);
  3418. }
  3419. return setTimeout(function() { func.apply(undefined, args); }, wait);
  3420. }
  3421. /**
  3422. * The base implementation of methods like `_.difference` without support
  3423. * for excluding multiple arrays or iteratee shorthands.
  3424. *
  3425. * @private
  3426. * @param {Array} array The array to inspect.
  3427. * @param {Array} values The values to exclude.
  3428. * @param {Function} [iteratee] The iteratee invoked per element.
  3429. * @param {Function} [comparator] The comparator invoked per element.
  3430. * @returns {Array} Returns the new array of filtered values.
  3431. */
  3432. function baseDifference(array, values, iteratee, comparator) {
  3433. var index = -1,
  3434. includes = arrayIncludes,
  3435. isCommon = true,
  3436. length = array.length,
  3437. result = [],
  3438. valuesLength = values.length;
  3439. if (!length) {
  3440. return result;
  3441. }
  3442. if (iteratee) {
  3443. values = arrayMap(values, baseUnary(iteratee));
  3444. }
  3445. if (comparator) {
  3446. includes = arrayIncludesWith;
  3447. isCommon = false;
  3448. }
  3449. else if (values.length >= LARGE_ARRAY_SIZE) {
  3450. includes = cacheHas;
  3451. isCommon = false;
  3452. values = new SetCache(values);
  3453. }
  3454. outer:
  3455. while (++index < length) {
  3456. var value = array[index],
  3457. computed = iteratee == null ? value : iteratee(value);
  3458. value = (comparator || value !== 0) ? value : 0;
  3459. if (isCommon && computed === computed) {
  3460. var valuesIndex = valuesLength;
  3461. while (valuesIndex--) {
  3462. if (values[valuesIndex] === computed) {
  3463. continue outer;
  3464. }
  3465. }
  3466. result.push(value);
  3467. }
  3468. else if (!includes(values, computed, comparator)) {
  3469. result.push(value);
  3470. }
  3471. }
  3472. return result;
  3473. }
  3474. /**
  3475. * The base implementation of `_.forEach` without support for iteratee shorthands.
  3476. *
  3477. * @private
  3478. * @param {Array|Object} collection The collection to iterate over.
  3479. * @param {Function} iteratee The function invoked per iteration.
  3480. * @returns {Array|Object} Returns `collection`.
  3481. */
  3482. var baseEach = createBaseEach(baseForOwn);
  3483. /**
  3484. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  3485. *
  3486. * @private
  3487. * @param {Array|Object} collection The collection to iterate over.
  3488. * @param {Function} iteratee The function invoked per iteration.
  3489. * @returns {Array|Object} Returns `collection`.
  3490. */
  3491. var baseEachRight = createBaseEach(baseForOwnRight, true);
  3492. /**
  3493. * The base implementation of `_.every` without support for iteratee shorthands.
  3494. *
  3495. * @private
  3496. * @param {Array|Object} collection The collection to iterate over.
  3497. * @param {Function} predicate The function invoked per iteration.
  3498. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  3499. * else `false`
  3500. */
  3501. function baseEvery(collection, predicate) {
  3502. var result = true;
  3503. baseEach(collection, function(value, index, collection) {
  3504. result = !!predicate(value, index, collection);
  3505. return result;
  3506. });
  3507. return result;
  3508. }
  3509. /**
  3510. * The base implementation of methods like `_.max` and `_.min` which accepts a
  3511. * `comparator` to determine the extremum value.
  3512. *
  3513. * @private
  3514. * @param {Array} array The array to iterate over.
  3515. * @param {Function} iteratee The iteratee invoked per iteration.
  3516. * @param {Function} comparator The comparator used to compare values.
  3517. * @returns {*} Returns the extremum value.
  3518. */
  3519. function baseExtremum(array, iteratee, comparator) {
  3520. var index = -1,
  3521. length = array.length;
  3522. while (++index < length) {
  3523. var value = array[index],
  3524. current = iteratee(value);
  3525. if (current != null && (computed === undefined
  3526. ? (current === current && !isSymbol(current))
  3527. : comparator(current, computed)
  3528. )) {
  3529. var computed = current,
  3530. result = value;
  3531. }
  3532. }
  3533. return result;
  3534. }
  3535. /**
  3536. * The base implementation of `_.fill` without an iteratee call guard.
  3537. *
  3538. * @private
  3539. * @param {Array} array The array to fill.
  3540. * @param {*} value The value to fill `array` with.
  3541. * @param {number} [start=0] The start position.
  3542. * @param {number} [end=array.length] The end position.
  3543. * @returns {Array} Returns `array`.
  3544. */
  3545. function baseFill(array, value, start, end) {
  3546. var length = array.length;
  3547. start = toInteger(start);
  3548. if (start < 0) {
  3549. start = -start > length ? 0 : (length + start);
  3550. }
  3551. end = (end === undefined || end > length) ? length : toInteger(end);
  3552. if (end < 0) {
  3553. end += length;
  3554. }
  3555. end = start > end ? 0 : toLength(end);
  3556. while (start < end) {
  3557. array[start++] = value;
  3558. }
  3559. return array;
  3560. }
  3561. /**
  3562. * The base implementation of `_.filter` without support for iteratee shorthands.
  3563. *
  3564. * @private
  3565. * @param {Array|Object} collection The collection to iterate over.
  3566. * @param {Function} predicate The function invoked per iteration.
  3567. * @returns {Array} Returns the new filtered array.
  3568. */
  3569. function baseFilter(collection, predicate) {
  3570. var result = [];
  3571. baseEach(collection, function(value, index, collection) {
  3572. if (predicate(value, index, collection)) {
  3573. result.push(value);
  3574. }
  3575. });
  3576. return result;
  3577. }
  3578. /**
  3579. * The base implementation of `_.flatten` with support for restricting flattening.
  3580. *
  3581. * @private
  3582. * @param {Array} array The array to flatten.
  3583. * @param {number} depth The maximum recursion depth.
  3584. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  3585. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  3586. * @param {Array} [result=[]] The initial result value.
  3587. * @returns {Array} Returns the new flattened array.
  3588. */
  3589. function baseFlatten(array, depth, predicate, isStrict, result) {
  3590. var index = -1,
  3591. length = array.length;
  3592. predicate || (predicate = isFlattenable);
  3593. result || (result = []);
  3594. while (++index < length) {
  3595. var value = array[index];
  3596. if (depth > 0 && predicate(value)) {
  3597. if (depth > 1) {
  3598. // Recursively flatten arrays (susceptible to call stack limits).
  3599. baseFlatten(value, depth - 1, predicate, isStrict, result);
  3600. } else {
  3601. arrayPush(result, value);
  3602. }
  3603. } else if (!isStrict) {
  3604. result[result.length] = value;
  3605. }
  3606. }
  3607. return result;
  3608. }
  3609. /**
  3610. * The base implementation of `baseForOwn` which iterates over `object`
  3611. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  3612. * Iteratee functions may exit iteration early by explicitly returning `false`.
  3613. *
  3614. * @private
  3615. * @param {Object} object The object to iterate over.
  3616. * @param {Function} iteratee The function invoked per iteration.
  3617. * @param {Function} keysFunc The function to get the keys of `object`.
  3618. * @returns {Object} Returns `object`.
  3619. */
  3620. var baseFor = createBaseFor();
  3621. /**
  3622. * This function is like `baseFor` except that it iterates over properties
  3623. * in the opposite order.
  3624. *
  3625. * @private
  3626. * @param {Object} object The object to iterate over.
  3627. * @param {Function} iteratee The function invoked per iteration.
  3628. * @param {Function} keysFunc The function to get the keys of `object`.
  3629. * @returns {Object} Returns `object`.
  3630. */
  3631. var baseForRight = createBaseFor(true);
  3632. /**
  3633. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  3634. *
  3635. * @private
  3636. * @param {Object} object The object to iterate over.
  3637. * @param {Function} iteratee The function invoked per iteration.
  3638. * @returns {Object} Returns `object`.
  3639. */
  3640. function baseForOwn(object, iteratee) {
  3641. return object && baseFor(object, iteratee, keys);
  3642. }
  3643. /**
  3644. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  3645. *
  3646. * @private
  3647. * @param {Object} object The object to iterate over.
  3648. * @param {Function} iteratee The function invoked per iteration.
  3649. * @returns {Object} Returns `object`.
  3650. */
  3651. function baseForOwnRight(object, iteratee) {
  3652. return object && baseForRight(object, iteratee, keys);
  3653. }
  3654. /**
  3655. * The base implementation of `_.functions` which creates an array of
  3656. * `object` function property names filtered from `props`.
  3657. *
  3658. * @private
  3659. * @param {Object} object The object to inspect.
  3660. * @param {Array} props The property names to filter.
  3661. * @returns {Array} Returns the function names.
  3662. */
  3663. function baseFunctions(object, props) {
  3664. return arrayFilter(props, function(key) {
  3665. return isFunction(object[key]);
  3666. });
  3667. }
  3668. /**
  3669. * The base implementation of `_.get` without support for default values.
  3670. *
  3671. * @private
  3672. * @param {Object} object The object to query.
  3673. * @param {Array|string} path The path of the property to get.
  3674. * @returns {*} Returns the resolved value.
  3675. */
  3676. function baseGet(object, path) {
  3677. path = castPath(path, object);
  3678. var index = 0,
  3679. length = path.length;
  3680. while (object != null && index < length) {
  3681. object = object[toKey(path[index++])];
  3682. }
  3683. return (index && index == length) ? object : undefined;
  3684. }
  3685. /**
  3686. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  3687. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  3688. * symbols of `object`.
  3689. *
  3690. * @private
  3691. * @param {Object} object The object to query.
  3692. * @param {Function} keysFunc The function to get the keys of `object`.
  3693. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  3694. * @returns {Array} Returns the array of property names and symbols.
  3695. */
  3696. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  3697. var result = keysFunc(object);
  3698. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  3699. }
  3700. /**
  3701. * The base implementation of `getTag` without fallbacks for buggy environments.
  3702. *
  3703. * @private
  3704. * @param {*} value The value to query.
  3705. * @returns {string} Returns the `toStringTag`.
  3706. */
  3707. function baseGetTag(value) {
  3708. if (value == null) {
  3709. return value === undefined ? undefinedTag : nullTag;
  3710. }
  3711. return (symToStringTag && symToStringTag in Object(value))
  3712. ? getRawTag(value)
  3713. : objectToString(value);
  3714. }
  3715. /**
  3716. * The base implementation of `_.gt` which doesn't coerce arguments.
  3717. *
  3718. * @private
  3719. * @param {*} value The value to compare.
  3720. * @param {*} other The other value to compare.
  3721. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  3722. * else `false`.
  3723. */
  3724. function baseGt(value, other) {
  3725. return value > other;
  3726. }
  3727. /**
  3728. * The base implementation of `_.has` without support for deep paths.
  3729. *
  3730. * @private
  3731. * @param {Object} [object] The object to query.
  3732. * @param {Array|string} key The key to check.
  3733. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  3734. */
  3735. function baseHas(object, key) {
  3736. return object != null && hasOwnProperty.call(object, key);
  3737. }
  3738. /**
  3739. * The base implementation of `_.hasIn` without support for deep paths.
  3740. *
  3741. * @private
  3742. * @param {Object} [object] The object to query.
  3743. * @param {Array|string} key The key to check.
  3744. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  3745. */
  3746. function baseHasIn(object, key) {
  3747. return object != null && key in Object(object);
  3748. }
  3749. /**
  3750. * The base implementation of `_.inRange` which doesn't coerce arguments.
  3751. *
  3752. * @private
  3753. * @param {number} number The number to check.
  3754. * @param {number} start The start of the range.
  3755. * @param {number} end The end of the range.
  3756. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  3757. */
  3758. function baseInRange(number, start, end) {
  3759. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  3760. }
  3761. /**
  3762. * The base implementation of methods like `_.intersection`, without support
  3763. * for iteratee shorthands, that accepts an array of arrays to inspect.
  3764. *
  3765. * @private
  3766. * @param {Array} arrays The arrays to inspect.
  3767. * @param {Function} [iteratee] The iteratee invoked per element.
  3768. * @param {Function} [comparator] The comparator invoked per element.
  3769. * @returns {Array} Returns the new array of shared values.
  3770. */
  3771. function baseIntersection(arrays, iteratee, comparator) {
  3772. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  3773. length = arrays[0].length,
  3774. othLength = arrays.length,
  3775. othIndex = othLength,
  3776. caches = Array(othLength),
  3777. maxLength = Infinity,
  3778. result = [];
  3779. while (othIndex--) {
  3780. var array = arrays[othIndex];
  3781. if (othIndex && iteratee) {
  3782. array = arrayMap(array, baseUnary(iteratee));
  3783. }
  3784. maxLength = nativeMin(array.length, maxLength);
  3785. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  3786. ? new SetCache(othIndex && array)
  3787. : undefined;
  3788. }
  3789. array = arrays[0];
  3790. var index = -1,
  3791. seen = caches[0];
  3792. outer:
  3793. while (++index < length && result.length < maxLength) {
  3794. var value = array[index],
  3795. computed = iteratee ? iteratee(value) : value;
  3796. value = (comparator || value !== 0) ? value : 0;
  3797. if (!(seen
  3798. ? cacheHas(seen, computed)
  3799. : includes(result, computed, comparator)
  3800. )) {
  3801. othIndex = othLength;
  3802. while (--othIndex) {
  3803. var cache = caches[othIndex];
  3804. if (!(cache
  3805. ? cacheHas(cache, computed)
  3806. : includes(arrays[othIndex], computed, comparator))
  3807. ) {
  3808. continue outer;
  3809. }
  3810. }
  3811. if (seen) {
  3812. seen.push(computed);
  3813. }
  3814. result.push(value);
  3815. }
  3816. }
  3817. return result;
  3818. }
  3819. /**
  3820. * The base implementation of `_.invert` and `_.invertBy` which inverts
  3821. * `object` with values transformed by `iteratee` and set by `setter`.
  3822. *
  3823. * @private
  3824. * @param {Object} object The object to iterate over.
  3825. * @param {Function} setter The function to set `accumulator` values.
  3826. * @param {Function} iteratee The iteratee to transform values.
  3827. * @param {Object} accumulator The initial inverted object.
  3828. * @returns {Function} Returns `accumulator`.
  3829. */
  3830. function baseInverter(object, setter, iteratee, accumulator) {
  3831. baseForOwn(object, function(value, key, object) {
  3832. setter(accumulator, iteratee(value), key, object);
  3833. });
  3834. return accumulator;
  3835. }
  3836. /**
  3837. * The base implementation of `_.invoke` without support for individual
  3838. * method arguments.
  3839. *
  3840. * @private
  3841. * @param {Object} object The object to query.
  3842. * @param {Array|string} path The path of the method to invoke.
  3843. * @param {Array} args The arguments to invoke the method with.
  3844. * @returns {*} Returns the result of the invoked method.
  3845. */
  3846. function baseInvoke(object, path, args) {
  3847. path = castPath(path, object);
  3848. object = parent(object, path);
  3849. var func = object == null ? object : object[toKey(last(path))];
  3850. return func == null ? undefined : apply(func, object, args);
  3851. }
  3852. /**
  3853. * The base implementation of `_.isArguments`.
  3854. *
  3855. * @private
  3856. * @param {*} value The value to check.
  3857. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  3858. */
  3859. function baseIsArguments(value) {
  3860. return isObjectLike(value) && baseGetTag(value) == argsTag;
  3861. }
  3862. /**
  3863. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  3864. *
  3865. * @private
  3866. * @param {*} value The value to check.
  3867. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  3868. */
  3869. function baseIsArrayBuffer(value) {
  3870. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  3871. }
  3872. /**
  3873. * The base implementation of `_.isDate` without Node.js optimizations.
  3874. *
  3875. * @private
  3876. * @param {*} value The value to check.
  3877. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  3878. */
  3879. function baseIsDate(value) {
  3880. return isObjectLike(value) && baseGetTag(value) == dateTag;
  3881. }
  3882. /**
  3883. * The base implementation of `_.isEqual` which supports partial comparisons
  3884. * and tracks traversed objects.
  3885. *
  3886. * @private
  3887. * @param {*} value The value to compare.
  3888. * @param {*} other The other value to compare.
  3889. * @param {boolean} bitmask The bitmask flags.
  3890. * 1 - Unordered comparison
  3891. * 2 - Partial comparison
  3892. * @param {Function} [customizer] The function to customize comparisons.
  3893. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  3894. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  3895. */
  3896. function baseIsEqual(value, other, bitmask, customizer, stack) {
  3897. if (value === other) {
  3898. return true;
  3899. }
  3900. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  3901. return value !== value && other !== other;
  3902. }
  3903. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  3904. }
  3905. /**
  3906. * A specialized version of `baseIsEqual` for arrays and objects which performs
  3907. * deep comparisons and tracks traversed objects enabling objects with circular
  3908. * references to be compared.
  3909. *
  3910. * @private
  3911. * @param {Object} object The object to compare.
  3912. * @param {Object} other The other object to compare.
  3913. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  3914. * @param {Function} customizer The function to customize comparisons.
  3915. * @param {Function} equalFunc The function to determine equivalents of values.
  3916. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  3917. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  3918. */
  3919. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  3920. var objIsArr = isArray(object),
  3921. othIsArr = isArray(other),
  3922. objTag = objIsArr ? arrayTag : getTag(object),
  3923. othTag = othIsArr ? arrayTag : getTag(other);
  3924. objTag = objTag == argsTag ? objectTag : objTag;
  3925. othTag = othTag == argsTag ? objectTag : othTag;
  3926. var objIsObj = objTag == objectTag,
  3927. othIsObj = othTag == objectTag,
  3928. isSameTag = objTag == othTag;
  3929. if (isSameTag && isBuffer(object)) {
  3930. if (!isBuffer(other)) {
  3931. return false;
  3932. }
  3933. objIsArr = true;
  3934. objIsObj = false;
  3935. }
  3936. if (isSameTag && !objIsObj) {
  3937. stack || (stack = new Stack);
  3938. return (objIsArr || isTypedArray(object))
  3939. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  3940. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  3941. }
  3942. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  3943. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  3944. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  3945. if (objIsWrapped || othIsWrapped) {
  3946. var objUnwrapped = objIsWrapped ? object.value() : object,
  3947. othUnwrapped = othIsWrapped ? other.value() : other;
  3948. stack || (stack = new Stack);
  3949. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  3950. }
  3951. }
  3952. if (!isSameTag) {
  3953. return false;
  3954. }
  3955. stack || (stack = new Stack);
  3956. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  3957. }
  3958. /**
  3959. * The base implementation of `_.isMap` without Node.js optimizations.
  3960. *
  3961. * @private
  3962. * @param {*} value The value to check.
  3963. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  3964. */
  3965. function baseIsMap(value) {
  3966. return isObjectLike(value) && getTag(value) == mapTag;
  3967. }
  3968. /**
  3969. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  3970. *
  3971. * @private
  3972. * @param {Object} object The object to inspect.
  3973. * @param {Object} source The object of property values to match.
  3974. * @param {Array} matchData The property names, values, and compare flags to match.
  3975. * @param {Function} [customizer] The function to customize comparisons.
  3976. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  3977. */
  3978. function baseIsMatch(object, source, matchData, customizer) {
  3979. var index = matchData.length,
  3980. length = index,
  3981. noCustomizer = !customizer;
  3982. if (object == null) {
  3983. return !length;
  3984. }
  3985. object = Object(object);
  3986. while (index--) {
  3987. var data = matchData[index];
  3988. if ((noCustomizer && data[2])
  3989. ? data[1] !== object[data[0]]
  3990. : !(data[0] in object)
  3991. ) {
  3992. return false;
  3993. }
  3994. }
  3995. while (++index < length) {
  3996. data = matchData[index];
  3997. var key = data[0],
  3998. objValue = object[key],
  3999. srcValue = data[1];
  4000. if (noCustomizer && data[2]) {
  4001. if (objValue === undefined && !(key in object)) {
  4002. return false;
  4003. }
  4004. } else {
  4005. var stack = new Stack;
  4006. if (customizer) {
  4007. var result = customizer(objValue, srcValue, key, object, source, stack);
  4008. }
  4009. if (!(result === undefined
  4010. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  4011. : result
  4012. )) {
  4013. return false;
  4014. }
  4015. }
  4016. }
  4017. return true;
  4018. }
  4019. /**
  4020. * The base implementation of `_.isNative` without bad shim checks.
  4021. *
  4022. * @private
  4023. * @param {*} value The value to check.
  4024. * @returns {boolean} Returns `true` if `value` is a native function,
  4025. * else `false`.
  4026. */
  4027. function baseIsNative(value) {
  4028. if (!isObject(value) || isMasked(value)) {
  4029. return false;
  4030. }
  4031. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  4032. return pattern.test(toSource(value));
  4033. }
  4034. /**
  4035. * The base implementation of `_.isRegExp` without Node.js optimizations.
  4036. *
  4037. * @private
  4038. * @param {*} value The value to check.
  4039. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  4040. */
  4041. function baseIsRegExp(value) {
  4042. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  4043. }
  4044. /**
  4045. * The base implementation of `_.isSet` without Node.js optimizations.
  4046. *
  4047. * @private
  4048. * @param {*} value The value to check.
  4049. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  4050. */
  4051. function baseIsSet(value) {
  4052. return isObjectLike(value) && getTag(value) == setTag;
  4053. }
  4054. /**
  4055. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  4056. *
  4057. * @private
  4058. * @param {*} value The value to check.
  4059. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  4060. */
  4061. function baseIsTypedArray(value) {
  4062. return isObjectLike(value) &&
  4063. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  4064. }
  4065. /**
  4066. * The base implementation of `_.iteratee`.
  4067. *
  4068. * @private
  4069. * @param {*} [value=_.identity] The value to convert to an iteratee.
  4070. * @returns {Function} Returns the iteratee.
  4071. */
  4072. function baseIteratee(value) {
  4073. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  4074. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  4075. if (typeof value == 'function') {
  4076. return value;
  4077. }
  4078. if (value == null) {
  4079. return identity;
  4080. }
  4081. if (typeof value == 'object') {
  4082. return isArray(value)
  4083. ? baseMatchesProperty(value[0], value[1])
  4084. : baseMatches(value);
  4085. }
  4086. return property(value);
  4087. }
  4088. /**
  4089. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  4090. *
  4091. * @private
  4092. * @param {Object} object The object to query.
  4093. * @returns {Array} Returns the array of property names.
  4094. */
  4095. function baseKeys(object) {
  4096. if (!isPrototype(object)) {
  4097. return nativeKeys(object);
  4098. }
  4099. var result = [];
  4100. for (var key in Object(object)) {
  4101. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  4102. result.push(key);
  4103. }
  4104. }
  4105. return result;
  4106. }
  4107. /**
  4108. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  4109. *
  4110. * @private
  4111. * @param {Object} object The object to query.
  4112. * @returns {Array} Returns the array of property names.
  4113. */
  4114. function baseKeysIn(object) {
  4115. if (!isObject(object)) {
  4116. return nativeKeysIn(object);
  4117. }
  4118. var isProto = isPrototype(object),
  4119. result = [];
  4120. for (var key in object) {
  4121. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  4122. result.push(key);
  4123. }
  4124. }
  4125. return result;
  4126. }
  4127. /**
  4128. * The base implementation of `_.lt` which doesn't coerce arguments.
  4129. *
  4130. * @private
  4131. * @param {*} value The value to compare.
  4132. * @param {*} other The other value to compare.
  4133. * @returns {boolean} Returns `true` if `value` is less than `other`,
  4134. * else `false`.
  4135. */
  4136. function baseLt(value, other) {
  4137. return value < other;
  4138. }
  4139. /**
  4140. * The base implementation of `_.map` without support for iteratee shorthands.
  4141. *
  4142. * @private
  4143. * @param {Array|Object} collection The collection to iterate over.
  4144. * @param {Function} iteratee The function invoked per iteration.
  4145. * @returns {Array} Returns the new mapped array.
  4146. */
  4147. function baseMap(collection, iteratee) {
  4148. var index = -1,
  4149. result = isArrayLike(collection) ? Array(collection.length) : [];
  4150. baseEach(collection, function(value, key, collection) {
  4151. result[++index] = iteratee(value, key, collection);
  4152. });
  4153. return result;
  4154. }
  4155. /**
  4156. * The base implementation of `_.matches` which doesn't clone `source`.
  4157. *
  4158. * @private
  4159. * @param {Object} source The object of property values to match.
  4160. * @returns {Function} Returns the new spec function.
  4161. */
  4162. function baseMatches(source) {
  4163. var matchData = getMatchData(source);
  4164. if (matchData.length == 1 && matchData[0][2]) {
  4165. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  4166. }
  4167. return function(object) {
  4168. return object === source || baseIsMatch(object, source, matchData);
  4169. };
  4170. }
  4171. /**
  4172. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  4173. *
  4174. * @private
  4175. * @param {string} path The path of the property to get.
  4176. * @param {*} srcValue The value to match.
  4177. * @returns {Function} Returns the new spec function.
  4178. */
  4179. function baseMatchesProperty(path, srcValue) {
  4180. if (isKey(path) && isStrictComparable(srcValue)) {
  4181. return matchesStrictComparable(toKey(path), srcValue);
  4182. }
  4183. return function(object) {
  4184. var objValue = get(object, path);
  4185. return (objValue === undefined && objValue === srcValue)
  4186. ? hasIn(object, path)
  4187. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  4188. };
  4189. }
  4190. /**
  4191. * The base implementation of `_.merge` without support for multiple sources.
  4192. *
  4193. * @private
  4194. * @param {Object} object The destination object.
  4195. * @param {Object} source The source object.
  4196. * @param {number} srcIndex The index of `source`.
  4197. * @param {Function} [customizer] The function to customize merged values.
  4198. * @param {Object} [stack] Tracks traversed source values and their merged
  4199. * counterparts.
  4200. */
  4201. function baseMerge(object, source, srcIndex, customizer, stack) {
  4202. if (object === source) {
  4203. return;
  4204. }
  4205. baseFor(source, function(srcValue, key) {
  4206. stack || (stack = new Stack);
  4207. if (isObject(srcValue)) {
  4208. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  4209. }
  4210. else {
  4211. var newValue = customizer
  4212. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  4213. : undefined;
  4214. if (newValue === undefined) {
  4215. newValue = srcValue;
  4216. }
  4217. assignMergeValue(object, key, newValue);
  4218. }
  4219. }, keysIn);
  4220. }
  4221. /**
  4222. * A specialized version of `baseMerge` for arrays and objects which performs
  4223. * deep merges and tracks traversed objects enabling objects with circular
  4224. * references to be merged.
  4225. *
  4226. * @private
  4227. * @param {Object} object The destination object.
  4228. * @param {Object} source The source object.
  4229. * @param {string} key The key of the value to merge.
  4230. * @param {number} srcIndex The index of `source`.
  4231. * @param {Function} mergeFunc The function to merge values.
  4232. * @param {Function} [customizer] The function to customize assigned values.
  4233. * @param {Object} [stack] Tracks traversed source values and their merged
  4234. * counterparts.
  4235. */
  4236. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  4237. var objValue = safeGet(object, key),
  4238. srcValue = safeGet(source, key),
  4239. stacked = stack.get(srcValue);
  4240. if (stacked) {
  4241. assignMergeValue(object, key, stacked);
  4242. return;
  4243. }
  4244. var newValue = customizer
  4245. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  4246. : undefined;
  4247. var isCommon = newValue === undefined;
  4248. if (isCommon) {
  4249. var isArr = isArray(srcValue),
  4250. isBuff = !isArr && isBuffer(srcValue),
  4251. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  4252. newValue = srcValue;
  4253. if (isArr || isBuff || isTyped) {
  4254. if (isArray(objValue)) {
  4255. newValue = objValue;
  4256. }
  4257. else if (isArrayLikeObject(objValue)) {
  4258. newValue = copyArray(objValue);
  4259. }
  4260. else if (isBuff) {
  4261. isCommon = false;
  4262. newValue = cloneBuffer(srcValue, true);
  4263. }
  4264. else if (isTyped) {
  4265. isCommon = false;
  4266. newValue = cloneTypedArray(srcValue, true);
  4267. }
  4268. else {
  4269. newValue = [];
  4270. }
  4271. }
  4272. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  4273. newValue = objValue;
  4274. if (isArguments(objValue)) {
  4275. newValue = toPlainObject(objValue);
  4276. }
  4277. else if (!isObject(objValue) || isFunction(objValue)) {
  4278. newValue = initCloneObject(srcValue);
  4279. }
  4280. }
  4281. else {
  4282. isCommon = false;
  4283. }
  4284. }
  4285. if (isCommon) {
  4286. // Recursively merge objects and arrays (susceptible to call stack limits).
  4287. stack.set(srcValue, newValue);
  4288. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  4289. stack['delete'](srcValue);
  4290. }
  4291. assignMergeValue(object, key, newValue);
  4292. }
  4293. /**
  4294. * The base implementation of `_.nth` which doesn't coerce arguments.
  4295. *
  4296. * @private
  4297. * @param {Array} array The array to query.
  4298. * @param {number} n The index of the element to return.
  4299. * @returns {*} Returns the nth element of `array`.
  4300. */
  4301. function baseNth(array, n) {
  4302. var length = array.length;
  4303. if (!length) {
  4304. return;
  4305. }
  4306. n += n < 0 ? length : 0;
  4307. return isIndex(n, length) ? array[n] : undefined;
  4308. }
  4309. /**
  4310. * The base implementation of `_.orderBy` without param guards.
  4311. *
  4312. * @private
  4313. * @param {Array|Object} collection The collection to iterate over.
  4314. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  4315. * @param {string[]} orders The sort orders of `iteratees`.
  4316. * @returns {Array} Returns the new sorted array.
  4317. */
  4318. function baseOrderBy(collection, iteratees, orders) {
  4319. if (iteratees.length) {
  4320. iteratees = arrayMap(iteratees, function(iteratee) {
  4321. if (isArray(iteratee)) {
  4322. return function(value) {
  4323. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  4324. }
  4325. }
  4326. return iteratee;
  4327. });
  4328. } else {
  4329. iteratees = [identity];
  4330. }
  4331. var index = -1;
  4332. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  4333. var result = baseMap(collection, function(value, key, collection) {
  4334. var criteria = arrayMap(iteratees, function(iteratee) {
  4335. return iteratee(value);
  4336. });
  4337. return { 'criteria': criteria, 'index': ++index, 'value': value };
  4338. });
  4339. return baseSortBy(result, function(object, other) {
  4340. return compareMultiple(object, other, orders);
  4341. });
  4342. }
  4343. /**
  4344. * The base implementation of `_.pick` without support for individual
  4345. * property identifiers.
  4346. *
  4347. * @private
  4348. * @param {Object} object The source object.
  4349. * @param {string[]} paths The property paths to pick.
  4350. * @returns {Object} Returns the new object.
  4351. */
  4352. function basePick(object, paths) {
  4353. return basePickBy(object, paths, function(value, path) {
  4354. return hasIn(object, path);
  4355. });
  4356. }
  4357. /**
  4358. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  4359. *
  4360. * @private
  4361. * @param {Object} object The source object.
  4362. * @param {string[]} paths The property paths to pick.
  4363. * @param {Function} predicate The function invoked per property.
  4364. * @returns {Object} Returns the new object.
  4365. */
  4366. function basePickBy(object, paths, predicate) {
  4367. var index = -1,
  4368. length = paths.length,
  4369. result = {};
  4370. while (++index < length) {
  4371. var path = paths[index],
  4372. value = baseGet(object, path);
  4373. if (predicate(value, path)) {
  4374. baseSet(result, castPath(path, object), value);
  4375. }
  4376. }
  4377. return result;
  4378. }
  4379. /**
  4380. * A specialized version of `baseProperty` which supports deep paths.
  4381. *
  4382. * @private
  4383. * @param {Array|string} path The path of the property to get.
  4384. * @returns {Function} Returns the new accessor function.
  4385. */
  4386. function basePropertyDeep(path) {
  4387. return function(object) {
  4388. return baseGet(object, path);
  4389. };
  4390. }
  4391. /**
  4392. * The base implementation of `_.pullAllBy` without support for iteratee
  4393. * shorthands.
  4394. *
  4395. * @private
  4396. * @param {Array} array The array to modify.
  4397. * @param {Array} values The values to remove.
  4398. * @param {Function} [iteratee] The iteratee invoked per element.
  4399. * @param {Function} [comparator] The comparator invoked per element.
  4400. * @returns {Array} Returns `array`.
  4401. */
  4402. function basePullAll(array, values, iteratee, comparator) {
  4403. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  4404. index = -1,
  4405. length = values.length,
  4406. seen = array;
  4407. if (array === values) {
  4408. values = copyArray(values);
  4409. }
  4410. if (iteratee) {
  4411. seen = arrayMap(array, baseUnary(iteratee));
  4412. }
  4413. while (++index < length) {
  4414. var fromIndex = 0,
  4415. value = values[index],
  4416. computed = iteratee ? iteratee(value) : value;
  4417. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  4418. if (seen !== array) {
  4419. splice.call(seen, fromIndex, 1);
  4420. }
  4421. splice.call(array, fromIndex, 1);
  4422. }
  4423. }
  4424. return array;
  4425. }
  4426. /**
  4427. * The base implementation of `_.pullAt` without support for individual
  4428. * indexes or capturing the removed elements.
  4429. *
  4430. * @private
  4431. * @param {Array} array The array to modify.
  4432. * @param {number[]} indexes The indexes of elements to remove.
  4433. * @returns {Array} Returns `array`.
  4434. */
  4435. function basePullAt(array, indexes) {
  4436. var length = array ? indexes.length : 0,
  4437. lastIndex = length - 1;
  4438. while (length--) {
  4439. var index = indexes[length];
  4440. if (length == lastIndex || index !== previous) {
  4441. var previous = index;
  4442. if (isIndex(index)) {
  4443. splice.call(array, index, 1);
  4444. } else {
  4445. baseUnset(array, index);
  4446. }
  4447. }
  4448. }
  4449. return array;
  4450. }
  4451. /**
  4452. * The base implementation of `_.random` without support for returning
  4453. * floating-point numbers.
  4454. *
  4455. * @private
  4456. * @param {number} lower The lower bound.
  4457. * @param {number} upper The upper bound.
  4458. * @returns {number} Returns the random number.
  4459. */
  4460. function baseRandom(lower, upper) {
  4461. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  4462. }
  4463. /**
  4464. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  4465. * coerce arguments.
  4466. *
  4467. * @private
  4468. * @param {number} start The start of the range.
  4469. * @param {number} end The end of the range.
  4470. * @param {number} step The value to increment or decrement by.
  4471. * @param {boolean} [fromRight] Specify iterating from right to left.
  4472. * @returns {Array} Returns the range of numbers.
  4473. */
  4474. function baseRange(start, end, step, fromRight) {
  4475. var index = -1,
  4476. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  4477. result = Array(length);
  4478. while (length--) {
  4479. result[fromRight ? length : ++index] = start;
  4480. start += step;
  4481. }
  4482. return result;
  4483. }
  4484. /**
  4485. * The base implementation of `_.repeat` which doesn't coerce arguments.
  4486. *
  4487. * @private
  4488. * @param {string} string The string to repeat.
  4489. * @param {number} n The number of times to repeat the string.
  4490. * @returns {string} Returns the repeated string.
  4491. */
  4492. function baseRepeat(string, n) {
  4493. var result = '';
  4494. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  4495. return result;
  4496. }
  4497. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  4498. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  4499. do {
  4500. if (n % 2) {
  4501. result += string;
  4502. }
  4503. n = nativeFloor(n / 2);
  4504. if (n) {
  4505. string += string;
  4506. }
  4507. } while (n);
  4508. return result;
  4509. }
  4510. /**
  4511. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  4512. *
  4513. * @private
  4514. * @param {Function} func The function to apply a rest parameter to.
  4515. * @param {number} [start=func.length-1] The start position of the rest parameter.
  4516. * @returns {Function} Returns the new function.
  4517. */
  4518. function baseRest(func, start) {
  4519. return setToString(overRest(func, start, identity), func + '');
  4520. }
  4521. /**
  4522. * The base implementation of `_.sample`.
  4523. *
  4524. * @private
  4525. * @param {Array|Object} collection The collection to sample.
  4526. * @returns {*} Returns the random element.
  4527. */
  4528. function baseSample(collection) {
  4529. return arraySample(values(collection));
  4530. }
  4531. /**
  4532. * The base implementation of `_.sampleSize` without param guards.
  4533. *
  4534. * @private
  4535. * @param {Array|Object} collection The collection to sample.
  4536. * @param {number} n The number of elements to sample.
  4537. * @returns {Array} Returns the random elements.
  4538. */
  4539. function baseSampleSize(collection, n) {
  4540. var array = values(collection);
  4541. return shuffleSelf(array, baseClamp(n, 0, array.length));
  4542. }
  4543. /**
  4544. * The base implementation of `_.set`.
  4545. *
  4546. * @private
  4547. * @param {Object} object The object to modify.
  4548. * @param {Array|string} path The path of the property to set.
  4549. * @param {*} value The value to set.
  4550. * @param {Function} [customizer] The function to customize path creation.
  4551. * @returns {Object} Returns `object`.
  4552. */
  4553. function baseSet(object, path, value, customizer) {
  4554. if (!isObject(object)) {
  4555. return object;
  4556. }
  4557. path = castPath(path, object);
  4558. var index = -1,
  4559. length = path.length,
  4560. lastIndex = length - 1,
  4561. nested = object;
  4562. while (nested != null && ++index < length) {
  4563. var key = toKey(path[index]),
  4564. newValue = value;
  4565. if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
  4566. return object;
  4567. }
  4568. if (index != lastIndex) {
  4569. var objValue = nested[key];
  4570. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  4571. if (newValue === undefined) {
  4572. newValue = isObject(objValue)
  4573. ? objValue
  4574. : (isIndex(path[index + 1]) ? [] : {});
  4575. }
  4576. }
  4577. assignValue(nested, key, newValue);
  4578. nested = nested[key];
  4579. }
  4580. return object;
  4581. }
  4582. /**
  4583. * The base implementation of `setData` without support for hot loop shorting.
  4584. *
  4585. * @private
  4586. * @param {Function} func The function to associate metadata with.
  4587. * @param {*} data The metadata.
  4588. * @returns {Function} Returns `func`.
  4589. */
  4590. var baseSetData = !metaMap ? identity : function(func, data) {
  4591. metaMap.set(func, data);
  4592. return func;
  4593. };
  4594. /**
  4595. * The base implementation of `setToString` without support for hot loop shorting.
  4596. *
  4597. * @private
  4598. * @param {Function} func The function to modify.
  4599. * @param {Function} string The `toString` result.
  4600. * @returns {Function} Returns `func`.
  4601. */
  4602. var baseSetToString = !defineProperty ? identity : function(func, string) {
  4603. return defineProperty(func, 'toString', {
  4604. 'configurable': true,
  4605. 'enumerable': false,
  4606. 'value': constant(string),
  4607. 'writable': true
  4608. });
  4609. };
  4610. /**
  4611. * The base implementation of `_.shuffle`.
  4612. *
  4613. * @private
  4614. * @param {Array|Object} collection The collection to shuffle.
  4615. * @returns {Array} Returns the new shuffled array.
  4616. */
  4617. function baseShuffle(collection) {
  4618. return shuffleSelf(values(collection));
  4619. }
  4620. /**
  4621. * The base implementation of `_.slice` without an iteratee call guard.
  4622. *
  4623. * @private
  4624. * @param {Array} array The array to slice.
  4625. * @param {number} [start=0] The start position.
  4626. * @param {number} [end=array.length] The end position.
  4627. * @returns {Array} Returns the slice of `array`.
  4628. */
  4629. function baseSlice(array, start, end) {
  4630. var index = -1,
  4631. length = array.length;
  4632. if (start < 0) {
  4633. start = -start > length ? 0 : (length + start);
  4634. }
  4635. end = end > length ? length : end;
  4636. if (end < 0) {
  4637. end += length;
  4638. }
  4639. length = start > end ? 0 : ((end - start) >>> 0);
  4640. start >>>= 0;
  4641. var result = Array(length);
  4642. while (++index < length) {
  4643. result[index] = array[index + start];
  4644. }
  4645. return result;
  4646. }
  4647. /**
  4648. * The base implementation of `_.some` without support for iteratee shorthands.
  4649. *
  4650. * @private
  4651. * @param {Array|Object} collection The collection to iterate over.
  4652. * @param {Function} predicate The function invoked per iteration.
  4653. * @returns {boolean} Returns `true` if any element passes the predicate check,
  4654. * else `false`.
  4655. */
  4656. function baseSome(collection, predicate) {
  4657. var result;
  4658. baseEach(collection, function(value, index, collection) {
  4659. result = predicate(value, index, collection);
  4660. return !result;
  4661. });
  4662. return !!result;
  4663. }
  4664. /**
  4665. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  4666. * performs a binary search of `array` to determine the index at which `value`
  4667. * should be inserted into `array` in order to maintain its sort order.
  4668. *
  4669. * @private
  4670. * @param {Array} array The sorted array to inspect.
  4671. * @param {*} value The value to evaluate.
  4672. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  4673. * @returns {number} Returns the index at which `value` should be inserted
  4674. * into `array`.
  4675. */
  4676. function baseSortedIndex(array, value, retHighest) {
  4677. var low = 0,
  4678. high = array == null ? low : array.length;
  4679. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  4680. while (low < high) {
  4681. var mid = (low + high) >>> 1,
  4682. computed = array[mid];
  4683. if (computed !== null && !isSymbol(computed) &&
  4684. (retHighest ? (computed <= value) : (computed < value))) {
  4685. low = mid + 1;
  4686. } else {
  4687. high = mid;
  4688. }
  4689. }
  4690. return high;
  4691. }
  4692. return baseSortedIndexBy(array, value, identity, retHighest);
  4693. }
  4694. /**
  4695. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  4696. * which invokes `iteratee` for `value` and each element of `array` to compute
  4697. * their sort ranking. The iteratee is invoked with one argument; (value).
  4698. *
  4699. * @private
  4700. * @param {Array} array The sorted array to inspect.
  4701. * @param {*} value The value to evaluate.
  4702. * @param {Function} iteratee The iteratee invoked per element.
  4703. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  4704. * @returns {number} Returns the index at which `value` should be inserted
  4705. * into `array`.
  4706. */
  4707. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  4708. var low = 0,
  4709. high = array == null ? 0 : array.length;
  4710. if (high === 0) {
  4711. return 0;
  4712. }
  4713. value = iteratee(value);
  4714. var valIsNaN = value !== value,
  4715. valIsNull = value === null,
  4716. valIsSymbol = isSymbol(value),
  4717. valIsUndefined = value === undefined;
  4718. while (low < high) {
  4719. var mid = nativeFloor((low + high) / 2),
  4720. computed = iteratee(array[mid]),
  4721. othIsDefined = computed !== undefined,
  4722. othIsNull = computed === null,
  4723. othIsReflexive = computed === computed,
  4724. othIsSymbol = isSymbol(computed);
  4725. if (valIsNaN) {
  4726. var setLow = retHighest || othIsReflexive;
  4727. } else if (valIsUndefined) {
  4728. setLow = othIsReflexive && (retHighest || othIsDefined);
  4729. } else if (valIsNull) {
  4730. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  4731. } else if (valIsSymbol) {
  4732. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  4733. } else if (othIsNull || othIsSymbol) {
  4734. setLow = false;
  4735. } else {
  4736. setLow = retHighest ? (computed <= value) : (computed < value);
  4737. }
  4738. if (setLow) {
  4739. low = mid + 1;
  4740. } else {
  4741. high = mid;
  4742. }
  4743. }
  4744. return nativeMin(high, MAX_ARRAY_INDEX);
  4745. }
  4746. /**
  4747. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  4748. * support for iteratee shorthands.
  4749. *
  4750. * @private
  4751. * @param {Array} array The array to inspect.
  4752. * @param {Function} [iteratee] The iteratee invoked per element.
  4753. * @returns {Array} Returns the new duplicate free array.
  4754. */
  4755. function baseSortedUniq(array, iteratee) {
  4756. var index = -1,
  4757. length = array.length,
  4758. resIndex = 0,
  4759. result = [];
  4760. while (++index < length) {
  4761. var value = array[index],
  4762. computed = iteratee ? iteratee(value) : value;
  4763. if (!index || !eq(computed, seen)) {
  4764. var seen = computed;
  4765. result[resIndex++] = value === 0 ? 0 : value;
  4766. }
  4767. }
  4768. return result;
  4769. }
  4770. /**
  4771. * The base implementation of `_.toNumber` which doesn't ensure correct
  4772. * conversions of binary, hexadecimal, or octal string values.
  4773. *
  4774. * @private
  4775. * @param {*} value The value to process.
  4776. * @returns {number} Returns the number.
  4777. */
  4778. function baseToNumber(value) {
  4779. if (typeof value == 'number') {
  4780. return value;
  4781. }
  4782. if (isSymbol(value)) {
  4783. return NAN;
  4784. }
  4785. return +value;
  4786. }
  4787. /**
  4788. * The base implementation of `_.toString` which doesn't convert nullish
  4789. * values to empty strings.
  4790. *
  4791. * @private
  4792. * @param {*} value The value to process.
  4793. * @returns {string} Returns the string.
  4794. */
  4795. function baseToString(value) {
  4796. // Exit early for strings to avoid a performance hit in some environments.
  4797. if (typeof value == 'string') {
  4798. return value;
  4799. }
  4800. if (isArray(value)) {
  4801. // Recursively convert values (susceptible to call stack limits).
  4802. return arrayMap(value, baseToString) + '';
  4803. }
  4804. if (isSymbol(value)) {
  4805. return symbolToString ? symbolToString.call(value) : '';
  4806. }
  4807. var result = (value + '');
  4808. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  4809. }
  4810. /**
  4811. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  4812. *
  4813. * @private
  4814. * @param {Array} array The array to inspect.
  4815. * @param {Function} [iteratee] The iteratee invoked per element.
  4816. * @param {Function} [comparator] The comparator invoked per element.
  4817. * @returns {Array} Returns the new duplicate free array.
  4818. */
  4819. function baseUniq(array, iteratee, comparator) {
  4820. var index = -1,
  4821. includes = arrayIncludes,
  4822. length = array.length,
  4823. isCommon = true,
  4824. result = [],
  4825. seen = result;
  4826. if (comparator) {
  4827. isCommon = false;
  4828. includes = arrayIncludesWith;
  4829. }
  4830. else if (length >= LARGE_ARRAY_SIZE) {
  4831. var set = iteratee ? null : createSet(array);
  4832. if (set) {
  4833. return setToArray(set);
  4834. }
  4835. isCommon = false;
  4836. includes = cacheHas;
  4837. seen = new SetCache;
  4838. }
  4839. else {
  4840. seen = iteratee ? [] : result;
  4841. }
  4842. outer:
  4843. while (++index < length) {
  4844. var value = array[index],
  4845. computed = iteratee ? iteratee(value) : value;
  4846. value = (comparator || value !== 0) ? value : 0;
  4847. if (isCommon && computed === computed) {
  4848. var seenIndex = seen.length;
  4849. while (seenIndex--) {
  4850. if (seen[seenIndex] === computed) {
  4851. continue outer;
  4852. }
  4853. }
  4854. if (iteratee) {
  4855. seen.push(computed);
  4856. }
  4857. result.push(value);
  4858. }
  4859. else if (!includes(seen, computed, comparator)) {
  4860. if (seen !== result) {
  4861. seen.push(computed);
  4862. }
  4863. result.push(value);
  4864. }
  4865. }
  4866. return result;
  4867. }
  4868. /**
  4869. * The base implementation of `_.unset`.
  4870. *
  4871. * @private
  4872. * @param {Object} object The object to modify.
  4873. * @param {Array|string} path The property path to unset.
  4874. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  4875. */
  4876. function baseUnset(object, path) {
  4877. path = castPath(path, object);
  4878. object = parent(object, path);
  4879. return object == null || delete object[toKey(last(path))];
  4880. }
  4881. /**
  4882. * The base implementation of `_.update`.
  4883. *
  4884. * @private
  4885. * @param {Object} object The object to modify.
  4886. * @param {Array|string} path The path of the property to update.
  4887. * @param {Function} updater The function to produce the updated value.
  4888. * @param {Function} [customizer] The function to customize path creation.
  4889. * @returns {Object} Returns `object`.
  4890. */
  4891. function baseUpdate(object, path, updater, customizer) {
  4892. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  4893. }
  4894. /**
  4895. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  4896. * without support for iteratee shorthands.
  4897. *
  4898. * @private
  4899. * @param {Array} array The array to query.
  4900. * @param {Function} predicate The function invoked per iteration.
  4901. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  4902. * @param {boolean} [fromRight] Specify iterating from right to left.
  4903. * @returns {Array} Returns the slice of `array`.
  4904. */
  4905. function baseWhile(array, predicate, isDrop, fromRight) {
  4906. var length = array.length,
  4907. index = fromRight ? length : -1;
  4908. while ((fromRight ? index-- : ++index < length) &&
  4909. predicate(array[index], index, array)) {}
  4910. return isDrop
  4911. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  4912. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  4913. }
  4914. /**
  4915. * The base implementation of `wrapperValue` which returns the result of
  4916. * performing a sequence of actions on the unwrapped `value`, where each
  4917. * successive action is supplied the return value of the previous.
  4918. *
  4919. * @private
  4920. * @param {*} value The unwrapped value.
  4921. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  4922. * @returns {*} Returns the resolved value.
  4923. */
  4924. function baseWrapperValue(value, actions) {
  4925. var result = value;
  4926. if (result instanceof LazyWrapper) {
  4927. result = result.value();
  4928. }
  4929. return arrayReduce(actions, function(result, action) {
  4930. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  4931. }, result);
  4932. }
  4933. /**
  4934. * The base implementation of methods like `_.xor`, without support for
  4935. * iteratee shorthands, that accepts an array of arrays to inspect.
  4936. *
  4937. * @private
  4938. * @param {Array} arrays The arrays to inspect.
  4939. * @param {Function} [iteratee] The iteratee invoked per element.
  4940. * @param {Function} [comparator] The comparator invoked per element.
  4941. * @returns {Array} Returns the new array of values.
  4942. */
  4943. function baseXor(arrays, iteratee, comparator) {
  4944. var length = arrays.length;
  4945. if (length < 2) {
  4946. return length ? baseUniq(arrays[0]) : [];
  4947. }
  4948. var index = -1,
  4949. result = Array(length);
  4950. while (++index < length) {
  4951. var array = arrays[index],
  4952. othIndex = -1;
  4953. while (++othIndex < length) {
  4954. if (othIndex != index) {
  4955. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  4956. }
  4957. }
  4958. }
  4959. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  4960. }
  4961. /**
  4962. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  4963. *
  4964. * @private
  4965. * @param {Array} props The property identifiers.
  4966. * @param {Array} values The property values.
  4967. * @param {Function} assignFunc The function to assign values.
  4968. * @returns {Object} Returns the new object.
  4969. */
  4970. function baseZipObject(props, values, assignFunc) {
  4971. var index = -1,
  4972. length = props.length,
  4973. valsLength = values.length,
  4974. result = {};
  4975. while (++index < length) {
  4976. var value = index < valsLength ? values[index] : undefined;
  4977. assignFunc(result, props[index], value);
  4978. }
  4979. return result;
  4980. }
  4981. /**
  4982. * Casts `value` to an empty array if it's not an array like object.
  4983. *
  4984. * @private
  4985. * @param {*} value The value to inspect.
  4986. * @returns {Array|Object} Returns the cast array-like object.
  4987. */
  4988. function castArrayLikeObject(value) {
  4989. return isArrayLikeObject(value) ? value : [];
  4990. }
  4991. /**
  4992. * Casts `value` to `identity` if it's not a function.
  4993. *
  4994. * @private
  4995. * @param {*} value The value to inspect.
  4996. * @returns {Function} Returns cast function.
  4997. */
  4998. function castFunction(value) {
  4999. return typeof value == 'function' ? value : identity;
  5000. }
  5001. /**
  5002. * Casts `value` to a path array if it's not one.
  5003. *
  5004. * @private
  5005. * @param {*} value The value to inspect.
  5006. * @param {Object} [object] The object to query keys on.
  5007. * @returns {Array} Returns the cast property path array.
  5008. */
  5009. function castPath(value, object) {
  5010. if (isArray(value)) {
  5011. return value;
  5012. }
  5013. return isKey(value, object) ? [value] : stringToPath(toString(value));
  5014. }
  5015. /**
  5016. * A `baseRest` alias which can be replaced with `identity` by module
  5017. * replacement plugins.
  5018. *
  5019. * @private
  5020. * @type {Function}
  5021. * @param {Function} func The function to apply a rest parameter to.
  5022. * @returns {Function} Returns the new function.
  5023. */
  5024. var castRest = baseRest;
  5025. /**
  5026. * Casts `array` to a slice if it's needed.
  5027. *
  5028. * @private
  5029. * @param {Array} array The array to inspect.
  5030. * @param {number} start The start position.
  5031. * @param {number} [end=array.length] The end position.
  5032. * @returns {Array} Returns the cast slice.
  5033. */
  5034. function castSlice(array, start, end) {
  5035. var length = array.length;
  5036. end = end === undefined ? length : end;
  5037. return (!start && end >= length) ? array : baseSlice(array, start, end);
  5038. }
  5039. /**
  5040. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  5041. *
  5042. * @private
  5043. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  5044. */
  5045. var clearTimeout = ctxClearTimeout || function(id) {
  5046. return root.clearTimeout(id);
  5047. };
  5048. /**
  5049. * Creates a clone of `buffer`.
  5050. *
  5051. * @private
  5052. * @param {Buffer} buffer The buffer to clone.
  5053. * @param {boolean} [isDeep] Specify a deep clone.
  5054. * @returns {Buffer} Returns the cloned buffer.
  5055. */
  5056. function cloneBuffer(buffer, isDeep) {
  5057. if (isDeep) {
  5058. return buffer.slice();
  5059. }
  5060. var length = buffer.length,
  5061. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  5062. buffer.copy(result);
  5063. return result;
  5064. }
  5065. /**
  5066. * Creates a clone of `arrayBuffer`.
  5067. *
  5068. * @private
  5069. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  5070. * @returns {ArrayBuffer} Returns the cloned array buffer.
  5071. */
  5072. function cloneArrayBuffer(arrayBuffer) {
  5073. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  5074. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  5075. return result;
  5076. }
  5077. /**
  5078. * Creates a clone of `dataView`.
  5079. *
  5080. * @private
  5081. * @param {Object} dataView The data view to clone.
  5082. * @param {boolean} [isDeep] Specify a deep clone.
  5083. * @returns {Object} Returns the cloned data view.
  5084. */
  5085. function cloneDataView(dataView, isDeep) {
  5086. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  5087. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  5088. }
  5089. /**
  5090. * Creates a clone of `regexp`.
  5091. *
  5092. * @private
  5093. * @param {Object} regexp The regexp to clone.
  5094. * @returns {Object} Returns the cloned regexp.
  5095. */
  5096. function cloneRegExp(regexp) {
  5097. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  5098. result.lastIndex = regexp.lastIndex;
  5099. return result;
  5100. }
  5101. /**
  5102. * Creates a clone of the `symbol` object.
  5103. *
  5104. * @private
  5105. * @param {Object} symbol The symbol object to clone.
  5106. * @returns {Object} Returns the cloned symbol object.
  5107. */
  5108. function cloneSymbol(symbol) {
  5109. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  5110. }
  5111. /**
  5112. * Creates a clone of `typedArray`.
  5113. *
  5114. * @private
  5115. * @param {Object} typedArray The typed array to clone.
  5116. * @param {boolean} [isDeep] Specify a deep clone.
  5117. * @returns {Object} Returns the cloned typed array.
  5118. */
  5119. function cloneTypedArray(typedArray, isDeep) {
  5120. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  5121. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  5122. }
  5123. /**
  5124. * Compares values to sort them in ascending order.
  5125. *
  5126. * @private
  5127. * @param {*} value The value to compare.
  5128. * @param {*} other The other value to compare.
  5129. * @returns {number} Returns the sort order indicator for `value`.
  5130. */
  5131. function compareAscending(value, other) {
  5132. if (value !== other) {
  5133. var valIsDefined = value !== undefined,
  5134. valIsNull = value === null,
  5135. valIsReflexive = value === value,
  5136. valIsSymbol = isSymbol(value);
  5137. var othIsDefined = other !== undefined,
  5138. othIsNull = other === null,
  5139. othIsReflexive = other === other,
  5140. othIsSymbol = isSymbol(other);
  5141. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  5142. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  5143. (valIsNull && othIsDefined && othIsReflexive) ||
  5144. (!valIsDefined && othIsReflexive) ||
  5145. !valIsReflexive) {
  5146. return 1;
  5147. }
  5148. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  5149. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  5150. (othIsNull && valIsDefined && valIsReflexive) ||
  5151. (!othIsDefined && valIsReflexive) ||
  5152. !othIsReflexive) {
  5153. return -1;
  5154. }
  5155. }
  5156. return 0;
  5157. }
  5158. /**
  5159. * Used by `_.orderBy` to compare multiple properties of a value to another
  5160. * and stable sort them.
  5161. *
  5162. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  5163. * specify an order of "desc" for descending or "asc" for ascending sort order
  5164. * of corresponding values.
  5165. *
  5166. * @private
  5167. * @param {Object} object The object to compare.
  5168. * @param {Object} other The other object to compare.
  5169. * @param {boolean[]|string[]} orders The order to sort by for each property.
  5170. * @returns {number} Returns the sort order indicator for `object`.
  5171. */
  5172. function compareMultiple(object, other, orders) {
  5173. var index = -1,
  5174. objCriteria = object.criteria,
  5175. othCriteria = other.criteria,
  5176. length = objCriteria.length,
  5177. ordersLength = orders.length;
  5178. while (++index < length) {
  5179. var result = compareAscending(objCriteria[index], othCriteria[index]);
  5180. if (result) {
  5181. if (index >= ordersLength) {
  5182. return result;
  5183. }
  5184. var order = orders[index];
  5185. return result * (order == 'desc' ? -1 : 1);
  5186. }
  5187. }
  5188. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  5189. // that causes it, under certain circumstances, to provide the same value for
  5190. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  5191. // for more details.
  5192. //
  5193. // This also ensures a stable sort in V8 and other engines.
  5194. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  5195. return object.index - other.index;
  5196. }
  5197. /**
  5198. * Creates an array that is the composition of partially applied arguments,
  5199. * placeholders, and provided arguments into a single array of arguments.
  5200. *
  5201. * @private
  5202. * @param {Array} args The provided arguments.
  5203. * @param {Array} partials The arguments to prepend to those provided.
  5204. * @param {Array} holders The `partials` placeholder indexes.
  5205. * @params {boolean} [isCurried] Specify composing for a curried function.
  5206. * @returns {Array} Returns the new array of composed arguments.
  5207. */
  5208. function composeArgs(args, partials, holders, isCurried) {
  5209. var argsIndex = -1,
  5210. argsLength = args.length,
  5211. holdersLength = holders.length,
  5212. leftIndex = -1,
  5213. leftLength = partials.length,
  5214. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5215. result = Array(leftLength + rangeLength),
  5216. isUncurried = !isCurried;
  5217. while (++leftIndex < leftLength) {
  5218. result[leftIndex] = partials[leftIndex];
  5219. }
  5220. while (++argsIndex < holdersLength) {
  5221. if (isUncurried || argsIndex < argsLength) {
  5222. result[holders[argsIndex]] = args[argsIndex];
  5223. }
  5224. }
  5225. while (rangeLength--) {
  5226. result[leftIndex++] = args[argsIndex++];
  5227. }
  5228. return result;
  5229. }
  5230. /**
  5231. * This function is like `composeArgs` except that the arguments composition
  5232. * is tailored for `_.partialRight`.
  5233. *
  5234. * @private
  5235. * @param {Array} args The provided arguments.
  5236. * @param {Array} partials The arguments to append to those provided.
  5237. * @param {Array} holders The `partials` placeholder indexes.
  5238. * @params {boolean} [isCurried] Specify composing for a curried function.
  5239. * @returns {Array} Returns the new array of composed arguments.
  5240. */
  5241. function composeArgsRight(args, partials, holders, isCurried) {
  5242. var argsIndex = -1,
  5243. argsLength = args.length,
  5244. holdersIndex = -1,
  5245. holdersLength = holders.length,
  5246. rightIndex = -1,
  5247. rightLength = partials.length,
  5248. rangeLength = nativeMax(argsLength - holdersLength, 0),
  5249. result = Array(rangeLength + rightLength),
  5250. isUncurried = !isCurried;
  5251. while (++argsIndex < rangeLength) {
  5252. result[argsIndex] = args[argsIndex];
  5253. }
  5254. var offset = argsIndex;
  5255. while (++rightIndex < rightLength) {
  5256. result[offset + rightIndex] = partials[rightIndex];
  5257. }
  5258. while (++holdersIndex < holdersLength) {
  5259. if (isUncurried || argsIndex < argsLength) {
  5260. result[offset + holders[holdersIndex]] = args[argsIndex++];
  5261. }
  5262. }
  5263. return result;
  5264. }
  5265. /**
  5266. * Copies the values of `source` to `array`.
  5267. *
  5268. * @private
  5269. * @param {Array} source The array to copy values from.
  5270. * @param {Array} [array=[]] The array to copy values to.
  5271. * @returns {Array} Returns `array`.
  5272. */
  5273. function copyArray(source, array) {
  5274. var index = -1,
  5275. length = source.length;
  5276. array || (array = Array(length));
  5277. while (++index < length) {
  5278. array[index] = source[index];
  5279. }
  5280. return array;
  5281. }
  5282. /**
  5283. * Copies properties of `source` to `object`.
  5284. *
  5285. * @private
  5286. * @param {Object} source The object to copy properties from.
  5287. * @param {Array} props The property identifiers to copy.
  5288. * @param {Object} [object={}] The object to copy properties to.
  5289. * @param {Function} [customizer] The function to customize copied values.
  5290. * @returns {Object} Returns `object`.
  5291. */
  5292. function copyObject(source, props, object, customizer) {
  5293. var isNew = !object;
  5294. object || (object = {});
  5295. var index = -1,
  5296. length = props.length;
  5297. while (++index < length) {
  5298. var key = props[index];
  5299. var newValue = customizer
  5300. ? customizer(object[key], source[key], key, object, source)
  5301. : undefined;
  5302. if (newValue === undefined) {
  5303. newValue = source[key];
  5304. }
  5305. if (isNew) {
  5306. baseAssignValue(object, key, newValue);
  5307. } else {
  5308. assignValue(object, key, newValue);
  5309. }
  5310. }
  5311. return object;
  5312. }
  5313. /**
  5314. * Copies own symbols of `source` to `object`.
  5315. *
  5316. * @private
  5317. * @param {Object} source The object to copy symbols from.
  5318. * @param {Object} [object={}] The object to copy symbols to.
  5319. * @returns {Object} Returns `object`.
  5320. */
  5321. function copySymbols(source, object) {
  5322. return copyObject(source, getSymbols(source), object);
  5323. }
  5324. /**
  5325. * Copies own and inherited symbols of `source` to `object`.
  5326. *
  5327. * @private
  5328. * @param {Object} source The object to copy symbols from.
  5329. * @param {Object} [object={}] The object to copy symbols to.
  5330. * @returns {Object} Returns `object`.
  5331. */
  5332. function copySymbolsIn(source, object) {
  5333. return copyObject(source, getSymbolsIn(source), object);
  5334. }
  5335. /**
  5336. * Creates a function like `_.groupBy`.
  5337. *
  5338. * @private
  5339. * @param {Function} setter The function to set accumulator values.
  5340. * @param {Function} [initializer] The accumulator object initializer.
  5341. * @returns {Function} Returns the new aggregator function.
  5342. */
  5343. function createAggregator(setter, initializer) {
  5344. return function(collection, iteratee) {
  5345. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  5346. accumulator = initializer ? initializer() : {};
  5347. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  5348. };
  5349. }
  5350. /**
  5351. * Creates a function like `_.assign`.
  5352. *
  5353. * @private
  5354. * @param {Function} assigner The function to assign values.
  5355. * @returns {Function} Returns the new assigner function.
  5356. */
  5357. function createAssigner(assigner) {
  5358. return baseRest(function(object, sources) {
  5359. var index = -1,
  5360. length = sources.length,
  5361. customizer = length > 1 ? sources[length - 1] : undefined,
  5362. guard = length > 2 ? sources[2] : undefined;
  5363. customizer = (assigner.length > 3 && typeof customizer == 'function')
  5364. ? (length--, customizer)
  5365. : undefined;
  5366. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  5367. customizer = length < 3 ? undefined : customizer;
  5368. length = 1;
  5369. }
  5370. object = Object(object);
  5371. while (++index < length) {
  5372. var source = sources[index];
  5373. if (source) {
  5374. assigner(object, source, index, customizer);
  5375. }
  5376. }
  5377. return object;
  5378. });
  5379. }
  5380. /**
  5381. * Creates a `baseEach` or `baseEachRight` function.
  5382. *
  5383. * @private
  5384. * @param {Function} eachFunc The function to iterate over a collection.
  5385. * @param {boolean} [fromRight] Specify iterating from right to left.
  5386. * @returns {Function} Returns the new base function.
  5387. */
  5388. function createBaseEach(eachFunc, fromRight) {
  5389. return function(collection, iteratee) {
  5390. if (collection == null) {
  5391. return collection;
  5392. }
  5393. if (!isArrayLike(collection)) {
  5394. return eachFunc(collection, iteratee);
  5395. }
  5396. var length = collection.length,
  5397. index = fromRight ? length : -1,
  5398. iterable = Object(collection);
  5399. while ((fromRight ? index-- : ++index < length)) {
  5400. if (iteratee(iterable[index], index, iterable) === false) {
  5401. break;
  5402. }
  5403. }
  5404. return collection;
  5405. };
  5406. }
  5407. /**
  5408. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  5409. *
  5410. * @private
  5411. * @param {boolean} [fromRight] Specify iterating from right to left.
  5412. * @returns {Function} Returns the new base function.
  5413. */
  5414. function createBaseFor(fromRight) {
  5415. return function(object, iteratee, keysFunc) {
  5416. var index = -1,
  5417. iterable = Object(object),
  5418. props = keysFunc(object),
  5419. length = props.length;
  5420. while (length--) {
  5421. var key = props[fromRight ? length : ++index];
  5422. if (iteratee(iterable[key], key, iterable) === false) {
  5423. break;
  5424. }
  5425. }
  5426. return object;
  5427. };
  5428. }
  5429. /**
  5430. * Creates a function that wraps `func` to invoke it with the optional `this`
  5431. * binding of `thisArg`.
  5432. *
  5433. * @private
  5434. * @param {Function} func The function to wrap.
  5435. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5436. * @param {*} [thisArg] The `this` binding of `func`.
  5437. * @returns {Function} Returns the new wrapped function.
  5438. */
  5439. function createBind(func, bitmask, thisArg) {
  5440. var isBind = bitmask & WRAP_BIND_FLAG,
  5441. Ctor = createCtor(func);
  5442. function wrapper() {
  5443. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5444. return fn.apply(isBind ? thisArg : this, arguments);
  5445. }
  5446. return wrapper;
  5447. }
  5448. /**
  5449. * Creates a function like `_.lowerFirst`.
  5450. *
  5451. * @private
  5452. * @param {string} methodName The name of the `String` case method to use.
  5453. * @returns {Function} Returns the new case function.
  5454. */
  5455. function createCaseFirst(methodName) {
  5456. return function(string) {
  5457. string = toString(string);
  5458. var strSymbols = hasUnicode(string)
  5459. ? stringToArray(string)
  5460. : undefined;
  5461. var chr = strSymbols
  5462. ? strSymbols[0]
  5463. : string.charAt(0);
  5464. var trailing = strSymbols
  5465. ? castSlice(strSymbols, 1).join('')
  5466. : string.slice(1);
  5467. return chr[methodName]() + trailing;
  5468. };
  5469. }
  5470. /**
  5471. * Creates a function like `_.camelCase`.
  5472. *
  5473. * @private
  5474. * @param {Function} callback The function to combine each word.
  5475. * @returns {Function} Returns the new compounder function.
  5476. */
  5477. function createCompounder(callback) {
  5478. return function(string) {
  5479. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  5480. };
  5481. }
  5482. /**
  5483. * Creates a function that produces an instance of `Ctor` regardless of
  5484. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  5485. *
  5486. * @private
  5487. * @param {Function} Ctor The constructor to wrap.
  5488. * @returns {Function} Returns the new wrapped function.
  5489. */
  5490. function createCtor(Ctor) {
  5491. return function() {
  5492. // Use a `switch` statement to work with class constructors. See
  5493. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  5494. // for more details.
  5495. var args = arguments;
  5496. switch (args.length) {
  5497. case 0: return new Ctor;
  5498. case 1: return new Ctor(args[0]);
  5499. case 2: return new Ctor(args[0], args[1]);
  5500. case 3: return new Ctor(args[0], args[1], args[2]);
  5501. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  5502. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  5503. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  5504. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  5505. }
  5506. var thisBinding = baseCreate(Ctor.prototype),
  5507. result = Ctor.apply(thisBinding, args);
  5508. // Mimic the constructor's `return` behavior.
  5509. // See https://es5.github.io/#x13.2.2 for more details.
  5510. return isObject(result) ? result : thisBinding;
  5511. };
  5512. }
  5513. /**
  5514. * Creates a function that wraps `func` to enable currying.
  5515. *
  5516. * @private
  5517. * @param {Function} func The function to wrap.
  5518. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5519. * @param {number} arity The arity of `func`.
  5520. * @returns {Function} Returns the new wrapped function.
  5521. */
  5522. function createCurry(func, bitmask, arity) {
  5523. var Ctor = createCtor(func);
  5524. function wrapper() {
  5525. var length = arguments.length,
  5526. args = Array(length),
  5527. index = length,
  5528. placeholder = getHolder(wrapper);
  5529. while (index--) {
  5530. args[index] = arguments[index];
  5531. }
  5532. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  5533. ? []
  5534. : replaceHolders(args, placeholder);
  5535. length -= holders.length;
  5536. if (length < arity) {
  5537. return createRecurry(
  5538. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  5539. args, holders, undefined, undefined, arity - length);
  5540. }
  5541. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5542. return apply(fn, this, args);
  5543. }
  5544. return wrapper;
  5545. }
  5546. /**
  5547. * Creates a `_.find` or `_.findLast` function.
  5548. *
  5549. * @private
  5550. * @param {Function} findIndexFunc The function to find the collection index.
  5551. * @returns {Function} Returns the new find function.
  5552. */
  5553. function createFind(findIndexFunc) {
  5554. return function(collection, predicate, fromIndex) {
  5555. var iterable = Object(collection);
  5556. if (!isArrayLike(collection)) {
  5557. var iteratee = getIteratee(predicate, 3);
  5558. collection = keys(collection);
  5559. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  5560. }
  5561. var index = findIndexFunc(collection, predicate, fromIndex);
  5562. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  5563. };
  5564. }
  5565. /**
  5566. * Creates a `_.flow` or `_.flowRight` function.
  5567. *
  5568. * @private
  5569. * @param {boolean} [fromRight] Specify iterating from right to left.
  5570. * @returns {Function} Returns the new flow function.
  5571. */
  5572. function createFlow(fromRight) {
  5573. return flatRest(function(funcs) {
  5574. var length = funcs.length,
  5575. index = length,
  5576. prereq = LodashWrapper.prototype.thru;
  5577. if (fromRight) {
  5578. funcs.reverse();
  5579. }
  5580. while (index--) {
  5581. var func = funcs[index];
  5582. if (typeof func != 'function') {
  5583. throw new TypeError(FUNC_ERROR_TEXT);
  5584. }
  5585. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  5586. var wrapper = new LodashWrapper([], true);
  5587. }
  5588. }
  5589. index = wrapper ? index : length;
  5590. while (++index < length) {
  5591. func = funcs[index];
  5592. var funcName = getFuncName(func),
  5593. data = funcName == 'wrapper' ? getData(func) : undefined;
  5594. if (data && isLaziable(data[0]) &&
  5595. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  5596. !data[4].length && data[9] == 1
  5597. ) {
  5598. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  5599. } else {
  5600. wrapper = (func.length == 1 && isLaziable(func))
  5601. ? wrapper[funcName]()
  5602. : wrapper.thru(func);
  5603. }
  5604. }
  5605. return function() {
  5606. var args = arguments,
  5607. value = args[0];
  5608. if (wrapper && args.length == 1 && isArray(value)) {
  5609. return wrapper.plant(value).value();
  5610. }
  5611. var index = 0,
  5612. result = length ? funcs[index].apply(this, args) : value;
  5613. while (++index < length) {
  5614. result = funcs[index].call(this, result);
  5615. }
  5616. return result;
  5617. };
  5618. });
  5619. }
  5620. /**
  5621. * Creates a function that wraps `func` to invoke it with optional `this`
  5622. * binding of `thisArg`, partial application, and currying.
  5623. *
  5624. * @private
  5625. * @param {Function|string} func The function or method name to wrap.
  5626. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5627. * @param {*} [thisArg] The `this` binding of `func`.
  5628. * @param {Array} [partials] The arguments to prepend to those provided to
  5629. * the new function.
  5630. * @param {Array} [holders] The `partials` placeholder indexes.
  5631. * @param {Array} [partialsRight] The arguments to append to those provided
  5632. * to the new function.
  5633. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  5634. * @param {Array} [argPos] The argument positions of the new function.
  5635. * @param {number} [ary] The arity cap of `func`.
  5636. * @param {number} [arity] The arity of `func`.
  5637. * @returns {Function} Returns the new wrapped function.
  5638. */
  5639. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  5640. var isAry = bitmask & WRAP_ARY_FLAG,
  5641. isBind = bitmask & WRAP_BIND_FLAG,
  5642. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  5643. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  5644. isFlip = bitmask & WRAP_FLIP_FLAG,
  5645. Ctor = isBindKey ? undefined : createCtor(func);
  5646. function wrapper() {
  5647. var length = arguments.length,
  5648. args = Array(length),
  5649. index = length;
  5650. while (index--) {
  5651. args[index] = arguments[index];
  5652. }
  5653. if (isCurried) {
  5654. var placeholder = getHolder(wrapper),
  5655. holdersCount = countHolders(args, placeholder);
  5656. }
  5657. if (partials) {
  5658. args = composeArgs(args, partials, holders, isCurried);
  5659. }
  5660. if (partialsRight) {
  5661. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  5662. }
  5663. length -= holdersCount;
  5664. if (isCurried && length < arity) {
  5665. var newHolders = replaceHolders(args, placeholder);
  5666. return createRecurry(
  5667. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  5668. args, newHolders, argPos, ary, arity - length
  5669. );
  5670. }
  5671. var thisBinding = isBind ? thisArg : this,
  5672. fn = isBindKey ? thisBinding[func] : func;
  5673. length = args.length;
  5674. if (argPos) {
  5675. args = reorder(args, argPos);
  5676. } else if (isFlip && length > 1) {
  5677. args.reverse();
  5678. }
  5679. if (isAry && ary < length) {
  5680. args.length = ary;
  5681. }
  5682. if (this && this !== root && this instanceof wrapper) {
  5683. fn = Ctor || createCtor(fn);
  5684. }
  5685. return fn.apply(thisBinding, args);
  5686. }
  5687. return wrapper;
  5688. }
  5689. /**
  5690. * Creates a function like `_.invertBy`.
  5691. *
  5692. * @private
  5693. * @param {Function} setter The function to set accumulator values.
  5694. * @param {Function} toIteratee The function to resolve iteratees.
  5695. * @returns {Function} Returns the new inverter function.
  5696. */
  5697. function createInverter(setter, toIteratee) {
  5698. return function(object, iteratee) {
  5699. return baseInverter(object, setter, toIteratee(iteratee), {});
  5700. };
  5701. }
  5702. /**
  5703. * Creates a function that performs a mathematical operation on two values.
  5704. *
  5705. * @private
  5706. * @param {Function} operator The function to perform the operation.
  5707. * @param {number} [defaultValue] The value used for `undefined` arguments.
  5708. * @returns {Function} Returns the new mathematical operation function.
  5709. */
  5710. function createMathOperation(operator, defaultValue) {
  5711. return function(value, other) {
  5712. var result;
  5713. if (value === undefined && other === undefined) {
  5714. return defaultValue;
  5715. }
  5716. if (value !== undefined) {
  5717. result = value;
  5718. }
  5719. if (other !== undefined) {
  5720. if (result === undefined) {
  5721. return other;
  5722. }
  5723. if (typeof value == 'string' || typeof other == 'string') {
  5724. value = baseToString(value);
  5725. other = baseToString(other);
  5726. } else {
  5727. value = baseToNumber(value);
  5728. other = baseToNumber(other);
  5729. }
  5730. result = operator(value, other);
  5731. }
  5732. return result;
  5733. };
  5734. }
  5735. /**
  5736. * Creates a function like `_.over`.
  5737. *
  5738. * @private
  5739. * @param {Function} arrayFunc The function to iterate over iteratees.
  5740. * @returns {Function} Returns the new over function.
  5741. */
  5742. function createOver(arrayFunc) {
  5743. return flatRest(function(iteratees) {
  5744. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  5745. return baseRest(function(args) {
  5746. var thisArg = this;
  5747. return arrayFunc(iteratees, function(iteratee) {
  5748. return apply(iteratee, thisArg, args);
  5749. });
  5750. });
  5751. });
  5752. }
  5753. /**
  5754. * Creates the padding for `string` based on `length`. The `chars` string
  5755. * is truncated if the number of characters exceeds `length`.
  5756. *
  5757. * @private
  5758. * @param {number} length The padding length.
  5759. * @param {string} [chars=' '] The string used as padding.
  5760. * @returns {string} Returns the padding for `string`.
  5761. */
  5762. function createPadding(length, chars) {
  5763. chars = chars === undefined ? ' ' : baseToString(chars);
  5764. var charsLength = chars.length;
  5765. if (charsLength < 2) {
  5766. return charsLength ? baseRepeat(chars, length) : chars;
  5767. }
  5768. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  5769. return hasUnicode(chars)
  5770. ? castSlice(stringToArray(result), 0, length).join('')
  5771. : result.slice(0, length);
  5772. }
  5773. /**
  5774. * Creates a function that wraps `func` to invoke it with the `this` binding
  5775. * of `thisArg` and `partials` prepended to the arguments it receives.
  5776. *
  5777. * @private
  5778. * @param {Function} func The function to wrap.
  5779. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5780. * @param {*} thisArg The `this` binding of `func`.
  5781. * @param {Array} partials The arguments to prepend to those provided to
  5782. * the new function.
  5783. * @returns {Function} Returns the new wrapped function.
  5784. */
  5785. function createPartial(func, bitmask, thisArg, partials) {
  5786. var isBind = bitmask & WRAP_BIND_FLAG,
  5787. Ctor = createCtor(func);
  5788. function wrapper() {
  5789. var argsIndex = -1,
  5790. argsLength = arguments.length,
  5791. leftIndex = -1,
  5792. leftLength = partials.length,
  5793. args = Array(leftLength + argsLength),
  5794. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  5795. while (++leftIndex < leftLength) {
  5796. args[leftIndex] = partials[leftIndex];
  5797. }
  5798. while (argsLength--) {
  5799. args[leftIndex++] = arguments[++argsIndex];
  5800. }
  5801. return apply(fn, isBind ? thisArg : this, args);
  5802. }
  5803. return wrapper;
  5804. }
  5805. /**
  5806. * Creates a `_.range` or `_.rangeRight` function.
  5807. *
  5808. * @private
  5809. * @param {boolean} [fromRight] Specify iterating from right to left.
  5810. * @returns {Function} Returns the new range function.
  5811. */
  5812. function createRange(fromRight) {
  5813. return function(start, end, step) {
  5814. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  5815. end = step = undefined;
  5816. }
  5817. // Ensure the sign of `-0` is preserved.
  5818. start = toFinite(start);
  5819. if (end === undefined) {
  5820. end = start;
  5821. start = 0;
  5822. } else {
  5823. end = toFinite(end);
  5824. }
  5825. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  5826. return baseRange(start, end, step, fromRight);
  5827. };
  5828. }
  5829. /**
  5830. * Creates a function that performs a relational operation on two values.
  5831. *
  5832. * @private
  5833. * @param {Function} operator The function to perform the operation.
  5834. * @returns {Function} Returns the new relational operation function.
  5835. */
  5836. function createRelationalOperation(operator) {
  5837. return function(value, other) {
  5838. if (!(typeof value == 'string' && typeof other == 'string')) {
  5839. value = toNumber(value);
  5840. other = toNumber(other);
  5841. }
  5842. return operator(value, other);
  5843. };
  5844. }
  5845. /**
  5846. * Creates a function that wraps `func` to continue currying.
  5847. *
  5848. * @private
  5849. * @param {Function} func The function to wrap.
  5850. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  5851. * @param {Function} wrapFunc The function to create the `func` wrapper.
  5852. * @param {*} placeholder The placeholder value.
  5853. * @param {*} [thisArg] The `this` binding of `func`.
  5854. * @param {Array} [partials] The arguments to prepend to those provided to
  5855. * the new function.
  5856. * @param {Array} [holders] The `partials` placeholder indexes.
  5857. * @param {Array} [argPos] The argument positions of the new function.
  5858. * @param {number} [ary] The arity cap of `func`.
  5859. * @param {number} [arity] The arity of `func`.
  5860. * @returns {Function} Returns the new wrapped function.
  5861. */
  5862. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  5863. var isCurry = bitmask & WRAP_CURRY_FLAG,
  5864. newHolders = isCurry ? holders : undefined,
  5865. newHoldersRight = isCurry ? undefined : holders,
  5866. newPartials = isCurry ? partials : undefined,
  5867. newPartialsRight = isCurry ? undefined : partials;
  5868. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  5869. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  5870. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  5871. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  5872. }
  5873. var newData = [
  5874. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  5875. newHoldersRight, argPos, ary, arity
  5876. ];
  5877. var result = wrapFunc.apply(undefined, newData);
  5878. if (isLaziable(func)) {
  5879. setData(result, newData);
  5880. }
  5881. result.placeholder = placeholder;
  5882. return setWrapToString(result, func, bitmask);
  5883. }
  5884. /**
  5885. * Creates a function like `_.round`.
  5886. *
  5887. * @private
  5888. * @param {string} methodName The name of the `Math` method to use when rounding.
  5889. * @returns {Function} Returns the new round function.
  5890. */
  5891. function createRound(methodName) {
  5892. var func = Math[methodName];
  5893. return function(number, precision) {
  5894. number = toNumber(number);
  5895. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  5896. if (precision && nativeIsFinite(number)) {
  5897. // Shift with exponential notation to avoid floating-point issues.
  5898. // See [MDN](https://mdn.io/round#Examples) for more details.
  5899. var pair = (toString(number) + 'e').split('e'),
  5900. value = func(pair[0] + 'e' + (+pair[1] + precision));
  5901. pair = (toString(value) + 'e').split('e');
  5902. return +(pair[0] + 'e' + (+pair[1] - precision));
  5903. }
  5904. return func(number);
  5905. };
  5906. }
  5907. /**
  5908. * Creates a set object of `values`.
  5909. *
  5910. * @private
  5911. * @param {Array} values The values to add to the set.
  5912. * @returns {Object} Returns the new set.
  5913. */
  5914. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  5915. return new Set(values);
  5916. };
  5917. /**
  5918. * Creates a `_.toPairs` or `_.toPairsIn` function.
  5919. *
  5920. * @private
  5921. * @param {Function} keysFunc The function to get the keys of a given object.
  5922. * @returns {Function} Returns the new pairs function.
  5923. */
  5924. function createToPairs(keysFunc) {
  5925. return function(object) {
  5926. var tag = getTag(object);
  5927. if (tag == mapTag) {
  5928. return mapToArray(object);
  5929. }
  5930. if (tag == setTag) {
  5931. return setToPairs(object);
  5932. }
  5933. return baseToPairs(object, keysFunc(object));
  5934. };
  5935. }
  5936. /**
  5937. * Creates a function that either curries or invokes `func` with optional
  5938. * `this` binding and partially applied arguments.
  5939. *
  5940. * @private
  5941. * @param {Function|string} func The function or method name to wrap.
  5942. * @param {number} bitmask The bitmask flags.
  5943. * 1 - `_.bind`
  5944. * 2 - `_.bindKey`
  5945. * 4 - `_.curry` or `_.curryRight` of a bound function
  5946. * 8 - `_.curry`
  5947. * 16 - `_.curryRight`
  5948. * 32 - `_.partial`
  5949. * 64 - `_.partialRight`
  5950. * 128 - `_.rearg`
  5951. * 256 - `_.ary`
  5952. * 512 - `_.flip`
  5953. * @param {*} [thisArg] The `this` binding of `func`.
  5954. * @param {Array} [partials] The arguments to be partially applied.
  5955. * @param {Array} [holders] The `partials` placeholder indexes.
  5956. * @param {Array} [argPos] The argument positions of the new function.
  5957. * @param {number} [ary] The arity cap of `func`.
  5958. * @param {number} [arity] The arity of `func`.
  5959. * @returns {Function} Returns the new wrapped function.
  5960. */
  5961. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  5962. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  5963. if (!isBindKey && typeof func != 'function') {
  5964. throw new TypeError(FUNC_ERROR_TEXT);
  5965. }
  5966. var length = partials ? partials.length : 0;
  5967. if (!length) {
  5968. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  5969. partials = holders = undefined;
  5970. }
  5971. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  5972. arity = arity === undefined ? arity : toInteger(arity);
  5973. length -= holders ? holders.length : 0;
  5974. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  5975. var partialsRight = partials,
  5976. holdersRight = holders;
  5977. partials = holders = undefined;
  5978. }
  5979. var data = isBindKey ? undefined : getData(func);
  5980. var newData = [
  5981. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  5982. argPos, ary, arity
  5983. ];
  5984. if (data) {
  5985. mergeData(newData, data);
  5986. }
  5987. func = newData[0];
  5988. bitmask = newData[1];
  5989. thisArg = newData[2];
  5990. partials = newData[3];
  5991. holders = newData[4];
  5992. arity = newData[9] = newData[9] === undefined
  5993. ? (isBindKey ? 0 : func.length)
  5994. : nativeMax(newData[9] - length, 0);
  5995. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  5996. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  5997. }
  5998. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  5999. var result = createBind(func, bitmask, thisArg);
  6000. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  6001. result = createCurry(func, bitmask, arity);
  6002. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  6003. result = createPartial(func, bitmask, thisArg, partials);
  6004. } else {
  6005. result = createHybrid.apply(undefined, newData);
  6006. }
  6007. var setter = data ? baseSetData : setData;
  6008. return setWrapToString(setter(result, newData), func, bitmask);
  6009. }
  6010. /**
  6011. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  6012. * of source objects to the destination object for all destination properties
  6013. * that resolve to `undefined`.
  6014. *
  6015. * @private
  6016. * @param {*} objValue The destination value.
  6017. * @param {*} srcValue The source value.
  6018. * @param {string} key The key of the property to assign.
  6019. * @param {Object} object The parent object of `objValue`.
  6020. * @returns {*} Returns the value to assign.
  6021. */
  6022. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  6023. if (objValue === undefined ||
  6024. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  6025. return srcValue;
  6026. }
  6027. return objValue;
  6028. }
  6029. /**
  6030. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  6031. * objects into destination objects that are passed thru.
  6032. *
  6033. * @private
  6034. * @param {*} objValue The destination value.
  6035. * @param {*} srcValue The source value.
  6036. * @param {string} key The key of the property to merge.
  6037. * @param {Object} object The parent object of `objValue`.
  6038. * @param {Object} source The parent object of `srcValue`.
  6039. * @param {Object} [stack] Tracks traversed source values and their merged
  6040. * counterparts.
  6041. * @returns {*} Returns the value to assign.
  6042. */
  6043. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  6044. if (isObject(objValue) && isObject(srcValue)) {
  6045. // Recursively merge objects and arrays (susceptible to call stack limits).
  6046. stack.set(srcValue, objValue);
  6047. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  6048. stack['delete'](srcValue);
  6049. }
  6050. return objValue;
  6051. }
  6052. /**
  6053. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  6054. * objects.
  6055. *
  6056. * @private
  6057. * @param {*} value The value to inspect.
  6058. * @param {string} key The key of the property to inspect.
  6059. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  6060. */
  6061. function customOmitClone(value) {
  6062. return isPlainObject(value) ? undefined : value;
  6063. }
  6064. /**
  6065. * A specialized version of `baseIsEqualDeep` for arrays with support for
  6066. * partial deep comparisons.
  6067. *
  6068. * @private
  6069. * @param {Array} array The array to compare.
  6070. * @param {Array} other The other array to compare.
  6071. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6072. * @param {Function} customizer The function to customize comparisons.
  6073. * @param {Function} equalFunc The function to determine equivalents of values.
  6074. * @param {Object} stack Tracks traversed `array` and `other` objects.
  6075. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  6076. */
  6077. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  6078. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6079. arrLength = array.length,
  6080. othLength = other.length;
  6081. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  6082. return false;
  6083. }
  6084. // Check that cyclic values are equal.
  6085. var arrStacked = stack.get(array);
  6086. var othStacked = stack.get(other);
  6087. if (arrStacked && othStacked) {
  6088. return arrStacked == other && othStacked == array;
  6089. }
  6090. var index = -1,
  6091. result = true,
  6092. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  6093. stack.set(array, other);
  6094. stack.set(other, array);
  6095. // Ignore non-index properties.
  6096. while (++index < arrLength) {
  6097. var arrValue = array[index],
  6098. othValue = other[index];
  6099. if (customizer) {
  6100. var compared = isPartial
  6101. ? customizer(othValue, arrValue, index, other, array, stack)
  6102. : customizer(arrValue, othValue, index, array, other, stack);
  6103. }
  6104. if (compared !== undefined) {
  6105. if (compared) {
  6106. continue;
  6107. }
  6108. result = false;
  6109. break;
  6110. }
  6111. // Recursively compare arrays (susceptible to call stack limits).
  6112. if (seen) {
  6113. if (!arraySome(other, function(othValue, othIndex) {
  6114. if (!cacheHas(seen, othIndex) &&
  6115. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  6116. return seen.push(othIndex);
  6117. }
  6118. })) {
  6119. result = false;
  6120. break;
  6121. }
  6122. } else if (!(
  6123. arrValue === othValue ||
  6124. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  6125. )) {
  6126. result = false;
  6127. break;
  6128. }
  6129. }
  6130. stack['delete'](array);
  6131. stack['delete'](other);
  6132. return result;
  6133. }
  6134. /**
  6135. * A specialized version of `baseIsEqualDeep` for comparing objects of
  6136. * the same `toStringTag`.
  6137. *
  6138. * **Note:** This function only supports comparing values with tags of
  6139. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  6140. *
  6141. * @private
  6142. * @param {Object} object The object to compare.
  6143. * @param {Object} other The other object to compare.
  6144. * @param {string} tag The `toStringTag` of the objects to compare.
  6145. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6146. * @param {Function} customizer The function to customize comparisons.
  6147. * @param {Function} equalFunc The function to determine equivalents of values.
  6148. * @param {Object} stack Tracks traversed `object` and `other` objects.
  6149. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6150. */
  6151. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  6152. switch (tag) {
  6153. case dataViewTag:
  6154. if ((object.byteLength != other.byteLength) ||
  6155. (object.byteOffset != other.byteOffset)) {
  6156. return false;
  6157. }
  6158. object = object.buffer;
  6159. other = other.buffer;
  6160. case arrayBufferTag:
  6161. if ((object.byteLength != other.byteLength) ||
  6162. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  6163. return false;
  6164. }
  6165. return true;
  6166. case boolTag:
  6167. case dateTag:
  6168. case numberTag:
  6169. // Coerce booleans to `1` or `0` and dates to milliseconds.
  6170. // Invalid dates are coerced to `NaN`.
  6171. return eq(+object, +other);
  6172. case errorTag:
  6173. return object.name == other.name && object.message == other.message;
  6174. case regexpTag:
  6175. case stringTag:
  6176. // Coerce regexes to strings and treat strings, primitives and objects,
  6177. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  6178. // for more details.
  6179. return object == (other + '');
  6180. case mapTag:
  6181. var convert = mapToArray;
  6182. case setTag:
  6183. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  6184. convert || (convert = setToArray);
  6185. if (object.size != other.size && !isPartial) {
  6186. return false;
  6187. }
  6188. // Assume cyclic values are equal.
  6189. var stacked = stack.get(object);
  6190. if (stacked) {
  6191. return stacked == other;
  6192. }
  6193. bitmask |= COMPARE_UNORDERED_FLAG;
  6194. // Recursively compare objects (susceptible to call stack limits).
  6195. stack.set(object, other);
  6196. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  6197. stack['delete'](object);
  6198. return result;
  6199. case symbolTag:
  6200. if (symbolValueOf) {
  6201. return symbolValueOf.call(object) == symbolValueOf.call(other);
  6202. }
  6203. }
  6204. return false;
  6205. }
  6206. /**
  6207. * A specialized version of `baseIsEqualDeep` for objects with support for
  6208. * partial deep comparisons.
  6209. *
  6210. * @private
  6211. * @param {Object} object The object to compare.
  6212. * @param {Object} other The other object to compare.
  6213. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  6214. * @param {Function} customizer The function to customize comparisons.
  6215. * @param {Function} equalFunc The function to determine equivalents of values.
  6216. * @param {Object} stack Tracks traversed `object` and `other` objects.
  6217. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  6218. */
  6219. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  6220. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  6221. objProps = getAllKeys(object),
  6222. objLength = objProps.length,
  6223. othProps = getAllKeys(other),
  6224. othLength = othProps.length;
  6225. if (objLength != othLength && !isPartial) {
  6226. return false;
  6227. }
  6228. var index = objLength;
  6229. while (index--) {
  6230. var key = objProps[index];
  6231. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  6232. return false;
  6233. }
  6234. }
  6235. // Check that cyclic values are equal.
  6236. var objStacked = stack.get(object);
  6237. var othStacked = stack.get(other);
  6238. if (objStacked && othStacked) {
  6239. return objStacked == other && othStacked == object;
  6240. }
  6241. var result = true;
  6242. stack.set(object, other);
  6243. stack.set(other, object);
  6244. var skipCtor = isPartial;
  6245. while (++index < objLength) {
  6246. key = objProps[index];
  6247. var objValue = object[key],
  6248. othValue = other[key];
  6249. if (customizer) {
  6250. var compared = isPartial
  6251. ? customizer(othValue, objValue, key, other, object, stack)
  6252. : customizer(objValue, othValue, key, object, other, stack);
  6253. }
  6254. // Recursively compare objects (susceptible to call stack limits).
  6255. if (!(compared === undefined
  6256. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  6257. : compared
  6258. )) {
  6259. result = false;
  6260. break;
  6261. }
  6262. skipCtor || (skipCtor = key == 'constructor');
  6263. }
  6264. if (result && !skipCtor) {
  6265. var objCtor = object.constructor,
  6266. othCtor = other.constructor;
  6267. // Non `Object` object instances with different constructors are not equal.
  6268. if (objCtor != othCtor &&
  6269. ('constructor' in object && 'constructor' in other) &&
  6270. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  6271. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  6272. result = false;
  6273. }
  6274. }
  6275. stack['delete'](object);
  6276. stack['delete'](other);
  6277. return result;
  6278. }
  6279. /**
  6280. * A specialized version of `baseRest` which flattens the rest array.
  6281. *
  6282. * @private
  6283. * @param {Function} func The function to apply a rest parameter to.
  6284. * @returns {Function} Returns the new function.
  6285. */
  6286. function flatRest(func) {
  6287. return setToString(overRest(func, undefined, flatten), func + '');
  6288. }
  6289. /**
  6290. * Creates an array of own enumerable property names and symbols of `object`.
  6291. *
  6292. * @private
  6293. * @param {Object} object The object to query.
  6294. * @returns {Array} Returns the array of property names and symbols.
  6295. */
  6296. function getAllKeys(object) {
  6297. return baseGetAllKeys(object, keys, getSymbols);
  6298. }
  6299. /**
  6300. * Creates an array of own and inherited enumerable property names and
  6301. * symbols of `object`.
  6302. *
  6303. * @private
  6304. * @param {Object} object The object to query.
  6305. * @returns {Array} Returns the array of property names and symbols.
  6306. */
  6307. function getAllKeysIn(object) {
  6308. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  6309. }
  6310. /**
  6311. * Gets metadata for `func`.
  6312. *
  6313. * @private
  6314. * @param {Function} func The function to query.
  6315. * @returns {*} Returns the metadata for `func`.
  6316. */
  6317. var getData = !metaMap ? noop : function(func) {
  6318. return metaMap.get(func);
  6319. };
  6320. /**
  6321. * Gets the name of `func`.
  6322. *
  6323. * @private
  6324. * @param {Function} func The function to query.
  6325. * @returns {string} Returns the function name.
  6326. */
  6327. function getFuncName(func) {
  6328. var result = (func.name + ''),
  6329. array = realNames[result],
  6330. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  6331. while (length--) {
  6332. var data = array[length],
  6333. otherFunc = data.func;
  6334. if (otherFunc == null || otherFunc == func) {
  6335. return data.name;
  6336. }
  6337. }
  6338. return result;
  6339. }
  6340. /**
  6341. * Gets the argument placeholder value for `func`.
  6342. *
  6343. * @private
  6344. * @param {Function} func The function to inspect.
  6345. * @returns {*} Returns the placeholder value.
  6346. */
  6347. function getHolder(func) {
  6348. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  6349. return object.placeholder;
  6350. }
  6351. /**
  6352. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  6353. * this function returns the custom method, otherwise it returns `baseIteratee`.
  6354. * If arguments are provided, the chosen function is invoked with them and
  6355. * its result is returned.
  6356. *
  6357. * @private
  6358. * @param {*} [value] The value to convert to an iteratee.
  6359. * @param {number} [arity] The arity of the created iteratee.
  6360. * @returns {Function} Returns the chosen function or its result.
  6361. */
  6362. function getIteratee() {
  6363. var result = lodash.iteratee || iteratee;
  6364. result = result === iteratee ? baseIteratee : result;
  6365. return arguments.length ? result(arguments[0], arguments[1]) : result;
  6366. }
  6367. /**
  6368. * Gets the data for `map`.
  6369. *
  6370. * @private
  6371. * @param {Object} map The map to query.
  6372. * @param {string} key The reference key.
  6373. * @returns {*} Returns the map data.
  6374. */
  6375. function getMapData(map, key) {
  6376. var data = map.__data__;
  6377. return isKeyable(key)
  6378. ? data[typeof key == 'string' ? 'string' : 'hash']
  6379. : data.map;
  6380. }
  6381. /**
  6382. * Gets the property names, values, and compare flags of `object`.
  6383. *
  6384. * @private
  6385. * @param {Object} object The object to query.
  6386. * @returns {Array} Returns the match data of `object`.
  6387. */
  6388. function getMatchData(object) {
  6389. var result = keys(object),
  6390. length = result.length;
  6391. while (length--) {
  6392. var key = result[length],
  6393. value = object[key];
  6394. result[length] = [key, value, isStrictComparable(value)];
  6395. }
  6396. return result;
  6397. }
  6398. /**
  6399. * Gets the native function at `key` of `object`.
  6400. *
  6401. * @private
  6402. * @param {Object} object The object to query.
  6403. * @param {string} key The key of the method to get.
  6404. * @returns {*} Returns the function if it's native, else `undefined`.
  6405. */
  6406. function getNative(object, key) {
  6407. var value = getValue(object, key);
  6408. return baseIsNative(value) ? value : undefined;
  6409. }
  6410. /**
  6411. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  6412. *
  6413. * @private
  6414. * @param {*} value The value to query.
  6415. * @returns {string} Returns the raw `toStringTag`.
  6416. */
  6417. function getRawTag(value) {
  6418. var isOwn = hasOwnProperty.call(value, symToStringTag),
  6419. tag = value[symToStringTag];
  6420. try {
  6421. value[symToStringTag] = undefined;
  6422. var unmasked = true;
  6423. } catch (e) {}
  6424. var result = nativeObjectToString.call(value);
  6425. if (unmasked) {
  6426. if (isOwn) {
  6427. value[symToStringTag] = tag;
  6428. } else {
  6429. delete value[symToStringTag];
  6430. }
  6431. }
  6432. return result;
  6433. }
  6434. /**
  6435. * Creates an array of the own enumerable symbols of `object`.
  6436. *
  6437. * @private
  6438. * @param {Object} object The object to query.
  6439. * @returns {Array} Returns the array of symbols.
  6440. */
  6441. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  6442. if (object == null) {
  6443. return [];
  6444. }
  6445. object = Object(object);
  6446. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  6447. return propertyIsEnumerable.call(object, symbol);
  6448. });
  6449. };
  6450. /**
  6451. * Creates an array of the own and inherited enumerable symbols of `object`.
  6452. *
  6453. * @private
  6454. * @param {Object} object The object to query.
  6455. * @returns {Array} Returns the array of symbols.
  6456. */
  6457. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  6458. var result = [];
  6459. while (object) {
  6460. arrayPush(result, getSymbols(object));
  6461. object = getPrototype(object);
  6462. }
  6463. return result;
  6464. };
  6465. /**
  6466. * Gets the `toStringTag` of `value`.
  6467. *
  6468. * @private
  6469. * @param {*} value The value to query.
  6470. * @returns {string} Returns the `toStringTag`.
  6471. */
  6472. var getTag = baseGetTag;
  6473. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  6474. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  6475. (Map && getTag(new Map) != mapTag) ||
  6476. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  6477. (Set && getTag(new Set) != setTag) ||
  6478. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  6479. getTag = function(value) {
  6480. var result = baseGetTag(value),
  6481. Ctor = result == objectTag ? value.constructor : undefined,
  6482. ctorString = Ctor ? toSource(Ctor) : '';
  6483. if (ctorString) {
  6484. switch (ctorString) {
  6485. case dataViewCtorString: return dataViewTag;
  6486. case mapCtorString: return mapTag;
  6487. case promiseCtorString: return promiseTag;
  6488. case setCtorString: return setTag;
  6489. case weakMapCtorString: return weakMapTag;
  6490. }
  6491. }
  6492. return result;
  6493. };
  6494. }
  6495. /**
  6496. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  6497. *
  6498. * @private
  6499. * @param {number} start The start of the view.
  6500. * @param {number} end The end of the view.
  6501. * @param {Array} transforms The transformations to apply to the view.
  6502. * @returns {Object} Returns an object containing the `start` and `end`
  6503. * positions of the view.
  6504. */
  6505. function getView(start, end, transforms) {
  6506. var index = -1,
  6507. length = transforms.length;
  6508. while (++index < length) {
  6509. var data = transforms[index],
  6510. size = data.size;
  6511. switch (data.type) {
  6512. case 'drop': start += size; break;
  6513. case 'dropRight': end -= size; break;
  6514. case 'take': end = nativeMin(end, start + size); break;
  6515. case 'takeRight': start = nativeMax(start, end - size); break;
  6516. }
  6517. }
  6518. return { 'start': start, 'end': end };
  6519. }
  6520. /**
  6521. * Extracts wrapper details from the `source` body comment.
  6522. *
  6523. * @private
  6524. * @param {string} source The source to inspect.
  6525. * @returns {Array} Returns the wrapper details.
  6526. */
  6527. function getWrapDetails(source) {
  6528. var match = source.match(reWrapDetails);
  6529. return match ? match[1].split(reSplitDetails) : [];
  6530. }
  6531. /**
  6532. * Checks if `path` exists on `object`.
  6533. *
  6534. * @private
  6535. * @param {Object} object The object to query.
  6536. * @param {Array|string} path The path to check.
  6537. * @param {Function} hasFunc The function to check properties.
  6538. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  6539. */
  6540. function hasPath(object, path, hasFunc) {
  6541. path = castPath(path, object);
  6542. var index = -1,
  6543. length = path.length,
  6544. result = false;
  6545. while (++index < length) {
  6546. var key = toKey(path[index]);
  6547. if (!(result = object != null && hasFunc(object, key))) {
  6548. break;
  6549. }
  6550. object = object[key];
  6551. }
  6552. if (result || ++index != length) {
  6553. return result;
  6554. }
  6555. length = object == null ? 0 : object.length;
  6556. return !!length && isLength(length) && isIndex(key, length) &&
  6557. (isArray(object) || isArguments(object));
  6558. }
  6559. /**
  6560. * Initializes an array clone.
  6561. *
  6562. * @private
  6563. * @param {Array} array The array to clone.
  6564. * @returns {Array} Returns the initialized clone.
  6565. */
  6566. function initCloneArray(array) {
  6567. var length = array.length,
  6568. result = new array.constructor(length);
  6569. // Add properties assigned by `RegExp#exec`.
  6570. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  6571. result.index = array.index;
  6572. result.input = array.input;
  6573. }
  6574. return result;
  6575. }
  6576. /**
  6577. * Initializes an object clone.
  6578. *
  6579. * @private
  6580. * @param {Object} object The object to clone.
  6581. * @returns {Object} Returns the initialized clone.
  6582. */
  6583. function initCloneObject(object) {
  6584. return (typeof object.constructor == 'function' && !isPrototype(object))
  6585. ? baseCreate(getPrototype(object))
  6586. : {};
  6587. }
  6588. /**
  6589. * Initializes an object clone based on its `toStringTag`.
  6590. *
  6591. * **Note:** This function only supports cloning values with tags of
  6592. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  6593. *
  6594. * @private
  6595. * @param {Object} object The object to clone.
  6596. * @param {string} tag The `toStringTag` of the object to clone.
  6597. * @param {boolean} [isDeep] Specify a deep clone.
  6598. * @returns {Object} Returns the initialized clone.
  6599. */
  6600. function initCloneByTag(object, tag, isDeep) {
  6601. var Ctor = object.constructor;
  6602. switch (tag) {
  6603. case arrayBufferTag:
  6604. return cloneArrayBuffer(object);
  6605. case boolTag:
  6606. case dateTag:
  6607. return new Ctor(+object);
  6608. case dataViewTag:
  6609. return cloneDataView(object, isDeep);
  6610. case float32Tag: case float64Tag:
  6611. case int8Tag: case int16Tag: case int32Tag:
  6612. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  6613. return cloneTypedArray(object, isDeep);
  6614. case mapTag:
  6615. return new Ctor;
  6616. case numberTag:
  6617. case stringTag:
  6618. return new Ctor(object);
  6619. case regexpTag:
  6620. return cloneRegExp(object);
  6621. case setTag:
  6622. return new Ctor;
  6623. case symbolTag:
  6624. return cloneSymbol(object);
  6625. }
  6626. }
  6627. /**
  6628. * Inserts wrapper `details` in a comment at the top of the `source` body.
  6629. *
  6630. * @private
  6631. * @param {string} source The source to modify.
  6632. * @returns {Array} details The details to insert.
  6633. * @returns {string} Returns the modified source.
  6634. */
  6635. function insertWrapDetails(source, details) {
  6636. var length = details.length;
  6637. if (!length) {
  6638. return source;
  6639. }
  6640. var lastIndex = length - 1;
  6641. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  6642. details = details.join(length > 2 ? ', ' : ' ');
  6643. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  6644. }
  6645. /**
  6646. * Checks if `value` is a flattenable `arguments` object or array.
  6647. *
  6648. * @private
  6649. * @param {*} value The value to check.
  6650. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  6651. */
  6652. function isFlattenable(value) {
  6653. return isArray(value) || isArguments(value) ||
  6654. !!(spreadableSymbol && value && value[spreadableSymbol]);
  6655. }
  6656. /**
  6657. * Checks if `value` is a valid array-like index.
  6658. *
  6659. * @private
  6660. * @param {*} value The value to check.
  6661. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  6662. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  6663. */
  6664. function isIndex(value, length) {
  6665. var type = typeof value;
  6666. length = length == null ? MAX_SAFE_INTEGER : length;
  6667. return !!length &&
  6668. (type == 'number' ||
  6669. (type != 'symbol' && reIsUint.test(value))) &&
  6670. (value > -1 && value % 1 == 0 && value < length);
  6671. }
  6672. /**
  6673. * Checks if the given arguments are from an iteratee call.
  6674. *
  6675. * @private
  6676. * @param {*} value The potential iteratee value argument.
  6677. * @param {*} index The potential iteratee index or key argument.
  6678. * @param {*} object The potential iteratee object argument.
  6679. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  6680. * else `false`.
  6681. */
  6682. function isIterateeCall(value, index, object) {
  6683. if (!isObject(object)) {
  6684. return false;
  6685. }
  6686. var type = typeof index;
  6687. if (type == 'number'
  6688. ? (isArrayLike(object) && isIndex(index, object.length))
  6689. : (type == 'string' && index in object)
  6690. ) {
  6691. return eq(object[index], value);
  6692. }
  6693. return false;
  6694. }
  6695. /**
  6696. * Checks if `value` is a property name and not a property path.
  6697. *
  6698. * @private
  6699. * @param {*} value The value to check.
  6700. * @param {Object} [object] The object to query keys on.
  6701. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  6702. */
  6703. function isKey(value, object) {
  6704. if (isArray(value)) {
  6705. return false;
  6706. }
  6707. var type = typeof value;
  6708. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  6709. value == null || isSymbol(value)) {
  6710. return true;
  6711. }
  6712. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  6713. (object != null && value in Object(object));
  6714. }
  6715. /**
  6716. * Checks if `value` is suitable for use as unique object key.
  6717. *
  6718. * @private
  6719. * @param {*} value The value to check.
  6720. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  6721. */
  6722. function isKeyable(value) {
  6723. var type = typeof value;
  6724. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  6725. ? (value !== '__proto__')
  6726. : (value === null);
  6727. }
  6728. /**
  6729. * Checks if `func` has a lazy counterpart.
  6730. *
  6731. * @private
  6732. * @param {Function} func The function to check.
  6733. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  6734. * else `false`.
  6735. */
  6736. function isLaziable(func) {
  6737. var funcName = getFuncName(func),
  6738. other = lodash[funcName];
  6739. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  6740. return false;
  6741. }
  6742. if (func === other) {
  6743. return true;
  6744. }
  6745. var data = getData(other);
  6746. return !!data && func === data[0];
  6747. }
  6748. /**
  6749. * Checks if `func` has its source masked.
  6750. *
  6751. * @private
  6752. * @param {Function} func The function to check.
  6753. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  6754. */
  6755. function isMasked(func) {
  6756. return !!maskSrcKey && (maskSrcKey in func);
  6757. }
  6758. /**
  6759. * Checks if `func` is capable of being masked.
  6760. *
  6761. * @private
  6762. * @param {*} value The value to check.
  6763. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  6764. */
  6765. var isMaskable = coreJsData ? isFunction : stubFalse;
  6766. /**
  6767. * Checks if `value` is likely a prototype object.
  6768. *
  6769. * @private
  6770. * @param {*} value The value to check.
  6771. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  6772. */
  6773. function isPrototype(value) {
  6774. var Ctor = value && value.constructor,
  6775. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  6776. return value === proto;
  6777. }
  6778. /**
  6779. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  6780. *
  6781. * @private
  6782. * @param {*} value The value to check.
  6783. * @returns {boolean} Returns `true` if `value` if suitable for strict
  6784. * equality comparisons, else `false`.
  6785. */
  6786. function isStrictComparable(value) {
  6787. return value === value && !isObject(value);
  6788. }
  6789. /**
  6790. * A specialized version of `matchesProperty` for source values suitable
  6791. * for strict equality comparisons, i.e. `===`.
  6792. *
  6793. * @private
  6794. * @param {string} key The key of the property to get.
  6795. * @param {*} srcValue The value to match.
  6796. * @returns {Function} Returns the new spec function.
  6797. */
  6798. function matchesStrictComparable(key, srcValue) {
  6799. return function(object) {
  6800. if (object == null) {
  6801. return false;
  6802. }
  6803. return object[key] === srcValue &&
  6804. (srcValue !== undefined || (key in Object(object)));
  6805. };
  6806. }
  6807. /**
  6808. * A specialized version of `_.memoize` which clears the memoized function's
  6809. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  6810. *
  6811. * @private
  6812. * @param {Function} func The function to have its output memoized.
  6813. * @returns {Function} Returns the new memoized function.
  6814. */
  6815. function memoizeCapped(func) {
  6816. var result = memoize(func, function(key) {
  6817. if (cache.size === MAX_MEMOIZE_SIZE) {
  6818. cache.clear();
  6819. }
  6820. return key;
  6821. });
  6822. var cache = result.cache;
  6823. return result;
  6824. }
  6825. /**
  6826. * Merges the function metadata of `source` into `data`.
  6827. *
  6828. * Merging metadata reduces the number of wrappers used to invoke a function.
  6829. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  6830. * may be applied regardless of execution order. Methods like `_.ary` and
  6831. * `_.rearg` modify function arguments, making the order in which they are
  6832. * executed important, preventing the merging of metadata. However, we make
  6833. * an exception for a safe combined case where curried functions have `_.ary`
  6834. * and or `_.rearg` applied.
  6835. *
  6836. * @private
  6837. * @param {Array} data The destination metadata.
  6838. * @param {Array} source The source metadata.
  6839. * @returns {Array} Returns `data`.
  6840. */
  6841. function mergeData(data, source) {
  6842. var bitmask = data[1],
  6843. srcBitmask = source[1],
  6844. newBitmask = bitmask | srcBitmask,
  6845. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  6846. var isCombo =
  6847. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  6848. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  6849. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  6850. // Exit early if metadata can't be merged.
  6851. if (!(isCommon || isCombo)) {
  6852. return data;
  6853. }
  6854. // Use source `thisArg` if available.
  6855. if (srcBitmask & WRAP_BIND_FLAG) {
  6856. data[2] = source[2];
  6857. // Set when currying a bound function.
  6858. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  6859. }
  6860. // Compose partial arguments.
  6861. var value = source[3];
  6862. if (value) {
  6863. var partials = data[3];
  6864. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  6865. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  6866. }
  6867. // Compose partial right arguments.
  6868. value = source[5];
  6869. if (value) {
  6870. partials = data[5];
  6871. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  6872. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  6873. }
  6874. // Use source `argPos` if available.
  6875. value = source[7];
  6876. if (value) {
  6877. data[7] = value;
  6878. }
  6879. // Use source `ary` if it's smaller.
  6880. if (srcBitmask & WRAP_ARY_FLAG) {
  6881. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  6882. }
  6883. // Use source `arity` if one is not provided.
  6884. if (data[9] == null) {
  6885. data[9] = source[9];
  6886. }
  6887. // Use source `func` and merge bitmasks.
  6888. data[0] = source[0];
  6889. data[1] = newBitmask;
  6890. return data;
  6891. }
  6892. /**
  6893. * This function is like
  6894. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  6895. * except that it includes inherited enumerable properties.
  6896. *
  6897. * @private
  6898. * @param {Object} object The object to query.
  6899. * @returns {Array} Returns the array of property names.
  6900. */
  6901. function nativeKeysIn(object) {
  6902. var result = [];
  6903. if (object != null) {
  6904. for (var key in Object(object)) {
  6905. result.push(key);
  6906. }
  6907. }
  6908. return result;
  6909. }
  6910. /**
  6911. * Converts `value` to a string using `Object.prototype.toString`.
  6912. *
  6913. * @private
  6914. * @param {*} value The value to convert.
  6915. * @returns {string} Returns the converted string.
  6916. */
  6917. function objectToString(value) {
  6918. return nativeObjectToString.call(value);
  6919. }
  6920. /**
  6921. * A specialized version of `baseRest` which transforms the rest array.
  6922. *
  6923. * @private
  6924. * @param {Function} func The function to apply a rest parameter to.
  6925. * @param {number} [start=func.length-1] The start position of the rest parameter.
  6926. * @param {Function} transform The rest array transform.
  6927. * @returns {Function} Returns the new function.
  6928. */
  6929. function overRest(func, start, transform) {
  6930. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  6931. return function() {
  6932. var args = arguments,
  6933. index = -1,
  6934. length = nativeMax(args.length - start, 0),
  6935. array = Array(length);
  6936. while (++index < length) {
  6937. array[index] = args[start + index];
  6938. }
  6939. index = -1;
  6940. var otherArgs = Array(start + 1);
  6941. while (++index < start) {
  6942. otherArgs[index] = args[index];
  6943. }
  6944. otherArgs[start] = transform(array);
  6945. return apply(func, this, otherArgs);
  6946. };
  6947. }
  6948. /**
  6949. * Gets the parent value at `path` of `object`.
  6950. *
  6951. * @private
  6952. * @param {Object} object The object to query.
  6953. * @param {Array} path The path to get the parent value of.
  6954. * @returns {*} Returns the parent value.
  6955. */
  6956. function parent(object, path) {
  6957. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  6958. }
  6959. /**
  6960. * Reorder `array` according to the specified indexes where the element at
  6961. * the first index is assigned as the first element, the element at
  6962. * the second index is assigned as the second element, and so on.
  6963. *
  6964. * @private
  6965. * @param {Array} array The array to reorder.
  6966. * @param {Array} indexes The arranged array indexes.
  6967. * @returns {Array} Returns `array`.
  6968. */
  6969. function reorder(array, indexes) {
  6970. var arrLength = array.length,
  6971. length = nativeMin(indexes.length, arrLength),
  6972. oldArray = copyArray(array);
  6973. while (length--) {
  6974. var index = indexes[length];
  6975. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  6976. }
  6977. return array;
  6978. }
  6979. /**
  6980. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  6981. *
  6982. * @private
  6983. * @param {Object} object The object to query.
  6984. * @param {string} key The key of the property to get.
  6985. * @returns {*} Returns the property value.
  6986. */
  6987. function safeGet(object, key) {
  6988. if (key === 'constructor' && typeof object[key] === 'function') {
  6989. return;
  6990. }
  6991. if (key == '__proto__') {
  6992. return;
  6993. }
  6994. return object[key];
  6995. }
  6996. /**
  6997. * Sets metadata for `func`.
  6998. *
  6999. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  7000. * period of time, it will trip its breaker and transition to an identity
  7001. * function to avoid garbage collection pauses in V8. See
  7002. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  7003. * for more details.
  7004. *
  7005. * @private
  7006. * @param {Function} func The function to associate metadata with.
  7007. * @param {*} data The metadata.
  7008. * @returns {Function} Returns `func`.
  7009. */
  7010. var setData = shortOut(baseSetData);
  7011. /**
  7012. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  7013. *
  7014. * @private
  7015. * @param {Function} func The function to delay.
  7016. * @param {number} wait The number of milliseconds to delay invocation.
  7017. * @returns {number|Object} Returns the timer id or timeout object.
  7018. */
  7019. var setTimeout = ctxSetTimeout || function(func, wait) {
  7020. return root.setTimeout(func, wait);
  7021. };
  7022. /**
  7023. * Sets the `toString` method of `func` to return `string`.
  7024. *
  7025. * @private
  7026. * @param {Function} func The function to modify.
  7027. * @param {Function} string The `toString` result.
  7028. * @returns {Function} Returns `func`.
  7029. */
  7030. var setToString = shortOut(baseSetToString);
  7031. /**
  7032. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  7033. * with wrapper details in a comment at the top of the source body.
  7034. *
  7035. * @private
  7036. * @param {Function} wrapper The function to modify.
  7037. * @param {Function} reference The reference function.
  7038. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  7039. * @returns {Function} Returns `wrapper`.
  7040. */
  7041. function setWrapToString(wrapper, reference, bitmask) {
  7042. var source = (reference + '');
  7043. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  7044. }
  7045. /**
  7046. * Creates a function that'll short out and invoke `identity` instead
  7047. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  7048. * milliseconds.
  7049. *
  7050. * @private
  7051. * @param {Function} func The function to restrict.
  7052. * @returns {Function} Returns the new shortable function.
  7053. */
  7054. function shortOut(func) {
  7055. var count = 0,
  7056. lastCalled = 0;
  7057. return function() {
  7058. var stamp = nativeNow(),
  7059. remaining = HOT_SPAN - (stamp - lastCalled);
  7060. lastCalled = stamp;
  7061. if (remaining > 0) {
  7062. if (++count >= HOT_COUNT) {
  7063. return arguments[0];
  7064. }
  7065. } else {
  7066. count = 0;
  7067. }
  7068. return func.apply(undefined, arguments);
  7069. };
  7070. }
  7071. /**
  7072. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  7073. *
  7074. * @private
  7075. * @param {Array} array The array to shuffle.
  7076. * @param {number} [size=array.length] The size of `array`.
  7077. * @returns {Array} Returns `array`.
  7078. */
  7079. function shuffleSelf(array, size) {
  7080. var index = -1,
  7081. length = array.length,
  7082. lastIndex = length - 1;
  7083. size = size === undefined ? length : size;
  7084. while (++index < size) {
  7085. var rand = baseRandom(index, lastIndex),
  7086. value = array[rand];
  7087. array[rand] = array[index];
  7088. array[index] = value;
  7089. }
  7090. array.length = size;
  7091. return array;
  7092. }
  7093. /**
  7094. * Converts `string` to a property path array.
  7095. *
  7096. * @private
  7097. * @param {string} string The string to convert.
  7098. * @returns {Array} Returns the property path array.
  7099. */
  7100. var stringToPath = memoizeCapped(function(string) {
  7101. var result = [];
  7102. if (string.charCodeAt(0) === 46 /* . */) {
  7103. result.push('');
  7104. }
  7105. string.replace(rePropName, function(match, number, quote, subString) {
  7106. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  7107. });
  7108. return result;
  7109. });
  7110. /**
  7111. * Converts `value` to a string key if it's not a string or symbol.
  7112. *
  7113. * @private
  7114. * @param {*} value The value to inspect.
  7115. * @returns {string|symbol} Returns the key.
  7116. */
  7117. function toKey(value) {
  7118. if (typeof value == 'string' || isSymbol(value)) {
  7119. return value;
  7120. }
  7121. var result = (value + '');
  7122. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  7123. }
  7124. /**
  7125. * Converts `func` to its source code.
  7126. *
  7127. * @private
  7128. * @param {Function} func The function to convert.
  7129. * @returns {string} Returns the source code.
  7130. */
  7131. function toSource(func) {
  7132. if (func != null) {
  7133. try {
  7134. return funcToString.call(func);
  7135. } catch (e) {}
  7136. try {
  7137. return (func + '');
  7138. } catch (e) {}
  7139. }
  7140. return '';
  7141. }
  7142. /**
  7143. * Updates wrapper `details` based on `bitmask` flags.
  7144. *
  7145. * @private
  7146. * @returns {Array} details The details to modify.
  7147. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  7148. * @returns {Array} Returns `details`.
  7149. */
  7150. function updateWrapDetails(details, bitmask) {
  7151. arrayEach(wrapFlags, function(pair) {
  7152. var value = '_.' + pair[0];
  7153. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  7154. details.push(value);
  7155. }
  7156. });
  7157. return details.sort();
  7158. }
  7159. /**
  7160. * Creates a clone of `wrapper`.
  7161. *
  7162. * @private
  7163. * @param {Object} wrapper The wrapper to clone.
  7164. * @returns {Object} Returns the cloned wrapper.
  7165. */
  7166. function wrapperClone(wrapper) {
  7167. if (wrapper instanceof LazyWrapper) {
  7168. return wrapper.clone();
  7169. }
  7170. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  7171. result.__actions__ = copyArray(wrapper.__actions__);
  7172. result.__index__ = wrapper.__index__;
  7173. result.__values__ = wrapper.__values__;
  7174. return result;
  7175. }
  7176. /*------------------------------------------------------------------------*/
  7177. /**
  7178. * Creates an array of elements split into groups the length of `size`.
  7179. * If `array` can't be split evenly, the final chunk will be the remaining
  7180. * elements.
  7181. *
  7182. * @static
  7183. * @memberOf _
  7184. * @since 3.0.0
  7185. * @category Array
  7186. * @param {Array} array The array to process.
  7187. * @param {number} [size=1] The length of each chunk
  7188. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7189. * @returns {Array} Returns the new array of chunks.
  7190. * @example
  7191. *
  7192. * _.chunk(['a', 'b', 'c', 'd'], 2);
  7193. * // => [['a', 'b'], ['c', 'd']]
  7194. *
  7195. * _.chunk(['a', 'b', 'c', 'd'], 3);
  7196. * // => [['a', 'b', 'c'], ['d']]
  7197. */
  7198. function chunk(array, size, guard) {
  7199. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  7200. size = 1;
  7201. } else {
  7202. size = nativeMax(toInteger(size), 0);
  7203. }
  7204. var length = array == null ? 0 : array.length;
  7205. if (!length || size < 1) {
  7206. return [];
  7207. }
  7208. var index = 0,
  7209. resIndex = 0,
  7210. result = Array(nativeCeil(length / size));
  7211. while (index < length) {
  7212. result[resIndex++] = baseSlice(array, index, (index += size));
  7213. }
  7214. return result;
  7215. }
  7216. /**
  7217. * Creates an array with all falsey values removed. The values `false`, `null`,
  7218. * `0`, `""`, `undefined`, and `NaN` are falsey.
  7219. *
  7220. * @static
  7221. * @memberOf _
  7222. * @since 0.1.0
  7223. * @category Array
  7224. * @param {Array} array The array to compact.
  7225. * @returns {Array} Returns the new array of filtered values.
  7226. * @example
  7227. *
  7228. * _.compact([0, 1, false, 2, '', 3]);
  7229. * // => [1, 2, 3]
  7230. */
  7231. function compact(array) {
  7232. var index = -1,
  7233. length = array == null ? 0 : array.length,
  7234. resIndex = 0,
  7235. result = [];
  7236. while (++index < length) {
  7237. var value = array[index];
  7238. if (value) {
  7239. result[resIndex++] = value;
  7240. }
  7241. }
  7242. return result;
  7243. }
  7244. /**
  7245. * Creates a new array concatenating `array` with any additional arrays
  7246. * and/or values.
  7247. *
  7248. * @static
  7249. * @memberOf _
  7250. * @since 4.0.0
  7251. * @category Array
  7252. * @param {Array} array The array to concatenate.
  7253. * @param {...*} [values] The values to concatenate.
  7254. * @returns {Array} Returns the new concatenated array.
  7255. * @example
  7256. *
  7257. * var array = [1];
  7258. * var other = _.concat(array, 2, [3], [[4]]);
  7259. *
  7260. * console.log(other);
  7261. * // => [1, 2, 3, [4]]
  7262. *
  7263. * console.log(array);
  7264. * // => [1]
  7265. */
  7266. function concat() {
  7267. var length = arguments.length;
  7268. if (!length) {
  7269. return [];
  7270. }
  7271. var args = Array(length - 1),
  7272. array = arguments[0],
  7273. index = length;
  7274. while (index--) {
  7275. args[index - 1] = arguments[index];
  7276. }
  7277. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  7278. }
  7279. /**
  7280. * Creates an array of `array` values not included in the other given arrays
  7281. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7282. * for equality comparisons. The order and references of result values are
  7283. * determined by the first array.
  7284. *
  7285. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  7286. *
  7287. * @static
  7288. * @memberOf _
  7289. * @since 0.1.0
  7290. * @category Array
  7291. * @param {Array} array The array to inspect.
  7292. * @param {...Array} [values] The values to exclude.
  7293. * @returns {Array} Returns the new array of filtered values.
  7294. * @see _.without, _.xor
  7295. * @example
  7296. *
  7297. * _.difference([2, 1], [2, 3]);
  7298. * // => [1]
  7299. */
  7300. var difference = baseRest(function(array, values) {
  7301. return isArrayLikeObject(array)
  7302. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  7303. : [];
  7304. });
  7305. /**
  7306. * This method is like `_.difference` except that it accepts `iteratee` which
  7307. * is invoked for each element of `array` and `values` to generate the criterion
  7308. * by which they're compared. The order and references of result values are
  7309. * determined by the first array. The iteratee is invoked with one argument:
  7310. * (value).
  7311. *
  7312. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  7313. *
  7314. * @static
  7315. * @memberOf _
  7316. * @since 4.0.0
  7317. * @category Array
  7318. * @param {Array} array The array to inspect.
  7319. * @param {...Array} [values] The values to exclude.
  7320. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7321. * @returns {Array} Returns the new array of filtered values.
  7322. * @example
  7323. *
  7324. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  7325. * // => [1.2]
  7326. *
  7327. * // The `_.property` iteratee shorthand.
  7328. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  7329. * // => [{ 'x': 2 }]
  7330. */
  7331. var differenceBy = baseRest(function(array, values) {
  7332. var iteratee = last(values);
  7333. if (isArrayLikeObject(iteratee)) {
  7334. iteratee = undefined;
  7335. }
  7336. return isArrayLikeObject(array)
  7337. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  7338. : [];
  7339. });
  7340. /**
  7341. * This method is like `_.difference` except that it accepts `comparator`
  7342. * which is invoked to compare elements of `array` to `values`. The order and
  7343. * references of result values are determined by the first array. The comparator
  7344. * is invoked with two arguments: (arrVal, othVal).
  7345. *
  7346. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  7347. *
  7348. * @static
  7349. * @memberOf _
  7350. * @since 4.0.0
  7351. * @category Array
  7352. * @param {Array} array The array to inspect.
  7353. * @param {...Array} [values] The values to exclude.
  7354. * @param {Function} [comparator] The comparator invoked per element.
  7355. * @returns {Array} Returns the new array of filtered values.
  7356. * @example
  7357. *
  7358. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  7359. *
  7360. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  7361. * // => [{ 'x': 2, 'y': 1 }]
  7362. */
  7363. var differenceWith = baseRest(function(array, values) {
  7364. var comparator = last(values);
  7365. if (isArrayLikeObject(comparator)) {
  7366. comparator = undefined;
  7367. }
  7368. return isArrayLikeObject(array)
  7369. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  7370. : [];
  7371. });
  7372. /**
  7373. * Creates a slice of `array` with `n` elements dropped from the beginning.
  7374. *
  7375. * @static
  7376. * @memberOf _
  7377. * @since 0.5.0
  7378. * @category Array
  7379. * @param {Array} array The array to query.
  7380. * @param {number} [n=1] The number of elements to drop.
  7381. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7382. * @returns {Array} Returns the slice of `array`.
  7383. * @example
  7384. *
  7385. * _.drop([1, 2, 3]);
  7386. * // => [2, 3]
  7387. *
  7388. * _.drop([1, 2, 3], 2);
  7389. * // => [3]
  7390. *
  7391. * _.drop([1, 2, 3], 5);
  7392. * // => []
  7393. *
  7394. * _.drop([1, 2, 3], 0);
  7395. * // => [1, 2, 3]
  7396. */
  7397. function drop(array, n, guard) {
  7398. var length = array == null ? 0 : array.length;
  7399. if (!length) {
  7400. return [];
  7401. }
  7402. n = (guard || n === undefined) ? 1 : toInteger(n);
  7403. return baseSlice(array, n < 0 ? 0 : n, length);
  7404. }
  7405. /**
  7406. * Creates a slice of `array` with `n` elements dropped from the end.
  7407. *
  7408. * @static
  7409. * @memberOf _
  7410. * @since 3.0.0
  7411. * @category Array
  7412. * @param {Array} array The array to query.
  7413. * @param {number} [n=1] The number of elements to drop.
  7414. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  7415. * @returns {Array} Returns the slice of `array`.
  7416. * @example
  7417. *
  7418. * _.dropRight([1, 2, 3]);
  7419. * // => [1, 2]
  7420. *
  7421. * _.dropRight([1, 2, 3], 2);
  7422. * // => [1]
  7423. *
  7424. * _.dropRight([1, 2, 3], 5);
  7425. * // => []
  7426. *
  7427. * _.dropRight([1, 2, 3], 0);
  7428. * // => [1, 2, 3]
  7429. */
  7430. function dropRight(array, n, guard) {
  7431. var length = array == null ? 0 : array.length;
  7432. if (!length) {
  7433. return [];
  7434. }
  7435. n = (guard || n === undefined) ? 1 : toInteger(n);
  7436. n = length - n;
  7437. return baseSlice(array, 0, n < 0 ? 0 : n);
  7438. }
  7439. /**
  7440. * Creates a slice of `array` excluding elements dropped from the end.
  7441. * Elements are dropped until `predicate` returns falsey. The predicate is
  7442. * invoked with three arguments: (value, index, array).
  7443. *
  7444. * @static
  7445. * @memberOf _
  7446. * @since 3.0.0
  7447. * @category Array
  7448. * @param {Array} array The array to query.
  7449. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7450. * @returns {Array} Returns the slice of `array`.
  7451. * @example
  7452. *
  7453. * var users = [
  7454. * { 'user': 'barney', 'active': true },
  7455. * { 'user': 'fred', 'active': false },
  7456. * { 'user': 'pebbles', 'active': false }
  7457. * ];
  7458. *
  7459. * _.dropRightWhile(users, function(o) { return !o.active; });
  7460. * // => objects for ['barney']
  7461. *
  7462. * // The `_.matches` iteratee shorthand.
  7463. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  7464. * // => objects for ['barney', 'fred']
  7465. *
  7466. * // The `_.matchesProperty` iteratee shorthand.
  7467. * _.dropRightWhile(users, ['active', false]);
  7468. * // => objects for ['barney']
  7469. *
  7470. * // The `_.property` iteratee shorthand.
  7471. * _.dropRightWhile(users, 'active');
  7472. * // => objects for ['barney', 'fred', 'pebbles']
  7473. */
  7474. function dropRightWhile(array, predicate) {
  7475. return (array && array.length)
  7476. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  7477. : [];
  7478. }
  7479. /**
  7480. * Creates a slice of `array` excluding elements dropped from the beginning.
  7481. * Elements are dropped until `predicate` returns falsey. The predicate is
  7482. * invoked with three arguments: (value, index, array).
  7483. *
  7484. * @static
  7485. * @memberOf _
  7486. * @since 3.0.0
  7487. * @category Array
  7488. * @param {Array} array The array to query.
  7489. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7490. * @returns {Array} Returns the slice of `array`.
  7491. * @example
  7492. *
  7493. * var users = [
  7494. * { 'user': 'barney', 'active': false },
  7495. * { 'user': 'fred', 'active': false },
  7496. * { 'user': 'pebbles', 'active': true }
  7497. * ];
  7498. *
  7499. * _.dropWhile(users, function(o) { return !o.active; });
  7500. * // => objects for ['pebbles']
  7501. *
  7502. * // The `_.matches` iteratee shorthand.
  7503. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  7504. * // => objects for ['fred', 'pebbles']
  7505. *
  7506. * // The `_.matchesProperty` iteratee shorthand.
  7507. * _.dropWhile(users, ['active', false]);
  7508. * // => objects for ['pebbles']
  7509. *
  7510. * // The `_.property` iteratee shorthand.
  7511. * _.dropWhile(users, 'active');
  7512. * // => objects for ['barney', 'fred', 'pebbles']
  7513. */
  7514. function dropWhile(array, predicate) {
  7515. return (array && array.length)
  7516. ? baseWhile(array, getIteratee(predicate, 3), true)
  7517. : [];
  7518. }
  7519. /**
  7520. * Fills elements of `array` with `value` from `start` up to, but not
  7521. * including, `end`.
  7522. *
  7523. * **Note:** This method mutates `array`.
  7524. *
  7525. * @static
  7526. * @memberOf _
  7527. * @since 3.2.0
  7528. * @category Array
  7529. * @param {Array} array The array to fill.
  7530. * @param {*} value The value to fill `array` with.
  7531. * @param {number} [start=0] The start position.
  7532. * @param {number} [end=array.length] The end position.
  7533. * @returns {Array} Returns `array`.
  7534. * @example
  7535. *
  7536. * var array = [1, 2, 3];
  7537. *
  7538. * _.fill(array, 'a');
  7539. * console.log(array);
  7540. * // => ['a', 'a', 'a']
  7541. *
  7542. * _.fill(Array(3), 2);
  7543. * // => [2, 2, 2]
  7544. *
  7545. * _.fill([4, 6, 8, 10], '*', 1, 3);
  7546. * // => [4, '*', '*', 10]
  7547. */
  7548. function fill(array, value, start, end) {
  7549. var length = array == null ? 0 : array.length;
  7550. if (!length) {
  7551. return [];
  7552. }
  7553. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  7554. start = 0;
  7555. end = length;
  7556. }
  7557. return baseFill(array, value, start, end);
  7558. }
  7559. /**
  7560. * This method is like `_.find` except that it returns the index of the first
  7561. * element `predicate` returns truthy for instead of the element itself.
  7562. *
  7563. * @static
  7564. * @memberOf _
  7565. * @since 1.1.0
  7566. * @category Array
  7567. * @param {Array} array The array to inspect.
  7568. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7569. * @param {number} [fromIndex=0] The index to search from.
  7570. * @returns {number} Returns the index of the found element, else `-1`.
  7571. * @example
  7572. *
  7573. * var users = [
  7574. * { 'user': 'barney', 'active': false },
  7575. * { 'user': 'fred', 'active': false },
  7576. * { 'user': 'pebbles', 'active': true }
  7577. * ];
  7578. *
  7579. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  7580. * // => 0
  7581. *
  7582. * // The `_.matches` iteratee shorthand.
  7583. * _.findIndex(users, { 'user': 'fred', 'active': false });
  7584. * // => 1
  7585. *
  7586. * // The `_.matchesProperty` iteratee shorthand.
  7587. * _.findIndex(users, ['active', false]);
  7588. * // => 0
  7589. *
  7590. * // The `_.property` iteratee shorthand.
  7591. * _.findIndex(users, 'active');
  7592. * // => 2
  7593. */
  7594. function findIndex(array, predicate, fromIndex) {
  7595. var length = array == null ? 0 : array.length;
  7596. if (!length) {
  7597. return -1;
  7598. }
  7599. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  7600. if (index < 0) {
  7601. index = nativeMax(length + index, 0);
  7602. }
  7603. return baseFindIndex(array, getIteratee(predicate, 3), index);
  7604. }
  7605. /**
  7606. * This method is like `_.findIndex` except that it iterates over elements
  7607. * of `collection` from right to left.
  7608. *
  7609. * @static
  7610. * @memberOf _
  7611. * @since 2.0.0
  7612. * @category Array
  7613. * @param {Array} array The array to inspect.
  7614. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  7615. * @param {number} [fromIndex=array.length-1] The index to search from.
  7616. * @returns {number} Returns the index of the found element, else `-1`.
  7617. * @example
  7618. *
  7619. * var users = [
  7620. * { 'user': 'barney', 'active': true },
  7621. * { 'user': 'fred', 'active': false },
  7622. * { 'user': 'pebbles', 'active': false }
  7623. * ];
  7624. *
  7625. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  7626. * // => 2
  7627. *
  7628. * // The `_.matches` iteratee shorthand.
  7629. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  7630. * // => 0
  7631. *
  7632. * // The `_.matchesProperty` iteratee shorthand.
  7633. * _.findLastIndex(users, ['active', false]);
  7634. * // => 2
  7635. *
  7636. * // The `_.property` iteratee shorthand.
  7637. * _.findLastIndex(users, 'active');
  7638. * // => 0
  7639. */
  7640. function findLastIndex(array, predicate, fromIndex) {
  7641. var length = array == null ? 0 : array.length;
  7642. if (!length) {
  7643. return -1;
  7644. }
  7645. var index = length - 1;
  7646. if (fromIndex !== undefined) {
  7647. index = toInteger(fromIndex);
  7648. index = fromIndex < 0
  7649. ? nativeMax(length + index, 0)
  7650. : nativeMin(index, length - 1);
  7651. }
  7652. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  7653. }
  7654. /**
  7655. * Flattens `array` a single level deep.
  7656. *
  7657. * @static
  7658. * @memberOf _
  7659. * @since 0.1.0
  7660. * @category Array
  7661. * @param {Array} array The array to flatten.
  7662. * @returns {Array} Returns the new flattened array.
  7663. * @example
  7664. *
  7665. * _.flatten([1, [2, [3, [4]], 5]]);
  7666. * // => [1, 2, [3, [4]], 5]
  7667. */
  7668. function flatten(array) {
  7669. var length = array == null ? 0 : array.length;
  7670. return length ? baseFlatten(array, 1) : [];
  7671. }
  7672. /**
  7673. * Recursively flattens `array`.
  7674. *
  7675. * @static
  7676. * @memberOf _
  7677. * @since 3.0.0
  7678. * @category Array
  7679. * @param {Array} array The array to flatten.
  7680. * @returns {Array} Returns the new flattened array.
  7681. * @example
  7682. *
  7683. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  7684. * // => [1, 2, 3, 4, 5]
  7685. */
  7686. function flattenDeep(array) {
  7687. var length = array == null ? 0 : array.length;
  7688. return length ? baseFlatten(array, INFINITY) : [];
  7689. }
  7690. /**
  7691. * Recursively flatten `array` up to `depth` times.
  7692. *
  7693. * @static
  7694. * @memberOf _
  7695. * @since 4.4.0
  7696. * @category Array
  7697. * @param {Array} array The array to flatten.
  7698. * @param {number} [depth=1] The maximum recursion depth.
  7699. * @returns {Array} Returns the new flattened array.
  7700. * @example
  7701. *
  7702. * var array = [1, [2, [3, [4]], 5]];
  7703. *
  7704. * _.flattenDepth(array, 1);
  7705. * // => [1, 2, [3, [4]], 5]
  7706. *
  7707. * _.flattenDepth(array, 2);
  7708. * // => [1, 2, 3, [4], 5]
  7709. */
  7710. function flattenDepth(array, depth) {
  7711. var length = array == null ? 0 : array.length;
  7712. if (!length) {
  7713. return [];
  7714. }
  7715. depth = depth === undefined ? 1 : toInteger(depth);
  7716. return baseFlatten(array, depth);
  7717. }
  7718. /**
  7719. * The inverse of `_.toPairs`; this method returns an object composed
  7720. * from key-value `pairs`.
  7721. *
  7722. * @static
  7723. * @memberOf _
  7724. * @since 4.0.0
  7725. * @category Array
  7726. * @param {Array} pairs The key-value pairs.
  7727. * @returns {Object} Returns the new object.
  7728. * @example
  7729. *
  7730. * _.fromPairs([['a', 1], ['b', 2]]);
  7731. * // => { 'a': 1, 'b': 2 }
  7732. */
  7733. function fromPairs(pairs) {
  7734. var index = -1,
  7735. length = pairs == null ? 0 : pairs.length,
  7736. result = {};
  7737. while (++index < length) {
  7738. var pair = pairs[index];
  7739. result[pair[0]] = pair[1];
  7740. }
  7741. return result;
  7742. }
  7743. /**
  7744. * Gets the first element of `array`.
  7745. *
  7746. * @static
  7747. * @memberOf _
  7748. * @since 0.1.0
  7749. * @alias first
  7750. * @category Array
  7751. * @param {Array} array The array to query.
  7752. * @returns {*} Returns the first element of `array`.
  7753. * @example
  7754. *
  7755. * _.head([1, 2, 3]);
  7756. * // => 1
  7757. *
  7758. * _.head([]);
  7759. * // => undefined
  7760. */
  7761. function head(array) {
  7762. return (array && array.length) ? array[0] : undefined;
  7763. }
  7764. /**
  7765. * Gets the index at which the first occurrence of `value` is found in `array`
  7766. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7767. * for equality comparisons. If `fromIndex` is negative, it's used as the
  7768. * offset from the end of `array`.
  7769. *
  7770. * @static
  7771. * @memberOf _
  7772. * @since 0.1.0
  7773. * @category Array
  7774. * @param {Array} array The array to inspect.
  7775. * @param {*} value The value to search for.
  7776. * @param {number} [fromIndex=0] The index to search from.
  7777. * @returns {number} Returns the index of the matched value, else `-1`.
  7778. * @example
  7779. *
  7780. * _.indexOf([1, 2, 1, 2], 2);
  7781. * // => 1
  7782. *
  7783. * // Search from the `fromIndex`.
  7784. * _.indexOf([1, 2, 1, 2], 2, 2);
  7785. * // => 3
  7786. */
  7787. function indexOf(array, value, fromIndex) {
  7788. var length = array == null ? 0 : array.length;
  7789. if (!length) {
  7790. return -1;
  7791. }
  7792. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  7793. if (index < 0) {
  7794. index = nativeMax(length + index, 0);
  7795. }
  7796. return baseIndexOf(array, value, index);
  7797. }
  7798. /**
  7799. * Gets all but the last element of `array`.
  7800. *
  7801. * @static
  7802. * @memberOf _
  7803. * @since 0.1.0
  7804. * @category Array
  7805. * @param {Array} array The array to query.
  7806. * @returns {Array} Returns the slice of `array`.
  7807. * @example
  7808. *
  7809. * _.initial([1, 2, 3]);
  7810. * // => [1, 2]
  7811. */
  7812. function initial(array) {
  7813. var length = array == null ? 0 : array.length;
  7814. return length ? baseSlice(array, 0, -1) : [];
  7815. }
  7816. /**
  7817. * Creates an array of unique values that are included in all given arrays
  7818. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  7819. * for equality comparisons. The order and references of result values are
  7820. * determined by the first array.
  7821. *
  7822. * @static
  7823. * @memberOf _
  7824. * @since 0.1.0
  7825. * @category Array
  7826. * @param {...Array} [arrays] The arrays to inspect.
  7827. * @returns {Array} Returns the new array of intersecting values.
  7828. * @example
  7829. *
  7830. * _.intersection([2, 1], [2, 3]);
  7831. * // => [2]
  7832. */
  7833. var intersection = baseRest(function(arrays) {
  7834. var mapped = arrayMap(arrays, castArrayLikeObject);
  7835. return (mapped.length && mapped[0] === arrays[0])
  7836. ? baseIntersection(mapped)
  7837. : [];
  7838. });
  7839. /**
  7840. * This method is like `_.intersection` except that it accepts `iteratee`
  7841. * which is invoked for each element of each `arrays` to generate the criterion
  7842. * by which they're compared. The order and references of result values are
  7843. * determined by the first array. The iteratee is invoked with one argument:
  7844. * (value).
  7845. *
  7846. * @static
  7847. * @memberOf _
  7848. * @since 4.0.0
  7849. * @category Array
  7850. * @param {...Array} [arrays] The arrays to inspect.
  7851. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  7852. * @returns {Array} Returns the new array of intersecting values.
  7853. * @example
  7854. *
  7855. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  7856. * // => [2.1]
  7857. *
  7858. * // The `_.property` iteratee shorthand.
  7859. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  7860. * // => [{ 'x': 1 }]
  7861. */
  7862. var intersectionBy = baseRest(function(arrays) {
  7863. var iteratee = last(arrays),
  7864. mapped = arrayMap(arrays, castArrayLikeObject);
  7865. if (iteratee === last(mapped)) {
  7866. iteratee = undefined;
  7867. } else {
  7868. mapped.pop();
  7869. }
  7870. return (mapped.length && mapped[0] === arrays[0])
  7871. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  7872. : [];
  7873. });
  7874. /**
  7875. * This method is like `_.intersection` except that it accepts `comparator`
  7876. * which is invoked to compare elements of `arrays`. The order and references
  7877. * of result values are determined by the first array. The comparator is
  7878. * invoked with two arguments: (arrVal, othVal).
  7879. *
  7880. * @static
  7881. * @memberOf _
  7882. * @since 4.0.0
  7883. * @category Array
  7884. * @param {...Array} [arrays] The arrays to inspect.
  7885. * @param {Function} [comparator] The comparator invoked per element.
  7886. * @returns {Array} Returns the new array of intersecting values.
  7887. * @example
  7888. *
  7889. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  7890. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  7891. *
  7892. * _.intersectionWith(objects, others, _.isEqual);
  7893. * // => [{ 'x': 1, 'y': 2 }]
  7894. */
  7895. var intersectionWith = baseRest(function(arrays) {
  7896. var comparator = last(arrays),
  7897. mapped = arrayMap(arrays, castArrayLikeObject);
  7898. comparator = typeof comparator == 'function' ? comparator : undefined;
  7899. if (comparator) {
  7900. mapped.pop();
  7901. }
  7902. return (mapped.length && mapped[0] === arrays[0])
  7903. ? baseIntersection(mapped, undefined, comparator)
  7904. : [];
  7905. });
  7906. /**
  7907. * Converts all elements in `array` into a string separated by `separator`.
  7908. *
  7909. * @static
  7910. * @memberOf _
  7911. * @since 4.0.0
  7912. * @category Array
  7913. * @param {Array} array The array to convert.
  7914. * @param {string} [separator=','] The element separator.
  7915. * @returns {string} Returns the joined string.
  7916. * @example
  7917. *
  7918. * _.join(['a', 'b', 'c'], '~');
  7919. * // => 'a~b~c'
  7920. */
  7921. function join(array, separator) {
  7922. return array == null ? '' : nativeJoin.call(array, separator);
  7923. }
  7924. /**
  7925. * Gets the last element of `array`.
  7926. *
  7927. * @static
  7928. * @memberOf _
  7929. * @since 0.1.0
  7930. * @category Array
  7931. * @param {Array} array The array to query.
  7932. * @returns {*} Returns the last element of `array`.
  7933. * @example
  7934. *
  7935. * _.last([1, 2, 3]);
  7936. * // => 3
  7937. */
  7938. function last(array) {
  7939. var length = array == null ? 0 : array.length;
  7940. return length ? array[length - 1] : undefined;
  7941. }
  7942. /**
  7943. * This method is like `_.indexOf` except that it iterates over elements of
  7944. * `array` from right to left.
  7945. *
  7946. * @static
  7947. * @memberOf _
  7948. * @since 0.1.0
  7949. * @category Array
  7950. * @param {Array} array The array to inspect.
  7951. * @param {*} value The value to search for.
  7952. * @param {number} [fromIndex=array.length-1] The index to search from.
  7953. * @returns {number} Returns the index of the matched value, else `-1`.
  7954. * @example
  7955. *
  7956. * _.lastIndexOf([1, 2, 1, 2], 2);
  7957. * // => 3
  7958. *
  7959. * // Search from the `fromIndex`.
  7960. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  7961. * // => 1
  7962. */
  7963. function lastIndexOf(array, value, fromIndex) {
  7964. var length = array == null ? 0 : array.length;
  7965. if (!length) {
  7966. return -1;
  7967. }
  7968. var index = length;
  7969. if (fromIndex !== undefined) {
  7970. index = toInteger(fromIndex);
  7971. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  7972. }
  7973. return value === value
  7974. ? strictLastIndexOf(array, value, index)
  7975. : baseFindIndex(array, baseIsNaN, index, true);
  7976. }
  7977. /**
  7978. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  7979. * element from the end is returned.
  7980. *
  7981. * @static
  7982. * @memberOf _
  7983. * @since 4.11.0
  7984. * @category Array
  7985. * @param {Array} array The array to query.
  7986. * @param {number} [n=0] The index of the element to return.
  7987. * @returns {*} Returns the nth element of `array`.
  7988. * @example
  7989. *
  7990. * var array = ['a', 'b', 'c', 'd'];
  7991. *
  7992. * _.nth(array, 1);
  7993. * // => 'b'
  7994. *
  7995. * _.nth(array, -2);
  7996. * // => 'c';
  7997. */
  7998. function nth(array, n) {
  7999. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  8000. }
  8001. /**
  8002. * Removes all given values from `array` using
  8003. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8004. * for equality comparisons.
  8005. *
  8006. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  8007. * to remove elements from an array by predicate.
  8008. *
  8009. * @static
  8010. * @memberOf _
  8011. * @since 2.0.0
  8012. * @category Array
  8013. * @param {Array} array The array to modify.
  8014. * @param {...*} [values] The values to remove.
  8015. * @returns {Array} Returns `array`.
  8016. * @example
  8017. *
  8018. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  8019. *
  8020. * _.pull(array, 'a', 'c');
  8021. * console.log(array);
  8022. * // => ['b', 'b']
  8023. */
  8024. var pull = baseRest(pullAll);
  8025. /**
  8026. * This method is like `_.pull` except that it accepts an array of values to remove.
  8027. *
  8028. * **Note:** Unlike `_.difference`, this method mutates `array`.
  8029. *
  8030. * @static
  8031. * @memberOf _
  8032. * @since 4.0.0
  8033. * @category Array
  8034. * @param {Array} array The array to modify.
  8035. * @param {Array} values The values to remove.
  8036. * @returns {Array} Returns `array`.
  8037. * @example
  8038. *
  8039. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  8040. *
  8041. * _.pullAll(array, ['a', 'c']);
  8042. * console.log(array);
  8043. * // => ['b', 'b']
  8044. */
  8045. function pullAll(array, values) {
  8046. return (array && array.length && values && values.length)
  8047. ? basePullAll(array, values)
  8048. : array;
  8049. }
  8050. /**
  8051. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  8052. * invoked for each element of `array` and `values` to generate the criterion
  8053. * by which they're compared. The iteratee is invoked with one argument: (value).
  8054. *
  8055. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  8056. *
  8057. * @static
  8058. * @memberOf _
  8059. * @since 4.0.0
  8060. * @category Array
  8061. * @param {Array} array The array to modify.
  8062. * @param {Array} values The values to remove.
  8063. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8064. * @returns {Array} Returns `array`.
  8065. * @example
  8066. *
  8067. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  8068. *
  8069. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  8070. * console.log(array);
  8071. * // => [{ 'x': 2 }]
  8072. */
  8073. function pullAllBy(array, values, iteratee) {
  8074. return (array && array.length && values && values.length)
  8075. ? basePullAll(array, values, getIteratee(iteratee, 2))
  8076. : array;
  8077. }
  8078. /**
  8079. * This method is like `_.pullAll` except that it accepts `comparator` which
  8080. * is invoked to compare elements of `array` to `values`. The comparator is
  8081. * invoked with two arguments: (arrVal, othVal).
  8082. *
  8083. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  8084. *
  8085. * @static
  8086. * @memberOf _
  8087. * @since 4.6.0
  8088. * @category Array
  8089. * @param {Array} array The array to modify.
  8090. * @param {Array} values The values to remove.
  8091. * @param {Function} [comparator] The comparator invoked per element.
  8092. * @returns {Array} Returns `array`.
  8093. * @example
  8094. *
  8095. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  8096. *
  8097. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  8098. * console.log(array);
  8099. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  8100. */
  8101. function pullAllWith(array, values, comparator) {
  8102. return (array && array.length && values && values.length)
  8103. ? basePullAll(array, values, undefined, comparator)
  8104. : array;
  8105. }
  8106. /**
  8107. * Removes elements from `array` corresponding to `indexes` and returns an
  8108. * array of removed elements.
  8109. *
  8110. * **Note:** Unlike `_.at`, this method mutates `array`.
  8111. *
  8112. * @static
  8113. * @memberOf _
  8114. * @since 3.0.0
  8115. * @category Array
  8116. * @param {Array} array The array to modify.
  8117. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  8118. * @returns {Array} Returns the new array of removed elements.
  8119. * @example
  8120. *
  8121. * var array = ['a', 'b', 'c', 'd'];
  8122. * var pulled = _.pullAt(array, [1, 3]);
  8123. *
  8124. * console.log(array);
  8125. * // => ['a', 'c']
  8126. *
  8127. * console.log(pulled);
  8128. * // => ['b', 'd']
  8129. */
  8130. var pullAt = flatRest(function(array, indexes) {
  8131. var length = array == null ? 0 : array.length,
  8132. result = baseAt(array, indexes);
  8133. basePullAt(array, arrayMap(indexes, function(index) {
  8134. return isIndex(index, length) ? +index : index;
  8135. }).sort(compareAscending));
  8136. return result;
  8137. });
  8138. /**
  8139. * Removes all elements from `array` that `predicate` returns truthy for
  8140. * and returns an array of the removed elements. The predicate is invoked
  8141. * with three arguments: (value, index, array).
  8142. *
  8143. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  8144. * to pull elements from an array by value.
  8145. *
  8146. * @static
  8147. * @memberOf _
  8148. * @since 2.0.0
  8149. * @category Array
  8150. * @param {Array} array The array to modify.
  8151. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8152. * @returns {Array} Returns the new array of removed elements.
  8153. * @example
  8154. *
  8155. * var array = [1, 2, 3, 4];
  8156. * var evens = _.remove(array, function(n) {
  8157. * return n % 2 == 0;
  8158. * });
  8159. *
  8160. * console.log(array);
  8161. * // => [1, 3]
  8162. *
  8163. * console.log(evens);
  8164. * // => [2, 4]
  8165. */
  8166. function remove(array, predicate) {
  8167. var result = [];
  8168. if (!(array && array.length)) {
  8169. return result;
  8170. }
  8171. var index = -1,
  8172. indexes = [],
  8173. length = array.length;
  8174. predicate = getIteratee(predicate, 3);
  8175. while (++index < length) {
  8176. var value = array[index];
  8177. if (predicate(value, index, array)) {
  8178. result.push(value);
  8179. indexes.push(index);
  8180. }
  8181. }
  8182. basePullAt(array, indexes);
  8183. return result;
  8184. }
  8185. /**
  8186. * Reverses `array` so that the first element becomes the last, the second
  8187. * element becomes the second to last, and so on.
  8188. *
  8189. * **Note:** This method mutates `array` and is based on
  8190. * [`Array#reverse`](https://mdn.io/Array/reverse).
  8191. *
  8192. * @static
  8193. * @memberOf _
  8194. * @since 4.0.0
  8195. * @category Array
  8196. * @param {Array} array The array to modify.
  8197. * @returns {Array} Returns `array`.
  8198. * @example
  8199. *
  8200. * var array = [1, 2, 3];
  8201. *
  8202. * _.reverse(array);
  8203. * // => [3, 2, 1]
  8204. *
  8205. * console.log(array);
  8206. * // => [3, 2, 1]
  8207. */
  8208. function reverse(array) {
  8209. return array == null ? array : nativeReverse.call(array);
  8210. }
  8211. /**
  8212. * Creates a slice of `array` from `start` up to, but not including, `end`.
  8213. *
  8214. * **Note:** This method is used instead of
  8215. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  8216. * returned.
  8217. *
  8218. * @static
  8219. * @memberOf _
  8220. * @since 3.0.0
  8221. * @category Array
  8222. * @param {Array} array The array to slice.
  8223. * @param {number} [start=0] The start position.
  8224. * @param {number} [end=array.length] The end position.
  8225. * @returns {Array} Returns the slice of `array`.
  8226. */
  8227. function slice(array, start, end) {
  8228. var length = array == null ? 0 : array.length;
  8229. if (!length) {
  8230. return [];
  8231. }
  8232. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  8233. start = 0;
  8234. end = length;
  8235. }
  8236. else {
  8237. start = start == null ? 0 : toInteger(start);
  8238. end = end === undefined ? length : toInteger(end);
  8239. }
  8240. return baseSlice(array, start, end);
  8241. }
  8242. /**
  8243. * Uses a binary search to determine the lowest index at which `value`
  8244. * should be inserted into `array` in order to maintain its sort order.
  8245. *
  8246. * @static
  8247. * @memberOf _
  8248. * @since 0.1.0
  8249. * @category Array
  8250. * @param {Array} array The sorted array to inspect.
  8251. * @param {*} value The value to evaluate.
  8252. * @returns {number} Returns the index at which `value` should be inserted
  8253. * into `array`.
  8254. * @example
  8255. *
  8256. * _.sortedIndex([30, 50], 40);
  8257. * // => 1
  8258. */
  8259. function sortedIndex(array, value) {
  8260. return baseSortedIndex(array, value);
  8261. }
  8262. /**
  8263. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  8264. * which is invoked for `value` and each element of `array` to compute their
  8265. * sort ranking. The iteratee is invoked with one argument: (value).
  8266. *
  8267. * @static
  8268. * @memberOf _
  8269. * @since 4.0.0
  8270. * @category Array
  8271. * @param {Array} array The sorted array to inspect.
  8272. * @param {*} value The value to evaluate.
  8273. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8274. * @returns {number} Returns the index at which `value` should be inserted
  8275. * into `array`.
  8276. * @example
  8277. *
  8278. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  8279. *
  8280. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  8281. * // => 0
  8282. *
  8283. * // The `_.property` iteratee shorthand.
  8284. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  8285. * // => 0
  8286. */
  8287. function sortedIndexBy(array, value, iteratee) {
  8288. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  8289. }
  8290. /**
  8291. * This method is like `_.indexOf` except that it performs a binary
  8292. * search on a sorted `array`.
  8293. *
  8294. * @static
  8295. * @memberOf _
  8296. * @since 4.0.0
  8297. * @category Array
  8298. * @param {Array} array The array to inspect.
  8299. * @param {*} value The value to search for.
  8300. * @returns {number} Returns the index of the matched value, else `-1`.
  8301. * @example
  8302. *
  8303. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  8304. * // => 1
  8305. */
  8306. function sortedIndexOf(array, value) {
  8307. var length = array == null ? 0 : array.length;
  8308. if (length) {
  8309. var index = baseSortedIndex(array, value);
  8310. if (index < length && eq(array[index], value)) {
  8311. return index;
  8312. }
  8313. }
  8314. return -1;
  8315. }
  8316. /**
  8317. * This method is like `_.sortedIndex` except that it returns the highest
  8318. * index at which `value` should be inserted into `array` in order to
  8319. * maintain its sort order.
  8320. *
  8321. * @static
  8322. * @memberOf _
  8323. * @since 3.0.0
  8324. * @category Array
  8325. * @param {Array} array The sorted array to inspect.
  8326. * @param {*} value The value to evaluate.
  8327. * @returns {number} Returns the index at which `value` should be inserted
  8328. * into `array`.
  8329. * @example
  8330. *
  8331. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  8332. * // => 4
  8333. */
  8334. function sortedLastIndex(array, value) {
  8335. return baseSortedIndex(array, value, true);
  8336. }
  8337. /**
  8338. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  8339. * which is invoked for `value` and each element of `array` to compute their
  8340. * sort ranking. The iteratee is invoked with one argument: (value).
  8341. *
  8342. * @static
  8343. * @memberOf _
  8344. * @since 4.0.0
  8345. * @category Array
  8346. * @param {Array} array The sorted array to inspect.
  8347. * @param {*} value The value to evaluate.
  8348. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8349. * @returns {number} Returns the index at which `value` should be inserted
  8350. * into `array`.
  8351. * @example
  8352. *
  8353. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  8354. *
  8355. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  8356. * // => 1
  8357. *
  8358. * // The `_.property` iteratee shorthand.
  8359. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  8360. * // => 1
  8361. */
  8362. function sortedLastIndexBy(array, value, iteratee) {
  8363. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  8364. }
  8365. /**
  8366. * This method is like `_.lastIndexOf` except that it performs a binary
  8367. * search on a sorted `array`.
  8368. *
  8369. * @static
  8370. * @memberOf _
  8371. * @since 4.0.0
  8372. * @category Array
  8373. * @param {Array} array The array to inspect.
  8374. * @param {*} value The value to search for.
  8375. * @returns {number} Returns the index of the matched value, else `-1`.
  8376. * @example
  8377. *
  8378. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  8379. * // => 3
  8380. */
  8381. function sortedLastIndexOf(array, value) {
  8382. var length = array == null ? 0 : array.length;
  8383. if (length) {
  8384. var index = baseSortedIndex(array, value, true) - 1;
  8385. if (eq(array[index], value)) {
  8386. return index;
  8387. }
  8388. }
  8389. return -1;
  8390. }
  8391. /**
  8392. * This method is like `_.uniq` except that it's designed and optimized
  8393. * for sorted arrays.
  8394. *
  8395. * @static
  8396. * @memberOf _
  8397. * @since 4.0.0
  8398. * @category Array
  8399. * @param {Array} array The array to inspect.
  8400. * @returns {Array} Returns the new duplicate free array.
  8401. * @example
  8402. *
  8403. * _.sortedUniq([1, 1, 2]);
  8404. * // => [1, 2]
  8405. */
  8406. function sortedUniq(array) {
  8407. return (array && array.length)
  8408. ? baseSortedUniq(array)
  8409. : [];
  8410. }
  8411. /**
  8412. * This method is like `_.uniqBy` except that it's designed and optimized
  8413. * for sorted arrays.
  8414. *
  8415. * @static
  8416. * @memberOf _
  8417. * @since 4.0.0
  8418. * @category Array
  8419. * @param {Array} array The array to inspect.
  8420. * @param {Function} [iteratee] The iteratee invoked per element.
  8421. * @returns {Array} Returns the new duplicate free array.
  8422. * @example
  8423. *
  8424. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  8425. * // => [1.1, 2.3]
  8426. */
  8427. function sortedUniqBy(array, iteratee) {
  8428. return (array && array.length)
  8429. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  8430. : [];
  8431. }
  8432. /**
  8433. * Gets all but the first element of `array`.
  8434. *
  8435. * @static
  8436. * @memberOf _
  8437. * @since 4.0.0
  8438. * @category Array
  8439. * @param {Array} array The array to query.
  8440. * @returns {Array} Returns the slice of `array`.
  8441. * @example
  8442. *
  8443. * _.tail([1, 2, 3]);
  8444. * // => [2, 3]
  8445. */
  8446. function tail(array) {
  8447. var length = array == null ? 0 : array.length;
  8448. return length ? baseSlice(array, 1, length) : [];
  8449. }
  8450. /**
  8451. * Creates a slice of `array` with `n` elements taken from the beginning.
  8452. *
  8453. * @static
  8454. * @memberOf _
  8455. * @since 0.1.0
  8456. * @category Array
  8457. * @param {Array} array The array to query.
  8458. * @param {number} [n=1] The number of elements to take.
  8459. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8460. * @returns {Array} Returns the slice of `array`.
  8461. * @example
  8462. *
  8463. * _.take([1, 2, 3]);
  8464. * // => [1]
  8465. *
  8466. * _.take([1, 2, 3], 2);
  8467. * // => [1, 2]
  8468. *
  8469. * _.take([1, 2, 3], 5);
  8470. * // => [1, 2, 3]
  8471. *
  8472. * _.take([1, 2, 3], 0);
  8473. * // => []
  8474. */
  8475. function take(array, n, guard) {
  8476. if (!(array && array.length)) {
  8477. return [];
  8478. }
  8479. n = (guard || n === undefined) ? 1 : toInteger(n);
  8480. return baseSlice(array, 0, n < 0 ? 0 : n);
  8481. }
  8482. /**
  8483. * Creates a slice of `array` with `n` elements taken from the end.
  8484. *
  8485. * @static
  8486. * @memberOf _
  8487. * @since 3.0.0
  8488. * @category Array
  8489. * @param {Array} array The array to query.
  8490. * @param {number} [n=1] The number of elements to take.
  8491. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8492. * @returns {Array} Returns the slice of `array`.
  8493. * @example
  8494. *
  8495. * _.takeRight([1, 2, 3]);
  8496. * // => [3]
  8497. *
  8498. * _.takeRight([1, 2, 3], 2);
  8499. * // => [2, 3]
  8500. *
  8501. * _.takeRight([1, 2, 3], 5);
  8502. * // => [1, 2, 3]
  8503. *
  8504. * _.takeRight([1, 2, 3], 0);
  8505. * // => []
  8506. */
  8507. function takeRight(array, n, guard) {
  8508. var length = array == null ? 0 : array.length;
  8509. if (!length) {
  8510. return [];
  8511. }
  8512. n = (guard || n === undefined) ? 1 : toInteger(n);
  8513. n = length - n;
  8514. return baseSlice(array, n < 0 ? 0 : n, length);
  8515. }
  8516. /**
  8517. * Creates a slice of `array` with elements taken from the end. Elements are
  8518. * taken until `predicate` returns falsey. The predicate is invoked with
  8519. * three arguments: (value, index, array).
  8520. *
  8521. * @static
  8522. * @memberOf _
  8523. * @since 3.0.0
  8524. * @category Array
  8525. * @param {Array} array The array to query.
  8526. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8527. * @returns {Array} Returns the slice of `array`.
  8528. * @example
  8529. *
  8530. * var users = [
  8531. * { 'user': 'barney', 'active': true },
  8532. * { 'user': 'fred', 'active': false },
  8533. * { 'user': 'pebbles', 'active': false }
  8534. * ];
  8535. *
  8536. * _.takeRightWhile(users, function(o) { return !o.active; });
  8537. * // => objects for ['fred', 'pebbles']
  8538. *
  8539. * // The `_.matches` iteratee shorthand.
  8540. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  8541. * // => objects for ['pebbles']
  8542. *
  8543. * // The `_.matchesProperty` iteratee shorthand.
  8544. * _.takeRightWhile(users, ['active', false]);
  8545. * // => objects for ['fred', 'pebbles']
  8546. *
  8547. * // The `_.property` iteratee shorthand.
  8548. * _.takeRightWhile(users, 'active');
  8549. * // => []
  8550. */
  8551. function takeRightWhile(array, predicate) {
  8552. return (array && array.length)
  8553. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  8554. : [];
  8555. }
  8556. /**
  8557. * Creates a slice of `array` with elements taken from the beginning. Elements
  8558. * are taken until `predicate` returns falsey. The predicate is invoked with
  8559. * three arguments: (value, index, array).
  8560. *
  8561. * @static
  8562. * @memberOf _
  8563. * @since 3.0.0
  8564. * @category Array
  8565. * @param {Array} array The array to query.
  8566. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  8567. * @returns {Array} Returns the slice of `array`.
  8568. * @example
  8569. *
  8570. * var users = [
  8571. * { 'user': 'barney', 'active': false },
  8572. * { 'user': 'fred', 'active': false },
  8573. * { 'user': 'pebbles', 'active': true }
  8574. * ];
  8575. *
  8576. * _.takeWhile(users, function(o) { return !o.active; });
  8577. * // => objects for ['barney', 'fred']
  8578. *
  8579. * // The `_.matches` iteratee shorthand.
  8580. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  8581. * // => objects for ['barney']
  8582. *
  8583. * // The `_.matchesProperty` iteratee shorthand.
  8584. * _.takeWhile(users, ['active', false]);
  8585. * // => objects for ['barney', 'fred']
  8586. *
  8587. * // The `_.property` iteratee shorthand.
  8588. * _.takeWhile(users, 'active');
  8589. * // => []
  8590. */
  8591. function takeWhile(array, predicate) {
  8592. return (array && array.length)
  8593. ? baseWhile(array, getIteratee(predicate, 3))
  8594. : [];
  8595. }
  8596. /**
  8597. * Creates an array of unique values, in order, from all given arrays using
  8598. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8599. * for equality comparisons.
  8600. *
  8601. * @static
  8602. * @memberOf _
  8603. * @since 0.1.0
  8604. * @category Array
  8605. * @param {...Array} [arrays] The arrays to inspect.
  8606. * @returns {Array} Returns the new array of combined values.
  8607. * @example
  8608. *
  8609. * _.union([2], [1, 2]);
  8610. * // => [2, 1]
  8611. */
  8612. var union = baseRest(function(arrays) {
  8613. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  8614. });
  8615. /**
  8616. * This method is like `_.union` except that it accepts `iteratee` which is
  8617. * invoked for each element of each `arrays` to generate the criterion by
  8618. * which uniqueness is computed. Result values are chosen from the first
  8619. * array in which the value occurs. The iteratee is invoked with one argument:
  8620. * (value).
  8621. *
  8622. * @static
  8623. * @memberOf _
  8624. * @since 4.0.0
  8625. * @category Array
  8626. * @param {...Array} [arrays] The arrays to inspect.
  8627. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8628. * @returns {Array} Returns the new array of combined values.
  8629. * @example
  8630. *
  8631. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  8632. * // => [2.1, 1.2]
  8633. *
  8634. * // The `_.property` iteratee shorthand.
  8635. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  8636. * // => [{ 'x': 1 }, { 'x': 2 }]
  8637. */
  8638. var unionBy = baseRest(function(arrays) {
  8639. var iteratee = last(arrays);
  8640. if (isArrayLikeObject(iteratee)) {
  8641. iteratee = undefined;
  8642. }
  8643. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  8644. });
  8645. /**
  8646. * This method is like `_.union` except that it accepts `comparator` which
  8647. * is invoked to compare elements of `arrays`. Result values are chosen from
  8648. * the first array in which the value occurs. The comparator is invoked
  8649. * with two arguments: (arrVal, othVal).
  8650. *
  8651. * @static
  8652. * @memberOf _
  8653. * @since 4.0.0
  8654. * @category Array
  8655. * @param {...Array} [arrays] The arrays to inspect.
  8656. * @param {Function} [comparator] The comparator invoked per element.
  8657. * @returns {Array} Returns the new array of combined values.
  8658. * @example
  8659. *
  8660. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8661. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8662. *
  8663. * _.unionWith(objects, others, _.isEqual);
  8664. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  8665. */
  8666. var unionWith = baseRest(function(arrays) {
  8667. var comparator = last(arrays);
  8668. comparator = typeof comparator == 'function' ? comparator : undefined;
  8669. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  8670. });
  8671. /**
  8672. * Creates a duplicate-free version of an array, using
  8673. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8674. * for equality comparisons, in which only the first occurrence of each element
  8675. * is kept. The order of result values is determined by the order they occur
  8676. * in the array.
  8677. *
  8678. * @static
  8679. * @memberOf _
  8680. * @since 0.1.0
  8681. * @category Array
  8682. * @param {Array} array The array to inspect.
  8683. * @returns {Array} Returns the new duplicate free array.
  8684. * @example
  8685. *
  8686. * _.uniq([2, 1, 2]);
  8687. * // => [2, 1]
  8688. */
  8689. function uniq(array) {
  8690. return (array && array.length) ? baseUniq(array) : [];
  8691. }
  8692. /**
  8693. * This method is like `_.uniq` except that it accepts `iteratee` which is
  8694. * invoked for each element in `array` to generate the criterion by which
  8695. * uniqueness is computed. The order of result values is determined by the
  8696. * order they occur in the array. The iteratee is invoked with one argument:
  8697. * (value).
  8698. *
  8699. * @static
  8700. * @memberOf _
  8701. * @since 4.0.0
  8702. * @category Array
  8703. * @param {Array} array The array to inspect.
  8704. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8705. * @returns {Array} Returns the new duplicate free array.
  8706. * @example
  8707. *
  8708. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  8709. * // => [2.1, 1.2]
  8710. *
  8711. * // The `_.property` iteratee shorthand.
  8712. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  8713. * // => [{ 'x': 1 }, { 'x': 2 }]
  8714. */
  8715. function uniqBy(array, iteratee) {
  8716. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  8717. }
  8718. /**
  8719. * This method is like `_.uniq` except that it accepts `comparator` which
  8720. * is invoked to compare elements of `array`. The order of result values is
  8721. * determined by the order they occur in the array.The comparator is invoked
  8722. * with two arguments: (arrVal, othVal).
  8723. *
  8724. * @static
  8725. * @memberOf _
  8726. * @since 4.0.0
  8727. * @category Array
  8728. * @param {Array} array The array to inspect.
  8729. * @param {Function} [comparator] The comparator invoked per element.
  8730. * @returns {Array} Returns the new duplicate free array.
  8731. * @example
  8732. *
  8733. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8734. *
  8735. * _.uniqWith(objects, _.isEqual);
  8736. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  8737. */
  8738. function uniqWith(array, comparator) {
  8739. comparator = typeof comparator == 'function' ? comparator : undefined;
  8740. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  8741. }
  8742. /**
  8743. * This method is like `_.zip` except that it accepts an array of grouped
  8744. * elements and creates an array regrouping the elements to their pre-zip
  8745. * configuration.
  8746. *
  8747. * @static
  8748. * @memberOf _
  8749. * @since 1.2.0
  8750. * @category Array
  8751. * @param {Array} array The array of grouped elements to process.
  8752. * @returns {Array} Returns the new array of regrouped elements.
  8753. * @example
  8754. *
  8755. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  8756. * // => [['a', 1, true], ['b', 2, false]]
  8757. *
  8758. * _.unzip(zipped);
  8759. * // => [['a', 'b'], [1, 2], [true, false]]
  8760. */
  8761. function unzip(array) {
  8762. if (!(array && array.length)) {
  8763. return [];
  8764. }
  8765. var length = 0;
  8766. array = arrayFilter(array, function(group) {
  8767. if (isArrayLikeObject(group)) {
  8768. length = nativeMax(group.length, length);
  8769. return true;
  8770. }
  8771. });
  8772. return baseTimes(length, function(index) {
  8773. return arrayMap(array, baseProperty(index));
  8774. });
  8775. }
  8776. /**
  8777. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  8778. * how regrouped values should be combined. The iteratee is invoked with the
  8779. * elements of each group: (...group).
  8780. *
  8781. * @static
  8782. * @memberOf _
  8783. * @since 3.8.0
  8784. * @category Array
  8785. * @param {Array} array The array of grouped elements to process.
  8786. * @param {Function} [iteratee=_.identity] The function to combine
  8787. * regrouped values.
  8788. * @returns {Array} Returns the new array of regrouped elements.
  8789. * @example
  8790. *
  8791. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  8792. * // => [[1, 10, 100], [2, 20, 200]]
  8793. *
  8794. * _.unzipWith(zipped, _.add);
  8795. * // => [3, 30, 300]
  8796. */
  8797. function unzipWith(array, iteratee) {
  8798. if (!(array && array.length)) {
  8799. return [];
  8800. }
  8801. var result = unzip(array);
  8802. if (iteratee == null) {
  8803. return result;
  8804. }
  8805. return arrayMap(result, function(group) {
  8806. return apply(iteratee, undefined, group);
  8807. });
  8808. }
  8809. /**
  8810. * Creates an array excluding all given values using
  8811. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8812. * for equality comparisons.
  8813. *
  8814. * **Note:** Unlike `_.pull`, this method returns a new array.
  8815. *
  8816. * @static
  8817. * @memberOf _
  8818. * @since 0.1.0
  8819. * @category Array
  8820. * @param {Array} array The array to inspect.
  8821. * @param {...*} [values] The values to exclude.
  8822. * @returns {Array} Returns the new array of filtered values.
  8823. * @see _.difference, _.xor
  8824. * @example
  8825. *
  8826. * _.without([2, 1, 2, 3], 1, 2);
  8827. * // => [3]
  8828. */
  8829. var without = baseRest(function(array, values) {
  8830. return isArrayLikeObject(array)
  8831. ? baseDifference(array, values)
  8832. : [];
  8833. });
  8834. /**
  8835. * Creates an array of unique values that is the
  8836. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  8837. * of the given arrays. The order of result values is determined by the order
  8838. * they occur in the arrays.
  8839. *
  8840. * @static
  8841. * @memberOf _
  8842. * @since 2.4.0
  8843. * @category Array
  8844. * @param {...Array} [arrays] The arrays to inspect.
  8845. * @returns {Array} Returns the new array of filtered values.
  8846. * @see _.difference, _.without
  8847. * @example
  8848. *
  8849. * _.xor([2, 1], [2, 3]);
  8850. * // => [1, 3]
  8851. */
  8852. var xor = baseRest(function(arrays) {
  8853. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  8854. });
  8855. /**
  8856. * This method is like `_.xor` except that it accepts `iteratee` which is
  8857. * invoked for each element of each `arrays` to generate the criterion by
  8858. * which by which they're compared. The order of result values is determined
  8859. * by the order they occur in the arrays. The iteratee is invoked with one
  8860. * argument: (value).
  8861. *
  8862. * @static
  8863. * @memberOf _
  8864. * @since 4.0.0
  8865. * @category Array
  8866. * @param {...Array} [arrays] The arrays to inspect.
  8867. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  8868. * @returns {Array} Returns the new array of filtered values.
  8869. * @example
  8870. *
  8871. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  8872. * // => [1.2, 3.4]
  8873. *
  8874. * // The `_.property` iteratee shorthand.
  8875. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  8876. * // => [{ 'x': 2 }]
  8877. */
  8878. var xorBy = baseRest(function(arrays) {
  8879. var iteratee = last(arrays);
  8880. if (isArrayLikeObject(iteratee)) {
  8881. iteratee = undefined;
  8882. }
  8883. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  8884. });
  8885. /**
  8886. * This method is like `_.xor` except that it accepts `comparator` which is
  8887. * invoked to compare elements of `arrays`. The order of result values is
  8888. * determined by the order they occur in the arrays. The comparator is invoked
  8889. * with two arguments: (arrVal, othVal).
  8890. *
  8891. * @static
  8892. * @memberOf _
  8893. * @since 4.0.0
  8894. * @category Array
  8895. * @param {...Array} [arrays] The arrays to inspect.
  8896. * @param {Function} [comparator] The comparator invoked per element.
  8897. * @returns {Array} Returns the new array of filtered values.
  8898. * @example
  8899. *
  8900. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  8901. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  8902. *
  8903. * _.xorWith(objects, others, _.isEqual);
  8904. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  8905. */
  8906. var xorWith = baseRest(function(arrays) {
  8907. var comparator = last(arrays);
  8908. comparator = typeof comparator == 'function' ? comparator : undefined;
  8909. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  8910. });
  8911. /**
  8912. * Creates an array of grouped elements, the first of which contains the
  8913. * first elements of the given arrays, the second of which contains the
  8914. * second elements of the given arrays, and so on.
  8915. *
  8916. * @static
  8917. * @memberOf _
  8918. * @since 0.1.0
  8919. * @category Array
  8920. * @param {...Array} [arrays] The arrays to process.
  8921. * @returns {Array} Returns the new array of grouped elements.
  8922. * @example
  8923. *
  8924. * _.zip(['a', 'b'], [1, 2], [true, false]);
  8925. * // => [['a', 1, true], ['b', 2, false]]
  8926. */
  8927. var zip = baseRest(unzip);
  8928. /**
  8929. * This method is like `_.fromPairs` except that it accepts two arrays,
  8930. * one of property identifiers and one of corresponding values.
  8931. *
  8932. * @static
  8933. * @memberOf _
  8934. * @since 0.4.0
  8935. * @category Array
  8936. * @param {Array} [props=[]] The property identifiers.
  8937. * @param {Array} [values=[]] The property values.
  8938. * @returns {Object} Returns the new object.
  8939. * @example
  8940. *
  8941. * _.zipObject(['a', 'b'], [1, 2]);
  8942. * // => { 'a': 1, 'b': 2 }
  8943. */
  8944. function zipObject(props, values) {
  8945. return baseZipObject(props || [], values || [], assignValue);
  8946. }
  8947. /**
  8948. * This method is like `_.zipObject` except that it supports property paths.
  8949. *
  8950. * @static
  8951. * @memberOf _
  8952. * @since 4.1.0
  8953. * @category Array
  8954. * @param {Array} [props=[]] The property identifiers.
  8955. * @param {Array} [values=[]] The property values.
  8956. * @returns {Object} Returns the new object.
  8957. * @example
  8958. *
  8959. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  8960. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  8961. */
  8962. function zipObjectDeep(props, values) {
  8963. return baseZipObject(props || [], values || [], baseSet);
  8964. }
  8965. /**
  8966. * This method is like `_.zip` except that it accepts `iteratee` to specify
  8967. * how grouped values should be combined. The iteratee is invoked with the
  8968. * elements of each group: (...group).
  8969. *
  8970. * @static
  8971. * @memberOf _
  8972. * @since 3.8.0
  8973. * @category Array
  8974. * @param {...Array} [arrays] The arrays to process.
  8975. * @param {Function} [iteratee=_.identity] The function to combine
  8976. * grouped values.
  8977. * @returns {Array} Returns the new array of grouped elements.
  8978. * @example
  8979. *
  8980. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  8981. * return a + b + c;
  8982. * });
  8983. * // => [111, 222]
  8984. */
  8985. var zipWith = baseRest(function(arrays) {
  8986. var length = arrays.length,
  8987. iteratee = length > 1 ? arrays[length - 1] : undefined;
  8988. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  8989. return unzipWith(arrays, iteratee);
  8990. });
  8991. /*------------------------------------------------------------------------*/
  8992. /**
  8993. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  8994. * chain sequences enabled. The result of such sequences must be unwrapped
  8995. * with `_#value`.
  8996. *
  8997. * @static
  8998. * @memberOf _
  8999. * @since 1.3.0
  9000. * @category Seq
  9001. * @param {*} value The value to wrap.
  9002. * @returns {Object} Returns the new `lodash` wrapper instance.
  9003. * @example
  9004. *
  9005. * var users = [
  9006. * { 'user': 'barney', 'age': 36 },
  9007. * { 'user': 'fred', 'age': 40 },
  9008. * { 'user': 'pebbles', 'age': 1 }
  9009. * ];
  9010. *
  9011. * var youngest = _
  9012. * .chain(users)
  9013. * .sortBy('age')
  9014. * .map(function(o) {
  9015. * return o.user + ' is ' + o.age;
  9016. * })
  9017. * .head()
  9018. * .value();
  9019. * // => 'pebbles is 1'
  9020. */
  9021. function chain(value) {
  9022. var result = lodash(value);
  9023. result.__chain__ = true;
  9024. return result;
  9025. }
  9026. /**
  9027. * This method invokes `interceptor` and returns `value`. The interceptor
  9028. * is invoked with one argument; (value). The purpose of this method is to
  9029. * "tap into" a method chain sequence in order to modify intermediate results.
  9030. *
  9031. * @static
  9032. * @memberOf _
  9033. * @since 0.1.0
  9034. * @category Seq
  9035. * @param {*} value The value to provide to `interceptor`.
  9036. * @param {Function} interceptor The function to invoke.
  9037. * @returns {*} Returns `value`.
  9038. * @example
  9039. *
  9040. * _([1, 2, 3])
  9041. * .tap(function(array) {
  9042. * // Mutate input array.
  9043. * array.pop();
  9044. * })
  9045. * .reverse()
  9046. * .value();
  9047. * // => [2, 1]
  9048. */
  9049. function tap(value, interceptor) {
  9050. interceptor(value);
  9051. return value;
  9052. }
  9053. /**
  9054. * This method is like `_.tap` except that it returns the result of `interceptor`.
  9055. * The purpose of this method is to "pass thru" values replacing intermediate
  9056. * results in a method chain sequence.
  9057. *
  9058. * @static
  9059. * @memberOf _
  9060. * @since 3.0.0
  9061. * @category Seq
  9062. * @param {*} value The value to provide to `interceptor`.
  9063. * @param {Function} interceptor The function to invoke.
  9064. * @returns {*} Returns the result of `interceptor`.
  9065. * @example
  9066. *
  9067. * _(' abc ')
  9068. * .chain()
  9069. * .trim()
  9070. * .thru(function(value) {
  9071. * return [value];
  9072. * })
  9073. * .value();
  9074. * // => ['abc']
  9075. */
  9076. function thru(value, interceptor) {
  9077. return interceptor(value);
  9078. }
  9079. /**
  9080. * This method is the wrapper version of `_.at`.
  9081. *
  9082. * @name at
  9083. * @memberOf _
  9084. * @since 1.0.0
  9085. * @category Seq
  9086. * @param {...(string|string[])} [paths] The property paths to pick.
  9087. * @returns {Object} Returns the new `lodash` wrapper instance.
  9088. * @example
  9089. *
  9090. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  9091. *
  9092. * _(object).at(['a[0].b.c', 'a[1]']).value();
  9093. * // => [3, 4]
  9094. */
  9095. var wrapperAt = flatRest(function(paths) {
  9096. var length = paths.length,
  9097. start = length ? paths[0] : 0,
  9098. value = this.__wrapped__,
  9099. interceptor = function(object) { return baseAt(object, paths); };
  9100. if (length > 1 || this.__actions__.length ||
  9101. !(value instanceof LazyWrapper) || !isIndex(start)) {
  9102. return this.thru(interceptor);
  9103. }
  9104. value = value.slice(start, +start + (length ? 1 : 0));
  9105. value.__actions__.push({
  9106. 'func': thru,
  9107. 'args': [interceptor],
  9108. 'thisArg': undefined
  9109. });
  9110. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  9111. if (length && !array.length) {
  9112. array.push(undefined);
  9113. }
  9114. return array;
  9115. });
  9116. });
  9117. /**
  9118. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  9119. *
  9120. * @name chain
  9121. * @memberOf _
  9122. * @since 0.1.0
  9123. * @category Seq
  9124. * @returns {Object} Returns the new `lodash` wrapper instance.
  9125. * @example
  9126. *
  9127. * var users = [
  9128. * { 'user': 'barney', 'age': 36 },
  9129. * { 'user': 'fred', 'age': 40 }
  9130. * ];
  9131. *
  9132. * // A sequence without explicit chaining.
  9133. * _(users).head();
  9134. * // => { 'user': 'barney', 'age': 36 }
  9135. *
  9136. * // A sequence with explicit chaining.
  9137. * _(users)
  9138. * .chain()
  9139. * .head()
  9140. * .pick('user')
  9141. * .value();
  9142. * // => { 'user': 'barney' }
  9143. */
  9144. function wrapperChain() {
  9145. return chain(this);
  9146. }
  9147. /**
  9148. * Executes the chain sequence and returns the wrapped result.
  9149. *
  9150. * @name commit
  9151. * @memberOf _
  9152. * @since 3.2.0
  9153. * @category Seq
  9154. * @returns {Object} Returns the new `lodash` wrapper instance.
  9155. * @example
  9156. *
  9157. * var array = [1, 2];
  9158. * var wrapped = _(array).push(3);
  9159. *
  9160. * console.log(array);
  9161. * // => [1, 2]
  9162. *
  9163. * wrapped = wrapped.commit();
  9164. * console.log(array);
  9165. * // => [1, 2, 3]
  9166. *
  9167. * wrapped.last();
  9168. * // => 3
  9169. *
  9170. * console.log(array);
  9171. * // => [1, 2, 3]
  9172. */
  9173. function wrapperCommit() {
  9174. return new LodashWrapper(this.value(), this.__chain__);
  9175. }
  9176. /**
  9177. * Gets the next value on a wrapped object following the
  9178. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  9179. *
  9180. * @name next
  9181. * @memberOf _
  9182. * @since 4.0.0
  9183. * @category Seq
  9184. * @returns {Object} Returns the next iterator value.
  9185. * @example
  9186. *
  9187. * var wrapped = _([1, 2]);
  9188. *
  9189. * wrapped.next();
  9190. * // => { 'done': false, 'value': 1 }
  9191. *
  9192. * wrapped.next();
  9193. * // => { 'done': false, 'value': 2 }
  9194. *
  9195. * wrapped.next();
  9196. * // => { 'done': true, 'value': undefined }
  9197. */
  9198. function wrapperNext() {
  9199. if (this.__values__ === undefined) {
  9200. this.__values__ = toArray(this.value());
  9201. }
  9202. var done = this.__index__ >= this.__values__.length,
  9203. value = done ? undefined : this.__values__[this.__index__++];
  9204. return { 'done': done, 'value': value };
  9205. }
  9206. /**
  9207. * Enables the wrapper to be iterable.
  9208. *
  9209. * @name Symbol.iterator
  9210. * @memberOf _
  9211. * @since 4.0.0
  9212. * @category Seq
  9213. * @returns {Object} Returns the wrapper object.
  9214. * @example
  9215. *
  9216. * var wrapped = _([1, 2]);
  9217. *
  9218. * wrapped[Symbol.iterator]() === wrapped;
  9219. * // => true
  9220. *
  9221. * Array.from(wrapped);
  9222. * // => [1, 2]
  9223. */
  9224. function wrapperToIterator() {
  9225. return this;
  9226. }
  9227. /**
  9228. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  9229. *
  9230. * @name plant
  9231. * @memberOf _
  9232. * @since 3.2.0
  9233. * @category Seq
  9234. * @param {*} value The value to plant.
  9235. * @returns {Object} Returns the new `lodash` wrapper instance.
  9236. * @example
  9237. *
  9238. * function square(n) {
  9239. * return n * n;
  9240. * }
  9241. *
  9242. * var wrapped = _([1, 2]).map(square);
  9243. * var other = wrapped.plant([3, 4]);
  9244. *
  9245. * other.value();
  9246. * // => [9, 16]
  9247. *
  9248. * wrapped.value();
  9249. * // => [1, 4]
  9250. */
  9251. function wrapperPlant(value) {
  9252. var result,
  9253. parent = this;
  9254. while (parent instanceof baseLodash) {
  9255. var clone = wrapperClone(parent);
  9256. clone.__index__ = 0;
  9257. clone.__values__ = undefined;
  9258. if (result) {
  9259. previous.__wrapped__ = clone;
  9260. } else {
  9261. result = clone;
  9262. }
  9263. var previous = clone;
  9264. parent = parent.__wrapped__;
  9265. }
  9266. previous.__wrapped__ = value;
  9267. return result;
  9268. }
  9269. /**
  9270. * This method is the wrapper version of `_.reverse`.
  9271. *
  9272. * **Note:** This method mutates the wrapped array.
  9273. *
  9274. * @name reverse
  9275. * @memberOf _
  9276. * @since 0.1.0
  9277. * @category Seq
  9278. * @returns {Object} Returns the new `lodash` wrapper instance.
  9279. * @example
  9280. *
  9281. * var array = [1, 2, 3];
  9282. *
  9283. * _(array).reverse().value()
  9284. * // => [3, 2, 1]
  9285. *
  9286. * console.log(array);
  9287. * // => [3, 2, 1]
  9288. */
  9289. function wrapperReverse() {
  9290. var value = this.__wrapped__;
  9291. if (value instanceof LazyWrapper) {
  9292. var wrapped = value;
  9293. if (this.__actions__.length) {
  9294. wrapped = new LazyWrapper(this);
  9295. }
  9296. wrapped = wrapped.reverse();
  9297. wrapped.__actions__.push({
  9298. 'func': thru,
  9299. 'args': [reverse],
  9300. 'thisArg': undefined
  9301. });
  9302. return new LodashWrapper(wrapped, this.__chain__);
  9303. }
  9304. return this.thru(reverse);
  9305. }
  9306. /**
  9307. * Executes the chain sequence to resolve the unwrapped value.
  9308. *
  9309. * @name value
  9310. * @memberOf _
  9311. * @since 0.1.0
  9312. * @alias toJSON, valueOf
  9313. * @category Seq
  9314. * @returns {*} Returns the resolved unwrapped value.
  9315. * @example
  9316. *
  9317. * _([1, 2, 3]).value();
  9318. * // => [1, 2, 3]
  9319. */
  9320. function wrapperValue() {
  9321. return baseWrapperValue(this.__wrapped__, this.__actions__);
  9322. }
  9323. /*------------------------------------------------------------------------*/
  9324. /**
  9325. * Creates an object composed of keys generated from the results of running
  9326. * each element of `collection` thru `iteratee`. The corresponding value of
  9327. * each key is the number of times the key was returned by `iteratee`. The
  9328. * iteratee is invoked with one argument: (value).
  9329. *
  9330. * @static
  9331. * @memberOf _
  9332. * @since 0.5.0
  9333. * @category Collection
  9334. * @param {Array|Object} collection The collection to iterate over.
  9335. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9336. * @returns {Object} Returns the composed aggregate object.
  9337. * @example
  9338. *
  9339. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  9340. * // => { '4': 1, '6': 2 }
  9341. *
  9342. * // The `_.property` iteratee shorthand.
  9343. * _.countBy(['one', 'two', 'three'], 'length');
  9344. * // => { '3': 2, '5': 1 }
  9345. */
  9346. var countBy = createAggregator(function(result, value, key) {
  9347. if (hasOwnProperty.call(result, key)) {
  9348. ++result[key];
  9349. } else {
  9350. baseAssignValue(result, key, 1);
  9351. }
  9352. });
  9353. /**
  9354. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  9355. * Iteration is stopped once `predicate` returns falsey. The predicate is
  9356. * invoked with three arguments: (value, index|key, collection).
  9357. *
  9358. * **Note:** This method returns `true` for
  9359. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  9360. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  9361. * elements of empty collections.
  9362. *
  9363. * @static
  9364. * @memberOf _
  9365. * @since 0.1.0
  9366. * @category Collection
  9367. * @param {Array|Object} collection The collection to iterate over.
  9368. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9369. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  9370. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  9371. * else `false`.
  9372. * @example
  9373. *
  9374. * _.every([true, 1, null, 'yes'], Boolean);
  9375. * // => false
  9376. *
  9377. * var users = [
  9378. * { 'user': 'barney', 'age': 36, 'active': false },
  9379. * { 'user': 'fred', 'age': 40, 'active': false }
  9380. * ];
  9381. *
  9382. * // The `_.matches` iteratee shorthand.
  9383. * _.every(users, { 'user': 'barney', 'active': false });
  9384. * // => false
  9385. *
  9386. * // The `_.matchesProperty` iteratee shorthand.
  9387. * _.every(users, ['active', false]);
  9388. * // => true
  9389. *
  9390. * // The `_.property` iteratee shorthand.
  9391. * _.every(users, 'active');
  9392. * // => false
  9393. */
  9394. function every(collection, predicate, guard) {
  9395. var func = isArray(collection) ? arrayEvery : baseEvery;
  9396. if (guard && isIterateeCall(collection, predicate, guard)) {
  9397. predicate = undefined;
  9398. }
  9399. return func(collection, getIteratee(predicate, 3));
  9400. }
  9401. /**
  9402. * Iterates over elements of `collection`, returning an array of all elements
  9403. * `predicate` returns truthy for. The predicate is invoked with three
  9404. * arguments: (value, index|key, collection).
  9405. *
  9406. * **Note:** Unlike `_.remove`, this method returns a new array.
  9407. *
  9408. * @static
  9409. * @memberOf _
  9410. * @since 0.1.0
  9411. * @category Collection
  9412. * @param {Array|Object} collection The collection to iterate over.
  9413. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9414. * @returns {Array} Returns the new filtered array.
  9415. * @see _.reject
  9416. * @example
  9417. *
  9418. * var users = [
  9419. * { 'user': 'barney', 'age': 36, 'active': true },
  9420. * { 'user': 'fred', 'age': 40, 'active': false }
  9421. * ];
  9422. *
  9423. * _.filter(users, function(o) { return !o.active; });
  9424. * // => objects for ['fred']
  9425. *
  9426. * // The `_.matches` iteratee shorthand.
  9427. * _.filter(users, { 'age': 36, 'active': true });
  9428. * // => objects for ['barney']
  9429. *
  9430. * // The `_.matchesProperty` iteratee shorthand.
  9431. * _.filter(users, ['active', false]);
  9432. * // => objects for ['fred']
  9433. *
  9434. * // The `_.property` iteratee shorthand.
  9435. * _.filter(users, 'active');
  9436. * // => objects for ['barney']
  9437. *
  9438. * // Combining several predicates using `_.overEvery` or `_.overSome`.
  9439. * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
  9440. * // => objects for ['fred', 'barney']
  9441. */
  9442. function filter(collection, predicate) {
  9443. var func = isArray(collection) ? arrayFilter : baseFilter;
  9444. return func(collection, getIteratee(predicate, 3));
  9445. }
  9446. /**
  9447. * Iterates over elements of `collection`, returning the first element
  9448. * `predicate` returns truthy for. The predicate is invoked with three
  9449. * arguments: (value, index|key, collection).
  9450. *
  9451. * @static
  9452. * @memberOf _
  9453. * @since 0.1.0
  9454. * @category Collection
  9455. * @param {Array|Object} collection The collection to inspect.
  9456. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9457. * @param {number} [fromIndex=0] The index to search from.
  9458. * @returns {*} Returns the matched element, else `undefined`.
  9459. * @example
  9460. *
  9461. * var users = [
  9462. * { 'user': 'barney', 'age': 36, 'active': true },
  9463. * { 'user': 'fred', 'age': 40, 'active': false },
  9464. * { 'user': 'pebbles', 'age': 1, 'active': true }
  9465. * ];
  9466. *
  9467. * _.find(users, function(o) { return o.age < 40; });
  9468. * // => object for 'barney'
  9469. *
  9470. * // The `_.matches` iteratee shorthand.
  9471. * _.find(users, { 'age': 1, 'active': true });
  9472. * // => object for 'pebbles'
  9473. *
  9474. * // The `_.matchesProperty` iteratee shorthand.
  9475. * _.find(users, ['active', false]);
  9476. * // => object for 'fred'
  9477. *
  9478. * // The `_.property` iteratee shorthand.
  9479. * _.find(users, 'active');
  9480. * // => object for 'barney'
  9481. */
  9482. var find = createFind(findIndex);
  9483. /**
  9484. * This method is like `_.find` except that it iterates over elements of
  9485. * `collection` from right to left.
  9486. *
  9487. * @static
  9488. * @memberOf _
  9489. * @since 2.0.0
  9490. * @category Collection
  9491. * @param {Array|Object} collection The collection to inspect.
  9492. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9493. * @param {number} [fromIndex=collection.length-1] The index to search from.
  9494. * @returns {*} Returns the matched element, else `undefined`.
  9495. * @example
  9496. *
  9497. * _.findLast([1, 2, 3, 4], function(n) {
  9498. * return n % 2 == 1;
  9499. * });
  9500. * // => 3
  9501. */
  9502. var findLast = createFind(findLastIndex);
  9503. /**
  9504. * Creates a flattened array of values by running each element in `collection`
  9505. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  9506. * with three arguments: (value, index|key, collection).
  9507. *
  9508. * @static
  9509. * @memberOf _
  9510. * @since 4.0.0
  9511. * @category Collection
  9512. * @param {Array|Object} collection The collection to iterate over.
  9513. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9514. * @returns {Array} Returns the new flattened array.
  9515. * @example
  9516. *
  9517. * function duplicate(n) {
  9518. * return [n, n];
  9519. * }
  9520. *
  9521. * _.flatMap([1, 2], duplicate);
  9522. * // => [1, 1, 2, 2]
  9523. */
  9524. function flatMap(collection, iteratee) {
  9525. return baseFlatten(map(collection, iteratee), 1);
  9526. }
  9527. /**
  9528. * This method is like `_.flatMap` except that it recursively flattens the
  9529. * mapped results.
  9530. *
  9531. * @static
  9532. * @memberOf _
  9533. * @since 4.7.0
  9534. * @category Collection
  9535. * @param {Array|Object} collection The collection to iterate over.
  9536. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9537. * @returns {Array} Returns the new flattened array.
  9538. * @example
  9539. *
  9540. * function duplicate(n) {
  9541. * return [[[n, n]]];
  9542. * }
  9543. *
  9544. * _.flatMapDeep([1, 2], duplicate);
  9545. * // => [1, 1, 2, 2]
  9546. */
  9547. function flatMapDeep(collection, iteratee) {
  9548. return baseFlatten(map(collection, iteratee), INFINITY);
  9549. }
  9550. /**
  9551. * This method is like `_.flatMap` except that it recursively flattens the
  9552. * mapped results up to `depth` times.
  9553. *
  9554. * @static
  9555. * @memberOf _
  9556. * @since 4.7.0
  9557. * @category Collection
  9558. * @param {Array|Object} collection The collection to iterate over.
  9559. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9560. * @param {number} [depth=1] The maximum recursion depth.
  9561. * @returns {Array} Returns the new flattened array.
  9562. * @example
  9563. *
  9564. * function duplicate(n) {
  9565. * return [[[n, n]]];
  9566. * }
  9567. *
  9568. * _.flatMapDepth([1, 2], duplicate, 2);
  9569. * // => [[1, 1], [2, 2]]
  9570. */
  9571. function flatMapDepth(collection, iteratee, depth) {
  9572. depth = depth === undefined ? 1 : toInteger(depth);
  9573. return baseFlatten(map(collection, iteratee), depth);
  9574. }
  9575. /**
  9576. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  9577. * The iteratee is invoked with three arguments: (value, index|key, collection).
  9578. * Iteratee functions may exit iteration early by explicitly returning `false`.
  9579. *
  9580. * **Note:** As with other "Collections" methods, objects with a "length"
  9581. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  9582. * or `_.forOwn` for object iteration.
  9583. *
  9584. * @static
  9585. * @memberOf _
  9586. * @since 0.1.0
  9587. * @alias each
  9588. * @category Collection
  9589. * @param {Array|Object} collection The collection to iterate over.
  9590. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9591. * @returns {Array|Object} Returns `collection`.
  9592. * @see _.forEachRight
  9593. * @example
  9594. *
  9595. * _.forEach([1, 2], function(value) {
  9596. * console.log(value);
  9597. * });
  9598. * // => Logs `1` then `2`.
  9599. *
  9600. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  9601. * console.log(key);
  9602. * });
  9603. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  9604. */
  9605. function forEach(collection, iteratee) {
  9606. var func = isArray(collection) ? arrayEach : baseEach;
  9607. return func(collection, getIteratee(iteratee, 3));
  9608. }
  9609. /**
  9610. * This method is like `_.forEach` except that it iterates over elements of
  9611. * `collection` from right to left.
  9612. *
  9613. * @static
  9614. * @memberOf _
  9615. * @since 2.0.0
  9616. * @alias eachRight
  9617. * @category Collection
  9618. * @param {Array|Object} collection The collection to iterate over.
  9619. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9620. * @returns {Array|Object} Returns `collection`.
  9621. * @see _.forEach
  9622. * @example
  9623. *
  9624. * _.forEachRight([1, 2], function(value) {
  9625. * console.log(value);
  9626. * });
  9627. * // => Logs `2` then `1`.
  9628. */
  9629. function forEachRight(collection, iteratee) {
  9630. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  9631. return func(collection, getIteratee(iteratee, 3));
  9632. }
  9633. /**
  9634. * Creates an object composed of keys generated from the results of running
  9635. * each element of `collection` thru `iteratee`. The order of grouped values
  9636. * is determined by the order they occur in `collection`. The corresponding
  9637. * value of each key is an array of elements responsible for generating the
  9638. * key. The iteratee is invoked with one argument: (value).
  9639. *
  9640. * @static
  9641. * @memberOf _
  9642. * @since 0.1.0
  9643. * @category Collection
  9644. * @param {Array|Object} collection The collection to iterate over.
  9645. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9646. * @returns {Object} Returns the composed aggregate object.
  9647. * @example
  9648. *
  9649. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  9650. * // => { '4': [4.2], '6': [6.1, 6.3] }
  9651. *
  9652. * // The `_.property` iteratee shorthand.
  9653. * _.groupBy(['one', 'two', 'three'], 'length');
  9654. * // => { '3': ['one', 'two'], '5': ['three'] }
  9655. */
  9656. var groupBy = createAggregator(function(result, value, key) {
  9657. if (hasOwnProperty.call(result, key)) {
  9658. result[key].push(value);
  9659. } else {
  9660. baseAssignValue(result, key, [value]);
  9661. }
  9662. });
  9663. /**
  9664. * Checks if `value` is in `collection`. If `collection` is a string, it's
  9665. * checked for a substring of `value`, otherwise
  9666. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  9667. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  9668. * the offset from the end of `collection`.
  9669. *
  9670. * @static
  9671. * @memberOf _
  9672. * @since 0.1.0
  9673. * @category Collection
  9674. * @param {Array|Object|string} collection The collection to inspect.
  9675. * @param {*} value The value to search for.
  9676. * @param {number} [fromIndex=0] The index to search from.
  9677. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  9678. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  9679. * @example
  9680. *
  9681. * _.includes([1, 2, 3], 1);
  9682. * // => true
  9683. *
  9684. * _.includes([1, 2, 3], 1, 2);
  9685. * // => false
  9686. *
  9687. * _.includes({ 'a': 1, 'b': 2 }, 1);
  9688. * // => true
  9689. *
  9690. * _.includes('abcd', 'bc');
  9691. * // => true
  9692. */
  9693. function includes(collection, value, fromIndex, guard) {
  9694. collection = isArrayLike(collection) ? collection : values(collection);
  9695. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  9696. var length = collection.length;
  9697. if (fromIndex < 0) {
  9698. fromIndex = nativeMax(length + fromIndex, 0);
  9699. }
  9700. return isString(collection)
  9701. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  9702. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  9703. }
  9704. /**
  9705. * Invokes the method at `path` of each element in `collection`, returning
  9706. * an array of the results of each invoked method. Any additional arguments
  9707. * are provided to each invoked method. If `path` is a function, it's invoked
  9708. * for, and `this` bound to, each element in `collection`.
  9709. *
  9710. * @static
  9711. * @memberOf _
  9712. * @since 4.0.0
  9713. * @category Collection
  9714. * @param {Array|Object} collection The collection to iterate over.
  9715. * @param {Array|Function|string} path The path of the method to invoke or
  9716. * the function invoked per iteration.
  9717. * @param {...*} [args] The arguments to invoke each method with.
  9718. * @returns {Array} Returns the array of results.
  9719. * @example
  9720. *
  9721. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  9722. * // => [[1, 5, 7], [1, 2, 3]]
  9723. *
  9724. * _.invokeMap([123, 456], String.prototype.split, '');
  9725. * // => [['1', '2', '3'], ['4', '5', '6']]
  9726. */
  9727. var invokeMap = baseRest(function(collection, path, args) {
  9728. var index = -1,
  9729. isFunc = typeof path == 'function',
  9730. result = isArrayLike(collection) ? Array(collection.length) : [];
  9731. baseEach(collection, function(value) {
  9732. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  9733. });
  9734. return result;
  9735. });
  9736. /**
  9737. * Creates an object composed of keys generated from the results of running
  9738. * each element of `collection` thru `iteratee`. The corresponding value of
  9739. * each key is the last element responsible for generating the key. The
  9740. * iteratee is invoked with one argument: (value).
  9741. *
  9742. * @static
  9743. * @memberOf _
  9744. * @since 4.0.0
  9745. * @category Collection
  9746. * @param {Array|Object} collection The collection to iterate over.
  9747. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  9748. * @returns {Object} Returns the composed aggregate object.
  9749. * @example
  9750. *
  9751. * var array = [
  9752. * { 'dir': 'left', 'code': 97 },
  9753. * { 'dir': 'right', 'code': 100 }
  9754. * ];
  9755. *
  9756. * _.keyBy(array, function(o) {
  9757. * return String.fromCharCode(o.code);
  9758. * });
  9759. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  9760. *
  9761. * _.keyBy(array, 'dir');
  9762. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  9763. */
  9764. var keyBy = createAggregator(function(result, value, key) {
  9765. baseAssignValue(result, key, value);
  9766. });
  9767. /**
  9768. * Creates an array of values by running each element in `collection` thru
  9769. * `iteratee`. The iteratee is invoked with three arguments:
  9770. * (value, index|key, collection).
  9771. *
  9772. * Many lodash methods are guarded to work as iteratees for methods like
  9773. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  9774. *
  9775. * The guarded methods are:
  9776. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  9777. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  9778. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  9779. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  9780. *
  9781. * @static
  9782. * @memberOf _
  9783. * @since 0.1.0
  9784. * @category Collection
  9785. * @param {Array|Object} collection The collection to iterate over.
  9786. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9787. * @returns {Array} Returns the new mapped array.
  9788. * @example
  9789. *
  9790. * function square(n) {
  9791. * return n * n;
  9792. * }
  9793. *
  9794. * _.map([4, 8], square);
  9795. * // => [16, 64]
  9796. *
  9797. * _.map({ 'a': 4, 'b': 8 }, square);
  9798. * // => [16, 64] (iteration order is not guaranteed)
  9799. *
  9800. * var users = [
  9801. * { 'user': 'barney' },
  9802. * { 'user': 'fred' }
  9803. * ];
  9804. *
  9805. * // The `_.property` iteratee shorthand.
  9806. * _.map(users, 'user');
  9807. * // => ['barney', 'fred']
  9808. */
  9809. function map(collection, iteratee) {
  9810. var func = isArray(collection) ? arrayMap : baseMap;
  9811. return func(collection, getIteratee(iteratee, 3));
  9812. }
  9813. /**
  9814. * This method is like `_.sortBy` except that it allows specifying the sort
  9815. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  9816. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  9817. * descending or "asc" for ascending sort order of corresponding values.
  9818. *
  9819. * @static
  9820. * @memberOf _
  9821. * @since 4.0.0
  9822. * @category Collection
  9823. * @param {Array|Object} collection The collection to iterate over.
  9824. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  9825. * The iteratees to sort by.
  9826. * @param {string[]} [orders] The sort orders of `iteratees`.
  9827. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  9828. * @returns {Array} Returns the new sorted array.
  9829. * @example
  9830. *
  9831. * var users = [
  9832. * { 'user': 'fred', 'age': 48 },
  9833. * { 'user': 'barney', 'age': 34 },
  9834. * { 'user': 'fred', 'age': 40 },
  9835. * { 'user': 'barney', 'age': 36 }
  9836. * ];
  9837. *
  9838. * // Sort by `user` in ascending order and by `age` in descending order.
  9839. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  9840. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  9841. */
  9842. function orderBy(collection, iteratees, orders, guard) {
  9843. if (collection == null) {
  9844. return [];
  9845. }
  9846. if (!isArray(iteratees)) {
  9847. iteratees = iteratees == null ? [] : [iteratees];
  9848. }
  9849. orders = guard ? undefined : orders;
  9850. if (!isArray(orders)) {
  9851. orders = orders == null ? [] : [orders];
  9852. }
  9853. return baseOrderBy(collection, iteratees, orders);
  9854. }
  9855. /**
  9856. * Creates an array of elements split into two groups, the first of which
  9857. * contains elements `predicate` returns truthy for, the second of which
  9858. * contains elements `predicate` returns falsey for. The predicate is
  9859. * invoked with one argument: (value).
  9860. *
  9861. * @static
  9862. * @memberOf _
  9863. * @since 3.0.0
  9864. * @category Collection
  9865. * @param {Array|Object} collection The collection to iterate over.
  9866. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9867. * @returns {Array} Returns the array of grouped elements.
  9868. * @example
  9869. *
  9870. * var users = [
  9871. * { 'user': 'barney', 'age': 36, 'active': false },
  9872. * { 'user': 'fred', 'age': 40, 'active': true },
  9873. * { 'user': 'pebbles', 'age': 1, 'active': false }
  9874. * ];
  9875. *
  9876. * _.partition(users, function(o) { return o.active; });
  9877. * // => objects for [['fred'], ['barney', 'pebbles']]
  9878. *
  9879. * // The `_.matches` iteratee shorthand.
  9880. * _.partition(users, { 'age': 1, 'active': false });
  9881. * // => objects for [['pebbles'], ['barney', 'fred']]
  9882. *
  9883. * // The `_.matchesProperty` iteratee shorthand.
  9884. * _.partition(users, ['active', false]);
  9885. * // => objects for [['barney', 'pebbles'], ['fred']]
  9886. *
  9887. * // The `_.property` iteratee shorthand.
  9888. * _.partition(users, 'active');
  9889. * // => objects for [['fred'], ['barney', 'pebbles']]
  9890. */
  9891. var partition = createAggregator(function(result, value, key) {
  9892. result[key ? 0 : 1].push(value);
  9893. }, function() { return [[], []]; });
  9894. /**
  9895. * Reduces `collection` to a value which is the accumulated result of running
  9896. * each element in `collection` thru `iteratee`, where each successive
  9897. * invocation is supplied the return value of the previous. If `accumulator`
  9898. * is not given, the first element of `collection` is used as the initial
  9899. * value. The iteratee is invoked with four arguments:
  9900. * (accumulator, value, index|key, collection).
  9901. *
  9902. * Many lodash methods are guarded to work as iteratees for methods like
  9903. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  9904. *
  9905. * The guarded methods are:
  9906. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  9907. * and `sortBy`
  9908. *
  9909. * @static
  9910. * @memberOf _
  9911. * @since 0.1.0
  9912. * @category Collection
  9913. * @param {Array|Object} collection The collection to iterate over.
  9914. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9915. * @param {*} [accumulator] The initial value.
  9916. * @returns {*} Returns the accumulated value.
  9917. * @see _.reduceRight
  9918. * @example
  9919. *
  9920. * _.reduce([1, 2], function(sum, n) {
  9921. * return sum + n;
  9922. * }, 0);
  9923. * // => 3
  9924. *
  9925. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  9926. * (result[value] || (result[value] = [])).push(key);
  9927. * return result;
  9928. * }, {});
  9929. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  9930. */
  9931. function reduce(collection, iteratee, accumulator) {
  9932. var func = isArray(collection) ? arrayReduce : baseReduce,
  9933. initAccum = arguments.length < 3;
  9934. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  9935. }
  9936. /**
  9937. * This method is like `_.reduce` except that it iterates over elements of
  9938. * `collection` from right to left.
  9939. *
  9940. * @static
  9941. * @memberOf _
  9942. * @since 0.1.0
  9943. * @category Collection
  9944. * @param {Array|Object} collection The collection to iterate over.
  9945. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  9946. * @param {*} [accumulator] The initial value.
  9947. * @returns {*} Returns the accumulated value.
  9948. * @see _.reduce
  9949. * @example
  9950. *
  9951. * var array = [[0, 1], [2, 3], [4, 5]];
  9952. *
  9953. * _.reduceRight(array, function(flattened, other) {
  9954. * return flattened.concat(other);
  9955. * }, []);
  9956. * // => [4, 5, 2, 3, 0, 1]
  9957. */
  9958. function reduceRight(collection, iteratee, accumulator) {
  9959. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  9960. initAccum = arguments.length < 3;
  9961. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  9962. }
  9963. /**
  9964. * The opposite of `_.filter`; this method returns the elements of `collection`
  9965. * that `predicate` does **not** return truthy for.
  9966. *
  9967. * @static
  9968. * @memberOf _
  9969. * @since 0.1.0
  9970. * @category Collection
  9971. * @param {Array|Object} collection The collection to iterate over.
  9972. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  9973. * @returns {Array} Returns the new filtered array.
  9974. * @see _.filter
  9975. * @example
  9976. *
  9977. * var users = [
  9978. * { 'user': 'barney', 'age': 36, 'active': false },
  9979. * { 'user': 'fred', 'age': 40, 'active': true }
  9980. * ];
  9981. *
  9982. * _.reject(users, function(o) { return !o.active; });
  9983. * // => objects for ['fred']
  9984. *
  9985. * // The `_.matches` iteratee shorthand.
  9986. * _.reject(users, { 'age': 40, 'active': true });
  9987. * // => objects for ['barney']
  9988. *
  9989. * // The `_.matchesProperty` iteratee shorthand.
  9990. * _.reject(users, ['active', false]);
  9991. * // => objects for ['fred']
  9992. *
  9993. * // The `_.property` iteratee shorthand.
  9994. * _.reject(users, 'active');
  9995. * // => objects for ['barney']
  9996. */
  9997. function reject(collection, predicate) {
  9998. var func = isArray(collection) ? arrayFilter : baseFilter;
  9999. return func(collection, negate(getIteratee(predicate, 3)));
  10000. }
  10001. /**
  10002. * Gets a random element from `collection`.
  10003. *
  10004. * @static
  10005. * @memberOf _
  10006. * @since 2.0.0
  10007. * @category Collection
  10008. * @param {Array|Object} collection The collection to sample.
  10009. * @returns {*} Returns the random element.
  10010. * @example
  10011. *
  10012. * _.sample([1, 2, 3, 4]);
  10013. * // => 2
  10014. */
  10015. function sample(collection) {
  10016. var func = isArray(collection) ? arraySample : baseSample;
  10017. return func(collection);
  10018. }
  10019. /**
  10020. * Gets `n` random elements at unique keys from `collection` up to the
  10021. * size of `collection`.
  10022. *
  10023. * @static
  10024. * @memberOf _
  10025. * @since 4.0.0
  10026. * @category Collection
  10027. * @param {Array|Object} collection The collection to sample.
  10028. * @param {number} [n=1] The number of elements to sample.
  10029. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10030. * @returns {Array} Returns the random elements.
  10031. * @example
  10032. *
  10033. * _.sampleSize([1, 2, 3], 2);
  10034. * // => [3, 1]
  10035. *
  10036. * _.sampleSize([1, 2, 3], 4);
  10037. * // => [2, 3, 1]
  10038. */
  10039. function sampleSize(collection, n, guard) {
  10040. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  10041. n = 1;
  10042. } else {
  10043. n = toInteger(n);
  10044. }
  10045. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  10046. return func(collection, n);
  10047. }
  10048. /**
  10049. * Creates an array of shuffled values, using a version of the
  10050. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  10051. *
  10052. * @static
  10053. * @memberOf _
  10054. * @since 0.1.0
  10055. * @category Collection
  10056. * @param {Array|Object} collection The collection to shuffle.
  10057. * @returns {Array} Returns the new shuffled array.
  10058. * @example
  10059. *
  10060. * _.shuffle([1, 2, 3, 4]);
  10061. * // => [4, 1, 3, 2]
  10062. */
  10063. function shuffle(collection) {
  10064. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  10065. return func(collection);
  10066. }
  10067. /**
  10068. * Gets the size of `collection` by returning its length for array-like
  10069. * values or the number of own enumerable string keyed properties for objects.
  10070. *
  10071. * @static
  10072. * @memberOf _
  10073. * @since 0.1.0
  10074. * @category Collection
  10075. * @param {Array|Object|string} collection The collection to inspect.
  10076. * @returns {number} Returns the collection size.
  10077. * @example
  10078. *
  10079. * _.size([1, 2, 3]);
  10080. * // => 3
  10081. *
  10082. * _.size({ 'a': 1, 'b': 2 });
  10083. * // => 2
  10084. *
  10085. * _.size('pebbles');
  10086. * // => 7
  10087. */
  10088. function size(collection) {
  10089. if (collection == null) {
  10090. return 0;
  10091. }
  10092. if (isArrayLike(collection)) {
  10093. return isString(collection) ? stringSize(collection) : collection.length;
  10094. }
  10095. var tag = getTag(collection);
  10096. if (tag == mapTag || tag == setTag) {
  10097. return collection.size;
  10098. }
  10099. return baseKeys(collection).length;
  10100. }
  10101. /**
  10102. * Checks if `predicate` returns truthy for **any** element of `collection`.
  10103. * Iteration is stopped once `predicate` returns truthy. The predicate is
  10104. * invoked with three arguments: (value, index|key, collection).
  10105. *
  10106. * @static
  10107. * @memberOf _
  10108. * @since 0.1.0
  10109. * @category Collection
  10110. * @param {Array|Object} collection The collection to iterate over.
  10111. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  10112. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10113. * @returns {boolean} Returns `true` if any element passes the predicate check,
  10114. * else `false`.
  10115. * @example
  10116. *
  10117. * _.some([null, 0, 'yes', false], Boolean);
  10118. * // => true
  10119. *
  10120. * var users = [
  10121. * { 'user': 'barney', 'active': true },
  10122. * { 'user': 'fred', 'active': false }
  10123. * ];
  10124. *
  10125. * // The `_.matches` iteratee shorthand.
  10126. * _.some(users, { 'user': 'barney', 'active': false });
  10127. * // => false
  10128. *
  10129. * // The `_.matchesProperty` iteratee shorthand.
  10130. * _.some(users, ['active', false]);
  10131. * // => true
  10132. *
  10133. * // The `_.property` iteratee shorthand.
  10134. * _.some(users, 'active');
  10135. * // => true
  10136. */
  10137. function some(collection, predicate, guard) {
  10138. var func = isArray(collection) ? arraySome : baseSome;
  10139. if (guard && isIterateeCall(collection, predicate, guard)) {
  10140. predicate = undefined;
  10141. }
  10142. return func(collection, getIteratee(predicate, 3));
  10143. }
  10144. /**
  10145. * Creates an array of elements, sorted in ascending order by the results of
  10146. * running each element in a collection thru each iteratee. This method
  10147. * performs a stable sort, that is, it preserves the original sort order of
  10148. * equal elements. The iteratees are invoked with one argument: (value).
  10149. *
  10150. * @static
  10151. * @memberOf _
  10152. * @since 0.1.0
  10153. * @category Collection
  10154. * @param {Array|Object} collection The collection to iterate over.
  10155. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  10156. * The iteratees to sort by.
  10157. * @returns {Array} Returns the new sorted array.
  10158. * @example
  10159. *
  10160. * var users = [
  10161. * { 'user': 'fred', 'age': 48 },
  10162. * { 'user': 'barney', 'age': 36 },
  10163. * { 'user': 'fred', 'age': 30 },
  10164. * { 'user': 'barney', 'age': 34 }
  10165. * ];
  10166. *
  10167. * _.sortBy(users, [function(o) { return o.user; }]);
  10168. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
  10169. *
  10170. * _.sortBy(users, ['user', 'age']);
  10171. * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
  10172. */
  10173. var sortBy = baseRest(function(collection, iteratees) {
  10174. if (collection == null) {
  10175. return [];
  10176. }
  10177. var length = iteratees.length;
  10178. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  10179. iteratees = [];
  10180. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  10181. iteratees = [iteratees[0]];
  10182. }
  10183. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  10184. });
  10185. /*------------------------------------------------------------------------*/
  10186. /**
  10187. * Gets the timestamp of the number of milliseconds that have elapsed since
  10188. * the Unix epoch (1 January 1970 00:00:00 UTC).
  10189. *
  10190. * @static
  10191. * @memberOf _
  10192. * @since 2.4.0
  10193. * @category Date
  10194. * @returns {number} Returns the timestamp.
  10195. * @example
  10196. *
  10197. * _.defer(function(stamp) {
  10198. * console.log(_.now() - stamp);
  10199. * }, _.now());
  10200. * // => Logs the number of milliseconds it took for the deferred invocation.
  10201. */
  10202. var now = ctxNow || function() {
  10203. return root.Date.now();
  10204. };
  10205. /*------------------------------------------------------------------------*/
  10206. /**
  10207. * The opposite of `_.before`; this method creates a function that invokes
  10208. * `func` once it's called `n` or more times.
  10209. *
  10210. * @static
  10211. * @memberOf _
  10212. * @since 0.1.0
  10213. * @category Function
  10214. * @param {number} n The number of calls before `func` is invoked.
  10215. * @param {Function} func The function to restrict.
  10216. * @returns {Function} Returns the new restricted function.
  10217. * @example
  10218. *
  10219. * var saves = ['profile', 'settings'];
  10220. *
  10221. * var done = _.after(saves.length, function() {
  10222. * console.log('done saving!');
  10223. * });
  10224. *
  10225. * _.forEach(saves, function(type) {
  10226. * asyncSave({ 'type': type, 'complete': done });
  10227. * });
  10228. * // => Logs 'done saving!' after the two async saves have completed.
  10229. */
  10230. function after(n, func) {
  10231. if (typeof func != 'function') {
  10232. throw new TypeError(FUNC_ERROR_TEXT);
  10233. }
  10234. n = toInteger(n);
  10235. return function() {
  10236. if (--n < 1) {
  10237. return func.apply(this, arguments);
  10238. }
  10239. };
  10240. }
  10241. /**
  10242. * Creates a function that invokes `func`, with up to `n` arguments,
  10243. * ignoring any additional arguments.
  10244. *
  10245. * @static
  10246. * @memberOf _
  10247. * @since 3.0.0
  10248. * @category Function
  10249. * @param {Function} func The function to cap arguments for.
  10250. * @param {number} [n=func.length] The arity cap.
  10251. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10252. * @returns {Function} Returns the new capped function.
  10253. * @example
  10254. *
  10255. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  10256. * // => [6, 8, 10]
  10257. */
  10258. function ary(func, n, guard) {
  10259. n = guard ? undefined : n;
  10260. n = (func && n == null) ? func.length : n;
  10261. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  10262. }
  10263. /**
  10264. * Creates a function that invokes `func`, with the `this` binding and arguments
  10265. * of the created function, while it's called less than `n` times. Subsequent
  10266. * calls to the created function return the result of the last `func` invocation.
  10267. *
  10268. * @static
  10269. * @memberOf _
  10270. * @since 3.0.0
  10271. * @category Function
  10272. * @param {number} n The number of calls at which `func` is no longer invoked.
  10273. * @param {Function} func The function to restrict.
  10274. * @returns {Function} Returns the new restricted function.
  10275. * @example
  10276. *
  10277. * jQuery(element).on('click', _.before(5, addContactToList));
  10278. * // => Allows adding up to 4 contacts to the list.
  10279. */
  10280. function before(n, func) {
  10281. var result;
  10282. if (typeof func != 'function') {
  10283. throw new TypeError(FUNC_ERROR_TEXT);
  10284. }
  10285. n = toInteger(n);
  10286. return function() {
  10287. if (--n > 0) {
  10288. result = func.apply(this, arguments);
  10289. }
  10290. if (n <= 1) {
  10291. func = undefined;
  10292. }
  10293. return result;
  10294. };
  10295. }
  10296. /**
  10297. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  10298. * and `partials` prepended to the arguments it receives.
  10299. *
  10300. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  10301. * may be used as a placeholder for partially applied arguments.
  10302. *
  10303. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  10304. * property of bound functions.
  10305. *
  10306. * @static
  10307. * @memberOf _
  10308. * @since 0.1.0
  10309. * @category Function
  10310. * @param {Function} func The function to bind.
  10311. * @param {*} thisArg The `this` binding of `func`.
  10312. * @param {...*} [partials] The arguments to be partially applied.
  10313. * @returns {Function} Returns the new bound function.
  10314. * @example
  10315. *
  10316. * function greet(greeting, punctuation) {
  10317. * return greeting + ' ' + this.user + punctuation;
  10318. * }
  10319. *
  10320. * var object = { 'user': 'fred' };
  10321. *
  10322. * var bound = _.bind(greet, object, 'hi');
  10323. * bound('!');
  10324. * // => 'hi fred!'
  10325. *
  10326. * // Bound with placeholders.
  10327. * var bound = _.bind(greet, object, _, '!');
  10328. * bound('hi');
  10329. * // => 'hi fred!'
  10330. */
  10331. var bind = baseRest(function(func, thisArg, partials) {
  10332. var bitmask = WRAP_BIND_FLAG;
  10333. if (partials.length) {
  10334. var holders = replaceHolders(partials, getHolder(bind));
  10335. bitmask |= WRAP_PARTIAL_FLAG;
  10336. }
  10337. return createWrap(func, bitmask, thisArg, partials, holders);
  10338. });
  10339. /**
  10340. * Creates a function that invokes the method at `object[key]` with `partials`
  10341. * prepended to the arguments it receives.
  10342. *
  10343. * This method differs from `_.bind` by allowing bound functions to reference
  10344. * methods that may be redefined or don't yet exist. See
  10345. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  10346. * for more details.
  10347. *
  10348. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  10349. * builds, may be used as a placeholder for partially applied arguments.
  10350. *
  10351. * @static
  10352. * @memberOf _
  10353. * @since 0.10.0
  10354. * @category Function
  10355. * @param {Object} object The object to invoke the method on.
  10356. * @param {string} key The key of the method.
  10357. * @param {...*} [partials] The arguments to be partially applied.
  10358. * @returns {Function} Returns the new bound function.
  10359. * @example
  10360. *
  10361. * var object = {
  10362. * 'user': 'fred',
  10363. * 'greet': function(greeting, punctuation) {
  10364. * return greeting + ' ' + this.user + punctuation;
  10365. * }
  10366. * };
  10367. *
  10368. * var bound = _.bindKey(object, 'greet', 'hi');
  10369. * bound('!');
  10370. * // => 'hi fred!'
  10371. *
  10372. * object.greet = function(greeting, punctuation) {
  10373. * return greeting + 'ya ' + this.user + punctuation;
  10374. * };
  10375. *
  10376. * bound('!');
  10377. * // => 'hiya fred!'
  10378. *
  10379. * // Bound with placeholders.
  10380. * var bound = _.bindKey(object, 'greet', _, '!');
  10381. * bound('hi');
  10382. * // => 'hiya fred!'
  10383. */
  10384. var bindKey = baseRest(function(object, key, partials) {
  10385. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  10386. if (partials.length) {
  10387. var holders = replaceHolders(partials, getHolder(bindKey));
  10388. bitmask |= WRAP_PARTIAL_FLAG;
  10389. }
  10390. return createWrap(key, bitmask, object, partials, holders);
  10391. });
  10392. /**
  10393. * Creates a function that accepts arguments of `func` and either invokes
  10394. * `func` returning its result, if at least `arity` number of arguments have
  10395. * been provided, or returns a function that accepts the remaining `func`
  10396. * arguments, and so on. The arity of `func` may be specified if `func.length`
  10397. * is not sufficient.
  10398. *
  10399. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  10400. * may be used as a placeholder for provided arguments.
  10401. *
  10402. * **Note:** This method doesn't set the "length" property of curried functions.
  10403. *
  10404. * @static
  10405. * @memberOf _
  10406. * @since 2.0.0
  10407. * @category Function
  10408. * @param {Function} func The function to curry.
  10409. * @param {number} [arity=func.length] The arity of `func`.
  10410. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10411. * @returns {Function} Returns the new curried function.
  10412. * @example
  10413. *
  10414. * var abc = function(a, b, c) {
  10415. * return [a, b, c];
  10416. * };
  10417. *
  10418. * var curried = _.curry(abc);
  10419. *
  10420. * curried(1)(2)(3);
  10421. * // => [1, 2, 3]
  10422. *
  10423. * curried(1, 2)(3);
  10424. * // => [1, 2, 3]
  10425. *
  10426. * curried(1, 2, 3);
  10427. * // => [1, 2, 3]
  10428. *
  10429. * // Curried with placeholders.
  10430. * curried(1)(_, 3)(2);
  10431. * // => [1, 2, 3]
  10432. */
  10433. function curry(func, arity, guard) {
  10434. arity = guard ? undefined : arity;
  10435. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  10436. result.placeholder = curry.placeholder;
  10437. return result;
  10438. }
  10439. /**
  10440. * This method is like `_.curry` except that arguments are applied to `func`
  10441. * in the manner of `_.partialRight` instead of `_.partial`.
  10442. *
  10443. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  10444. * builds, may be used as a placeholder for provided arguments.
  10445. *
  10446. * **Note:** This method doesn't set the "length" property of curried functions.
  10447. *
  10448. * @static
  10449. * @memberOf _
  10450. * @since 3.0.0
  10451. * @category Function
  10452. * @param {Function} func The function to curry.
  10453. * @param {number} [arity=func.length] The arity of `func`.
  10454. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  10455. * @returns {Function} Returns the new curried function.
  10456. * @example
  10457. *
  10458. * var abc = function(a, b, c) {
  10459. * return [a, b, c];
  10460. * };
  10461. *
  10462. * var curried = _.curryRight(abc);
  10463. *
  10464. * curried(3)(2)(1);
  10465. * // => [1, 2, 3]
  10466. *
  10467. * curried(2, 3)(1);
  10468. * // => [1, 2, 3]
  10469. *
  10470. * curried(1, 2, 3);
  10471. * // => [1, 2, 3]
  10472. *
  10473. * // Curried with placeholders.
  10474. * curried(3)(1, _)(2);
  10475. * // => [1, 2, 3]
  10476. */
  10477. function curryRight(func, arity, guard) {
  10478. arity = guard ? undefined : arity;
  10479. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  10480. result.placeholder = curryRight.placeholder;
  10481. return result;
  10482. }
  10483. /**
  10484. * Creates a debounced function that delays invoking `func` until after `wait`
  10485. * milliseconds have elapsed since the last time the debounced function was
  10486. * invoked. The debounced function comes with a `cancel` method to cancel
  10487. * delayed `func` invocations and a `flush` method to immediately invoke them.
  10488. * Provide `options` to indicate whether `func` should be invoked on the
  10489. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  10490. * with the last arguments provided to the debounced function. Subsequent
  10491. * calls to the debounced function return the result of the last `func`
  10492. * invocation.
  10493. *
  10494. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  10495. * invoked on the trailing edge of the timeout only if the debounced function
  10496. * is invoked more than once during the `wait` timeout.
  10497. *
  10498. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  10499. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  10500. *
  10501. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  10502. * for details over the differences between `_.debounce` and `_.throttle`.
  10503. *
  10504. * @static
  10505. * @memberOf _
  10506. * @since 0.1.0
  10507. * @category Function
  10508. * @param {Function} func The function to debounce.
  10509. * @param {number} [wait=0] The number of milliseconds to delay.
  10510. * @param {Object} [options={}] The options object.
  10511. * @param {boolean} [options.leading=false]
  10512. * Specify invoking on the leading edge of the timeout.
  10513. * @param {number} [options.maxWait]
  10514. * The maximum time `func` is allowed to be delayed before it's invoked.
  10515. * @param {boolean} [options.trailing=true]
  10516. * Specify invoking on the trailing edge of the timeout.
  10517. * @returns {Function} Returns the new debounced function.
  10518. * @example
  10519. *
  10520. * // Avoid costly calculations while the window size is in flux.
  10521. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  10522. *
  10523. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  10524. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  10525. * 'leading': true,
  10526. * 'trailing': false
  10527. * }));
  10528. *
  10529. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  10530. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  10531. * var source = new EventSource('/stream');
  10532. * jQuery(source).on('message', debounced);
  10533. *
  10534. * // Cancel the trailing debounced invocation.
  10535. * jQuery(window).on('popstate', debounced.cancel);
  10536. */
  10537. function debounce(func, wait, options) {
  10538. var lastArgs,
  10539. lastThis,
  10540. maxWait,
  10541. result,
  10542. timerId,
  10543. lastCallTime,
  10544. lastInvokeTime = 0,
  10545. leading = false,
  10546. maxing = false,
  10547. trailing = true;
  10548. if (typeof func != 'function') {
  10549. throw new TypeError(FUNC_ERROR_TEXT);
  10550. }
  10551. wait = toNumber(wait) || 0;
  10552. if (isObject(options)) {
  10553. leading = !!options.leading;
  10554. maxing = 'maxWait' in options;
  10555. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  10556. trailing = 'trailing' in options ? !!options.trailing : trailing;
  10557. }
  10558. function invokeFunc(time) {
  10559. var args = lastArgs,
  10560. thisArg = lastThis;
  10561. lastArgs = lastThis = undefined;
  10562. lastInvokeTime = time;
  10563. result = func.apply(thisArg, args);
  10564. return result;
  10565. }
  10566. function leadingEdge(time) {
  10567. // Reset any `maxWait` timer.
  10568. lastInvokeTime = time;
  10569. // Start the timer for the trailing edge.
  10570. timerId = setTimeout(timerExpired, wait);
  10571. // Invoke the leading edge.
  10572. return leading ? invokeFunc(time) : result;
  10573. }
  10574. function remainingWait(time) {
  10575. var timeSinceLastCall = time - lastCallTime,
  10576. timeSinceLastInvoke = time - lastInvokeTime,
  10577. timeWaiting = wait - timeSinceLastCall;
  10578. return maxing
  10579. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  10580. : timeWaiting;
  10581. }
  10582. function shouldInvoke(time) {
  10583. var timeSinceLastCall = time - lastCallTime,
  10584. timeSinceLastInvoke = time - lastInvokeTime;
  10585. // Either this is the first call, activity has stopped and we're at the
  10586. // trailing edge, the system time has gone backwards and we're treating
  10587. // it as the trailing edge, or we've hit the `maxWait` limit.
  10588. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  10589. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  10590. }
  10591. function timerExpired() {
  10592. var time = now();
  10593. if (shouldInvoke(time)) {
  10594. return trailingEdge(time);
  10595. }
  10596. // Restart the timer.
  10597. timerId = setTimeout(timerExpired, remainingWait(time));
  10598. }
  10599. function trailingEdge(time) {
  10600. timerId = undefined;
  10601. // Only invoke if we have `lastArgs` which means `func` has been
  10602. // debounced at least once.
  10603. if (trailing && lastArgs) {
  10604. return invokeFunc(time);
  10605. }
  10606. lastArgs = lastThis = undefined;
  10607. return result;
  10608. }
  10609. function cancel() {
  10610. if (timerId !== undefined) {
  10611. clearTimeout(timerId);
  10612. }
  10613. lastInvokeTime = 0;
  10614. lastArgs = lastCallTime = lastThis = timerId = undefined;
  10615. }
  10616. function flush() {
  10617. return timerId === undefined ? result : trailingEdge(now());
  10618. }
  10619. function debounced() {
  10620. var time = now(),
  10621. isInvoking = shouldInvoke(time);
  10622. lastArgs = arguments;
  10623. lastThis = this;
  10624. lastCallTime = time;
  10625. if (isInvoking) {
  10626. if (timerId === undefined) {
  10627. return leadingEdge(lastCallTime);
  10628. }
  10629. if (maxing) {
  10630. // Handle invocations in a tight loop.
  10631. clearTimeout(timerId);
  10632. timerId = setTimeout(timerExpired, wait);
  10633. return invokeFunc(lastCallTime);
  10634. }
  10635. }
  10636. if (timerId === undefined) {
  10637. timerId = setTimeout(timerExpired, wait);
  10638. }
  10639. return result;
  10640. }
  10641. debounced.cancel = cancel;
  10642. debounced.flush = flush;
  10643. return debounced;
  10644. }
  10645. /**
  10646. * Defers invoking the `func` until the current call stack has cleared. Any
  10647. * additional arguments are provided to `func` when it's invoked.
  10648. *
  10649. * @static
  10650. * @memberOf _
  10651. * @since 0.1.0
  10652. * @category Function
  10653. * @param {Function} func The function to defer.
  10654. * @param {...*} [args] The arguments to invoke `func` with.
  10655. * @returns {number} Returns the timer id.
  10656. * @example
  10657. *
  10658. * _.defer(function(text) {
  10659. * console.log(text);
  10660. * }, 'deferred');
  10661. * // => Logs 'deferred' after one millisecond.
  10662. */
  10663. var defer = baseRest(function(func, args) {
  10664. return baseDelay(func, 1, args);
  10665. });
  10666. /**
  10667. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  10668. * provided to `func` when it's invoked.
  10669. *
  10670. * @static
  10671. * @memberOf _
  10672. * @since 0.1.0
  10673. * @category Function
  10674. * @param {Function} func The function to delay.
  10675. * @param {number} wait The number of milliseconds to delay invocation.
  10676. * @param {...*} [args] The arguments to invoke `func` with.
  10677. * @returns {number} Returns the timer id.
  10678. * @example
  10679. *
  10680. * _.delay(function(text) {
  10681. * console.log(text);
  10682. * }, 1000, 'later');
  10683. * // => Logs 'later' after one second.
  10684. */
  10685. var delay = baseRest(function(func, wait, args) {
  10686. return baseDelay(func, toNumber(wait) || 0, args);
  10687. });
  10688. /**
  10689. * Creates a function that invokes `func` with arguments reversed.
  10690. *
  10691. * @static
  10692. * @memberOf _
  10693. * @since 4.0.0
  10694. * @category Function
  10695. * @param {Function} func The function to flip arguments for.
  10696. * @returns {Function} Returns the new flipped function.
  10697. * @example
  10698. *
  10699. * var flipped = _.flip(function() {
  10700. * return _.toArray(arguments);
  10701. * });
  10702. *
  10703. * flipped('a', 'b', 'c', 'd');
  10704. * // => ['d', 'c', 'b', 'a']
  10705. */
  10706. function flip(func) {
  10707. return createWrap(func, WRAP_FLIP_FLAG);
  10708. }
  10709. /**
  10710. * Creates a function that memoizes the result of `func`. If `resolver` is
  10711. * provided, it determines the cache key for storing the result based on the
  10712. * arguments provided to the memoized function. By default, the first argument
  10713. * provided to the memoized function is used as the map cache key. The `func`
  10714. * is invoked with the `this` binding of the memoized function.
  10715. *
  10716. * **Note:** The cache is exposed as the `cache` property on the memoized
  10717. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  10718. * constructor with one whose instances implement the
  10719. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  10720. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  10721. *
  10722. * @static
  10723. * @memberOf _
  10724. * @since 0.1.0
  10725. * @category Function
  10726. * @param {Function} func The function to have its output memoized.
  10727. * @param {Function} [resolver] The function to resolve the cache key.
  10728. * @returns {Function} Returns the new memoized function.
  10729. * @example
  10730. *
  10731. * var object = { 'a': 1, 'b': 2 };
  10732. * var other = { 'c': 3, 'd': 4 };
  10733. *
  10734. * var values = _.memoize(_.values);
  10735. * values(object);
  10736. * // => [1, 2]
  10737. *
  10738. * values(other);
  10739. * // => [3, 4]
  10740. *
  10741. * object.a = 2;
  10742. * values(object);
  10743. * // => [1, 2]
  10744. *
  10745. * // Modify the result cache.
  10746. * values.cache.set(object, ['a', 'b']);
  10747. * values(object);
  10748. * // => ['a', 'b']
  10749. *
  10750. * // Replace `_.memoize.Cache`.
  10751. * _.memoize.Cache = WeakMap;
  10752. */
  10753. function memoize(func, resolver) {
  10754. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  10755. throw new TypeError(FUNC_ERROR_TEXT);
  10756. }
  10757. var memoized = function() {
  10758. var args = arguments,
  10759. key = resolver ? resolver.apply(this, args) : args[0],
  10760. cache = memoized.cache;
  10761. if (cache.has(key)) {
  10762. return cache.get(key);
  10763. }
  10764. var result = func.apply(this, args);
  10765. memoized.cache = cache.set(key, result) || cache;
  10766. return result;
  10767. };
  10768. memoized.cache = new (memoize.Cache || MapCache);
  10769. return memoized;
  10770. }
  10771. // Expose `MapCache`.
  10772. memoize.Cache = MapCache;
  10773. /**
  10774. * Creates a function that negates the result of the predicate `func`. The
  10775. * `func` predicate is invoked with the `this` binding and arguments of the
  10776. * created function.
  10777. *
  10778. * @static
  10779. * @memberOf _
  10780. * @since 3.0.0
  10781. * @category Function
  10782. * @param {Function} predicate The predicate to negate.
  10783. * @returns {Function} Returns the new negated function.
  10784. * @example
  10785. *
  10786. * function isEven(n) {
  10787. * return n % 2 == 0;
  10788. * }
  10789. *
  10790. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  10791. * // => [1, 3, 5]
  10792. */
  10793. function negate(predicate) {
  10794. if (typeof predicate != 'function') {
  10795. throw new TypeError(FUNC_ERROR_TEXT);
  10796. }
  10797. return function() {
  10798. var args = arguments;
  10799. switch (args.length) {
  10800. case 0: return !predicate.call(this);
  10801. case 1: return !predicate.call(this, args[0]);
  10802. case 2: return !predicate.call(this, args[0], args[1]);
  10803. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  10804. }
  10805. return !predicate.apply(this, args);
  10806. };
  10807. }
  10808. /**
  10809. * Creates a function that is restricted to invoking `func` once. Repeat calls
  10810. * to the function return the value of the first invocation. The `func` is
  10811. * invoked with the `this` binding and arguments of the created function.
  10812. *
  10813. * @static
  10814. * @memberOf _
  10815. * @since 0.1.0
  10816. * @category Function
  10817. * @param {Function} func The function to restrict.
  10818. * @returns {Function} Returns the new restricted function.
  10819. * @example
  10820. *
  10821. * var initialize = _.once(createApplication);
  10822. * initialize();
  10823. * initialize();
  10824. * // => `createApplication` is invoked once
  10825. */
  10826. function once(func) {
  10827. return before(2, func);
  10828. }
  10829. /**
  10830. * Creates a function that invokes `func` with its arguments transformed.
  10831. *
  10832. * @static
  10833. * @since 4.0.0
  10834. * @memberOf _
  10835. * @category Function
  10836. * @param {Function} func The function to wrap.
  10837. * @param {...(Function|Function[])} [transforms=[_.identity]]
  10838. * The argument transforms.
  10839. * @returns {Function} Returns the new function.
  10840. * @example
  10841. *
  10842. * function doubled(n) {
  10843. * return n * 2;
  10844. * }
  10845. *
  10846. * function square(n) {
  10847. * return n * n;
  10848. * }
  10849. *
  10850. * var func = _.overArgs(function(x, y) {
  10851. * return [x, y];
  10852. * }, [square, doubled]);
  10853. *
  10854. * func(9, 3);
  10855. * // => [81, 6]
  10856. *
  10857. * func(10, 5);
  10858. * // => [100, 10]
  10859. */
  10860. var overArgs = castRest(function(func, transforms) {
  10861. transforms = (transforms.length == 1 && isArray(transforms[0]))
  10862. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  10863. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  10864. var funcsLength = transforms.length;
  10865. return baseRest(function(args) {
  10866. var index = -1,
  10867. length = nativeMin(args.length, funcsLength);
  10868. while (++index < length) {
  10869. args[index] = transforms[index].call(this, args[index]);
  10870. }
  10871. return apply(func, this, args);
  10872. });
  10873. });
  10874. /**
  10875. * Creates a function that invokes `func` with `partials` prepended to the
  10876. * arguments it receives. This method is like `_.bind` except it does **not**
  10877. * alter the `this` binding.
  10878. *
  10879. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  10880. * builds, may be used as a placeholder for partially applied arguments.
  10881. *
  10882. * **Note:** This method doesn't set the "length" property of partially
  10883. * applied functions.
  10884. *
  10885. * @static
  10886. * @memberOf _
  10887. * @since 0.2.0
  10888. * @category Function
  10889. * @param {Function} func The function to partially apply arguments to.
  10890. * @param {...*} [partials] The arguments to be partially applied.
  10891. * @returns {Function} Returns the new partially applied function.
  10892. * @example
  10893. *
  10894. * function greet(greeting, name) {
  10895. * return greeting + ' ' + name;
  10896. * }
  10897. *
  10898. * var sayHelloTo = _.partial(greet, 'hello');
  10899. * sayHelloTo('fred');
  10900. * // => 'hello fred'
  10901. *
  10902. * // Partially applied with placeholders.
  10903. * var greetFred = _.partial(greet, _, 'fred');
  10904. * greetFred('hi');
  10905. * // => 'hi fred'
  10906. */
  10907. var partial = baseRest(function(func, partials) {
  10908. var holders = replaceHolders(partials, getHolder(partial));
  10909. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  10910. });
  10911. /**
  10912. * This method is like `_.partial` except that partially applied arguments
  10913. * are appended to the arguments it receives.
  10914. *
  10915. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  10916. * builds, may be used as a placeholder for partially applied arguments.
  10917. *
  10918. * **Note:** This method doesn't set the "length" property of partially
  10919. * applied functions.
  10920. *
  10921. * @static
  10922. * @memberOf _
  10923. * @since 1.0.0
  10924. * @category Function
  10925. * @param {Function} func The function to partially apply arguments to.
  10926. * @param {...*} [partials] The arguments to be partially applied.
  10927. * @returns {Function} Returns the new partially applied function.
  10928. * @example
  10929. *
  10930. * function greet(greeting, name) {
  10931. * return greeting + ' ' + name;
  10932. * }
  10933. *
  10934. * var greetFred = _.partialRight(greet, 'fred');
  10935. * greetFred('hi');
  10936. * // => 'hi fred'
  10937. *
  10938. * // Partially applied with placeholders.
  10939. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  10940. * sayHelloTo('fred');
  10941. * // => 'hello fred'
  10942. */
  10943. var partialRight = baseRest(function(func, partials) {
  10944. var holders = replaceHolders(partials, getHolder(partialRight));
  10945. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  10946. });
  10947. /**
  10948. * Creates a function that invokes `func` with arguments arranged according
  10949. * to the specified `indexes` where the argument value at the first index is
  10950. * provided as the first argument, the argument value at the second index is
  10951. * provided as the second argument, and so on.
  10952. *
  10953. * @static
  10954. * @memberOf _
  10955. * @since 3.0.0
  10956. * @category Function
  10957. * @param {Function} func The function to rearrange arguments for.
  10958. * @param {...(number|number[])} indexes The arranged argument indexes.
  10959. * @returns {Function} Returns the new function.
  10960. * @example
  10961. *
  10962. * var rearged = _.rearg(function(a, b, c) {
  10963. * return [a, b, c];
  10964. * }, [2, 0, 1]);
  10965. *
  10966. * rearged('b', 'c', 'a')
  10967. * // => ['a', 'b', 'c']
  10968. */
  10969. var rearg = flatRest(function(func, indexes) {
  10970. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  10971. });
  10972. /**
  10973. * Creates a function that invokes `func` with the `this` binding of the
  10974. * created function and arguments from `start` and beyond provided as
  10975. * an array.
  10976. *
  10977. * **Note:** This method is based on the
  10978. * [rest parameter](https://mdn.io/rest_parameters).
  10979. *
  10980. * @static
  10981. * @memberOf _
  10982. * @since 4.0.0
  10983. * @category Function
  10984. * @param {Function} func The function to apply a rest parameter to.
  10985. * @param {number} [start=func.length-1] The start position of the rest parameter.
  10986. * @returns {Function} Returns the new function.
  10987. * @example
  10988. *
  10989. * var say = _.rest(function(what, names) {
  10990. * return what + ' ' + _.initial(names).join(', ') +
  10991. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  10992. * });
  10993. *
  10994. * say('hello', 'fred', 'barney', 'pebbles');
  10995. * // => 'hello fred, barney, & pebbles'
  10996. */
  10997. function rest(func, start) {
  10998. if (typeof func != 'function') {
  10999. throw new TypeError(FUNC_ERROR_TEXT);
  11000. }
  11001. start = start === undefined ? start : toInteger(start);
  11002. return baseRest(func, start);
  11003. }
  11004. /**
  11005. * Creates a function that invokes `func` with the `this` binding of the
  11006. * create function and an array of arguments much like
  11007. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  11008. *
  11009. * **Note:** This method is based on the
  11010. * [spread operator](https://mdn.io/spread_operator).
  11011. *
  11012. * @static
  11013. * @memberOf _
  11014. * @since 3.2.0
  11015. * @category Function
  11016. * @param {Function} func The function to spread arguments over.
  11017. * @param {number} [start=0] The start position of the spread.
  11018. * @returns {Function} Returns the new function.
  11019. * @example
  11020. *
  11021. * var say = _.spread(function(who, what) {
  11022. * return who + ' says ' + what;
  11023. * });
  11024. *
  11025. * say(['fred', 'hello']);
  11026. * // => 'fred says hello'
  11027. *
  11028. * var numbers = Promise.all([
  11029. * Promise.resolve(40),
  11030. * Promise.resolve(36)
  11031. * ]);
  11032. *
  11033. * numbers.then(_.spread(function(x, y) {
  11034. * return x + y;
  11035. * }));
  11036. * // => a Promise of 76
  11037. */
  11038. function spread(func, start) {
  11039. if (typeof func != 'function') {
  11040. throw new TypeError(FUNC_ERROR_TEXT);
  11041. }
  11042. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  11043. return baseRest(function(args) {
  11044. var array = args[start],
  11045. otherArgs = castSlice(args, 0, start);
  11046. if (array) {
  11047. arrayPush(otherArgs, array);
  11048. }
  11049. return apply(func, this, otherArgs);
  11050. });
  11051. }
  11052. /**
  11053. * Creates a throttled function that only invokes `func` at most once per
  11054. * every `wait` milliseconds. The throttled function comes with a `cancel`
  11055. * method to cancel delayed `func` invocations and a `flush` method to
  11056. * immediately invoke them. Provide `options` to indicate whether `func`
  11057. * should be invoked on the leading and/or trailing edge of the `wait`
  11058. * timeout. The `func` is invoked with the last arguments provided to the
  11059. * throttled function. Subsequent calls to the throttled function return the
  11060. * result of the last `func` invocation.
  11061. *
  11062. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  11063. * invoked on the trailing edge of the timeout only if the throttled function
  11064. * is invoked more than once during the `wait` timeout.
  11065. *
  11066. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  11067. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  11068. *
  11069. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  11070. * for details over the differences between `_.throttle` and `_.debounce`.
  11071. *
  11072. * @static
  11073. * @memberOf _
  11074. * @since 0.1.0
  11075. * @category Function
  11076. * @param {Function} func The function to throttle.
  11077. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  11078. * @param {Object} [options={}] The options object.
  11079. * @param {boolean} [options.leading=true]
  11080. * Specify invoking on the leading edge of the timeout.
  11081. * @param {boolean} [options.trailing=true]
  11082. * Specify invoking on the trailing edge of the timeout.
  11083. * @returns {Function} Returns the new throttled function.
  11084. * @example
  11085. *
  11086. * // Avoid excessively updating the position while scrolling.
  11087. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  11088. *
  11089. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  11090. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  11091. * jQuery(element).on('click', throttled);
  11092. *
  11093. * // Cancel the trailing throttled invocation.
  11094. * jQuery(window).on('popstate', throttled.cancel);
  11095. */
  11096. function throttle(func, wait, options) {
  11097. var leading = true,
  11098. trailing = true;
  11099. if (typeof func != 'function') {
  11100. throw new TypeError(FUNC_ERROR_TEXT);
  11101. }
  11102. if (isObject(options)) {
  11103. leading = 'leading' in options ? !!options.leading : leading;
  11104. trailing = 'trailing' in options ? !!options.trailing : trailing;
  11105. }
  11106. return debounce(func, wait, {
  11107. 'leading': leading,
  11108. 'maxWait': wait,
  11109. 'trailing': trailing
  11110. });
  11111. }
  11112. /**
  11113. * Creates a function that accepts up to one argument, ignoring any
  11114. * additional arguments.
  11115. *
  11116. * @static
  11117. * @memberOf _
  11118. * @since 4.0.0
  11119. * @category Function
  11120. * @param {Function} func The function to cap arguments for.
  11121. * @returns {Function} Returns the new capped function.
  11122. * @example
  11123. *
  11124. * _.map(['6', '8', '10'], _.unary(parseInt));
  11125. * // => [6, 8, 10]
  11126. */
  11127. function unary(func) {
  11128. return ary(func, 1);
  11129. }
  11130. /**
  11131. * Creates a function that provides `value` to `wrapper` as its first
  11132. * argument. Any additional arguments provided to the function are appended
  11133. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  11134. * binding of the created function.
  11135. *
  11136. * @static
  11137. * @memberOf _
  11138. * @since 0.1.0
  11139. * @category Function
  11140. * @param {*} value The value to wrap.
  11141. * @param {Function} [wrapper=identity] The wrapper function.
  11142. * @returns {Function} Returns the new function.
  11143. * @example
  11144. *
  11145. * var p = _.wrap(_.escape, function(func, text) {
  11146. * return '<p>' + func(text) + '</p>';
  11147. * });
  11148. *
  11149. * p('fred, barney, & pebbles');
  11150. * // => '<p>fred, barney, &amp; pebbles</p>'
  11151. */
  11152. function wrap(value, wrapper) {
  11153. return partial(castFunction(wrapper), value);
  11154. }
  11155. /*------------------------------------------------------------------------*/
  11156. /**
  11157. * Casts `value` as an array if it's not one.
  11158. *
  11159. * @static
  11160. * @memberOf _
  11161. * @since 4.4.0
  11162. * @category Lang
  11163. * @param {*} value The value to inspect.
  11164. * @returns {Array} Returns the cast array.
  11165. * @example
  11166. *
  11167. * _.castArray(1);
  11168. * // => [1]
  11169. *
  11170. * _.castArray({ 'a': 1 });
  11171. * // => [{ 'a': 1 }]
  11172. *
  11173. * _.castArray('abc');
  11174. * // => ['abc']
  11175. *
  11176. * _.castArray(null);
  11177. * // => [null]
  11178. *
  11179. * _.castArray(undefined);
  11180. * // => [undefined]
  11181. *
  11182. * _.castArray();
  11183. * // => []
  11184. *
  11185. * var array = [1, 2, 3];
  11186. * console.log(_.castArray(array) === array);
  11187. * // => true
  11188. */
  11189. function castArray() {
  11190. if (!arguments.length) {
  11191. return [];
  11192. }
  11193. var value = arguments[0];
  11194. return isArray(value) ? value : [value];
  11195. }
  11196. /**
  11197. * Creates a shallow clone of `value`.
  11198. *
  11199. * **Note:** This method is loosely based on the
  11200. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  11201. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  11202. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  11203. * arrays. The own enumerable properties of `arguments` objects are cloned
  11204. * as plain objects. An empty object is returned for uncloneable values such
  11205. * as error objects, functions, DOM nodes, and WeakMaps.
  11206. *
  11207. * @static
  11208. * @memberOf _
  11209. * @since 0.1.0
  11210. * @category Lang
  11211. * @param {*} value The value to clone.
  11212. * @returns {*} Returns the cloned value.
  11213. * @see _.cloneDeep
  11214. * @example
  11215. *
  11216. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  11217. *
  11218. * var shallow = _.clone(objects);
  11219. * console.log(shallow[0] === objects[0]);
  11220. * // => true
  11221. */
  11222. function clone(value) {
  11223. return baseClone(value, CLONE_SYMBOLS_FLAG);
  11224. }
  11225. /**
  11226. * This method is like `_.clone` except that it accepts `customizer` which
  11227. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  11228. * cloning is handled by the method instead. The `customizer` is invoked with
  11229. * up to four arguments; (value [, index|key, object, stack]).
  11230. *
  11231. * @static
  11232. * @memberOf _
  11233. * @since 4.0.0
  11234. * @category Lang
  11235. * @param {*} value The value to clone.
  11236. * @param {Function} [customizer] The function to customize cloning.
  11237. * @returns {*} Returns the cloned value.
  11238. * @see _.cloneDeepWith
  11239. * @example
  11240. *
  11241. * function customizer(value) {
  11242. * if (_.isElement(value)) {
  11243. * return value.cloneNode(false);
  11244. * }
  11245. * }
  11246. *
  11247. * var el = _.cloneWith(document.body, customizer);
  11248. *
  11249. * console.log(el === document.body);
  11250. * // => false
  11251. * console.log(el.nodeName);
  11252. * // => 'BODY'
  11253. * console.log(el.childNodes.length);
  11254. * // => 0
  11255. */
  11256. function cloneWith(value, customizer) {
  11257. customizer = typeof customizer == 'function' ? customizer : undefined;
  11258. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  11259. }
  11260. /**
  11261. * This method is like `_.clone` except that it recursively clones `value`.
  11262. *
  11263. * @static
  11264. * @memberOf _
  11265. * @since 1.0.0
  11266. * @category Lang
  11267. * @param {*} value The value to recursively clone.
  11268. * @returns {*} Returns the deep cloned value.
  11269. * @see _.clone
  11270. * @example
  11271. *
  11272. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  11273. *
  11274. * var deep = _.cloneDeep(objects);
  11275. * console.log(deep[0] === objects[0]);
  11276. * // => false
  11277. */
  11278. function cloneDeep(value) {
  11279. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  11280. }
  11281. /**
  11282. * This method is like `_.cloneWith` except that it recursively clones `value`.
  11283. *
  11284. * @static
  11285. * @memberOf _
  11286. * @since 4.0.0
  11287. * @category Lang
  11288. * @param {*} value The value to recursively clone.
  11289. * @param {Function} [customizer] The function to customize cloning.
  11290. * @returns {*} Returns the deep cloned value.
  11291. * @see _.cloneWith
  11292. * @example
  11293. *
  11294. * function customizer(value) {
  11295. * if (_.isElement(value)) {
  11296. * return value.cloneNode(true);
  11297. * }
  11298. * }
  11299. *
  11300. * var el = _.cloneDeepWith(document.body, customizer);
  11301. *
  11302. * console.log(el === document.body);
  11303. * // => false
  11304. * console.log(el.nodeName);
  11305. * // => 'BODY'
  11306. * console.log(el.childNodes.length);
  11307. * // => 20
  11308. */
  11309. function cloneDeepWith(value, customizer) {
  11310. customizer = typeof customizer == 'function' ? customizer : undefined;
  11311. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  11312. }
  11313. /**
  11314. * Checks if `object` conforms to `source` by invoking the predicate
  11315. * properties of `source` with the corresponding property values of `object`.
  11316. *
  11317. * **Note:** This method is equivalent to `_.conforms` when `source` is
  11318. * partially applied.
  11319. *
  11320. * @static
  11321. * @memberOf _
  11322. * @since 4.14.0
  11323. * @category Lang
  11324. * @param {Object} object The object to inspect.
  11325. * @param {Object} source The object of property predicates to conform to.
  11326. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  11327. * @example
  11328. *
  11329. * var object = { 'a': 1, 'b': 2 };
  11330. *
  11331. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  11332. * // => true
  11333. *
  11334. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  11335. * // => false
  11336. */
  11337. function conformsTo(object, source) {
  11338. return source == null || baseConformsTo(object, source, keys(source));
  11339. }
  11340. /**
  11341. * Performs a
  11342. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  11343. * comparison between two values to determine if they are equivalent.
  11344. *
  11345. * @static
  11346. * @memberOf _
  11347. * @since 4.0.0
  11348. * @category Lang
  11349. * @param {*} value The value to compare.
  11350. * @param {*} other The other value to compare.
  11351. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11352. * @example
  11353. *
  11354. * var object = { 'a': 1 };
  11355. * var other = { 'a': 1 };
  11356. *
  11357. * _.eq(object, object);
  11358. * // => true
  11359. *
  11360. * _.eq(object, other);
  11361. * // => false
  11362. *
  11363. * _.eq('a', 'a');
  11364. * // => true
  11365. *
  11366. * _.eq('a', Object('a'));
  11367. * // => false
  11368. *
  11369. * _.eq(NaN, NaN);
  11370. * // => true
  11371. */
  11372. function eq(value, other) {
  11373. return value === other || (value !== value && other !== other);
  11374. }
  11375. /**
  11376. * Checks if `value` is greater than `other`.
  11377. *
  11378. * @static
  11379. * @memberOf _
  11380. * @since 3.9.0
  11381. * @category Lang
  11382. * @param {*} value The value to compare.
  11383. * @param {*} other The other value to compare.
  11384. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  11385. * else `false`.
  11386. * @see _.lt
  11387. * @example
  11388. *
  11389. * _.gt(3, 1);
  11390. * // => true
  11391. *
  11392. * _.gt(3, 3);
  11393. * // => false
  11394. *
  11395. * _.gt(1, 3);
  11396. * // => false
  11397. */
  11398. var gt = createRelationalOperation(baseGt);
  11399. /**
  11400. * Checks if `value` is greater than or equal to `other`.
  11401. *
  11402. * @static
  11403. * @memberOf _
  11404. * @since 3.9.0
  11405. * @category Lang
  11406. * @param {*} value The value to compare.
  11407. * @param {*} other The other value to compare.
  11408. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  11409. * `other`, else `false`.
  11410. * @see _.lte
  11411. * @example
  11412. *
  11413. * _.gte(3, 1);
  11414. * // => true
  11415. *
  11416. * _.gte(3, 3);
  11417. * // => true
  11418. *
  11419. * _.gte(1, 3);
  11420. * // => false
  11421. */
  11422. var gte = createRelationalOperation(function(value, other) {
  11423. return value >= other;
  11424. });
  11425. /**
  11426. * Checks if `value` is likely an `arguments` object.
  11427. *
  11428. * @static
  11429. * @memberOf _
  11430. * @since 0.1.0
  11431. * @category Lang
  11432. * @param {*} value The value to check.
  11433. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  11434. * else `false`.
  11435. * @example
  11436. *
  11437. * _.isArguments(function() { return arguments; }());
  11438. * // => true
  11439. *
  11440. * _.isArguments([1, 2, 3]);
  11441. * // => false
  11442. */
  11443. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  11444. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  11445. !propertyIsEnumerable.call(value, 'callee');
  11446. };
  11447. /**
  11448. * Checks if `value` is classified as an `Array` object.
  11449. *
  11450. * @static
  11451. * @memberOf _
  11452. * @since 0.1.0
  11453. * @category Lang
  11454. * @param {*} value The value to check.
  11455. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  11456. * @example
  11457. *
  11458. * _.isArray([1, 2, 3]);
  11459. * // => true
  11460. *
  11461. * _.isArray(document.body.children);
  11462. * // => false
  11463. *
  11464. * _.isArray('abc');
  11465. * // => false
  11466. *
  11467. * _.isArray(_.noop);
  11468. * // => false
  11469. */
  11470. var isArray = Array.isArray;
  11471. /**
  11472. * Checks if `value` is classified as an `ArrayBuffer` object.
  11473. *
  11474. * @static
  11475. * @memberOf _
  11476. * @since 4.3.0
  11477. * @category Lang
  11478. * @param {*} value The value to check.
  11479. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  11480. * @example
  11481. *
  11482. * _.isArrayBuffer(new ArrayBuffer(2));
  11483. * // => true
  11484. *
  11485. * _.isArrayBuffer(new Array(2));
  11486. * // => false
  11487. */
  11488. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  11489. /**
  11490. * Checks if `value` is array-like. A value is considered array-like if it's
  11491. * not a function and has a `value.length` that's an integer greater than or
  11492. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  11493. *
  11494. * @static
  11495. * @memberOf _
  11496. * @since 4.0.0
  11497. * @category Lang
  11498. * @param {*} value The value to check.
  11499. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  11500. * @example
  11501. *
  11502. * _.isArrayLike([1, 2, 3]);
  11503. * // => true
  11504. *
  11505. * _.isArrayLike(document.body.children);
  11506. * // => true
  11507. *
  11508. * _.isArrayLike('abc');
  11509. * // => true
  11510. *
  11511. * _.isArrayLike(_.noop);
  11512. * // => false
  11513. */
  11514. function isArrayLike(value) {
  11515. return value != null && isLength(value.length) && !isFunction(value);
  11516. }
  11517. /**
  11518. * This method is like `_.isArrayLike` except that it also checks if `value`
  11519. * is an object.
  11520. *
  11521. * @static
  11522. * @memberOf _
  11523. * @since 4.0.0
  11524. * @category Lang
  11525. * @param {*} value The value to check.
  11526. * @returns {boolean} Returns `true` if `value` is an array-like object,
  11527. * else `false`.
  11528. * @example
  11529. *
  11530. * _.isArrayLikeObject([1, 2, 3]);
  11531. * // => true
  11532. *
  11533. * _.isArrayLikeObject(document.body.children);
  11534. * // => true
  11535. *
  11536. * _.isArrayLikeObject('abc');
  11537. * // => false
  11538. *
  11539. * _.isArrayLikeObject(_.noop);
  11540. * // => false
  11541. */
  11542. function isArrayLikeObject(value) {
  11543. return isObjectLike(value) && isArrayLike(value);
  11544. }
  11545. /**
  11546. * Checks if `value` is classified as a boolean primitive or object.
  11547. *
  11548. * @static
  11549. * @memberOf _
  11550. * @since 0.1.0
  11551. * @category Lang
  11552. * @param {*} value The value to check.
  11553. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  11554. * @example
  11555. *
  11556. * _.isBoolean(false);
  11557. * // => true
  11558. *
  11559. * _.isBoolean(null);
  11560. * // => false
  11561. */
  11562. function isBoolean(value) {
  11563. return value === true || value === false ||
  11564. (isObjectLike(value) && baseGetTag(value) == boolTag);
  11565. }
  11566. /**
  11567. * Checks if `value` is a buffer.
  11568. *
  11569. * @static
  11570. * @memberOf _
  11571. * @since 4.3.0
  11572. * @category Lang
  11573. * @param {*} value The value to check.
  11574. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  11575. * @example
  11576. *
  11577. * _.isBuffer(new Buffer(2));
  11578. * // => true
  11579. *
  11580. * _.isBuffer(new Uint8Array(2));
  11581. * // => false
  11582. */
  11583. var isBuffer = nativeIsBuffer || stubFalse;
  11584. /**
  11585. * Checks if `value` is classified as a `Date` object.
  11586. *
  11587. * @static
  11588. * @memberOf _
  11589. * @since 0.1.0
  11590. * @category Lang
  11591. * @param {*} value The value to check.
  11592. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  11593. * @example
  11594. *
  11595. * _.isDate(new Date);
  11596. * // => true
  11597. *
  11598. * _.isDate('Mon April 23 2012');
  11599. * // => false
  11600. */
  11601. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  11602. /**
  11603. * Checks if `value` is likely a DOM element.
  11604. *
  11605. * @static
  11606. * @memberOf _
  11607. * @since 0.1.0
  11608. * @category Lang
  11609. * @param {*} value The value to check.
  11610. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  11611. * @example
  11612. *
  11613. * _.isElement(document.body);
  11614. * // => true
  11615. *
  11616. * _.isElement('<body>');
  11617. * // => false
  11618. */
  11619. function isElement(value) {
  11620. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  11621. }
  11622. /**
  11623. * Checks if `value` is an empty object, collection, map, or set.
  11624. *
  11625. * Objects are considered empty if they have no own enumerable string keyed
  11626. * properties.
  11627. *
  11628. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  11629. * jQuery-like collections are considered empty if they have a `length` of `0`.
  11630. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  11631. *
  11632. * @static
  11633. * @memberOf _
  11634. * @since 0.1.0
  11635. * @category Lang
  11636. * @param {*} value The value to check.
  11637. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  11638. * @example
  11639. *
  11640. * _.isEmpty(null);
  11641. * // => true
  11642. *
  11643. * _.isEmpty(true);
  11644. * // => true
  11645. *
  11646. * _.isEmpty(1);
  11647. * // => true
  11648. *
  11649. * _.isEmpty([1, 2, 3]);
  11650. * // => false
  11651. *
  11652. * _.isEmpty({ 'a': 1 });
  11653. * // => false
  11654. */
  11655. function isEmpty(value) {
  11656. if (value == null) {
  11657. return true;
  11658. }
  11659. if (isArrayLike(value) &&
  11660. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  11661. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  11662. return !value.length;
  11663. }
  11664. var tag = getTag(value);
  11665. if (tag == mapTag || tag == setTag) {
  11666. return !value.size;
  11667. }
  11668. if (isPrototype(value)) {
  11669. return !baseKeys(value).length;
  11670. }
  11671. for (var key in value) {
  11672. if (hasOwnProperty.call(value, key)) {
  11673. return false;
  11674. }
  11675. }
  11676. return true;
  11677. }
  11678. /**
  11679. * Performs a deep comparison between two values to determine if they are
  11680. * equivalent.
  11681. *
  11682. * **Note:** This method supports comparing arrays, array buffers, booleans,
  11683. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  11684. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  11685. * by their own, not inherited, enumerable properties. Functions and DOM
  11686. * nodes are compared by strict equality, i.e. `===`.
  11687. *
  11688. * @static
  11689. * @memberOf _
  11690. * @since 0.1.0
  11691. * @category Lang
  11692. * @param {*} value The value to compare.
  11693. * @param {*} other The other value to compare.
  11694. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11695. * @example
  11696. *
  11697. * var object = { 'a': 1 };
  11698. * var other = { 'a': 1 };
  11699. *
  11700. * _.isEqual(object, other);
  11701. * // => true
  11702. *
  11703. * object === other;
  11704. * // => false
  11705. */
  11706. function isEqual(value, other) {
  11707. return baseIsEqual(value, other);
  11708. }
  11709. /**
  11710. * This method is like `_.isEqual` except that it accepts `customizer` which
  11711. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  11712. * are handled by the method instead. The `customizer` is invoked with up to
  11713. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  11714. *
  11715. * @static
  11716. * @memberOf _
  11717. * @since 4.0.0
  11718. * @category Lang
  11719. * @param {*} value The value to compare.
  11720. * @param {*} other The other value to compare.
  11721. * @param {Function} [customizer] The function to customize comparisons.
  11722. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  11723. * @example
  11724. *
  11725. * function isGreeting(value) {
  11726. * return /^h(?:i|ello)$/.test(value);
  11727. * }
  11728. *
  11729. * function customizer(objValue, othValue) {
  11730. * if (isGreeting(objValue) && isGreeting(othValue)) {
  11731. * return true;
  11732. * }
  11733. * }
  11734. *
  11735. * var array = ['hello', 'goodbye'];
  11736. * var other = ['hi', 'goodbye'];
  11737. *
  11738. * _.isEqualWith(array, other, customizer);
  11739. * // => true
  11740. */
  11741. function isEqualWith(value, other, customizer) {
  11742. customizer = typeof customizer == 'function' ? customizer : undefined;
  11743. var result = customizer ? customizer(value, other) : undefined;
  11744. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  11745. }
  11746. /**
  11747. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  11748. * `SyntaxError`, `TypeError`, or `URIError` object.
  11749. *
  11750. * @static
  11751. * @memberOf _
  11752. * @since 3.0.0
  11753. * @category Lang
  11754. * @param {*} value The value to check.
  11755. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  11756. * @example
  11757. *
  11758. * _.isError(new Error);
  11759. * // => true
  11760. *
  11761. * _.isError(Error);
  11762. * // => false
  11763. */
  11764. function isError(value) {
  11765. if (!isObjectLike(value)) {
  11766. return false;
  11767. }
  11768. var tag = baseGetTag(value);
  11769. return tag == errorTag || tag == domExcTag ||
  11770. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  11771. }
  11772. /**
  11773. * Checks if `value` is a finite primitive number.
  11774. *
  11775. * **Note:** This method is based on
  11776. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  11777. *
  11778. * @static
  11779. * @memberOf _
  11780. * @since 0.1.0
  11781. * @category Lang
  11782. * @param {*} value The value to check.
  11783. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  11784. * @example
  11785. *
  11786. * _.isFinite(3);
  11787. * // => true
  11788. *
  11789. * _.isFinite(Number.MIN_VALUE);
  11790. * // => true
  11791. *
  11792. * _.isFinite(Infinity);
  11793. * // => false
  11794. *
  11795. * _.isFinite('3');
  11796. * // => false
  11797. */
  11798. function isFinite(value) {
  11799. return typeof value == 'number' && nativeIsFinite(value);
  11800. }
  11801. /**
  11802. * Checks if `value` is classified as a `Function` object.
  11803. *
  11804. * @static
  11805. * @memberOf _
  11806. * @since 0.1.0
  11807. * @category Lang
  11808. * @param {*} value The value to check.
  11809. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  11810. * @example
  11811. *
  11812. * _.isFunction(_);
  11813. * // => true
  11814. *
  11815. * _.isFunction(/abc/);
  11816. * // => false
  11817. */
  11818. function isFunction(value) {
  11819. if (!isObject(value)) {
  11820. return false;
  11821. }
  11822. // The use of `Object#toString` avoids issues with the `typeof` operator
  11823. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  11824. var tag = baseGetTag(value);
  11825. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  11826. }
  11827. /**
  11828. * Checks if `value` is an integer.
  11829. *
  11830. * **Note:** This method is based on
  11831. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  11832. *
  11833. * @static
  11834. * @memberOf _
  11835. * @since 4.0.0
  11836. * @category Lang
  11837. * @param {*} value The value to check.
  11838. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  11839. * @example
  11840. *
  11841. * _.isInteger(3);
  11842. * // => true
  11843. *
  11844. * _.isInteger(Number.MIN_VALUE);
  11845. * // => false
  11846. *
  11847. * _.isInteger(Infinity);
  11848. * // => false
  11849. *
  11850. * _.isInteger('3');
  11851. * // => false
  11852. */
  11853. function isInteger(value) {
  11854. return typeof value == 'number' && value == toInteger(value);
  11855. }
  11856. /**
  11857. * Checks if `value` is a valid array-like length.
  11858. *
  11859. * **Note:** This method is loosely based on
  11860. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  11861. *
  11862. * @static
  11863. * @memberOf _
  11864. * @since 4.0.0
  11865. * @category Lang
  11866. * @param {*} value The value to check.
  11867. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  11868. * @example
  11869. *
  11870. * _.isLength(3);
  11871. * // => true
  11872. *
  11873. * _.isLength(Number.MIN_VALUE);
  11874. * // => false
  11875. *
  11876. * _.isLength(Infinity);
  11877. * // => false
  11878. *
  11879. * _.isLength('3');
  11880. * // => false
  11881. */
  11882. function isLength(value) {
  11883. return typeof value == 'number' &&
  11884. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  11885. }
  11886. /**
  11887. * Checks if `value` is the
  11888. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  11889. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  11890. *
  11891. * @static
  11892. * @memberOf _
  11893. * @since 0.1.0
  11894. * @category Lang
  11895. * @param {*} value The value to check.
  11896. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  11897. * @example
  11898. *
  11899. * _.isObject({});
  11900. * // => true
  11901. *
  11902. * _.isObject([1, 2, 3]);
  11903. * // => true
  11904. *
  11905. * _.isObject(_.noop);
  11906. * // => true
  11907. *
  11908. * _.isObject(null);
  11909. * // => false
  11910. */
  11911. function isObject(value) {
  11912. var type = typeof value;
  11913. return value != null && (type == 'object' || type == 'function');
  11914. }
  11915. /**
  11916. * Checks if `value` is object-like. A value is object-like if it's not `null`
  11917. * and has a `typeof` result of "object".
  11918. *
  11919. * @static
  11920. * @memberOf _
  11921. * @since 4.0.0
  11922. * @category Lang
  11923. * @param {*} value The value to check.
  11924. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  11925. * @example
  11926. *
  11927. * _.isObjectLike({});
  11928. * // => true
  11929. *
  11930. * _.isObjectLike([1, 2, 3]);
  11931. * // => true
  11932. *
  11933. * _.isObjectLike(_.noop);
  11934. * // => false
  11935. *
  11936. * _.isObjectLike(null);
  11937. * // => false
  11938. */
  11939. function isObjectLike(value) {
  11940. return value != null && typeof value == 'object';
  11941. }
  11942. /**
  11943. * Checks if `value` is classified as a `Map` object.
  11944. *
  11945. * @static
  11946. * @memberOf _
  11947. * @since 4.3.0
  11948. * @category Lang
  11949. * @param {*} value The value to check.
  11950. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  11951. * @example
  11952. *
  11953. * _.isMap(new Map);
  11954. * // => true
  11955. *
  11956. * _.isMap(new WeakMap);
  11957. * // => false
  11958. */
  11959. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  11960. /**
  11961. * Performs a partial deep comparison between `object` and `source` to
  11962. * determine if `object` contains equivalent property values.
  11963. *
  11964. * **Note:** This method is equivalent to `_.matches` when `source` is
  11965. * partially applied.
  11966. *
  11967. * Partial comparisons will match empty array and empty object `source`
  11968. * values against any array or object value, respectively. See `_.isEqual`
  11969. * for a list of supported value comparisons.
  11970. *
  11971. * @static
  11972. * @memberOf _
  11973. * @since 3.0.0
  11974. * @category Lang
  11975. * @param {Object} object The object to inspect.
  11976. * @param {Object} source The object of property values to match.
  11977. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  11978. * @example
  11979. *
  11980. * var object = { 'a': 1, 'b': 2 };
  11981. *
  11982. * _.isMatch(object, { 'b': 2 });
  11983. * // => true
  11984. *
  11985. * _.isMatch(object, { 'b': 1 });
  11986. * // => false
  11987. */
  11988. function isMatch(object, source) {
  11989. return object === source || baseIsMatch(object, source, getMatchData(source));
  11990. }
  11991. /**
  11992. * This method is like `_.isMatch` except that it accepts `customizer` which
  11993. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  11994. * are handled by the method instead. The `customizer` is invoked with five
  11995. * arguments: (objValue, srcValue, index|key, object, source).
  11996. *
  11997. * @static
  11998. * @memberOf _
  11999. * @since 4.0.0
  12000. * @category Lang
  12001. * @param {Object} object The object to inspect.
  12002. * @param {Object} source The object of property values to match.
  12003. * @param {Function} [customizer] The function to customize comparisons.
  12004. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  12005. * @example
  12006. *
  12007. * function isGreeting(value) {
  12008. * return /^h(?:i|ello)$/.test(value);
  12009. * }
  12010. *
  12011. * function customizer(objValue, srcValue) {
  12012. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  12013. * return true;
  12014. * }
  12015. * }
  12016. *
  12017. * var object = { 'greeting': 'hello' };
  12018. * var source = { 'greeting': 'hi' };
  12019. *
  12020. * _.isMatchWith(object, source, customizer);
  12021. * // => true
  12022. */
  12023. function isMatchWith(object, source, customizer) {
  12024. customizer = typeof customizer == 'function' ? customizer : undefined;
  12025. return baseIsMatch(object, source, getMatchData(source), customizer);
  12026. }
  12027. /**
  12028. * Checks if `value` is `NaN`.
  12029. *
  12030. * **Note:** This method is based on
  12031. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  12032. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  12033. * `undefined` and other non-number values.
  12034. *
  12035. * @static
  12036. * @memberOf _
  12037. * @since 0.1.0
  12038. * @category Lang
  12039. * @param {*} value The value to check.
  12040. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  12041. * @example
  12042. *
  12043. * _.isNaN(NaN);
  12044. * // => true
  12045. *
  12046. * _.isNaN(new Number(NaN));
  12047. * // => true
  12048. *
  12049. * isNaN(undefined);
  12050. * // => true
  12051. *
  12052. * _.isNaN(undefined);
  12053. * // => false
  12054. */
  12055. function isNaN(value) {
  12056. // An `NaN` primitive is the only value that is not equal to itself.
  12057. // Perform the `toStringTag` check first to avoid errors with some
  12058. // ActiveX objects in IE.
  12059. return isNumber(value) && value != +value;
  12060. }
  12061. /**
  12062. * Checks if `value` is a pristine native function.
  12063. *
  12064. * **Note:** This method can't reliably detect native functions in the presence
  12065. * of the core-js package because core-js circumvents this kind of detection.
  12066. * Despite multiple requests, the core-js maintainer has made it clear: any
  12067. * attempt to fix the detection will be obstructed. As a result, we're left
  12068. * with little choice but to throw an error. Unfortunately, this also affects
  12069. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  12070. * which rely on core-js.
  12071. *
  12072. * @static
  12073. * @memberOf _
  12074. * @since 3.0.0
  12075. * @category Lang
  12076. * @param {*} value The value to check.
  12077. * @returns {boolean} Returns `true` if `value` is a native function,
  12078. * else `false`.
  12079. * @example
  12080. *
  12081. * _.isNative(Array.prototype.push);
  12082. * // => true
  12083. *
  12084. * _.isNative(_);
  12085. * // => false
  12086. */
  12087. function isNative(value) {
  12088. if (isMaskable(value)) {
  12089. throw new Error(CORE_ERROR_TEXT);
  12090. }
  12091. return baseIsNative(value);
  12092. }
  12093. /**
  12094. * Checks if `value` is `null`.
  12095. *
  12096. * @static
  12097. * @memberOf _
  12098. * @since 0.1.0
  12099. * @category Lang
  12100. * @param {*} value The value to check.
  12101. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  12102. * @example
  12103. *
  12104. * _.isNull(null);
  12105. * // => true
  12106. *
  12107. * _.isNull(void 0);
  12108. * // => false
  12109. */
  12110. function isNull(value) {
  12111. return value === null;
  12112. }
  12113. /**
  12114. * Checks if `value` is `null` or `undefined`.
  12115. *
  12116. * @static
  12117. * @memberOf _
  12118. * @since 4.0.0
  12119. * @category Lang
  12120. * @param {*} value The value to check.
  12121. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  12122. * @example
  12123. *
  12124. * _.isNil(null);
  12125. * // => true
  12126. *
  12127. * _.isNil(void 0);
  12128. * // => true
  12129. *
  12130. * _.isNil(NaN);
  12131. * // => false
  12132. */
  12133. function isNil(value) {
  12134. return value == null;
  12135. }
  12136. /**
  12137. * Checks if `value` is classified as a `Number` primitive or object.
  12138. *
  12139. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  12140. * classified as numbers, use the `_.isFinite` method.
  12141. *
  12142. * @static
  12143. * @memberOf _
  12144. * @since 0.1.0
  12145. * @category Lang
  12146. * @param {*} value The value to check.
  12147. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  12148. * @example
  12149. *
  12150. * _.isNumber(3);
  12151. * // => true
  12152. *
  12153. * _.isNumber(Number.MIN_VALUE);
  12154. * // => true
  12155. *
  12156. * _.isNumber(Infinity);
  12157. * // => true
  12158. *
  12159. * _.isNumber('3');
  12160. * // => false
  12161. */
  12162. function isNumber(value) {
  12163. return typeof value == 'number' ||
  12164. (isObjectLike(value) && baseGetTag(value) == numberTag);
  12165. }
  12166. /**
  12167. * Checks if `value` is a plain object, that is, an object created by the
  12168. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  12169. *
  12170. * @static
  12171. * @memberOf _
  12172. * @since 0.8.0
  12173. * @category Lang
  12174. * @param {*} value The value to check.
  12175. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  12176. * @example
  12177. *
  12178. * function Foo() {
  12179. * this.a = 1;
  12180. * }
  12181. *
  12182. * _.isPlainObject(new Foo);
  12183. * // => false
  12184. *
  12185. * _.isPlainObject([1, 2, 3]);
  12186. * // => false
  12187. *
  12188. * _.isPlainObject({ 'x': 0, 'y': 0 });
  12189. * // => true
  12190. *
  12191. * _.isPlainObject(Object.create(null));
  12192. * // => true
  12193. */
  12194. function isPlainObject(value) {
  12195. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  12196. return false;
  12197. }
  12198. var proto = getPrototype(value);
  12199. if (proto === null) {
  12200. return true;
  12201. }
  12202. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  12203. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  12204. funcToString.call(Ctor) == objectCtorString;
  12205. }
  12206. /**
  12207. * Checks if `value` is classified as a `RegExp` object.
  12208. *
  12209. * @static
  12210. * @memberOf _
  12211. * @since 0.1.0
  12212. * @category Lang
  12213. * @param {*} value The value to check.
  12214. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  12215. * @example
  12216. *
  12217. * _.isRegExp(/abc/);
  12218. * // => true
  12219. *
  12220. * _.isRegExp('/abc/');
  12221. * // => false
  12222. */
  12223. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  12224. /**
  12225. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  12226. * double precision number which isn't the result of a rounded unsafe integer.
  12227. *
  12228. * **Note:** This method is based on
  12229. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  12230. *
  12231. * @static
  12232. * @memberOf _
  12233. * @since 4.0.0
  12234. * @category Lang
  12235. * @param {*} value The value to check.
  12236. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  12237. * @example
  12238. *
  12239. * _.isSafeInteger(3);
  12240. * // => true
  12241. *
  12242. * _.isSafeInteger(Number.MIN_VALUE);
  12243. * // => false
  12244. *
  12245. * _.isSafeInteger(Infinity);
  12246. * // => false
  12247. *
  12248. * _.isSafeInteger('3');
  12249. * // => false
  12250. */
  12251. function isSafeInteger(value) {
  12252. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  12253. }
  12254. /**
  12255. * Checks if `value` is classified as a `Set` object.
  12256. *
  12257. * @static
  12258. * @memberOf _
  12259. * @since 4.3.0
  12260. * @category Lang
  12261. * @param {*} value The value to check.
  12262. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  12263. * @example
  12264. *
  12265. * _.isSet(new Set);
  12266. * // => true
  12267. *
  12268. * _.isSet(new WeakSet);
  12269. * // => false
  12270. */
  12271. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  12272. /**
  12273. * Checks if `value` is classified as a `String` primitive or object.
  12274. *
  12275. * @static
  12276. * @since 0.1.0
  12277. * @memberOf _
  12278. * @category Lang
  12279. * @param {*} value The value to check.
  12280. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  12281. * @example
  12282. *
  12283. * _.isString('abc');
  12284. * // => true
  12285. *
  12286. * _.isString(1);
  12287. * // => false
  12288. */
  12289. function isString(value) {
  12290. return typeof value == 'string' ||
  12291. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  12292. }
  12293. /**
  12294. * Checks if `value` is classified as a `Symbol` primitive or object.
  12295. *
  12296. * @static
  12297. * @memberOf _
  12298. * @since 4.0.0
  12299. * @category Lang
  12300. * @param {*} value The value to check.
  12301. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  12302. * @example
  12303. *
  12304. * _.isSymbol(Symbol.iterator);
  12305. * // => true
  12306. *
  12307. * _.isSymbol('abc');
  12308. * // => false
  12309. */
  12310. function isSymbol(value) {
  12311. return typeof value == 'symbol' ||
  12312. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  12313. }
  12314. /**
  12315. * Checks if `value` is classified as a typed array.
  12316. *
  12317. * @static
  12318. * @memberOf _
  12319. * @since 3.0.0
  12320. * @category Lang
  12321. * @param {*} value The value to check.
  12322. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  12323. * @example
  12324. *
  12325. * _.isTypedArray(new Uint8Array);
  12326. * // => true
  12327. *
  12328. * _.isTypedArray([]);
  12329. * // => false
  12330. */
  12331. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  12332. /**
  12333. * Checks if `value` is `undefined`.
  12334. *
  12335. * @static
  12336. * @since 0.1.0
  12337. * @memberOf _
  12338. * @category Lang
  12339. * @param {*} value The value to check.
  12340. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  12341. * @example
  12342. *
  12343. * _.isUndefined(void 0);
  12344. * // => true
  12345. *
  12346. * _.isUndefined(null);
  12347. * // => false
  12348. */
  12349. function isUndefined(value) {
  12350. return value === undefined;
  12351. }
  12352. /**
  12353. * Checks if `value` is classified as a `WeakMap` object.
  12354. *
  12355. * @static
  12356. * @memberOf _
  12357. * @since 4.3.0
  12358. * @category Lang
  12359. * @param {*} value The value to check.
  12360. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  12361. * @example
  12362. *
  12363. * _.isWeakMap(new WeakMap);
  12364. * // => true
  12365. *
  12366. * _.isWeakMap(new Map);
  12367. * // => false
  12368. */
  12369. function isWeakMap(value) {
  12370. return isObjectLike(value) && getTag(value) == weakMapTag;
  12371. }
  12372. /**
  12373. * Checks if `value` is classified as a `WeakSet` object.
  12374. *
  12375. * @static
  12376. * @memberOf _
  12377. * @since 4.3.0
  12378. * @category Lang
  12379. * @param {*} value The value to check.
  12380. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  12381. * @example
  12382. *
  12383. * _.isWeakSet(new WeakSet);
  12384. * // => true
  12385. *
  12386. * _.isWeakSet(new Set);
  12387. * // => false
  12388. */
  12389. function isWeakSet(value) {
  12390. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  12391. }
  12392. /**
  12393. * Checks if `value` is less than `other`.
  12394. *
  12395. * @static
  12396. * @memberOf _
  12397. * @since 3.9.0
  12398. * @category Lang
  12399. * @param {*} value The value to compare.
  12400. * @param {*} other The other value to compare.
  12401. * @returns {boolean} Returns `true` if `value` is less than `other`,
  12402. * else `false`.
  12403. * @see _.gt
  12404. * @example
  12405. *
  12406. * _.lt(1, 3);
  12407. * // => true
  12408. *
  12409. * _.lt(3, 3);
  12410. * // => false
  12411. *
  12412. * _.lt(3, 1);
  12413. * // => false
  12414. */
  12415. var lt = createRelationalOperation(baseLt);
  12416. /**
  12417. * Checks if `value` is less than or equal to `other`.
  12418. *
  12419. * @static
  12420. * @memberOf _
  12421. * @since 3.9.0
  12422. * @category Lang
  12423. * @param {*} value The value to compare.
  12424. * @param {*} other The other value to compare.
  12425. * @returns {boolean} Returns `true` if `value` is less than or equal to
  12426. * `other`, else `false`.
  12427. * @see _.gte
  12428. * @example
  12429. *
  12430. * _.lte(1, 3);
  12431. * // => true
  12432. *
  12433. * _.lte(3, 3);
  12434. * // => true
  12435. *
  12436. * _.lte(3, 1);
  12437. * // => false
  12438. */
  12439. var lte = createRelationalOperation(function(value, other) {
  12440. return value <= other;
  12441. });
  12442. /**
  12443. * Converts `value` to an array.
  12444. *
  12445. * @static
  12446. * @since 0.1.0
  12447. * @memberOf _
  12448. * @category Lang
  12449. * @param {*} value The value to convert.
  12450. * @returns {Array} Returns the converted array.
  12451. * @example
  12452. *
  12453. * _.toArray({ 'a': 1, 'b': 2 });
  12454. * // => [1, 2]
  12455. *
  12456. * _.toArray('abc');
  12457. * // => ['a', 'b', 'c']
  12458. *
  12459. * _.toArray(1);
  12460. * // => []
  12461. *
  12462. * _.toArray(null);
  12463. * // => []
  12464. */
  12465. function toArray(value) {
  12466. if (!value) {
  12467. return [];
  12468. }
  12469. if (isArrayLike(value)) {
  12470. return isString(value) ? stringToArray(value) : copyArray(value);
  12471. }
  12472. if (symIterator && value[symIterator]) {
  12473. return iteratorToArray(value[symIterator]());
  12474. }
  12475. var tag = getTag(value),
  12476. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  12477. return func(value);
  12478. }
  12479. /**
  12480. * Converts `value` to a finite number.
  12481. *
  12482. * @static
  12483. * @memberOf _
  12484. * @since 4.12.0
  12485. * @category Lang
  12486. * @param {*} value The value to convert.
  12487. * @returns {number} Returns the converted number.
  12488. * @example
  12489. *
  12490. * _.toFinite(3.2);
  12491. * // => 3.2
  12492. *
  12493. * _.toFinite(Number.MIN_VALUE);
  12494. * // => 5e-324
  12495. *
  12496. * _.toFinite(Infinity);
  12497. * // => 1.7976931348623157e+308
  12498. *
  12499. * _.toFinite('3.2');
  12500. * // => 3.2
  12501. */
  12502. function toFinite(value) {
  12503. if (!value) {
  12504. return value === 0 ? value : 0;
  12505. }
  12506. value = toNumber(value);
  12507. if (value === INFINITY || value === -INFINITY) {
  12508. var sign = (value < 0 ? -1 : 1);
  12509. return sign * MAX_INTEGER;
  12510. }
  12511. return value === value ? value : 0;
  12512. }
  12513. /**
  12514. * Converts `value` to an integer.
  12515. *
  12516. * **Note:** This method is loosely based on
  12517. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  12518. *
  12519. * @static
  12520. * @memberOf _
  12521. * @since 4.0.0
  12522. * @category Lang
  12523. * @param {*} value The value to convert.
  12524. * @returns {number} Returns the converted integer.
  12525. * @example
  12526. *
  12527. * _.toInteger(3.2);
  12528. * // => 3
  12529. *
  12530. * _.toInteger(Number.MIN_VALUE);
  12531. * // => 0
  12532. *
  12533. * _.toInteger(Infinity);
  12534. * // => 1.7976931348623157e+308
  12535. *
  12536. * _.toInteger('3.2');
  12537. * // => 3
  12538. */
  12539. function toInteger(value) {
  12540. var result = toFinite(value),
  12541. remainder = result % 1;
  12542. return result === result ? (remainder ? result - remainder : result) : 0;
  12543. }
  12544. /**
  12545. * Converts `value` to an integer suitable for use as the length of an
  12546. * array-like object.
  12547. *
  12548. * **Note:** This method is based on
  12549. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  12550. *
  12551. * @static
  12552. * @memberOf _
  12553. * @since 4.0.0
  12554. * @category Lang
  12555. * @param {*} value The value to convert.
  12556. * @returns {number} Returns the converted integer.
  12557. * @example
  12558. *
  12559. * _.toLength(3.2);
  12560. * // => 3
  12561. *
  12562. * _.toLength(Number.MIN_VALUE);
  12563. * // => 0
  12564. *
  12565. * _.toLength(Infinity);
  12566. * // => 4294967295
  12567. *
  12568. * _.toLength('3.2');
  12569. * // => 3
  12570. */
  12571. function toLength(value) {
  12572. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  12573. }
  12574. /**
  12575. * Converts `value` to a number.
  12576. *
  12577. * @static
  12578. * @memberOf _
  12579. * @since 4.0.0
  12580. * @category Lang
  12581. * @param {*} value The value to process.
  12582. * @returns {number} Returns the number.
  12583. * @example
  12584. *
  12585. * _.toNumber(3.2);
  12586. * // => 3.2
  12587. *
  12588. * _.toNumber(Number.MIN_VALUE);
  12589. * // => 5e-324
  12590. *
  12591. * _.toNumber(Infinity);
  12592. * // => Infinity
  12593. *
  12594. * _.toNumber('3.2');
  12595. * // => 3.2
  12596. */
  12597. function toNumber(value) {
  12598. if (typeof value == 'number') {
  12599. return value;
  12600. }
  12601. if (isSymbol(value)) {
  12602. return NAN;
  12603. }
  12604. if (isObject(value)) {
  12605. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  12606. value = isObject(other) ? (other + '') : other;
  12607. }
  12608. if (typeof value != 'string') {
  12609. return value === 0 ? value : +value;
  12610. }
  12611. value = baseTrim(value);
  12612. var isBinary = reIsBinary.test(value);
  12613. return (isBinary || reIsOctal.test(value))
  12614. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  12615. : (reIsBadHex.test(value) ? NAN : +value);
  12616. }
  12617. /**
  12618. * Converts `value` to a plain object flattening inherited enumerable string
  12619. * keyed properties of `value` to own properties of the plain object.
  12620. *
  12621. * @static
  12622. * @memberOf _
  12623. * @since 3.0.0
  12624. * @category Lang
  12625. * @param {*} value The value to convert.
  12626. * @returns {Object} Returns the converted plain object.
  12627. * @example
  12628. *
  12629. * function Foo() {
  12630. * this.b = 2;
  12631. * }
  12632. *
  12633. * Foo.prototype.c = 3;
  12634. *
  12635. * _.assign({ 'a': 1 }, new Foo);
  12636. * // => { 'a': 1, 'b': 2 }
  12637. *
  12638. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  12639. * // => { 'a': 1, 'b': 2, 'c': 3 }
  12640. */
  12641. function toPlainObject(value) {
  12642. return copyObject(value, keysIn(value));
  12643. }
  12644. /**
  12645. * Converts `value` to a safe integer. A safe integer can be compared and
  12646. * represented correctly.
  12647. *
  12648. * @static
  12649. * @memberOf _
  12650. * @since 4.0.0
  12651. * @category Lang
  12652. * @param {*} value The value to convert.
  12653. * @returns {number} Returns the converted integer.
  12654. * @example
  12655. *
  12656. * _.toSafeInteger(3.2);
  12657. * // => 3
  12658. *
  12659. * _.toSafeInteger(Number.MIN_VALUE);
  12660. * // => 0
  12661. *
  12662. * _.toSafeInteger(Infinity);
  12663. * // => 9007199254740991
  12664. *
  12665. * _.toSafeInteger('3.2');
  12666. * // => 3
  12667. */
  12668. function toSafeInteger(value) {
  12669. return value
  12670. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  12671. : (value === 0 ? value : 0);
  12672. }
  12673. /**
  12674. * Converts `value` to a string. An empty string is returned for `null`
  12675. * and `undefined` values. The sign of `-0` is preserved.
  12676. *
  12677. * @static
  12678. * @memberOf _
  12679. * @since 4.0.0
  12680. * @category Lang
  12681. * @param {*} value The value to convert.
  12682. * @returns {string} Returns the converted string.
  12683. * @example
  12684. *
  12685. * _.toString(null);
  12686. * // => ''
  12687. *
  12688. * _.toString(-0);
  12689. * // => '-0'
  12690. *
  12691. * _.toString([1, 2, 3]);
  12692. * // => '1,2,3'
  12693. */
  12694. function toString(value) {
  12695. return value == null ? '' : baseToString(value);
  12696. }
  12697. /*------------------------------------------------------------------------*/
  12698. /**
  12699. * Assigns own enumerable string keyed properties of source objects to the
  12700. * destination object. Source objects are applied from left to right.
  12701. * Subsequent sources overwrite property assignments of previous sources.
  12702. *
  12703. * **Note:** This method mutates `object` and is loosely based on
  12704. * [`Object.assign`](https://mdn.io/Object/assign).
  12705. *
  12706. * @static
  12707. * @memberOf _
  12708. * @since 0.10.0
  12709. * @category Object
  12710. * @param {Object} object The destination object.
  12711. * @param {...Object} [sources] The source objects.
  12712. * @returns {Object} Returns `object`.
  12713. * @see _.assignIn
  12714. * @example
  12715. *
  12716. * function Foo() {
  12717. * this.a = 1;
  12718. * }
  12719. *
  12720. * function Bar() {
  12721. * this.c = 3;
  12722. * }
  12723. *
  12724. * Foo.prototype.b = 2;
  12725. * Bar.prototype.d = 4;
  12726. *
  12727. * _.assign({ 'a': 0 }, new Foo, new Bar);
  12728. * // => { 'a': 1, 'c': 3 }
  12729. */
  12730. var assign = createAssigner(function(object, source) {
  12731. if (isPrototype(source) || isArrayLike(source)) {
  12732. copyObject(source, keys(source), object);
  12733. return;
  12734. }
  12735. for (var key in source) {
  12736. if (hasOwnProperty.call(source, key)) {
  12737. assignValue(object, key, source[key]);
  12738. }
  12739. }
  12740. });
  12741. /**
  12742. * This method is like `_.assign` except that it iterates over own and
  12743. * inherited source properties.
  12744. *
  12745. * **Note:** This method mutates `object`.
  12746. *
  12747. * @static
  12748. * @memberOf _
  12749. * @since 4.0.0
  12750. * @alias extend
  12751. * @category Object
  12752. * @param {Object} object The destination object.
  12753. * @param {...Object} [sources] The source objects.
  12754. * @returns {Object} Returns `object`.
  12755. * @see _.assign
  12756. * @example
  12757. *
  12758. * function Foo() {
  12759. * this.a = 1;
  12760. * }
  12761. *
  12762. * function Bar() {
  12763. * this.c = 3;
  12764. * }
  12765. *
  12766. * Foo.prototype.b = 2;
  12767. * Bar.prototype.d = 4;
  12768. *
  12769. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  12770. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  12771. */
  12772. var assignIn = createAssigner(function(object, source) {
  12773. copyObject(source, keysIn(source), object);
  12774. });
  12775. /**
  12776. * This method is like `_.assignIn` except that it accepts `customizer`
  12777. * which is invoked to produce the assigned values. If `customizer` returns
  12778. * `undefined`, assignment is handled by the method instead. The `customizer`
  12779. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  12780. *
  12781. * **Note:** This method mutates `object`.
  12782. *
  12783. * @static
  12784. * @memberOf _
  12785. * @since 4.0.0
  12786. * @alias extendWith
  12787. * @category Object
  12788. * @param {Object} object The destination object.
  12789. * @param {...Object} sources The source objects.
  12790. * @param {Function} [customizer] The function to customize assigned values.
  12791. * @returns {Object} Returns `object`.
  12792. * @see _.assignWith
  12793. * @example
  12794. *
  12795. * function customizer(objValue, srcValue) {
  12796. * return _.isUndefined(objValue) ? srcValue : objValue;
  12797. * }
  12798. *
  12799. * var defaults = _.partialRight(_.assignInWith, customizer);
  12800. *
  12801. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  12802. * // => { 'a': 1, 'b': 2 }
  12803. */
  12804. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  12805. copyObject(source, keysIn(source), object, customizer);
  12806. });
  12807. /**
  12808. * This method is like `_.assign` except that it accepts `customizer`
  12809. * which is invoked to produce the assigned values. If `customizer` returns
  12810. * `undefined`, assignment is handled by the method instead. The `customizer`
  12811. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  12812. *
  12813. * **Note:** This method mutates `object`.
  12814. *
  12815. * @static
  12816. * @memberOf _
  12817. * @since 4.0.0
  12818. * @category Object
  12819. * @param {Object} object The destination object.
  12820. * @param {...Object} sources The source objects.
  12821. * @param {Function} [customizer] The function to customize assigned values.
  12822. * @returns {Object} Returns `object`.
  12823. * @see _.assignInWith
  12824. * @example
  12825. *
  12826. * function customizer(objValue, srcValue) {
  12827. * return _.isUndefined(objValue) ? srcValue : objValue;
  12828. * }
  12829. *
  12830. * var defaults = _.partialRight(_.assignWith, customizer);
  12831. *
  12832. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  12833. * // => { 'a': 1, 'b': 2 }
  12834. */
  12835. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  12836. copyObject(source, keys(source), object, customizer);
  12837. });
  12838. /**
  12839. * Creates an array of values corresponding to `paths` of `object`.
  12840. *
  12841. * @static
  12842. * @memberOf _
  12843. * @since 1.0.0
  12844. * @category Object
  12845. * @param {Object} object The object to iterate over.
  12846. * @param {...(string|string[])} [paths] The property paths to pick.
  12847. * @returns {Array} Returns the picked values.
  12848. * @example
  12849. *
  12850. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  12851. *
  12852. * _.at(object, ['a[0].b.c', 'a[1]']);
  12853. * // => [3, 4]
  12854. */
  12855. var at = flatRest(baseAt);
  12856. /**
  12857. * Creates an object that inherits from the `prototype` object. If a
  12858. * `properties` object is given, its own enumerable string keyed properties
  12859. * are assigned to the created object.
  12860. *
  12861. * @static
  12862. * @memberOf _
  12863. * @since 2.3.0
  12864. * @category Object
  12865. * @param {Object} prototype The object to inherit from.
  12866. * @param {Object} [properties] The properties to assign to the object.
  12867. * @returns {Object} Returns the new object.
  12868. * @example
  12869. *
  12870. * function Shape() {
  12871. * this.x = 0;
  12872. * this.y = 0;
  12873. * }
  12874. *
  12875. * function Circle() {
  12876. * Shape.call(this);
  12877. * }
  12878. *
  12879. * Circle.prototype = _.create(Shape.prototype, {
  12880. * 'constructor': Circle
  12881. * });
  12882. *
  12883. * var circle = new Circle;
  12884. * circle instanceof Circle;
  12885. * // => true
  12886. *
  12887. * circle instanceof Shape;
  12888. * // => true
  12889. */
  12890. function create(prototype, properties) {
  12891. var result = baseCreate(prototype);
  12892. return properties == null ? result : baseAssign(result, properties);
  12893. }
  12894. /**
  12895. * Assigns own and inherited enumerable string keyed properties of source
  12896. * objects to the destination object for all destination properties that
  12897. * resolve to `undefined`. Source objects are applied from left to right.
  12898. * Once a property is set, additional values of the same property are ignored.
  12899. *
  12900. * **Note:** This method mutates `object`.
  12901. *
  12902. * @static
  12903. * @since 0.1.0
  12904. * @memberOf _
  12905. * @category Object
  12906. * @param {Object} object The destination object.
  12907. * @param {...Object} [sources] The source objects.
  12908. * @returns {Object} Returns `object`.
  12909. * @see _.defaultsDeep
  12910. * @example
  12911. *
  12912. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  12913. * // => { 'a': 1, 'b': 2 }
  12914. */
  12915. var defaults = baseRest(function(object, sources) {
  12916. object = Object(object);
  12917. var index = -1;
  12918. var length = sources.length;
  12919. var guard = length > 2 ? sources[2] : undefined;
  12920. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  12921. length = 1;
  12922. }
  12923. while (++index < length) {
  12924. var source = sources[index];
  12925. var props = keysIn(source);
  12926. var propsIndex = -1;
  12927. var propsLength = props.length;
  12928. while (++propsIndex < propsLength) {
  12929. var key = props[propsIndex];
  12930. var value = object[key];
  12931. if (value === undefined ||
  12932. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  12933. object[key] = source[key];
  12934. }
  12935. }
  12936. }
  12937. return object;
  12938. });
  12939. /**
  12940. * This method is like `_.defaults` except that it recursively assigns
  12941. * default properties.
  12942. *
  12943. * **Note:** This method mutates `object`.
  12944. *
  12945. * @static
  12946. * @memberOf _
  12947. * @since 3.10.0
  12948. * @category Object
  12949. * @param {Object} object The destination object.
  12950. * @param {...Object} [sources] The source objects.
  12951. * @returns {Object} Returns `object`.
  12952. * @see _.defaults
  12953. * @example
  12954. *
  12955. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  12956. * // => { 'a': { 'b': 2, 'c': 3 } }
  12957. */
  12958. var defaultsDeep = baseRest(function(args) {
  12959. args.push(undefined, customDefaultsMerge);
  12960. return apply(mergeWith, undefined, args);
  12961. });
  12962. /**
  12963. * This method is like `_.find` except that it returns the key of the first
  12964. * element `predicate` returns truthy for instead of the element itself.
  12965. *
  12966. * @static
  12967. * @memberOf _
  12968. * @since 1.1.0
  12969. * @category Object
  12970. * @param {Object} object The object to inspect.
  12971. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  12972. * @returns {string|undefined} Returns the key of the matched element,
  12973. * else `undefined`.
  12974. * @example
  12975. *
  12976. * var users = {
  12977. * 'barney': { 'age': 36, 'active': true },
  12978. * 'fred': { 'age': 40, 'active': false },
  12979. * 'pebbles': { 'age': 1, 'active': true }
  12980. * };
  12981. *
  12982. * _.findKey(users, function(o) { return o.age < 40; });
  12983. * // => 'barney' (iteration order is not guaranteed)
  12984. *
  12985. * // The `_.matches` iteratee shorthand.
  12986. * _.findKey(users, { 'age': 1, 'active': true });
  12987. * // => 'pebbles'
  12988. *
  12989. * // The `_.matchesProperty` iteratee shorthand.
  12990. * _.findKey(users, ['active', false]);
  12991. * // => 'fred'
  12992. *
  12993. * // The `_.property` iteratee shorthand.
  12994. * _.findKey(users, 'active');
  12995. * // => 'barney'
  12996. */
  12997. function findKey(object, predicate) {
  12998. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  12999. }
  13000. /**
  13001. * This method is like `_.findKey` except that it iterates over elements of
  13002. * a collection in the opposite order.
  13003. *
  13004. * @static
  13005. * @memberOf _
  13006. * @since 2.0.0
  13007. * @category Object
  13008. * @param {Object} object The object to inspect.
  13009. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  13010. * @returns {string|undefined} Returns the key of the matched element,
  13011. * else `undefined`.
  13012. * @example
  13013. *
  13014. * var users = {
  13015. * 'barney': { 'age': 36, 'active': true },
  13016. * 'fred': { 'age': 40, 'active': false },
  13017. * 'pebbles': { 'age': 1, 'active': true }
  13018. * };
  13019. *
  13020. * _.findLastKey(users, function(o) { return o.age < 40; });
  13021. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  13022. *
  13023. * // The `_.matches` iteratee shorthand.
  13024. * _.findLastKey(users, { 'age': 36, 'active': true });
  13025. * // => 'barney'
  13026. *
  13027. * // The `_.matchesProperty` iteratee shorthand.
  13028. * _.findLastKey(users, ['active', false]);
  13029. * // => 'fred'
  13030. *
  13031. * // The `_.property` iteratee shorthand.
  13032. * _.findLastKey(users, 'active');
  13033. * // => 'pebbles'
  13034. */
  13035. function findLastKey(object, predicate) {
  13036. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  13037. }
  13038. /**
  13039. * Iterates over own and inherited enumerable string keyed properties of an
  13040. * object and invokes `iteratee` for each property. The iteratee is invoked
  13041. * with three arguments: (value, key, object). Iteratee functions may exit
  13042. * iteration early by explicitly returning `false`.
  13043. *
  13044. * @static
  13045. * @memberOf _
  13046. * @since 0.3.0
  13047. * @category Object
  13048. * @param {Object} object The object to iterate over.
  13049. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13050. * @returns {Object} Returns `object`.
  13051. * @see _.forInRight
  13052. * @example
  13053. *
  13054. * function Foo() {
  13055. * this.a = 1;
  13056. * this.b = 2;
  13057. * }
  13058. *
  13059. * Foo.prototype.c = 3;
  13060. *
  13061. * _.forIn(new Foo, function(value, key) {
  13062. * console.log(key);
  13063. * });
  13064. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  13065. */
  13066. function forIn(object, iteratee) {
  13067. return object == null
  13068. ? object
  13069. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  13070. }
  13071. /**
  13072. * This method is like `_.forIn` except that it iterates over properties of
  13073. * `object` in the opposite order.
  13074. *
  13075. * @static
  13076. * @memberOf _
  13077. * @since 2.0.0
  13078. * @category Object
  13079. * @param {Object} object The object to iterate over.
  13080. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13081. * @returns {Object} Returns `object`.
  13082. * @see _.forIn
  13083. * @example
  13084. *
  13085. * function Foo() {
  13086. * this.a = 1;
  13087. * this.b = 2;
  13088. * }
  13089. *
  13090. * Foo.prototype.c = 3;
  13091. *
  13092. * _.forInRight(new Foo, function(value, key) {
  13093. * console.log(key);
  13094. * });
  13095. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  13096. */
  13097. function forInRight(object, iteratee) {
  13098. return object == null
  13099. ? object
  13100. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  13101. }
  13102. /**
  13103. * Iterates over own enumerable string keyed properties of an object and
  13104. * invokes `iteratee` for each property. The iteratee is invoked with three
  13105. * arguments: (value, key, object). Iteratee functions may exit iteration
  13106. * early by explicitly returning `false`.
  13107. *
  13108. * @static
  13109. * @memberOf _
  13110. * @since 0.3.0
  13111. * @category Object
  13112. * @param {Object} object The object to iterate over.
  13113. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13114. * @returns {Object} Returns `object`.
  13115. * @see _.forOwnRight
  13116. * @example
  13117. *
  13118. * function Foo() {
  13119. * this.a = 1;
  13120. * this.b = 2;
  13121. * }
  13122. *
  13123. * Foo.prototype.c = 3;
  13124. *
  13125. * _.forOwn(new Foo, function(value, key) {
  13126. * console.log(key);
  13127. * });
  13128. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  13129. */
  13130. function forOwn(object, iteratee) {
  13131. return object && baseForOwn(object, getIteratee(iteratee, 3));
  13132. }
  13133. /**
  13134. * This method is like `_.forOwn` except that it iterates over properties of
  13135. * `object` in the opposite order.
  13136. *
  13137. * @static
  13138. * @memberOf _
  13139. * @since 2.0.0
  13140. * @category Object
  13141. * @param {Object} object The object to iterate over.
  13142. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13143. * @returns {Object} Returns `object`.
  13144. * @see _.forOwn
  13145. * @example
  13146. *
  13147. * function Foo() {
  13148. * this.a = 1;
  13149. * this.b = 2;
  13150. * }
  13151. *
  13152. * Foo.prototype.c = 3;
  13153. *
  13154. * _.forOwnRight(new Foo, function(value, key) {
  13155. * console.log(key);
  13156. * });
  13157. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  13158. */
  13159. function forOwnRight(object, iteratee) {
  13160. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  13161. }
  13162. /**
  13163. * Creates an array of function property names from own enumerable properties
  13164. * of `object`.
  13165. *
  13166. * @static
  13167. * @since 0.1.0
  13168. * @memberOf _
  13169. * @category Object
  13170. * @param {Object} object The object to inspect.
  13171. * @returns {Array} Returns the function names.
  13172. * @see _.functionsIn
  13173. * @example
  13174. *
  13175. * function Foo() {
  13176. * this.a = _.constant('a');
  13177. * this.b = _.constant('b');
  13178. * }
  13179. *
  13180. * Foo.prototype.c = _.constant('c');
  13181. *
  13182. * _.functions(new Foo);
  13183. * // => ['a', 'b']
  13184. */
  13185. function functions(object) {
  13186. return object == null ? [] : baseFunctions(object, keys(object));
  13187. }
  13188. /**
  13189. * Creates an array of function property names from own and inherited
  13190. * enumerable properties of `object`.
  13191. *
  13192. * @static
  13193. * @memberOf _
  13194. * @since 4.0.0
  13195. * @category Object
  13196. * @param {Object} object The object to inspect.
  13197. * @returns {Array} Returns the function names.
  13198. * @see _.functions
  13199. * @example
  13200. *
  13201. * function Foo() {
  13202. * this.a = _.constant('a');
  13203. * this.b = _.constant('b');
  13204. * }
  13205. *
  13206. * Foo.prototype.c = _.constant('c');
  13207. *
  13208. * _.functionsIn(new Foo);
  13209. * // => ['a', 'b', 'c']
  13210. */
  13211. function functionsIn(object) {
  13212. return object == null ? [] : baseFunctions(object, keysIn(object));
  13213. }
  13214. /**
  13215. * Gets the value at `path` of `object`. If the resolved value is
  13216. * `undefined`, the `defaultValue` is returned in its place.
  13217. *
  13218. * @static
  13219. * @memberOf _
  13220. * @since 3.7.0
  13221. * @category Object
  13222. * @param {Object} object The object to query.
  13223. * @param {Array|string} path The path of the property to get.
  13224. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  13225. * @returns {*} Returns the resolved value.
  13226. * @example
  13227. *
  13228. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  13229. *
  13230. * _.get(object, 'a[0].b.c');
  13231. * // => 3
  13232. *
  13233. * _.get(object, ['a', '0', 'b', 'c']);
  13234. * // => 3
  13235. *
  13236. * _.get(object, 'a.b.c', 'default');
  13237. * // => 'default'
  13238. */
  13239. function get(object, path, defaultValue) {
  13240. var result = object == null ? undefined : baseGet(object, path);
  13241. return result === undefined ? defaultValue : result;
  13242. }
  13243. /**
  13244. * Checks if `path` is a direct property of `object`.
  13245. *
  13246. * @static
  13247. * @since 0.1.0
  13248. * @memberOf _
  13249. * @category Object
  13250. * @param {Object} object The object to query.
  13251. * @param {Array|string} path The path to check.
  13252. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  13253. * @example
  13254. *
  13255. * var object = { 'a': { 'b': 2 } };
  13256. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  13257. *
  13258. * _.has(object, 'a');
  13259. * // => true
  13260. *
  13261. * _.has(object, 'a.b');
  13262. * // => true
  13263. *
  13264. * _.has(object, ['a', 'b']);
  13265. * // => true
  13266. *
  13267. * _.has(other, 'a');
  13268. * // => false
  13269. */
  13270. function has(object, path) {
  13271. return object != null && hasPath(object, path, baseHas);
  13272. }
  13273. /**
  13274. * Checks if `path` is a direct or inherited property of `object`.
  13275. *
  13276. * @static
  13277. * @memberOf _
  13278. * @since 4.0.0
  13279. * @category Object
  13280. * @param {Object} object The object to query.
  13281. * @param {Array|string} path The path to check.
  13282. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  13283. * @example
  13284. *
  13285. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  13286. *
  13287. * _.hasIn(object, 'a');
  13288. * // => true
  13289. *
  13290. * _.hasIn(object, 'a.b');
  13291. * // => true
  13292. *
  13293. * _.hasIn(object, ['a', 'b']);
  13294. * // => true
  13295. *
  13296. * _.hasIn(object, 'b');
  13297. * // => false
  13298. */
  13299. function hasIn(object, path) {
  13300. return object != null && hasPath(object, path, baseHasIn);
  13301. }
  13302. /**
  13303. * Creates an object composed of the inverted keys and values of `object`.
  13304. * If `object` contains duplicate values, subsequent values overwrite
  13305. * property assignments of previous values.
  13306. *
  13307. * @static
  13308. * @memberOf _
  13309. * @since 0.7.0
  13310. * @category Object
  13311. * @param {Object} object The object to invert.
  13312. * @returns {Object} Returns the new inverted object.
  13313. * @example
  13314. *
  13315. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  13316. *
  13317. * _.invert(object);
  13318. * // => { '1': 'c', '2': 'b' }
  13319. */
  13320. var invert = createInverter(function(result, value, key) {
  13321. if (value != null &&
  13322. typeof value.toString != 'function') {
  13323. value = nativeObjectToString.call(value);
  13324. }
  13325. result[value] = key;
  13326. }, constant(identity));
  13327. /**
  13328. * This method is like `_.invert` except that the inverted object is generated
  13329. * from the results of running each element of `object` thru `iteratee`. The
  13330. * corresponding inverted value of each inverted key is an array of keys
  13331. * responsible for generating the inverted value. The iteratee is invoked
  13332. * with one argument: (value).
  13333. *
  13334. * @static
  13335. * @memberOf _
  13336. * @since 4.1.0
  13337. * @category Object
  13338. * @param {Object} object The object to invert.
  13339. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  13340. * @returns {Object} Returns the new inverted object.
  13341. * @example
  13342. *
  13343. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  13344. *
  13345. * _.invertBy(object);
  13346. * // => { '1': ['a', 'c'], '2': ['b'] }
  13347. *
  13348. * _.invertBy(object, function(value) {
  13349. * return 'group' + value;
  13350. * });
  13351. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  13352. */
  13353. var invertBy = createInverter(function(result, value, key) {
  13354. if (value != null &&
  13355. typeof value.toString != 'function') {
  13356. value = nativeObjectToString.call(value);
  13357. }
  13358. if (hasOwnProperty.call(result, value)) {
  13359. result[value].push(key);
  13360. } else {
  13361. result[value] = [key];
  13362. }
  13363. }, getIteratee);
  13364. /**
  13365. * Invokes the method at `path` of `object`.
  13366. *
  13367. * @static
  13368. * @memberOf _
  13369. * @since 4.0.0
  13370. * @category Object
  13371. * @param {Object} object The object to query.
  13372. * @param {Array|string} path The path of the method to invoke.
  13373. * @param {...*} [args] The arguments to invoke the method with.
  13374. * @returns {*} Returns the result of the invoked method.
  13375. * @example
  13376. *
  13377. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  13378. *
  13379. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  13380. * // => [2, 3]
  13381. */
  13382. var invoke = baseRest(baseInvoke);
  13383. /**
  13384. * Creates an array of the own enumerable property names of `object`.
  13385. *
  13386. * **Note:** Non-object values are coerced to objects. See the
  13387. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  13388. * for more details.
  13389. *
  13390. * @static
  13391. * @since 0.1.0
  13392. * @memberOf _
  13393. * @category Object
  13394. * @param {Object} object The object to query.
  13395. * @returns {Array} Returns the array of property names.
  13396. * @example
  13397. *
  13398. * function Foo() {
  13399. * this.a = 1;
  13400. * this.b = 2;
  13401. * }
  13402. *
  13403. * Foo.prototype.c = 3;
  13404. *
  13405. * _.keys(new Foo);
  13406. * // => ['a', 'b'] (iteration order is not guaranteed)
  13407. *
  13408. * _.keys('hi');
  13409. * // => ['0', '1']
  13410. */
  13411. function keys(object) {
  13412. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  13413. }
  13414. /**
  13415. * Creates an array of the own and inherited enumerable property names of `object`.
  13416. *
  13417. * **Note:** Non-object values are coerced to objects.
  13418. *
  13419. * @static
  13420. * @memberOf _
  13421. * @since 3.0.0
  13422. * @category Object
  13423. * @param {Object} object The object to query.
  13424. * @returns {Array} Returns the array of property names.
  13425. * @example
  13426. *
  13427. * function Foo() {
  13428. * this.a = 1;
  13429. * this.b = 2;
  13430. * }
  13431. *
  13432. * Foo.prototype.c = 3;
  13433. *
  13434. * _.keysIn(new Foo);
  13435. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  13436. */
  13437. function keysIn(object) {
  13438. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  13439. }
  13440. /**
  13441. * The opposite of `_.mapValues`; this method creates an object with the
  13442. * same values as `object` and keys generated by running each own enumerable
  13443. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  13444. * with three arguments: (value, key, object).
  13445. *
  13446. * @static
  13447. * @memberOf _
  13448. * @since 3.8.0
  13449. * @category Object
  13450. * @param {Object} object The object to iterate over.
  13451. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13452. * @returns {Object} Returns the new mapped object.
  13453. * @see _.mapValues
  13454. * @example
  13455. *
  13456. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  13457. * return key + value;
  13458. * });
  13459. * // => { 'a1': 1, 'b2': 2 }
  13460. */
  13461. function mapKeys(object, iteratee) {
  13462. var result = {};
  13463. iteratee = getIteratee(iteratee, 3);
  13464. baseForOwn(object, function(value, key, object) {
  13465. baseAssignValue(result, iteratee(value, key, object), value);
  13466. });
  13467. return result;
  13468. }
  13469. /**
  13470. * Creates an object with the same keys as `object` and values generated
  13471. * by running each own enumerable string keyed property of `object` thru
  13472. * `iteratee`. The iteratee is invoked with three arguments:
  13473. * (value, key, object).
  13474. *
  13475. * @static
  13476. * @memberOf _
  13477. * @since 2.4.0
  13478. * @category Object
  13479. * @param {Object} object The object to iterate over.
  13480. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13481. * @returns {Object} Returns the new mapped object.
  13482. * @see _.mapKeys
  13483. * @example
  13484. *
  13485. * var users = {
  13486. * 'fred': { 'user': 'fred', 'age': 40 },
  13487. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  13488. * };
  13489. *
  13490. * _.mapValues(users, function(o) { return o.age; });
  13491. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  13492. *
  13493. * // The `_.property` iteratee shorthand.
  13494. * _.mapValues(users, 'age');
  13495. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  13496. */
  13497. function mapValues(object, iteratee) {
  13498. var result = {};
  13499. iteratee = getIteratee(iteratee, 3);
  13500. baseForOwn(object, function(value, key, object) {
  13501. baseAssignValue(result, key, iteratee(value, key, object));
  13502. });
  13503. return result;
  13504. }
  13505. /**
  13506. * This method is like `_.assign` except that it recursively merges own and
  13507. * inherited enumerable string keyed properties of source objects into the
  13508. * destination object. Source properties that resolve to `undefined` are
  13509. * skipped if a destination value exists. Array and plain object properties
  13510. * are merged recursively. Other objects and value types are overridden by
  13511. * assignment. Source objects are applied from left to right. Subsequent
  13512. * sources overwrite property assignments of previous sources.
  13513. *
  13514. * **Note:** This method mutates `object`.
  13515. *
  13516. * @static
  13517. * @memberOf _
  13518. * @since 0.5.0
  13519. * @category Object
  13520. * @param {Object} object The destination object.
  13521. * @param {...Object} [sources] The source objects.
  13522. * @returns {Object} Returns `object`.
  13523. * @example
  13524. *
  13525. * var object = {
  13526. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  13527. * };
  13528. *
  13529. * var other = {
  13530. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  13531. * };
  13532. *
  13533. * _.merge(object, other);
  13534. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  13535. */
  13536. var merge = createAssigner(function(object, source, srcIndex) {
  13537. baseMerge(object, source, srcIndex);
  13538. });
  13539. /**
  13540. * This method is like `_.merge` except that it accepts `customizer` which
  13541. * is invoked to produce the merged values of the destination and source
  13542. * properties. If `customizer` returns `undefined`, merging is handled by the
  13543. * method instead. The `customizer` is invoked with six arguments:
  13544. * (objValue, srcValue, key, object, source, stack).
  13545. *
  13546. * **Note:** This method mutates `object`.
  13547. *
  13548. * @static
  13549. * @memberOf _
  13550. * @since 4.0.0
  13551. * @category Object
  13552. * @param {Object} object The destination object.
  13553. * @param {...Object} sources The source objects.
  13554. * @param {Function} customizer The function to customize assigned values.
  13555. * @returns {Object} Returns `object`.
  13556. * @example
  13557. *
  13558. * function customizer(objValue, srcValue) {
  13559. * if (_.isArray(objValue)) {
  13560. * return objValue.concat(srcValue);
  13561. * }
  13562. * }
  13563. *
  13564. * var object = { 'a': [1], 'b': [2] };
  13565. * var other = { 'a': [3], 'b': [4] };
  13566. *
  13567. * _.mergeWith(object, other, customizer);
  13568. * // => { 'a': [1, 3], 'b': [2, 4] }
  13569. */
  13570. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  13571. baseMerge(object, source, srcIndex, customizer);
  13572. });
  13573. /**
  13574. * The opposite of `_.pick`; this method creates an object composed of the
  13575. * own and inherited enumerable property paths of `object` that are not omitted.
  13576. *
  13577. * **Note:** This method is considerably slower than `_.pick`.
  13578. *
  13579. * @static
  13580. * @since 0.1.0
  13581. * @memberOf _
  13582. * @category Object
  13583. * @param {Object} object The source object.
  13584. * @param {...(string|string[])} [paths] The property paths to omit.
  13585. * @returns {Object} Returns the new object.
  13586. * @example
  13587. *
  13588. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13589. *
  13590. * _.omit(object, ['a', 'c']);
  13591. * // => { 'b': '2' }
  13592. */
  13593. var omit = flatRest(function(object, paths) {
  13594. var result = {};
  13595. if (object == null) {
  13596. return result;
  13597. }
  13598. var isDeep = false;
  13599. paths = arrayMap(paths, function(path) {
  13600. path = castPath(path, object);
  13601. isDeep || (isDeep = path.length > 1);
  13602. return path;
  13603. });
  13604. copyObject(object, getAllKeysIn(object), result);
  13605. if (isDeep) {
  13606. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  13607. }
  13608. var length = paths.length;
  13609. while (length--) {
  13610. baseUnset(result, paths[length]);
  13611. }
  13612. return result;
  13613. });
  13614. /**
  13615. * The opposite of `_.pickBy`; this method creates an object composed of
  13616. * the own and inherited enumerable string keyed properties of `object` that
  13617. * `predicate` doesn't return truthy for. The predicate is invoked with two
  13618. * arguments: (value, key).
  13619. *
  13620. * @static
  13621. * @memberOf _
  13622. * @since 4.0.0
  13623. * @category Object
  13624. * @param {Object} object The source object.
  13625. * @param {Function} [predicate=_.identity] The function invoked per property.
  13626. * @returns {Object} Returns the new object.
  13627. * @example
  13628. *
  13629. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13630. *
  13631. * _.omitBy(object, _.isNumber);
  13632. * // => { 'b': '2' }
  13633. */
  13634. function omitBy(object, predicate) {
  13635. return pickBy(object, negate(getIteratee(predicate)));
  13636. }
  13637. /**
  13638. * Creates an object composed of the picked `object` properties.
  13639. *
  13640. * @static
  13641. * @since 0.1.0
  13642. * @memberOf _
  13643. * @category Object
  13644. * @param {Object} object The source object.
  13645. * @param {...(string|string[])} [paths] The property paths to pick.
  13646. * @returns {Object} Returns the new object.
  13647. * @example
  13648. *
  13649. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13650. *
  13651. * _.pick(object, ['a', 'c']);
  13652. * // => { 'a': 1, 'c': 3 }
  13653. */
  13654. var pick = flatRest(function(object, paths) {
  13655. return object == null ? {} : basePick(object, paths);
  13656. });
  13657. /**
  13658. * Creates an object composed of the `object` properties `predicate` returns
  13659. * truthy for. The predicate is invoked with two arguments: (value, key).
  13660. *
  13661. * @static
  13662. * @memberOf _
  13663. * @since 4.0.0
  13664. * @category Object
  13665. * @param {Object} object The source object.
  13666. * @param {Function} [predicate=_.identity] The function invoked per property.
  13667. * @returns {Object} Returns the new object.
  13668. * @example
  13669. *
  13670. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  13671. *
  13672. * _.pickBy(object, _.isNumber);
  13673. * // => { 'a': 1, 'c': 3 }
  13674. */
  13675. function pickBy(object, predicate) {
  13676. if (object == null) {
  13677. return {};
  13678. }
  13679. var props = arrayMap(getAllKeysIn(object), function(prop) {
  13680. return [prop];
  13681. });
  13682. predicate = getIteratee(predicate);
  13683. return basePickBy(object, props, function(value, path) {
  13684. return predicate(value, path[0]);
  13685. });
  13686. }
  13687. /**
  13688. * This method is like `_.get` except that if the resolved value is a
  13689. * function it's invoked with the `this` binding of its parent object and
  13690. * its result is returned.
  13691. *
  13692. * @static
  13693. * @since 0.1.0
  13694. * @memberOf _
  13695. * @category Object
  13696. * @param {Object} object The object to query.
  13697. * @param {Array|string} path The path of the property to resolve.
  13698. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  13699. * @returns {*} Returns the resolved value.
  13700. * @example
  13701. *
  13702. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  13703. *
  13704. * _.result(object, 'a[0].b.c1');
  13705. * // => 3
  13706. *
  13707. * _.result(object, 'a[0].b.c2');
  13708. * // => 4
  13709. *
  13710. * _.result(object, 'a[0].b.c3', 'default');
  13711. * // => 'default'
  13712. *
  13713. * _.result(object, 'a[0].b.c3', _.constant('default'));
  13714. * // => 'default'
  13715. */
  13716. function result(object, path, defaultValue) {
  13717. path = castPath(path, object);
  13718. var index = -1,
  13719. length = path.length;
  13720. // Ensure the loop is entered when path is empty.
  13721. if (!length) {
  13722. length = 1;
  13723. object = undefined;
  13724. }
  13725. while (++index < length) {
  13726. var value = object == null ? undefined : object[toKey(path[index])];
  13727. if (value === undefined) {
  13728. index = length;
  13729. value = defaultValue;
  13730. }
  13731. object = isFunction(value) ? value.call(object) : value;
  13732. }
  13733. return object;
  13734. }
  13735. /**
  13736. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  13737. * it's created. Arrays are created for missing index properties while objects
  13738. * are created for all other missing properties. Use `_.setWith` to customize
  13739. * `path` creation.
  13740. *
  13741. * **Note:** This method mutates `object`.
  13742. *
  13743. * @static
  13744. * @memberOf _
  13745. * @since 3.7.0
  13746. * @category Object
  13747. * @param {Object} object The object to modify.
  13748. * @param {Array|string} path The path of the property to set.
  13749. * @param {*} value The value to set.
  13750. * @returns {Object} Returns `object`.
  13751. * @example
  13752. *
  13753. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  13754. *
  13755. * _.set(object, 'a[0].b.c', 4);
  13756. * console.log(object.a[0].b.c);
  13757. * // => 4
  13758. *
  13759. * _.set(object, ['x', '0', 'y', 'z'], 5);
  13760. * console.log(object.x[0].y.z);
  13761. * // => 5
  13762. */
  13763. function set(object, path, value) {
  13764. return object == null ? object : baseSet(object, path, value);
  13765. }
  13766. /**
  13767. * This method is like `_.set` except that it accepts `customizer` which is
  13768. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  13769. * path creation is handled by the method instead. The `customizer` is invoked
  13770. * with three arguments: (nsValue, key, nsObject).
  13771. *
  13772. * **Note:** This method mutates `object`.
  13773. *
  13774. * @static
  13775. * @memberOf _
  13776. * @since 4.0.0
  13777. * @category Object
  13778. * @param {Object} object The object to modify.
  13779. * @param {Array|string} path The path of the property to set.
  13780. * @param {*} value The value to set.
  13781. * @param {Function} [customizer] The function to customize assigned values.
  13782. * @returns {Object} Returns `object`.
  13783. * @example
  13784. *
  13785. * var object = {};
  13786. *
  13787. * _.setWith(object, '[0][1]', 'a', Object);
  13788. * // => { '0': { '1': 'a' } }
  13789. */
  13790. function setWith(object, path, value, customizer) {
  13791. customizer = typeof customizer == 'function' ? customizer : undefined;
  13792. return object == null ? object : baseSet(object, path, value, customizer);
  13793. }
  13794. /**
  13795. * Creates an array of own enumerable string keyed-value pairs for `object`
  13796. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  13797. * entries are returned.
  13798. *
  13799. * @static
  13800. * @memberOf _
  13801. * @since 4.0.0
  13802. * @alias entries
  13803. * @category Object
  13804. * @param {Object} object The object to query.
  13805. * @returns {Array} Returns the key-value pairs.
  13806. * @example
  13807. *
  13808. * function Foo() {
  13809. * this.a = 1;
  13810. * this.b = 2;
  13811. * }
  13812. *
  13813. * Foo.prototype.c = 3;
  13814. *
  13815. * _.toPairs(new Foo);
  13816. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  13817. */
  13818. var toPairs = createToPairs(keys);
  13819. /**
  13820. * Creates an array of own and inherited enumerable string keyed-value pairs
  13821. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  13822. * or set, its entries are returned.
  13823. *
  13824. * @static
  13825. * @memberOf _
  13826. * @since 4.0.0
  13827. * @alias entriesIn
  13828. * @category Object
  13829. * @param {Object} object The object to query.
  13830. * @returns {Array} Returns the key-value pairs.
  13831. * @example
  13832. *
  13833. * function Foo() {
  13834. * this.a = 1;
  13835. * this.b = 2;
  13836. * }
  13837. *
  13838. * Foo.prototype.c = 3;
  13839. *
  13840. * _.toPairsIn(new Foo);
  13841. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  13842. */
  13843. var toPairsIn = createToPairs(keysIn);
  13844. /**
  13845. * An alternative to `_.reduce`; this method transforms `object` to a new
  13846. * `accumulator` object which is the result of running each of its own
  13847. * enumerable string keyed properties thru `iteratee`, with each invocation
  13848. * potentially mutating the `accumulator` object. If `accumulator` is not
  13849. * provided, a new object with the same `[[Prototype]]` will be used. The
  13850. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  13851. * Iteratee functions may exit iteration early by explicitly returning `false`.
  13852. *
  13853. * @static
  13854. * @memberOf _
  13855. * @since 1.3.0
  13856. * @category Object
  13857. * @param {Object} object The object to iterate over.
  13858. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  13859. * @param {*} [accumulator] The custom accumulator value.
  13860. * @returns {*} Returns the accumulated value.
  13861. * @example
  13862. *
  13863. * _.transform([2, 3, 4], function(result, n) {
  13864. * result.push(n *= n);
  13865. * return n % 2 == 0;
  13866. * }, []);
  13867. * // => [4, 9]
  13868. *
  13869. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  13870. * (result[value] || (result[value] = [])).push(key);
  13871. * }, {});
  13872. * // => { '1': ['a', 'c'], '2': ['b'] }
  13873. */
  13874. function transform(object, iteratee, accumulator) {
  13875. var isArr = isArray(object),
  13876. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  13877. iteratee = getIteratee(iteratee, 4);
  13878. if (accumulator == null) {
  13879. var Ctor = object && object.constructor;
  13880. if (isArrLike) {
  13881. accumulator = isArr ? new Ctor : [];
  13882. }
  13883. else if (isObject(object)) {
  13884. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  13885. }
  13886. else {
  13887. accumulator = {};
  13888. }
  13889. }
  13890. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  13891. return iteratee(accumulator, value, index, object);
  13892. });
  13893. return accumulator;
  13894. }
  13895. /**
  13896. * Removes the property at `path` of `object`.
  13897. *
  13898. * **Note:** This method mutates `object`.
  13899. *
  13900. * @static
  13901. * @memberOf _
  13902. * @since 4.0.0
  13903. * @category Object
  13904. * @param {Object} object The object to modify.
  13905. * @param {Array|string} path The path of the property to unset.
  13906. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  13907. * @example
  13908. *
  13909. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  13910. * _.unset(object, 'a[0].b.c');
  13911. * // => true
  13912. *
  13913. * console.log(object);
  13914. * // => { 'a': [{ 'b': {} }] };
  13915. *
  13916. * _.unset(object, ['a', '0', 'b', 'c']);
  13917. * // => true
  13918. *
  13919. * console.log(object);
  13920. * // => { 'a': [{ 'b': {} }] };
  13921. */
  13922. function unset(object, path) {
  13923. return object == null ? true : baseUnset(object, path);
  13924. }
  13925. /**
  13926. * This method is like `_.set` except that accepts `updater` to produce the
  13927. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  13928. * is invoked with one argument: (value).
  13929. *
  13930. * **Note:** This method mutates `object`.
  13931. *
  13932. * @static
  13933. * @memberOf _
  13934. * @since 4.6.0
  13935. * @category Object
  13936. * @param {Object} object The object to modify.
  13937. * @param {Array|string} path The path of the property to set.
  13938. * @param {Function} updater The function to produce the updated value.
  13939. * @returns {Object} Returns `object`.
  13940. * @example
  13941. *
  13942. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  13943. *
  13944. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  13945. * console.log(object.a[0].b.c);
  13946. * // => 9
  13947. *
  13948. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  13949. * console.log(object.x[0].y.z);
  13950. * // => 0
  13951. */
  13952. function update(object, path, updater) {
  13953. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  13954. }
  13955. /**
  13956. * This method is like `_.update` except that it accepts `customizer` which is
  13957. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  13958. * path creation is handled by the method instead. The `customizer` is invoked
  13959. * with three arguments: (nsValue, key, nsObject).
  13960. *
  13961. * **Note:** This method mutates `object`.
  13962. *
  13963. * @static
  13964. * @memberOf _
  13965. * @since 4.6.0
  13966. * @category Object
  13967. * @param {Object} object The object to modify.
  13968. * @param {Array|string} path The path of the property to set.
  13969. * @param {Function} updater The function to produce the updated value.
  13970. * @param {Function} [customizer] The function to customize assigned values.
  13971. * @returns {Object} Returns `object`.
  13972. * @example
  13973. *
  13974. * var object = {};
  13975. *
  13976. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  13977. * // => { '0': { '1': 'a' } }
  13978. */
  13979. function updateWith(object, path, updater, customizer) {
  13980. customizer = typeof customizer == 'function' ? customizer : undefined;
  13981. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  13982. }
  13983. /**
  13984. * Creates an array of the own enumerable string keyed property values of `object`.
  13985. *
  13986. * **Note:** Non-object values are coerced to objects.
  13987. *
  13988. * @static
  13989. * @since 0.1.0
  13990. * @memberOf _
  13991. * @category Object
  13992. * @param {Object} object The object to query.
  13993. * @returns {Array} Returns the array of property values.
  13994. * @example
  13995. *
  13996. * function Foo() {
  13997. * this.a = 1;
  13998. * this.b = 2;
  13999. * }
  14000. *
  14001. * Foo.prototype.c = 3;
  14002. *
  14003. * _.values(new Foo);
  14004. * // => [1, 2] (iteration order is not guaranteed)
  14005. *
  14006. * _.values('hi');
  14007. * // => ['h', 'i']
  14008. */
  14009. function values(object) {
  14010. return object == null ? [] : baseValues(object, keys(object));
  14011. }
  14012. /**
  14013. * Creates an array of the own and inherited enumerable string keyed property
  14014. * values of `object`.
  14015. *
  14016. * **Note:** Non-object values are coerced to objects.
  14017. *
  14018. * @static
  14019. * @memberOf _
  14020. * @since 3.0.0
  14021. * @category Object
  14022. * @param {Object} object The object to query.
  14023. * @returns {Array} Returns the array of property values.
  14024. * @example
  14025. *
  14026. * function Foo() {
  14027. * this.a = 1;
  14028. * this.b = 2;
  14029. * }
  14030. *
  14031. * Foo.prototype.c = 3;
  14032. *
  14033. * _.valuesIn(new Foo);
  14034. * // => [1, 2, 3] (iteration order is not guaranteed)
  14035. */
  14036. function valuesIn(object) {
  14037. return object == null ? [] : baseValues(object, keysIn(object));
  14038. }
  14039. /*------------------------------------------------------------------------*/
  14040. /**
  14041. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  14042. *
  14043. * @static
  14044. * @memberOf _
  14045. * @since 4.0.0
  14046. * @category Number
  14047. * @param {number} number The number to clamp.
  14048. * @param {number} [lower] The lower bound.
  14049. * @param {number} upper The upper bound.
  14050. * @returns {number} Returns the clamped number.
  14051. * @example
  14052. *
  14053. * _.clamp(-10, -5, 5);
  14054. * // => -5
  14055. *
  14056. * _.clamp(10, -5, 5);
  14057. * // => 5
  14058. */
  14059. function clamp(number, lower, upper) {
  14060. if (upper === undefined) {
  14061. upper = lower;
  14062. lower = undefined;
  14063. }
  14064. if (upper !== undefined) {
  14065. upper = toNumber(upper);
  14066. upper = upper === upper ? upper : 0;
  14067. }
  14068. if (lower !== undefined) {
  14069. lower = toNumber(lower);
  14070. lower = lower === lower ? lower : 0;
  14071. }
  14072. return baseClamp(toNumber(number), lower, upper);
  14073. }
  14074. /**
  14075. * Checks if `n` is between `start` and up to, but not including, `end`. If
  14076. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  14077. * If `start` is greater than `end` the params are swapped to support
  14078. * negative ranges.
  14079. *
  14080. * @static
  14081. * @memberOf _
  14082. * @since 3.3.0
  14083. * @category Number
  14084. * @param {number} number The number to check.
  14085. * @param {number} [start=0] The start of the range.
  14086. * @param {number} end The end of the range.
  14087. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  14088. * @see _.range, _.rangeRight
  14089. * @example
  14090. *
  14091. * _.inRange(3, 2, 4);
  14092. * // => true
  14093. *
  14094. * _.inRange(4, 8);
  14095. * // => true
  14096. *
  14097. * _.inRange(4, 2);
  14098. * // => false
  14099. *
  14100. * _.inRange(2, 2);
  14101. * // => false
  14102. *
  14103. * _.inRange(1.2, 2);
  14104. * // => true
  14105. *
  14106. * _.inRange(5.2, 4);
  14107. * // => false
  14108. *
  14109. * _.inRange(-3, -2, -6);
  14110. * // => true
  14111. */
  14112. function inRange(number, start, end) {
  14113. start = toFinite(start);
  14114. if (end === undefined) {
  14115. end = start;
  14116. start = 0;
  14117. } else {
  14118. end = toFinite(end);
  14119. }
  14120. number = toNumber(number);
  14121. return baseInRange(number, start, end);
  14122. }
  14123. /**
  14124. * Produces a random number between the inclusive `lower` and `upper` bounds.
  14125. * If only one argument is provided a number between `0` and the given number
  14126. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  14127. * floats, a floating-point number is returned instead of an integer.
  14128. *
  14129. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  14130. * floating-point values which can produce unexpected results.
  14131. *
  14132. * @static
  14133. * @memberOf _
  14134. * @since 0.7.0
  14135. * @category Number
  14136. * @param {number} [lower=0] The lower bound.
  14137. * @param {number} [upper=1] The upper bound.
  14138. * @param {boolean} [floating] Specify returning a floating-point number.
  14139. * @returns {number} Returns the random number.
  14140. * @example
  14141. *
  14142. * _.random(0, 5);
  14143. * // => an integer between 0 and 5
  14144. *
  14145. * _.random(5);
  14146. * // => also an integer between 0 and 5
  14147. *
  14148. * _.random(5, true);
  14149. * // => a floating-point number between 0 and 5
  14150. *
  14151. * _.random(1.2, 5.2);
  14152. * // => a floating-point number between 1.2 and 5.2
  14153. */
  14154. function random(lower, upper, floating) {
  14155. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  14156. upper = floating = undefined;
  14157. }
  14158. if (floating === undefined) {
  14159. if (typeof upper == 'boolean') {
  14160. floating = upper;
  14161. upper = undefined;
  14162. }
  14163. else if (typeof lower == 'boolean') {
  14164. floating = lower;
  14165. lower = undefined;
  14166. }
  14167. }
  14168. if (lower === undefined && upper === undefined) {
  14169. lower = 0;
  14170. upper = 1;
  14171. }
  14172. else {
  14173. lower = toFinite(lower);
  14174. if (upper === undefined) {
  14175. upper = lower;
  14176. lower = 0;
  14177. } else {
  14178. upper = toFinite(upper);
  14179. }
  14180. }
  14181. if (lower > upper) {
  14182. var temp = lower;
  14183. lower = upper;
  14184. upper = temp;
  14185. }
  14186. if (floating || lower % 1 || upper % 1) {
  14187. var rand = nativeRandom();
  14188. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  14189. }
  14190. return baseRandom(lower, upper);
  14191. }
  14192. /*------------------------------------------------------------------------*/
  14193. /**
  14194. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  14195. *
  14196. * @static
  14197. * @memberOf _
  14198. * @since 3.0.0
  14199. * @category String
  14200. * @param {string} [string=''] The string to convert.
  14201. * @returns {string} Returns the camel cased string.
  14202. * @example
  14203. *
  14204. * _.camelCase('Foo Bar');
  14205. * // => 'fooBar'
  14206. *
  14207. * _.camelCase('--foo-bar--');
  14208. * // => 'fooBar'
  14209. *
  14210. * _.camelCase('__FOO_BAR__');
  14211. * // => 'fooBar'
  14212. */
  14213. var camelCase = createCompounder(function(result, word, index) {
  14214. word = word.toLowerCase();
  14215. return result + (index ? capitalize(word) : word);
  14216. });
  14217. /**
  14218. * Converts the first character of `string` to upper case and the remaining
  14219. * to lower case.
  14220. *
  14221. * @static
  14222. * @memberOf _
  14223. * @since 3.0.0
  14224. * @category String
  14225. * @param {string} [string=''] The string to capitalize.
  14226. * @returns {string} Returns the capitalized string.
  14227. * @example
  14228. *
  14229. * _.capitalize('FRED');
  14230. * // => 'Fred'
  14231. */
  14232. function capitalize(string) {
  14233. return upperFirst(toString(string).toLowerCase());
  14234. }
  14235. /**
  14236. * Deburrs `string` by converting
  14237. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  14238. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  14239. * letters to basic Latin letters and removing
  14240. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  14241. *
  14242. * @static
  14243. * @memberOf _
  14244. * @since 3.0.0
  14245. * @category String
  14246. * @param {string} [string=''] The string to deburr.
  14247. * @returns {string} Returns the deburred string.
  14248. * @example
  14249. *
  14250. * _.deburr('déjà vu');
  14251. * // => 'deja vu'
  14252. */
  14253. function deburr(string) {
  14254. string = toString(string);
  14255. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  14256. }
  14257. /**
  14258. * Checks if `string` ends with the given target string.
  14259. *
  14260. * @static
  14261. * @memberOf _
  14262. * @since 3.0.0
  14263. * @category String
  14264. * @param {string} [string=''] The string to inspect.
  14265. * @param {string} [target] The string to search for.
  14266. * @param {number} [position=string.length] The position to search up to.
  14267. * @returns {boolean} Returns `true` if `string` ends with `target`,
  14268. * else `false`.
  14269. * @example
  14270. *
  14271. * _.endsWith('abc', 'c');
  14272. * // => true
  14273. *
  14274. * _.endsWith('abc', 'b');
  14275. * // => false
  14276. *
  14277. * _.endsWith('abc', 'b', 2);
  14278. * // => true
  14279. */
  14280. function endsWith(string, target, position) {
  14281. string = toString(string);
  14282. target = baseToString(target);
  14283. var length = string.length;
  14284. position = position === undefined
  14285. ? length
  14286. : baseClamp(toInteger(position), 0, length);
  14287. var end = position;
  14288. position -= target.length;
  14289. return position >= 0 && string.slice(position, end) == target;
  14290. }
  14291. /**
  14292. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  14293. * corresponding HTML entities.
  14294. *
  14295. * **Note:** No other characters are escaped. To escape additional
  14296. * characters use a third-party library like [_he_](https://mths.be/he).
  14297. *
  14298. * Though the ">" character is escaped for symmetry, characters like
  14299. * ">" and "/" don't need escaping in HTML and have no special meaning
  14300. * unless they're part of a tag or unquoted attribute value. See
  14301. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  14302. * (under "semi-related fun fact") for more details.
  14303. *
  14304. * When working with HTML you should always
  14305. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  14306. * XSS vectors.
  14307. *
  14308. * @static
  14309. * @since 0.1.0
  14310. * @memberOf _
  14311. * @category String
  14312. * @param {string} [string=''] The string to escape.
  14313. * @returns {string} Returns the escaped string.
  14314. * @example
  14315. *
  14316. * _.escape('fred, barney, & pebbles');
  14317. * // => 'fred, barney, &amp; pebbles'
  14318. */
  14319. function escape(string) {
  14320. string = toString(string);
  14321. return (string && reHasUnescapedHtml.test(string))
  14322. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  14323. : string;
  14324. }
  14325. /**
  14326. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  14327. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  14328. *
  14329. * @static
  14330. * @memberOf _
  14331. * @since 3.0.0
  14332. * @category String
  14333. * @param {string} [string=''] The string to escape.
  14334. * @returns {string} Returns the escaped string.
  14335. * @example
  14336. *
  14337. * _.escapeRegExp('[lodash](https://lodash.com/)');
  14338. * // => '\[lodash\]\(https://lodash\.com/\)'
  14339. */
  14340. function escapeRegExp(string) {
  14341. string = toString(string);
  14342. return (string && reHasRegExpChar.test(string))
  14343. ? string.replace(reRegExpChar, '\\$&')
  14344. : string;
  14345. }
  14346. /**
  14347. * Converts `string` to
  14348. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  14349. *
  14350. * @static
  14351. * @memberOf _
  14352. * @since 3.0.0
  14353. * @category String
  14354. * @param {string} [string=''] The string to convert.
  14355. * @returns {string} Returns the kebab cased string.
  14356. * @example
  14357. *
  14358. * _.kebabCase('Foo Bar');
  14359. * // => 'foo-bar'
  14360. *
  14361. * _.kebabCase('fooBar');
  14362. * // => 'foo-bar'
  14363. *
  14364. * _.kebabCase('__FOO_BAR__');
  14365. * // => 'foo-bar'
  14366. */
  14367. var kebabCase = createCompounder(function(result, word, index) {
  14368. return result + (index ? '-' : '') + word.toLowerCase();
  14369. });
  14370. /**
  14371. * Converts `string`, as space separated words, to lower case.
  14372. *
  14373. * @static
  14374. * @memberOf _
  14375. * @since 4.0.0
  14376. * @category String
  14377. * @param {string} [string=''] The string to convert.
  14378. * @returns {string} Returns the lower cased string.
  14379. * @example
  14380. *
  14381. * _.lowerCase('--Foo-Bar--');
  14382. * // => 'foo bar'
  14383. *
  14384. * _.lowerCase('fooBar');
  14385. * // => 'foo bar'
  14386. *
  14387. * _.lowerCase('__FOO_BAR__');
  14388. * // => 'foo bar'
  14389. */
  14390. var lowerCase = createCompounder(function(result, word, index) {
  14391. return result + (index ? ' ' : '') + word.toLowerCase();
  14392. });
  14393. /**
  14394. * Converts the first character of `string` to lower case.
  14395. *
  14396. * @static
  14397. * @memberOf _
  14398. * @since 4.0.0
  14399. * @category String
  14400. * @param {string} [string=''] The string to convert.
  14401. * @returns {string} Returns the converted string.
  14402. * @example
  14403. *
  14404. * _.lowerFirst('Fred');
  14405. * // => 'fred'
  14406. *
  14407. * _.lowerFirst('FRED');
  14408. * // => 'fRED'
  14409. */
  14410. var lowerFirst = createCaseFirst('toLowerCase');
  14411. /**
  14412. * Pads `string` on the left and right sides if it's shorter than `length`.
  14413. * Padding characters are truncated if they can't be evenly divided by `length`.
  14414. *
  14415. * @static
  14416. * @memberOf _
  14417. * @since 3.0.0
  14418. * @category String
  14419. * @param {string} [string=''] The string to pad.
  14420. * @param {number} [length=0] The padding length.
  14421. * @param {string} [chars=' '] The string used as padding.
  14422. * @returns {string} Returns the padded string.
  14423. * @example
  14424. *
  14425. * _.pad('abc', 8);
  14426. * // => ' abc '
  14427. *
  14428. * _.pad('abc', 8, '_-');
  14429. * // => '_-abc_-_'
  14430. *
  14431. * _.pad('abc', 3);
  14432. * // => 'abc'
  14433. */
  14434. function pad(string, length, chars) {
  14435. string = toString(string);
  14436. length = toInteger(length);
  14437. var strLength = length ? stringSize(string) : 0;
  14438. if (!length || strLength >= length) {
  14439. return string;
  14440. }
  14441. var mid = (length - strLength) / 2;
  14442. return (
  14443. createPadding(nativeFloor(mid), chars) +
  14444. string +
  14445. createPadding(nativeCeil(mid), chars)
  14446. );
  14447. }
  14448. /**
  14449. * Pads `string` on the right side if it's shorter than `length`. Padding
  14450. * characters are truncated if they exceed `length`.
  14451. *
  14452. * @static
  14453. * @memberOf _
  14454. * @since 4.0.0
  14455. * @category String
  14456. * @param {string} [string=''] The string to pad.
  14457. * @param {number} [length=0] The padding length.
  14458. * @param {string} [chars=' '] The string used as padding.
  14459. * @returns {string} Returns the padded string.
  14460. * @example
  14461. *
  14462. * _.padEnd('abc', 6);
  14463. * // => 'abc '
  14464. *
  14465. * _.padEnd('abc', 6, '_-');
  14466. * // => 'abc_-_'
  14467. *
  14468. * _.padEnd('abc', 3);
  14469. * // => 'abc'
  14470. */
  14471. function padEnd(string, length, chars) {
  14472. string = toString(string);
  14473. length = toInteger(length);
  14474. var strLength = length ? stringSize(string) : 0;
  14475. return (length && strLength < length)
  14476. ? (string + createPadding(length - strLength, chars))
  14477. : string;
  14478. }
  14479. /**
  14480. * Pads `string` on the left side if it's shorter than `length`. Padding
  14481. * characters are truncated if they exceed `length`.
  14482. *
  14483. * @static
  14484. * @memberOf _
  14485. * @since 4.0.0
  14486. * @category String
  14487. * @param {string} [string=''] The string to pad.
  14488. * @param {number} [length=0] The padding length.
  14489. * @param {string} [chars=' '] The string used as padding.
  14490. * @returns {string} Returns the padded string.
  14491. * @example
  14492. *
  14493. * _.padStart('abc', 6);
  14494. * // => ' abc'
  14495. *
  14496. * _.padStart('abc', 6, '_-');
  14497. * // => '_-_abc'
  14498. *
  14499. * _.padStart('abc', 3);
  14500. * // => 'abc'
  14501. */
  14502. function padStart(string, length, chars) {
  14503. string = toString(string);
  14504. length = toInteger(length);
  14505. var strLength = length ? stringSize(string) : 0;
  14506. return (length && strLength < length)
  14507. ? (createPadding(length - strLength, chars) + string)
  14508. : string;
  14509. }
  14510. /**
  14511. * Converts `string` to an integer of the specified radix. If `radix` is
  14512. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  14513. * hexadecimal, in which case a `radix` of `16` is used.
  14514. *
  14515. * **Note:** This method aligns with the
  14516. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  14517. *
  14518. * @static
  14519. * @memberOf _
  14520. * @since 1.1.0
  14521. * @category String
  14522. * @param {string} string The string to convert.
  14523. * @param {number} [radix=10] The radix to interpret `value` by.
  14524. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14525. * @returns {number} Returns the converted integer.
  14526. * @example
  14527. *
  14528. * _.parseInt('08');
  14529. * // => 8
  14530. *
  14531. * _.map(['6', '08', '10'], _.parseInt);
  14532. * // => [6, 8, 10]
  14533. */
  14534. function parseInt(string, radix, guard) {
  14535. if (guard || radix == null) {
  14536. radix = 0;
  14537. } else if (radix) {
  14538. radix = +radix;
  14539. }
  14540. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  14541. }
  14542. /**
  14543. * Repeats the given string `n` times.
  14544. *
  14545. * @static
  14546. * @memberOf _
  14547. * @since 3.0.0
  14548. * @category String
  14549. * @param {string} [string=''] The string to repeat.
  14550. * @param {number} [n=1] The number of times to repeat the string.
  14551. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14552. * @returns {string} Returns the repeated string.
  14553. * @example
  14554. *
  14555. * _.repeat('*', 3);
  14556. * // => '***'
  14557. *
  14558. * _.repeat('abc', 2);
  14559. * // => 'abcabc'
  14560. *
  14561. * _.repeat('abc', 0);
  14562. * // => ''
  14563. */
  14564. function repeat(string, n, guard) {
  14565. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  14566. n = 1;
  14567. } else {
  14568. n = toInteger(n);
  14569. }
  14570. return baseRepeat(toString(string), n);
  14571. }
  14572. /**
  14573. * Replaces matches for `pattern` in `string` with `replacement`.
  14574. *
  14575. * **Note:** This method is based on
  14576. * [`String#replace`](https://mdn.io/String/replace).
  14577. *
  14578. * @static
  14579. * @memberOf _
  14580. * @since 4.0.0
  14581. * @category String
  14582. * @param {string} [string=''] The string to modify.
  14583. * @param {RegExp|string} pattern The pattern to replace.
  14584. * @param {Function|string} replacement The match replacement.
  14585. * @returns {string} Returns the modified string.
  14586. * @example
  14587. *
  14588. * _.replace('Hi Fred', 'Fred', 'Barney');
  14589. * // => 'Hi Barney'
  14590. */
  14591. function replace() {
  14592. var args = arguments,
  14593. string = toString(args[0]);
  14594. return args.length < 3 ? string : string.replace(args[1], args[2]);
  14595. }
  14596. /**
  14597. * Converts `string` to
  14598. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  14599. *
  14600. * @static
  14601. * @memberOf _
  14602. * @since 3.0.0
  14603. * @category String
  14604. * @param {string} [string=''] The string to convert.
  14605. * @returns {string} Returns the snake cased string.
  14606. * @example
  14607. *
  14608. * _.snakeCase('Foo Bar');
  14609. * // => 'foo_bar'
  14610. *
  14611. * _.snakeCase('fooBar');
  14612. * // => 'foo_bar'
  14613. *
  14614. * _.snakeCase('--FOO-BAR--');
  14615. * // => 'foo_bar'
  14616. */
  14617. var snakeCase = createCompounder(function(result, word, index) {
  14618. return result + (index ? '_' : '') + word.toLowerCase();
  14619. });
  14620. /**
  14621. * Splits `string` by `separator`.
  14622. *
  14623. * **Note:** This method is based on
  14624. * [`String#split`](https://mdn.io/String/split).
  14625. *
  14626. * @static
  14627. * @memberOf _
  14628. * @since 4.0.0
  14629. * @category String
  14630. * @param {string} [string=''] The string to split.
  14631. * @param {RegExp|string} separator The separator pattern to split by.
  14632. * @param {number} [limit] The length to truncate results to.
  14633. * @returns {Array} Returns the string segments.
  14634. * @example
  14635. *
  14636. * _.split('a-b-c', '-', 2);
  14637. * // => ['a', 'b']
  14638. */
  14639. function split(string, separator, limit) {
  14640. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  14641. separator = limit = undefined;
  14642. }
  14643. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  14644. if (!limit) {
  14645. return [];
  14646. }
  14647. string = toString(string);
  14648. if (string && (
  14649. typeof separator == 'string' ||
  14650. (separator != null && !isRegExp(separator))
  14651. )) {
  14652. separator = baseToString(separator);
  14653. if (!separator && hasUnicode(string)) {
  14654. return castSlice(stringToArray(string), 0, limit);
  14655. }
  14656. }
  14657. return string.split(separator, limit);
  14658. }
  14659. /**
  14660. * Converts `string` to
  14661. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  14662. *
  14663. * @static
  14664. * @memberOf _
  14665. * @since 3.1.0
  14666. * @category String
  14667. * @param {string} [string=''] The string to convert.
  14668. * @returns {string} Returns the start cased string.
  14669. * @example
  14670. *
  14671. * _.startCase('--foo-bar--');
  14672. * // => 'Foo Bar'
  14673. *
  14674. * _.startCase('fooBar');
  14675. * // => 'Foo Bar'
  14676. *
  14677. * _.startCase('__FOO_BAR__');
  14678. * // => 'FOO BAR'
  14679. */
  14680. var startCase = createCompounder(function(result, word, index) {
  14681. return result + (index ? ' ' : '') + upperFirst(word);
  14682. });
  14683. /**
  14684. * Checks if `string` starts with the given target string.
  14685. *
  14686. * @static
  14687. * @memberOf _
  14688. * @since 3.0.0
  14689. * @category String
  14690. * @param {string} [string=''] The string to inspect.
  14691. * @param {string} [target] The string to search for.
  14692. * @param {number} [position=0] The position to search from.
  14693. * @returns {boolean} Returns `true` if `string` starts with `target`,
  14694. * else `false`.
  14695. * @example
  14696. *
  14697. * _.startsWith('abc', 'a');
  14698. * // => true
  14699. *
  14700. * _.startsWith('abc', 'b');
  14701. * // => false
  14702. *
  14703. * _.startsWith('abc', 'b', 1);
  14704. * // => true
  14705. */
  14706. function startsWith(string, target, position) {
  14707. string = toString(string);
  14708. position = position == null
  14709. ? 0
  14710. : baseClamp(toInteger(position), 0, string.length);
  14711. target = baseToString(target);
  14712. return string.slice(position, position + target.length) == target;
  14713. }
  14714. /**
  14715. * Creates a compiled template function that can interpolate data properties
  14716. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  14717. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  14718. * properties may be accessed as free variables in the template. If a setting
  14719. * object is given, it takes precedence over `_.templateSettings` values.
  14720. *
  14721. * **Note:** In the development build `_.template` utilizes
  14722. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  14723. * for easier debugging.
  14724. *
  14725. * For more information on precompiling templates see
  14726. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  14727. *
  14728. * For more information on Chrome extension sandboxes see
  14729. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  14730. *
  14731. * @static
  14732. * @since 0.1.0
  14733. * @memberOf _
  14734. * @category String
  14735. * @param {string} [string=''] The template string.
  14736. * @param {Object} [options={}] The options object.
  14737. * @param {RegExp} [options.escape=_.templateSettings.escape]
  14738. * The HTML "escape" delimiter.
  14739. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  14740. * The "evaluate" delimiter.
  14741. * @param {Object} [options.imports=_.templateSettings.imports]
  14742. * An object to import into the template as free variables.
  14743. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  14744. * The "interpolate" delimiter.
  14745. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  14746. * The sourceURL of the compiled template.
  14747. * @param {string} [options.variable='obj']
  14748. * The data object variable name.
  14749. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14750. * @returns {Function} Returns the compiled template function.
  14751. * @example
  14752. *
  14753. * // Use the "interpolate" delimiter to create a compiled template.
  14754. * var compiled = _.template('hello <%= user %>!');
  14755. * compiled({ 'user': 'fred' });
  14756. * // => 'hello fred!'
  14757. *
  14758. * // Use the HTML "escape" delimiter to escape data property values.
  14759. * var compiled = _.template('<b><%- value %></b>');
  14760. * compiled({ 'value': '<script>' });
  14761. * // => '<b>&lt;script&gt;</b>'
  14762. *
  14763. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  14764. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  14765. * compiled({ 'users': ['fred', 'barney'] });
  14766. * // => '<li>fred</li><li>barney</li>'
  14767. *
  14768. * // Use the internal `print` function in "evaluate" delimiters.
  14769. * var compiled = _.template('<% print("hello " + user); %>!');
  14770. * compiled({ 'user': 'barney' });
  14771. * // => 'hello barney!'
  14772. *
  14773. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  14774. * // Disable support by replacing the "interpolate" delimiter.
  14775. * var compiled = _.template('hello ${ user }!');
  14776. * compiled({ 'user': 'pebbles' });
  14777. * // => 'hello pebbles!'
  14778. *
  14779. * // Use backslashes to treat delimiters as plain text.
  14780. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  14781. * compiled({ 'value': 'ignored' });
  14782. * // => '<%- value %>'
  14783. *
  14784. * // Use the `imports` option to import `jQuery` as `jq`.
  14785. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  14786. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  14787. * compiled({ 'users': ['fred', 'barney'] });
  14788. * // => '<li>fred</li><li>barney</li>'
  14789. *
  14790. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  14791. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  14792. * compiled(data);
  14793. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  14794. *
  14795. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  14796. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  14797. * compiled.source;
  14798. * // => function(data) {
  14799. * // var __t, __p = '';
  14800. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  14801. * // return __p;
  14802. * // }
  14803. *
  14804. * // Use custom template delimiters.
  14805. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  14806. * var compiled = _.template('hello {{ user }}!');
  14807. * compiled({ 'user': 'mustache' });
  14808. * // => 'hello mustache!'
  14809. *
  14810. * // Use the `source` property to inline compiled templates for meaningful
  14811. * // line numbers in error messages and stack traces.
  14812. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  14813. * var JST = {\
  14814. * "main": ' + _.template(mainText).source + '\
  14815. * };\
  14816. * ');
  14817. */
  14818. function template(string, options, guard) {
  14819. // Based on John Resig's `tmpl` implementation
  14820. // (http://ejohn.org/blog/javascript-micro-templating/)
  14821. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  14822. var settings = lodash.templateSettings;
  14823. if (guard && isIterateeCall(string, options, guard)) {
  14824. options = undefined;
  14825. }
  14826. string = toString(string);
  14827. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  14828. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  14829. importsKeys = keys(imports),
  14830. importsValues = baseValues(imports, importsKeys);
  14831. var isEscaping,
  14832. isEvaluating,
  14833. index = 0,
  14834. interpolate = options.interpolate || reNoMatch,
  14835. source = "__p += '";
  14836. // Compile the regexp to match each delimiter.
  14837. var reDelimiters = RegExp(
  14838. (options.escape || reNoMatch).source + '|' +
  14839. interpolate.source + '|' +
  14840. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  14841. (options.evaluate || reNoMatch).source + '|$'
  14842. , 'g');
  14843. // Use a sourceURL for easier debugging.
  14844. // The sourceURL gets injected into the source that's eval-ed, so be careful
  14845. // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
  14846. // and escape the comment, thus injecting code that gets evaled.
  14847. var sourceURL = '//# sourceURL=' +
  14848. (hasOwnProperty.call(options, 'sourceURL')
  14849. ? (options.sourceURL + '').replace(/\s/g, ' ')
  14850. : ('lodash.templateSources[' + (++templateCounter) + ']')
  14851. ) + '\n';
  14852. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  14853. interpolateValue || (interpolateValue = esTemplateValue);
  14854. // Escape characters that can't be included in string literals.
  14855. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  14856. // Replace delimiters with snippets.
  14857. if (escapeValue) {
  14858. isEscaping = true;
  14859. source += "' +\n__e(" + escapeValue + ") +\n'";
  14860. }
  14861. if (evaluateValue) {
  14862. isEvaluating = true;
  14863. source += "';\n" + evaluateValue + ";\n__p += '";
  14864. }
  14865. if (interpolateValue) {
  14866. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  14867. }
  14868. index = offset + match.length;
  14869. // The JS engine embedded in Adobe products needs `match` returned in
  14870. // order to produce the correct `offset` value.
  14871. return match;
  14872. });
  14873. source += "';\n";
  14874. // If `variable` is not specified wrap a with-statement around the generated
  14875. // code to add the data object to the top of the scope chain.
  14876. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  14877. if (!variable) {
  14878. source = 'with (obj) {\n' + source + '\n}\n';
  14879. }
  14880. // Throw an error if a forbidden character was found in `variable`, to prevent
  14881. // potential command injection attacks.
  14882. else if (reForbiddenIdentifierChars.test(variable)) {
  14883. throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
  14884. }
  14885. // Cleanup code by stripping empty strings.
  14886. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  14887. .replace(reEmptyStringMiddle, '$1')
  14888. .replace(reEmptyStringTrailing, '$1;');
  14889. // Frame code as the function body.
  14890. source = 'function(' + (variable || 'obj') + ') {\n' +
  14891. (variable
  14892. ? ''
  14893. : 'obj || (obj = {});\n'
  14894. ) +
  14895. "var __t, __p = ''" +
  14896. (isEscaping
  14897. ? ', __e = _.escape'
  14898. : ''
  14899. ) +
  14900. (isEvaluating
  14901. ? ', __j = Array.prototype.join;\n' +
  14902. "function print() { __p += __j.call(arguments, '') }\n"
  14903. : ';\n'
  14904. ) +
  14905. source +
  14906. 'return __p\n}';
  14907. var result = attempt(function() {
  14908. return Function(importsKeys, sourceURL + 'return ' + source)
  14909. .apply(undefined, importsValues);
  14910. });
  14911. // Provide the compiled function's source by its `toString` method or
  14912. // the `source` property as a convenience for inlining compiled templates.
  14913. result.source = source;
  14914. if (isError(result)) {
  14915. throw result;
  14916. }
  14917. return result;
  14918. }
  14919. /**
  14920. * Converts `string`, as a whole, to lower case just like
  14921. * [String#toLowerCase](https://mdn.io/toLowerCase).
  14922. *
  14923. * @static
  14924. * @memberOf _
  14925. * @since 4.0.0
  14926. * @category String
  14927. * @param {string} [string=''] The string to convert.
  14928. * @returns {string} Returns the lower cased string.
  14929. * @example
  14930. *
  14931. * _.toLower('--Foo-Bar--');
  14932. * // => '--foo-bar--'
  14933. *
  14934. * _.toLower('fooBar');
  14935. * // => 'foobar'
  14936. *
  14937. * _.toLower('__FOO_BAR__');
  14938. * // => '__foo_bar__'
  14939. */
  14940. function toLower(value) {
  14941. return toString(value).toLowerCase();
  14942. }
  14943. /**
  14944. * Converts `string`, as a whole, to upper case just like
  14945. * [String#toUpperCase](https://mdn.io/toUpperCase).
  14946. *
  14947. * @static
  14948. * @memberOf _
  14949. * @since 4.0.0
  14950. * @category String
  14951. * @param {string} [string=''] The string to convert.
  14952. * @returns {string} Returns the upper cased string.
  14953. * @example
  14954. *
  14955. * _.toUpper('--foo-bar--');
  14956. * // => '--FOO-BAR--'
  14957. *
  14958. * _.toUpper('fooBar');
  14959. * // => 'FOOBAR'
  14960. *
  14961. * _.toUpper('__foo_bar__');
  14962. * // => '__FOO_BAR__'
  14963. */
  14964. function toUpper(value) {
  14965. return toString(value).toUpperCase();
  14966. }
  14967. /**
  14968. * Removes leading and trailing whitespace or specified characters from `string`.
  14969. *
  14970. * @static
  14971. * @memberOf _
  14972. * @since 3.0.0
  14973. * @category String
  14974. * @param {string} [string=''] The string to trim.
  14975. * @param {string} [chars=whitespace] The characters to trim.
  14976. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  14977. * @returns {string} Returns the trimmed string.
  14978. * @example
  14979. *
  14980. * _.trim(' abc ');
  14981. * // => 'abc'
  14982. *
  14983. * _.trim('-_-abc-_-', '_-');
  14984. * // => 'abc'
  14985. *
  14986. * _.map([' foo ', ' bar '], _.trim);
  14987. * // => ['foo', 'bar']
  14988. */
  14989. function trim(string, chars, guard) {
  14990. string = toString(string);
  14991. if (string && (guard || chars === undefined)) {
  14992. return baseTrim(string);
  14993. }
  14994. if (!string || !(chars = baseToString(chars))) {
  14995. return string;
  14996. }
  14997. var strSymbols = stringToArray(string),
  14998. chrSymbols = stringToArray(chars),
  14999. start = charsStartIndex(strSymbols, chrSymbols),
  15000. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  15001. return castSlice(strSymbols, start, end).join('');
  15002. }
  15003. /**
  15004. * Removes trailing whitespace or specified characters from `string`.
  15005. *
  15006. * @static
  15007. * @memberOf _
  15008. * @since 4.0.0
  15009. * @category String
  15010. * @param {string} [string=''] The string to trim.
  15011. * @param {string} [chars=whitespace] The characters to trim.
  15012. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15013. * @returns {string} Returns the trimmed string.
  15014. * @example
  15015. *
  15016. * _.trimEnd(' abc ');
  15017. * // => ' abc'
  15018. *
  15019. * _.trimEnd('-_-abc-_-', '_-');
  15020. * // => '-_-abc'
  15021. */
  15022. function trimEnd(string, chars, guard) {
  15023. string = toString(string);
  15024. if (string && (guard || chars === undefined)) {
  15025. return string.slice(0, trimmedEndIndex(string) + 1);
  15026. }
  15027. if (!string || !(chars = baseToString(chars))) {
  15028. return string;
  15029. }
  15030. var strSymbols = stringToArray(string),
  15031. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  15032. return castSlice(strSymbols, 0, end).join('');
  15033. }
  15034. /**
  15035. * Removes leading whitespace or specified characters from `string`.
  15036. *
  15037. * @static
  15038. * @memberOf _
  15039. * @since 4.0.0
  15040. * @category String
  15041. * @param {string} [string=''] The string to trim.
  15042. * @param {string} [chars=whitespace] The characters to trim.
  15043. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15044. * @returns {string} Returns the trimmed string.
  15045. * @example
  15046. *
  15047. * _.trimStart(' abc ');
  15048. * // => 'abc '
  15049. *
  15050. * _.trimStart('-_-abc-_-', '_-');
  15051. * // => 'abc-_-'
  15052. */
  15053. function trimStart(string, chars, guard) {
  15054. string = toString(string);
  15055. if (string && (guard || chars === undefined)) {
  15056. return string.replace(reTrimStart, '');
  15057. }
  15058. if (!string || !(chars = baseToString(chars))) {
  15059. return string;
  15060. }
  15061. var strSymbols = stringToArray(string),
  15062. start = charsStartIndex(strSymbols, stringToArray(chars));
  15063. return castSlice(strSymbols, start).join('');
  15064. }
  15065. /**
  15066. * Truncates `string` if it's longer than the given maximum string length.
  15067. * The last characters of the truncated string are replaced with the omission
  15068. * string which defaults to "...".
  15069. *
  15070. * @static
  15071. * @memberOf _
  15072. * @since 4.0.0
  15073. * @category String
  15074. * @param {string} [string=''] The string to truncate.
  15075. * @param {Object} [options={}] The options object.
  15076. * @param {number} [options.length=30] The maximum string length.
  15077. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  15078. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  15079. * @returns {string} Returns the truncated string.
  15080. * @example
  15081. *
  15082. * _.truncate('hi-diddly-ho there, neighborino');
  15083. * // => 'hi-diddly-ho there, neighbo...'
  15084. *
  15085. * _.truncate('hi-diddly-ho there, neighborino', {
  15086. * 'length': 24,
  15087. * 'separator': ' '
  15088. * });
  15089. * // => 'hi-diddly-ho there,...'
  15090. *
  15091. * _.truncate('hi-diddly-ho there, neighborino', {
  15092. * 'length': 24,
  15093. * 'separator': /,? +/
  15094. * });
  15095. * // => 'hi-diddly-ho there...'
  15096. *
  15097. * _.truncate('hi-diddly-ho there, neighborino', {
  15098. * 'omission': ' [...]'
  15099. * });
  15100. * // => 'hi-diddly-ho there, neig [...]'
  15101. */
  15102. function truncate(string, options) {
  15103. var length = DEFAULT_TRUNC_LENGTH,
  15104. omission = DEFAULT_TRUNC_OMISSION;
  15105. if (isObject(options)) {
  15106. var separator = 'separator' in options ? options.separator : separator;
  15107. length = 'length' in options ? toInteger(options.length) : length;
  15108. omission = 'omission' in options ? baseToString(options.omission) : omission;
  15109. }
  15110. string = toString(string);
  15111. var strLength = string.length;
  15112. if (hasUnicode(string)) {
  15113. var strSymbols = stringToArray(string);
  15114. strLength = strSymbols.length;
  15115. }
  15116. if (length >= strLength) {
  15117. return string;
  15118. }
  15119. var end = length - stringSize(omission);
  15120. if (end < 1) {
  15121. return omission;
  15122. }
  15123. var result = strSymbols
  15124. ? castSlice(strSymbols, 0, end).join('')
  15125. : string.slice(0, end);
  15126. if (separator === undefined) {
  15127. return result + omission;
  15128. }
  15129. if (strSymbols) {
  15130. end += (result.length - end);
  15131. }
  15132. if (isRegExp(separator)) {
  15133. if (string.slice(end).search(separator)) {
  15134. var match,
  15135. substring = result;
  15136. if (!separator.global) {
  15137. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  15138. }
  15139. separator.lastIndex = 0;
  15140. while ((match = separator.exec(substring))) {
  15141. var newEnd = match.index;
  15142. }
  15143. result = result.slice(0, newEnd === undefined ? end : newEnd);
  15144. }
  15145. } else if (string.indexOf(baseToString(separator), end) != end) {
  15146. var index = result.lastIndexOf(separator);
  15147. if (index > -1) {
  15148. result = result.slice(0, index);
  15149. }
  15150. }
  15151. return result + omission;
  15152. }
  15153. /**
  15154. * The inverse of `_.escape`; this method converts the HTML entities
  15155. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  15156. * their corresponding characters.
  15157. *
  15158. * **Note:** No other HTML entities are unescaped. To unescape additional
  15159. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  15160. *
  15161. * @static
  15162. * @memberOf _
  15163. * @since 0.6.0
  15164. * @category String
  15165. * @param {string} [string=''] The string to unescape.
  15166. * @returns {string} Returns the unescaped string.
  15167. * @example
  15168. *
  15169. * _.unescape('fred, barney, &amp; pebbles');
  15170. * // => 'fred, barney, & pebbles'
  15171. */
  15172. function unescape(string) {
  15173. string = toString(string);
  15174. return (string && reHasEscapedHtml.test(string))
  15175. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  15176. : string;
  15177. }
  15178. /**
  15179. * Converts `string`, as space separated words, to upper case.
  15180. *
  15181. * @static
  15182. * @memberOf _
  15183. * @since 4.0.0
  15184. * @category String
  15185. * @param {string} [string=''] The string to convert.
  15186. * @returns {string} Returns the upper cased string.
  15187. * @example
  15188. *
  15189. * _.upperCase('--foo-bar');
  15190. * // => 'FOO BAR'
  15191. *
  15192. * _.upperCase('fooBar');
  15193. * // => 'FOO BAR'
  15194. *
  15195. * _.upperCase('__foo_bar__');
  15196. * // => 'FOO BAR'
  15197. */
  15198. var upperCase = createCompounder(function(result, word, index) {
  15199. return result + (index ? ' ' : '') + word.toUpperCase();
  15200. });
  15201. /**
  15202. * Converts the first character of `string` to upper case.
  15203. *
  15204. * @static
  15205. * @memberOf _
  15206. * @since 4.0.0
  15207. * @category String
  15208. * @param {string} [string=''] The string to convert.
  15209. * @returns {string} Returns the converted string.
  15210. * @example
  15211. *
  15212. * _.upperFirst('fred');
  15213. * // => 'Fred'
  15214. *
  15215. * _.upperFirst('FRED');
  15216. * // => 'FRED'
  15217. */
  15218. var upperFirst = createCaseFirst('toUpperCase');
  15219. /**
  15220. * Splits `string` into an array of its words.
  15221. *
  15222. * @static
  15223. * @memberOf _
  15224. * @since 3.0.0
  15225. * @category String
  15226. * @param {string} [string=''] The string to inspect.
  15227. * @param {RegExp|string} [pattern] The pattern to match words.
  15228. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15229. * @returns {Array} Returns the words of `string`.
  15230. * @example
  15231. *
  15232. * _.words('fred, barney, & pebbles');
  15233. * // => ['fred', 'barney', 'pebbles']
  15234. *
  15235. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  15236. * // => ['fred', 'barney', '&', 'pebbles']
  15237. */
  15238. function words(string, pattern, guard) {
  15239. string = toString(string);
  15240. pattern = guard ? undefined : pattern;
  15241. if (pattern === undefined) {
  15242. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  15243. }
  15244. return string.match(pattern) || [];
  15245. }
  15246. /*------------------------------------------------------------------------*/
  15247. /**
  15248. * Attempts to invoke `func`, returning either the result or the caught error
  15249. * object. Any additional arguments are provided to `func` when it's invoked.
  15250. *
  15251. * @static
  15252. * @memberOf _
  15253. * @since 3.0.0
  15254. * @category Util
  15255. * @param {Function} func The function to attempt.
  15256. * @param {...*} [args] The arguments to invoke `func` with.
  15257. * @returns {*} Returns the `func` result or error object.
  15258. * @example
  15259. *
  15260. * // Avoid throwing errors for invalid selectors.
  15261. * var elements = _.attempt(function(selector) {
  15262. * return document.querySelectorAll(selector);
  15263. * }, '>_>');
  15264. *
  15265. * if (_.isError(elements)) {
  15266. * elements = [];
  15267. * }
  15268. */
  15269. var attempt = baseRest(function(func, args) {
  15270. try {
  15271. return apply(func, undefined, args);
  15272. } catch (e) {
  15273. return isError(e) ? e : new Error(e);
  15274. }
  15275. });
  15276. /**
  15277. * Binds methods of an object to the object itself, overwriting the existing
  15278. * method.
  15279. *
  15280. * **Note:** This method doesn't set the "length" property of bound functions.
  15281. *
  15282. * @static
  15283. * @since 0.1.0
  15284. * @memberOf _
  15285. * @category Util
  15286. * @param {Object} object The object to bind and assign the bound methods to.
  15287. * @param {...(string|string[])} methodNames The object method names to bind.
  15288. * @returns {Object} Returns `object`.
  15289. * @example
  15290. *
  15291. * var view = {
  15292. * 'label': 'docs',
  15293. * 'click': function() {
  15294. * console.log('clicked ' + this.label);
  15295. * }
  15296. * };
  15297. *
  15298. * _.bindAll(view, ['click']);
  15299. * jQuery(element).on('click', view.click);
  15300. * // => Logs 'clicked docs' when clicked.
  15301. */
  15302. var bindAll = flatRest(function(object, methodNames) {
  15303. arrayEach(methodNames, function(key) {
  15304. key = toKey(key);
  15305. baseAssignValue(object, key, bind(object[key], object));
  15306. });
  15307. return object;
  15308. });
  15309. /**
  15310. * Creates a function that iterates over `pairs` and invokes the corresponding
  15311. * function of the first predicate to return truthy. The predicate-function
  15312. * pairs are invoked with the `this` binding and arguments of the created
  15313. * function.
  15314. *
  15315. * @static
  15316. * @memberOf _
  15317. * @since 4.0.0
  15318. * @category Util
  15319. * @param {Array} pairs The predicate-function pairs.
  15320. * @returns {Function} Returns the new composite function.
  15321. * @example
  15322. *
  15323. * var func = _.cond([
  15324. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  15325. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  15326. * [_.stubTrue, _.constant('no match')]
  15327. * ]);
  15328. *
  15329. * func({ 'a': 1, 'b': 2 });
  15330. * // => 'matches A'
  15331. *
  15332. * func({ 'a': 0, 'b': 1 });
  15333. * // => 'matches B'
  15334. *
  15335. * func({ 'a': '1', 'b': '2' });
  15336. * // => 'no match'
  15337. */
  15338. function cond(pairs) {
  15339. var length = pairs == null ? 0 : pairs.length,
  15340. toIteratee = getIteratee();
  15341. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  15342. if (typeof pair[1] != 'function') {
  15343. throw new TypeError(FUNC_ERROR_TEXT);
  15344. }
  15345. return [toIteratee(pair[0]), pair[1]];
  15346. });
  15347. return baseRest(function(args) {
  15348. var index = -1;
  15349. while (++index < length) {
  15350. var pair = pairs[index];
  15351. if (apply(pair[0], this, args)) {
  15352. return apply(pair[1], this, args);
  15353. }
  15354. }
  15355. });
  15356. }
  15357. /**
  15358. * Creates a function that invokes the predicate properties of `source` with
  15359. * the corresponding property values of a given object, returning `true` if
  15360. * all predicates return truthy, else `false`.
  15361. *
  15362. * **Note:** The created function is equivalent to `_.conformsTo` with
  15363. * `source` partially applied.
  15364. *
  15365. * @static
  15366. * @memberOf _
  15367. * @since 4.0.0
  15368. * @category Util
  15369. * @param {Object} source The object of property predicates to conform to.
  15370. * @returns {Function} Returns the new spec function.
  15371. * @example
  15372. *
  15373. * var objects = [
  15374. * { 'a': 2, 'b': 1 },
  15375. * { 'a': 1, 'b': 2 }
  15376. * ];
  15377. *
  15378. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  15379. * // => [{ 'a': 1, 'b': 2 }]
  15380. */
  15381. function conforms(source) {
  15382. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  15383. }
  15384. /**
  15385. * Creates a function that returns `value`.
  15386. *
  15387. * @static
  15388. * @memberOf _
  15389. * @since 2.4.0
  15390. * @category Util
  15391. * @param {*} value The value to return from the new function.
  15392. * @returns {Function} Returns the new constant function.
  15393. * @example
  15394. *
  15395. * var objects = _.times(2, _.constant({ 'a': 1 }));
  15396. *
  15397. * console.log(objects);
  15398. * // => [{ 'a': 1 }, { 'a': 1 }]
  15399. *
  15400. * console.log(objects[0] === objects[1]);
  15401. * // => true
  15402. */
  15403. function constant(value) {
  15404. return function() {
  15405. return value;
  15406. };
  15407. }
  15408. /**
  15409. * Checks `value` to determine whether a default value should be returned in
  15410. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  15411. * or `undefined`.
  15412. *
  15413. * @static
  15414. * @memberOf _
  15415. * @since 4.14.0
  15416. * @category Util
  15417. * @param {*} value The value to check.
  15418. * @param {*} defaultValue The default value.
  15419. * @returns {*} Returns the resolved value.
  15420. * @example
  15421. *
  15422. * _.defaultTo(1, 10);
  15423. * // => 1
  15424. *
  15425. * _.defaultTo(undefined, 10);
  15426. * // => 10
  15427. */
  15428. function defaultTo(value, defaultValue) {
  15429. return (value == null || value !== value) ? defaultValue : value;
  15430. }
  15431. /**
  15432. * Creates a function that returns the result of invoking the given functions
  15433. * with the `this` binding of the created function, where each successive
  15434. * invocation is supplied the return value of the previous.
  15435. *
  15436. * @static
  15437. * @memberOf _
  15438. * @since 3.0.0
  15439. * @category Util
  15440. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  15441. * @returns {Function} Returns the new composite function.
  15442. * @see _.flowRight
  15443. * @example
  15444. *
  15445. * function square(n) {
  15446. * return n * n;
  15447. * }
  15448. *
  15449. * var addSquare = _.flow([_.add, square]);
  15450. * addSquare(1, 2);
  15451. * // => 9
  15452. */
  15453. var flow = createFlow();
  15454. /**
  15455. * This method is like `_.flow` except that it creates a function that
  15456. * invokes the given functions from right to left.
  15457. *
  15458. * @static
  15459. * @since 3.0.0
  15460. * @memberOf _
  15461. * @category Util
  15462. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  15463. * @returns {Function} Returns the new composite function.
  15464. * @see _.flow
  15465. * @example
  15466. *
  15467. * function square(n) {
  15468. * return n * n;
  15469. * }
  15470. *
  15471. * var addSquare = _.flowRight([square, _.add]);
  15472. * addSquare(1, 2);
  15473. * // => 9
  15474. */
  15475. var flowRight = createFlow(true);
  15476. /**
  15477. * This method returns the first argument it receives.
  15478. *
  15479. * @static
  15480. * @since 0.1.0
  15481. * @memberOf _
  15482. * @category Util
  15483. * @param {*} value Any value.
  15484. * @returns {*} Returns `value`.
  15485. * @example
  15486. *
  15487. * var object = { 'a': 1 };
  15488. *
  15489. * console.log(_.identity(object) === object);
  15490. * // => true
  15491. */
  15492. function identity(value) {
  15493. return value;
  15494. }
  15495. /**
  15496. * Creates a function that invokes `func` with the arguments of the created
  15497. * function. If `func` is a property name, the created function returns the
  15498. * property value for a given element. If `func` is an array or object, the
  15499. * created function returns `true` for elements that contain the equivalent
  15500. * source properties, otherwise it returns `false`.
  15501. *
  15502. * @static
  15503. * @since 4.0.0
  15504. * @memberOf _
  15505. * @category Util
  15506. * @param {*} [func=_.identity] The value to convert to a callback.
  15507. * @returns {Function} Returns the callback.
  15508. * @example
  15509. *
  15510. * var users = [
  15511. * { 'user': 'barney', 'age': 36, 'active': true },
  15512. * { 'user': 'fred', 'age': 40, 'active': false }
  15513. * ];
  15514. *
  15515. * // The `_.matches` iteratee shorthand.
  15516. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  15517. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  15518. *
  15519. * // The `_.matchesProperty` iteratee shorthand.
  15520. * _.filter(users, _.iteratee(['user', 'fred']));
  15521. * // => [{ 'user': 'fred', 'age': 40 }]
  15522. *
  15523. * // The `_.property` iteratee shorthand.
  15524. * _.map(users, _.iteratee('user'));
  15525. * // => ['barney', 'fred']
  15526. *
  15527. * // Create custom iteratee shorthands.
  15528. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  15529. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  15530. * return func.test(string);
  15531. * };
  15532. * });
  15533. *
  15534. * _.filter(['abc', 'def'], /ef/);
  15535. * // => ['def']
  15536. */
  15537. function iteratee(func) {
  15538. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  15539. }
  15540. /**
  15541. * Creates a function that performs a partial deep comparison between a given
  15542. * object and `source`, returning `true` if the given object has equivalent
  15543. * property values, else `false`.
  15544. *
  15545. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  15546. * partially applied.
  15547. *
  15548. * Partial comparisons will match empty array and empty object `source`
  15549. * values against any array or object value, respectively. See `_.isEqual`
  15550. * for a list of supported value comparisons.
  15551. *
  15552. * **Note:** Multiple values can be checked by combining several matchers
  15553. * using `_.overSome`
  15554. *
  15555. * @static
  15556. * @memberOf _
  15557. * @since 3.0.0
  15558. * @category Util
  15559. * @param {Object} source The object of property values to match.
  15560. * @returns {Function} Returns the new spec function.
  15561. * @example
  15562. *
  15563. * var objects = [
  15564. * { 'a': 1, 'b': 2, 'c': 3 },
  15565. * { 'a': 4, 'b': 5, 'c': 6 }
  15566. * ];
  15567. *
  15568. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  15569. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  15570. *
  15571. * // Checking for several possible values
  15572. * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
  15573. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  15574. */
  15575. function matches(source) {
  15576. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  15577. }
  15578. /**
  15579. * Creates a function that performs a partial deep comparison between the
  15580. * value at `path` of a given object to `srcValue`, returning `true` if the
  15581. * object value is equivalent, else `false`.
  15582. *
  15583. * **Note:** Partial comparisons will match empty array and empty object
  15584. * `srcValue` values against any array or object value, respectively. See
  15585. * `_.isEqual` for a list of supported value comparisons.
  15586. *
  15587. * **Note:** Multiple values can be checked by combining several matchers
  15588. * using `_.overSome`
  15589. *
  15590. * @static
  15591. * @memberOf _
  15592. * @since 3.2.0
  15593. * @category Util
  15594. * @param {Array|string} path The path of the property to get.
  15595. * @param {*} srcValue The value to match.
  15596. * @returns {Function} Returns the new spec function.
  15597. * @example
  15598. *
  15599. * var objects = [
  15600. * { 'a': 1, 'b': 2, 'c': 3 },
  15601. * { 'a': 4, 'b': 5, 'c': 6 }
  15602. * ];
  15603. *
  15604. * _.find(objects, _.matchesProperty('a', 4));
  15605. * // => { 'a': 4, 'b': 5, 'c': 6 }
  15606. *
  15607. * // Checking for several possible values
  15608. * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
  15609. * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
  15610. */
  15611. function matchesProperty(path, srcValue) {
  15612. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  15613. }
  15614. /**
  15615. * Creates a function that invokes the method at `path` of a given object.
  15616. * Any additional arguments are provided to the invoked method.
  15617. *
  15618. * @static
  15619. * @memberOf _
  15620. * @since 3.7.0
  15621. * @category Util
  15622. * @param {Array|string} path The path of the method to invoke.
  15623. * @param {...*} [args] The arguments to invoke the method with.
  15624. * @returns {Function} Returns the new invoker function.
  15625. * @example
  15626. *
  15627. * var objects = [
  15628. * { 'a': { 'b': _.constant(2) } },
  15629. * { 'a': { 'b': _.constant(1) } }
  15630. * ];
  15631. *
  15632. * _.map(objects, _.method('a.b'));
  15633. * // => [2, 1]
  15634. *
  15635. * _.map(objects, _.method(['a', 'b']));
  15636. * // => [2, 1]
  15637. */
  15638. var method = baseRest(function(path, args) {
  15639. return function(object) {
  15640. return baseInvoke(object, path, args);
  15641. };
  15642. });
  15643. /**
  15644. * The opposite of `_.method`; this method creates a function that invokes
  15645. * the method at a given path of `object`. Any additional arguments are
  15646. * provided to the invoked method.
  15647. *
  15648. * @static
  15649. * @memberOf _
  15650. * @since 3.7.0
  15651. * @category Util
  15652. * @param {Object} object The object to query.
  15653. * @param {...*} [args] The arguments to invoke the method with.
  15654. * @returns {Function} Returns the new invoker function.
  15655. * @example
  15656. *
  15657. * var array = _.times(3, _.constant),
  15658. * object = { 'a': array, 'b': array, 'c': array };
  15659. *
  15660. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  15661. * // => [2, 0]
  15662. *
  15663. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  15664. * // => [2, 0]
  15665. */
  15666. var methodOf = baseRest(function(object, args) {
  15667. return function(path) {
  15668. return baseInvoke(object, path, args);
  15669. };
  15670. });
  15671. /**
  15672. * Adds all own enumerable string keyed function properties of a source
  15673. * object to the destination object. If `object` is a function, then methods
  15674. * are added to its prototype as well.
  15675. *
  15676. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  15677. * avoid conflicts caused by modifying the original.
  15678. *
  15679. * @static
  15680. * @since 0.1.0
  15681. * @memberOf _
  15682. * @category Util
  15683. * @param {Function|Object} [object=lodash] The destination object.
  15684. * @param {Object} source The object of functions to add.
  15685. * @param {Object} [options={}] The options object.
  15686. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  15687. * @returns {Function|Object} Returns `object`.
  15688. * @example
  15689. *
  15690. * function vowels(string) {
  15691. * return _.filter(string, function(v) {
  15692. * return /[aeiou]/i.test(v);
  15693. * });
  15694. * }
  15695. *
  15696. * _.mixin({ 'vowels': vowels });
  15697. * _.vowels('fred');
  15698. * // => ['e']
  15699. *
  15700. * _('fred').vowels().value();
  15701. * // => ['e']
  15702. *
  15703. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  15704. * _('fred').vowels();
  15705. * // => ['e']
  15706. */
  15707. function mixin(object, source, options) {
  15708. var props = keys(source),
  15709. methodNames = baseFunctions(source, props);
  15710. if (options == null &&
  15711. !(isObject(source) && (methodNames.length || !props.length))) {
  15712. options = source;
  15713. source = object;
  15714. object = this;
  15715. methodNames = baseFunctions(source, keys(source));
  15716. }
  15717. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  15718. isFunc = isFunction(object);
  15719. arrayEach(methodNames, function(methodName) {
  15720. var func = source[methodName];
  15721. object[methodName] = func;
  15722. if (isFunc) {
  15723. object.prototype[methodName] = function() {
  15724. var chainAll = this.__chain__;
  15725. if (chain || chainAll) {
  15726. var result = object(this.__wrapped__),
  15727. actions = result.__actions__ = copyArray(this.__actions__);
  15728. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  15729. result.__chain__ = chainAll;
  15730. return result;
  15731. }
  15732. return func.apply(object, arrayPush([this.value()], arguments));
  15733. };
  15734. }
  15735. });
  15736. return object;
  15737. }
  15738. /**
  15739. * Reverts the `_` variable to its previous value and returns a reference to
  15740. * the `lodash` function.
  15741. *
  15742. * @static
  15743. * @since 0.1.0
  15744. * @memberOf _
  15745. * @category Util
  15746. * @returns {Function} Returns the `lodash` function.
  15747. * @example
  15748. *
  15749. * var lodash = _.noConflict();
  15750. */
  15751. function noConflict() {
  15752. if (root._ === this) {
  15753. root._ = oldDash;
  15754. }
  15755. return this;
  15756. }
  15757. /**
  15758. * This method returns `undefined`.
  15759. *
  15760. * @static
  15761. * @memberOf _
  15762. * @since 2.3.0
  15763. * @category Util
  15764. * @example
  15765. *
  15766. * _.times(2, _.noop);
  15767. * // => [undefined, undefined]
  15768. */
  15769. function noop() {
  15770. // No operation performed.
  15771. }
  15772. /**
  15773. * Creates a function that gets the argument at index `n`. If `n` is negative,
  15774. * the nth argument from the end is returned.
  15775. *
  15776. * @static
  15777. * @memberOf _
  15778. * @since 4.0.0
  15779. * @category Util
  15780. * @param {number} [n=0] The index of the argument to return.
  15781. * @returns {Function} Returns the new pass-thru function.
  15782. * @example
  15783. *
  15784. * var func = _.nthArg(1);
  15785. * func('a', 'b', 'c', 'd');
  15786. * // => 'b'
  15787. *
  15788. * var func = _.nthArg(-2);
  15789. * func('a', 'b', 'c', 'd');
  15790. * // => 'c'
  15791. */
  15792. function nthArg(n) {
  15793. n = toInteger(n);
  15794. return baseRest(function(args) {
  15795. return baseNth(args, n);
  15796. });
  15797. }
  15798. /**
  15799. * Creates a function that invokes `iteratees` with the arguments it receives
  15800. * and returns their results.
  15801. *
  15802. * @static
  15803. * @memberOf _
  15804. * @since 4.0.0
  15805. * @category Util
  15806. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  15807. * The iteratees to invoke.
  15808. * @returns {Function} Returns the new function.
  15809. * @example
  15810. *
  15811. * var func = _.over([Math.max, Math.min]);
  15812. *
  15813. * func(1, 2, 3, 4);
  15814. * // => [4, 1]
  15815. */
  15816. var over = createOver(arrayMap);
  15817. /**
  15818. * Creates a function that checks if **all** of the `predicates` return
  15819. * truthy when invoked with the arguments it receives.
  15820. *
  15821. * Following shorthands are possible for providing predicates.
  15822. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  15823. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  15824. *
  15825. * @static
  15826. * @memberOf _
  15827. * @since 4.0.0
  15828. * @category Util
  15829. * @param {...(Function|Function[])} [predicates=[_.identity]]
  15830. * The predicates to check.
  15831. * @returns {Function} Returns the new function.
  15832. * @example
  15833. *
  15834. * var func = _.overEvery([Boolean, isFinite]);
  15835. *
  15836. * func('1');
  15837. * // => true
  15838. *
  15839. * func(null);
  15840. * // => false
  15841. *
  15842. * func(NaN);
  15843. * // => false
  15844. */
  15845. var overEvery = createOver(arrayEvery);
  15846. /**
  15847. * Creates a function that checks if **any** of the `predicates` return
  15848. * truthy when invoked with the arguments it receives.
  15849. *
  15850. * Following shorthands are possible for providing predicates.
  15851. * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
  15852. * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
  15853. *
  15854. * @static
  15855. * @memberOf _
  15856. * @since 4.0.0
  15857. * @category Util
  15858. * @param {...(Function|Function[])} [predicates=[_.identity]]
  15859. * The predicates to check.
  15860. * @returns {Function} Returns the new function.
  15861. * @example
  15862. *
  15863. * var func = _.overSome([Boolean, isFinite]);
  15864. *
  15865. * func('1');
  15866. * // => true
  15867. *
  15868. * func(null);
  15869. * // => true
  15870. *
  15871. * func(NaN);
  15872. * // => false
  15873. *
  15874. * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
  15875. * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
  15876. */
  15877. var overSome = createOver(arraySome);
  15878. /**
  15879. * Creates a function that returns the value at `path` of a given object.
  15880. *
  15881. * @static
  15882. * @memberOf _
  15883. * @since 2.4.0
  15884. * @category Util
  15885. * @param {Array|string} path The path of the property to get.
  15886. * @returns {Function} Returns the new accessor function.
  15887. * @example
  15888. *
  15889. * var objects = [
  15890. * { 'a': { 'b': 2 } },
  15891. * { 'a': { 'b': 1 } }
  15892. * ];
  15893. *
  15894. * _.map(objects, _.property('a.b'));
  15895. * // => [2, 1]
  15896. *
  15897. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  15898. * // => [1, 2]
  15899. */
  15900. function property(path) {
  15901. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  15902. }
  15903. /**
  15904. * The opposite of `_.property`; this method creates a function that returns
  15905. * the value at a given path of `object`.
  15906. *
  15907. * @static
  15908. * @memberOf _
  15909. * @since 3.0.0
  15910. * @category Util
  15911. * @param {Object} object The object to query.
  15912. * @returns {Function} Returns the new accessor function.
  15913. * @example
  15914. *
  15915. * var array = [0, 1, 2],
  15916. * object = { 'a': array, 'b': array, 'c': array };
  15917. *
  15918. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  15919. * // => [2, 0]
  15920. *
  15921. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  15922. * // => [2, 0]
  15923. */
  15924. function propertyOf(object) {
  15925. return function(path) {
  15926. return object == null ? undefined : baseGet(object, path);
  15927. };
  15928. }
  15929. /**
  15930. * Creates an array of numbers (positive and/or negative) progressing from
  15931. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  15932. * `start` is specified without an `end` or `step`. If `end` is not specified,
  15933. * it's set to `start` with `start` then set to `0`.
  15934. *
  15935. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  15936. * floating-point values which can produce unexpected results.
  15937. *
  15938. * @static
  15939. * @since 0.1.0
  15940. * @memberOf _
  15941. * @category Util
  15942. * @param {number} [start=0] The start of the range.
  15943. * @param {number} end The end of the range.
  15944. * @param {number} [step=1] The value to increment or decrement by.
  15945. * @returns {Array} Returns the range of numbers.
  15946. * @see _.inRange, _.rangeRight
  15947. * @example
  15948. *
  15949. * _.range(4);
  15950. * // => [0, 1, 2, 3]
  15951. *
  15952. * _.range(-4);
  15953. * // => [0, -1, -2, -3]
  15954. *
  15955. * _.range(1, 5);
  15956. * // => [1, 2, 3, 4]
  15957. *
  15958. * _.range(0, 20, 5);
  15959. * // => [0, 5, 10, 15]
  15960. *
  15961. * _.range(0, -4, -1);
  15962. * // => [0, -1, -2, -3]
  15963. *
  15964. * _.range(1, 4, 0);
  15965. * // => [1, 1, 1]
  15966. *
  15967. * _.range(0);
  15968. * // => []
  15969. */
  15970. var range = createRange();
  15971. /**
  15972. * This method is like `_.range` except that it populates values in
  15973. * descending order.
  15974. *
  15975. * @static
  15976. * @memberOf _
  15977. * @since 4.0.0
  15978. * @category Util
  15979. * @param {number} [start=0] The start of the range.
  15980. * @param {number} end The end of the range.
  15981. * @param {number} [step=1] The value to increment or decrement by.
  15982. * @returns {Array} Returns the range of numbers.
  15983. * @see _.inRange, _.range
  15984. * @example
  15985. *
  15986. * _.rangeRight(4);
  15987. * // => [3, 2, 1, 0]
  15988. *
  15989. * _.rangeRight(-4);
  15990. * // => [-3, -2, -1, 0]
  15991. *
  15992. * _.rangeRight(1, 5);
  15993. * // => [4, 3, 2, 1]
  15994. *
  15995. * _.rangeRight(0, 20, 5);
  15996. * // => [15, 10, 5, 0]
  15997. *
  15998. * _.rangeRight(0, -4, -1);
  15999. * // => [-3, -2, -1, 0]
  16000. *
  16001. * _.rangeRight(1, 4, 0);
  16002. * // => [1, 1, 1]
  16003. *
  16004. * _.rangeRight(0);
  16005. * // => []
  16006. */
  16007. var rangeRight = createRange(true);
  16008. /**
  16009. * This method returns a new empty array.
  16010. *
  16011. * @static
  16012. * @memberOf _
  16013. * @since 4.13.0
  16014. * @category Util
  16015. * @returns {Array} Returns the new empty array.
  16016. * @example
  16017. *
  16018. * var arrays = _.times(2, _.stubArray);
  16019. *
  16020. * console.log(arrays);
  16021. * // => [[], []]
  16022. *
  16023. * console.log(arrays[0] === arrays[1]);
  16024. * // => false
  16025. */
  16026. function stubArray() {
  16027. return [];
  16028. }
  16029. /**
  16030. * This method returns `false`.
  16031. *
  16032. * @static
  16033. * @memberOf _
  16034. * @since 4.13.0
  16035. * @category Util
  16036. * @returns {boolean} Returns `false`.
  16037. * @example
  16038. *
  16039. * _.times(2, _.stubFalse);
  16040. * // => [false, false]
  16041. */
  16042. function stubFalse() {
  16043. return false;
  16044. }
  16045. /**
  16046. * This method returns a new empty object.
  16047. *
  16048. * @static
  16049. * @memberOf _
  16050. * @since 4.13.0
  16051. * @category Util
  16052. * @returns {Object} Returns the new empty object.
  16053. * @example
  16054. *
  16055. * var objects = _.times(2, _.stubObject);
  16056. *
  16057. * console.log(objects);
  16058. * // => [{}, {}]
  16059. *
  16060. * console.log(objects[0] === objects[1]);
  16061. * // => false
  16062. */
  16063. function stubObject() {
  16064. return {};
  16065. }
  16066. /**
  16067. * This method returns an empty string.
  16068. *
  16069. * @static
  16070. * @memberOf _
  16071. * @since 4.13.0
  16072. * @category Util
  16073. * @returns {string} Returns the empty string.
  16074. * @example
  16075. *
  16076. * _.times(2, _.stubString);
  16077. * // => ['', '']
  16078. */
  16079. function stubString() {
  16080. return '';
  16081. }
  16082. /**
  16083. * This method returns `true`.
  16084. *
  16085. * @static
  16086. * @memberOf _
  16087. * @since 4.13.0
  16088. * @category Util
  16089. * @returns {boolean} Returns `true`.
  16090. * @example
  16091. *
  16092. * _.times(2, _.stubTrue);
  16093. * // => [true, true]
  16094. */
  16095. function stubTrue() {
  16096. return true;
  16097. }
  16098. /**
  16099. * Invokes the iteratee `n` times, returning an array of the results of
  16100. * each invocation. The iteratee is invoked with one argument; (index).
  16101. *
  16102. * @static
  16103. * @since 0.1.0
  16104. * @memberOf _
  16105. * @category Util
  16106. * @param {number} n The number of times to invoke `iteratee`.
  16107. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  16108. * @returns {Array} Returns the array of results.
  16109. * @example
  16110. *
  16111. * _.times(3, String);
  16112. * // => ['0', '1', '2']
  16113. *
  16114. * _.times(4, _.constant(0));
  16115. * // => [0, 0, 0, 0]
  16116. */
  16117. function times(n, iteratee) {
  16118. n = toInteger(n);
  16119. if (n < 1 || n > MAX_SAFE_INTEGER) {
  16120. return [];
  16121. }
  16122. var index = MAX_ARRAY_LENGTH,
  16123. length = nativeMin(n, MAX_ARRAY_LENGTH);
  16124. iteratee = getIteratee(iteratee);
  16125. n -= MAX_ARRAY_LENGTH;
  16126. var result = baseTimes(length, iteratee);
  16127. while (++index < n) {
  16128. iteratee(index);
  16129. }
  16130. return result;
  16131. }
  16132. /**
  16133. * Converts `value` to a property path array.
  16134. *
  16135. * @static
  16136. * @memberOf _
  16137. * @since 4.0.0
  16138. * @category Util
  16139. * @param {*} value The value to convert.
  16140. * @returns {Array} Returns the new property path array.
  16141. * @example
  16142. *
  16143. * _.toPath('a.b.c');
  16144. * // => ['a', 'b', 'c']
  16145. *
  16146. * _.toPath('a[0].b.c');
  16147. * // => ['a', '0', 'b', 'c']
  16148. */
  16149. function toPath(value) {
  16150. if (isArray(value)) {
  16151. return arrayMap(value, toKey);
  16152. }
  16153. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  16154. }
  16155. /**
  16156. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  16157. *
  16158. * @static
  16159. * @since 0.1.0
  16160. * @memberOf _
  16161. * @category Util
  16162. * @param {string} [prefix=''] The value to prefix the ID with.
  16163. * @returns {string} Returns the unique ID.
  16164. * @example
  16165. *
  16166. * _.uniqueId('contact_');
  16167. * // => 'contact_104'
  16168. *
  16169. * _.uniqueId();
  16170. * // => '105'
  16171. */
  16172. function uniqueId(prefix) {
  16173. var id = ++idCounter;
  16174. return toString(prefix) + id;
  16175. }
  16176. /*------------------------------------------------------------------------*/
  16177. /**
  16178. * Adds two numbers.
  16179. *
  16180. * @static
  16181. * @memberOf _
  16182. * @since 3.4.0
  16183. * @category Math
  16184. * @param {number} augend The first number in an addition.
  16185. * @param {number} addend The second number in an addition.
  16186. * @returns {number} Returns the total.
  16187. * @example
  16188. *
  16189. * _.add(6, 4);
  16190. * // => 10
  16191. */
  16192. var add = createMathOperation(function(augend, addend) {
  16193. return augend + addend;
  16194. }, 0);
  16195. /**
  16196. * Computes `number` rounded up to `precision`.
  16197. *
  16198. * @static
  16199. * @memberOf _
  16200. * @since 3.10.0
  16201. * @category Math
  16202. * @param {number} number The number to round up.
  16203. * @param {number} [precision=0] The precision to round up to.
  16204. * @returns {number} Returns the rounded up number.
  16205. * @example
  16206. *
  16207. * _.ceil(4.006);
  16208. * // => 5
  16209. *
  16210. * _.ceil(6.004, 2);
  16211. * // => 6.01
  16212. *
  16213. * _.ceil(6040, -2);
  16214. * // => 6100
  16215. */
  16216. var ceil = createRound('ceil');
  16217. /**
  16218. * Divide two numbers.
  16219. *
  16220. * @static
  16221. * @memberOf _
  16222. * @since 4.7.0
  16223. * @category Math
  16224. * @param {number} dividend The first number in a division.
  16225. * @param {number} divisor The second number in a division.
  16226. * @returns {number} Returns the quotient.
  16227. * @example
  16228. *
  16229. * _.divide(6, 4);
  16230. * // => 1.5
  16231. */
  16232. var divide = createMathOperation(function(dividend, divisor) {
  16233. return dividend / divisor;
  16234. }, 1);
  16235. /**
  16236. * Computes `number` rounded down to `precision`.
  16237. *
  16238. * @static
  16239. * @memberOf _
  16240. * @since 3.10.0
  16241. * @category Math
  16242. * @param {number} number The number to round down.
  16243. * @param {number} [precision=0] The precision to round down to.
  16244. * @returns {number} Returns the rounded down number.
  16245. * @example
  16246. *
  16247. * _.floor(4.006);
  16248. * // => 4
  16249. *
  16250. * _.floor(0.046, 2);
  16251. * // => 0.04
  16252. *
  16253. * _.floor(4060, -2);
  16254. * // => 4000
  16255. */
  16256. var floor = createRound('floor');
  16257. /**
  16258. * Computes the maximum value of `array`. If `array` is empty or falsey,
  16259. * `undefined` is returned.
  16260. *
  16261. * @static
  16262. * @since 0.1.0
  16263. * @memberOf _
  16264. * @category Math
  16265. * @param {Array} array The array to iterate over.
  16266. * @returns {*} Returns the maximum value.
  16267. * @example
  16268. *
  16269. * _.max([4, 2, 8, 6]);
  16270. * // => 8
  16271. *
  16272. * _.max([]);
  16273. * // => undefined
  16274. */
  16275. function max(array) {
  16276. return (array && array.length)
  16277. ? baseExtremum(array, identity, baseGt)
  16278. : undefined;
  16279. }
  16280. /**
  16281. * This method is like `_.max` except that it accepts `iteratee` which is
  16282. * invoked for each element in `array` to generate the criterion by which
  16283. * the value is ranked. The iteratee is invoked with one argument: (value).
  16284. *
  16285. * @static
  16286. * @memberOf _
  16287. * @since 4.0.0
  16288. * @category Math
  16289. * @param {Array} array The array to iterate over.
  16290. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16291. * @returns {*} Returns the maximum value.
  16292. * @example
  16293. *
  16294. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  16295. *
  16296. * _.maxBy(objects, function(o) { return o.n; });
  16297. * // => { 'n': 2 }
  16298. *
  16299. * // The `_.property` iteratee shorthand.
  16300. * _.maxBy(objects, 'n');
  16301. * // => { 'n': 2 }
  16302. */
  16303. function maxBy(array, iteratee) {
  16304. return (array && array.length)
  16305. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  16306. : undefined;
  16307. }
  16308. /**
  16309. * Computes the mean of the values in `array`.
  16310. *
  16311. * @static
  16312. * @memberOf _
  16313. * @since 4.0.0
  16314. * @category Math
  16315. * @param {Array} array The array to iterate over.
  16316. * @returns {number} Returns the mean.
  16317. * @example
  16318. *
  16319. * _.mean([4, 2, 8, 6]);
  16320. * // => 5
  16321. */
  16322. function mean(array) {
  16323. return baseMean(array, identity);
  16324. }
  16325. /**
  16326. * This method is like `_.mean` except that it accepts `iteratee` which is
  16327. * invoked for each element in `array` to generate the value to be averaged.
  16328. * The iteratee is invoked with one argument: (value).
  16329. *
  16330. * @static
  16331. * @memberOf _
  16332. * @since 4.7.0
  16333. * @category Math
  16334. * @param {Array} array The array to iterate over.
  16335. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16336. * @returns {number} Returns the mean.
  16337. * @example
  16338. *
  16339. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  16340. *
  16341. * _.meanBy(objects, function(o) { return o.n; });
  16342. * // => 5
  16343. *
  16344. * // The `_.property` iteratee shorthand.
  16345. * _.meanBy(objects, 'n');
  16346. * // => 5
  16347. */
  16348. function meanBy(array, iteratee) {
  16349. return baseMean(array, getIteratee(iteratee, 2));
  16350. }
  16351. /**
  16352. * Computes the minimum value of `array`. If `array` is empty or falsey,
  16353. * `undefined` is returned.
  16354. *
  16355. * @static
  16356. * @since 0.1.0
  16357. * @memberOf _
  16358. * @category Math
  16359. * @param {Array} array The array to iterate over.
  16360. * @returns {*} Returns the minimum value.
  16361. * @example
  16362. *
  16363. * _.min([4, 2, 8, 6]);
  16364. * // => 2
  16365. *
  16366. * _.min([]);
  16367. * // => undefined
  16368. */
  16369. function min(array) {
  16370. return (array && array.length)
  16371. ? baseExtremum(array, identity, baseLt)
  16372. : undefined;
  16373. }
  16374. /**
  16375. * This method is like `_.min` except that it accepts `iteratee` which is
  16376. * invoked for each element in `array` to generate the criterion by which
  16377. * the value is ranked. The iteratee is invoked with one argument: (value).
  16378. *
  16379. * @static
  16380. * @memberOf _
  16381. * @since 4.0.0
  16382. * @category Math
  16383. * @param {Array} array The array to iterate over.
  16384. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16385. * @returns {*} Returns the minimum value.
  16386. * @example
  16387. *
  16388. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  16389. *
  16390. * _.minBy(objects, function(o) { return o.n; });
  16391. * // => { 'n': 1 }
  16392. *
  16393. * // The `_.property` iteratee shorthand.
  16394. * _.minBy(objects, 'n');
  16395. * // => { 'n': 1 }
  16396. */
  16397. function minBy(array, iteratee) {
  16398. return (array && array.length)
  16399. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  16400. : undefined;
  16401. }
  16402. /**
  16403. * Multiply two numbers.
  16404. *
  16405. * @static
  16406. * @memberOf _
  16407. * @since 4.7.0
  16408. * @category Math
  16409. * @param {number} multiplier The first number in a multiplication.
  16410. * @param {number} multiplicand The second number in a multiplication.
  16411. * @returns {number} Returns the product.
  16412. * @example
  16413. *
  16414. * _.multiply(6, 4);
  16415. * // => 24
  16416. */
  16417. var multiply = createMathOperation(function(multiplier, multiplicand) {
  16418. return multiplier * multiplicand;
  16419. }, 1);
  16420. /**
  16421. * Computes `number` rounded to `precision`.
  16422. *
  16423. * @static
  16424. * @memberOf _
  16425. * @since 3.10.0
  16426. * @category Math
  16427. * @param {number} number The number to round.
  16428. * @param {number} [precision=0] The precision to round to.
  16429. * @returns {number} Returns the rounded number.
  16430. * @example
  16431. *
  16432. * _.round(4.006);
  16433. * // => 4
  16434. *
  16435. * _.round(4.006, 2);
  16436. * // => 4.01
  16437. *
  16438. * _.round(4060, -2);
  16439. * // => 4100
  16440. */
  16441. var round = createRound('round');
  16442. /**
  16443. * Subtract two numbers.
  16444. *
  16445. * @static
  16446. * @memberOf _
  16447. * @since 4.0.0
  16448. * @category Math
  16449. * @param {number} minuend The first number in a subtraction.
  16450. * @param {number} subtrahend The second number in a subtraction.
  16451. * @returns {number} Returns the difference.
  16452. * @example
  16453. *
  16454. * _.subtract(6, 4);
  16455. * // => 2
  16456. */
  16457. var subtract = createMathOperation(function(minuend, subtrahend) {
  16458. return minuend - subtrahend;
  16459. }, 0);
  16460. /**
  16461. * Computes the sum of the values in `array`.
  16462. *
  16463. * @static
  16464. * @memberOf _
  16465. * @since 3.4.0
  16466. * @category Math
  16467. * @param {Array} array The array to iterate over.
  16468. * @returns {number} Returns the sum.
  16469. * @example
  16470. *
  16471. * _.sum([4, 2, 8, 6]);
  16472. * // => 20
  16473. */
  16474. function sum(array) {
  16475. return (array && array.length)
  16476. ? baseSum(array, identity)
  16477. : 0;
  16478. }
  16479. /**
  16480. * This method is like `_.sum` except that it accepts `iteratee` which is
  16481. * invoked for each element in `array` to generate the value to be summed.
  16482. * The iteratee is invoked with one argument: (value).
  16483. *
  16484. * @static
  16485. * @memberOf _
  16486. * @since 4.0.0
  16487. * @category Math
  16488. * @param {Array} array The array to iterate over.
  16489. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  16490. * @returns {number} Returns the sum.
  16491. * @example
  16492. *
  16493. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  16494. *
  16495. * _.sumBy(objects, function(o) { return o.n; });
  16496. * // => 20
  16497. *
  16498. * // The `_.property` iteratee shorthand.
  16499. * _.sumBy(objects, 'n');
  16500. * // => 20
  16501. */
  16502. function sumBy(array, iteratee) {
  16503. return (array && array.length)
  16504. ? baseSum(array, getIteratee(iteratee, 2))
  16505. : 0;
  16506. }
  16507. /*------------------------------------------------------------------------*/
  16508. // Add methods that return wrapped values in chain sequences.
  16509. lodash.after = after;
  16510. lodash.ary = ary;
  16511. lodash.assign = assign;
  16512. lodash.assignIn = assignIn;
  16513. lodash.assignInWith = assignInWith;
  16514. lodash.assignWith = assignWith;
  16515. lodash.at = at;
  16516. lodash.before = before;
  16517. lodash.bind = bind;
  16518. lodash.bindAll = bindAll;
  16519. lodash.bindKey = bindKey;
  16520. lodash.castArray = castArray;
  16521. lodash.chain = chain;
  16522. lodash.chunk = chunk;
  16523. lodash.compact = compact;
  16524. lodash.concat = concat;
  16525. lodash.cond = cond;
  16526. lodash.conforms = conforms;
  16527. lodash.constant = constant;
  16528. lodash.countBy = countBy;
  16529. lodash.create = create;
  16530. lodash.curry = curry;
  16531. lodash.curryRight = curryRight;
  16532. lodash.debounce = debounce;
  16533. lodash.defaults = defaults;
  16534. lodash.defaultsDeep = defaultsDeep;
  16535. lodash.defer = defer;
  16536. lodash.delay = delay;
  16537. lodash.difference = difference;
  16538. lodash.differenceBy = differenceBy;
  16539. lodash.differenceWith = differenceWith;
  16540. lodash.drop = drop;
  16541. lodash.dropRight = dropRight;
  16542. lodash.dropRightWhile = dropRightWhile;
  16543. lodash.dropWhile = dropWhile;
  16544. lodash.fill = fill;
  16545. lodash.filter = filter;
  16546. lodash.flatMap = flatMap;
  16547. lodash.flatMapDeep = flatMapDeep;
  16548. lodash.flatMapDepth = flatMapDepth;
  16549. lodash.flatten = flatten;
  16550. lodash.flattenDeep = flattenDeep;
  16551. lodash.flattenDepth = flattenDepth;
  16552. lodash.flip = flip;
  16553. lodash.flow = flow;
  16554. lodash.flowRight = flowRight;
  16555. lodash.fromPairs = fromPairs;
  16556. lodash.functions = functions;
  16557. lodash.functionsIn = functionsIn;
  16558. lodash.groupBy = groupBy;
  16559. lodash.initial = initial;
  16560. lodash.intersection = intersection;
  16561. lodash.intersectionBy = intersectionBy;
  16562. lodash.intersectionWith = intersectionWith;
  16563. lodash.invert = invert;
  16564. lodash.invertBy = invertBy;
  16565. lodash.invokeMap = invokeMap;
  16566. lodash.iteratee = iteratee;
  16567. lodash.keyBy = keyBy;
  16568. lodash.keys = keys;
  16569. lodash.keysIn = keysIn;
  16570. lodash.map = map;
  16571. lodash.mapKeys = mapKeys;
  16572. lodash.mapValues = mapValues;
  16573. lodash.matches = matches;
  16574. lodash.matchesProperty = matchesProperty;
  16575. lodash.memoize = memoize;
  16576. lodash.merge = merge;
  16577. lodash.mergeWith = mergeWith;
  16578. lodash.method = method;
  16579. lodash.methodOf = methodOf;
  16580. lodash.mixin = mixin;
  16581. lodash.negate = negate;
  16582. lodash.nthArg = nthArg;
  16583. lodash.omit = omit;
  16584. lodash.omitBy = omitBy;
  16585. lodash.once = once;
  16586. lodash.orderBy = orderBy;
  16587. lodash.over = over;
  16588. lodash.overArgs = overArgs;
  16589. lodash.overEvery = overEvery;
  16590. lodash.overSome = overSome;
  16591. lodash.partial = partial;
  16592. lodash.partialRight = partialRight;
  16593. lodash.partition = partition;
  16594. lodash.pick = pick;
  16595. lodash.pickBy = pickBy;
  16596. lodash.property = property;
  16597. lodash.propertyOf = propertyOf;
  16598. lodash.pull = pull;
  16599. lodash.pullAll = pullAll;
  16600. lodash.pullAllBy = pullAllBy;
  16601. lodash.pullAllWith = pullAllWith;
  16602. lodash.pullAt = pullAt;
  16603. lodash.range = range;
  16604. lodash.rangeRight = rangeRight;
  16605. lodash.rearg = rearg;
  16606. lodash.reject = reject;
  16607. lodash.remove = remove;
  16608. lodash.rest = rest;
  16609. lodash.reverse = reverse;
  16610. lodash.sampleSize = sampleSize;
  16611. lodash.set = set;
  16612. lodash.setWith = setWith;
  16613. lodash.shuffle = shuffle;
  16614. lodash.slice = slice;
  16615. lodash.sortBy = sortBy;
  16616. lodash.sortedUniq = sortedUniq;
  16617. lodash.sortedUniqBy = sortedUniqBy;
  16618. lodash.split = split;
  16619. lodash.spread = spread;
  16620. lodash.tail = tail;
  16621. lodash.take = take;
  16622. lodash.takeRight = takeRight;
  16623. lodash.takeRightWhile = takeRightWhile;
  16624. lodash.takeWhile = takeWhile;
  16625. lodash.tap = tap;
  16626. lodash.throttle = throttle;
  16627. lodash.thru = thru;
  16628. lodash.toArray = toArray;
  16629. lodash.toPairs = toPairs;
  16630. lodash.toPairsIn = toPairsIn;
  16631. lodash.toPath = toPath;
  16632. lodash.toPlainObject = toPlainObject;
  16633. lodash.transform = transform;
  16634. lodash.unary = unary;
  16635. lodash.union = union;
  16636. lodash.unionBy = unionBy;
  16637. lodash.unionWith = unionWith;
  16638. lodash.uniq = uniq;
  16639. lodash.uniqBy = uniqBy;
  16640. lodash.uniqWith = uniqWith;
  16641. lodash.unset = unset;
  16642. lodash.unzip = unzip;
  16643. lodash.unzipWith = unzipWith;
  16644. lodash.update = update;
  16645. lodash.updateWith = updateWith;
  16646. lodash.values = values;
  16647. lodash.valuesIn = valuesIn;
  16648. lodash.without = without;
  16649. lodash.words = words;
  16650. lodash.wrap = wrap;
  16651. lodash.xor = xor;
  16652. lodash.xorBy = xorBy;
  16653. lodash.xorWith = xorWith;
  16654. lodash.zip = zip;
  16655. lodash.zipObject = zipObject;
  16656. lodash.zipObjectDeep = zipObjectDeep;
  16657. lodash.zipWith = zipWith;
  16658. // Add aliases.
  16659. lodash.entries = toPairs;
  16660. lodash.entriesIn = toPairsIn;
  16661. lodash.extend = assignIn;
  16662. lodash.extendWith = assignInWith;
  16663. // Add methods to `lodash.prototype`.
  16664. mixin(lodash, lodash);
  16665. /*------------------------------------------------------------------------*/
  16666. // Add methods that return unwrapped values in chain sequences.
  16667. lodash.add = add;
  16668. lodash.attempt = attempt;
  16669. lodash.camelCase = camelCase;
  16670. lodash.capitalize = capitalize;
  16671. lodash.ceil = ceil;
  16672. lodash.clamp = clamp;
  16673. lodash.clone = clone;
  16674. lodash.cloneDeep = cloneDeep;
  16675. lodash.cloneDeepWith = cloneDeepWith;
  16676. lodash.cloneWith = cloneWith;
  16677. lodash.conformsTo = conformsTo;
  16678. lodash.deburr = deburr;
  16679. lodash.defaultTo = defaultTo;
  16680. lodash.divide = divide;
  16681. lodash.endsWith = endsWith;
  16682. lodash.eq = eq;
  16683. lodash.escape = escape;
  16684. lodash.escapeRegExp = escapeRegExp;
  16685. lodash.every = every;
  16686. lodash.find = find;
  16687. lodash.findIndex = findIndex;
  16688. lodash.findKey = findKey;
  16689. lodash.findLast = findLast;
  16690. lodash.findLastIndex = findLastIndex;
  16691. lodash.findLastKey = findLastKey;
  16692. lodash.floor = floor;
  16693. lodash.forEach = forEach;
  16694. lodash.forEachRight = forEachRight;
  16695. lodash.forIn = forIn;
  16696. lodash.forInRight = forInRight;
  16697. lodash.forOwn = forOwn;
  16698. lodash.forOwnRight = forOwnRight;
  16699. lodash.get = get;
  16700. lodash.gt = gt;
  16701. lodash.gte = gte;
  16702. lodash.has = has;
  16703. lodash.hasIn = hasIn;
  16704. lodash.head = head;
  16705. lodash.identity = identity;
  16706. lodash.includes = includes;
  16707. lodash.indexOf = indexOf;
  16708. lodash.inRange = inRange;
  16709. lodash.invoke = invoke;
  16710. lodash.isArguments = isArguments;
  16711. lodash.isArray = isArray;
  16712. lodash.isArrayBuffer = isArrayBuffer;
  16713. lodash.isArrayLike = isArrayLike;
  16714. lodash.isArrayLikeObject = isArrayLikeObject;
  16715. lodash.isBoolean = isBoolean;
  16716. lodash.isBuffer = isBuffer;
  16717. lodash.isDate = isDate;
  16718. lodash.isElement = isElement;
  16719. lodash.isEmpty = isEmpty;
  16720. lodash.isEqual = isEqual;
  16721. lodash.isEqualWith = isEqualWith;
  16722. lodash.isError = isError;
  16723. lodash.isFinite = isFinite;
  16724. lodash.isFunction = isFunction;
  16725. lodash.isInteger = isInteger;
  16726. lodash.isLength = isLength;
  16727. lodash.isMap = isMap;
  16728. lodash.isMatch = isMatch;
  16729. lodash.isMatchWith = isMatchWith;
  16730. lodash.isNaN = isNaN;
  16731. lodash.isNative = isNative;
  16732. lodash.isNil = isNil;
  16733. lodash.isNull = isNull;
  16734. lodash.isNumber = isNumber;
  16735. lodash.isObject = isObject;
  16736. lodash.isObjectLike = isObjectLike;
  16737. lodash.isPlainObject = isPlainObject;
  16738. lodash.isRegExp = isRegExp;
  16739. lodash.isSafeInteger = isSafeInteger;
  16740. lodash.isSet = isSet;
  16741. lodash.isString = isString;
  16742. lodash.isSymbol = isSymbol;
  16743. lodash.isTypedArray = isTypedArray;
  16744. lodash.isUndefined = isUndefined;
  16745. lodash.isWeakMap = isWeakMap;
  16746. lodash.isWeakSet = isWeakSet;
  16747. lodash.join = join;
  16748. lodash.kebabCase = kebabCase;
  16749. lodash.last = last;
  16750. lodash.lastIndexOf = lastIndexOf;
  16751. lodash.lowerCase = lowerCase;
  16752. lodash.lowerFirst = lowerFirst;
  16753. lodash.lt = lt;
  16754. lodash.lte = lte;
  16755. lodash.max = max;
  16756. lodash.maxBy = maxBy;
  16757. lodash.mean = mean;
  16758. lodash.meanBy = meanBy;
  16759. lodash.min = min;
  16760. lodash.minBy = minBy;
  16761. lodash.stubArray = stubArray;
  16762. lodash.stubFalse = stubFalse;
  16763. lodash.stubObject = stubObject;
  16764. lodash.stubString = stubString;
  16765. lodash.stubTrue = stubTrue;
  16766. lodash.multiply = multiply;
  16767. lodash.nth = nth;
  16768. lodash.noConflict = noConflict;
  16769. lodash.noop = noop;
  16770. lodash.now = now;
  16771. lodash.pad = pad;
  16772. lodash.padEnd = padEnd;
  16773. lodash.padStart = padStart;
  16774. lodash.parseInt = parseInt;
  16775. lodash.random = random;
  16776. lodash.reduce = reduce;
  16777. lodash.reduceRight = reduceRight;
  16778. lodash.repeat = repeat;
  16779. lodash.replace = replace;
  16780. lodash.result = result;
  16781. lodash.round = round;
  16782. lodash.runInContext = runInContext;
  16783. lodash.sample = sample;
  16784. lodash.size = size;
  16785. lodash.snakeCase = snakeCase;
  16786. lodash.some = some;
  16787. lodash.sortedIndex = sortedIndex;
  16788. lodash.sortedIndexBy = sortedIndexBy;
  16789. lodash.sortedIndexOf = sortedIndexOf;
  16790. lodash.sortedLastIndex = sortedLastIndex;
  16791. lodash.sortedLastIndexBy = sortedLastIndexBy;
  16792. lodash.sortedLastIndexOf = sortedLastIndexOf;
  16793. lodash.startCase = startCase;
  16794. lodash.startsWith = startsWith;
  16795. lodash.subtract = subtract;
  16796. lodash.sum = sum;
  16797. lodash.sumBy = sumBy;
  16798. lodash.template = template;
  16799. lodash.times = times;
  16800. lodash.toFinite = toFinite;
  16801. lodash.toInteger = toInteger;
  16802. lodash.toLength = toLength;
  16803. lodash.toLower = toLower;
  16804. lodash.toNumber = toNumber;
  16805. lodash.toSafeInteger = toSafeInteger;
  16806. lodash.toString = toString;
  16807. lodash.toUpper = toUpper;
  16808. lodash.trim = trim;
  16809. lodash.trimEnd = trimEnd;
  16810. lodash.trimStart = trimStart;
  16811. lodash.truncate = truncate;
  16812. lodash.unescape = unescape;
  16813. lodash.uniqueId = uniqueId;
  16814. lodash.upperCase = upperCase;
  16815. lodash.upperFirst = upperFirst;
  16816. // Add aliases.
  16817. lodash.each = forEach;
  16818. lodash.eachRight = forEachRight;
  16819. lodash.first = head;
  16820. mixin(lodash, (function() {
  16821. var source = {};
  16822. baseForOwn(lodash, function(func, methodName) {
  16823. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  16824. source[methodName] = func;
  16825. }
  16826. });
  16827. return source;
  16828. }()), { 'chain': false });
  16829. /*------------------------------------------------------------------------*/
  16830. /**
  16831. * The semantic version number.
  16832. *
  16833. * @static
  16834. * @memberOf _
  16835. * @type {string}
  16836. */
  16837. lodash.VERSION = VERSION;
  16838. // Assign default placeholders.
  16839. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  16840. lodash[methodName].placeholder = lodash;
  16841. });
  16842. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  16843. arrayEach(['drop', 'take'], function(methodName, index) {
  16844. LazyWrapper.prototype[methodName] = function(n) {
  16845. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  16846. var result = (this.__filtered__ && !index)
  16847. ? new LazyWrapper(this)
  16848. : this.clone();
  16849. if (result.__filtered__) {
  16850. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  16851. } else {
  16852. result.__views__.push({
  16853. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  16854. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  16855. });
  16856. }
  16857. return result;
  16858. };
  16859. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  16860. return this.reverse()[methodName](n).reverse();
  16861. };
  16862. });
  16863. // Add `LazyWrapper` methods that accept an `iteratee` value.
  16864. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  16865. var type = index + 1,
  16866. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  16867. LazyWrapper.prototype[methodName] = function(iteratee) {
  16868. var result = this.clone();
  16869. result.__iteratees__.push({
  16870. 'iteratee': getIteratee(iteratee, 3),
  16871. 'type': type
  16872. });
  16873. result.__filtered__ = result.__filtered__ || isFilter;
  16874. return result;
  16875. };
  16876. });
  16877. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  16878. arrayEach(['head', 'last'], function(methodName, index) {
  16879. var takeName = 'take' + (index ? 'Right' : '');
  16880. LazyWrapper.prototype[methodName] = function() {
  16881. return this[takeName](1).value()[0];
  16882. };
  16883. });
  16884. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  16885. arrayEach(['initial', 'tail'], function(methodName, index) {
  16886. var dropName = 'drop' + (index ? '' : 'Right');
  16887. LazyWrapper.prototype[methodName] = function() {
  16888. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  16889. };
  16890. });
  16891. LazyWrapper.prototype.compact = function() {
  16892. return this.filter(identity);
  16893. };
  16894. LazyWrapper.prototype.find = function(predicate) {
  16895. return this.filter(predicate).head();
  16896. };
  16897. LazyWrapper.prototype.findLast = function(predicate) {
  16898. return this.reverse().find(predicate);
  16899. };
  16900. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  16901. if (typeof path == 'function') {
  16902. return new LazyWrapper(this);
  16903. }
  16904. return this.map(function(value) {
  16905. return baseInvoke(value, path, args);
  16906. });
  16907. });
  16908. LazyWrapper.prototype.reject = function(predicate) {
  16909. return this.filter(negate(getIteratee(predicate)));
  16910. };
  16911. LazyWrapper.prototype.slice = function(start, end) {
  16912. start = toInteger(start);
  16913. var result = this;
  16914. if (result.__filtered__ && (start > 0 || end < 0)) {
  16915. return new LazyWrapper(result);
  16916. }
  16917. if (start < 0) {
  16918. result = result.takeRight(-start);
  16919. } else if (start) {
  16920. result = result.drop(start);
  16921. }
  16922. if (end !== undefined) {
  16923. end = toInteger(end);
  16924. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  16925. }
  16926. return result;
  16927. };
  16928. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  16929. return this.reverse().takeWhile(predicate).reverse();
  16930. };
  16931. LazyWrapper.prototype.toArray = function() {
  16932. return this.take(MAX_ARRAY_LENGTH);
  16933. };
  16934. // Add `LazyWrapper` methods to `lodash.prototype`.
  16935. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  16936. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  16937. isTaker = /^(?:head|last)$/.test(methodName),
  16938. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  16939. retUnwrapped = isTaker || /^find/.test(methodName);
  16940. if (!lodashFunc) {
  16941. return;
  16942. }
  16943. lodash.prototype[methodName] = function() {
  16944. var value = this.__wrapped__,
  16945. args = isTaker ? [1] : arguments,
  16946. isLazy = value instanceof LazyWrapper,
  16947. iteratee = args[0],
  16948. useLazy = isLazy || isArray(value);
  16949. var interceptor = function(value) {
  16950. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  16951. return (isTaker && chainAll) ? result[0] : result;
  16952. };
  16953. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  16954. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  16955. isLazy = useLazy = false;
  16956. }
  16957. var chainAll = this.__chain__,
  16958. isHybrid = !!this.__actions__.length,
  16959. isUnwrapped = retUnwrapped && !chainAll,
  16960. onlyLazy = isLazy && !isHybrid;
  16961. if (!retUnwrapped && useLazy) {
  16962. value = onlyLazy ? value : new LazyWrapper(this);
  16963. var result = func.apply(value, args);
  16964. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  16965. return new LodashWrapper(result, chainAll);
  16966. }
  16967. if (isUnwrapped && onlyLazy) {
  16968. return func.apply(this, args);
  16969. }
  16970. result = this.thru(interceptor);
  16971. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  16972. };
  16973. });
  16974. // Add `Array` methods to `lodash.prototype`.
  16975. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  16976. var func = arrayProto[methodName],
  16977. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  16978. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  16979. lodash.prototype[methodName] = function() {
  16980. var args = arguments;
  16981. if (retUnwrapped && !this.__chain__) {
  16982. var value = this.value();
  16983. return func.apply(isArray(value) ? value : [], args);
  16984. }
  16985. return this[chainName](function(value) {
  16986. return func.apply(isArray(value) ? value : [], args);
  16987. });
  16988. };
  16989. });
  16990. // Map minified method names to their real names.
  16991. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  16992. var lodashFunc = lodash[methodName];
  16993. if (lodashFunc) {
  16994. var key = lodashFunc.name + '';
  16995. if (!hasOwnProperty.call(realNames, key)) {
  16996. realNames[key] = [];
  16997. }
  16998. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  16999. }
  17000. });
  17001. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  17002. 'name': 'wrapper',
  17003. 'func': undefined
  17004. }];
  17005. // Add methods to `LazyWrapper`.
  17006. LazyWrapper.prototype.clone = lazyClone;
  17007. LazyWrapper.prototype.reverse = lazyReverse;
  17008. LazyWrapper.prototype.value = lazyValue;
  17009. // Add chain sequence methods to the `lodash` wrapper.
  17010. lodash.prototype.at = wrapperAt;
  17011. lodash.prototype.chain = wrapperChain;
  17012. lodash.prototype.commit = wrapperCommit;
  17013. lodash.prototype.next = wrapperNext;
  17014. lodash.prototype.plant = wrapperPlant;
  17015. lodash.prototype.reverse = wrapperReverse;
  17016. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  17017. // Add lazy aliases.
  17018. lodash.prototype.first = lodash.prototype.head;
  17019. if (symIterator) {
  17020. lodash.prototype[symIterator] = wrapperToIterator;
  17021. }
  17022. return lodash;
  17023. });
  17024. /*--------------------------------------------------------------------------*/
  17025. // Export lodash.
  17026. var _ = runInContext();
  17027. // Some AMD build optimizers, like r.js, check for condition patterns like:
  17028. if (true) {
  17029. // Expose Lodash on the global object to prevent errors when Lodash is
  17030. // loaded by a script tag in the presence of an AMD loader.
  17031. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  17032. // Use `_.noConflict` to remove Lodash from the global object.
  17033. root._ = _;
  17034. // Define as an anonymous module so, through path mapping, it can be
  17035. // referenced as the "underscore" module.
  17036. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17037. return _;
  17038. }).call(exports, __webpack_require__, exports, module),
  17039. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17040. }
  17041. // Check for `exports` after `define` in case a build optimizer adds it.
  17042. else if (freeModule) {
  17043. // Export for Node.js.
  17044. (freeModule.exports = _)._ = _;
  17045. // Export for CommonJS support.
  17046. freeExports._ = _;
  17047. }
  17048. else {
  17049. // Export to the global object.
  17050. root._ = _;
  17051. }
  17052. }.call(this));
  17053. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(13)(module)))
  17054. /***/ }),
  17055. /* 13 */
  17056. /***/ (function(module, exports) {
  17057. module.exports = function(module) {
  17058. if(!module.webpackPolyfill) {
  17059. module.deprecate = function() {};
  17060. module.paths = [];
  17061. // module.parent = undefined by default
  17062. if(!module.children) module.children = [];
  17063. Object.defineProperty(module, "loaded", {
  17064. enumerable: true,
  17065. get: function() {
  17066. return module.l;
  17067. }
  17068. });
  17069. Object.defineProperty(module, "id", {
  17070. enumerable: true,
  17071. get: function() {
  17072. return module.i;
  17073. }
  17074. });
  17075. module.webpackPolyfill = 1;
  17076. }
  17077. return module;
  17078. };
  17079. /***/ }),
  17080. /* 14 */
  17081. /***/ (function(module, exports, __webpack_require__) {
  17082. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  17083. * jQuery JavaScript Library v3.6.0
  17084. * https://jquery.com/
  17085. *
  17086. * Includes Sizzle.js
  17087. * https://sizzlejs.com/
  17088. *
  17089. * Copyright OpenJS Foundation and other contributors
  17090. * Released under the MIT license
  17091. * https://jquery.org/license
  17092. *
  17093. * Date: 2021-03-02T17:08Z
  17094. */
  17095. ( function( global, factory ) {
  17096. "use strict";
  17097. if ( typeof module === "object" && typeof module.exports === "object" ) {
  17098. // For CommonJS and CommonJS-like environments where a proper `window`
  17099. // is present, execute the factory and get jQuery.
  17100. // For environments that do not have a `window` with a `document`
  17101. // (such as Node.js), expose a factory as module.exports.
  17102. // This accentuates the need for the creation of a real `window`.
  17103. // e.g. var jQuery = require("jquery")(window);
  17104. // See ticket #14549 for more info.
  17105. module.exports = global.document ?
  17106. factory( global, true ) :
  17107. function( w ) {
  17108. if ( !w.document ) {
  17109. throw new Error( "jQuery requires a window with a document" );
  17110. }
  17111. return factory( w );
  17112. };
  17113. } else {
  17114. factory( global );
  17115. }
  17116. // Pass this if window is not defined yet
  17117. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  17118. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  17119. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  17120. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  17121. // enough that all such attempts are guarded in a try block.
  17122. "use strict";
  17123. var arr = [];
  17124. var getProto = Object.getPrototypeOf;
  17125. var slice = arr.slice;
  17126. var flat = arr.flat ? function( array ) {
  17127. return arr.flat.call( array );
  17128. } : function( array ) {
  17129. return arr.concat.apply( [], array );
  17130. };
  17131. var push = arr.push;
  17132. var indexOf = arr.indexOf;
  17133. var class2type = {};
  17134. var toString = class2type.toString;
  17135. var hasOwn = class2type.hasOwnProperty;
  17136. var fnToString = hasOwn.toString;
  17137. var ObjectFunctionString = fnToString.call( Object );
  17138. var support = {};
  17139. var isFunction = function isFunction( obj ) {
  17140. // Support: Chrome <=57, Firefox <=52
  17141. // In some browsers, typeof returns "function" for HTML <object> elements
  17142. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  17143. // We don't want to classify *any* DOM node as a function.
  17144. // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5
  17145. // Plus for old WebKit, typeof returns "function" for HTML collections
  17146. // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756)
  17147. return typeof obj === "function" && typeof obj.nodeType !== "number" &&
  17148. typeof obj.item !== "function";
  17149. };
  17150. var isWindow = function isWindow( obj ) {
  17151. return obj != null && obj === obj.window;
  17152. };
  17153. var document = window.document;
  17154. var preservedScriptAttributes = {
  17155. type: true,
  17156. src: true,
  17157. nonce: true,
  17158. noModule: true
  17159. };
  17160. function DOMEval( code, node, doc ) {
  17161. doc = doc || document;
  17162. var i, val,
  17163. script = doc.createElement( "script" );
  17164. script.text = code;
  17165. if ( node ) {
  17166. for ( i in preservedScriptAttributes ) {
  17167. // Support: Firefox 64+, Edge 18+
  17168. // Some browsers don't support the "nonce" property on scripts.
  17169. // On the other hand, just using `getAttribute` is not enough as
  17170. // the `nonce` attribute is reset to an empty string whenever it
  17171. // becomes browsing-context connected.
  17172. // See https://github.com/whatwg/html/issues/2369
  17173. // See https://html.spec.whatwg.org/#nonce-attributes
  17174. // The `node.getAttribute` check was added for the sake of
  17175. // `jQuery.globalEval` so that it can fake a nonce-containing node
  17176. // via an object.
  17177. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  17178. if ( val ) {
  17179. script.setAttribute( i, val );
  17180. }
  17181. }
  17182. }
  17183. doc.head.appendChild( script ).parentNode.removeChild( script );
  17184. }
  17185. function toType( obj ) {
  17186. if ( obj == null ) {
  17187. return obj + "";
  17188. }
  17189. // Support: Android <=2.3 only (functionish RegExp)
  17190. return typeof obj === "object" || typeof obj === "function" ?
  17191. class2type[ toString.call( obj ) ] || "object" :
  17192. typeof obj;
  17193. }
  17194. /* global Symbol */
  17195. // Defining this global in .eslintrc.json would create a danger of using the global
  17196. // unguarded in another place, it seems safer to define global only for this module
  17197. var
  17198. version = "3.6.0",
  17199. // Define a local copy of jQuery
  17200. jQuery = function( selector, context ) {
  17201. // The jQuery object is actually just the init constructor 'enhanced'
  17202. // Need init if jQuery is called (just allow error to be thrown if not included)
  17203. return new jQuery.fn.init( selector, context );
  17204. };
  17205. jQuery.fn = jQuery.prototype = {
  17206. // The current version of jQuery being used
  17207. jquery: version,
  17208. constructor: jQuery,
  17209. // The default length of a jQuery object is 0
  17210. length: 0,
  17211. toArray: function() {
  17212. return slice.call( this );
  17213. },
  17214. // Get the Nth element in the matched element set OR
  17215. // Get the whole matched element set as a clean array
  17216. get: function( num ) {
  17217. // Return all the elements in a clean array
  17218. if ( num == null ) {
  17219. return slice.call( this );
  17220. }
  17221. // Return just the one element from the set
  17222. return num < 0 ? this[ num + this.length ] : this[ num ];
  17223. },
  17224. // Take an array of elements and push it onto the stack
  17225. // (returning the new matched element set)
  17226. pushStack: function( elems ) {
  17227. // Build a new jQuery matched element set
  17228. var ret = jQuery.merge( this.constructor(), elems );
  17229. // Add the old object onto the stack (as a reference)
  17230. ret.prevObject = this;
  17231. // Return the newly-formed element set
  17232. return ret;
  17233. },
  17234. // Execute a callback for every element in the matched set.
  17235. each: function( callback ) {
  17236. return jQuery.each( this, callback );
  17237. },
  17238. map: function( callback ) {
  17239. return this.pushStack( jQuery.map( this, function( elem, i ) {
  17240. return callback.call( elem, i, elem );
  17241. } ) );
  17242. },
  17243. slice: function() {
  17244. return this.pushStack( slice.apply( this, arguments ) );
  17245. },
  17246. first: function() {
  17247. return this.eq( 0 );
  17248. },
  17249. last: function() {
  17250. return this.eq( -1 );
  17251. },
  17252. even: function() {
  17253. return this.pushStack( jQuery.grep( this, function( _elem, i ) {
  17254. return ( i + 1 ) % 2;
  17255. } ) );
  17256. },
  17257. odd: function() {
  17258. return this.pushStack( jQuery.grep( this, function( _elem, i ) {
  17259. return i % 2;
  17260. } ) );
  17261. },
  17262. eq: function( i ) {
  17263. var len = this.length,
  17264. j = +i + ( i < 0 ? len : 0 );
  17265. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  17266. },
  17267. end: function() {
  17268. return this.prevObject || this.constructor();
  17269. },
  17270. // For internal use only.
  17271. // Behaves like an Array's method, not like a jQuery method.
  17272. push: push,
  17273. sort: arr.sort,
  17274. splice: arr.splice
  17275. };
  17276. jQuery.extend = jQuery.fn.extend = function() {
  17277. var options, name, src, copy, copyIsArray, clone,
  17278. target = arguments[ 0 ] || {},
  17279. i = 1,
  17280. length = arguments.length,
  17281. deep = false;
  17282. // Handle a deep copy situation
  17283. if ( typeof target === "boolean" ) {
  17284. deep = target;
  17285. // Skip the boolean and the target
  17286. target = arguments[ i ] || {};
  17287. i++;
  17288. }
  17289. // Handle case when target is a string or something (possible in deep copy)
  17290. if ( typeof target !== "object" && !isFunction( target ) ) {
  17291. target = {};
  17292. }
  17293. // Extend jQuery itself if only one argument is passed
  17294. if ( i === length ) {
  17295. target = this;
  17296. i--;
  17297. }
  17298. for ( ; i < length; i++ ) {
  17299. // Only deal with non-null/undefined values
  17300. if ( ( options = arguments[ i ] ) != null ) {
  17301. // Extend the base object
  17302. for ( name in options ) {
  17303. copy = options[ name ];
  17304. // Prevent Object.prototype pollution
  17305. // Prevent never-ending loop
  17306. if ( name === "__proto__" || target === copy ) {
  17307. continue;
  17308. }
  17309. // Recurse if we're merging plain objects or arrays
  17310. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  17311. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  17312. src = target[ name ];
  17313. // Ensure proper type for the source value
  17314. if ( copyIsArray && !Array.isArray( src ) ) {
  17315. clone = [];
  17316. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  17317. clone = {};
  17318. } else {
  17319. clone = src;
  17320. }
  17321. copyIsArray = false;
  17322. // Never move original objects, clone them
  17323. target[ name ] = jQuery.extend( deep, clone, copy );
  17324. // Don't bring in undefined values
  17325. } else if ( copy !== undefined ) {
  17326. target[ name ] = copy;
  17327. }
  17328. }
  17329. }
  17330. }
  17331. // Return the modified object
  17332. return target;
  17333. };
  17334. jQuery.extend( {
  17335. // Unique for each copy of jQuery on the page
  17336. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  17337. // Assume jQuery is ready without the ready module
  17338. isReady: true,
  17339. error: function( msg ) {
  17340. throw new Error( msg );
  17341. },
  17342. noop: function() {},
  17343. isPlainObject: function( obj ) {
  17344. var proto, Ctor;
  17345. // Detect obvious negatives
  17346. // Use toString instead of jQuery.type to catch host objects
  17347. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  17348. return false;
  17349. }
  17350. proto = getProto( obj );
  17351. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  17352. if ( !proto ) {
  17353. return true;
  17354. }
  17355. // Objects with prototype are plain iff they were constructed by a global Object function
  17356. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  17357. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  17358. },
  17359. isEmptyObject: function( obj ) {
  17360. var name;
  17361. for ( name in obj ) {
  17362. return false;
  17363. }
  17364. return true;
  17365. },
  17366. // Evaluates a script in a provided context; falls back to the global one
  17367. // if not specified.
  17368. globalEval: function( code, options, doc ) {
  17369. DOMEval( code, { nonce: options && options.nonce }, doc );
  17370. },
  17371. each: function( obj, callback ) {
  17372. var length, i = 0;
  17373. if ( isArrayLike( obj ) ) {
  17374. length = obj.length;
  17375. for ( ; i < length; i++ ) {
  17376. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  17377. break;
  17378. }
  17379. }
  17380. } else {
  17381. for ( i in obj ) {
  17382. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  17383. break;
  17384. }
  17385. }
  17386. }
  17387. return obj;
  17388. },
  17389. // results is for internal usage only
  17390. makeArray: function( arr, results ) {
  17391. var ret = results || [];
  17392. if ( arr != null ) {
  17393. if ( isArrayLike( Object( arr ) ) ) {
  17394. jQuery.merge( ret,
  17395. typeof arr === "string" ?
  17396. [ arr ] : arr
  17397. );
  17398. } else {
  17399. push.call( ret, arr );
  17400. }
  17401. }
  17402. return ret;
  17403. },
  17404. inArray: function( elem, arr, i ) {
  17405. return arr == null ? -1 : indexOf.call( arr, elem, i );
  17406. },
  17407. // Support: Android <=4.0 only, PhantomJS 1 only
  17408. // push.apply(_, arraylike) throws on ancient WebKit
  17409. merge: function( first, second ) {
  17410. var len = +second.length,
  17411. j = 0,
  17412. i = first.length;
  17413. for ( ; j < len; j++ ) {
  17414. first[ i++ ] = second[ j ];
  17415. }
  17416. first.length = i;
  17417. return first;
  17418. },
  17419. grep: function( elems, callback, invert ) {
  17420. var callbackInverse,
  17421. matches = [],
  17422. i = 0,
  17423. length = elems.length,
  17424. callbackExpect = !invert;
  17425. // Go through the array, only saving the items
  17426. // that pass the validator function
  17427. for ( ; i < length; i++ ) {
  17428. callbackInverse = !callback( elems[ i ], i );
  17429. if ( callbackInverse !== callbackExpect ) {
  17430. matches.push( elems[ i ] );
  17431. }
  17432. }
  17433. return matches;
  17434. },
  17435. // arg is for internal usage only
  17436. map: function( elems, callback, arg ) {
  17437. var length, value,
  17438. i = 0,
  17439. ret = [];
  17440. // Go through the array, translating each of the items to their new values
  17441. if ( isArrayLike( elems ) ) {
  17442. length = elems.length;
  17443. for ( ; i < length; i++ ) {
  17444. value = callback( elems[ i ], i, arg );
  17445. if ( value != null ) {
  17446. ret.push( value );
  17447. }
  17448. }
  17449. // Go through every key on the object,
  17450. } else {
  17451. for ( i in elems ) {
  17452. value = callback( elems[ i ], i, arg );
  17453. if ( value != null ) {
  17454. ret.push( value );
  17455. }
  17456. }
  17457. }
  17458. // Flatten any nested arrays
  17459. return flat( ret );
  17460. },
  17461. // A global GUID counter for objects
  17462. guid: 1,
  17463. // jQuery.support is not used in Core but other projects attach their
  17464. // properties to it so it needs to exist.
  17465. support: support
  17466. } );
  17467. if ( typeof Symbol === "function" ) {
  17468. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  17469. }
  17470. // Populate the class2type map
  17471. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  17472. function( _i, name ) {
  17473. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  17474. } );
  17475. function isArrayLike( obj ) {
  17476. // Support: real iOS 8.2 only (not reproducible in simulator)
  17477. // `in` check used to prevent JIT error (gh-2145)
  17478. // hasOwn isn't used here due to false negatives
  17479. // regarding Nodelist length in IE
  17480. var length = !!obj && "length" in obj && obj.length,
  17481. type = toType( obj );
  17482. if ( isFunction( obj ) || isWindow( obj ) ) {
  17483. return false;
  17484. }
  17485. return type === "array" || length === 0 ||
  17486. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  17487. }
  17488. var Sizzle =
  17489. /*!
  17490. * Sizzle CSS Selector Engine v2.3.6
  17491. * https://sizzlejs.com/
  17492. *
  17493. * Copyright JS Foundation and other contributors
  17494. * Released under the MIT license
  17495. * https://js.foundation/
  17496. *
  17497. * Date: 2021-02-16
  17498. */
  17499. ( function( window ) {
  17500. var i,
  17501. support,
  17502. Expr,
  17503. getText,
  17504. isXML,
  17505. tokenize,
  17506. compile,
  17507. select,
  17508. outermostContext,
  17509. sortInput,
  17510. hasDuplicate,
  17511. // Local document vars
  17512. setDocument,
  17513. document,
  17514. docElem,
  17515. documentIsHTML,
  17516. rbuggyQSA,
  17517. rbuggyMatches,
  17518. matches,
  17519. contains,
  17520. // Instance-specific data
  17521. expando = "sizzle" + 1 * new Date(),
  17522. preferredDoc = window.document,
  17523. dirruns = 0,
  17524. done = 0,
  17525. classCache = createCache(),
  17526. tokenCache = createCache(),
  17527. compilerCache = createCache(),
  17528. nonnativeSelectorCache = createCache(),
  17529. sortOrder = function( a, b ) {
  17530. if ( a === b ) {
  17531. hasDuplicate = true;
  17532. }
  17533. return 0;
  17534. },
  17535. // Instance methods
  17536. hasOwn = ( {} ).hasOwnProperty,
  17537. arr = [],
  17538. pop = arr.pop,
  17539. pushNative = arr.push,
  17540. push = arr.push,
  17541. slice = arr.slice,
  17542. // Use a stripped-down indexOf as it's faster than native
  17543. // https://jsperf.com/thor-indexof-vs-for/5
  17544. indexOf = function( list, elem ) {
  17545. var i = 0,
  17546. len = list.length;
  17547. for ( ; i < len; i++ ) {
  17548. if ( list[ i ] === elem ) {
  17549. return i;
  17550. }
  17551. }
  17552. return -1;
  17553. },
  17554. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" +
  17555. "ismap|loop|multiple|open|readonly|required|scoped",
  17556. // Regular expressions
  17557. // http://www.w3.org/TR/css3-selectors/#whitespace
  17558. whitespace = "[\\x20\\t\\r\\n\\f]",
  17559. // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
  17560. identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
  17561. "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
  17562. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  17563. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  17564. // Operator (capture 2)
  17565. "*([*^$|!~]?=)" + whitespace +
  17566. // "Attribute values must be CSS identifiers [capture 5]
  17567. // or strings [capture 3 or capture 4]"
  17568. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
  17569. whitespace + "*\\]",
  17570. pseudos = ":(" + identifier + ")(?:\\((" +
  17571. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  17572. // 1. quoted (capture 3; capture 4 or capture 5)
  17573. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  17574. // 2. simple (capture 6)
  17575. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  17576. // 3. anything else (capture 2)
  17577. ".*" +
  17578. ")\\)|)",
  17579. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  17580. rwhitespace = new RegExp( whitespace + "+", "g" ),
  17581. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
  17582. whitespace + "+$", "g" ),
  17583. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  17584. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
  17585. "*" ),
  17586. rdescend = new RegExp( whitespace + "|>" ),
  17587. rpseudo = new RegExp( pseudos ),
  17588. ridentifier = new RegExp( "^" + identifier + "$" ),
  17589. matchExpr = {
  17590. "ID": new RegExp( "^#(" + identifier + ")" ),
  17591. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  17592. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  17593. "ATTR": new RegExp( "^" + attributes ),
  17594. "PSEUDO": new RegExp( "^" + pseudos ),
  17595. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
  17596. whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
  17597. whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  17598. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  17599. // For use in libraries implementing .is()
  17600. // We use this for POS matching in `select`
  17601. "needsContext": new RegExp( "^" + whitespace +
  17602. "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
  17603. "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  17604. },
  17605. rhtml = /HTML$/i,
  17606. rinputs = /^(?:input|select|textarea|button)$/i,
  17607. rheader = /^h\d$/i,
  17608. rnative = /^[^{]+\{\s*\[native \w/,
  17609. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  17610. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  17611. rsibling = /[+~]/,
  17612. // CSS escapes
  17613. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  17614. runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ),
  17615. funescape = function( escape, nonHex ) {
  17616. var high = "0x" + escape.slice( 1 ) - 0x10000;
  17617. return nonHex ?
  17618. // Strip the backslash prefix from a non-hex escape sequence
  17619. nonHex :
  17620. // Replace a hexadecimal escape sequence with the encoded Unicode code point
  17621. // Support: IE <=11+
  17622. // For values outside the Basic Multilingual Plane (BMP), manually construct a
  17623. // surrogate pair
  17624. high < 0 ?
  17625. String.fromCharCode( high + 0x10000 ) :
  17626. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  17627. },
  17628. // CSS string/identifier serialization
  17629. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  17630. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  17631. fcssescape = function( ch, asCodePoint ) {
  17632. if ( asCodePoint ) {
  17633. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  17634. if ( ch === "\0" ) {
  17635. return "\uFFFD";
  17636. }
  17637. // Control characters and (dependent upon position) numbers get escaped as code points
  17638. return ch.slice( 0, -1 ) + "\\" +
  17639. ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  17640. }
  17641. // Other potentially-special ASCII characters get backslash-escaped
  17642. return "\\" + ch;
  17643. },
  17644. // Used for iframes
  17645. // See setDocument()
  17646. // Removing the function wrapper causes a "Permission Denied"
  17647. // error in IE
  17648. unloadHandler = function() {
  17649. setDocument();
  17650. },
  17651. inDisabledFieldset = addCombinator(
  17652. function( elem ) {
  17653. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  17654. },
  17655. { dir: "parentNode", next: "legend" }
  17656. );
  17657. // Optimize for push.apply( _, NodeList )
  17658. try {
  17659. push.apply(
  17660. ( arr = slice.call( preferredDoc.childNodes ) ),
  17661. preferredDoc.childNodes
  17662. );
  17663. // Support: Android<4.0
  17664. // Detect silently failing push.apply
  17665. // eslint-disable-next-line no-unused-expressions
  17666. arr[ preferredDoc.childNodes.length ].nodeType;
  17667. } catch ( e ) {
  17668. push = { apply: arr.length ?
  17669. // Leverage slice if possible
  17670. function( target, els ) {
  17671. pushNative.apply( target, slice.call( els ) );
  17672. } :
  17673. // Support: IE<9
  17674. // Otherwise append directly
  17675. function( target, els ) {
  17676. var j = target.length,
  17677. i = 0;
  17678. // Can't trust NodeList.length
  17679. while ( ( target[ j++ ] = els[ i++ ] ) ) {}
  17680. target.length = j - 1;
  17681. }
  17682. };
  17683. }
  17684. function Sizzle( selector, context, results, seed ) {
  17685. var m, i, elem, nid, match, groups, newSelector,
  17686. newContext = context && context.ownerDocument,
  17687. // nodeType defaults to 9, since context defaults to document
  17688. nodeType = context ? context.nodeType : 9;
  17689. results = results || [];
  17690. // Return early from calls with invalid selector or context
  17691. if ( typeof selector !== "string" || !selector ||
  17692. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  17693. return results;
  17694. }
  17695. // Try to shortcut find operations (as opposed to filters) in HTML documents
  17696. if ( !seed ) {
  17697. setDocument( context );
  17698. context = context || document;
  17699. if ( documentIsHTML ) {
  17700. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  17701. // (excepting DocumentFragment context, where the methods don't exist)
  17702. if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
  17703. // ID selector
  17704. if ( ( m = match[ 1 ] ) ) {
  17705. // Document context
  17706. if ( nodeType === 9 ) {
  17707. if ( ( elem = context.getElementById( m ) ) ) {
  17708. // Support: IE, Opera, Webkit
  17709. // TODO: identify versions
  17710. // getElementById can match elements by name instead of ID
  17711. if ( elem.id === m ) {
  17712. results.push( elem );
  17713. return results;
  17714. }
  17715. } else {
  17716. return results;
  17717. }
  17718. // Element context
  17719. } else {
  17720. // Support: IE, Opera, Webkit
  17721. // TODO: identify versions
  17722. // getElementById can match elements by name instead of ID
  17723. if ( newContext && ( elem = newContext.getElementById( m ) ) &&
  17724. contains( context, elem ) &&
  17725. elem.id === m ) {
  17726. results.push( elem );
  17727. return results;
  17728. }
  17729. }
  17730. // Type selector
  17731. } else if ( match[ 2 ] ) {
  17732. push.apply( results, context.getElementsByTagName( selector ) );
  17733. return results;
  17734. // Class selector
  17735. } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName &&
  17736. context.getElementsByClassName ) {
  17737. push.apply( results, context.getElementsByClassName( m ) );
  17738. return results;
  17739. }
  17740. }
  17741. // Take advantage of querySelectorAll
  17742. if ( support.qsa &&
  17743. !nonnativeSelectorCache[ selector + " " ] &&
  17744. ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
  17745. // Support: IE 8 only
  17746. // Exclude object elements
  17747. ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {
  17748. newSelector = selector;
  17749. newContext = context;
  17750. // qSA considers elements outside a scoping root when evaluating child or
  17751. // descendant combinators, which is not what we want.
  17752. // In such cases, we work around the behavior by prefixing every selector in the
  17753. // list with an ID selector referencing the scope context.
  17754. // The technique has to be used as well when a leading combinator is used
  17755. // as such selectors are not recognized by querySelectorAll.
  17756. // Thanks to Andrew Dupont for this technique.
  17757. if ( nodeType === 1 &&
  17758. ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
  17759. // Expand context for sibling selectors
  17760. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  17761. context;
  17762. // We can use :scope instead of the ID hack if the browser
  17763. // supports it & if we're not changing the context.
  17764. if ( newContext !== context || !support.scope ) {
  17765. // Capture the context ID, setting it first if necessary
  17766. if ( ( nid = context.getAttribute( "id" ) ) ) {
  17767. nid = nid.replace( rcssescape, fcssescape );
  17768. } else {
  17769. context.setAttribute( "id", ( nid = expando ) );
  17770. }
  17771. }
  17772. // Prefix every selector in the list
  17773. groups = tokenize( selector );
  17774. i = groups.length;
  17775. while ( i-- ) {
  17776. groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
  17777. toSelector( groups[ i ] );
  17778. }
  17779. newSelector = groups.join( "," );
  17780. }
  17781. try {
  17782. push.apply( results,
  17783. newContext.querySelectorAll( newSelector )
  17784. );
  17785. return results;
  17786. } catch ( qsaError ) {
  17787. nonnativeSelectorCache( selector, true );
  17788. } finally {
  17789. if ( nid === expando ) {
  17790. context.removeAttribute( "id" );
  17791. }
  17792. }
  17793. }
  17794. }
  17795. }
  17796. // All others
  17797. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  17798. }
  17799. /**
  17800. * Create key-value caches of limited size
  17801. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  17802. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  17803. * deleting the oldest entry
  17804. */
  17805. function createCache() {
  17806. var keys = [];
  17807. function cache( key, value ) {
  17808. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  17809. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  17810. // Only keep the most recent entries
  17811. delete cache[ keys.shift() ];
  17812. }
  17813. return ( cache[ key + " " ] = value );
  17814. }
  17815. return cache;
  17816. }
  17817. /**
  17818. * Mark a function for special use by Sizzle
  17819. * @param {Function} fn The function to mark
  17820. */
  17821. function markFunction( fn ) {
  17822. fn[ expando ] = true;
  17823. return fn;
  17824. }
  17825. /**
  17826. * Support testing using an element
  17827. * @param {Function} fn Passed the created element and returns a boolean result
  17828. */
  17829. function assert( fn ) {
  17830. var el = document.createElement( "fieldset" );
  17831. try {
  17832. return !!fn( el );
  17833. } catch ( e ) {
  17834. return false;
  17835. } finally {
  17836. // Remove from its parent by default
  17837. if ( el.parentNode ) {
  17838. el.parentNode.removeChild( el );
  17839. }
  17840. // release memory in IE
  17841. el = null;
  17842. }
  17843. }
  17844. /**
  17845. * Adds the same handler for all of the specified attrs
  17846. * @param {String} attrs Pipe-separated list of attributes
  17847. * @param {Function} handler The method that will be applied
  17848. */
  17849. function addHandle( attrs, handler ) {
  17850. var arr = attrs.split( "|" ),
  17851. i = arr.length;
  17852. while ( i-- ) {
  17853. Expr.attrHandle[ arr[ i ] ] = handler;
  17854. }
  17855. }
  17856. /**
  17857. * Checks document order of two siblings
  17858. * @param {Element} a
  17859. * @param {Element} b
  17860. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  17861. */
  17862. function siblingCheck( a, b ) {
  17863. var cur = b && a,
  17864. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  17865. a.sourceIndex - b.sourceIndex;
  17866. // Use IE sourceIndex if available on both nodes
  17867. if ( diff ) {
  17868. return diff;
  17869. }
  17870. // Check if b follows a
  17871. if ( cur ) {
  17872. while ( ( cur = cur.nextSibling ) ) {
  17873. if ( cur === b ) {
  17874. return -1;
  17875. }
  17876. }
  17877. }
  17878. return a ? 1 : -1;
  17879. }
  17880. /**
  17881. * Returns a function to use in pseudos for input types
  17882. * @param {String} type
  17883. */
  17884. function createInputPseudo( type ) {
  17885. return function( elem ) {
  17886. var name = elem.nodeName.toLowerCase();
  17887. return name === "input" && elem.type === type;
  17888. };
  17889. }
  17890. /**
  17891. * Returns a function to use in pseudos for buttons
  17892. * @param {String} type
  17893. */
  17894. function createButtonPseudo( type ) {
  17895. return function( elem ) {
  17896. var name = elem.nodeName.toLowerCase();
  17897. return ( name === "input" || name === "button" ) && elem.type === type;
  17898. };
  17899. }
  17900. /**
  17901. * Returns a function to use in pseudos for :enabled/:disabled
  17902. * @param {Boolean} disabled true for :disabled; false for :enabled
  17903. */
  17904. function createDisabledPseudo( disabled ) {
  17905. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  17906. return function( elem ) {
  17907. // Only certain elements can match :enabled or :disabled
  17908. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  17909. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  17910. if ( "form" in elem ) {
  17911. // Check for inherited disabledness on relevant non-disabled elements:
  17912. // * listed form-associated elements in a disabled fieldset
  17913. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  17914. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  17915. // * option elements in a disabled optgroup
  17916. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  17917. // All such elements have a "form" property.
  17918. if ( elem.parentNode && elem.disabled === false ) {
  17919. // Option elements defer to a parent optgroup if present
  17920. if ( "label" in elem ) {
  17921. if ( "label" in elem.parentNode ) {
  17922. return elem.parentNode.disabled === disabled;
  17923. } else {
  17924. return elem.disabled === disabled;
  17925. }
  17926. }
  17927. // Support: IE 6 - 11
  17928. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  17929. return elem.isDisabled === disabled ||
  17930. // Where there is no isDisabled, check manually
  17931. /* jshint -W018 */
  17932. elem.isDisabled !== !disabled &&
  17933. inDisabledFieldset( elem ) === disabled;
  17934. }
  17935. return elem.disabled === disabled;
  17936. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  17937. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  17938. // even exist on them, let alone have a boolean value.
  17939. } else if ( "label" in elem ) {
  17940. return elem.disabled === disabled;
  17941. }
  17942. // Remaining elements are neither :enabled nor :disabled
  17943. return false;
  17944. };
  17945. }
  17946. /**
  17947. * Returns a function to use in pseudos for positionals
  17948. * @param {Function} fn
  17949. */
  17950. function createPositionalPseudo( fn ) {
  17951. return markFunction( function( argument ) {
  17952. argument = +argument;
  17953. return markFunction( function( seed, matches ) {
  17954. var j,
  17955. matchIndexes = fn( [], seed.length, argument ),
  17956. i = matchIndexes.length;
  17957. // Match elements found at the specified indexes
  17958. while ( i-- ) {
  17959. if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
  17960. seed[ j ] = !( matches[ j ] = seed[ j ] );
  17961. }
  17962. }
  17963. } );
  17964. } );
  17965. }
  17966. /**
  17967. * Checks a node for validity as a Sizzle context
  17968. * @param {Element|Object=} context
  17969. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  17970. */
  17971. function testContext( context ) {
  17972. return context && typeof context.getElementsByTagName !== "undefined" && context;
  17973. }
  17974. // Expose support vars for convenience
  17975. support = Sizzle.support = {};
  17976. /**
  17977. * Detects XML nodes
  17978. * @param {Element|Object} elem An element or a document
  17979. * @returns {Boolean} True iff elem is a non-HTML XML node
  17980. */
  17981. isXML = Sizzle.isXML = function( elem ) {
  17982. var namespace = elem && elem.namespaceURI,
  17983. docElem = elem && ( elem.ownerDocument || elem ).documentElement;
  17984. // Support: IE <=8
  17985. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  17986. // https://bugs.jquery.com/ticket/4833
  17987. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  17988. };
  17989. /**
  17990. * Sets document-related variables once based on the current document
  17991. * @param {Element|Object} [doc] An element or document object to use to set the document
  17992. * @returns {Object} Returns the current document
  17993. */
  17994. setDocument = Sizzle.setDocument = function( node ) {
  17995. var hasCompare, subWindow,
  17996. doc = node ? node.ownerDocument || node : preferredDoc;
  17997. // Return early if doc is invalid or already selected
  17998. // Support: IE 11+, Edge 17 - 18+
  17999. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  18000. // two documents; shallow comparisons work.
  18001. // eslint-disable-next-line eqeqeq
  18002. if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {
  18003. return document;
  18004. }
  18005. // Update global variables
  18006. document = doc;
  18007. docElem = document.documentElement;
  18008. documentIsHTML = !isXML( document );
  18009. // Support: IE 9 - 11+, Edge 12 - 18+
  18010. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  18011. // Support: IE 11+, Edge 17 - 18+
  18012. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  18013. // two documents; shallow comparisons work.
  18014. // eslint-disable-next-line eqeqeq
  18015. if ( preferredDoc != document &&
  18016. ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
  18017. // Support: IE 11, Edge
  18018. if ( subWindow.addEventListener ) {
  18019. subWindow.addEventListener( "unload", unloadHandler, false );
  18020. // Support: IE 9 - 10 only
  18021. } else if ( subWindow.attachEvent ) {
  18022. subWindow.attachEvent( "onunload", unloadHandler );
  18023. }
  18024. }
  18025. // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
  18026. // Safari 4 - 5 only, Opera <=11.6 - 12.x only
  18027. // IE/Edge & older browsers don't support the :scope pseudo-class.
  18028. // Support: Safari 6.0 only
  18029. // Safari 6.0 supports :scope but it's an alias of :root there.
  18030. support.scope = assert( function( el ) {
  18031. docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
  18032. return typeof el.querySelectorAll !== "undefined" &&
  18033. !el.querySelectorAll( ":scope fieldset div" ).length;
  18034. } );
  18035. /* Attributes
  18036. ---------------------------------------------------------------------- */
  18037. // Support: IE<8
  18038. // Verify that getAttribute really returns attributes and not properties
  18039. // (excepting IE8 booleans)
  18040. support.attributes = assert( function( el ) {
  18041. el.className = "i";
  18042. return !el.getAttribute( "className" );
  18043. } );
  18044. /* getElement(s)By*
  18045. ---------------------------------------------------------------------- */
  18046. // Check if getElementsByTagName("*") returns only elements
  18047. support.getElementsByTagName = assert( function( el ) {
  18048. el.appendChild( document.createComment( "" ) );
  18049. return !el.getElementsByTagName( "*" ).length;
  18050. } );
  18051. // Support: IE<9
  18052. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  18053. // Support: IE<10
  18054. // Check if getElementById returns elements by name
  18055. // The broken getElementById methods don't pick up programmatically-set names,
  18056. // so use a roundabout getElementsByName test
  18057. support.getById = assert( function( el ) {
  18058. docElem.appendChild( el ).id = expando;
  18059. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  18060. } );
  18061. // ID filter and find
  18062. if ( support.getById ) {
  18063. Expr.filter[ "ID" ] = function( id ) {
  18064. var attrId = id.replace( runescape, funescape );
  18065. return function( elem ) {
  18066. return elem.getAttribute( "id" ) === attrId;
  18067. };
  18068. };
  18069. Expr.find[ "ID" ] = function( id, context ) {
  18070. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  18071. var elem = context.getElementById( id );
  18072. return elem ? [ elem ] : [];
  18073. }
  18074. };
  18075. } else {
  18076. Expr.filter[ "ID" ] = function( id ) {
  18077. var attrId = id.replace( runescape, funescape );
  18078. return function( elem ) {
  18079. var node = typeof elem.getAttributeNode !== "undefined" &&
  18080. elem.getAttributeNode( "id" );
  18081. return node && node.value === attrId;
  18082. };
  18083. };
  18084. // Support: IE 6 - 7 only
  18085. // getElementById is not reliable as a find shortcut
  18086. Expr.find[ "ID" ] = function( id, context ) {
  18087. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  18088. var node, i, elems,
  18089. elem = context.getElementById( id );
  18090. if ( elem ) {
  18091. // Verify the id attribute
  18092. node = elem.getAttributeNode( "id" );
  18093. if ( node && node.value === id ) {
  18094. return [ elem ];
  18095. }
  18096. // Fall back on getElementsByName
  18097. elems = context.getElementsByName( id );
  18098. i = 0;
  18099. while ( ( elem = elems[ i++ ] ) ) {
  18100. node = elem.getAttributeNode( "id" );
  18101. if ( node && node.value === id ) {
  18102. return [ elem ];
  18103. }
  18104. }
  18105. }
  18106. return [];
  18107. }
  18108. };
  18109. }
  18110. // Tag
  18111. Expr.find[ "TAG" ] = support.getElementsByTagName ?
  18112. function( tag, context ) {
  18113. if ( typeof context.getElementsByTagName !== "undefined" ) {
  18114. return context.getElementsByTagName( tag );
  18115. // DocumentFragment nodes don't have gEBTN
  18116. } else if ( support.qsa ) {
  18117. return context.querySelectorAll( tag );
  18118. }
  18119. } :
  18120. function( tag, context ) {
  18121. var elem,
  18122. tmp = [],
  18123. i = 0,
  18124. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  18125. results = context.getElementsByTagName( tag );
  18126. // Filter out possible comments
  18127. if ( tag === "*" ) {
  18128. while ( ( elem = results[ i++ ] ) ) {
  18129. if ( elem.nodeType === 1 ) {
  18130. tmp.push( elem );
  18131. }
  18132. }
  18133. return tmp;
  18134. }
  18135. return results;
  18136. };
  18137. // Class
  18138. Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) {
  18139. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  18140. return context.getElementsByClassName( className );
  18141. }
  18142. };
  18143. /* QSA/matchesSelector
  18144. ---------------------------------------------------------------------- */
  18145. // QSA and matchesSelector support
  18146. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  18147. rbuggyMatches = [];
  18148. // qSa(:focus) reports false when true (Chrome 21)
  18149. // We allow this because of a bug in IE8/9 that throws an error
  18150. // whenever `document.activeElement` is accessed on an iframe
  18151. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  18152. // See https://bugs.jquery.com/ticket/13378
  18153. rbuggyQSA = [];
  18154. if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {
  18155. // Build QSA regex
  18156. // Regex strategy adopted from Diego Perini
  18157. assert( function( el ) {
  18158. var input;
  18159. // Select is set to empty string on purpose
  18160. // This is to test IE's treatment of not explicitly
  18161. // setting a boolean content attribute,
  18162. // since its presence should be enough
  18163. // https://bugs.jquery.com/ticket/12359
  18164. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  18165. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  18166. "<option selected=''></option></select>";
  18167. // Support: IE8, Opera 11-12.16
  18168. // Nothing should be selected when empty strings follow ^= or $= or *=
  18169. // The test attribute must be unknown in Opera but "safe" for WinRT
  18170. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  18171. if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) {
  18172. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  18173. }
  18174. // Support: IE8
  18175. // Boolean attributes and "value" are not treated correctly
  18176. if ( !el.querySelectorAll( "[selected]" ).length ) {
  18177. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  18178. }
  18179. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  18180. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  18181. rbuggyQSA.push( "~=" );
  18182. }
  18183. // Support: IE 11+, Edge 15 - 18+
  18184. // IE 11/Edge don't find elements on a `[name='']` query in some cases.
  18185. // Adding a temporary attribute to the document before the selection works
  18186. // around the issue.
  18187. // Interestingly, IE 10 & older don't seem to have the issue.
  18188. input = document.createElement( "input" );
  18189. input.setAttribute( "name", "" );
  18190. el.appendChild( input );
  18191. if ( !el.querySelectorAll( "[name='']" ).length ) {
  18192. rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
  18193. whitespace + "*(?:''|\"\")" );
  18194. }
  18195. // Webkit/Opera - :checked should return selected option elements
  18196. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  18197. // IE8 throws error here and will not see later tests
  18198. if ( !el.querySelectorAll( ":checked" ).length ) {
  18199. rbuggyQSA.push( ":checked" );
  18200. }
  18201. // Support: Safari 8+, iOS 8+
  18202. // https://bugs.webkit.org/show_bug.cgi?id=136851
  18203. // In-page `selector#id sibling-combinator selector` fails
  18204. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  18205. rbuggyQSA.push( ".#.+[+~]" );
  18206. }
  18207. // Support: Firefox <=3.6 - 5 only
  18208. // Old Firefox doesn't throw on a badly-escaped identifier.
  18209. el.querySelectorAll( "\\\f" );
  18210. rbuggyQSA.push( "[\\r\\n\\f]" );
  18211. } );
  18212. assert( function( el ) {
  18213. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  18214. "<select disabled='disabled'><option/></select>";
  18215. // Support: Windows 8 Native Apps
  18216. // The type and name attributes are restricted during .innerHTML assignment
  18217. var input = document.createElement( "input" );
  18218. input.setAttribute( "type", "hidden" );
  18219. el.appendChild( input ).setAttribute( "name", "D" );
  18220. // Support: IE8
  18221. // Enforce case-sensitivity of name attribute
  18222. if ( el.querySelectorAll( "[name=d]" ).length ) {
  18223. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  18224. }
  18225. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  18226. // IE8 throws error here and will not see later tests
  18227. if ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
  18228. rbuggyQSA.push( ":enabled", ":disabled" );
  18229. }
  18230. // Support: IE9-11+
  18231. // IE's :disabled selector does not pick up the children of disabled fieldsets
  18232. docElem.appendChild( el ).disabled = true;
  18233. if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
  18234. rbuggyQSA.push( ":enabled", ":disabled" );
  18235. }
  18236. // Support: Opera 10 - 11 only
  18237. // Opera 10-11 does not throw on post-comma invalid pseudos
  18238. el.querySelectorAll( "*,:x" );
  18239. rbuggyQSA.push( ",.*:" );
  18240. } );
  18241. }
  18242. if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
  18243. docElem.webkitMatchesSelector ||
  18244. docElem.mozMatchesSelector ||
  18245. docElem.oMatchesSelector ||
  18246. docElem.msMatchesSelector ) ) ) ) {
  18247. assert( function( el ) {
  18248. // Check to see if it's possible to do matchesSelector
  18249. // on a disconnected node (IE 9)
  18250. support.disconnectedMatch = matches.call( el, "*" );
  18251. // This should fail with an exception
  18252. // Gecko does not error, returns false instead
  18253. matches.call( el, "[s!='']:x" );
  18254. rbuggyMatches.push( "!=", pseudos );
  18255. } );
  18256. }
  18257. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
  18258. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) );
  18259. /* Contains
  18260. ---------------------------------------------------------------------- */
  18261. hasCompare = rnative.test( docElem.compareDocumentPosition );
  18262. // Element contains another
  18263. // Purposefully self-exclusive
  18264. // As in, an element does not contain itself
  18265. contains = hasCompare || rnative.test( docElem.contains ) ?
  18266. function( a, b ) {
  18267. var adown = a.nodeType === 9 ? a.documentElement : a,
  18268. bup = b && b.parentNode;
  18269. return a === bup || !!( bup && bup.nodeType === 1 && (
  18270. adown.contains ?
  18271. adown.contains( bup ) :
  18272. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  18273. ) );
  18274. } :
  18275. function( a, b ) {
  18276. if ( b ) {
  18277. while ( ( b = b.parentNode ) ) {
  18278. if ( b === a ) {
  18279. return true;
  18280. }
  18281. }
  18282. }
  18283. return false;
  18284. };
  18285. /* Sorting
  18286. ---------------------------------------------------------------------- */
  18287. // Document order sorting
  18288. sortOrder = hasCompare ?
  18289. function( a, b ) {
  18290. // Flag for duplicate removal
  18291. if ( a === b ) {
  18292. hasDuplicate = true;
  18293. return 0;
  18294. }
  18295. // Sort on method existence if only one input has compareDocumentPosition
  18296. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  18297. if ( compare ) {
  18298. return compare;
  18299. }
  18300. // Calculate position if both inputs belong to the same document
  18301. // Support: IE 11+, Edge 17 - 18+
  18302. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  18303. // two documents; shallow comparisons work.
  18304. // eslint-disable-next-line eqeqeq
  18305. compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
  18306. a.compareDocumentPosition( b ) :
  18307. // Otherwise we know they are disconnected
  18308. 1;
  18309. // Disconnected nodes
  18310. if ( compare & 1 ||
  18311. ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {
  18312. // Choose the first element that is related to our preferred document
  18313. // Support: IE 11+, Edge 17 - 18+
  18314. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  18315. // two documents; shallow comparisons work.
  18316. // eslint-disable-next-line eqeqeq
  18317. if ( a == document || a.ownerDocument == preferredDoc &&
  18318. contains( preferredDoc, a ) ) {
  18319. return -1;
  18320. }
  18321. // Support: IE 11+, Edge 17 - 18+
  18322. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  18323. // two documents; shallow comparisons work.
  18324. // eslint-disable-next-line eqeqeq
  18325. if ( b == document || b.ownerDocument == preferredDoc &&
  18326. contains( preferredDoc, b ) ) {
  18327. return 1;
  18328. }
  18329. // Maintain original order
  18330. return sortInput ?
  18331. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  18332. 0;
  18333. }
  18334. return compare & 4 ? -1 : 1;
  18335. } :
  18336. function( a, b ) {
  18337. // Exit early if the nodes are identical
  18338. if ( a === b ) {
  18339. hasDuplicate = true;
  18340. return 0;
  18341. }
  18342. var cur,
  18343. i = 0,
  18344. aup = a.parentNode,
  18345. bup = b.parentNode,
  18346. ap = [ a ],
  18347. bp = [ b ];
  18348. // Parentless nodes are either documents or disconnected
  18349. if ( !aup || !bup ) {
  18350. // Support: IE 11+, Edge 17 - 18+
  18351. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  18352. // two documents; shallow comparisons work.
  18353. /* eslint-disable eqeqeq */
  18354. return a == document ? -1 :
  18355. b == document ? 1 :
  18356. /* eslint-enable eqeqeq */
  18357. aup ? -1 :
  18358. bup ? 1 :
  18359. sortInput ?
  18360. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  18361. 0;
  18362. // If the nodes are siblings, we can do a quick check
  18363. } else if ( aup === bup ) {
  18364. return siblingCheck( a, b );
  18365. }
  18366. // Otherwise we need full lists of their ancestors for comparison
  18367. cur = a;
  18368. while ( ( cur = cur.parentNode ) ) {
  18369. ap.unshift( cur );
  18370. }
  18371. cur = b;
  18372. while ( ( cur = cur.parentNode ) ) {
  18373. bp.unshift( cur );
  18374. }
  18375. // Walk down the tree looking for a discrepancy
  18376. while ( ap[ i ] === bp[ i ] ) {
  18377. i++;
  18378. }
  18379. return i ?
  18380. // Do a sibling check if the nodes have a common ancestor
  18381. siblingCheck( ap[ i ], bp[ i ] ) :
  18382. // Otherwise nodes in our document sort first
  18383. // Support: IE 11+, Edge 17 - 18+
  18384. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  18385. // two documents; shallow comparisons work.
  18386. /* eslint-disable eqeqeq */
  18387. ap[ i ] == preferredDoc ? -1 :
  18388. bp[ i ] == preferredDoc ? 1 :
  18389. /* eslint-enable eqeqeq */
  18390. 0;
  18391. };
  18392. return document;
  18393. };
  18394. Sizzle.matches = function( expr, elements ) {
  18395. return Sizzle( expr, null, null, elements );
  18396. };
  18397. Sizzle.matchesSelector = function( elem, expr ) {
  18398. setDocument( elem );
  18399. if ( support.matchesSelector && documentIsHTML &&
  18400. !nonnativeSelectorCache[ expr + " " ] &&
  18401. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  18402. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  18403. try {
  18404. var ret = matches.call( elem, expr );
  18405. // IE 9's matchesSelector returns false on disconnected nodes
  18406. if ( ret || support.disconnectedMatch ||
  18407. // As well, disconnected nodes are said to be in a document
  18408. // fragment in IE 9
  18409. elem.document && elem.document.nodeType !== 11 ) {
  18410. return ret;
  18411. }
  18412. } catch ( e ) {
  18413. nonnativeSelectorCache( expr, true );
  18414. }
  18415. }
  18416. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  18417. };
  18418. Sizzle.contains = function( context, elem ) {
  18419. // Set document vars if needed
  18420. // Support: IE 11+, Edge 17 - 18+
  18421. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  18422. // two documents; shallow comparisons work.
  18423. // eslint-disable-next-line eqeqeq
  18424. if ( ( context.ownerDocument || context ) != document ) {
  18425. setDocument( context );
  18426. }
  18427. return contains( context, elem );
  18428. };
  18429. Sizzle.attr = function( elem, name ) {
  18430. // Set document vars if needed
  18431. // Support: IE 11+, Edge 17 - 18+
  18432. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  18433. // two documents; shallow comparisons work.
  18434. // eslint-disable-next-line eqeqeq
  18435. if ( ( elem.ownerDocument || elem ) != document ) {
  18436. setDocument( elem );
  18437. }
  18438. var fn = Expr.attrHandle[ name.toLowerCase() ],
  18439. // Don't get fooled by Object.prototype properties (jQuery #13807)
  18440. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  18441. fn( elem, name, !documentIsHTML ) :
  18442. undefined;
  18443. return val !== undefined ?
  18444. val :
  18445. support.attributes || !documentIsHTML ?
  18446. elem.getAttribute( name ) :
  18447. ( val = elem.getAttributeNode( name ) ) && val.specified ?
  18448. val.value :
  18449. null;
  18450. };
  18451. Sizzle.escape = function( sel ) {
  18452. return ( sel + "" ).replace( rcssescape, fcssescape );
  18453. };
  18454. Sizzle.error = function( msg ) {
  18455. throw new Error( "Syntax error, unrecognized expression: " + msg );
  18456. };
  18457. /**
  18458. * Document sorting and removing duplicates
  18459. * @param {ArrayLike} results
  18460. */
  18461. Sizzle.uniqueSort = function( results ) {
  18462. var elem,
  18463. duplicates = [],
  18464. j = 0,
  18465. i = 0;
  18466. // Unless we *know* we can detect duplicates, assume their presence
  18467. hasDuplicate = !support.detectDuplicates;
  18468. sortInput = !support.sortStable && results.slice( 0 );
  18469. results.sort( sortOrder );
  18470. if ( hasDuplicate ) {
  18471. while ( ( elem = results[ i++ ] ) ) {
  18472. if ( elem === results[ i ] ) {
  18473. j = duplicates.push( i );
  18474. }
  18475. }
  18476. while ( j-- ) {
  18477. results.splice( duplicates[ j ], 1 );
  18478. }
  18479. }
  18480. // Clear input after sorting to release objects
  18481. // See https://github.com/jquery/sizzle/pull/225
  18482. sortInput = null;
  18483. return results;
  18484. };
  18485. /**
  18486. * Utility function for retrieving the text value of an array of DOM nodes
  18487. * @param {Array|Element} elem
  18488. */
  18489. getText = Sizzle.getText = function( elem ) {
  18490. var node,
  18491. ret = "",
  18492. i = 0,
  18493. nodeType = elem.nodeType;
  18494. if ( !nodeType ) {
  18495. // If no nodeType, this is expected to be an array
  18496. while ( ( node = elem[ i++ ] ) ) {
  18497. // Do not traverse comment nodes
  18498. ret += getText( node );
  18499. }
  18500. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  18501. // Use textContent for elements
  18502. // innerText usage removed for consistency of new lines (jQuery #11153)
  18503. if ( typeof elem.textContent === "string" ) {
  18504. return elem.textContent;
  18505. } else {
  18506. // Traverse its children
  18507. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  18508. ret += getText( elem );
  18509. }
  18510. }
  18511. } else if ( nodeType === 3 || nodeType === 4 ) {
  18512. return elem.nodeValue;
  18513. }
  18514. // Do not include comment or processing instruction nodes
  18515. return ret;
  18516. };
  18517. Expr = Sizzle.selectors = {
  18518. // Can be adjusted by the user
  18519. cacheLength: 50,
  18520. createPseudo: markFunction,
  18521. match: matchExpr,
  18522. attrHandle: {},
  18523. find: {},
  18524. relative: {
  18525. ">": { dir: "parentNode", first: true },
  18526. " ": { dir: "parentNode" },
  18527. "+": { dir: "previousSibling", first: true },
  18528. "~": { dir: "previousSibling" }
  18529. },
  18530. preFilter: {
  18531. "ATTR": function( match ) {
  18532. match[ 1 ] = match[ 1 ].replace( runescape, funescape );
  18533. // Move the given value to match[3] whether quoted or unquoted
  18534. match[ 3 ] = ( match[ 3 ] || match[ 4 ] ||
  18535. match[ 5 ] || "" ).replace( runescape, funescape );
  18536. if ( match[ 2 ] === "~=" ) {
  18537. match[ 3 ] = " " + match[ 3 ] + " ";
  18538. }
  18539. return match.slice( 0, 4 );
  18540. },
  18541. "CHILD": function( match ) {
  18542. /* matches from matchExpr["CHILD"]
  18543. 1 type (only|nth|...)
  18544. 2 what (child|of-type)
  18545. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  18546. 4 xn-component of xn+y argument ([+-]?\d*n|)
  18547. 5 sign of xn-component
  18548. 6 x of xn-component
  18549. 7 sign of y-component
  18550. 8 y of y-component
  18551. */
  18552. match[ 1 ] = match[ 1 ].toLowerCase();
  18553. if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
  18554. // nth-* requires argument
  18555. if ( !match[ 3 ] ) {
  18556. Sizzle.error( match[ 0 ] );
  18557. }
  18558. // numeric x and y parameters for Expr.filter.CHILD
  18559. // remember that false/true cast respectively to 0/1
  18560. match[ 4 ] = +( match[ 4 ] ?
  18561. match[ 5 ] + ( match[ 6 ] || 1 ) :
  18562. 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) );
  18563. match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
  18564. // other types prohibit arguments
  18565. } else if ( match[ 3 ] ) {
  18566. Sizzle.error( match[ 0 ] );
  18567. }
  18568. return match;
  18569. },
  18570. "PSEUDO": function( match ) {
  18571. var excess,
  18572. unquoted = !match[ 6 ] && match[ 2 ];
  18573. if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
  18574. return null;
  18575. }
  18576. // Accept quoted arguments as-is
  18577. if ( match[ 3 ] ) {
  18578. match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
  18579. // Strip excess characters from unquoted arguments
  18580. } else if ( unquoted && rpseudo.test( unquoted ) &&
  18581. // Get excess from tokenize (recursively)
  18582. ( excess = tokenize( unquoted, true ) ) &&
  18583. // advance to the next closing parenthesis
  18584. ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
  18585. // excess is a negative index
  18586. match[ 0 ] = match[ 0 ].slice( 0, excess );
  18587. match[ 2 ] = unquoted.slice( 0, excess );
  18588. }
  18589. // Return only captures needed by the pseudo filter method (type and argument)
  18590. return match.slice( 0, 3 );
  18591. }
  18592. },
  18593. filter: {
  18594. "TAG": function( nodeNameSelector ) {
  18595. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  18596. return nodeNameSelector === "*" ?
  18597. function() {
  18598. return true;
  18599. } :
  18600. function( elem ) {
  18601. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  18602. };
  18603. },
  18604. "CLASS": function( className ) {
  18605. var pattern = classCache[ className + " " ];
  18606. return pattern ||
  18607. ( pattern = new RegExp( "(^|" + whitespace +
  18608. ")" + className + "(" + whitespace + "|$)" ) ) && classCache(
  18609. className, function( elem ) {
  18610. return pattern.test(
  18611. typeof elem.className === "string" && elem.className ||
  18612. typeof elem.getAttribute !== "undefined" &&
  18613. elem.getAttribute( "class" ) ||
  18614. ""
  18615. );
  18616. } );
  18617. },
  18618. "ATTR": function( name, operator, check ) {
  18619. return function( elem ) {
  18620. var result = Sizzle.attr( elem, name );
  18621. if ( result == null ) {
  18622. return operator === "!=";
  18623. }
  18624. if ( !operator ) {
  18625. return true;
  18626. }
  18627. result += "";
  18628. /* eslint-disable max-len */
  18629. return operator === "=" ? result === check :
  18630. operator === "!=" ? result !== check :
  18631. operator === "^=" ? check && result.indexOf( check ) === 0 :
  18632. operator === "*=" ? check && result.indexOf( check ) > -1 :
  18633. operator === "$=" ? check && result.slice( -check.length ) === check :
  18634. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  18635. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  18636. false;
  18637. /* eslint-enable max-len */
  18638. };
  18639. },
  18640. "CHILD": function( type, what, _argument, first, last ) {
  18641. var simple = type.slice( 0, 3 ) !== "nth",
  18642. forward = type.slice( -4 ) !== "last",
  18643. ofType = what === "of-type";
  18644. return first === 1 && last === 0 ?
  18645. // Shortcut for :nth-*(n)
  18646. function( elem ) {
  18647. return !!elem.parentNode;
  18648. } :
  18649. function( elem, _context, xml ) {
  18650. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  18651. dir = simple !== forward ? "nextSibling" : "previousSibling",
  18652. parent = elem.parentNode,
  18653. name = ofType && elem.nodeName.toLowerCase(),
  18654. useCache = !xml && !ofType,
  18655. diff = false;
  18656. if ( parent ) {
  18657. // :(first|last|only)-(child|of-type)
  18658. if ( simple ) {
  18659. while ( dir ) {
  18660. node = elem;
  18661. while ( ( node = node[ dir ] ) ) {
  18662. if ( ofType ?
  18663. node.nodeName.toLowerCase() === name :
  18664. node.nodeType === 1 ) {
  18665. return false;
  18666. }
  18667. }
  18668. // Reverse direction for :only-* (if we haven't yet done so)
  18669. start = dir = type === "only" && !start && "nextSibling";
  18670. }
  18671. return true;
  18672. }
  18673. start = [ forward ? parent.firstChild : parent.lastChild ];
  18674. // non-xml :nth-child(...) stores cache data on `parent`
  18675. if ( forward && useCache ) {
  18676. // Seek `elem` from a previously-cached index
  18677. // ...in a gzip-friendly way
  18678. node = parent;
  18679. outerCache = node[ expando ] || ( node[ expando ] = {} );
  18680. // Support: IE <9 only
  18681. // Defend against cloned attroperties (jQuery gh-1709)
  18682. uniqueCache = outerCache[ node.uniqueID ] ||
  18683. ( outerCache[ node.uniqueID ] = {} );
  18684. cache = uniqueCache[ type ] || [];
  18685. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  18686. diff = nodeIndex && cache[ 2 ];
  18687. node = nodeIndex && parent.childNodes[ nodeIndex ];
  18688. while ( ( node = ++nodeIndex && node && node[ dir ] ||
  18689. // Fallback to seeking `elem` from the start
  18690. ( diff = nodeIndex = 0 ) || start.pop() ) ) {
  18691. // When found, cache indexes on `parent` and break
  18692. if ( node.nodeType === 1 && ++diff && node === elem ) {
  18693. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  18694. break;
  18695. }
  18696. }
  18697. } else {
  18698. // Use previously-cached element index if available
  18699. if ( useCache ) {
  18700. // ...in a gzip-friendly way
  18701. node = elem;
  18702. outerCache = node[ expando ] || ( node[ expando ] = {} );
  18703. // Support: IE <9 only
  18704. // Defend against cloned attroperties (jQuery gh-1709)
  18705. uniqueCache = outerCache[ node.uniqueID ] ||
  18706. ( outerCache[ node.uniqueID ] = {} );
  18707. cache = uniqueCache[ type ] || [];
  18708. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  18709. diff = nodeIndex;
  18710. }
  18711. // xml :nth-child(...)
  18712. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  18713. if ( diff === false ) {
  18714. // Use the same loop as above to seek `elem` from the start
  18715. while ( ( node = ++nodeIndex && node && node[ dir ] ||
  18716. ( diff = nodeIndex = 0 ) || start.pop() ) ) {
  18717. if ( ( ofType ?
  18718. node.nodeName.toLowerCase() === name :
  18719. node.nodeType === 1 ) &&
  18720. ++diff ) {
  18721. // Cache the index of each encountered element
  18722. if ( useCache ) {
  18723. outerCache = node[ expando ] ||
  18724. ( node[ expando ] = {} );
  18725. // Support: IE <9 only
  18726. // Defend against cloned attroperties (jQuery gh-1709)
  18727. uniqueCache = outerCache[ node.uniqueID ] ||
  18728. ( outerCache[ node.uniqueID ] = {} );
  18729. uniqueCache[ type ] = [ dirruns, diff ];
  18730. }
  18731. if ( node === elem ) {
  18732. break;
  18733. }
  18734. }
  18735. }
  18736. }
  18737. }
  18738. // Incorporate the offset, then check against cycle size
  18739. diff -= last;
  18740. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  18741. }
  18742. };
  18743. },
  18744. "PSEUDO": function( pseudo, argument ) {
  18745. // pseudo-class names are case-insensitive
  18746. // http://www.w3.org/TR/selectors/#pseudo-classes
  18747. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  18748. // Remember that setFilters inherits from pseudos
  18749. var args,
  18750. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  18751. Sizzle.error( "unsupported pseudo: " + pseudo );
  18752. // The user may use createPseudo to indicate that
  18753. // arguments are needed to create the filter function
  18754. // just as Sizzle does
  18755. if ( fn[ expando ] ) {
  18756. return fn( argument );
  18757. }
  18758. // But maintain support for old signatures
  18759. if ( fn.length > 1 ) {
  18760. args = [ pseudo, pseudo, "", argument ];
  18761. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  18762. markFunction( function( seed, matches ) {
  18763. var idx,
  18764. matched = fn( seed, argument ),
  18765. i = matched.length;
  18766. while ( i-- ) {
  18767. idx = indexOf( seed, matched[ i ] );
  18768. seed[ idx ] = !( matches[ idx ] = matched[ i ] );
  18769. }
  18770. } ) :
  18771. function( elem ) {
  18772. return fn( elem, 0, args );
  18773. };
  18774. }
  18775. return fn;
  18776. }
  18777. },
  18778. pseudos: {
  18779. // Potentially complex pseudos
  18780. "not": markFunction( function( selector ) {
  18781. // Trim the selector passed to compile
  18782. // to avoid treating leading and trailing
  18783. // spaces as combinators
  18784. var input = [],
  18785. results = [],
  18786. matcher = compile( selector.replace( rtrim, "$1" ) );
  18787. return matcher[ expando ] ?
  18788. markFunction( function( seed, matches, _context, xml ) {
  18789. var elem,
  18790. unmatched = matcher( seed, null, xml, [] ),
  18791. i = seed.length;
  18792. // Match elements unmatched by `matcher`
  18793. while ( i-- ) {
  18794. if ( ( elem = unmatched[ i ] ) ) {
  18795. seed[ i ] = !( matches[ i ] = elem );
  18796. }
  18797. }
  18798. } ) :
  18799. function( elem, _context, xml ) {
  18800. input[ 0 ] = elem;
  18801. matcher( input, null, xml, results );
  18802. // Don't keep the element (issue #299)
  18803. input[ 0 ] = null;
  18804. return !results.pop();
  18805. };
  18806. } ),
  18807. "has": markFunction( function( selector ) {
  18808. return function( elem ) {
  18809. return Sizzle( selector, elem ).length > 0;
  18810. };
  18811. } ),
  18812. "contains": markFunction( function( text ) {
  18813. text = text.replace( runescape, funescape );
  18814. return function( elem ) {
  18815. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  18816. };
  18817. } ),
  18818. // "Whether an element is represented by a :lang() selector
  18819. // is based solely on the element's language value
  18820. // being equal to the identifier C,
  18821. // or beginning with the identifier C immediately followed by "-".
  18822. // The matching of C against the element's language value is performed case-insensitively.
  18823. // The identifier C does not have to be a valid language name."
  18824. // http://www.w3.org/TR/selectors/#lang-pseudo
  18825. "lang": markFunction( function( lang ) {
  18826. // lang value must be a valid identifier
  18827. if ( !ridentifier.test( lang || "" ) ) {
  18828. Sizzle.error( "unsupported lang: " + lang );
  18829. }
  18830. lang = lang.replace( runescape, funescape ).toLowerCase();
  18831. return function( elem ) {
  18832. var elemLang;
  18833. do {
  18834. if ( ( elemLang = documentIsHTML ?
  18835. elem.lang :
  18836. elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
  18837. elemLang = elemLang.toLowerCase();
  18838. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  18839. }
  18840. } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
  18841. return false;
  18842. };
  18843. } ),
  18844. // Miscellaneous
  18845. "target": function( elem ) {
  18846. var hash = window.location && window.location.hash;
  18847. return hash && hash.slice( 1 ) === elem.id;
  18848. },
  18849. "root": function( elem ) {
  18850. return elem === docElem;
  18851. },
  18852. "focus": function( elem ) {
  18853. return elem === document.activeElement &&
  18854. ( !document.hasFocus || document.hasFocus() ) &&
  18855. !!( elem.type || elem.href || ~elem.tabIndex );
  18856. },
  18857. // Boolean properties
  18858. "enabled": createDisabledPseudo( false ),
  18859. "disabled": createDisabledPseudo( true ),
  18860. "checked": function( elem ) {
  18861. // In CSS3, :checked should return both checked and selected elements
  18862. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  18863. var nodeName = elem.nodeName.toLowerCase();
  18864. return ( nodeName === "input" && !!elem.checked ) ||
  18865. ( nodeName === "option" && !!elem.selected );
  18866. },
  18867. "selected": function( elem ) {
  18868. // Accessing this property makes selected-by-default
  18869. // options in Safari work properly
  18870. if ( elem.parentNode ) {
  18871. // eslint-disable-next-line no-unused-expressions
  18872. elem.parentNode.selectedIndex;
  18873. }
  18874. return elem.selected === true;
  18875. },
  18876. // Contents
  18877. "empty": function( elem ) {
  18878. // http://www.w3.org/TR/selectors/#empty-pseudo
  18879. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  18880. // but not by others (comment: 8; processing instruction: 7; etc.)
  18881. // nodeType < 6 works because attributes (2) do not appear as children
  18882. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  18883. if ( elem.nodeType < 6 ) {
  18884. return false;
  18885. }
  18886. }
  18887. return true;
  18888. },
  18889. "parent": function( elem ) {
  18890. return !Expr.pseudos[ "empty" ]( elem );
  18891. },
  18892. // Element/input types
  18893. "header": function( elem ) {
  18894. return rheader.test( elem.nodeName );
  18895. },
  18896. "input": function( elem ) {
  18897. return rinputs.test( elem.nodeName );
  18898. },
  18899. "button": function( elem ) {
  18900. var name = elem.nodeName.toLowerCase();
  18901. return name === "input" && elem.type === "button" || name === "button";
  18902. },
  18903. "text": function( elem ) {
  18904. var attr;
  18905. return elem.nodeName.toLowerCase() === "input" &&
  18906. elem.type === "text" &&
  18907. // Support: IE<8
  18908. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  18909. ( ( attr = elem.getAttribute( "type" ) ) == null ||
  18910. attr.toLowerCase() === "text" );
  18911. },
  18912. // Position-in-collection
  18913. "first": createPositionalPseudo( function() {
  18914. return [ 0 ];
  18915. } ),
  18916. "last": createPositionalPseudo( function( _matchIndexes, length ) {
  18917. return [ length - 1 ];
  18918. } ),
  18919. "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) {
  18920. return [ argument < 0 ? argument + length : argument ];
  18921. } ),
  18922. "even": createPositionalPseudo( function( matchIndexes, length ) {
  18923. var i = 0;
  18924. for ( ; i < length; i += 2 ) {
  18925. matchIndexes.push( i );
  18926. }
  18927. return matchIndexes;
  18928. } ),
  18929. "odd": createPositionalPseudo( function( matchIndexes, length ) {
  18930. var i = 1;
  18931. for ( ; i < length; i += 2 ) {
  18932. matchIndexes.push( i );
  18933. }
  18934. return matchIndexes;
  18935. } ),
  18936. "lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
  18937. var i = argument < 0 ?
  18938. argument + length :
  18939. argument > length ?
  18940. length :
  18941. argument;
  18942. for ( ; --i >= 0; ) {
  18943. matchIndexes.push( i );
  18944. }
  18945. return matchIndexes;
  18946. } ),
  18947. "gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
  18948. var i = argument < 0 ? argument + length : argument;
  18949. for ( ; ++i < length; ) {
  18950. matchIndexes.push( i );
  18951. }
  18952. return matchIndexes;
  18953. } )
  18954. }
  18955. };
  18956. Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];
  18957. // Add button/input type pseudos
  18958. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  18959. Expr.pseudos[ i ] = createInputPseudo( i );
  18960. }
  18961. for ( i in { submit: true, reset: true } ) {
  18962. Expr.pseudos[ i ] = createButtonPseudo( i );
  18963. }
  18964. // Easy API for creating new setFilters
  18965. function setFilters() {}
  18966. setFilters.prototype = Expr.filters = Expr.pseudos;
  18967. Expr.setFilters = new setFilters();
  18968. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  18969. var matched, match, tokens, type,
  18970. soFar, groups, preFilters,
  18971. cached = tokenCache[ selector + " " ];
  18972. if ( cached ) {
  18973. return parseOnly ? 0 : cached.slice( 0 );
  18974. }
  18975. soFar = selector;
  18976. groups = [];
  18977. preFilters = Expr.preFilter;
  18978. while ( soFar ) {
  18979. // Comma and first run
  18980. if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
  18981. if ( match ) {
  18982. // Don't consume trailing commas as valid
  18983. soFar = soFar.slice( match[ 0 ].length ) || soFar;
  18984. }
  18985. groups.push( ( tokens = [] ) );
  18986. }
  18987. matched = false;
  18988. // Combinators
  18989. if ( ( match = rcombinators.exec( soFar ) ) ) {
  18990. matched = match.shift();
  18991. tokens.push( {
  18992. value: matched,
  18993. // Cast descendant combinators to space
  18994. type: match[ 0 ].replace( rtrim, " " )
  18995. } );
  18996. soFar = soFar.slice( matched.length );
  18997. }
  18998. // Filters
  18999. for ( type in Expr.filter ) {
  19000. if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
  19001. ( match = preFilters[ type ]( match ) ) ) ) {
  19002. matched = match.shift();
  19003. tokens.push( {
  19004. value: matched,
  19005. type: type,
  19006. matches: match
  19007. } );
  19008. soFar = soFar.slice( matched.length );
  19009. }
  19010. }
  19011. if ( !matched ) {
  19012. break;
  19013. }
  19014. }
  19015. // Return the length of the invalid excess
  19016. // if we're just parsing
  19017. // Otherwise, throw an error or return tokens
  19018. return parseOnly ?
  19019. soFar.length :
  19020. soFar ?
  19021. Sizzle.error( selector ) :
  19022. // Cache the tokens
  19023. tokenCache( selector, groups ).slice( 0 );
  19024. };
  19025. function toSelector( tokens ) {
  19026. var i = 0,
  19027. len = tokens.length,
  19028. selector = "";
  19029. for ( ; i < len; i++ ) {
  19030. selector += tokens[ i ].value;
  19031. }
  19032. return selector;
  19033. }
  19034. function addCombinator( matcher, combinator, base ) {
  19035. var dir = combinator.dir,
  19036. skip = combinator.next,
  19037. key = skip || dir,
  19038. checkNonElements = base && key === "parentNode",
  19039. doneName = done++;
  19040. return combinator.first ?
  19041. // Check against closest ancestor/preceding element
  19042. function( elem, context, xml ) {
  19043. while ( ( elem = elem[ dir ] ) ) {
  19044. if ( elem.nodeType === 1 || checkNonElements ) {
  19045. return matcher( elem, context, xml );
  19046. }
  19047. }
  19048. return false;
  19049. } :
  19050. // Check against all ancestor/preceding elements
  19051. function( elem, context, xml ) {
  19052. var oldCache, uniqueCache, outerCache,
  19053. newCache = [ dirruns, doneName ];
  19054. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  19055. if ( xml ) {
  19056. while ( ( elem = elem[ dir ] ) ) {
  19057. if ( elem.nodeType === 1 || checkNonElements ) {
  19058. if ( matcher( elem, context, xml ) ) {
  19059. return true;
  19060. }
  19061. }
  19062. }
  19063. } else {
  19064. while ( ( elem = elem[ dir ] ) ) {
  19065. if ( elem.nodeType === 1 || checkNonElements ) {
  19066. outerCache = elem[ expando ] || ( elem[ expando ] = {} );
  19067. // Support: IE <9 only
  19068. // Defend against cloned attroperties (jQuery gh-1709)
  19069. uniqueCache = outerCache[ elem.uniqueID ] ||
  19070. ( outerCache[ elem.uniqueID ] = {} );
  19071. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  19072. elem = elem[ dir ] || elem;
  19073. } else if ( ( oldCache = uniqueCache[ key ] ) &&
  19074. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  19075. // Assign to newCache so results back-propagate to previous elements
  19076. return ( newCache[ 2 ] = oldCache[ 2 ] );
  19077. } else {
  19078. // Reuse newcache so results back-propagate to previous elements
  19079. uniqueCache[ key ] = newCache;
  19080. // A match means we're done; a fail means we have to keep checking
  19081. if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
  19082. return true;
  19083. }
  19084. }
  19085. }
  19086. }
  19087. }
  19088. return false;
  19089. };
  19090. }
  19091. function elementMatcher( matchers ) {
  19092. return matchers.length > 1 ?
  19093. function( elem, context, xml ) {
  19094. var i = matchers.length;
  19095. while ( i-- ) {
  19096. if ( !matchers[ i ]( elem, context, xml ) ) {
  19097. return false;
  19098. }
  19099. }
  19100. return true;
  19101. } :
  19102. matchers[ 0 ];
  19103. }
  19104. function multipleContexts( selector, contexts, results ) {
  19105. var i = 0,
  19106. len = contexts.length;
  19107. for ( ; i < len; i++ ) {
  19108. Sizzle( selector, contexts[ i ], results );
  19109. }
  19110. return results;
  19111. }
  19112. function condense( unmatched, map, filter, context, xml ) {
  19113. var elem,
  19114. newUnmatched = [],
  19115. i = 0,
  19116. len = unmatched.length,
  19117. mapped = map != null;
  19118. for ( ; i < len; i++ ) {
  19119. if ( ( elem = unmatched[ i ] ) ) {
  19120. if ( !filter || filter( elem, context, xml ) ) {
  19121. newUnmatched.push( elem );
  19122. if ( mapped ) {
  19123. map.push( i );
  19124. }
  19125. }
  19126. }
  19127. }
  19128. return newUnmatched;
  19129. }
  19130. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  19131. if ( postFilter && !postFilter[ expando ] ) {
  19132. postFilter = setMatcher( postFilter );
  19133. }
  19134. if ( postFinder && !postFinder[ expando ] ) {
  19135. postFinder = setMatcher( postFinder, postSelector );
  19136. }
  19137. return markFunction( function( seed, results, context, xml ) {
  19138. var temp, i, elem,
  19139. preMap = [],
  19140. postMap = [],
  19141. preexisting = results.length,
  19142. // Get initial elements from seed or context
  19143. elems = seed || multipleContexts(
  19144. selector || "*",
  19145. context.nodeType ? [ context ] : context,
  19146. []
  19147. ),
  19148. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  19149. matcherIn = preFilter && ( seed || !selector ) ?
  19150. condense( elems, preMap, preFilter, context, xml ) :
  19151. elems,
  19152. matcherOut = matcher ?
  19153. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  19154. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  19155. // ...intermediate processing is necessary
  19156. [] :
  19157. // ...otherwise use results directly
  19158. results :
  19159. matcherIn;
  19160. // Find primary matches
  19161. if ( matcher ) {
  19162. matcher( matcherIn, matcherOut, context, xml );
  19163. }
  19164. // Apply postFilter
  19165. if ( postFilter ) {
  19166. temp = condense( matcherOut, postMap );
  19167. postFilter( temp, [], context, xml );
  19168. // Un-match failing elements by moving them back to matcherIn
  19169. i = temp.length;
  19170. while ( i-- ) {
  19171. if ( ( elem = temp[ i ] ) ) {
  19172. matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
  19173. }
  19174. }
  19175. }
  19176. if ( seed ) {
  19177. if ( postFinder || preFilter ) {
  19178. if ( postFinder ) {
  19179. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  19180. temp = [];
  19181. i = matcherOut.length;
  19182. while ( i-- ) {
  19183. if ( ( elem = matcherOut[ i ] ) ) {
  19184. // Restore matcherIn since elem is not yet a final match
  19185. temp.push( ( matcherIn[ i ] = elem ) );
  19186. }
  19187. }
  19188. postFinder( null, ( matcherOut = [] ), temp, xml );
  19189. }
  19190. // Move matched elements from seed to results to keep them synchronized
  19191. i = matcherOut.length;
  19192. while ( i-- ) {
  19193. if ( ( elem = matcherOut[ i ] ) &&
  19194. ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) {
  19195. seed[ temp ] = !( results[ temp ] = elem );
  19196. }
  19197. }
  19198. }
  19199. // Add elements to results, through postFinder if defined
  19200. } else {
  19201. matcherOut = condense(
  19202. matcherOut === results ?
  19203. matcherOut.splice( preexisting, matcherOut.length ) :
  19204. matcherOut
  19205. );
  19206. if ( postFinder ) {
  19207. postFinder( null, results, matcherOut, xml );
  19208. } else {
  19209. push.apply( results, matcherOut );
  19210. }
  19211. }
  19212. } );
  19213. }
  19214. function matcherFromTokens( tokens ) {
  19215. var checkContext, matcher, j,
  19216. len = tokens.length,
  19217. leadingRelative = Expr.relative[ tokens[ 0 ].type ],
  19218. implicitRelative = leadingRelative || Expr.relative[ " " ],
  19219. i = leadingRelative ? 1 : 0,
  19220. // The foundational matcher ensures that elements are reachable from top-level context(s)
  19221. matchContext = addCombinator( function( elem ) {
  19222. return elem === checkContext;
  19223. }, implicitRelative, true ),
  19224. matchAnyContext = addCombinator( function( elem ) {
  19225. return indexOf( checkContext, elem ) > -1;
  19226. }, implicitRelative, true ),
  19227. matchers = [ function( elem, context, xml ) {
  19228. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  19229. ( checkContext = context ).nodeType ?
  19230. matchContext( elem, context, xml ) :
  19231. matchAnyContext( elem, context, xml ) );
  19232. // Avoid hanging onto element (issue #299)
  19233. checkContext = null;
  19234. return ret;
  19235. } ];
  19236. for ( ; i < len; i++ ) {
  19237. if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
  19238. matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
  19239. } else {
  19240. matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
  19241. // Return special upon seeing a positional matcher
  19242. if ( matcher[ expando ] ) {
  19243. // Find the next relative operator (if any) for proper handling
  19244. j = ++i;
  19245. for ( ; j < len; j++ ) {
  19246. if ( Expr.relative[ tokens[ j ].type ] ) {
  19247. break;
  19248. }
  19249. }
  19250. return setMatcher(
  19251. i > 1 && elementMatcher( matchers ),
  19252. i > 1 && toSelector(
  19253. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  19254. tokens
  19255. .slice( 0, i - 1 )
  19256. .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
  19257. ).replace( rtrim, "$1" ),
  19258. matcher,
  19259. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  19260. j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
  19261. j < len && toSelector( tokens )
  19262. );
  19263. }
  19264. matchers.push( matcher );
  19265. }
  19266. }
  19267. return elementMatcher( matchers );
  19268. }
  19269. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  19270. var bySet = setMatchers.length > 0,
  19271. byElement = elementMatchers.length > 0,
  19272. superMatcher = function( seed, context, xml, results, outermost ) {
  19273. var elem, j, matcher,
  19274. matchedCount = 0,
  19275. i = "0",
  19276. unmatched = seed && [],
  19277. setMatched = [],
  19278. contextBackup = outermostContext,
  19279. // We must always have either seed elements or outermost context
  19280. elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ),
  19281. // Use integer dirruns iff this is the outermost matcher
  19282. dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
  19283. len = elems.length;
  19284. if ( outermost ) {
  19285. // Support: IE 11+, Edge 17 - 18+
  19286. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  19287. // two documents; shallow comparisons work.
  19288. // eslint-disable-next-line eqeqeq
  19289. outermostContext = context == document || context || outermost;
  19290. }
  19291. // Add elements passing elementMatchers directly to results
  19292. // Support: IE<9, Safari
  19293. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  19294. for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
  19295. if ( byElement && elem ) {
  19296. j = 0;
  19297. // Support: IE 11+, Edge 17 - 18+
  19298. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  19299. // two documents; shallow comparisons work.
  19300. // eslint-disable-next-line eqeqeq
  19301. if ( !context && elem.ownerDocument != document ) {
  19302. setDocument( elem );
  19303. xml = !documentIsHTML;
  19304. }
  19305. while ( ( matcher = elementMatchers[ j++ ] ) ) {
  19306. if ( matcher( elem, context || document, xml ) ) {
  19307. results.push( elem );
  19308. break;
  19309. }
  19310. }
  19311. if ( outermost ) {
  19312. dirruns = dirrunsUnique;
  19313. }
  19314. }
  19315. // Track unmatched elements for set filters
  19316. if ( bySet ) {
  19317. // They will have gone through all possible matchers
  19318. if ( ( elem = !matcher && elem ) ) {
  19319. matchedCount--;
  19320. }
  19321. // Lengthen the array for every element, matched or not
  19322. if ( seed ) {
  19323. unmatched.push( elem );
  19324. }
  19325. }
  19326. }
  19327. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  19328. // makes the latter nonnegative.
  19329. matchedCount += i;
  19330. // Apply set filters to unmatched elements
  19331. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  19332. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  19333. // no element matchers and no seed.
  19334. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  19335. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  19336. // numerically zero.
  19337. if ( bySet && i !== matchedCount ) {
  19338. j = 0;
  19339. while ( ( matcher = setMatchers[ j++ ] ) ) {
  19340. matcher( unmatched, setMatched, context, xml );
  19341. }
  19342. if ( seed ) {
  19343. // Reintegrate element matches to eliminate the need for sorting
  19344. if ( matchedCount > 0 ) {
  19345. while ( i-- ) {
  19346. if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
  19347. setMatched[ i ] = pop.call( results );
  19348. }
  19349. }
  19350. }
  19351. // Discard index placeholder values to get only actual matches
  19352. setMatched = condense( setMatched );
  19353. }
  19354. // Add matches to results
  19355. push.apply( results, setMatched );
  19356. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  19357. if ( outermost && !seed && setMatched.length > 0 &&
  19358. ( matchedCount + setMatchers.length ) > 1 ) {
  19359. Sizzle.uniqueSort( results );
  19360. }
  19361. }
  19362. // Override manipulation of globals by nested matchers
  19363. if ( outermost ) {
  19364. dirruns = dirrunsUnique;
  19365. outermostContext = contextBackup;
  19366. }
  19367. return unmatched;
  19368. };
  19369. return bySet ?
  19370. markFunction( superMatcher ) :
  19371. superMatcher;
  19372. }
  19373. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  19374. var i,
  19375. setMatchers = [],
  19376. elementMatchers = [],
  19377. cached = compilerCache[ selector + " " ];
  19378. if ( !cached ) {
  19379. // Generate a function of recursive functions that can be used to check each element
  19380. if ( !match ) {
  19381. match = tokenize( selector );
  19382. }
  19383. i = match.length;
  19384. while ( i-- ) {
  19385. cached = matcherFromTokens( match[ i ] );
  19386. if ( cached[ expando ] ) {
  19387. setMatchers.push( cached );
  19388. } else {
  19389. elementMatchers.push( cached );
  19390. }
  19391. }
  19392. // Cache the compiled function
  19393. cached = compilerCache(
  19394. selector,
  19395. matcherFromGroupMatchers( elementMatchers, setMatchers )
  19396. );
  19397. // Save selector and tokenization
  19398. cached.selector = selector;
  19399. }
  19400. return cached;
  19401. };
  19402. /**
  19403. * A low-level selection function that works with Sizzle's compiled
  19404. * selector functions
  19405. * @param {String|Function} selector A selector or a pre-compiled
  19406. * selector function built with Sizzle.compile
  19407. * @param {Element} context
  19408. * @param {Array} [results]
  19409. * @param {Array} [seed] A set of elements to match against
  19410. */
  19411. select = Sizzle.select = function( selector, context, results, seed ) {
  19412. var i, tokens, token, type, find,
  19413. compiled = typeof selector === "function" && selector,
  19414. match = !seed && tokenize( ( selector = compiled.selector || selector ) );
  19415. results = results || [];
  19416. // Try to minimize operations if there is only one selector in the list and no seed
  19417. // (the latter of which guarantees us context)
  19418. if ( match.length === 1 ) {
  19419. // Reduce context if the leading compound selector is an ID
  19420. tokens = match[ 0 ] = match[ 0 ].slice( 0 );
  19421. if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
  19422. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
  19423. context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
  19424. .replace( runescape, funescape ), context ) || [] )[ 0 ];
  19425. if ( !context ) {
  19426. return results;
  19427. // Precompiled matchers will still verify ancestry, so step up a level
  19428. } else if ( compiled ) {
  19429. context = context.parentNode;
  19430. }
  19431. selector = selector.slice( tokens.shift().value.length );
  19432. }
  19433. // Fetch a seed set for right-to-left matching
  19434. i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
  19435. while ( i-- ) {
  19436. token = tokens[ i ];
  19437. // Abort if we hit a combinator
  19438. if ( Expr.relative[ ( type = token.type ) ] ) {
  19439. break;
  19440. }
  19441. if ( ( find = Expr.find[ type ] ) ) {
  19442. // Search, expanding context for leading sibling combinators
  19443. if ( ( seed = find(
  19444. token.matches[ 0 ].replace( runescape, funescape ),
  19445. rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) ||
  19446. context
  19447. ) ) ) {
  19448. // If seed is empty or no tokens remain, we can return early
  19449. tokens.splice( i, 1 );
  19450. selector = seed.length && toSelector( tokens );
  19451. if ( !selector ) {
  19452. push.apply( results, seed );
  19453. return results;
  19454. }
  19455. break;
  19456. }
  19457. }
  19458. }
  19459. }
  19460. // Compile and execute a filtering function if one is not provided
  19461. // Provide `match` to avoid retokenization if we modified the selector above
  19462. ( compiled || compile( selector, match ) )(
  19463. seed,
  19464. context,
  19465. !documentIsHTML,
  19466. results,
  19467. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  19468. );
  19469. return results;
  19470. };
  19471. // One-time assignments
  19472. // Sort stability
  19473. support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
  19474. // Support: Chrome 14-35+
  19475. // Always assume duplicates if they aren't passed to the comparison function
  19476. support.detectDuplicates = !!hasDuplicate;
  19477. // Initialize against the default document
  19478. setDocument();
  19479. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  19480. // Detached nodes confoundingly follow *each other*
  19481. support.sortDetached = assert( function( el ) {
  19482. // Should return 1, but returns 4 (following)
  19483. return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
  19484. } );
  19485. // Support: IE<8
  19486. // Prevent attribute/property "interpolation"
  19487. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  19488. if ( !assert( function( el ) {
  19489. el.innerHTML = "<a href='#'></a>";
  19490. return el.firstChild.getAttribute( "href" ) === "#";
  19491. } ) ) {
  19492. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  19493. if ( !isXML ) {
  19494. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  19495. }
  19496. } );
  19497. }
  19498. // Support: IE<9
  19499. // Use defaultValue in place of getAttribute("value")
  19500. if ( !support.attributes || !assert( function( el ) {
  19501. el.innerHTML = "<input/>";
  19502. el.firstChild.setAttribute( "value", "" );
  19503. return el.firstChild.getAttribute( "value" ) === "";
  19504. } ) ) {
  19505. addHandle( "value", function( elem, _name, isXML ) {
  19506. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  19507. return elem.defaultValue;
  19508. }
  19509. } );
  19510. }
  19511. // Support: IE<9
  19512. // Use getAttributeNode to fetch booleans when getAttribute lies
  19513. if ( !assert( function( el ) {
  19514. return el.getAttribute( "disabled" ) == null;
  19515. } ) ) {
  19516. addHandle( booleans, function( elem, name, isXML ) {
  19517. var val;
  19518. if ( !isXML ) {
  19519. return elem[ name ] === true ? name.toLowerCase() :
  19520. ( val = elem.getAttributeNode( name ) ) && val.specified ?
  19521. val.value :
  19522. null;
  19523. }
  19524. } );
  19525. }
  19526. return Sizzle;
  19527. } )( window );
  19528. jQuery.find = Sizzle;
  19529. jQuery.expr = Sizzle.selectors;
  19530. // Deprecated
  19531. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  19532. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  19533. jQuery.text = Sizzle.getText;
  19534. jQuery.isXMLDoc = Sizzle.isXML;
  19535. jQuery.contains = Sizzle.contains;
  19536. jQuery.escapeSelector = Sizzle.escape;
  19537. var dir = function( elem, dir, until ) {
  19538. var matched = [],
  19539. truncate = until !== undefined;
  19540. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  19541. if ( elem.nodeType === 1 ) {
  19542. if ( truncate && jQuery( elem ).is( until ) ) {
  19543. break;
  19544. }
  19545. matched.push( elem );
  19546. }
  19547. }
  19548. return matched;
  19549. };
  19550. var siblings = function( n, elem ) {
  19551. var matched = [];
  19552. for ( ; n; n = n.nextSibling ) {
  19553. if ( n.nodeType === 1 && n !== elem ) {
  19554. matched.push( n );
  19555. }
  19556. }
  19557. return matched;
  19558. };
  19559. var rneedsContext = jQuery.expr.match.needsContext;
  19560. function nodeName( elem, name ) {
  19561. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  19562. }
  19563. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  19564. // Implement the identical functionality for filter and not
  19565. function winnow( elements, qualifier, not ) {
  19566. if ( isFunction( qualifier ) ) {
  19567. return jQuery.grep( elements, function( elem, i ) {
  19568. return !!qualifier.call( elem, i, elem ) !== not;
  19569. } );
  19570. }
  19571. // Single element
  19572. if ( qualifier.nodeType ) {
  19573. return jQuery.grep( elements, function( elem ) {
  19574. return ( elem === qualifier ) !== not;
  19575. } );
  19576. }
  19577. // Arraylike of elements (jQuery, arguments, Array)
  19578. if ( typeof qualifier !== "string" ) {
  19579. return jQuery.grep( elements, function( elem ) {
  19580. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  19581. } );
  19582. }
  19583. // Filtered directly for both simple and complex selectors
  19584. return jQuery.filter( qualifier, elements, not );
  19585. }
  19586. jQuery.filter = function( expr, elems, not ) {
  19587. var elem = elems[ 0 ];
  19588. if ( not ) {
  19589. expr = ":not(" + expr + ")";
  19590. }
  19591. if ( elems.length === 1 && elem.nodeType === 1 ) {
  19592. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  19593. }
  19594. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  19595. return elem.nodeType === 1;
  19596. } ) );
  19597. };
  19598. jQuery.fn.extend( {
  19599. find: function( selector ) {
  19600. var i, ret,
  19601. len = this.length,
  19602. self = this;
  19603. if ( typeof selector !== "string" ) {
  19604. return this.pushStack( jQuery( selector ).filter( function() {
  19605. for ( i = 0; i < len; i++ ) {
  19606. if ( jQuery.contains( self[ i ], this ) ) {
  19607. return true;
  19608. }
  19609. }
  19610. } ) );
  19611. }
  19612. ret = this.pushStack( [] );
  19613. for ( i = 0; i < len; i++ ) {
  19614. jQuery.find( selector, self[ i ], ret );
  19615. }
  19616. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  19617. },
  19618. filter: function( selector ) {
  19619. return this.pushStack( winnow( this, selector || [], false ) );
  19620. },
  19621. not: function( selector ) {
  19622. return this.pushStack( winnow( this, selector || [], true ) );
  19623. },
  19624. is: function( selector ) {
  19625. return !!winnow(
  19626. this,
  19627. // If this is a positional/relative selector, check membership in the returned set
  19628. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  19629. typeof selector === "string" && rneedsContext.test( selector ) ?
  19630. jQuery( selector ) :
  19631. selector || [],
  19632. false
  19633. ).length;
  19634. }
  19635. } );
  19636. // Initialize a jQuery object
  19637. // A central reference to the root jQuery(document)
  19638. var rootjQuery,
  19639. // A simple way to check for HTML strings
  19640. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  19641. // Strict HTML recognition (#11290: must start with <)
  19642. // Shortcut simple #id case for speed
  19643. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  19644. init = jQuery.fn.init = function( selector, context, root ) {
  19645. var match, elem;
  19646. // HANDLE: $(""), $(null), $(undefined), $(false)
  19647. if ( !selector ) {
  19648. return this;
  19649. }
  19650. // Method init() accepts an alternate rootjQuery
  19651. // so migrate can support jQuery.sub (gh-2101)
  19652. root = root || rootjQuery;
  19653. // Handle HTML strings
  19654. if ( typeof selector === "string" ) {
  19655. if ( selector[ 0 ] === "<" &&
  19656. selector[ selector.length - 1 ] === ">" &&
  19657. selector.length >= 3 ) {
  19658. // Assume that strings that start and end with <> are HTML and skip the regex check
  19659. match = [ null, selector, null ];
  19660. } else {
  19661. match = rquickExpr.exec( selector );
  19662. }
  19663. // Match html or make sure no context is specified for #id
  19664. if ( match && ( match[ 1 ] || !context ) ) {
  19665. // HANDLE: $(html) -> $(array)
  19666. if ( match[ 1 ] ) {
  19667. context = context instanceof jQuery ? context[ 0 ] : context;
  19668. // Option to run scripts is true for back-compat
  19669. // Intentionally let the error be thrown if parseHTML is not present
  19670. jQuery.merge( this, jQuery.parseHTML(
  19671. match[ 1 ],
  19672. context && context.nodeType ? context.ownerDocument || context : document,
  19673. true
  19674. ) );
  19675. // HANDLE: $(html, props)
  19676. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  19677. for ( match in context ) {
  19678. // Properties of context are called as methods if possible
  19679. if ( isFunction( this[ match ] ) ) {
  19680. this[ match ]( context[ match ] );
  19681. // ...and otherwise set as attributes
  19682. } else {
  19683. this.attr( match, context[ match ] );
  19684. }
  19685. }
  19686. }
  19687. return this;
  19688. // HANDLE: $(#id)
  19689. } else {
  19690. elem = document.getElementById( match[ 2 ] );
  19691. if ( elem ) {
  19692. // Inject the element directly into the jQuery object
  19693. this[ 0 ] = elem;
  19694. this.length = 1;
  19695. }
  19696. return this;
  19697. }
  19698. // HANDLE: $(expr, $(...))
  19699. } else if ( !context || context.jquery ) {
  19700. return ( context || root ).find( selector );
  19701. // HANDLE: $(expr, context)
  19702. // (which is just equivalent to: $(context).find(expr)
  19703. } else {
  19704. return this.constructor( context ).find( selector );
  19705. }
  19706. // HANDLE: $(DOMElement)
  19707. } else if ( selector.nodeType ) {
  19708. this[ 0 ] = selector;
  19709. this.length = 1;
  19710. return this;
  19711. // HANDLE: $(function)
  19712. // Shortcut for document ready
  19713. } else if ( isFunction( selector ) ) {
  19714. return root.ready !== undefined ?
  19715. root.ready( selector ) :
  19716. // Execute immediately if ready is not present
  19717. selector( jQuery );
  19718. }
  19719. return jQuery.makeArray( selector, this );
  19720. };
  19721. // Give the init function the jQuery prototype for later instantiation
  19722. init.prototype = jQuery.fn;
  19723. // Initialize central reference
  19724. rootjQuery = jQuery( document );
  19725. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  19726. // Methods guaranteed to produce a unique set when starting from a unique set
  19727. guaranteedUnique = {
  19728. children: true,
  19729. contents: true,
  19730. next: true,
  19731. prev: true
  19732. };
  19733. jQuery.fn.extend( {
  19734. has: function( target ) {
  19735. var targets = jQuery( target, this ),
  19736. l = targets.length;
  19737. return this.filter( function() {
  19738. var i = 0;
  19739. for ( ; i < l; i++ ) {
  19740. if ( jQuery.contains( this, targets[ i ] ) ) {
  19741. return true;
  19742. }
  19743. }
  19744. } );
  19745. },
  19746. closest: function( selectors, context ) {
  19747. var cur,
  19748. i = 0,
  19749. l = this.length,
  19750. matched = [],
  19751. targets = typeof selectors !== "string" && jQuery( selectors );
  19752. // Positional selectors never match, since there's no _selection_ context
  19753. if ( !rneedsContext.test( selectors ) ) {
  19754. for ( ; i < l; i++ ) {
  19755. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  19756. // Always skip document fragments
  19757. if ( cur.nodeType < 11 && ( targets ?
  19758. targets.index( cur ) > -1 :
  19759. // Don't pass non-elements to Sizzle
  19760. cur.nodeType === 1 &&
  19761. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  19762. matched.push( cur );
  19763. break;
  19764. }
  19765. }
  19766. }
  19767. }
  19768. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  19769. },
  19770. // Determine the position of an element within the set
  19771. index: function( elem ) {
  19772. // No argument, return index in parent
  19773. if ( !elem ) {
  19774. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  19775. }
  19776. // Index in selector
  19777. if ( typeof elem === "string" ) {
  19778. return indexOf.call( jQuery( elem ), this[ 0 ] );
  19779. }
  19780. // Locate the position of the desired element
  19781. return indexOf.call( this,
  19782. // If it receives a jQuery object, the first element is used
  19783. elem.jquery ? elem[ 0 ] : elem
  19784. );
  19785. },
  19786. add: function( selector, context ) {
  19787. return this.pushStack(
  19788. jQuery.uniqueSort(
  19789. jQuery.merge( this.get(), jQuery( selector, context ) )
  19790. )
  19791. );
  19792. },
  19793. addBack: function( selector ) {
  19794. return this.add( selector == null ?
  19795. this.prevObject : this.prevObject.filter( selector )
  19796. );
  19797. }
  19798. } );
  19799. function sibling( cur, dir ) {
  19800. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  19801. return cur;
  19802. }
  19803. jQuery.each( {
  19804. parent: function( elem ) {
  19805. var parent = elem.parentNode;
  19806. return parent && parent.nodeType !== 11 ? parent : null;
  19807. },
  19808. parents: function( elem ) {
  19809. return dir( elem, "parentNode" );
  19810. },
  19811. parentsUntil: function( elem, _i, until ) {
  19812. return dir( elem, "parentNode", until );
  19813. },
  19814. next: function( elem ) {
  19815. return sibling( elem, "nextSibling" );
  19816. },
  19817. prev: function( elem ) {
  19818. return sibling( elem, "previousSibling" );
  19819. },
  19820. nextAll: function( elem ) {
  19821. return dir( elem, "nextSibling" );
  19822. },
  19823. prevAll: function( elem ) {
  19824. return dir( elem, "previousSibling" );
  19825. },
  19826. nextUntil: function( elem, _i, until ) {
  19827. return dir( elem, "nextSibling", until );
  19828. },
  19829. prevUntil: function( elem, _i, until ) {
  19830. return dir( elem, "previousSibling", until );
  19831. },
  19832. siblings: function( elem ) {
  19833. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  19834. },
  19835. children: function( elem ) {
  19836. return siblings( elem.firstChild );
  19837. },
  19838. contents: function( elem ) {
  19839. if ( elem.contentDocument != null &&
  19840. // Support: IE 11+
  19841. // <object> elements with no `data` attribute has an object
  19842. // `contentDocument` with a `null` prototype.
  19843. getProto( elem.contentDocument ) ) {
  19844. return elem.contentDocument;
  19845. }
  19846. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  19847. // Treat the template element as a regular one in browsers that
  19848. // don't support it.
  19849. if ( nodeName( elem, "template" ) ) {
  19850. elem = elem.content || elem;
  19851. }
  19852. return jQuery.merge( [], elem.childNodes );
  19853. }
  19854. }, function( name, fn ) {
  19855. jQuery.fn[ name ] = function( until, selector ) {
  19856. var matched = jQuery.map( this, fn, until );
  19857. if ( name.slice( -5 ) !== "Until" ) {
  19858. selector = until;
  19859. }
  19860. if ( selector && typeof selector === "string" ) {
  19861. matched = jQuery.filter( selector, matched );
  19862. }
  19863. if ( this.length > 1 ) {
  19864. // Remove duplicates
  19865. if ( !guaranteedUnique[ name ] ) {
  19866. jQuery.uniqueSort( matched );
  19867. }
  19868. // Reverse order for parents* and prev-derivatives
  19869. if ( rparentsprev.test( name ) ) {
  19870. matched.reverse();
  19871. }
  19872. }
  19873. return this.pushStack( matched );
  19874. };
  19875. } );
  19876. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  19877. // Convert String-formatted options into Object-formatted ones
  19878. function createOptions( options ) {
  19879. var object = {};
  19880. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  19881. object[ flag ] = true;
  19882. } );
  19883. return object;
  19884. }
  19885. /*
  19886. * Create a callback list using the following parameters:
  19887. *
  19888. * options: an optional list of space-separated options that will change how
  19889. * the callback list behaves or a more traditional option object
  19890. *
  19891. * By default a callback list will act like an event callback list and can be
  19892. * "fired" multiple times.
  19893. *
  19894. * Possible options:
  19895. *
  19896. * once: will ensure the callback list can only be fired once (like a Deferred)
  19897. *
  19898. * memory: will keep track of previous values and will call any callback added
  19899. * after the list has been fired right away with the latest "memorized"
  19900. * values (like a Deferred)
  19901. *
  19902. * unique: will ensure a callback can only be added once (no duplicate in the list)
  19903. *
  19904. * stopOnFalse: interrupt callings when a callback returns false
  19905. *
  19906. */
  19907. jQuery.Callbacks = function( options ) {
  19908. // Convert options from String-formatted to Object-formatted if needed
  19909. // (we check in cache first)
  19910. options = typeof options === "string" ?
  19911. createOptions( options ) :
  19912. jQuery.extend( {}, options );
  19913. var // Flag to know if list is currently firing
  19914. firing,
  19915. // Last fire value for non-forgettable lists
  19916. memory,
  19917. // Flag to know if list was already fired
  19918. fired,
  19919. // Flag to prevent firing
  19920. locked,
  19921. // Actual callback list
  19922. list = [],
  19923. // Queue of execution data for repeatable lists
  19924. queue = [],
  19925. // Index of currently firing callback (modified by add/remove as needed)
  19926. firingIndex = -1,
  19927. // Fire callbacks
  19928. fire = function() {
  19929. // Enforce single-firing
  19930. locked = locked || options.once;
  19931. // Execute callbacks for all pending executions,
  19932. // respecting firingIndex overrides and runtime changes
  19933. fired = firing = true;
  19934. for ( ; queue.length; firingIndex = -1 ) {
  19935. memory = queue.shift();
  19936. while ( ++firingIndex < list.length ) {
  19937. // Run callback and check for early termination
  19938. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  19939. options.stopOnFalse ) {
  19940. // Jump to end and forget the data so .add doesn't re-fire
  19941. firingIndex = list.length;
  19942. memory = false;
  19943. }
  19944. }
  19945. }
  19946. // Forget the data if we're done with it
  19947. if ( !options.memory ) {
  19948. memory = false;
  19949. }
  19950. firing = false;
  19951. // Clean up if we're done firing for good
  19952. if ( locked ) {
  19953. // Keep an empty list if we have data for future add calls
  19954. if ( memory ) {
  19955. list = [];
  19956. // Otherwise, this object is spent
  19957. } else {
  19958. list = "";
  19959. }
  19960. }
  19961. },
  19962. // Actual Callbacks object
  19963. self = {
  19964. // Add a callback or a collection of callbacks to the list
  19965. add: function() {
  19966. if ( list ) {
  19967. // If we have memory from a past run, we should fire after adding
  19968. if ( memory && !firing ) {
  19969. firingIndex = list.length - 1;
  19970. queue.push( memory );
  19971. }
  19972. ( function add( args ) {
  19973. jQuery.each( args, function( _, arg ) {
  19974. if ( isFunction( arg ) ) {
  19975. if ( !options.unique || !self.has( arg ) ) {
  19976. list.push( arg );
  19977. }
  19978. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  19979. // Inspect recursively
  19980. add( arg );
  19981. }
  19982. } );
  19983. } )( arguments );
  19984. if ( memory && !firing ) {
  19985. fire();
  19986. }
  19987. }
  19988. return this;
  19989. },
  19990. // Remove a callback from the list
  19991. remove: function() {
  19992. jQuery.each( arguments, function( _, arg ) {
  19993. var index;
  19994. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  19995. list.splice( index, 1 );
  19996. // Handle firing indexes
  19997. if ( index <= firingIndex ) {
  19998. firingIndex--;
  19999. }
  20000. }
  20001. } );
  20002. return this;
  20003. },
  20004. // Check if a given callback is in the list.
  20005. // If no argument is given, return whether or not list has callbacks attached.
  20006. has: function( fn ) {
  20007. return fn ?
  20008. jQuery.inArray( fn, list ) > -1 :
  20009. list.length > 0;
  20010. },
  20011. // Remove all callbacks from the list
  20012. empty: function() {
  20013. if ( list ) {
  20014. list = [];
  20015. }
  20016. return this;
  20017. },
  20018. // Disable .fire and .add
  20019. // Abort any current/pending executions
  20020. // Clear all callbacks and values
  20021. disable: function() {
  20022. locked = queue = [];
  20023. list = memory = "";
  20024. return this;
  20025. },
  20026. disabled: function() {
  20027. return !list;
  20028. },
  20029. // Disable .fire
  20030. // Also disable .add unless we have memory (since it would have no effect)
  20031. // Abort any pending executions
  20032. lock: function() {
  20033. locked = queue = [];
  20034. if ( !memory && !firing ) {
  20035. list = memory = "";
  20036. }
  20037. return this;
  20038. },
  20039. locked: function() {
  20040. return !!locked;
  20041. },
  20042. // Call all callbacks with the given context and arguments
  20043. fireWith: function( context, args ) {
  20044. if ( !locked ) {
  20045. args = args || [];
  20046. args = [ context, args.slice ? args.slice() : args ];
  20047. queue.push( args );
  20048. if ( !firing ) {
  20049. fire();
  20050. }
  20051. }
  20052. return this;
  20053. },
  20054. // Call all the callbacks with the given arguments
  20055. fire: function() {
  20056. self.fireWith( this, arguments );
  20057. return this;
  20058. },
  20059. // To know if the callbacks have already been called at least once
  20060. fired: function() {
  20061. return !!fired;
  20062. }
  20063. };
  20064. return self;
  20065. };
  20066. function Identity( v ) {
  20067. return v;
  20068. }
  20069. function Thrower( ex ) {
  20070. throw ex;
  20071. }
  20072. function adoptValue( value, resolve, reject, noValue ) {
  20073. var method;
  20074. try {
  20075. // Check for promise aspect first to privilege synchronous behavior
  20076. if ( value && isFunction( ( method = value.promise ) ) ) {
  20077. method.call( value ).done( resolve ).fail( reject );
  20078. // Other thenables
  20079. } else if ( value && isFunction( ( method = value.then ) ) ) {
  20080. method.call( value, resolve, reject );
  20081. // Other non-thenables
  20082. } else {
  20083. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  20084. // * false: [ value ].slice( 0 ) => resolve( value )
  20085. // * true: [ value ].slice( 1 ) => resolve()
  20086. resolve.apply( undefined, [ value ].slice( noValue ) );
  20087. }
  20088. // For Promises/A+, convert exceptions into rejections
  20089. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  20090. // Deferred#then to conditionally suppress rejection.
  20091. } catch ( value ) {
  20092. // Support: Android 4.0 only
  20093. // Strict mode functions invoked without .call/.apply get global-object context
  20094. reject.apply( undefined, [ value ] );
  20095. }
  20096. }
  20097. jQuery.extend( {
  20098. Deferred: function( func ) {
  20099. var tuples = [
  20100. // action, add listener, callbacks,
  20101. // ... .then handlers, argument index, [final state]
  20102. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  20103. jQuery.Callbacks( "memory" ), 2 ],
  20104. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  20105. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  20106. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  20107. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  20108. ],
  20109. state = "pending",
  20110. promise = {
  20111. state: function() {
  20112. return state;
  20113. },
  20114. always: function() {
  20115. deferred.done( arguments ).fail( arguments );
  20116. return this;
  20117. },
  20118. "catch": function( fn ) {
  20119. return promise.then( null, fn );
  20120. },
  20121. // Keep pipe for back-compat
  20122. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  20123. var fns = arguments;
  20124. return jQuery.Deferred( function( newDefer ) {
  20125. jQuery.each( tuples, function( _i, tuple ) {
  20126. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  20127. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  20128. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  20129. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  20130. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  20131. deferred[ tuple[ 1 ] ]( function() {
  20132. var returned = fn && fn.apply( this, arguments );
  20133. if ( returned && isFunction( returned.promise ) ) {
  20134. returned.promise()
  20135. .progress( newDefer.notify )
  20136. .done( newDefer.resolve )
  20137. .fail( newDefer.reject );
  20138. } else {
  20139. newDefer[ tuple[ 0 ] + "With" ](
  20140. this,
  20141. fn ? [ returned ] : arguments
  20142. );
  20143. }
  20144. } );
  20145. } );
  20146. fns = null;
  20147. } ).promise();
  20148. },
  20149. then: function( onFulfilled, onRejected, onProgress ) {
  20150. var maxDepth = 0;
  20151. function resolve( depth, deferred, handler, special ) {
  20152. return function() {
  20153. var that = this,
  20154. args = arguments,
  20155. mightThrow = function() {
  20156. var returned, then;
  20157. // Support: Promises/A+ section 2.3.3.3.3
  20158. // https://promisesaplus.com/#point-59
  20159. // Ignore double-resolution attempts
  20160. if ( depth < maxDepth ) {
  20161. return;
  20162. }
  20163. returned = handler.apply( that, args );
  20164. // Support: Promises/A+ section 2.3.1
  20165. // https://promisesaplus.com/#point-48
  20166. if ( returned === deferred.promise() ) {
  20167. throw new TypeError( "Thenable self-resolution" );
  20168. }
  20169. // Support: Promises/A+ sections 2.3.3.1, 3.5
  20170. // https://promisesaplus.com/#point-54
  20171. // https://promisesaplus.com/#point-75
  20172. // Retrieve `then` only once
  20173. then = returned &&
  20174. // Support: Promises/A+ section 2.3.4
  20175. // https://promisesaplus.com/#point-64
  20176. // Only check objects and functions for thenability
  20177. ( typeof returned === "object" ||
  20178. typeof returned === "function" ) &&
  20179. returned.then;
  20180. // Handle a returned thenable
  20181. if ( isFunction( then ) ) {
  20182. // Special processors (notify) just wait for resolution
  20183. if ( special ) {
  20184. then.call(
  20185. returned,
  20186. resolve( maxDepth, deferred, Identity, special ),
  20187. resolve( maxDepth, deferred, Thrower, special )
  20188. );
  20189. // Normal processors (resolve) also hook into progress
  20190. } else {
  20191. // ...and disregard older resolution values
  20192. maxDepth++;
  20193. then.call(
  20194. returned,
  20195. resolve( maxDepth, deferred, Identity, special ),
  20196. resolve( maxDepth, deferred, Thrower, special ),
  20197. resolve( maxDepth, deferred, Identity,
  20198. deferred.notifyWith )
  20199. );
  20200. }
  20201. // Handle all other returned values
  20202. } else {
  20203. // Only substitute handlers pass on context
  20204. // and multiple values (non-spec behavior)
  20205. if ( handler !== Identity ) {
  20206. that = undefined;
  20207. args = [ returned ];
  20208. }
  20209. // Process the value(s)
  20210. // Default process is resolve
  20211. ( special || deferred.resolveWith )( that, args );
  20212. }
  20213. },
  20214. // Only normal processors (resolve) catch and reject exceptions
  20215. process = special ?
  20216. mightThrow :
  20217. function() {
  20218. try {
  20219. mightThrow();
  20220. } catch ( e ) {
  20221. if ( jQuery.Deferred.exceptionHook ) {
  20222. jQuery.Deferred.exceptionHook( e,
  20223. process.stackTrace );
  20224. }
  20225. // Support: Promises/A+ section 2.3.3.3.4.1
  20226. // https://promisesaplus.com/#point-61
  20227. // Ignore post-resolution exceptions
  20228. if ( depth + 1 >= maxDepth ) {
  20229. // Only substitute handlers pass on context
  20230. // and multiple values (non-spec behavior)
  20231. if ( handler !== Thrower ) {
  20232. that = undefined;
  20233. args = [ e ];
  20234. }
  20235. deferred.rejectWith( that, args );
  20236. }
  20237. }
  20238. };
  20239. // Support: Promises/A+ section 2.3.3.3.1
  20240. // https://promisesaplus.com/#point-57
  20241. // Re-resolve promises immediately to dodge false rejection from
  20242. // subsequent errors
  20243. if ( depth ) {
  20244. process();
  20245. } else {
  20246. // Call an optional hook to record the stack, in case of exception
  20247. // since it's otherwise lost when execution goes async
  20248. if ( jQuery.Deferred.getStackHook ) {
  20249. process.stackTrace = jQuery.Deferred.getStackHook();
  20250. }
  20251. window.setTimeout( process );
  20252. }
  20253. };
  20254. }
  20255. return jQuery.Deferred( function( newDefer ) {
  20256. // progress_handlers.add( ... )
  20257. tuples[ 0 ][ 3 ].add(
  20258. resolve(
  20259. 0,
  20260. newDefer,
  20261. isFunction( onProgress ) ?
  20262. onProgress :
  20263. Identity,
  20264. newDefer.notifyWith
  20265. )
  20266. );
  20267. // fulfilled_handlers.add( ... )
  20268. tuples[ 1 ][ 3 ].add(
  20269. resolve(
  20270. 0,
  20271. newDefer,
  20272. isFunction( onFulfilled ) ?
  20273. onFulfilled :
  20274. Identity
  20275. )
  20276. );
  20277. // rejected_handlers.add( ... )
  20278. tuples[ 2 ][ 3 ].add(
  20279. resolve(
  20280. 0,
  20281. newDefer,
  20282. isFunction( onRejected ) ?
  20283. onRejected :
  20284. Thrower
  20285. )
  20286. );
  20287. } ).promise();
  20288. },
  20289. // Get a promise for this deferred
  20290. // If obj is provided, the promise aspect is added to the object
  20291. promise: function( obj ) {
  20292. return obj != null ? jQuery.extend( obj, promise ) : promise;
  20293. }
  20294. },
  20295. deferred = {};
  20296. // Add list-specific methods
  20297. jQuery.each( tuples, function( i, tuple ) {
  20298. var list = tuple[ 2 ],
  20299. stateString = tuple[ 5 ];
  20300. // promise.progress = list.add
  20301. // promise.done = list.add
  20302. // promise.fail = list.add
  20303. promise[ tuple[ 1 ] ] = list.add;
  20304. // Handle state
  20305. if ( stateString ) {
  20306. list.add(
  20307. function() {
  20308. // state = "resolved" (i.e., fulfilled)
  20309. // state = "rejected"
  20310. state = stateString;
  20311. },
  20312. // rejected_callbacks.disable
  20313. // fulfilled_callbacks.disable
  20314. tuples[ 3 - i ][ 2 ].disable,
  20315. // rejected_handlers.disable
  20316. // fulfilled_handlers.disable
  20317. tuples[ 3 - i ][ 3 ].disable,
  20318. // progress_callbacks.lock
  20319. tuples[ 0 ][ 2 ].lock,
  20320. // progress_handlers.lock
  20321. tuples[ 0 ][ 3 ].lock
  20322. );
  20323. }
  20324. // progress_handlers.fire
  20325. // fulfilled_handlers.fire
  20326. // rejected_handlers.fire
  20327. list.add( tuple[ 3 ].fire );
  20328. // deferred.notify = function() { deferred.notifyWith(...) }
  20329. // deferred.resolve = function() { deferred.resolveWith(...) }
  20330. // deferred.reject = function() { deferred.rejectWith(...) }
  20331. deferred[ tuple[ 0 ] ] = function() {
  20332. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  20333. return this;
  20334. };
  20335. // deferred.notifyWith = list.fireWith
  20336. // deferred.resolveWith = list.fireWith
  20337. // deferred.rejectWith = list.fireWith
  20338. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  20339. } );
  20340. // Make the deferred a promise
  20341. promise.promise( deferred );
  20342. // Call given func if any
  20343. if ( func ) {
  20344. func.call( deferred, deferred );
  20345. }
  20346. // All done!
  20347. return deferred;
  20348. },
  20349. // Deferred helper
  20350. when: function( singleValue ) {
  20351. var
  20352. // count of uncompleted subordinates
  20353. remaining = arguments.length,
  20354. // count of unprocessed arguments
  20355. i = remaining,
  20356. // subordinate fulfillment data
  20357. resolveContexts = Array( i ),
  20358. resolveValues = slice.call( arguments ),
  20359. // the primary Deferred
  20360. primary = jQuery.Deferred(),
  20361. // subordinate callback factory
  20362. updateFunc = function( i ) {
  20363. return function( value ) {
  20364. resolveContexts[ i ] = this;
  20365. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  20366. if ( !( --remaining ) ) {
  20367. primary.resolveWith( resolveContexts, resolveValues );
  20368. }
  20369. };
  20370. };
  20371. // Single- and empty arguments are adopted like Promise.resolve
  20372. if ( remaining <= 1 ) {
  20373. adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject,
  20374. !remaining );
  20375. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  20376. if ( primary.state() === "pending" ||
  20377. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  20378. return primary.then();
  20379. }
  20380. }
  20381. // Multiple arguments are aggregated like Promise.all array elements
  20382. while ( i-- ) {
  20383. adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject );
  20384. }
  20385. return primary.promise();
  20386. }
  20387. } );
  20388. // These usually indicate a programmer mistake during development,
  20389. // warn about them ASAP rather than swallowing them by default.
  20390. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  20391. jQuery.Deferred.exceptionHook = function( error, stack ) {
  20392. // Support: IE 8 - 9 only
  20393. // Console exists when dev tools are open, which can happen at any time
  20394. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  20395. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  20396. }
  20397. };
  20398. jQuery.readyException = function( error ) {
  20399. window.setTimeout( function() {
  20400. throw error;
  20401. } );
  20402. };
  20403. // The deferred used on DOM ready
  20404. var readyList = jQuery.Deferred();
  20405. jQuery.fn.ready = function( fn ) {
  20406. readyList
  20407. .then( fn )
  20408. // Wrap jQuery.readyException in a function so that the lookup
  20409. // happens at the time of error handling instead of callback
  20410. // registration.
  20411. .catch( function( error ) {
  20412. jQuery.readyException( error );
  20413. } );
  20414. return this;
  20415. };
  20416. jQuery.extend( {
  20417. // Is the DOM ready to be used? Set to true once it occurs.
  20418. isReady: false,
  20419. // A counter to track how many items to wait for before
  20420. // the ready event fires. See #6781
  20421. readyWait: 1,
  20422. // Handle when the DOM is ready
  20423. ready: function( wait ) {
  20424. // Abort if there are pending holds or we're already ready
  20425. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  20426. return;
  20427. }
  20428. // Remember that the DOM is ready
  20429. jQuery.isReady = true;
  20430. // If a normal DOM Ready event fired, decrement, and wait if need be
  20431. if ( wait !== true && --jQuery.readyWait > 0 ) {
  20432. return;
  20433. }
  20434. // If there are functions bound, to execute
  20435. readyList.resolveWith( document, [ jQuery ] );
  20436. }
  20437. } );
  20438. jQuery.ready.then = readyList.then;
  20439. // The ready event handler and self cleanup method
  20440. function completed() {
  20441. document.removeEventListener( "DOMContentLoaded", completed );
  20442. window.removeEventListener( "load", completed );
  20443. jQuery.ready();
  20444. }
  20445. // Catch cases where $(document).ready() is called
  20446. // after the browser event has already occurred.
  20447. // Support: IE <=9 - 10 only
  20448. // Older IE sometimes signals "interactive" too soon
  20449. if ( document.readyState === "complete" ||
  20450. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  20451. // Handle it asynchronously to allow scripts the opportunity to delay ready
  20452. window.setTimeout( jQuery.ready );
  20453. } else {
  20454. // Use the handy event callback
  20455. document.addEventListener( "DOMContentLoaded", completed );
  20456. // A fallback to window.onload, that will always work
  20457. window.addEventListener( "load", completed );
  20458. }
  20459. // Multifunctional method to get and set values of a collection
  20460. // The value/s can optionally be executed if it's a function
  20461. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  20462. var i = 0,
  20463. len = elems.length,
  20464. bulk = key == null;
  20465. // Sets many values
  20466. if ( toType( key ) === "object" ) {
  20467. chainable = true;
  20468. for ( i in key ) {
  20469. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  20470. }
  20471. // Sets one value
  20472. } else if ( value !== undefined ) {
  20473. chainable = true;
  20474. if ( !isFunction( value ) ) {
  20475. raw = true;
  20476. }
  20477. if ( bulk ) {
  20478. // Bulk operations run against the entire set
  20479. if ( raw ) {
  20480. fn.call( elems, value );
  20481. fn = null;
  20482. // ...except when executing function values
  20483. } else {
  20484. bulk = fn;
  20485. fn = function( elem, _key, value ) {
  20486. return bulk.call( jQuery( elem ), value );
  20487. };
  20488. }
  20489. }
  20490. if ( fn ) {
  20491. for ( ; i < len; i++ ) {
  20492. fn(
  20493. elems[ i ], key, raw ?
  20494. value :
  20495. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  20496. );
  20497. }
  20498. }
  20499. }
  20500. if ( chainable ) {
  20501. return elems;
  20502. }
  20503. // Gets
  20504. if ( bulk ) {
  20505. return fn.call( elems );
  20506. }
  20507. return len ? fn( elems[ 0 ], key ) : emptyGet;
  20508. };
  20509. // Matches dashed string for camelizing
  20510. var rmsPrefix = /^-ms-/,
  20511. rdashAlpha = /-([a-z])/g;
  20512. // Used by camelCase as callback to replace()
  20513. function fcamelCase( _all, letter ) {
  20514. return letter.toUpperCase();
  20515. }
  20516. // Convert dashed to camelCase; used by the css and data modules
  20517. // Support: IE <=9 - 11, Edge 12 - 15
  20518. // Microsoft forgot to hump their vendor prefix (#9572)
  20519. function camelCase( string ) {
  20520. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  20521. }
  20522. var acceptData = function( owner ) {
  20523. // Accepts only:
  20524. // - Node
  20525. // - Node.ELEMENT_NODE
  20526. // - Node.DOCUMENT_NODE
  20527. // - Object
  20528. // - Any
  20529. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  20530. };
  20531. function Data() {
  20532. this.expando = jQuery.expando + Data.uid++;
  20533. }
  20534. Data.uid = 1;
  20535. Data.prototype = {
  20536. cache: function( owner ) {
  20537. // Check if the owner object already has a cache
  20538. var value = owner[ this.expando ];
  20539. // If not, create one
  20540. if ( !value ) {
  20541. value = {};
  20542. // We can accept data for non-element nodes in modern browsers,
  20543. // but we should not, see #8335.
  20544. // Always return an empty object.
  20545. if ( acceptData( owner ) ) {
  20546. // If it is a node unlikely to be stringify-ed or looped over
  20547. // use plain assignment
  20548. if ( owner.nodeType ) {
  20549. owner[ this.expando ] = value;
  20550. // Otherwise secure it in a non-enumerable property
  20551. // configurable must be true to allow the property to be
  20552. // deleted when data is removed
  20553. } else {
  20554. Object.defineProperty( owner, this.expando, {
  20555. value: value,
  20556. configurable: true
  20557. } );
  20558. }
  20559. }
  20560. }
  20561. return value;
  20562. },
  20563. set: function( owner, data, value ) {
  20564. var prop,
  20565. cache = this.cache( owner );
  20566. // Handle: [ owner, key, value ] args
  20567. // Always use camelCase key (gh-2257)
  20568. if ( typeof data === "string" ) {
  20569. cache[ camelCase( data ) ] = value;
  20570. // Handle: [ owner, { properties } ] args
  20571. } else {
  20572. // Copy the properties one-by-one to the cache object
  20573. for ( prop in data ) {
  20574. cache[ camelCase( prop ) ] = data[ prop ];
  20575. }
  20576. }
  20577. return cache;
  20578. },
  20579. get: function( owner, key ) {
  20580. return key === undefined ?
  20581. this.cache( owner ) :
  20582. // Always use camelCase key (gh-2257)
  20583. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  20584. },
  20585. access: function( owner, key, value ) {
  20586. // In cases where either:
  20587. //
  20588. // 1. No key was specified
  20589. // 2. A string key was specified, but no value provided
  20590. //
  20591. // Take the "read" path and allow the get method to determine
  20592. // which value to return, respectively either:
  20593. //
  20594. // 1. The entire cache object
  20595. // 2. The data stored at the key
  20596. //
  20597. if ( key === undefined ||
  20598. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  20599. return this.get( owner, key );
  20600. }
  20601. // When the key is not a string, or both a key and value
  20602. // are specified, set or extend (existing objects) with either:
  20603. //
  20604. // 1. An object of properties
  20605. // 2. A key and value
  20606. //
  20607. this.set( owner, key, value );
  20608. // Since the "set" path can have two possible entry points
  20609. // return the expected data based on which path was taken[*]
  20610. return value !== undefined ? value : key;
  20611. },
  20612. remove: function( owner, key ) {
  20613. var i,
  20614. cache = owner[ this.expando ];
  20615. if ( cache === undefined ) {
  20616. return;
  20617. }
  20618. if ( key !== undefined ) {
  20619. // Support array or space separated string of keys
  20620. if ( Array.isArray( key ) ) {
  20621. // If key is an array of keys...
  20622. // We always set camelCase keys, so remove that.
  20623. key = key.map( camelCase );
  20624. } else {
  20625. key = camelCase( key );
  20626. // If a key with the spaces exists, use it.
  20627. // Otherwise, create an array by matching non-whitespace
  20628. key = key in cache ?
  20629. [ key ] :
  20630. ( key.match( rnothtmlwhite ) || [] );
  20631. }
  20632. i = key.length;
  20633. while ( i-- ) {
  20634. delete cache[ key[ i ] ];
  20635. }
  20636. }
  20637. // Remove the expando if there's no more data
  20638. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  20639. // Support: Chrome <=35 - 45
  20640. // Webkit & Blink performance suffers when deleting properties
  20641. // from DOM nodes, so set to undefined instead
  20642. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  20643. if ( owner.nodeType ) {
  20644. owner[ this.expando ] = undefined;
  20645. } else {
  20646. delete owner[ this.expando ];
  20647. }
  20648. }
  20649. },
  20650. hasData: function( owner ) {
  20651. var cache = owner[ this.expando ];
  20652. return cache !== undefined && !jQuery.isEmptyObject( cache );
  20653. }
  20654. };
  20655. var dataPriv = new Data();
  20656. var dataUser = new Data();
  20657. // Implementation Summary
  20658. //
  20659. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  20660. // 2. Improve the module's maintainability by reducing the storage
  20661. // paths to a single mechanism.
  20662. // 3. Use the same single mechanism to support "private" and "user" data.
  20663. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  20664. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  20665. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  20666. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  20667. rmultiDash = /[A-Z]/g;
  20668. function getData( data ) {
  20669. if ( data === "true" ) {
  20670. return true;
  20671. }
  20672. if ( data === "false" ) {
  20673. return false;
  20674. }
  20675. if ( data === "null" ) {
  20676. return null;
  20677. }
  20678. // Only convert to a number if it doesn't change the string
  20679. if ( data === +data + "" ) {
  20680. return +data;
  20681. }
  20682. if ( rbrace.test( data ) ) {
  20683. return JSON.parse( data );
  20684. }
  20685. return data;
  20686. }
  20687. function dataAttr( elem, key, data ) {
  20688. var name;
  20689. // If nothing was found internally, try to fetch any
  20690. // data from the HTML5 data-* attribute
  20691. if ( data === undefined && elem.nodeType === 1 ) {
  20692. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  20693. data = elem.getAttribute( name );
  20694. if ( typeof data === "string" ) {
  20695. try {
  20696. data = getData( data );
  20697. } catch ( e ) {}
  20698. // Make sure we set the data so it isn't changed later
  20699. dataUser.set( elem, key, data );
  20700. } else {
  20701. data = undefined;
  20702. }
  20703. }
  20704. return data;
  20705. }
  20706. jQuery.extend( {
  20707. hasData: function( elem ) {
  20708. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  20709. },
  20710. data: function( elem, name, data ) {
  20711. return dataUser.access( elem, name, data );
  20712. },
  20713. removeData: function( elem, name ) {
  20714. dataUser.remove( elem, name );
  20715. },
  20716. // TODO: Now that all calls to _data and _removeData have been replaced
  20717. // with direct calls to dataPriv methods, these can be deprecated.
  20718. _data: function( elem, name, data ) {
  20719. return dataPriv.access( elem, name, data );
  20720. },
  20721. _removeData: function( elem, name ) {
  20722. dataPriv.remove( elem, name );
  20723. }
  20724. } );
  20725. jQuery.fn.extend( {
  20726. data: function( key, value ) {
  20727. var i, name, data,
  20728. elem = this[ 0 ],
  20729. attrs = elem && elem.attributes;
  20730. // Gets all values
  20731. if ( key === undefined ) {
  20732. if ( this.length ) {
  20733. data = dataUser.get( elem );
  20734. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  20735. i = attrs.length;
  20736. while ( i-- ) {
  20737. // Support: IE 11 only
  20738. // The attrs elements can be null (#14894)
  20739. if ( attrs[ i ] ) {
  20740. name = attrs[ i ].name;
  20741. if ( name.indexOf( "data-" ) === 0 ) {
  20742. name = camelCase( name.slice( 5 ) );
  20743. dataAttr( elem, name, data[ name ] );
  20744. }
  20745. }
  20746. }
  20747. dataPriv.set( elem, "hasDataAttrs", true );
  20748. }
  20749. }
  20750. return data;
  20751. }
  20752. // Sets multiple values
  20753. if ( typeof key === "object" ) {
  20754. return this.each( function() {
  20755. dataUser.set( this, key );
  20756. } );
  20757. }
  20758. return access( this, function( value ) {
  20759. var data;
  20760. // The calling jQuery object (element matches) is not empty
  20761. // (and therefore has an element appears at this[ 0 ]) and the
  20762. // `value` parameter was not undefined. An empty jQuery object
  20763. // will result in `undefined` for elem = this[ 0 ] which will
  20764. // throw an exception if an attempt to read a data cache is made.
  20765. if ( elem && value === undefined ) {
  20766. // Attempt to get data from the cache
  20767. // The key will always be camelCased in Data
  20768. data = dataUser.get( elem, key );
  20769. if ( data !== undefined ) {
  20770. return data;
  20771. }
  20772. // Attempt to "discover" the data in
  20773. // HTML5 custom data-* attrs
  20774. data = dataAttr( elem, key );
  20775. if ( data !== undefined ) {
  20776. return data;
  20777. }
  20778. // We tried really hard, but the data doesn't exist.
  20779. return;
  20780. }
  20781. // Set the data...
  20782. this.each( function() {
  20783. // We always store the camelCased key
  20784. dataUser.set( this, key, value );
  20785. } );
  20786. }, null, value, arguments.length > 1, null, true );
  20787. },
  20788. removeData: function( key ) {
  20789. return this.each( function() {
  20790. dataUser.remove( this, key );
  20791. } );
  20792. }
  20793. } );
  20794. jQuery.extend( {
  20795. queue: function( elem, type, data ) {
  20796. var queue;
  20797. if ( elem ) {
  20798. type = ( type || "fx" ) + "queue";
  20799. queue = dataPriv.get( elem, type );
  20800. // Speed up dequeue by getting out quickly if this is just a lookup
  20801. if ( data ) {
  20802. if ( !queue || Array.isArray( data ) ) {
  20803. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  20804. } else {
  20805. queue.push( data );
  20806. }
  20807. }
  20808. return queue || [];
  20809. }
  20810. },
  20811. dequeue: function( elem, type ) {
  20812. type = type || "fx";
  20813. var queue = jQuery.queue( elem, type ),
  20814. startLength = queue.length,
  20815. fn = queue.shift(),
  20816. hooks = jQuery._queueHooks( elem, type ),
  20817. next = function() {
  20818. jQuery.dequeue( elem, type );
  20819. };
  20820. // If the fx queue is dequeued, always remove the progress sentinel
  20821. if ( fn === "inprogress" ) {
  20822. fn = queue.shift();
  20823. startLength--;
  20824. }
  20825. if ( fn ) {
  20826. // Add a progress sentinel to prevent the fx queue from being
  20827. // automatically dequeued
  20828. if ( type === "fx" ) {
  20829. queue.unshift( "inprogress" );
  20830. }
  20831. // Clear up the last queue stop function
  20832. delete hooks.stop;
  20833. fn.call( elem, next, hooks );
  20834. }
  20835. if ( !startLength && hooks ) {
  20836. hooks.empty.fire();
  20837. }
  20838. },
  20839. // Not public - generate a queueHooks object, or return the current one
  20840. _queueHooks: function( elem, type ) {
  20841. var key = type + "queueHooks";
  20842. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  20843. empty: jQuery.Callbacks( "once memory" ).add( function() {
  20844. dataPriv.remove( elem, [ type + "queue", key ] );
  20845. } )
  20846. } );
  20847. }
  20848. } );
  20849. jQuery.fn.extend( {
  20850. queue: function( type, data ) {
  20851. var setter = 2;
  20852. if ( typeof type !== "string" ) {
  20853. data = type;
  20854. type = "fx";
  20855. setter--;
  20856. }
  20857. if ( arguments.length < setter ) {
  20858. return jQuery.queue( this[ 0 ], type );
  20859. }
  20860. return data === undefined ?
  20861. this :
  20862. this.each( function() {
  20863. var queue = jQuery.queue( this, type, data );
  20864. // Ensure a hooks for this queue
  20865. jQuery._queueHooks( this, type );
  20866. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  20867. jQuery.dequeue( this, type );
  20868. }
  20869. } );
  20870. },
  20871. dequeue: function( type ) {
  20872. return this.each( function() {
  20873. jQuery.dequeue( this, type );
  20874. } );
  20875. },
  20876. clearQueue: function( type ) {
  20877. return this.queue( type || "fx", [] );
  20878. },
  20879. // Get a promise resolved when queues of a certain type
  20880. // are emptied (fx is the type by default)
  20881. promise: function( type, obj ) {
  20882. var tmp,
  20883. count = 1,
  20884. defer = jQuery.Deferred(),
  20885. elements = this,
  20886. i = this.length,
  20887. resolve = function() {
  20888. if ( !( --count ) ) {
  20889. defer.resolveWith( elements, [ elements ] );
  20890. }
  20891. };
  20892. if ( typeof type !== "string" ) {
  20893. obj = type;
  20894. type = undefined;
  20895. }
  20896. type = type || "fx";
  20897. while ( i-- ) {
  20898. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  20899. if ( tmp && tmp.empty ) {
  20900. count++;
  20901. tmp.empty.add( resolve );
  20902. }
  20903. }
  20904. resolve();
  20905. return defer.promise( obj );
  20906. }
  20907. } );
  20908. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  20909. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  20910. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  20911. var documentElement = document.documentElement;
  20912. var isAttached = function( elem ) {
  20913. return jQuery.contains( elem.ownerDocument, elem );
  20914. },
  20915. composed = { composed: true };
  20916. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  20917. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  20918. // Support: iOS 10.0-10.2 only
  20919. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  20920. // leading to errors. We need to check for `getRootNode`.
  20921. if ( documentElement.getRootNode ) {
  20922. isAttached = function( elem ) {
  20923. return jQuery.contains( elem.ownerDocument, elem ) ||
  20924. elem.getRootNode( composed ) === elem.ownerDocument;
  20925. };
  20926. }
  20927. var isHiddenWithinTree = function( elem, el ) {
  20928. // isHiddenWithinTree might be called from jQuery#filter function;
  20929. // in that case, element will be second argument
  20930. elem = el || elem;
  20931. // Inline style trumps all
  20932. return elem.style.display === "none" ||
  20933. elem.style.display === "" &&
  20934. // Otherwise, check computed style
  20935. // Support: Firefox <=43 - 45
  20936. // Disconnected elements can have computed display: none, so first confirm that elem is
  20937. // in the document.
  20938. isAttached( elem ) &&
  20939. jQuery.css( elem, "display" ) === "none";
  20940. };
  20941. function adjustCSS( elem, prop, valueParts, tween ) {
  20942. var adjusted, scale,
  20943. maxIterations = 20,
  20944. currentValue = tween ?
  20945. function() {
  20946. return tween.cur();
  20947. } :
  20948. function() {
  20949. return jQuery.css( elem, prop, "" );
  20950. },
  20951. initial = currentValue(),
  20952. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  20953. // Starting value computation is required for potential unit mismatches
  20954. initialInUnit = elem.nodeType &&
  20955. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  20956. rcssNum.exec( jQuery.css( elem, prop ) );
  20957. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  20958. // Support: Firefox <=54
  20959. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  20960. initial = initial / 2;
  20961. // Trust units reported by jQuery.css
  20962. unit = unit || initialInUnit[ 3 ];
  20963. // Iteratively approximate from a nonzero starting point
  20964. initialInUnit = +initial || 1;
  20965. while ( maxIterations-- ) {
  20966. // Evaluate and update our best guess (doubling guesses that zero out).
  20967. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  20968. jQuery.style( elem, prop, initialInUnit + unit );
  20969. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  20970. maxIterations = 0;
  20971. }
  20972. initialInUnit = initialInUnit / scale;
  20973. }
  20974. initialInUnit = initialInUnit * 2;
  20975. jQuery.style( elem, prop, initialInUnit + unit );
  20976. // Make sure we update the tween properties later on
  20977. valueParts = valueParts || [];
  20978. }
  20979. if ( valueParts ) {
  20980. initialInUnit = +initialInUnit || +initial || 0;
  20981. // Apply relative offset (+=/-=) if specified
  20982. adjusted = valueParts[ 1 ] ?
  20983. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  20984. +valueParts[ 2 ];
  20985. if ( tween ) {
  20986. tween.unit = unit;
  20987. tween.start = initialInUnit;
  20988. tween.end = adjusted;
  20989. }
  20990. }
  20991. return adjusted;
  20992. }
  20993. var defaultDisplayMap = {};
  20994. function getDefaultDisplay( elem ) {
  20995. var temp,
  20996. doc = elem.ownerDocument,
  20997. nodeName = elem.nodeName,
  20998. display = defaultDisplayMap[ nodeName ];
  20999. if ( display ) {
  21000. return display;
  21001. }
  21002. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  21003. display = jQuery.css( temp, "display" );
  21004. temp.parentNode.removeChild( temp );
  21005. if ( display === "none" ) {
  21006. display = "block";
  21007. }
  21008. defaultDisplayMap[ nodeName ] = display;
  21009. return display;
  21010. }
  21011. function showHide( elements, show ) {
  21012. var display, elem,
  21013. values = [],
  21014. index = 0,
  21015. length = elements.length;
  21016. // Determine new display value for elements that need to change
  21017. for ( ; index < length; index++ ) {
  21018. elem = elements[ index ];
  21019. if ( !elem.style ) {
  21020. continue;
  21021. }
  21022. display = elem.style.display;
  21023. if ( show ) {
  21024. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  21025. // check is required in this first loop unless we have a nonempty display value (either
  21026. // inline or about-to-be-restored)
  21027. if ( display === "none" ) {
  21028. values[ index ] = dataPriv.get( elem, "display" ) || null;
  21029. if ( !values[ index ] ) {
  21030. elem.style.display = "";
  21031. }
  21032. }
  21033. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  21034. values[ index ] = getDefaultDisplay( elem );
  21035. }
  21036. } else {
  21037. if ( display !== "none" ) {
  21038. values[ index ] = "none";
  21039. // Remember what we're overwriting
  21040. dataPriv.set( elem, "display", display );
  21041. }
  21042. }
  21043. }
  21044. // Set the display of the elements in a second loop to avoid constant reflow
  21045. for ( index = 0; index < length; index++ ) {
  21046. if ( values[ index ] != null ) {
  21047. elements[ index ].style.display = values[ index ];
  21048. }
  21049. }
  21050. return elements;
  21051. }
  21052. jQuery.fn.extend( {
  21053. show: function() {
  21054. return showHide( this, true );
  21055. },
  21056. hide: function() {
  21057. return showHide( this );
  21058. },
  21059. toggle: function( state ) {
  21060. if ( typeof state === "boolean" ) {
  21061. return state ? this.show() : this.hide();
  21062. }
  21063. return this.each( function() {
  21064. if ( isHiddenWithinTree( this ) ) {
  21065. jQuery( this ).show();
  21066. } else {
  21067. jQuery( this ).hide();
  21068. }
  21069. } );
  21070. }
  21071. } );
  21072. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  21073. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  21074. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  21075. ( function() {
  21076. var fragment = document.createDocumentFragment(),
  21077. div = fragment.appendChild( document.createElement( "div" ) ),
  21078. input = document.createElement( "input" );
  21079. // Support: Android 4.0 - 4.3 only
  21080. // Check state lost if the name is set (#11217)
  21081. // Support: Windows Web Apps (WWA)
  21082. // `name` and `type` must use .setAttribute for WWA (#14901)
  21083. input.setAttribute( "type", "radio" );
  21084. input.setAttribute( "checked", "checked" );
  21085. input.setAttribute( "name", "t" );
  21086. div.appendChild( input );
  21087. // Support: Android <=4.1 only
  21088. // Older WebKit doesn't clone checked state correctly in fragments
  21089. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  21090. // Support: IE <=11 only
  21091. // Make sure textarea (and checkbox) defaultValue is properly cloned
  21092. div.innerHTML = "<textarea>x</textarea>";
  21093. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  21094. // Support: IE <=9 only
  21095. // IE <=9 replaces <option> tags with their contents when inserted outside of
  21096. // the select element.
  21097. div.innerHTML = "<option></option>";
  21098. support.option = !!div.lastChild;
  21099. } )();
  21100. // We have to close these tags to support XHTML (#13200)
  21101. var wrapMap = {
  21102. // XHTML parsers do not magically insert elements in the
  21103. // same way that tag soup parsers do. So we cannot shorten
  21104. // this by omitting <tbody> or other required elements.
  21105. thead: [ 1, "<table>", "</table>" ],
  21106. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  21107. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  21108. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  21109. _default: [ 0, "", "" ]
  21110. };
  21111. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  21112. wrapMap.th = wrapMap.td;
  21113. // Support: IE <=9 only
  21114. if ( !support.option ) {
  21115. wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
  21116. }
  21117. function getAll( context, tag ) {
  21118. // Support: IE <=9 - 11 only
  21119. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  21120. var ret;
  21121. if ( typeof context.getElementsByTagName !== "undefined" ) {
  21122. ret = context.getElementsByTagName( tag || "*" );
  21123. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  21124. ret = context.querySelectorAll( tag || "*" );
  21125. } else {
  21126. ret = [];
  21127. }
  21128. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  21129. return jQuery.merge( [ context ], ret );
  21130. }
  21131. return ret;
  21132. }
  21133. // Mark scripts as having already been evaluated
  21134. function setGlobalEval( elems, refElements ) {
  21135. var i = 0,
  21136. l = elems.length;
  21137. for ( ; i < l; i++ ) {
  21138. dataPriv.set(
  21139. elems[ i ],
  21140. "globalEval",
  21141. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  21142. );
  21143. }
  21144. }
  21145. var rhtml = /<|&#?\w+;/;
  21146. function buildFragment( elems, context, scripts, selection, ignored ) {
  21147. var elem, tmp, tag, wrap, attached, j,
  21148. fragment = context.createDocumentFragment(),
  21149. nodes = [],
  21150. i = 0,
  21151. l = elems.length;
  21152. for ( ; i < l; i++ ) {
  21153. elem = elems[ i ];
  21154. if ( elem || elem === 0 ) {
  21155. // Add nodes directly
  21156. if ( toType( elem ) === "object" ) {
  21157. // Support: Android <=4.0 only, PhantomJS 1 only
  21158. // push.apply(_, arraylike) throws on ancient WebKit
  21159. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  21160. // Convert non-html into a text node
  21161. } else if ( !rhtml.test( elem ) ) {
  21162. nodes.push( context.createTextNode( elem ) );
  21163. // Convert html into DOM nodes
  21164. } else {
  21165. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  21166. // Deserialize a standard representation
  21167. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  21168. wrap = wrapMap[ tag ] || wrapMap._default;
  21169. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  21170. // Descend through wrappers to the right content
  21171. j = wrap[ 0 ];
  21172. while ( j-- ) {
  21173. tmp = tmp.lastChild;
  21174. }
  21175. // Support: Android <=4.0 only, PhantomJS 1 only
  21176. // push.apply(_, arraylike) throws on ancient WebKit
  21177. jQuery.merge( nodes, tmp.childNodes );
  21178. // Remember the top-level container
  21179. tmp = fragment.firstChild;
  21180. // Ensure the created nodes are orphaned (#12392)
  21181. tmp.textContent = "";
  21182. }
  21183. }
  21184. }
  21185. // Remove wrapper from fragment
  21186. fragment.textContent = "";
  21187. i = 0;
  21188. while ( ( elem = nodes[ i++ ] ) ) {
  21189. // Skip elements already in the context collection (trac-4087)
  21190. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  21191. if ( ignored ) {
  21192. ignored.push( elem );
  21193. }
  21194. continue;
  21195. }
  21196. attached = isAttached( elem );
  21197. // Append to fragment
  21198. tmp = getAll( fragment.appendChild( elem ), "script" );
  21199. // Preserve script evaluation history
  21200. if ( attached ) {
  21201. setGlobalEval( tmp );
  21202. }
  21203. // Capture executables
  21204. if ( scripts ) {
  21205. j = 0;
  21206. while ( ( elem = tmp[ j++ ] ) ) {
  21207. if ( rscriptType.test( elem.type || "" ) ) {
  21208. scripts.push( elem );
  21209. }
  21210. }
  21211. }
  21212. }
  21213. return fragment;
  21214. }
  21215. var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  21216. function returnTrue() {
  21217. return true;
  21218. }
  21219. function returnFalse() {
  21220. return false;
  21221. }
  21222. // Support: IE <=9 - 11+
  21223. // focus() and blur() are asynchronous, except when they are no-op.
  21224. // So expect focus to be synchronous when the element is already active,
  21225. // and blur to be synchronous when the element is not already active.
  21226. // (focus and blur are always synchronous in other supported browsers,
  21227. // this just defines when we can count on it).
  21228. function expectSync( elem, type ) {
  21229. return ( elem === safeActiveElement() ) === ( type === "focus" );
  21230. }
  21231. // Support: IE <=9 only
  21232. // Accessing document.activeElement can throw unexpectedly
  21233. // https://bugs.jquery.com/ticket/13393
  21234. function safeActiveElement() {
  21235. try {
  21236. return document.activeElement;
  21237. } catch ( err ) { }
  21238. }
  21239. function on( elem, types, selector, data, fn, one ) {
  21240. var origFn, type;
  21241. // Types can be a map of types/handlers
  21242. if ( typeof types === "object" ) {
  21243. // ( types-Object, selector, data )
  21244. if ( typeof selector !== "string" ) {
  21245. // ( types-Object, data )
  21246. data = data || selector;
  21247. selector = undefined;
  21248. }
  21249. for ( type in types ) {
  21250. on( elem, type, selector, data, types[ type ], one );
  21251. }
  21252. return elem;
  21253. }
  21254. if ( data == null && fn == null ) {
  21255. // ( types, fn )
  21256. fn = selector;
  21257. data = selector = undefined;
  21258. } else if ( fn == null ) {
  21259. if ( typeof selector === "string" ) {
  21260. // ( types, selector, fn )
  21261. fn = data;
  21262. data = undefined;
  21263. } else {
  21264. // ( types, data, fn )
  21265. fn = data;
  21266. data = selector;
  21267. selector = undefined;
  21268. }
  21269. }
  21270. if ( fn === false ) {
  21271. fn = returnFalse;
  21272. } else if ( !fn ) {
  21273. return elem;
  21274. }
  21275. if ( one === 1 ) {
  21276. origFn = fn;
  21277. fn = function( event ) {
  21278. // Can use an empty set, since event contains the info
  21279. jQuery().off( event );
  21280. return origFn.apply( this, arguments );
  21281. };
  21282. // Use same guid so caller can remove using origFn
  21283. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  21284. }
  21285. return elem.each( function() {
  21286. jQuery.event.add( this, types, fn, data, selector );
  21287. } );
  21288. }
  21289. /*
  21290. * Helper functions for managing events -- not part of the public interface.
  21291. * Props to Dean Edwards' addEvent library for many of the ideas.
  21292. */
  21293. jQuery.event = {
  21294. global: {},
  21295. add: function( elem, types, handler, data, selector ) {
  21296. var handleObjIn, eventHandle, tmp,
  21297. events, t, handleObj,
  21298. special, handlers, type, namespaces, origType,
  21299. elemData = dataPriv.get( elem );
  21300. // Only attach events to objects that accept data
  21301. if ( !acceptData( elem ) ) {
  21302. return;
  21303. }
  21304. // Caller can pass in an object of custom data in lieu of the handler
  21305. if ( handler.handler ) {
  21306. handleObjIn = handler;
  21307. handler = handleObjIn.handler;
  21308. selector = handleObjIn.selector;
  21309. }
  21310. // Ensure that invalid selectors throw exceptions at attach time
  21311. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  21312. if ( selector ) {
  21313. jQuery.find.matchesSelector( documentElement, selector );
  21314. }
  21315. // Make sure that the handler has a unique ID, used to find/remove it later
  21316. if ( !handler.guid ) {
  21317. handler.guid = jQuery.guid++;
  21318. }
  21319. // Init the element's event structure and main handler, if this is the first
  21320. if ( !( events = elemData.events ) ) {
  21321. events = elemData.events = Object.create( null );
  21322. }
  21323. if ( !( eventHandle = elemData.handle ) ) {
  21324. eventHandle = elemData.handle = function( e ) {
  21325. // Discard the second event of a jQuery.event.trigger() and
  21326. // when an event is called after a page has unloaded
  21327. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  21328. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  21329. };
  21330. }
  21331. // Handle multiple events separated by a space
  21332. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  21333. t = types.length;
  21334. while ( t-- ) {
  21335. tmp = rtypenamespace.exec( types[ t ] ) || [];
  21336. type = origType = tmp[ 1 ];
  21337. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  21338. // There *must* be a type, no attaching namespace-only handlers
  21339. if ( !type ) {
  21340. continue;
  21341. }
  21342. // If event changes its type, use the special event handlers for the changed type
  21343. special = jQuery.event.special[ type ] || {};
  21344. // If selector defined, determine special event api type, otherwise given type
  21345. type = ( selector ? special.delegateType : special.bindType ) || type;
  21346. // Update special based on newly reset type
  21347. special = jQuery.event.special[ type ] || {};
  21348. // handleObj is passed to all event handlers
  21349. handleObj = jQuery.extend( {
  21350. type: type,
  21351. origType: origType,
  21352. data: data,
  21353. handler: handler,
  21354. guid: handler.guid,
  21355. selector: selector,
  21356. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  21357. namespace: namespaces.join( "." )
  21358. }, handleObjIn );
  21359. // Init the event handler queue if we're the first
  21360. if ( !( handlers = events[ type ] ) ) {
  21361. handlers = events[ type ] = [];
  21362. handlers.delegateCount = 0;
  21363. // Only use addEventListener if the special events handler returns false
  21364. if ( !special.setup ||
  21365. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  21366. if ( elem.addEventListener ) {
  21367. elem.addEventListener( type, eventHandle );
  21368. }
  21369. }
  21370. }
  21371. if ( special.add ) {
  21372. special.add.call( elem, handleObj );
  21373. if ( !handleObj.handler.guid ) {
  21374. handleObj.handler.guid = handler.guid;
  21375. }
  21376. }
  21377. // Add to the element's handler list, delegates in front
  21378. if ( selector ) {
  21379. handlers.splice( handlers.delegateCount++, 0, handleObj );
  21380. } else {
  21381. handlers.push( handleObj );
  21382. }
  21383. // Keep track of which events have ever been used, for event optimization
  21384. jQuery.event.global[ type ] = true;
  21385. }
  21386. },
  21387. // Detach an event or set of events from an element
  21388. remove: function( elem, types, handler, selector, mappedTypes ) {
  21389. var j, origCount, tmp,
  21390. events, t, handleObj,
  21391. special, handlers, type, namespaces, origType,
  21392. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  21393. if ( !elemData || !( events = elemData.events ) ) {
  21394. return;
  21395. }
  21396. // Once for each type.namespace in types; type may be omitted
  21397. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  21398. t = types.length;
  21399. while ( t-- ) {
  21400. tmp = rtypenamespace.exec( types[ t ] ) || [];
  21401. type = origType = tmp[ 1 ];
  21402. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  21403. // Unbind all events (on this namespace, if provided) for the element
  21404. if ( !type ) {
  21405. for ( type in events ) {
  21406. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  21407. }
  21408. continue;
  21409. }
  21410. special = jQuery.event.special[ type ] || {};
  21411. type = ( selector ? special.delegateType : special.bindType ) || type;
  21412. handlers = events[ type ] || [];
  21413. tmp = tmp[ 2 ] &&
  21414. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  21415. // Remove matching events
  21416. origCount = j = handlers.length;
  21417. while ( j-- ) {
  21418. handleObj = handlers[ j ];
  21419. if ( ( mappedTypes || origType === handleObj.origType ) &&
  21420. ( !handler || handler.guid === handleObj.guid ) &&
  21421. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  21422. ( !selector || selector === handleObj.selector ||
  21423. selector === "**" && handleObj.selector ) ) {
  21424. handlers.splice( j, 1 );
  21425. if ( handleObj.selector ) {
  21426. handlers.delegateCount--;
  21427. }
  21428. if ( special.remove ) {
  21429. special.remove.call( elem, handleObj );
  21430. }
  21431. }
  21432. }
  21433. // Remove generic event handler if we removed something and no more handlers exist
  21434. // (avoids potential for endless recursion during removal of special event handlers)
  21435. if ( origCount && !handlers.length ) {
  21436. if ( !special.teardown ||
  21437. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  21438. jQuery.removeEvent( elem, type, elemData.handle );
  21439. }
  21440. delete events[ type ];
  21441. }
  21442. }
  21443. // Remove data and the expando if it's no longer used
  21444. if ( jQuery.isEmptyObject( events ) ) {
  21445. dataPriv.remove( elem, "handle events" );
  21446. }
  21447. },
  21448. dispatch: function( nativeEvent ) {
  21449. var i, j, ret, matched, handleObj, handlerQueue,
  21450. args = new Array( arguments.length ),
  21451. // Make a writable jQuery.Event from the native event object
  21452. event = jQuery.event.fix( nativeEvent ),
  21453. handlers = (
  21454. dataPriv.get( this, "events" ) || Object.create( null )
  21455. )[ event.type ] || [],
  21456. special = jQuery.event.special[ event.type ] || {};
  21457. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  21458. args[ 0 ] = event;
  21459. for ( i = 1; i < arguments.length; i++ ) {
  21460. args[ i ] = arguments[ i ];
  21461. }
  21462. event.delegateTarget = this;
  21463. // Call the preDispatch hook for the mapped type, and let it bail if desired
  21464. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  21465. return;
  21466. }
  21467. // Determine handlers
  21468. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  21469. // Run delegates first; they may want to stop propagation beneath us
  21470. i = 0;
  21471. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  21472. event.currentTarget = matched.elem;
  21473. j = 0;
  21474. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  21475. !event.isImmediatePropagationStopped() ) {
  21476. // If the event is namespaced, then each handler is only invoked if it is
  21477. // specially universal or its namespaces are a superset of the event's.
  21478. if ( !event.rnamespace || handleObj.namespace === false ||
  21479. event.rnamespace.test( handleObj.namespace ) ) {
  21480. event.handleObj = handleObj;
  21481. event.data = handleObj.data;
  21482. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  21483. handleObj.handler ).apply( matched.elem, args );
  21484. if ( ret !== undefined ) {
  21485. if ( ( event.result = ret ) === false ) {
  21486. event.preventDefault();
  21487. event.stopPropagation();
  21488. }
  21489. }
  21490. }
  21491. }
  21492. }
  21493. // Call the postDispatch hook for the mapped type
  21494. if ( special.postDispatch ) {
  21495. special.postDispatch.call( this, event );
  21496. }
  21497. return event.result;
  21498. },
  21499. handlers: function( event, handlers ) {
  21500. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  21501. handlerQueue = [],
  21502. delegateCount = handlers.delegateCount,
  21503. cur = event.target;
  21504. // Find delegate handlers
  21505. if ( delegateCount &&
  21506. // Support: IE <=9
  21507. // Black-hole SVG <use> instance trees (trac-13180)
  21508. cur.nodeType &&
  21509. // Support: Firefox <=42
  21510. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  21511. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  21512. // Support: IE 11 only
  21513. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  21514. !( event.type === "click" && event.button >= 1 ) ) {
  21515. for ( ; cur !== this; cur = cur.parentNode || this ) {
  21516. // Don't check non-elements (#13208)
  21517. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  21518. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  21519. matchedHandlers = [];
  21520. matchedSelectors = {};
  21521. for ( i = 0; i < delegateCount; i++ ) {
  21522. handleObj = handlers[ i ];
  21523. // Don't conflict with Object.prototype properties (#13203)
  21524. sel = handleObj.selector + " ";
  21525. if ( matchedSelectors[ sel ] === undefined ) {
  21526. matchedSelectors[ sel ] = handleObj.needsContext ?
  21527. jQuery( sel, this ).index( cur ) > -1 :
  21528. jQuery.find( sel, this, null, [ cur ] ).length;
  21529. }
  21530. if ( matchedSelectors[ sel ] ) {
  21531. matchedHandlers.push( handleObj );
  21532. }
  21533. }
  21534. if ( matchedHandlers.length ) {
  21535. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  21536. }
  21537. }
  21538. }
  21539. }
  21540. // Add the remaining (directly-bound) handlers
  21541. cur = this;
  21542. if ( delegateCount < handlers.length ) {
  21543. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  21544. }
  21545. return handlerQueue;
  21546. },
  21547. addProp: function( name, hook ) {
  21548. Object.defineProperty( jQuery.Event.prototype, name, {
  21549. enumerable: true,
  21550. configurable: true,
  21551. get: isFunction( hook ) ?
  21552. function() {
  21553. if ( this.originalEvent ) {
  21554. return hook( this.originalEvent );
  21555. }
  21556. } :
  21557. function() {
  21558. if ( this.originalEvent ) {
  21559. return this.originalEvent[ name ];
  21560. }
  21561. },
  21562. set: function( value ) {
  21563. Object.defineProperty( this, name, {
  21564. enumerable: true,
  21565. configurable: true,
  21566. writable: true,
  21567. value: value
  21568. } );
  21569. }
  21570. } );
  21571. },
  21572. fix: function( originalEvent ) {
  21573. return originalEvent[ jQuery.expando ] ?
  21574. originalEvent :
  21575. new jQuery.Event( originalEvent );
  21576. },
  21577. special: {
  21578. load: {
  21579. // Prevent triggered image.load events from bubbling to window.load
  21580. noBubble: true
  21581. },
  21582. click: {
  21583. // Utilize native event to ensure correct state for checkable inputs
  21584. setup: function( data ) {
  21585. // For mutual compressibility with _default, replace `this` access with a local var.
  21586. // `|| data` is dead code meant only to preserve the variable through minification.
  21587. var el = this || data;
  21588. // Claim the first handler
  21589. if ( rcheckableType.test( el.type ) &&
  21590. el.click && nodeName( el, "input" ) ) {
  21591. // dataPriv.set( el, "click", ... )
  21592. leverageNative( el, "click", returnTrue );
  21593. }
  21594. // Return false to allow normal processing in the caller
  21595. return false;
  21596. },
  21597. trigger: function( data ) {
  21598. // For mutual compressibility with _default, replace `this` access with a local var.
  21599. // `|| data` is dead code meant only to preserve the variable through minification.
  21600. var el = this || data;
  21601. // Force setup before triggering a click
  21602. if ( rcheckableType.test( el.type ) &&
  21603. el.click && nodeName( el, "input" ) ) {
  21604. leverageNative( el, "click" );
  21605. }
  21606. // Return non-false to allow normal event-path propagation
  21607. return true;
  21608. },
  21609. // For cross-browser consistency, suppress native .click() on links
  21610. // Also prevent it if we're currently inside a leveraged native-event stack
  21611. _default: function( event ) {
  21612. var target = event.target;
  21613. return rcheckableType.test( target.type ) &&
  21614. target.click && nodeName( target, "input" ) &&
  21615. dataPriv.get( target, "click" ) ||
  21616. nodeName( target, "a" );
  21617. }
  21618. },
  21619. beforeunload: {
  21620. postDispatch: function( event ) {
  21621. // Support: Firefox 20+
  21622. // Firefox doesn't alert if the returnValue field is not set.
  21623. if ( event.result !== undefined && event.originalEvent ) {
  21624. event.originalEvent.returnValue = event.result;
  21625. }
  21626. }
  21627. }
  21628. }
  21629. };
  21630. // Ensure the presence of an event listener that handles manually-triggered
  21631. // synthetic events by interrupting progress until reinvoked in response to
  21632. // *native* events that it fires directly, ensuring that state changes have
  21633. // already occurred before other listeners are invoked.
  21634. function leverageNative( el, type, expectSync ) {
  21635. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  21636. if ( !expectSync ) {
  21637. if ( dataPriv.get( el, type ) === undefined ) {
  21638. jQuery.event.add( el, type, returnTrue );
  21639. }
  21640. return;
  21641. }
  21642. // Register the controller as a special universal handler for all event namespaces
  21643. dataPriv.set( el, type, false );
  21644. jQuery.event.add( el, type, {
  21645. namespace: false,
  21646. handler: function( event ) {
  21647. var notAsync, result,
  21648. saved = dataPriv.get( this, type );
  21649. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  21650. // Interrupt processing of the outer synthetic .trigger()ed event
  21651. // Saved data should be false in such cases, but might be a leftover capture object
  21652. // from an async native handler (gh-4350)
  21653. if ( !saved.length ) {
  21654. // Store arguments for use when handling the inner native event
  21655. // There will always be at least one argument (an event object), so this array
  21656. // will not be confused with a leftover capture object.
  21657. saved = slice.call( arguments );
  21658. dataPriv.set( this, type, saved );
  21659. // Trigger the native event and capture its result
  21660. // Support: IE <=9 - 11+
  21661. // focus() and blur() are asynchronous
  21662. notAsync = expectSync( this, type );
  21663. this[ type ]();
  21664. result = dataPriv.get( this, type );
  21665. if ( saved !== result || notAsync ) {
  21666. dataPriv.set( this, type, false );
  21667. } else {
  21668. result = {};
  21669. }
  21670. if ( saved !== result ) {
  21671. // Cancel the outer synthetic event
  21672. event.stopImmediatePropagation();
  21673. event.preventDefault();
  21674. // Support: Chrome 86+
  21675. // In Chrome, if an element having a focusout handler is blurred by
  21676. // clicking outside of it, it invokes the handler synchronously. If
  21677. // that handler calls `.remove()` on the element, the data is cleared,
  21678. // leaving `result` undefined. We need to guard against this.
  21679. return result && result.value;
  21680. }
  21681. // If this is an inner synthetic event for an event with a bubbling surrogate
  21682. // (focus or blur), assume that the surrogate already propagated from triggering the
  21683. // native event and prevent that from happening again here.
  21684. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  21685. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  21686. // less bad than duplication.
  21687. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  21688. event.stopPropagation();
  21689. }
  21690. // If this is a native event triggered above, everything is now in order
  21691. // Fire an inner synthetic event with the original arguments
  21692. } else if ( saved.length ) {
  21693. // ...and capture the result
  21694. dataPriv.set( this, type, {
  21695. value: jQuery.event.trigger(
  21696. // Support: IE <=9 - 11+
  21697. // Extend with the prototype to reset the above stopImmediatePropagation()
  21698. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  21699. saved.slice( 1 ),
  21700. this
  21701. )
  21702. } );
  21703. // Abort handling of the native event
  21704. event.stopImmediatePropagation();
  21705. }
  21706. }
  21707. } );
  21708. }
  21709. jQuery.removeEvent = function( elem, type, handle ) {
  21710. // This "if" is needed for plain objects
  21711. if ( elem.removeEventListener ) {
  21712. elem.removeEventListener( type, handle );
  21713. }
  21714. };
  21715. jQuery.Event = function( src, props ) {
  21716. // Allow instantiation without the 'new' keyword
  21717. if ( !( this instanceof jQuery.Event ) ) {
  21718. return new jQuery.Event( src, props );
  21719. }
  21720. // Event object
  21721. if ( src && src.type ) {
  21722. this.originalEvent = src;
  21723. this.type = src.type;
  21724. // Events bubbling up the document may have been marked as prevented
  21725. // by a handler lower down the tree; reflect the correct value.
  21726. this.isDefaultPrevented = src.defaultPrevented ||
  21727. src.defaultPrevented === undefined &&
  21728. // Support: Android <=2.3 only
  21729. src.returnValue === false ?
  21730. returnTrue :
  21731. returnFalse;
  21732. // Create target properties
  21733. // Support: Safari <=6 - 7 only
  21734. // Target should not be a text node (#504, #13143)
  21735. this.target = ( src.target && src.target.nodeType === 3 ) ?
  21736. src.target.parentNode :
  21737. src.target;
  21738. this.currentTarget = src.currentTarget;
  21739. this.relatedTarget = src.relatedTarget;
  21740. // Event type
  21741. } else {
  21742. this.type = src;
  21743. }
  21744. // Put explicitly provided properties onto the event object
  21745. if ( props ) {
  21746. jQuery.extend( this, props );
  21747. }
  21748. // Create a timestamp if incoming event doesn't have one
  21749. this.timeStamp = src && src.timeStamp || Date.now();
  21750. // Mark it as fixed
  21751. this[ jQuery.expando ] = true;
  21752. };
  21753. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  21754. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  21755. jQuery.Event.prototype = {
  21756. constructor: jQuery.Event,
  21757. isDefaultPrevented: returnFalse,
  21758. isPropagationStopped: returnFalse,
  21759. isImmediatePropagationStopped: returnFalse,
  21760. isSimulated: false,
  21761. preventDefault: function() {
  21762. var e = this.originalEvent;
  21763. this.isDefaultPrevented = returnTrue;
  21764. if ( e && !this.isSimulated ) {
  21765. e.preventDefault();
  21766. }
  21767. },
  21768. stopPropagation: function() {
  21769. var e = this.originalEvent;
  21770. this.isPropagationStopped = returnTrue;
  21771. if ( e && !this.isSimulated ) {
  21772. e.stopPropagation();
  21773. }
  21774. },
  21775. stopImmediatePropagation: function() {
  21776. var e = this.originalEvent;
  21777. this.isImmediatePropagationStopped = returnTrue;
  21778. if ( e && !this.isSimulated ) {
  21779. e.stopImmediatePropagation();
  21780. }
  21781. this.stopPropagation();
  21782. }
  21783. };
  21784. // Includes all common event props including KeyEvent and MouseEvent specific props
  21785. jQuery.each( {
  21786. altKey: true,
  21787. bubbles: true,
  21788. cancelable: true,
  21789. changedTouches: true,
  21790. ctrlKey: true,
  21791. detail: true,
  21792. eventPhase: true,
  21793. metaKey: true,
  21794. pageX: true,
  21795. pageY: true,
  21796. shiftKey: true,
  21797. view: true,
  21798. "char": true,
  21799. code: true,
  21800. charCode: true,
  21801. key: true,
  21802. keyCode: true,
  21803. button: true,
  21804. buttons: true,
  21805. clientX: true,
  21806. clientY: true,
  21807. offsetX: true,
  21808. offsetY: true,
  21809. pointerId: true,
  21810. pointerType: true,
  21811. screenX: true,
  21812. screenY: true,
  21813. targetTouches: true,
  21814. toElement: true,
  21815. touches: true,
  21816. which: true
  21817. }, jQuery.event.addProp );
  21818. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  21819. jQuery.event.special[ type ] = {
  21820. // Utilize native event if possible so blur/focus sequence is correct
  21821. setup: function() {
  21822. // Claim the first handler
  21823. // dataPriv.set( this, "focus", ... )
  21824. // dataPriv.set( this, "blur", ... )
  21825. leverageNative( this, type, expectSync );
  21826. // Return false to allow normal processing in the caller
  21827. return false;
  21828. },
  21829. trigger: function() {
  21830. // Force setup before trigger
  21831. leverageNative( this, type );
  21832. // Return non-false to allow normal event-path propagation
  21833. return true;
  21834. },
  21835. // Suppress native focus or blur as it's already being fired
  21836. // in leverageNative.
  21837. _default: function() {
  21838. return true;
  21839. },
  21840. delegateType: delegateType
  21841. };
  21842. } );
  21843. // Create mouseenter/leave events using mouseover/out and event-time checks
  21844. // so that event delegation works in jQuery.
  21845. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  21846. //
  21847. // Support: Safari 7 only
  21848. // Safari sends mouseenter too often; see:
  21849. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  21850. // for the description of the bug (it existed in older Chrome versions as well).
  21851. jQuery.each( {
  21852. mouseenter: "mouseover",
  21853. mouseleave: "mouseout",
  21854. pointerenter: "pointerover",
  21855. pointerleave: "pointerout"
  21856. }, function( orig, fix ) {
  21857. jQuery.event.special[ orig ] = {
  21858. delegateType: fix,
  21859. bindType: fix,
  21860. handle: function( event ) {
  21861. var ret,
  21862. target = this,
  21863. related = event.relatedTarget,
  21864. handleObj = event.handleObj;
  21865. // For mouseenter/leave call the handler if related is outside the target.
  21866. // NB: No relatedTarget if the mouse left/entered the browser window
  21867. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  21868. event.type = handleObj.origType;
  21869. ret = handleObj.handler.apply( this, arguments );
  21870. event.type = fix;
  21871. }
  21872. return ret;
  21873. }
  21874. };
  21875. } );
  21876. jQuery.fn.extend( {
  21877. on: function( types, selector, data, fn ) {
  21878. return on( this, types, selector, data, fn );
  21879. },
  21880. one: function( types, selector, data, fn ) {
  21881. return on( this, types, selector, data, fn, 1 );
  21882. },
  21883. off: function( types, selector, fn ) {
  21884. var handleObj, type;
  21885. if ( types && types.preventDefault && types.handleObj ) {
  21886. // ( event ) dispatched jQuery.Event
  21887. handleObj = types.handleObj;
  21888. jQuery( types.delegateTarget ).off(
  21889. handleObj.namespace ?
  21890. handleObj.origType + "." + handleObj.namespace :
  21891. handleObj.origType,
  21892. handleObj.selector,
  21893. handleObj.handler
  21894. );
  21895. return this;
  21896. }
  21897. if ( typeof types === "object" ) {
  21898. // ( types-object [, selector] )
  21899. for ( type in types ) {
  21900. this.off( type, selector, types[ type ] );
  21901. }
  21902. return this;
  21903. }
  21904. if ( selector === false || typeof selector === "function" ) {
  21905. // ( types [, fn] )
  21906. fn = selector;
  21907. selector = undefined;
  21908. }
  21909. if ( fn === false ) {
  21910. fn = returnFalse;
  21911. }
  21912. return this.each( function() {
  21913. jQuery.event.remove( this, types, fn, selector );
  21914. } );
  21915. }
  21916. } );
  21917. var
  21918. // Support: IE <=10 - 11, Edge 12 - 13 only
  21919. // In IE/Edge using regex groups here causes severe slowdowns.
  21920. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  21921. rnoInnerhtml = /<script|<style|<link/i,
  21922. // checked="checked" or checked
  21923. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  21924. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  21925. // Prefer a tbody over its parent table for containing new rows
  21926. function manipulationTarget( elem, content ) {
  21927. if ( nodeName( elem, "table" ) &&
  21928. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  21929. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  21930. }
  21931. return elem;
  21932. }
  21933. // Replace/restore the type attribute of script elements for safe DOM manipulation
  21934. function disableScript( elem ) {
  21935. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  21936. return elem;
  21937. }
  21938. function restoreScript( elem ) {
  21939. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  21940. elem.type = elem.type.slice( 5 );
  21941. } else {
  21942. elem.removeAttribute( "type" );
  21943. }
  21944. return elem;
  21945. }
  21946. function cloneCopyEvent( src, dest ) {
  21947. var i, l, type, pdataOld, udataOld, udataCur, events;
  21948. if ( dest.nodeType !== 1 ) {
  21949. return;
  21950. }
  21951. // 1. Copy private data: events, handlers, etc.
  21952. if ( dataPriv.hasData( src ) ) {
  21953. pdataOld = dataPriv.get( src );
  21954. events = pdataOld.events;
  21955. if ( events ) {
  21956. dataPriv.remove( dest, "handle events" );
  21957. for ( type in events ) {
  21958. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  21959. jQuery.event.add( dest, type, events[ type ][ i ] );
  21960. }
  21961. }
  21962. }
  21963. }
  21964. // 2. Copy user data
  21965. if ( dataUser.hasData( src ) ) {
  21966. udataOld = dataUser.access( src );
  21967. udataCur = jQuery.extend( {}, udataOld );
  21968. dataUser.set( dest, udataCur );
  21969. }
  21970. }
  21971. // Fix IE bugs, see support tests
  21972. function fixInput( src, dest ) {
  21973. var nodeName = dest.nodeName.toLowerCase();
  21974. // Fails to persist the checked state of a cloned checkbox or radio button.
  21975. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  21976. dest.checked = src.checked;
  21977. // Fails to return the selected option to the default selected state when cloning options
  21978. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  21979. dest.defaultValue = src.defaultValue;
  21980. }
  21981. }
  21982. function domManip( collection, args, callback, ignored ) {
  21983. // Flatten any nested arrays
  21984. args = flat( args );
  21985. var fragment, first, scripts, hasScripts, node, doc,
  21986. i = 0,
  21987. l = collection.length,
  21988. iNoClone = l - 1,
  21989. value = args[ 0 ],
  21990. valueIsFunction = isFunction( value );
  21991. // We can't cloneNode fragments that contain checked, in WebKit
  21992. if ( valueIsFunction ||
  21993. ( l > 1 && typeof value === "string" &&
  21994. !support.checkClone && rchecked.test( value ) ) ) {
  21995. return collection.each( function( index ) {
  21996. var self = collection.eq( index );
  21997. if ( valueIsFunction ) {
  21998. args[ 0 ] = value.call( this, index, self.html() );
  21999. }
  22000. domManip( self, args, callback, ignored );
  22001. } );
  22002. }
  22003. if ( l ) {
  22004. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  22005. first = fragment.firstChild;
  22006. if ( fragment.childNodes.length === 1 ) {
  22007. fragment = first;
  22008. }
  22009. // Require either new content or an interest in ignored elements to invoke the callback
  22010. if ( first || ignored ) {
  22011. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  22012. hasScripts = scripts.length;
  22013. // Use the original fragment for the last item
  22014. // instead of the first because it can end up
  22015. // being emptied incorrectly in certain situations (#8070).
  22016. for ( ; i < l; i++ ) {
  22017. node = fragment;
  22018. if ( i !== iNoClone ) {
  22019. node = jQuery.clone( node, true, true );
  22020. // Keep references to cloned scripts for later restoration
  22021. if ( hasScripts ) {
  22022. // Support: Android <=4.0 only, PhantomJS 1 only
  22023. // push.apply(_, arraylike) throws on ancient WebKit
  22024. jQuery.merge( scripts, getAll( node, "script" ) );
  22025. }
  22026. }
  22027. callback.call( collection[ i ], node, i );
  22028. }
  22029. if ( hasScripts ) {
  22030. doc = scripts[ scripts.length - 1 ].ownerDocument;
  22031. // Reenable scripts
  22032. jQuery.map( scripts, restoreScript );
  22033. // Evaluate executable scripts on first document insertion
  22034. for ( i = 0; i < hasScripts; i++ ) {
  22035. node = scripts[ i ];
  22036. if ( rscriptType.test( node.type || "" ) &&
  22037. !dataPriv.access( node, "globalEval" ) &&
  22038. jQuery.contains( doc, node ) ) {
  22039. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  22040. // Optional AJAX dependency, but won't run scripts if not present
  22041. if ( jQuery._evalUrl && !node.noModule ) {
  22042. jQuery._evalUrl( node.src, {
  22043. nonce: node.nonce || node.getAttribute( "nonce" )
  22044. }, doc );
  22045. }
  22046. } else {
  22047. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  22048. }
  22049. }
  22050. }
  22051. }
  22052. }
  22053. }
  22054. return collection;
  22055. }
  22056. function remove( elem, selector, keepData ) {
  22057. var node,
  22058. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  22059. i = 0;
  22060. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  22061. if ( !keepData && node.nodeType === 1 ) {
  22062. jQuery.cleanData( getAll( node ) );
  22063. }
  22064. if ( node.parentNode ) {
  22065. if ( keepData && isAttached( node ) ) {
  22066. setGlobalEval( getAll( node, "script" ) );
  22067. }
  22068. node.parentNode.removeChild( node );
  22069. }
  22070. }
  22071. return elem;
  22072. }
  22073. jQuery.extend( {
  22074. htmlPrefilter: function( html ) {
  22075. return html;
  22076. },
  22077. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  22078. var i, l, srcElements, destElements,
  22079. clone = elem.cloneNode( true ),
  22080. inPage = isAttached( elem );
  22081. // Fix IE cloning issues
  22082. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  22083. !jQuery.isXMLDoc( elem ) ) {
  22084. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  22085. destElements = getAll( clone );
  22086. srcElements = getAll( elem );
  22087. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  22088. fixInput( srcElements[ i ], destElements[ i ] );
  22089. }
  22090. }
  22091. // Copy the events from the original to the clone
  22092. if ( dataAndEvents ) {
  22093. if ( deepDataAndEvents ) {
  22094. srcElements = srcElements || getAll( elem );
  22095. destElements = destElements || getAll( clone );
  22096. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  22097. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  22098. }
  22099. } else {
  22100. cloneCopyEvent( elem, clone );
  22101. }
  22102. }
  22103. // Preserve script evaluation history
  22104. destElements = getAll( clone, "script" );
  22105. if ( destElements.length > 0 ) {
  22106. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  22107. }
  22108. // Return the cloned set
  22109. return clone;
  22110. },
  22111. cleanData: function( elems ) {
  22112. var data, elem, type,
  22113. special = jQuery.event.special,
  22114. i = 0;
  22115. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  22116. if ( acceptData( elem ) ) {
  22117. if ( ( data = elem[ dataPriv.expando ] ) ) {
  22118. if ( data.events ) {
  22119. for ( type in data.events ) {
  22120. if ( special[ type ] ) {
  22121. jQuery.event.remove( elem, type );
  22122. // This is a shortcut to avoid jQuery.event.remove's overhead
  22123. } else {
  22124. jQuery.removeEvent( elem, type, data.handle );
  22125. }
  22126. }
  22127. }
  22128. // Support: Chrome <=35 - 45+
  22129. // Assign undefined instead of using delete, see Data#remove
  22130. elem[ dataPriv.expando ] = undefined;
  22131. }
  22132. if ( elem[ dataUser.expando ] ) {
  22133. // Support: Chrome <=35 - 45+
  22134. // Assign undefined instead of using delete, see Data#remove
  22135. elem[ dataUser.expando ] = undefined;
  22136. }
  22137. }
  22138. }
  22139. }
  22140. } );
  22141. jQuery.fn.extend( {
  22142. detach: function( selector ) {
  22143. return remove( this, selector, true );
  22144. },
  22145. remove: function( selector ) {
  22146. return remove( this, selector );
  22147. },
  22148. text: function( value ) {
  22149. return access( this, function( value ) {
  22150. return value === undefined ?
  22151. jQuery.text( this ) :
  22152. this.empty().each( function() {
  22153. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  22154. this.textContent = value;
  22155. }
  22156. } );
  22157. }, null, value, arguments.length );
  22158. },
  22159. append: function() {
  22160. return domManip( this, arguments, function( elem ) {
  22161. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  22162. var target = manipulationTarget( this, elem );
  22163. target.appendChild( elem );
  22164. }
  22165. } );
  22166. },
  22167. prepend: function() {
  22168. return domManip( this, arguments, function( elem ) {
  22169. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  22170. var target = manipulationTarget( this, elem );
  22171. target.insertBefore( elem, target.firstChild );
  22172. }
  22173. } );
  22174. },
  22175. before: function() {
  22176. return domManip( this, arguments, function( elem ) {
  22177. if ( this.parentNode ) {
  22178. this.parentNode.insertBefore( elem, this );
  22179. }
  22180. } );
  22181. },
  22182. after: function() {
  22183. return domManip( this, arguments, function( elem ) {
  22184. if ( this.parentNode ) {
  22185. this.parentNode.insertBefore( elem, this.nextSibling );
  22186. }
  22187. } );
  22188. },
  22189. empty: function() {
  22190. var elem,
  22191. i = 0;
  22192. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  22193. if ( elem.nodeType === 1 ) {
  22194. // Prevent memory leaks
  22195. jQuery.cleanData( getAll( elem, false ) );
  22196. // Remove any remaining nodes
  22197. elem.textContent = "";
  22198. }
  22199. }
  22200. return this;
  22201. },
  22202. clone: function( dataAndEvents, deepDataAndEvents ) {
  22203. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  22204. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  22205. return this.map( function() {
  22206. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  22207. } );
  22208. },
  22209. html: function( value ) {
  22210. return access( this, function( value ) {
  22211. var elem = this[ 0 ] || {},
  22212. i = 0,
  22213. l = this.length;
  22214. if ( value === undefined && elem.nodeType === 1 ) {
  22215. return elem.innerHTML;
  22216. }
  22217. // See if we can take a shortcut and just use innerHTML
  22218. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  22219. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  22220. value = jQuery.htmlPrefilter( value );
  22221. try {
  22222. for ( ; i < l; i++ ) {
  22223. elem = this[ i ] || {};
  22224. // Remove element nodes and prevent memory leaks
  22225. if ( elem.nodeType === 1 ) {
  22226. jQuery.cleanData( getAll( elem, false ) );
  22227. elem.innerHTML = value;
  22228. }
  22229. }
  22230. elem = 0;
  22231. // If using innerHTML throws an exception, use the fallback method
  22232. } catch ( e ) {}
  22233. }
  22234. if ( elem ) {
  22235. this.empty().append( value );
  22236. }
  22237. }, null, value, arguments.length );
  22238. },
  22239. replaceWith: function() {
  22240. var ignored = [];
  22241. // Make the changes, replacing each non-ignored context element with the new content
  22242. return domManip( this, arguments, function( elem ) {
  22243. var parent = this.parentNode;
  22244. if ( jQuery.inArray( this, ignored ) < 0 ) {
  22245. jQuery.cleanData( getAll( this ) );
  22246. if ( parent ) {
  22247. parent.replaceChild( elem, this );
  22248. }
  22249. }
  22250. // Force callback invocation
  22251. }, ignored );
  22252. }
  22253. } );
  22254. jQuery.each( {
  22255. appendTo: "append",
  22256. prependTo: "prepend",
  22257. insertBefore: "before",
  22258. insertAfter: "after",
  22259. replaceAll: "replaceWith"
  22260. }, function( name, original ) {
  22261. jQuery.fn[ name ] = function( selector ) {
  22262. var elems,
  22263. ret = [],
  22264. insert = jQuery( selector ),
  22265. last = insert.length - 1,
  22266. i = 0;
  22267. for ( ; i <= last; i++ ) {
  22268. elems = i === last ? this : this.clone( true );
  22269. jQuery( insert[ i ] )[ original ]( elems );
  22270. // Support: Android <=4.0 only, PhantomJS 1 only
  22271. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  22272. push.apply( ret, elems.get() );
  22273. }
  22274. return this.pushStack( ret );
  22275. };
  22276. } );
  22277. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  22278. var getStyles = function( elem ) {
  22279. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  22280. // IE throws on elements created in popups
  22281. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  22282. var view = elem.ownerDocument.defaultView;
  22283. if ( !view || !view.opener ) {
  22284. view = window;
  22285. }
  22286. return view.getComputedStyle( elem );
  22287. };
  22288. var swap = function( elem, options, callback ) {
  22289. var ret, name,
  22290. old = {};
  22291. // Remember the old values, and insert the new ones
  22292. for ( name in options ) {
  22293. old[ name ] = elem.style[ name ];
  22294. elem.style[ name ] = options[ name ];
  22295. }
  22296. ret = callback.call( elem );
  22297. // Revert the old values
  22298. for ( name in options ) {
  22299. elem.style[ name ] = old[ name ];
  22300. }
  22301. return ret;
  22302. };
  22303. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  22304. ( function() {
  22305. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  22306. // so they're executed at the same time to save the second computation.
  22307. function computeStyleTests() {
  22308. // This is a singleton, we need to execute it only once
  22309. if ( !div ) {
  22310. return;
  22311. }
  22312. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  22313. "margin-top:1px;padding:0;border:0";
  22314. div.style.cssText =
  22315. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  22316. "margin:auto;border:1px;padding:1px;" +
  22317. "width:60%;top:1%";
  22318. documentElement.appendChild( container ).appendChild( div );
  22319. var divStyle = window.getComputedStyle( div );
  22320. pixelPositionVal = divStyle.top !== "1%";
  22321. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  22322. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  22323. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  22324. // Some styles come back with percentage values, even though they shouldn't
  22325. div.style.right = "60%";
  22326. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  22327. // Support: IE 9 - 11 only
  22328. // Detect misreporting of content dimensions for box-sizing:border-box elements
  22329. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  22330. // Support: IE 9 only
  22331. // Detect overflow:scroll screwiness (gh-3699)
  22332. // Support: Chrome <=64
  22333. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  22334. div.style.position = "absolute";
  22335. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  22336. documentElement.removeChild( container );
  22337. // Nullify the div so it wouldn't be stored in the memory and
  22338. // it will also be a sign that checks already performed
  22339. div = null;
  22340. }
  22341. function roundPixelMeasures( measure ) {
  22342. return Math.round( parseFloat( measure ) );
  22343. }
  22344. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  22345. reliableTrDimensionsVal, reliableMarginLeftVal,
  22346. container = document.createElement( "div" ),
  22347. div = document.createElement( "div" );
  22348. // Finish early in limited (non-browser) environments
  22349. if ( !div.style ) {
  22350. return;
  22351. }
  22352. // Support: IE <=9 - 11 only
  22353. // Style of cloned element affects source element cloned (#8908)
  22354. div.style.backgroundClip = "content-box";
  22355. div.cloneNode( true ).style.backgroundClip = "";
  22356. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  22357. jQuery.extend( support, {
  22358. boxSizingReliable: function() {
  22359. computeStyleTests();
  22360. return boxSizingReliableVal;
  22361. },
  22362. pixelBoxStyles: function() {
  22363. computeStyleTests();
  22364. return pixelBoxStylesVal;
  22365. },
  22366. pixelPosition: function() {
  22367. computeStyleTests();
  22368. return pixelPositionVal;
  22369. },
  22370. reliableMarginLeft: function() {
  22371. computeStyleTests();
  22372. return reliableMarginLeftVal;
  22373. },
  22374. scrollboxSize: function() {
  22375. computeStyleTests();
  22376. return scrollboxSizeVal;
  22377. },
  22378. // Support: IE 9 - 11+, Edge 15 - 18+
  22379. // IE/Edge misreport `getComputedStyle` of table rows with width/height
  22380. // set in CSS while `offset*` properties report correct values.
  22381. // Behavior in IE 9 is more subtle than in newer versions & it passes
  22382. // some versions of this test; make sure not to make it pass there!
  22383. //
  22384. // Support: Firefox 70+
  22385. // Only Firefox includes border widths
  22386. // in computed dimensions. (gh-4529)
  22387. reliableTrDimensions: function() {
  22388. var table, tr, trChild, trStyle;
  22389. if ( reliableTrDimensionsVal == null ) {
  22390. table = document.createElement( "table" );
  22391. tr = document.createElement( "tr" );
  22392. trChild = document.createElement( "div" );
  22393. table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
  22394. tr.style.cssText = "border:1px solid";
  22395. // Support: Chrome 86+
  22396. // Height set through cssText does not get applied.
  22397. // Computed height then comes back as 0.
  22398. tr.style.height = "1px";
  22399. trChild.style.height = "9px";
  22400. // Support: Android 8 Chrome 86+
  22401. // In our bodyBackground.html iframe,
  22402. // display for all div elements is set to "inline",
  22403. // which causes a problem only in Android 8 Chrome 86.
  22404. // Ensuring the div is display: block
  22405. // gets around this issue.
  22406. trChild.style.display = "block";
  22407. documentElement
  22408. .appendChild( table )
  22409. .appendChild( tr )
  22410. .appendChild( trChild );
  22411. trStyle = window.getComputedStyle( tr );
  22412. reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) +
  22413. parseInt( trStyle.borderTopWidth, 10 ) +
  22414. parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight;
  22415. documentElement.removeChild( table );
  22416. }
  22417. return reliableTrDimensionsVal;
  22418. }
  22419. } );
  22420. } )();
  22421. function curCSS( elem, name, computed ) {
  22422. var width, minWidth, maxWidth, ret,
  22423. // Support: Firefox 51+
  22424. // Retrieving style before computed somehow
  22425. // fixes an issue with getting wrong values
  22426. // on detached elements
  22427. style = elem.style;
  22428. computed = computed || getStyles( elem );
  22429. // getPropertyValue is needed for:
  22430. // .css('filter') (IE 9 only, #12537)
  22431. // .css('--customProperty) (#3144)
  22432. if ( computed ) {
  22433. ret = computed.getPropertyValue( name ) || computed[ name ];
  22434. if ( ret === "" && !isAttached( elem ) ) {
  22435. ret = jQuery.style( elem, name );
  22436. }
  22437. // A tribute to the "awesome hack by Dean Edwards"
  22438. // Android Browser returns percentage for some values,
  22439. // but width seems to be reliably pixels.
  22440. // This is against the CSSOM draft spec:
  22441. // https://drafts.csswg.org/cssom/#resolved-values
  22442. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  22443. // Remember the original values
  22444. width = style.width;
  22445. minWidth = style.minWidth;
  22446. maxWidth = style.maxWidth;
  22447. // Put in the new values to get a computed value out
  22448. style.minWidth = style.maxWidth = style.width = ret;
  22449. ret = computed.width;
  22450. // Revert the changed values
  22451. style.width = width;
  22452. style.minWidth = minWidth;
  22453. style.maxWidth = maxWidth;
  22454. }
  22455. }
  22456. return ret !== undefined ?
  22457. // Support: IE <=9 - 11 only
  22458. // IE returns zIndex value as an integer.
  22459. ret + "" :
  22460. ret;
  22461. }
  22462. function addGetHookIf( conditionFn, hookFn ) {
  22463. // Define the hook, we'll check on the first run if it's really needed.
  22464. return {
  22465. get: function() {
  22466. if ( conditionFn() ) {
  22467. // Hook not needed (or it's not possible to use it due
  22468. // to missing dependency), remove it.
  22469. delete this.get;
  22470. return;
  22471. }
  22472. // Hook needed; redefine it so that the support test is not executed again.
  22473. return ( this.get = hookFn ).apply( this, arguments );
  22474. }
  22475. };
  22476. }
  22477. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  22478. emptyStyle = document.createElement( "div" ).style,
  22479. vendorProps = {};
  22480. // Return a vendor-prefixed property or undefined
  22481. function vendorPropName( name ) {
  22482. // Check for vendor prefixed names
  22483. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  22484. i = cssPrefixes.length;
  22485. while ( i-- ) {
  22486. name = cssPrefixes[ i ] + capName;
  22487. if ( name in emptyStyle ) {
  22488. return name;
  22489. }
  22490. }
  22491. }
  22492. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  22493. function finalPropName( name ) {
  22494. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  22495. if ( final ) {
  22496. return final;
  22497. }
  22498. if ( name in emptyStyle ) {
  22499. return name;
  22500. }
  22501. return vendorProps[ name ] = vendorPropName( name ) || name;
  22502. }
  22503. var
  22504. // Swappable if display is none or starts with table
  22505. // except "table", "table-cell", or "table-caption"
  22506. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  22507. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  22508. rcustomProp = /^--/,
  22509. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  22510. cssNormalTransform = {
  22511. letterSpacing: "0",
  22512. fontWeight: "400"
  22513. };
  22514. function setPositiveNumber( _elem, value, subtract ) {
  22515. // Any relative (+/-) values have already been
  22516. // normalized at this point
  22517. var matches = rcssNum.exec( value );
  22518. return matches ?
  22519. // Guard against undefined "subtract", e.g., when used as in cssHooks
  22520. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  22521. value;
  22522. }
  22523. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  22524. var i = dimension === "width" ? 1 : 0,
  22525. extra = 0,
  22526. delta = 0;
  22527. // Adjustment may not be necessary
  22528. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  22529. return 0;
  22530. }
  22531. for ( ; i < 4; i += 2 ) {
  22532. // Both box models exclude margin
  22533. if ( box === "margin" ) {
  22534. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  22535. }
  22536. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  22537. if ( !isBorderBox ) {
  22538. // Add padding
  22539. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  22540. // For "border" or "margin", add border
  22541. if ( box !== "padding" ) {
  22542. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  22543. // But still keep track of it otherwise
  22544. } else {
  22545. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  22546. }
  22547. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  22548. // "padding" or "margin"
  22549. } else {
  22550. // For "content", subtract padding
  22551. if ( box === "content" ) {
  22552. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  22553. }
  22554. // For "content" or "padding", subtract border
  22555. if ( box !== "margin" ) {
  22556. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  22557. }
  22558. }
  22559. }
  22560. // Account for positive content-box scroll gutter when requested by providing computedVal
  22561. if ( !isBorderBox && computedVal >= 0 ) {
  22562. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  22563. // Assuming integer scroll gutter, subtract the rest and round down
  22564. delta += Math.max( 0, Math.ceil(
  22565. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  22566. computedVal -
  22567. delta -
  22568. extra -
  22569. 0.5
  22570. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  22571. // Use an explicit zero to avoid NaN (gh-3964)
  22572. ) ) || 0;
  22573. }
  22574. return delta;
  22575. }
  22576. function getWidthOrHeight( elem, dimension, extra ) {
  22577. // Start with computed style
  22578. var styles = getStyles( elem ),
  22579. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  22580. // Fake content-box until we know it's needed to know the true value.
  22581. boxSizingNeeded = !support.boxSizingReliable() || extra,
  22582. isBorderBox = boxSizingNeeded &&
  22583. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  22584. valueIsBorderBox = isBorderBox,
  22585. val = curCSS( elem, dimension, styles ),
  22586. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  22587. // Support: Firefox <=54
  22588. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  22589. if ( rnumnonpx.test( val ) ) {
  22590. if ( !extra ) {
  22591. return val;
  22592. }
  22593. val = "auto";
  22594. }
  22595. // Support: IE 9 - 11 only
  22596. // Use offsetWidth/offsetHeight for when box sizing is unreliable.
  22597. // In those cases, the computed value can be trusted to be border-box.
  22598. if ( ( !support.boxSizingReliable() && isBorderBox ||
  22599. // Support: IE 10 - 11+, Edge 15 - 18+
  22600. // IE/Edge misreport `getComputedStyle` of table rows with width/height
  22601. // set in CSS while `offset*` properties report correct values.
  22602. // Interestingly, in some cases IE 9 doesn't suffer from this issue.
  22603. !support.reliableTrDimensions() && nodeName( elem, "tr" ) ||
  22604. // Fall back to offsetWidth/offsetHeight when value is "auto"
  22605. // This happens for inline elements with no explicit setting (gh-3571)
  22606. val === "auto" ||
  22607. // Support: Android <=4.1 - 4.3 only
  22608. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  22609. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  22610. // Make sure the element is visible & connected
  22611. elem.getClientRects().length ) {
  22612. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  22613. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  22614. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  22615. // retrieved value as a content box dimension.
  22616. valueIsBorderBox = offsetProp in elem;
  22617. if ( valueIsBorderBox ) {
  22618. val = elem[ offsetProp ];
  22619. }
  22620. }
  22621. // Normalize "" and auto
  22622. val = parseFloat( val ) || 0;
  22623. // Adjust for the element's box model
  22624. return ( val +
  22625. boxModelAdjustment(
  22626. elem,
  22627. dimension,
  22628. extra || ( isBorderBox ? "border" : "content" ),
  22629. valueIsBorderBox,
  22630. styles,
  22631. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  22632. val
  22633. )
  22634. ) + "px";
  22635. }
  22636. jQuery.extend( {
  22637. // Add in style property hooks for overriding the default
  22638. // behavior of getting and setting a style property
  22639. cssHooks: {
  22640. opacity: {
  22641. get: function( elem, computed ) {
  22642. if ( computed ) {
  22643. // We should always get a number back from opacity
  22644. var ret = curCSS( elem, "opacity" );
  22645. return ret === "" ? "1" : ret;
  22646. }
  22647. }
  22648. }
  22649. },
  22650. // Don't automatically add "px" to these possibly-unitless properties
  22651. cssNumber: {
  22652. "animationIterationCount": true,
  22653. "columnCount": true,
  22654. "fillOpacity": true,
  22655. "flexGrow": true,
  22656. "flexShrink": true,
  22657. "fontWeight": true,
  22658. "gridArea": true,
  22659. "gridColumn": true,
  22660. "gridColumnEnd": true,
  22661. "gridColumnStart": true,
  22662. "gridRow": true,
  22663. "gridRowEnd": true,
  22664. "gridRowStart": true,
  22665. "lineHeight": true,
  22666. "opacity": true,
  22667. "order": true,
  22668. "orphans": true,
  22669. "widows": true,
  22670. "zIndex": true,
  22671. "zoom": true
  22672. },
  22673. // Add in properties whose names you wish to fix before
  22674. // setting or getting the value
  22675. cssProps: {},
  22676. // Get and set the style property on a DOM Node
  22677. style: function( elem, name, value, extra ) {
  22678. // Don't set styles on text and comment nodes
  22679. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  22680. return;
  22681. }
  22682. // Make sure that we're working with the right name
  22683. var ret, type, hooks,
  22684. origName = camelCase( name ),
  22685. isCustomProp = rcustomProp.test( name ),
  22686. style = elem.style;
  22687. // Make sure that we're working with the right name. We don't
  22688. // want to query the value if it is a CSS custom property
  22689. // since they are user-defined.
  22690. if ( !isCustomProp ) {
  22691. name = finalPropName( origName );
  22692. }
  22693. // Gets hook for the prefixed version, then unprefixed version
  22694. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  22695. // Check if we're setting a value
  22696. if ( value !== undefined ) {
  22697. type = typeof value;
  22698. // Convert "+=" or "-=" to relative numbers (#7345)
  22699. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  22700. value = adjustCSS( elem, name, ret );
  22701. // Fixes bug #9237
  22702. type = "number";
  22703. }
  22704. // Make sure that null and NaN values aren't set (#7116)
  22705. if ( value == null || value !== value ) {
  22706. return;
  22707. }
  22708. // If a number was passed in, add the unit (except for certain CSS properties)
  22709. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  22710. // "px" to a few hardcoded values.
  22711. if ( type === "number" && !isCustomProp ) {
  22712. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  22713. }
  22714. // background-* props affect original clone's values
  22715. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  22716. style[ name ] = "inherit";
  22717. }
  22718. // If a hook was provided, use that value, otherwise just set the specified value
  22719. if ( !hooks || !( "set" in hooks ) ||
  22720. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  22721. if ( isCustomProp ) {
  22722. style.setProperty( name, value );
  22723. } else {
  22724. style[ name ] = value;
  22725. }
  22726. }
  22727. } else {
  22728. // If a hook was provided get the non-computed value from there
  22729. if ( hooks && "get" in hooks &&
  22730. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  22731. return ret;
  22732. }
  22733. // Otherwise just get the value from the style object
  22734. return style[ name ];
  22735. }
  22736. },
  22737. css: function( elem, name, extra, styles ) {
  22738. var val, num, hooks,
  22739. origName = camelCase( name ),
  22740. isCustomProp = rcustomProp.test( name );
  22741. // Make sure that we're working with the right name. We don't
  22742. // want to modify the value if it is a CSS custom property
  22743. // since they are user-defined.
  22744. if ( !isCustomProp ) {
  22745. name = finalPropName( origName );
  22746. }
  22747. // Try prefixed name followed by the unprefixed name
  22748. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  22749. // If a hook was provided get the computed value from there
  22750. if ( hooks && "get" in hooks ) {
  22751. val = hooks.get( elem, true, extra );
  22752. }
  22753. // Otherwise, if a way to get the computed value exists, use that
  22754. if ( val === undefined ) {
  22755. val = curCSS( elem, name, styles );
  22756. }
  22757. // Convert "normal" to computed value
  22758. if ( val === "normal" && name in cssNormalTransform ) {
  22759. val = cssNormalTransform[ name ];
  22760. }
  22761. // Make numeric if forced or a qualifier was provided and val looks numeric
  22762. if ( extra === "" || extra ) {
  22763. num = parseFloat( val );
  22764. return extra === true || isFinite( num ) ? num || 0 : val;
  22765. }
  22766. return val;
  22767. }
  22768. } );
  22769. jQuery.each( [ "height", "width" ], function( _i, dimension ) {
  22770. jQuery.cssHooks[ dimension ] = {
  22771. get: function( elem, computed, extra ) {
  22772. if ( computed ) {
  22773. // Certain elements can have dimension info if we invisibly show them
  22774. // but it must have a current display style that would benefit
  22775. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  22776. // Support: Safari 8+
  22777. // Table columns in Safari have non-zero offsetWidth & zero
  22778. // getBoundingClientRect().width unless display is changed.
  22779. // Support: IE <=11 only
  22780. // Running getBoundingClientRect on a disconnected node
  22781. // in IE throws an error.
  22782. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  22783. swap( elem, cssShow, function() {
  22784. return getWidthOrHeight( elem, dimension, extra );
  22785. } ) :
  22786. getWidthOrHeight( elem, dimension, extra );
  22787. }
  22788. },
  22789. set: function( elem, value, extra ) {
  22790. var matches,
  22791. styles = getStyles( elem ),
  22792. // Only read styles.position if the test has a chance to fail
  22793. // to avoid forcing a reflow.
  22794. scrollboxSizeBuggy = !support.scrollboxSize() &&
  22795. styles.position === "absolute",
  22796. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  22797. boxSizingNeeded = scrollboxSizeBuggy || extra,
  22798. isBorderBox = boxSizingNeeded &&
  22799. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  22800. subtract = extra ?
  22801. boxModelAdjustment(
  22802. elem,
  22803. dimension,
  22804. extra,
  22805. isBorderBox,
  22806. styles
  22807. ) :
  22808. 0;
  22809. // Account for unreliable border-box dimensions by comparing offset* to computed and
  22810. // faking a content-box to get border and padding (gh-3699)
  22811. if ( isBorderBox && scrollboxSizeBuggy ) {
  22812. subtract -= Math.ceil(
  22813. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  22814. parseFloat( styles[ dimension ] ) -
  22815. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  22816. 0.5
  22817. );
  22818. }
  22819. // Convert to pixels if value adjustment is needed
  22820. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  22821. ( matches[ 3 ] || "px" ) !== "px" ) {
  22822. elem.style[ dimension ] = value;
  22823. value = jQuery.css( elem, dimension );
  22824. }
  22825. return setPositiveNumber( elem, value, subtract );
  22826. }
  22827. };
  22828. } );
  22829. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  22830. function( elem, computed ) {
  22831. if ( computed ) {
  22832. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  22833. elem.getBoundingClientRect().left -
  22834. swap( elem, { marginLeft: 0 }, function() {
  22835. return elem.getBoundingClientRect().left;
  22836. } )
  22837. ) + "px";
  22838. }
  22839. }
  22840. );
  22841. // These hooks are used by animate to expand properties
  22842. jQuery.each( {
  22843. margin: "",
  22844. padding: "",
  22845. border: "Width"
  22846. }, function( prefix, suffix ) {
  22847. jQuery.cssHooks[ prefix + suffix ] = {
  22848. expand: function( value ) {
  22849. var i = 0,
  22850. expanded = {},
  22851. // Assumes a single number if not a string
  22852. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  22853. for ( ; i < 4; i++ ) {
  22854. expanded[ prefix + cssExpand[ i ] + suffix ] =
  22855. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  22856. }
  22857. return expanded;
  22858. }
  22859. };
  22860. if ( prefix !== "margin" ) {
  22861. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  22862. }
  22863. } );
  22864. jQuery.fn.extend( {
  22865. css: function( name, value ) {
  22866. return access( this, function( elem, name, value ) {
  22867. var styles, len,
  22868. map = {},
  22869. i = 0;
  22870. if ( Array.isArray( name ) ) {
  22871. styles = getStyles( elem );
  22872. len = name.length;
  22873. for ( ; i < len; i++ ) {
  22874. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  22875. }
  22876. return map;
  22877. }
  22878. return value !== undefined ?
  22879. jQuery.style( elem, name, value ) :
  22880. jQuery.css( elem, name );
  22881. }, name, value, arguments.length > 1 );
  22882. }
  22883. } );
  22884. function Tween( elem, options, prop, end, easing ) {
  22885. return new Tween.prototype.init( elem, options, prop, end, easing );
  22886. }
  22887. jQuery.Tween = Tween;
  22888. Tween.prototype = {
  22889. constructor: Tween,
  22890. init: function( elem, options, prop, end, easing, unit ) {
  22891. this.elem = elem;
  22892. this.prop = prop;
  22893. this.easing = easing || jQuery.easing._default;
  22894. this.options = options;
  22895. this.start = this.now = this.cur();
  22896. this.end = end;
  22897. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  22898. },
  22899. cur: function() {
  22900. var hooks = Tween.propHooks[ this.prop ];
  22901. return hooks && hooks.get ?
  22902. hooks.get( this ) :
  22903. Tween.propHooks._default.get( this );
  22904. },
  22905. run: function( percent ) {
  22906. var eased,
  22907. hooks = Tween.propHooks[ this.prop ];
  22908. if ( this.options.duration ) {
  22909. this.pos = eased = jQuery.easing[ this.easing ](
  22910. percent, this.options.duration * percent, 0, 1, this.options.duration
  22911. );
  22912. } else {
  22913. this.pos = eased = percent;
  22914. }
  22915. this.now = ( this.end - this.start ) * eased + this.start;
  22916. if ( this.options.step ) {
  22917. this.options.step.call( this.elem, this.now, this );
  22918. }
  22919. if ( hooks && hooks.set ) {
  22920. hooks.set( this );
  22921. } else {
  22922. Tween.propHooks._default.set( this );
  22923. }
  22924. return this;
  22925. }
  22926. };
  22927. Tween.prototype.init.prototype = Tween.prototype;
  22928. Tween.propHooks = {
  22929. _default: {
  22930. get: function( tween ) {
  22931. var result;
  22932. // Use a property on the element directly when it is not a DOM element,
  22933. // or when there is no matching style property that exists.
  22934. if ( tween.elem.nodeType !== 1 ||
  22935. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  22936. return tween.elem[ tween.prop ];
  22937. }
  22938. // Passing an empty string as a 3rd parameter to .css will automatically
  22939. // attempt a parseFloat and fallback to a string if the parse fails.
  22940. // Simple values such as "10px" are parsed to Float;
  22941. // complex values such as "rotate(1rad)" are returned as-is.
  22942. result = jQuery.css( tween.elem, tween.prop, "" );
  22943. // Empty strings, null, undefined and "auto" are converted to 0.
  22944. return !result || result === "auto" ? 0 : result;
  22945. },
  22946. set: function( tween ) {
  22947. // Use step hook for back compat.
  22948. // Use cssHook if its there.
  22949. // Use .style if available and use plain properties where available.
  22950. if ( jQuery.fx.step[ tween.prop ] ) {
  22951. jQuery.fx.step[ tween.prop ]( tween );
  22952. } else if ( tween.elem.nodeType === 1 && (
  22953. jQuery.cssHooks[ tween.prop ] ||
  22954. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  22955. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  22956. } else {
  22957. tween.elem[ tween.prop ] = tween.now;
  22958. }
  22959. }
  22960. }
  22961. };
  22962. // Support: IE <=9 only
  22963. // Panic based approach to setting things on disconnected nodes
  22964. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  22965. set: function( tween ) {
  22966. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  22967. tween.elem[ tween.prop ] = tween.now;
  22968. }
  22969. }
  22970. };
  22971. jQuery.easing = {
  22972. linear: function( p ) {
  22973. return p;
  22974. },
  22975. swing: function( p ) {
  22976. return 0.5 - Math.cos( p * Math.PI ) / 2;
  22977. },
  22978. _default: "swing"
  22979. };
  22980. jQuery.fx = Tween.prototype.init;
  22981. // Back compat <1.8 extension point
  22982. jQuery.fx.step = {};
  22983. var
  22984. fxNow, inProgress,
  22985. rfxtypes = /^(?:toggle|show|hide)$/,
  22986. rrun = /queueHooks$/;
  22987. function schedule() {
  22988. if ( inProgress ) {
  22989. if ( document.hidden === false && window.requestAnimationFrame ) {
  22990. window.requestAnimationFrame( schedule );
  22991. } else {
  22992. window.setTimeout( schedule, jQuery.fx.interval );
  22993. }
  22994. jQuery.fx.tick();
  22995. }
  22996. }
  22997. // Animations created synchronously will run synchronously
  22998. function createFxNow() {
  22999. window.setTimeout( function() {
  23000. fxNow = undefined;
  23001. } );
  23002. return ( fxNow = Date.now() );
  23003. }
  23004. // Generate parameters to create a standard animation
  23005. function genFx( type, includeWidth ) {
  23006. var which,
  23007. i = 0,
  23008. attrs = { height: type };
  23009. // If we include width, step value is 1 to do all cssExpand values,
  23010. // otherwise step value is 2 to skip over Left and Right
  23011. includeWidth = includeWidth ? 1 : 0;
  23012. for ( ; i < 4; i += 2 - includeWidth ) {
  23013. which = cssExpand[ i ];
  23014. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  23015. }
  23016. if ( includeWidth ) {
  23017. attrs.opacity = attrs.width = type;
  23018. }
  23019. return attrs;
  23020. }
  23021. function createTween( value, prop, animation ) {
  23022. var tween,
  23023. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  23024. index = 0,
  23025. length = collection.length;
  23026. for ( ; index < length; index++ ) {
  23027. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  23028. // We're done with this property
  23029. return tween;
  23030. }
  23031. }
  23032. }
  23033. function defaultPrefilter( elem, props, opts ) {
  23034. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  23035. isBox = "width" in props || "height" in props,
  23036. anim = this,
  23037. orig = {},
  23038. style = elem.style,
  23039. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  23040. dataShow = dataPriv.get( elem, "fxshow" );
  23041. // Queue-skipping animations hijack the fx hooks
  23042. if ( !opts.queue ) {
  23043. hooks = jQuery._queueHooks( elem, "fx" );
  23044. if ( hooks.unqueued == null ) {
  23045. hooks.unqueued = 0;
  23046. oldfire = hooks.empty.fire;
  23047. hooks.empty.fire = function() {
  23048. if ( !hooks.unqueued ) {
  23049. oldfire();
  23050. }
  23051. };
  23052. }
  23053. hooks.unqueued++;
  23054. anim.always( function() {
  23055. // Ensure the complete handler is called before this completes
  23056. anim.always( function() {
  23057. hooks.unqueued--;
  23058. if ( !jQuery.queue( elem, "fx" ).length ) {
  23059. hooks.empty.fire();
  23060. }
  23061. } );
  23062. } );
  23063. }
  23064. // Detect show/hide animations
  23065. for ( prop in props ) {
  23066. value = props[ prop ];
  23067. if ( rfxtypes.test( value ) ) {
  23068. delete props[ prop ];
  23069. toggle = toggle || value === "toggle";
  23070. if ( value === ( hidden ? "hide" : "show" ) ) {
  23071. // Pretend to be hidden if this is a "show" and
  23072. // there is still data from a stopped show/hide
  23073. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  23074. hidden = true;
  23075. // Ignore all other no-op show/hide data
  23076. } else {
  23077. continue;
  23078. }
  23079. }
  23080. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  23081. }
  23082. }
  23083. // Bail out if this is a no-op like .hide().hide()
  23084. propTween = !jQuery.isEmptyObject( props );
  23085. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  23086. return;
  23087. }
  23088. // Restrict "overflow" and "display" styles during box animations
  23089. if ( isBox && elem.nodeType === 1 ) {
  23090. // Support: IE <=9 - 11, Edge 12 - 15
  23091. // Record all 3 overflow attributes because IE does not infer the shorthand
  23092. // from identically-valued overflowX and overflowY and Edge just mirrors
  23093. // the overflowX value there.
  23094. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  23095. // Identify a display type, preferring old show/hide data over the CSS cascade
  23096. restoreDisplay = dataShow && dataShow.display;
  23097. if ( restoreDisplay == null ) {
  23098. restoreDisplay = dataPriv.get( elem, "display" );
  23099. }
  23100. display = jQuery.css( elem, "display" );
  23101. if ( display === "none" ) {
  23102. if ( restoreDisplay ) {
  23103. display = restoreDisplay;
  23104. } else {
  23105. // Get nonempty value(s) by temporarily forcing visibility
  23106. showHide( [ elem ], true );
  23107. restoreDisplay = elem.style.display || restoreDisplay;
  23108. display = jQuery.css( elem, "display" );
  23109. showHide( [ elem ] );
  23110. }
  23111. }
  23112. // Animate inline elements as inline-block
  23113. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  23114. if ( jQuery.css( elem, "float" ) === "none" ) {
  23115. // Restore the original display value at the end of pure show/hide animations
  23116. if ( !propTween ) {
  23117. anim.done( function() {
  23118. style.display = restoreDisplay;
  23119. } );
  23120. if ( restoreDisplay == null ) {
  23121. display = style.display;
  23122. restoreDisplay = display === "none" ? "" : display;
  23123. }
  23124. }
  23125. style.display = "inline-block";
  23126. }
  23127. }
  23128. }
  23129. if ( opts.overflow ) {
  23130. style.overflow = "hidden";
  23131. anim.always( function() {
  23132. style.overflow = opts.overflow[ 0 ];
  23133. style.overflowX = opts.overflow[ 1 ];
  23134. style.overflowY = opts.overflow[ 2 ];
  23135. } );
  23136. }
  23137. // Implement show/hide animations
  23138. propTween = false;
  23139. for ( prop in orig ) {
  23140. // General show/hide setup for this element animation
  23141. if ( !propTween ) {
  23142. if ( dataShow ) {
  23143. if ( "hidden" in dataShow ) {
  23144. hidden = dataShow.hidden;
  23145. }
  23146. } else {
  23147. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  23148. }
  23149. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  23150. if ( toggle ) {
  23151. dataShow.hidden = !hidden;
  23152. }
  23153. // Show elements before animating them
  23154. if ( hidden ) {
  23155. showHide( [ elem ], true );
  23156. }
  23157. /* eslint-disable no-loop-func */
  23158. anim.done( function() {
  23159. /* eslint-enable no-loop-func */
  23160. // The final step of a "hide" animation is actually hiding the element
  23161. if ( !hidden ) {
  23162. showHide( [ elem ] );
  23163. }
  23164. dataPriv.remove( elem, "fxshow" );
  23165. for ( prop in orig ) {
  23166. jQuery.style( elem, prop, orig[ prop ] );
  23167. }
  23168. } );
  23169. }
  23170. // Per-property setup
  23171. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  23172. if ( !( prop in dataShow ) ) {
  23173. dataShow[ prop ] = propTween.start;
  23174. if ( hidden ) {
  23175. propTween.end = propTween.start;
  23176. propTween.start = 0;
  23177. }
  23178. }
  23179. }
  23180. }
  23181. function propFilter( props, specialEasing ) {
  23182. var index, name, easing, value, hooks;
  23183. // camelCase, specialEasing and expand cssHook pass
  23184. for ( index in props ) {
  23185. name = camelCase( index );
  23186. easing = specialEasing[ name ];
  23187. value = props[ index ];
  23188. if ( Array.isArray( value ) ) {
  23189. easing = value[ 1 ];
  23190. value = props[ index ] = value[ 0 ];
  23191. }
  23192. if ( index !== name ) {
  23193. props[ name ] = value;
  23194. delete props[ index ];
  23195. }
  23196. hooks = jQuery.cssHooks[ name ];
  23197. if ( hooks && "expand" in hooks ) {
  23198. value = hooks.expand( value );
  23199. delete props[ name ];
  23200. // Not quite $.extend, this won't overwrite existing keys.
  23201. // Reusing 'index' because we have the correct "name"
  23202. for ( index in value ) {
  23203. if ( !( index in props ) ) {
  23204. props[ index ] = value[ index ];
  23205. specialEasing[ index ] = easing;
  23206. }
  23207. }
  23208. } else {
  23209. specialEasing[ name ] = easing;
  23210. }
  23211. }
  23212. }
  23213. function Animation( elem, properties, options ) {
  23214. var result,
  23215. stopped,
  23216. index = 0,
  23217. length = Animation.prefilters.length,
  23218. deferred = jQuery.Deferred().always( function() {
  23219. // Don't match elem in the :animated selector
  23220. delete tick.elem;
  23221. } ),
  23222. tick = function() {
  23223. if ( stopped ) {
  23224. return false;
  23225. }
  23226. var currentTime = fxNow || createFxNow(),
  23227. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  23228. // Support: Android 2.3 only
  23229. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  23230. temp = remaining / animation.duration || 0,
  23231. percent = 1 - temp,
  23232. index = 0,
  23233. length = animation.tweens.length;
  23234. for ( ; index < length; index++ ) {
  23235. animation.tweens[ index ].run( percent );
  23236. }
  23237. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  23238. // If there's more to do, yield
  23239. if ( percent < 1 && length ) {
  23240. return remaining;
  23241. }
  23242. // If this was an empty animation, synthesize a final progress notification
  23243. if ( !length ) {
  23244. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  23245. }
  23246. // Resolve the animation and report its conclusion
  23247. deferred.resolveWith( elem, [ animation ] );
  23248. return false;
  23249. },
  23250. animation = deferred.promise( {
  23251. elem: elem,
  23252. props: jQuery.extend( {}, properties ),
  23253. opts: jQuery.extend( true, {
  23254. specialEasing: {},
  23255. easing: jQuery.easing._default
  23256. }, options ),
  23257. originalProperties: properties,
  23258. originalOptions: options,
  23259. startTime: fxNow || createFxNow(),
  23260. duration: options.duration,
  23261. tweens: [],
  23262. createTween: function( prop, end ) {
  23263. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  23264. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  23265. animation.tweens.push( tween );
  23266. return tween;
  23267. },
  23268. stop: function( gotoEnd ) {
  23269. var index = 0,
  23270. // If we are going to the end, we want to run all the tweens
  23271. // otherwise we skip this part
  23272. length = gotoEnd ? animation.tweens.length : 0;
  23273. if ( stopped ) {
  23274. return this;
  23275. }
  23276. stopped = true;
  23277. for ( ; index < length; index++ ) {
  23278. animation.tweens[ index ].run( 1 );
  23279. }
  23280. // Resolve when we played the last frame; otherwise, reject
  23281. if ( gotoEnd ) {
  23282. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  23283. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  23284. } else {
  23285. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  23286. }
  23287. return this;
  23288. }
  23289. } ),
  23290. props = animation.props;
  23291. propFilter( props, animation.opts.specialEasing );
  23292. for ( ; index < length; index++ ) {
  23293. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  23294. if ( result ) {
  23295. if ( isFunction( result.stop ) ) {
  23296. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  23297. result.stop.bind( result );
  23298. }
  23299. return result;
  23300. }
  23301. }
  23302. jQuery.map( props, createTween, animation );
  23303. if ( isFunction( animation.opts.start ) ) {
  23304. animation.opts.start.call( elem, animation );
  23305. }
  23306. // Attach callbacks from options
  23307. animation
  23308. .progress( animation.opts.progress )
  23309. .done( animation.opts.done, animation.opts.complete )
  23310. .fail( animation.opts.fail )
  23311. .always( animation.opts.always );
  23312. jQuery.fx.timer(
  23313. jQuery.extend( tick, {
  23314. elem: elem,
  23315. anim: animation,
  23316. queue: animation.opts.queue
  23317. } )
  23318. );
  23319. return animation;
  23320. }
  23321. jQuery.Animation = jQuery.extend( Animation, {
  23322. tweeners: {
  23323. "*": [ function( prop, value ) {
  23324. var tween = this.createTween( prop, value );
  23325. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  23326. return tween;
  23327. } ]
  23328. },
  23329. tweener: function( props, callback ) {
  23330. if ( isFunction( props ) ) {
  23331. callback = props;
  23332. props = [ "*" ];
  23333. } else {
  23334. props = props.match( rnothtmlwhite );
  23335. }
  23336. var prop,
  23337. index = 0,
  23338. length = props.length;
  23339. for ( ; index < length; index++ ) {
  23340. prop = props[ index ];
  23341. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  23342. Animation.tweeners[ prop ].unshift( callback );
  23343. }
  23344. },
  23345. prefilters: [ defaultPrefilter ],
  23346. prefilter: function( callback, prepend ) {
  23347. if ( prepend ) {
  23348. Animation.prefilters.unshift( callback );
  23349. } else {
  23350. Animation.prefilters.push( callback );
  23351. }
  23352. }
  23353. } );
  23354. jQuery.speed = function( speed, easing, fn ) {
  23355. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  23356. complete: fn || !fn && easing ||
  23357. isFunction( speed ) && speed,
  23358. duration: speed,
  23359. easing: fn && easing || easing && !isFunction( easing ) && easing
  23360. };
  23361. // Go to the end state if fx are off
  23362. if ( jQuery.fx.off ) {
  23363. opt.duration = 0;
  23364. } else {
  23365. if ( typeof opt.duration !== "number" ) {
  23366. if ( opt.duration in jQuery.fx.speeds ) {
  23367. opt.duration = jQuery.fx.speeds[ opt.duration ];
  23368. } else {
  23369. opt.duration = jQuery.fx.speeds._default;
  23370. }
  23371. }
  23372. }
  23373. // Normalize opt.queue - true/undefined/null -> "fx"
  23374. if ( opt.queue == null || opt.queue === true ) {
  23375. opt.queue = "fx";
  23376. }
  23377. // Queueing
  23378. opt.old = opt.complete;
  23379. opt.complete = function() {
  23380. if ( isFunction( opt.old ) ) {
  23381. opt.old.call( this );
  23382. }
  23383. if ( opt.queue ) {
  23384. jQuery.dequeue( this, opt.queue );
  23385. }
  23386. };
  23387. return opt;
  23388. };
  23389. jQuery.fn.extend( {
  23390. fadeTo: function( speed, to, easing, callback ) {
  23391. // Show any hidden elements after setting opacity to 0
  23392. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  23393. // Animate to the value specified
  23394. .end().animate( { opacity: to }, speed, easing, callback );
  23395. },
  23396. animate: function( prop, speed, easing, callback ) {
  23397. var empty = jQuery.isEmptyObject( prop ),
  23398. optall = jQuery.speed( speed, easing, callback ),
  23399. doAnimation = function() {
  23400. // Operate on a copy of prop so per-property easing won't be lost
  23401. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  23402. // Empty animations, or finishing resolves immediately
  23403. if ( empty || dataPriv.get( this, "finish" ) ) {
  23404. anim.stop( true );
  23405. }
  23406. };
  23407. doAnimation.finish = doAnimation;
  23408. return empty || optall.queue === false ?
  23409. this.each( doAnimation ) :
  23410. this.queue( optall.queue, doAnimation );
  23411. },
  23412. stop: function( type, clearQueue, gotoEnd ) {
  23413. var stopQueue = function( hooks ) {
  23414. var stop = hooks.stop;
  23415. delete hooks.stop;
  23416. stop( gotoEnd );
  23417. };
  23418. if ( typeof type !== "string" ) {
  23419. gotoEnd = clearQueue;
  23420. clearQueue = type;
  23421. type = undefined;
  23422. }
  23423. if ( clearQueue ) {
  23424. this.queue( type || "fx", [] );
  23425. }
  23426. return this.each( function() {
  23427. var dequeue = true,
  23428. index = type != null && type + "queueHooks",
  23429. timers = jQuery.timers,
  23430. data = dataPriv.get( this );
  23431. if ( index ) {
  23432. if ( data[ index ] && data[ index ].stop ) {
  23433. stopQueue( data[ index ] );
  23434. }
  23435. } else {
  23436. for ( index in data ) {
  23437. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  23438. stopQueue( data[ index ] );
  23439. }
  23440. }
  23441. }
  23442. for ( index = timers.length; index--; ) {
  23443. if ( timers[ index ].elem === this &&
  23444. ( type == null || timers[ index ].queue === type ) ) {
  23445. timers[ index ].anim.stop( gotoEnd );
  23446. dequeue = false;
  23447. timers.splice( index, 1 );
  23448. }
  23449. }
  23450. // Start the next in the queue if the last step wasn't forced.
  23451. // Timers currently will call their complete callbacks, which
  23452. // will dequeue but only if they were gotoEnd.
  23453. if ( dequeue || !gotoEnd ) {
  23454. jQuery.dequeue( this, type );
  23455. }
  23456. } );
  23457. },
  23458. finish: function( type ) {
  23459. if ( type !== false ) {
  23460. type = type || "fx";
  23461. }
  23462. return this.each( function() {
  23463. var index,
  23464. data = dataPriv.get( this ),
  23465. queue = data[ type + "queue" ],
  23466. hooks = data[ type + "queueHooks" ],
  23467. timers = jQuery.timers,
  23468. length = queue ? queue.length : 0;
  23469. // Enable finishing flag on private data
  23470. data.finish = true;
  23471. // Empty the queue first
  23472. jQuery.queue( this, type, [] );
  23473. if ( hooks && hooks.stop ) {
  23474. hooks.stop.call( this, true );
  23475. }
  23476. // Look for any active animations, and finish them
  23477. for ( index = timers.length; index--; ) {
  23478. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  23479. timers[ index ].anim.stop( true );
  23480. timers.splice( index, 1 );
  23481. }
  23482. }
  23483. // Look for any animations in the old queue and finish them
  23484. for ( index = 0; index < length; index++ ) {
  23485. if ( queue[ index ] && queue[ index ].finish ) {
  23486. queue[ index ].finish.call( this );
  23487. }
  23488. }
  23489. // Turn off finishing flag
  23490. delete data.finish;
  23491. } );
  23492. }
  23493. } );
  23494. jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) {
  23495. var cssFn = jQuery.fn[ name ];
  23496. jQuery.fn[ name ] = function( speed, easing, callback ) {
  23497. return speed == null || typeof speed === "boolean" ?
  23498. cssFn.apply( this, arguments ) :
  23499. this.animate( genFx( name, true ), speed, easing, callback );
  23500. };
  23501. } );
  23502. // Generate shortcuts for custom animations
  23503. jQuery.each( {
  23504. slideDown: genFx( "show" ),
  23505. slideUp: genFx( "hide" ),
  23506. slideToggle: genFx( "toggle" ),
  23507. fadeIn: { opacity: "show" },
  23508. fadeOut: { opacity: "hide" },
  23509. fadeToggle: { opacity: "toggle" }
  23510. }, function( name, props ) {
  23511. jQuery.fn[ name ] = function( speed, easing, callback ) {
  23512. return this.animate( props, speed, easing, callback );
  23513. };
  23514. } );
  23515. jQuery.timers = [];
  23516. jQuery.fx.tick = function() {
  23517. var timer,
  23518. i = 0,
  23519. timers = jQuery.timers;
  23520. fxNow = Date.now();
  23521. for ( ; i < timers.length; i++ ) {
  23522. timer = timers[ i ];
  23523. // Run the timer and safely remove it when done (allowing for external removal)
  23524. if ( !timer() && timers[ i ] === timer ) {
  23525. timers.splice( i--, 1 );
  23526. }
  23527. }
  23528. if ( !timers.length ) {
  23529. jQuery.fx.stop();
  23530. }
  23531. fxNow = undefined;
  23532. };
  23533. jQuery.fx.timer = function( timer ) {
  23534. jQuery.timers.push( timer );
  23535. jQuery.fx.start();
  23536. };
  23537. jQuery.fx.interval = 13;
  23538. jQuery.fx.start = function() {
  23539. if ( inProgress ) {
  23540. return;
  23541. }
  23542. inProgress = true;
  23543. schedule();
  23544. };
  23545. jQuery.fx.stop = function() {
  23546. inProgress = null;
  23547. };
  23548. jQuery.fx.speeds = {
  23549. slow: 600,
  23550. fast: 200,
  23551. // Default speed
  23552. _default: 400
  23553. };
  23554. // Based off of the plugin by Clint Helfers, with permission.
  23555. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  23556. jQuery.fn.delay = function( time, type ) {
  23557. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  23558. type = type || "fx";
  23559. return this.queue( type, function( next, hooks ) {
  23560. var timeout = window.setTimeout( next, time );
  23561. hooks.stop = function() {
  23562. window.clearTimeout( timeout );
  23563. };
  23564. } );
  23565. };
  23566. ( function() {
  23567. var input = document.createElement( "input" ),
  23568. select = document.createElement( "select" ),
  23569. opt = select.appendChild( document.createElement( "option" ) );
  23570. input.type = "checkbox";
  23571. // Support: Android <=4.3 only
  23572. // Default value for a checkbox should be "on"
  23573. support.checkOn = input.value !== "";
  23574. // Support: IE <=11 only
  23575. // Must access selectedIndex to make default options select
  23576. support.optSelected = opt.selected;
  23577. // Support: IE <=11 only
  23578. // An input loses its value after becoming a radio
  23579. input = document.createElement( "input" );
  23580. input.value = "t";
  23581. input.type = "radio";
  23582. support.radioValue = input.value === "t";
  23583. } )();
  23584. var boolHook,
  23585. attrHandle = jQuery.expr.attrHandle;
  23586. jQuery.fn.extend( {
  23587. attr: function( name, value ) {
  23588. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  23589. },
  23590. removeAttr: function( name ) {
  23591. return this.each( function() {
  23592. jQuery.removeAttr( this, name );
  23593. } );
  23594. }
  23595. } );
  23596. jQuery.extend( {
  23597. attr: function( elem, name, value ) {
  23598. var ret, hooks,
  23599. nType = elem.nodeType;
  23600. // Don't get/set attributes on text, comment and attribute nodes
  23601. if ( nType === 3 || nType === 8 || nType === 2 ) {
  23602. return;
  23603. }
  23604. // Fallback to prop when attributes are not supported
  23605. if ( typeof elem.getAttribute === "undefined" ) {
  23606. return jQuery.prop( elem, name, value );
  23607. }
  23608. // Attribute hooks are determined by the lowercase version
  23609. // Grab necessary hook if one is defined
  23610. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  23611. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  23612. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  23613. }
  23614. if ( value !== undefined ) {
  23615. if ( value === null ) {
  23616. jQuery.removeAttr( elem, name );
  23617. return;
  23618. }
  23619. if ( hooks && "set" in hooks &&
  23620. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  23621. return ret;
  23622. }
  23623. elem.setAttribute( name, value + "" );
  23624. return value;
  23625. }
  23626. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  23627. return ret;
  23628. }
  23629. ret = jQuery.find.attr( elem, name );
  23630. // Non-existent attributes return null, we normalize to undefined
  23631. return ret == null ? undefined : ret;
  23632. },
  23633. attrHooks: {
  23634. type: {
  23635. set: function( elem, value ) {
  23636. if ( !support.radioValue && value === "radio" &&
  23637. nodeName( elem, "input" ) ) {
  23638. var val = elem.value;
  23639. elem.setAttribute( "type", value );
  23640. if ( val ) {
  23641. elem.value = val;
  23642. }
  23643. return value;
  23644. }
  23645. }
  23646. }
  23647. },
  23648. removeAttr: function( elem, value ) {
  23649. var name,
  23650. i = 0,
  23651. // Attribute names can contain non-HTML whitespace characters
  23652. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  23653. attrNames = value && value.match( rnothtmlwhite );
  23654. if ( attrNames && elem.nodeType === 1 ) {
  23655. while ( ( name = attrNames[ i++ ] ) ) {
  23656. elem.removeAttribute( name );
  23657. }
  23658. }
  23659. }
  23660. } );
  23661. // Hooks for boolean attributes
  23662. boolHook = {
  23663. set: function( elem, value, name ) {
  23664. if ( value === false ) {
  23665. // Remove boolean attributes when set to false
  23666. jQuery.removeAttr( elem, name );
  23667. } else {
  23668. elem.setAttribute( name, name );
  23669. }
  23670. return name;
  23671. }
  23672. };
  23673. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
  23674. var getter = attrHandle[ name ] || jQuery.find.attr;
  23675. attrHandle[ name ] = function( elem, name, isXML ) {
  23676. var ret, handle,
  23677. lowercaseName = name.toLowerCase();
  23678. if ( !isXML ) {
  23679. // Avoid an infinite loop by temporarily removing this function from the getter
  23680. handle = attrHandle[ lowercaseName ];
  23681. attrHandle[ lowercaseName ] = ret;
  23682. ret = getter( elem, name, isXML ) != null ?
  23683. lowercaseName :
  23684. null;
  23685. attrHandle[ lowercaseName ] = handle;
  23686. }
  23687. return ret;
  23688. };
  23689. } );
  23690. var rfocusable = /^(?:input|select|textarea|button)$/i,
  23691. rclickable = /^(?:a|area)$/i;
  23692. jQuery.fn.extend( {
  23693. prop: function( name, value ) {
  23694. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  23695. },
  23696. removeProp: function( name ) {
  23697. return this.each( function() {
  23698. delete this[ jQuery.propFix[ name ] || name ];
  23699. } );
  23700. }
  23701. } );
  23702. jQuery.extend( {
  23703. prop: function( elem, name, value ) {
  23704. var ret, hooks,
  23705. nType = elem.nodeType;
  23706. // Don't get/set properties on text, comment and attribute nodes
  23707. if ( nType === 3 || nType === 8 || nType === 2 ) {
  23708. return;
  23709. }
  23710. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  23711. // Fix name and attach hooks
  23712. name = jQuery.propFix[ name ] || name;
  23713. hooks = jQuery.propHooks[ name ];
  23714. }
  23715. if ( value !== undefined ) {
  23716. if ( hooks && "set" in hooks &&
  23717. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  23718. return ret;
  23719. }
  23720. return ( elem[ name ] = value );
  23721. }
  23722. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  23723. return ret;
  23724. }
  23725. return elem[ name ];
  23726. },
  23727. propHooks: {
  23728. tabIndex: {
  23729. get: function( elem ) {
  23730. // Support: IE <=9 - 11 only
  23731. // elem.tabIndex doesn't always return the
  23732. // correct value when it hasn't been explicitly set
  23733. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  23734. // Use proper attribute retrieval(#12072)
  23735. var tabindex = jQuery.find.attr( elem, "tabindex" );
  23736. if ( tabindex ) {
  23737. return parseInt( tabindex, 10 );
  23738. }
  23739. if (
  23740. rfocusable.test( elem.nodeName ) ||
  23741. rclickable.test( elem.nodeName ) &&
  23742. elem.href
  23743. ) {
  23744. return 0;
  23745. }
  23746. return -1;
  23747. }
  23748. }
  23749. },
  23750. propFix: {
  23751. "for": "htmlFor",
  23752. "class": "className"
  23753. }
  23754. } );
  23755. // Support: IE <=11 only
  23756. // Accessing the selectedIndex property
  23757. // forces the browser to respect setting selected
  23758. // on the option
  23759. // The getter ensures a default option is selected
  23760. // when in an optgroup
  23761. // eslint rule "no-unused-expressions" is disabled for this code
  23762. // since it considers such accessions noop
  23763. if ( !support.optSelected ) {
  23764. jQuery.propHooks.selected = {
  23765. get: function( elem ) {
  23766. /* eslint no-unused-expressions: "off" */
  23767. var parent = elem.parentNode;
  23768. if ( parent && parent.parentNode ) {
  23769. parent.parentNode.selectedIndex;
  23770. }
  23771. return null;
  23772. },
  23773. set: function( elem ) {
  23774. /* eslint no-unused-expressions: "off" */
  23775. var parent = elem.parentNode;
  23776. if ( parent ) {
  23777. parent.selectedIndex;
  23778. if ( parent.parentNode ) {
  23779. parent.parentNode.selectedIndex;
  23780. }
  23781. }
  23782. }
  23783. };
  23784. }
  23785. jQuery.each( [
  23786. "tabIndex",
  23787. "readOnly",
  23788. "maxLength",
  23789. "cellSpacing",
  23790. "cellPadding",
  23791. "rowSpan",
  23792. "colSpan",
  23793. "useMap",
  23794. "frameBorder",
  23795. "contentEditable"
  23796. ], function() {
  23797. jQuery.propFix[ this.toLowerCase() ] = this;
  23798. } );
  23799. // Strip and collapse whitespace according to HTML spec
  23800. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  23801. function stripAndCollapse( value ) {
  23802. var tokens = value.match( rnothtmlwhite ) || [];
  23803. return tokens.join( " " );
  23804. }
  23805. function getClass( elem ) {
  23806. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  23807. }
  23808. function classesToArray( value ) {
  23809. if ( Array.isArray( value ) ) {
  23810. return value;
  23811. }
  23812. if ( typeof value === "string" ) {
  23813. return value.match( rnothtmlwhite ) || [];
  23814. }
  23815. return [];
  23816. }
  23817. jQuery.fn.extend( {
  23818. addClass: function( value ) {
  23819. var classes, elem, cur, curValue, clazz, j, finalValue,
  23820. i = 0;
  23821. if ( isFunction( value ) ) {
  23822. return this.each( function( j ) {
  23823. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  23824. } );
  23825. }
  23826. classes = classesToArray( value );
  23827. if ( classes.length ) {
  23828. while ( ( elem = this[ i++ ] ) ) {
  23829. curValue = getClass( elem );
  23830. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  23831. if ( cur ) {
  23832. j = 0;
  23833. while ( ( clazz = classes[ j++ ] ) ) {
  23834. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  23835. cur += clazz + " ";
  23836. }
  23837. }
  23838. // Only assign if different to avoid unneeded rendering.
  23839. finalValue = stripAndCollapse( cur );
  23840. if ( curValue !== finalValue ) {
  23841. elem.setAttribute( "class", finalValue );
  23842. }
  23843. }
  23844. }
  23845. }
  23846. return this;
  23847. },
  23848. removeClass: function( value ) {
  23849. var classes, elem, cur, curValue, clazz, j, finalValue,
  23850. i = 0;
  23851. if ( isFunction( value ) ) {
  23852. return this.each( function( j ) {
  23853. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  23854. } );
  23855. }
  23856. if ( !arguments.length ) {
  23857. return this.attr( "class", "" );
  23858. }
  23859. classes = classesToArray( value );
  23860. if ( classes.length ) {
  23861. while ( ( elem = this[ i++ ] ) ) {
  23862. curValue = getClass( elem );
  23863. // This expression is here for better compressibility (see addClass)
  23864. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  23865. if ( cur ) {
  23866. j = 0;
  23867. while ( ( clazz = classes[ j++ ] ) ) {
  23868. // Remove *all* instances
  23869. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  23870. cur = cur.replace( " " + clazz + " ", " " );
  23871. }
  23872. }
  23873. // Only assign if different to avoid unneeded rendering.
  23874. finalValue = stripAndCollapse( cur );
  23875. if ( curValue !== finalValue ) {
  23876. elem.setAttribute( "class", finalValue );
  23877. }
  23878. }
  23879. }
  23880. }
  23881. return this;
  23882. },
  23883. toggleClass: function( value, stateVal ) {
  23884. var type = typeof value,
  23885. isValidValue = type === "string" || Array.isArray( value );
  23886. if ( typeof stateVal === "boolean" && isValidValue ) {
  23887. return stateVal ? this.addClass( value ) : this.removeClass( value );
  23888. }
  23889. if ( isFunction( value ) ) {
  23890. return this.each( function( i ) {
  23891. jQuery( this ).toggleClass(
  23892. value.call( this, i, getClass( this ), stateVal ),
  23893. stateVal
  23894. );
  23895. } );
  23896. }
  23897. return this.each( function() {
  23898. var className, i, self, classNames;
  23899. if ( isValidValue ) {
  23900. // Toggle individual class names
  23901. i = 0;
  23902. self = jQuery( this );
  23903. classNames = classesToArray( value );
  23904. while ( ( className = classNames[ i++ ] ) ) {
  23905. // Check each className given, space separated list
  23906. if ( self.hasClass( className ) ) {
  23907. self.removeClass( className );
  23908. } else {
  23909. self.addClass( className );
  23910. }
  23911. }
  23912. // Toggle whole class name
  23913. } else if ( value === undefined || type === "boolean" ) {
  23914. className = getClass( this );
  23915. if ( className ) {
  23916. // Store className if set
  23917. dataPriv.set( this, "__className__", className );
  23918. }
  23919. // If the element has a class name or if we're passed `false`,
  23920. // then remove the whole classname (if there was one, the above saved it).
  23921. // Otherwise bring back whatever was previously saved (if anything),
  23922. // falling back to the empty string if nothing was stored.
  23923. if ( this.setAttribute ) {
  23924. this.setAttribute( "class",
  23925. className || value === false ?
  23926. "" :
  23927. dataPriv.get( this, "__className__" ) || ""
  23928. );
  23929. }
  23930. }
  23931. } );
  23932. },
  23933. hasClass: function( selector ) {
  23934. var className, elem,
  23935. i = 0;
  23936. className = " " + selector + " ";
  23937. while ( ( elem = this[ i++ ] ) ) {
  23938. if ( elem.nodeType === 1 &&
  23939. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  23940. return true;
  23941. }
  23942. }
  23943. return false;
  23944. }
  23945. } );
  23946. var rreturn = /\r/g;
  23947. jQuery.fn.extend( {
  23948. val: function( value ) {
  23949. var hooks, ret, valueIsFunction,
  23950. elem = this[ 0 ];
  23951. if ( !arguments.length ) {
  23952. if ( elem ) {
  23953. hooks = jQuery.valHooks[ elem.type ] ||
  23954. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  23955. if ( hooks &&
  23956. "get" in hooks &&
  23957. ( ret = hooks.get( elem, "value" ) ) !== undefined
  23958. ) {
  23959. return ret;
  23960. }
  23961. ret = elem.value;
  23962. // Handle most common string cases
  23963. if ( typeof ret === "string" ) {
  23964. return ret.replace( rreturn, "" );
  23965. }
  23966. // Handle cases where value is null/undef or number
  23967. return ret == null ? "" : ret;
  23968. }
  23969. return;
  23970. }
  23971. valueIsFunction = isFunction( value );
  23972. return this.each( function( i ) {
  23973. var val;
  23974. if ( this.nodeType !== 1 ) {
  23975. return;
  23976. }
  23977. if ( valueIsFunction ) {
  23978. val = value.call( this, i, jQuery( this ).val() );
  23979. } else {
  23980. val = value;
  23981. }
  23982. // Treat null/undefined as ""; convert numbers to string
  23983. if ( val == null ) {
  23984. val = "";
  23985. } else if ( typeof val === "number" ) {
  23986. val += "";
  23987. } else if ( Array.isArray( val ) ) {
  23988. val = jQuery.map( val, function( value ) {
  23989. return value == null ? "" : value + "";
  23990. } );
  23991. }
  23992. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  23993. // If set returns undefined, fall back to normal setting
  23994. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  23995. this.value = val;
  23996. }
  23997. } );
  23998. }
  23999. } );
  24000. jQuery.extend( {
  24001. valHooks: {
  24002. option: {
  24003. get: function( elem ) {
  24004. var val = jQuery.find.attr( elem, "value" );
  24005. return val != null ?
  24006. val :
  24007. // Support: IE <=10 - 11 only
  24008. // option.text throws exceptions (#14686, #14858)
  24009. // Strip and collapse whitespace
  24010. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  24011. stripAndCollapse( jQuery.text( elem ) );
  24012. }
  24013. },
  24014. select: {
  24015. get: function( elem ) {
  24016. var value, option, i,
  24017. options = elem.options,
  24018. index = elem.selectedIndex,
  24019. one = elem.type === "select-one",
  24020. values = one ? null : [],
  24021. max = one ? index + 1 : options.length;
  24022. if ( index < 0 ) {
  24023. i = max;
  24024. } else {
  24025. i = one ? index : 0;
  24026. }
  24027. // Loop through all the selected options
  24028. for ( ; i < max; i++ ) {
  24029. option = options[ i ];
  24030. // Support: IE <=9 only
  24031. // IE8-9 doesn't update selected after form reset (#2551)
  24032. if ( ( option.selected || i === index ) &&
  24033. // Don't return options that are disabled or in a disabled optgroup
  24034. !option.disabled &&
  24035. ( !option.parentNode.disabled ||
  24036. !nodeName( option.parentNode, "optgroup" ) ) ) {
  24037. // Get the specific value for the option
  24038. value = jQuery( option ).val();
  24039. // We don't need an array for one selects
  24040. if ( one ) {
  24041. return value;
  24042. }
  24043. // Multi-Selects return an array
  24044. values.push( value );
  24045. }
  24046. }
  24047. return values;
  24048. },
  24049. set: function( elem, value ) {
  24050. var optionSet, option,
  24051. options = elem.options,
  24052. values = jQuery.makeArray( value ),
  24053. i = options.length;
  24054. while ( i-- ) {
  24055. option = options[ i ];
  24056. /* eslint-disable no-cond-assign */
  24057. if ( option.selected =
  24058. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  24059. ) {
  24060. optionSet = true;
  24061. }
  24062. /* eslint-enable no-cond-assign */
  24063. }
  24064. // Force browsers to behave consistently when non-matching value is set
  24065. if ( !optionSet ) {
  24066. elem.selectedIndex = -1;
  24067. }
  24068. return values;
  24069. }
  24070. }
  24071. }
  24072. } );
  24073. // Radios and checkboxes getter/setter
  24074. jQuery.each( [ "radio", "checkbox" ], function() {
  24075. jQuery.valHooks[ this ] = {
  24076. set: function( elem, value ) {
  24077. if ( Array.isArray( value ) ) {
  24078. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  24079. }
  24080. }
  24081. };
  24082. if ( !support.checkOn ) {
  24083. jQuery.valHooks[ this ].get = function( elem ) {
  24084. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  24085. };
  24086. }
  24087. } );
  24088. // Return jQuery for attributes-only inclusion
  24089. support.focusin = "onfocusin" in window;
  24090. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  24091. stopPropagationCallback = function( e ) {
  24092. e.stopPropagation();
  24093. };
  24094. jQuery.extend( jQuery.event, {
  24095. trigger: function( event, data, elem, onlyHandlers ) {
  24096. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  24097. eventPath = [ elem || document ],
  24098. type = hasOwn.call( event, "type" ) ? event.type : event,
  24099. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  24100. cur = lastElement = tmp = elem = elem || document;
  24101. // Don't do events on text and comment nodes
  24102. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  24103. return;
  24104. }
  24105. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  24106. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  24107. return;
  24108. }
  24109. if ( type.indexOf( "." ) > -1 ) {
  24110. // Namespaced trigger; create a regexp to match event type in handle()
  24111. namespaces = type.split( "." );
  24112. type = namespaces.shift();
  24113. namespaces.sort();
  24114. }
  24115. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  24116. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  24117. event = event[ jQuery.expando ] ?
  24118. event :
  24119. new jQuery.Event( type, typeof event === "object" && event );
  24120. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  24121. event.isTrigger = onlyHandlers ? 2 : 3;
  24122. event.namespace = namespaces.join( "." );
  24123. event.rnamespace = event.namespace ?
  24124. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  24125. null;
  24126. // Clean up the event in case it is being reused
  24127. event.result = undefined;
  24128. if ( !event.target ) {
  24129. event.target = elem;
  24130. }
  24131. // Clone any incoming data and prepend the event, creating the handler arg list
  24132. data = data == null ?
  24133. [ event ] :
  24134. jQuery.makeArray( data, [ event ] );
  24135. // Allow special events to draw outside the lines
  24136. special = jQuery.event.special[ type ] || {};
  24137. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  24138. return;
  24139. }
  24140. // Determine event propagation path in advance, per W3C events spec (#9951)
  24141. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  24142. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  24143. bubbleType = special.delegateType || type;
  24144. if ( !rfocusMorph.test( bubbleType + type ) ) {
  24145. cur = cur.parentNode;
  24146. }
  24147. for ( ; cur; cur = cur.parentNode ) {
  24148. eventPath.push( cur );
  24149. tmp = cur;
  24150. }
  24151. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  24152. if ( tmp === ( elem.ownerDocument || document ) ) {
  24153. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  24154. }
  24155. }
  24156. // Fire handlers on the event path
  24157. i = 0;
  24158. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  24159. lastElement = cur;
  24160. event.type = i > 1 ?
  24161. bubbleType :
  24162. special.bindType || type;
  24163. // jQuery handler
  24164. handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] &&
  24165. dataPriv.get( cur, "handle" );
  24166. if ( handle ) {
  24167. handle.apply( cur, data );
  24168. }
  24169. // Native handler
  24170. handle = ontype && cur[ ontype ];
  24171. if ( handle && handle.apply && acceptData( cur ) ) {
  24172. event.result = handle.apply( cur, data );
  24173. if ( event.result === false ) {
  24174. event.preventDefault();
  24175. }
  24176. }
  24177. }
  24178. event.type = type;
  24179. // If nobody prevented the default action, do it now
  24180. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  24181. if ( ( !special._default ||
  24182. special._default.apply( eventPath.pop(), data ) === false ) &&
  24183. acceptData( elem ) ) {
  24184. // Call a native DOM method on the target with the same name as the event.
  24185. // Don't do default actions on window, that's where global variables be (#6170)
  24186. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  24187. // Don't re-trigger an onFOO event when we call its FOO() method
  24188. tmp = elem[ ontype ];
  24189. if ( tmp ) {
  24190. elem[ ontype ] = null;
  24191. }
  24192. // Prevent re-triggering of the same event, since we already bubbled it above
  24193. jQuery.event.triggered = type;
  24194. if ( event.isPropagationStopped() ) {
  24195. lastElement.addEventListener( type, stopPropagationCallback );
  24196. }
  24197. elem[ type ]();
  24198. if ( event.isPropagationStopped() ) {
  24199. lastElement.removeEventListener( type, stopPropagationCallback );
  24200. }
  24201. jQuery.event.triggered = undefined;
  24202. if ( tmp ) {
  24203. elem[ ontype ] = tmp;
  24204. }
  24205. }
  24206. }
  24207. }
  24208. return event.result;
  24209. },
  24210. // Piggyback on a donor event to simulate a different one
  24211. // Used only for `focus(in | out)` events
  24212. simulate: function( type, elem, event ) {
  24213. var e = jQuery.extend(
  24214. new jQuery.Event(),
  24215. event,
  24216. {
  24217. type: type,
  24218. isSimulated: true
  24219. }
  24220. );
  24221. jQuery.event.trigger( e, null, elem );
  24222. }
  24223. } );
  24224. jQuery.fn.extend( {
  24225. trigger: function( type, data ) {
  24226. return this.each( function() {
  24227. jQuery.event.trigger( type, data, this );
  24228. } );
  24229. },
  24230. triggerHandler: function( type, data ) {
  24231. var elem = this[ 0 ];
  24232. if ( elem ) {
  24233. return jQuery.event.trigger( type, data, elem, true );
  24234. }
  24235. }
  24236. } );
  24237. // Support: Firefox <=44
  24238. // Firefox doesn't have focus(in | out) events
  24239. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  24240. //
  24241. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  24242. // focus(in | out) events fire after focus & blur events,
  24243. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  24244. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  24245. if ( !support.focusin ) {
  24246. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  24247. // Attach a single capturing handler on the document while someone wants focusin/focusout
  24248. var handler = function( event ) {
  24249. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  24250. };
  24251. jQuery.event.special[ fix ] = {
  24252. setup: function() {
  24253. // Handle: regular nodes (via `this.ownerDocument`), window
  24254. // (via `this.document`) & document (via `this`).
  24255. var doc = this.ownerDocument || this.document || this,
  24256. attaches = dataPriv.access( doc, fix );
  24257. if ( !attaches ) {
  24258. doc.addEventListener( orig, handler, true );
  24259. }
  24260. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  24261. },
  24262. teardown: function() {
  24263. var doc = this.ownerDocument || this.document || this,
  24264. attaches = dataPriv.access( doc, fix ) - 1;
  24265. if ( !attaches ) {
  24266. doc.removeEventListener( orig, handler, true );
  24267. dataPriv.remove( doc, fix );
  24268. } else {
  24269. dataPriv.access( doc, fix, attaches );
  24270. }
  24271. }
  24272. };
  24273. } );
  24274. }
  24275. var location = window.location;
  24276. var nonce = { guid: Date.now() };
  24277. var rquery = ( /\?/ );
  24278. // Cross-browser xml parsing
  24279. jQuery.parseXML = function( data ) {
  24280. var xml, parserErrorElem;
  24281. if ( !data || typeof data !== "string" ) {
  24282. return null;
  24283. }
  24284. // Support: IE 9 - 11 only
  24285. // IE throws on parseFromString with invalid input.
  24286. try {
  24287. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  24288. } catch ( e ) {}
  24289. parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
  24290. if ( !xml || parserErrorElem ) {
  24291. jQuery.error( "Invalid XML: " + (
  24292. parserErrorElem ?
  24293. jQuery.map( parserErrorElem.childNodes, function( el ) {
  24294. return el.textContent;
  24295. } ).join( "\n" ) :
  24296. data
  24297. ) );
  24298. }
  24299. return xml;
  24300. };
  24301. var
  24302. rbracket = /\[\]$/,
  24303. rCRLF = /\r?\n/g,
  24304. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  24305. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  24306. function buildParams( prefix, obj, traditional, add ) {
  24307. var name;
  24308. if ( Array.isArray( obj ) ) {
  24309. // Serialize array item.
  24310. jQuery.each( obj, function( i, v ) {
  24311. if ( traditional || rbracket.test( prefix ) ) {
  24312. // Treat each array item as a scalar.
  24313. add( prefix, v );
  24314. } else {
  24315. // Item is non-scalar (array or object), encode its numeric index.
  24316. buildParams(
  24317. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  24318. v,
  24319. traditional,
  24320. add
  24321. );
  24322. }
  24323. } );
  24324. } else if ( !traditional && toType( obj ) === "object" ) {
  24325. // Serialize object item.
  24326. for ( name in obj ) {
  24327. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  24328. }
  24329. } else {
  24330. // Serialize scalar item.
  24331. add( prefix, obj );
  24332. }
  24333. }
  24334. // Serialize an array of form elements or a set of
  24335. // key/values into a query string
  24336. jQuery.param = function( a, traditional ) {
  24337. var prefix,
  24338. s = [],
  24339. add = function( key, valueOrFunction ) {
  24340. // If value is a function, invoke it and use its return value
  24341. var value = isFunction( valueOrFunction ) ?
  24342. valueOrFunction() :
  24343. valueOrFunction;
  24344. s[ s.length ] = encodeURIComponent( key ) + "=" +
  24345. encodeURIComponent( value == null ? "" : value );
  24346. };
  24347. if ( a == null ) {
  24348. return "";
  24349. }
  24350. // If an array was passed in, assume that it is an array of form elements.
  24351. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  24352. // Serialize the form elements
  24353. jQuery.each( a, function() {
  24354. add( this.name, this.value );
  24355. } );
  24356. } else {
  24357. // If traditional, encode the "old" way (the way 1.3.2 or older
  24358. // did it), otherwise encode params recursively.
  24359. for ( prefix in a ) {
  24360. buildParams( prefix, a[ prefix ], traditional, add );
  24361. }
  24362. }
  24363. // Return the resulting serialization
  24364. return s.join( "&" );
  24365. };
  24366. jQuery.fn.extend( {
  24367. serialize: function() {
  24368. return jQuery.param( this.serializeArray() );
  24369. },
  24370. serializeArray: function() {
  24371. return this.map( function() {
  24372. // Can add propHook for "elements" to filter or add form elements
  24373. var elements = jQuery.prop( this, "elements" );
  24374. return elements ? jQuery.makeArray( elements ) : this;
  24375. } ).filter( function() {
  24376. var type = this.type;
  24377. // Use .is( ":disabled" ) so that fieldset[disabled] works
  24378. return this.name && !jQuery( this ).is( ":disabled" ) &&
  24379. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  24380. ( this.checked || !rcheckableType.test( type ) );
  24381. } ).map( function( _i, elem ) {
  24382. var val = jQuery( this ).val();
  24383. if ( val == null ) {
  24384. return null;
  24385. }
  24386. if ( Array.isArray( val ) ) {
  24387. return jQuery.map( val, function( val ) {
  24388. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  24389. } );
  24390. }
  24391. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  24392. } ).get();
  24393. }
  24394. } );
  24395. var
  24396. r20 = /%20/g,
  24397. rhash = /#.*$/,
  24398. rantiCache = /([?&])_=[^&]*/,
  24399. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  24400. // #7653, #8125, #8152: local protocol detection
  24401. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  24402. rnoContent = /^(?:GET|HEAD)$/,
  24403. rprotocol = /^\/\//,
  24404. /* Prefilters
  24405. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  24406. * 2) These are called:
  24407. * - BEFORE asking for a transport
  24408. * - AFTER param serialization (s.data is a string if s.processData is true)
  24409. * 3) key is the dataType
  24410. * 4) the catchall symbol "*" can be used
  24411. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  24412. */
  24413. prefilters = {},
  24414. /* Transports bindings
  24415. * 1) key is the dataType
  24416. * 2) the catchall symbol "*" can be used
  24417. * 3) selection will start with transport dataType and THEN go to "*" if needed
  24418. */
  24419. transports = {},
  24420. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  24421. allTypes = "*/".concat( "*" ),
  24422. // Anchor tag for parsing the document origin
  24423. originAnchor = document.createElement( "a" );
  24424. originAnchor.href = location.href;
  24425. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  24426. function addToPrefiltersOrTransports( structure ) {
  24427. // dataTypeExpression is optional and defaults to "*"
  24428. return function( dataTypeExpression, func ) {
  24429. if ( typeof dataTypeExpression !== "string" ) {
  24430. func = dataTypeExpression;
  24431. dataTypeExpression = "*";
  24432. }
  24433. var dataType,
  24434. i = 0,
  24435. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  24436. if ( isFunction( func ) ) {
  24437. // For each dataType in the dataTypeExpression
  24438. while ( ( dataType = dataTypes[ i++ ] ) ) {
  24439. // Prepend if requested
  24440. if ( dataType[ 0 ] === "+" ) {
  24441. dataType = dataType.slice( 1 ) || "*";
  24442. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  24443. // Otherwise append
  24444. } else {
  24445. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  24446. }
  24447. }
  24448. }
  24449. };
  24450. }
  24451. // Base inspection function for prefilters and transports
  24452. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  24453. var inspected = {},
  24454. seekingTransport = ( structure === transports );
  24455. function inspect( dataType ) {
  24456. var selected;
  24457. inspected[ dataType ] = true;
  24458. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  24459. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  24460. if ( typeof dataTypeOrTransport === "string" &&
  24461. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  24462. options.dataTypes.unshift( dataTypeOrTransport );
  24463. inspect( dataTypeOrTransport );
  24464. return false;
  24465. } else if ( seekingTransport ) {
  24466. return !( selected = dataTypeOrTransport );
  24467. }
  24468. } );
  24469. return selected;
  24470. }
  24471. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  24472. }
  24473. // A special extend for ajax options
  24474. // that takes "flat" options (not to be deep extended)
  24475. // Fixes #9887
  24476. function ajaxExtend( target, src ) {
  24477. var key, deep,
  24478. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  24479. for ( key in src ) {
  24480. if ( src[ key ] !== undefined ) {
  24481. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  24482. }
  24483. }
  24484. if ( deep ) {
  24485. jQuery.extend( true, target, deep );
  24486. }
  24487. return target;
  24488. }
  24489. /* Handles responses to an ajax request:
  24490. * - finds the right dataType (mediates between content-type and expected dataType)
  24491. * - returns the corresponding response
  24492. */
  24493. function ajaxHandleResponses( s, jqXHR, responses ) {
  24494. var ct, type, finalDataType, firstDataType,
  24495. contents = s.contents,
  24496. dataTypes = s.dataTypes;
  24497. // Remove auto dataType and get content-type in the process
  24498. while ( dataTypes[ 0 ] === "*" ) {
  24499. dataTypes.shift();
  24500. if ( ct === undefined ) {
  24501. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  24502. }
  24503. }
  24504. // Check if we're dealing with a known content-type
  24505. if ( ct ) {
  24506. for ( type in contents ) {
  24507. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  24508. dataTypes.unshift( type );
  24509. break;
  24510. }
  24511. }
  24512. }
  24513. // Check to see if we have a response for the expected dataType
  24514. if ( dataTypes[ 0 ] in responses ) {
  24515. finalDataType = dataTypes[ 0 ];
  24516. } else {
  24517. // Try convertible dataTypes
  24518. for ( type in responses ) {
  24519. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  24520. finalDataType = type;
  24521. break;
  24522. }
  24523. if ( !firstDataType ) {
  24524. firstDataType = type;
  24525. }
  24526. }
  24527. // Or just use first one
  24528. finalDataType = finalDataType || firstDataType;
  24529. }
  24530. // If we found a dataType
  24531. // We add the dataType to the list if needed
  24532. // and return the corresponding response
  24533. if ( finalDataType ) {
  24534. if ( finalDataType !== dataTypes[ 0 ] ) {
  24535. dataTypes.unshift( finalDataType );
  24536. }
  24537. return responses[ finalDataType ];
  24538. }
  24539. }
  24540. /* Chain conversions given the request and the original response
  24541. * Also sets the responseXXX fields on the jqXHR instance
  24542. */
  24543. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  24544. var conv2, current, conv, tmp, prev,
  24545. converters = {},
  24546. // Work with a copy of dataTypes in case we need to modify it for conversion
  24547. dataTypes = s.dataTypes.slice();
  24548. // Create converters map with lowercased keys
  24549. if ( dataTypes[ 1 ] ) {
  24550. for ( conv in s.converters ) {
  24551. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  24552. }
  24553. }
  24554. current = dataTypes.shift();
  24555. // Convert to each sequential dataType
  24556. while ( current ) {
  24557. if ( s.responseFields[ current ] ) {
  24558. jqXHR[ s.responseFields[ current ] ] = response;
  24559. }
  24560. // Apply the dataFilter if provided
  24561. if ( !prev && isSuccess && s.dataFilter ) {
  24562. response = s.dataFilter( response, s.dataType );
  24563. }
  24564. prev = current;
  24565. current = dataTypes.shift();
  24566. if ( current ) {
  24567. // There's only work to do if current dataType is non-auto
  24568. if ( current === "*" ) {
  24569. current = prev;
  24570. // Convert response if prev dataType is non-auto and differs from current
  24571. } else if ( prev !== "*" && prev !== current ) {
  24572. // Seek a direct converter
  24573. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  24574. // If none found, seek a pair
  24575. if ( !conv ) {
  24576. for ( conv2 in converters ) {
  24577. // If conv2 outputs current
  24578. tmp = conv2.split( " " );
  24579. if ( tmp[ 1 ] === current ) {
  24580. // If prev can be converted to accepted input
  24581. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  24582. converters[ "* " + tmp[ 0 ] ];
  24583. if ( conv ) {
  24584. // Condense equivalence converters
  24585. if ( conv === true ) {
  24586. conv = converters[ conv2 ];
  24587. // Otherwise, insert the intermediate dataType
  24588. } else if ( converters[ conv2 ] !== true ) {
  24589. current = tmp[ 0 ];
  24590. dataTypes.unshift( tmp[ 1 ] );
  24591. }
  24592. break;
  24593. }
  24594. }
  24595. }
  24596. }
  24597. // Apply converter (if not an equivalence)
  24598. if ( conv !== true ) {
  24599. // Unless errors are allowed to bubble, catch and return them
  24600. if ( conv && s.throws ) {
  24601. response = conv( response );
  24602. } else {
  24603. try {
  24604. response = conv( response );
  24605. } catch ( e ) {
  24606. return {
  24607. state: "parsererror",
  24608. error: conv ? e : "No conversion from " + prev + " to " + current
  24609. };
  24610. }
  24611. }
  24612. }
  24613. }
  24614. }
  24615. }
  24616. return { state: "success", data: response };
  24617. }
  24618. jQuery.extend( {
  24619. // Counter for holding the number of active queries
  24620. active: 0,
  24621. // Last-Modified header cache for next request
  24622. lastModified: {},
  24623. etag: {},
  24624. ajaxSettings: {
  24625. url: location.href,
  24626. type: "GET",
  24627. isLocal: rlocalProtocol.test( location.protocol ),
  24628. global: true,
  24629. processData: true,
  24630. async: true,
  24631. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  24632. /*
  24633. timeout: 0,
  24634. data: null,
  24635. dataType: null,
  24636. username: null,
  24637. password: null,
  24638. cache: null,
  24639. throws: false,
  24640. traditional: false,
  24641. headers: {},
  24642. */
  24643. accepts: {
  24644. "*": allTypes,
  24645. text: "text/plain",
  24646. html: "text/html",
  24647. xml: "application/xml, text/xml",
  24648. json: "application/json, text/javascript"
  24649. },
  24650. contents: {
  24651. xml: /\bxml\b/,
  24652. html: /\bhtml/,
  24653. json: /\bjson\b/
  24654. },
  24655. responseFields: {
  24656. xml: "responseXML",
  24657. text: "responseText",
  24658. json: "responseJSON"
  24659. },
  24660. // Data converters
  24661. // Keys separate source (or catchall "*") and destination types with a single space
  24662. converters: {
  24663. // Convert anything to text
  24664. "* text": String,
  24665. // Text to html (true = no transformation)
  24666. "text html": true,
  24667. // Evaluate text as a json expression
  24668. "text json": JSON.parse,
  24669. // Parse text as xml
  24670. "text xml": jQuery.parseXML
  24671. },
  24672. // For options that shouldn't be deep extended:
  24673. // you can add your own custom options here if
  24674. // and when you create one that shouldn't be
  24675. // deep extended (see ajaxExtend)
  24676. flatOptions: {
  24677. url: true,
  24678. context: true
  24679. }
  24680. },
  24681. // Creates a full fledged settings object into target
  24682. // with both ajaxSettings and settings fields.
  24683. // If target is omitted, writes into ajaxSettings.
  24684. ajaxSetup: function( target, settings ) {
  24685. return settings ?
  24686. // Building a settings object
  24687. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  24688. // Extending ajaxSettings
  24689. ajaxExtend( jQuery.ajaxSettings, target );
  24690. },
  24691. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  24692. ajaxTransport: addToPrefiltersOrTransports( transports ),
  24693. // Main method
  24694. ajax: function( url, options ) {
  24695. // If url is an object, simulate pre-1.5 signature
  24696. if ( typeof url === "object" ) {
  24697. options = url;
  24698. url = undefined;
  24699. }
  24700. // Force options to be an object
  24701. options = options || {};
  24702. var transport,
  24703. // URL without anti-cache param
  24704. cacheURL,
  24705. // Response headers
  24706. responseHeadersString,
  24707. responseHeaders,
  24708. // timeout handle
  24709. timeoutTimer,
  24710. // Url cleanup var
  24711. urlAnchor,
  24712. // Request state (becomes false upon send and true upon completion)
  24713. completed,
  24714. // To know if global events are to be dispatched
  24715. fireGlobals,
  24716. // Loop variable
  24717. i,
  24718. // uncached part of the url
  24719. uncached,
  24720. // Create the final options object
  24721. s = jQuery.ajaxSetup( {}, options ),
  24722. // Callbacks context
  24723. callbackContext = s.context || s,
  24724. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  24725. globalEventContext = s.context &&
  24726. ( callbackContext.nodeType || callbackContext.jquery ) ?
  24727. jQuery( callbackContext ) :
  24728. jQuery.event,
  24729. // Deferreds
  24730. deferred = jQuery.Deferred(),
  24731. completeDeferred = jQuery.Callbacks( "once memory" ),
  24732. // Status-dependent callbacks
  24733. statusCode = s.statusCode || {},
  24734. // Headers (they are sent all at once)
  24735. requestHeaders = {},
  24736. requestHeadersNames = {},
  24737. // Default abort message
  24738. strAbort = "canceled",
  24739. // Fake xhr
  24740. jqXHR = {
  24741. readyState: 0,
  24742. // Builds headers hashtable if needed
  24743. getResponseHeader: function( key ) {
  24744. var match;
  24745. if ( completed ) {
  24746. if ( !responseHeaders ) {
  24747. responseHeaders = {};
  24748. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  24749. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  24750. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  24751. .concat( match[ 2 ] );
  24752. }
  24753. }
  24754. match = responseHeaders[ key.toLowerCase() + " " ];
  24755. }
  24756. return match == null ? null : match.join( ", " );
  24757. },
  24758. // Raw string
  24759. getAllResponseHeaders: function() {
  24760. return completed ? responseHeadersString : null;
  24761. },
  24762. // Caches the header
  24763. setRequestHeader: function( name, value ) {
  24764. if ( completed == null ) {
  24765. name = requestHeadersNames[ name.toLowerCase() ] =
  24766. requestHeadersNames[ name.toLowerCase() ] || name;
  24767. requestHeaders[ name ] = value;
  24768. }
  24769. return this;
  24770. },
  24771. // Overrides response content-type header
  24772. overrideMimeType: function( type ) {
  24773. if ( completed == null ) {
  24774. s.mimeType = type;
  24775. }
  24776. return this;
  24777. },
  24778. // Status-dependent callbacks
  24779. statusCode: function( map ) {
  24780. var code;
  24781. if ( map ) {
  24782. if ( completed ) {
  24783. // Execute the appropriate callbacks
  24784. jqXHR.always( map[ jqXHR.status ] );
  24785. } else {
  24786. // Lazy-add the new callbacks in a way that preserves old ones
  24787. for ( code in map ) {
  24788. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  24789. }
  24790. }
  24791. }
  24792. return this;
  24793. },
  24794. // Cancel the request
  24795. abort: function( statusText ) {
  24796. var finalText = statusText || strAbort;
  24797. if ( transport ) {
  24798. transport.abort( finalText );
  24799. }
  24800. done( 0, finalText );
  24801. return this;
  24802. }
  24803. };
  24804. // Attach deferreds
  24805. deferred.promise( jqXHR );
  24806. // Add protocol if not provided (prefilters might expect it)
  24807. // Handle falsy url in the settings object (#10093: consistency with old signature)
  24808. // We also use the url parameter if available
  24809. s.url = ( ( url || s.url || location.href ) + "" )
  24810. .replace( rprotocol, location.protocol + "//" );
  24811. // Alias method option to type as per ticket #12004
  24812. s.type = options.method || options.type || s.method || s.type;
  24813. // Extract dataTypes list
  24814. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  24815. // A cross-domain request is in order when the origin doesn't match the current origin.
  24816. if ( s.crossDomain == null ) {
  24817. urlAnchor = document.createElement( "a" );
  24818. // Support: IE <=8 - 11, Edge 12 - 15
  24819. // IE throws exception on accessing the href property if url is malformed,
  24820. // e.g. http://example.com:80x/
  24821. try {
  24822. urlAnchor.href = s.url;
  24823. // Support: IE <=8 - 11 only
  24824. // Anchor's host property isn't correctly set when s.url is relative
  24825. urlAnchor.href = urlAnchor.href;
  24826. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  24827. urlAnchor.protocol + "//" + urlAnchor.host;
  24828. } catch ( e ) {
  24829. // If there is an error parsing the URL, assume it is crossDomain,
  24830. // it can be rejected by the transport if it is invalid
  24831. s.crossDomain = true;
  24832. }
  24833. }
  24834. // Convert data if not already a string
  24835. if ( s.data && s.processData && typeof s.data !== "string" ) {
  24836. s.data = jQuery.param( s.data, s.traditional );
  24837. }
  24838. // Apply prefilters
  24839. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  24840. // If request was aborted inside a prefilter, stop there
  24841. if ( completed ) {
  24842. return jqXHR;
  24843. }
  24844. // We can fire global events as of now if asked to
  24845. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  24846. fireGlobals = jQuery.event && s.global;
  24847. // Watch for a new set of requests
  24848. if ( fireGlobals && jQuery.active++ === 0 ) {
  24849. jQuery.event.trigger( "ajaxStart" );
  24850. }
  24851. // Uppercase the type
  24852. s.type = s.type.toUpperCase();
  24853. // Determine if request has content
  24854. s.hasContent = !rnoContent.test( s.type );
  24855. // Save the URL in case we're toying with the If-Modified-Since
  24856. // and/or If-None-Match header later on
  24857. // Remove hash to simplify url manipulation
  24858. cacheURL = s.url.replace( rhash, "" );
  24859. // More options handling for requests with no content
  24860. if ( !s.hasContent ) {
  24861. // Remember the hash so we can put it back
  24862. uncached = s.url.slice( cacheURL.length );
  24863. // If data is available and should be processed, append data to url
  24864. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  24865. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  24866. // #9682: remove data so that it's not used in an eventual retry
  24867. delete s.data;
  24868. }
  24869. // Add or update anti-cache param if needed
  24870. if ( s.cache === false ) {
  24871. cacheURL = cacheURL.replace( rantiCache, "$1" );
  24872. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +
  24873. uncached;
  24874. }
  24875. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  24876. s.url = cacheURL + uncached;
  24877. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  24878. } else if ( s.data && s.processData &&
  24879. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  24880. s.data = s.data.replace( r20, "+" );
  24881. }
  24882. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  24883. if ( s.ifModified ) {
  24884. if ( jQuery.lastModified[ cacheURL ] ) {
  24885. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  24886. }
  24887. if ( jQuery.etag[ cacheURL ] ) {
  24888. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  24889. }
  24890. }
  24891. // Set the correct header, if data is being sent
  24892. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  24893. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  24894. }
  24895. // Set the Accepts header for the server, depending on the dataType
  24896. jqXHR.setRequestHeader(
  24897. "Accept",
  24898. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  24899. s.accepts[ s.dataTypes[ 0 ] ] +
  24900. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  24901. s.accepts[ "*" ]
  24902. );
  24903. // Check for headers option
  24904. for ( i in s.headers ) {
  24905. jqXHR.setRequestHeader( i, s.headers[ i ] );
  24906. }
  24907. // Allow custom headers/mimetypes and early abort
  24908. if ( s.beforeSend &&
  24909. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  24910. // Abort if not done already and return
  24911. return jqXHR.abort();
  24912. }
  24913. // Aborting is no longer a cancellation
  24914. strAbort = "abort";
  24915. // Install callbacks on deferreds
  24916. completeDeferred.add( s.complete );
  24917. jqXHR.done( s.success );
  24918. jqXHR.fail( s.error );
  24919. // Get transport
  24920. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  24921. // If no transport, we auto-abort
  24922. if ( !transport ) {
  24923. done( -1, "No Transport" );
  24924. } else {
  24925. jqXHR.readyState = 1;
  24926. // Send global event
  24927. if ( fireGlobals ) {
  24928. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  24929. }
  24930. // If request was aborted inside ajaxSend, stop there
  24931. if ( completed ) {
  24932. return jqXHR;
  24933. }
  24934. // Timeout
  24935. if ( s.async && s.timeout > 0 ) {
  24936. timeoutTimer = window.setTimeout( function() {
  24937. jqXHR.abort( "timeout" );
  24938. }, s.timeout );
  24939. }
  24940. try {
  24941. completed = false;
  24942. transport.send( requestHeaders, done );
  24943. } catch ( e ) {
  24944. // Rethrow post-completion exceptions
  24945. if ( completed ) {
  24946. throw e;
  24947. }
  24948. // Propagate others as results
  24949. done( -1, e );
  24950. }
  24951. }
  24952. // Callback for when everything is done
  24953. function done( status, nativeStatusText, responses, headers ) {
  24954. var isSuccess, success, error, response, modified,
  24955. statusText = nativeStatusText;
  24956. // Ignore repeat invocations
  24957. if ( completed ) {
  24958. return;
  24959. }
  24960. completed = true;
  24961. // Clear timeout if it exists
  24962. if ( timeoutTimer ) {
  24963. window.clearTimeout( timeoutTimer );
  24964. }
  24965. // Dereference transport for early garbage collection
  24966. // (no matter how long the jqXHR object will be used)
  24967. transport = undefined;
  24968. // Cache response headers
  24969. responseHeadersString = headers || "";
  24970. // Set readyState
  24971. jqXHR.readyState = status > 0 ? 4 : 0;
  24972. // Determine if successful
  24973. isSuccess = status >= 200 && status < 300 || status === 304;
  24974. // Get response data
  24975. if ( responses ) {
  24976. response = ajaxHandleResponses( s, jqXHR, responses );
  24977. }
  24978. // Use a noop converter for missing script but not if jsonp
  24979. if ( !isSuccess &&
  24980. jQuery.inArray( "script", s.dataTypes ) > -1 &&
  24981. jQuery.inArray( "json", s.dataTypes ) < 0 ) {
  24982. s.converters[ "text script" ] = function() {};
  24983. }
  24984. // Convert no matter what (that way responseXXX fields are always set)
  24985. response = ajaxConvert( s, response, jqXHR, isSuccess );
  24986. // If successful, handle type chaining
  24987. if ( isSuccess ) {
  24988. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  24989. if ( s.ifModified ) {
  24990. modified = jqXHR.getResponseHeader( "Last-Modified" );
  24991. if ( modified ) {
  24992. jQuery.lastModified[ cacheURL ] = modified;
  24993. }
  24994. modified = jqXHR.getResponseHeader( "etag" );
  24995. if ( modified ) {
  24996. jQuery.etag[ cacheURL ] = modified;
  24997. }
  24998. }
  24999. // if no content
  25000. if ( status === 204 || s.type === "HEAD" ) {
  25001. statusText = "nocontent";
  25002. // if not modified
  25003. } else if ( status === 304 ) {
  25004. statusText = "notmodified";
  25005. // If we have data, let's convert it
  25006. } else {
  25007. statusText = response.state;
  25008. success = response.data;
  25009. error = response.error;
  25010. isSuccess = !error;
  25011. }
  25012. } else {
  25013. // Extract error from statusText and normalize for non-aborts
  25014. error = statusText;
  25015. if ( status || !statusText ) {
  25016. statusText = "error";
  25017. if ( status < 0 ) {
  25018. status = 0;
  25019. }
  25020. }
  25021. }
  25022. // Set data for the fake xhr object
  25023. jqXHR.status = status;
  25024. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  25025. // Success/Error
  25026. if ( isSuccess ) {
  25027. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  25028. } else {
  25029. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  25030. }
  25031. // Status-dependent callbacks
  25032. jqXHR.statusCode( statusCode );
  25033. statusCode = undefined;
  25034. if ( fireGlobals ) {
  25035. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  25036. [ jqXHR, s, isSuccess ? success : error ] );
  25037. }
  25038. // Complete
  25039. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  25040. if ( fireGlobals ) {
  25041. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  25042. // Handle the global AJAX counter
  25043. if ( !( --jQuery.active ) ) {
  25044. jQuery.event.trigger( "ajaxStop" );
  25045. }
  25046. }
  25047. }
  25048. return jqXHR;
  25049. },
  25050. getJSON: function( url, data, callback ) {
  25051. return jQuery.get( url, data, callback, "json" );
  25052. },
  25053. getScript: function( url, callback ) {
  25054. return jQuery.get( url, undefined, callback, "script" );
  25055. }
  25056. } );
  25057. jQuery.each( [ "get", "post" ], function( _i, method ) {
  25058. jQuery[ method ] = function( url, data, callback, type ) {
  25059. // Shift arguments if data argument was omitted
  25060. if ( isFunction( data ) ) {
  25061. type = type || callback;
  25062. callback = data;
  25063. data = undefined;
  25064. }
  25065. // The url can be an options object (which then must have .url)
  25066. return jQuery.ajax( jQuery.extend( {
  25067. url: url,
  25068. type: method,
  25069. dataType: type,
  25070. data: data,
  25071. success: callback
  25072. }, jQuery.isPlainObject( url ) && url ) );
  25073. };
  25074. } );
  25075. jQuery.ajaxPrefilter( function( s ) {
  25076. var i;
  25077. for ( i in s.headers ) {
  25078. if ( i.toLowerCase() === "content-type" ) {
  25079. s.contentType = s.headers[ i ] || "";
  25080. }
  25081. }
  25082. } );
  25083. jQuery._evalUrl = function( url, options, doc ) {
  25084. return jQuery.ajax( {
  25085. url: url,
  25086. // Make this explicit, since user can override this through ajaxSetup (#11264)
  25087. type: "GET",
  25088. dataType: "script",
  25089. cache: true,
  25090. async: false,
  25091. global: false,
  25092. // Only evaluate the response if it is successful (gh-4126)
  25093. // dataFilter is not invoked for failure responses, so using it instead
  25094. // of the default converter is kludgy but it works.
  25095. converters: {
  25096. "text script": function() {}
  25097. },
  25098. dataFilter: function( response ) {
  25099. jQuery.globalEval( response, options, doc );
  25100. }
  25101. } );
  25102. };
  25103. jQuery.fn.extend( {
  25104. wrapAll: function( html ) {
  25105. var wrap;
  25106. if ( this[ 0 ] ) {
  25107. if ( isFunction( html ) ) {
  25108. html = html.call( this[ 0 ] );
  25109. }
  25110. // The elements to wrap the target around
  25111. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  25112. if ( this[ 0 ].parentNode ) {
  25113. wrap.insertBefore( this[ 0 ] );
  25114. }
  25115. wrap.map( function() {
  25116. var elem = this;
  25117. while ( elem.firstElementChild ) {
  25118. elem = elem.firstElementChild;
  25119. }
  25120. return elem;
  25121. } ).append( this );
  25122. }
  25123. return this;
  25124. },
  25125. wrapInner: function( html ) {
  25126. if ( isFunction( html ) ) {
  25127. return this.each( function( i ) {
  25128. jQuery( this ).wrapInner( html.call( this, i ) );
  25129. } );
  25130. }
  25131. return this.each( function() {
  25132. var self = jQuery( this ),
  25133. contents = self.contents();
  25134. if ( contents.length ) {
  25135. contents.wrapAll( html );
  25136. } else {
  25137. self.append( html );
  25138. }
  25139. } );
  25140. },
  25141. wrap: function( html ) {
  25142. var htmlIsFunction = isFunction( html );
  25143. return this.each( function( i ) {
  25144. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  25145. } );
  25146. },
  25147. unwrap: function( selector ) {
  25148. this.parent( selector ).not( "body" ).each( function() {
  25149. jQuery( this ).replaceWith( this.childNodes );
  25150. } );
  25151. return this;
  25152. }
  25153. } );
  25154. jQuery.expr.pseudos.hidden = function( elem ) {
  25155. return !jQuery.expr.pseudos.visible( elem );
  25156. };
  25157. jQuery.expr.pseudos.visible = function( elem ) {
  25158. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  25159. };
  25160. jQuery.ajaxSettings.xhr = function() {
  25161. try {
  25162. return new window.XMLHttpRequest();
  25163. } catch ( e ) {}
  25164. };
  25165. var xhrSuccessStatus = {
  25166. // File protocol always yields status code 0, assume 200
  25167. 0: 200,
  25168. // Support: IE <=9 only
  25169. // #1450: sometimes IE returns 1223 when it should be 204
  25170. 1223: 204
  25171. },
  25172. xhrSupported = jQuery.ajaxSettings.xhr();
  25173. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  25174. support.ajax = xhrSupported = !!xhrSupported;
  25175. jQuery.ajaxTransport( function( options ) {
  25176. var callback, errorCallback;
  25177. // Cross domain only allowed if supported through XMLHttpRequest
  25178. if ( support.cors || xhrSupported && !options.crossDomain ) {
  25179. return {
  25180. send: function( headers, complete ) {
  25181. var i,
  25182. xhr = options.xhr();
  25183. xhr.open(
  25184. options.type,
  25185. options.url,
  25186. options.async,
  25187. options.username,
  25188. options.password
  25189. );
  25190. // Apply custom fields if provided
  25191. if ( options.xhrFields ) {
  25192. for ( i in options.xhrFields ) {
  25193. xhr[ i ] = options.xhrFields[ i ];
  25194. }
  25195. }
  25196. // Override mime type if needed
  25197. if ( options.mimeType && xhr.overrideMimeType ) {
  25198. xhr.overrideMimeType( options.mimeType );
  25199. }
  25200. // X-Requested-With header
  25201. // For cross-domain requests, seeing as conditions for a preflight are
  25202. // akin to a jigsaw puzzle, we simply never set it to be sure.
  25203. // (it can always be set on a per-request basis or even using ajaxSetup)
  25204. // For same-domain requests, won't change header if already provided.
  25205. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  25206. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  25207. }
  25208. // Set headers
  25209. for ( i in headers ) {
  25210. xhr.setRequestHeader( i, headers[ i ] );
  25211. }
  25212. // Callback
  25213. callback = function( type ) {
  25214. return function() {
  25215. if ( callback ) {
  25216. callback = errorCallback = xhr.onload =
  25217. xhr.onerror = xhr.onabort = xhr.ontimeout =
  25218. xhr.onreadystatechange = null;
  25219. if ( type === "abort" ) {
  25220. xhr.abort();
  25221. } else if ( type === "error" ) {
  25222. // Support: IE <=9 only
  25223. // On a manual native abort, IE9 throws
  25224. // errors on any property access that is not readyState
  25225. if ( typeof xhr.status !== "number" ) {
  25226. complete( 0, "error" );
  25227. } else {
  25228. complete(
  25229. // File: protocol always yields status 0; see #8605, #14207
  25230. xhr.status,
  25231. xhr.statusText
  25232. );
  25233. }
  25234. } else {
  25235. complete(
  25236. xhrSuccessStatus[ xhr.status ] || xhr.status,
  25237. xhr.statusText,
  25238. // Support: IE <=9 only
  25239. // IE9 has no XHR2 but throws on binary (trac-11426)
  25240. // For XHR2 non-text, let the caller handle it (gh-2498)
  25241. ( xhr.responseType || "text" ) !== "text" ||
  25242. typeof xhr.responseText !== "string" ?
  25243. { binary: xhr.response } :
  25244. { text: xhr.responseText },
  25245. xhr.getAllResponseHeaders()
  25246. );
  25247. }
  25248. }
  25249. };
  25250. };
  25251. // Listen to events
  25252. xhr.onload = callback();
  25253. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  25254. // Support: IE 9 only
  25255. // Use onreadystatechange to replace onabort
  25256. // to handle uncaught aborts
  25257. if ( xhr.onabort !== undefined ) {
  25258. xhr.onabort = errorCallback;
  25259. } else {
  25260. xhr.onreadystatechange = function() {
  25261. // Check readyState before timeout as it changes
  25262. if ( xhr.readyState === 4 ) {
  25263. // Allow onerror to be called first,
  25264. // but that will not handle a native abort
  25265. // Also, save errorCallback to a variable
  25266. // as xhr.onerror cannot be accessed
  25267. window.setTimeout( function() {
  25268. if ( callback ) {
  25269. errorCallback();
  25270. }
  25271. } );
  25272. }
  25273. };
  25274. }
  25275. // Create the abort callback
  25276. callback = callback( "abort" );
  25277. try {
  25278. // Do send the request (this may raise an exception)
  25279. xhr.send( options.hasContent && options.data || null );
  25280. } catch ( e ) {
  25281. // #14683: Only rethrow if this hasn't been notified as an error yet
  25282. if ( callback ) {
  25283. throw e;
  25284. }
  25285. }
  25286. },
  25287. abort: function() {
  25288. if ( callback ) {
  25289. callback();
  25290. }
  25291. }
  25292. };
  25293. }
  25294. } );
  25295. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  25296. jQuery.ajaxPrefilter( function( s ) {
  25297. if ( s.crossDomain ) {
  25298. s.contents.script = false;
  25299. }
  25300. } );
  25301. // Install script dataType
  25302. jQuery.ajaxSetup( {
  25303. accepts: {
  25304. script: "text/javascript, application/javascript, " +
  25305. "application/ecmascript, application/x-ecmascript"
  25306. },
  25307. contents: {
  25308. script: /\b(?:java|ecma)script\b/
  25309. },
  25310. converters: {
  25311. "text script": function( text ) {
  25312. jQuery.globalEval( text );
  25313. return text;
  25314. }
  25315. }
  25316. } );
  25317. // Handle cache's special case and crossDomain
  25318. jQuery.ajaxPrefilter( "script", function( s ) {
  25319. if ( s.cache === undefined ) {
  25320. s.cache = false;
  25321. }
  25322. if ( s.crossDomain ) {
  25323. s.type = "GET";
  25324. }
  25325. } );
  25326. // Bind script tag hack transport
  25327. jQuery.ajaxTransport( "script", function( s ) {
  25328. // This transport only deals with cross domain or forced-by-attrs requests
  25329. if ( s.crossDomain || s.scriptAttrs ) {
  25330. var script, callback;
  25331. return {
  25332. send: function( _, complete ) {
  25333. script = jQuery( "<script>" )
  25334. .attr( s.scriptAttrs || {} )
  25335. .prop( { charset: s.scriptCharset, src: s.url } )
  25336. .on( "load error", callback = function( evt ) {
  25337. script.remove();
  25338. callback = null;
  25339. if ( evt ) {
  25340. complete( evt.type === "error" ? 404 : 200, evt.type );
  25341. }
  25342. } );
  25343. // Use native DOM manipulation to avoid our domManip AJAX trickery
  25344. document.head.appendChild( script[ 0 ] );
  25345. },
  25346. abort: function() {
  25347. if ( callback ) {
  25348. callback();
  25349. }
  25350. }
  25351. };
  25352. }
  25353. } );
  25354. var oldCallbacks = [],
  25355. rjsonp = /(=)\?(?=&|$)|\?\?/;
  25356. // Default jsonp settings
  25357. jQuery.ajaxSetup( {
  25358. jsonp: "callback",
  25359. jsonpCallback: function() {
  25360. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) );
  25361. this[ callback ] = true;
  25362. return callback;
  25363. }
  25364. } );
  25365. // Detect, normalize options and install callbacks for jsonp requests
  25366. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  25367. var callbackName, overwritten, responseContainer,
  25368. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  25369. "url" :
  25370. typeof s.data === "string" &&
  25371. ( s.contentType || "" )
  25372. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  25373. rjsonp.test( s.data ) && "data"
  25374. );
  25375. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  25376. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  25377. // Get callback name, remembering preexisting value associated with it
  25378. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  25379. s.jsonpCallback() :
  25380. s.jsonpCallback;
  25381. // Insert callback into url or form data
  25382. if ( jsonProp ) {
  25383. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  25384. } else if ( s.jsonp !== false ) {
  25385. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  25386. }
  25387. // Use data converter to retrieve json after script execution
  25388. s.converters[ "script json" ] = function() {
  25389. if ( !responseContainer ) {
  25390. jQuery.error( callbackName + " was not called" );
  25391. }
  25392. return responseContainer[ 0 ];
  25393. };
  25394. // Force json dataType
  25395. s.dataTypes[ 0 ] = "json";
  25396. // Install callback
  25397. overwritten = window[ callbackName ];
  25398. window[ callbackName ] = function() {
  25399. responseContainer = arguments;
  25400. };
  25401. // Clean-up function (fires after converters)
  25402. jqXHR.always( function() {
  25403. // If previous value didn't exist - remove it
  25404. if ( overwritten === undefined ) {
  25405. jQuery( window ).removeProp( callbackName );
  25406. // Otherwise restore preexisting value
  25407. } else {
  25408. window[ callbackName ] = overwritten;
  25409. }
  25410. // Save back as free
  25411. if ( s[ callbackName ] ) {
  25412. // Make sure that re-using the options doesn't screw things around
  25413. s.jsonpCallback = originalSettings.jsonpCallback;
  25414. // Save the callback name for future use
  25415. oldCallbacks.push( callbackName );
  25416. }
  25417. // Call if it was a function and we have a response
  25418. if ( responseContainer && isFunction( overwritten ) ) {
  25419. overwritten( responseContainer[ 0 ] );
  25420. }
  25421. responseContainer = overwritten = undefined;
  25422. } );
  25423. // Delegate to script
  25424. return "script";
  25425. }
  25426. } );
  25427. // Support: Safari 8 only
  25428. // In Safari 8 documents created via document.implementation.createHTMLDocument
  25429. // collapse sibling forms: the second one becomes a child of the first one.
  25430. // Because of that, this security measure has to be disabled in Safari 8.
  25431. // https://bugs.webkit.org/show_bug.cgi?id=137337
  25432. support.createHTMLDocument = ( function() {
  25433. var body = document.implementation.createHTMLDocument( "" ).body;
  25434. body.innerHTML = "<form></form><form></form>";
  25435. return body.childNodes.length === 2;
  25436. } )();
  25437. // Argument "data" should be string of html
  25438. // context (optional): If specified, the fragment will be created in this context,
  25439. // defaults to document
  25440. // keepScripts (optional): If true, will include scripts passed in the html string
  25441. jQuery.parseHTML = function( data, context, keepScripts ) {
  25442. if ( typeof data !== "string" ) {
  25443. return [];
  25444. }
  25445. if ( typeof context === "boolean" ) {
  25446. keepScripts = context;
  25447. context = false;
  25448. }
  25449. var base, parsed, scripts;
  25450. if ( !context ) {
  25451. // Stop scripts or inline event handlers from being executed immediately
  25452. // by using document.implementation
  25453. if ( support.createHTMLDocument ) {
  25454. context = document.implementation.createHTMLDocument( "" );
  25455. // Set the base href for the created document
  25456. // so any parsed elements with URLs
  25457. // are based on the document's URL (gh-2965)
  25458. base = context.createElement( "base" );
  25459. base.href = document.location.href;
  25460. context.head.appendChild( base );
  25461. } else {
  25462. context = document;
  25463. }
  25464. }
  25465. parsed = rsingleTag.exec( data );
  25466. scripts = !keepScripts && [];
  25467. // Single tag
  25468. if ( parsed ) {
  25469. return [ context.createElement( parsed[ 1 ] ) ];
  25470. }
  25471. parsed = buildFragment( [ data ], context, scripts );
  25472. if ( scripts && scripts.length ) {
  25473. jQuery( scripts ).remove();
  25474. }
  25475. return jQuery.merge( [], parsed.childNodes );
  25476. };
  25477. /**
  25478. * Load a url into a page
  25479. */
  25480. jQuery.fn.load = function( url, params, callback ) {
  25481. var selector, type, response,
  25482. self = this,
  25483. off = url.indexOf( " " );
  25484. if ( off > -1 ) {
  25485. selector = stripAndCollapse( url.slice( off ) );
  25486. url = url.slice( 0, off );
  25487. }
  25488. // If it's a function
  25489. if ( isFunction( params ) ) {
  25490. // We assume that it's the callback
  25491. callback = params;
  25492. params = undefined;
  25493. // Otherwise, build a param string
  25494. } else if ( params && typeof params === "object" ) {
  25495. type = "POST";
  25496. }
  25497. // If we have elements to modify, make the request
  25498. if ( self.length > 0 ) {
  25499. jQuery.ajax( {
  25500. url: url,
  25501. // If "type" variable is undefined, then "GET" method will be used.
  25502. // Make value of this field explicit since
  25503. // user can override it through ajaxSetup method
  25504. type: type || "GET",
  25505. dataType: "html",
  25506. data: params
  25507. } ).done( function( responseText ) {
  25508. // Save response for use in complete callback
  25509. response = arguments;
  25510. self.html( selector ?
  25511. // If a selector was specified, locate the right elements in a dummy div
  25512. // Exclude scripts to avoid IE 'Permission Denied' errors
  25513. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  25514. // Otherwise use the full result
  25515. responseText );
  25516. // If the request succeeds, this function gets "data", "status", "jqXHR"
  25517. // but they are ignored because response was set above.
  25518. // If it fails, this function gets "jqXHR", "status", "error"
  25519. } ).always( callback && function( jqXHR, status ) {
  25520. self.each( function() {
  25521. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  25522. } );
  25523. } );
  25524. }
  25525. return this;
  25526. };
  25527. jQuery.expr.pseudos.animated = function( elem ) {
  25528. return jQuery.grep( jQuery.timers, function( fn ) {
  25529. return elem === fn.elem;
  25530. } ).length;
  25531. };
  25532. jQuery.offset = {
  25533. setOffset: function( elem, options, i ) {
  25534. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  25535. position = jQuery.css( elem, "position" ),
  25536. curElem = jQuery( elem ),
  25537. props = {};
  25538. // Set position first, in-case top/left are set even on static elem
  25539. if ( position === "static" ) {
  25540. elem.style.position = "relative";
  25541. }
  25542. curOffset = curElem.offset();
  25543. curCSSTop = jQuery.css( elem, "top" );
  25544. curCSSLeft = jQuery.css( elem, "left" );
  25545. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  25546. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  25547. // Need to be able to calculate position if either
  25548. // top or left is auto and position is either absolute or fixed
  25549. if ( calculatePosition ) {
  25550. curPosition = curElem.position();
  25551. curTop = curPosition.top;
  25552. curLeft = curPosition.left;
  25553. } else {
  25554. curTop = parseFloat( curCSSTop ) || 0;
  25555. curLeft = parseFloat( curCSSLeft ) || 0;
  25556. }
  25557. if ( isFunction( options ) ) {
  25558. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  25559. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  25560. }
  25561. if ( options.top != null ) {
  25562. props.top = ( options.top - curOffset.top ) + curTop;
  25563. }
  25564. if ( options.left != null ) {
  25565. props.left = ( options.left - curOffset.left ) + curLeft;
  25566. }
  25567. if ( "using" in options ) {
  25568. options.using.call( elem, props );
  25569. } else {
  25570. curElem.css( props );
  25571. }
  25572. }
  25573. };
  25574. jQuery.fn.extend( {
  25575. // offset() relates an element's border box to the document origin
  25576. offset: function( options ) {
  25577. // Preserve chaining for setter
  25578. if ( arguments.length ) {
  25579. return options === undefined ?
  25580. this :
  25581. this.each( function( i ) {
  25582. jQuery.offset.setOffset( this, options, i );
  25583. } );
  25584. }
  25585. var rect, win,
  25586. elem = this[ 0 ];
  25587. if ( !elem ) {
  25588. return;
  25589. }
  25590. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  25591. // Support: IE <=11 only
  25592. // Running getBoundingClientRect on a
  25593. // disconnected node in IE throws an error
  25594. if ( !elem.getClientRects().length ) {
  25595. return { top: 0, left: 0 };
  25596. }
  25597. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  25598. rect = elem.getBoundingClientRect();
  25599. win = elem.ownerDocument.defaultView;
  25600. return {
  25601. top: rect.top + win.pageYOffset,
  25602. left: rect.left + win.pageXOffset
  25603. };
  25604. },
  25605. // position() relates an element's margin box to its offset parent's padding box
  25606. // This corresponds to the behavior of CSS absolute positioning
  25607. position: function() {
  25608. if ( !this[ 0 ] ) {
  25609. return;
  25610. }
  25611. var offsetParent, offset, doc,
  25612. elem = this[ 0 ],
  25613. parentOffset = { top: 0, left: 0 };
  25614. // position:fixed elements are offset from the viewport, which itself always has zero offset
  25615. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  25616. // Assume position:fixed implies availability of getBoundingClientRect
  25617. offset = elem.getBoundingClientRect();
  25618. } else {
  25619. offset = this.offset();
  25620. // Account for the *real* offset parent, which can be the document or its root element
  25621. // when a statically positioned element is identified
  25622. doc = elem.ownerDocument;
  25623. offsetParent = elem.offsetParent || doc.documentElement;
  25624. while ( offsetParent &&
  25625. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  25626. jQuery.css( offsetParent, "position" ) === "static" ) {
  25627. offsetParent = offsetParent.parentNode;
  25628. }
  25629. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  25630. // Incorporate borders into its offset, since they are outside its content origin
  25631. parentOffset = jQuery( offsetParent ).offset();
  25632. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  25633. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  25634. }
  25635. }
  25636. // Subtract parent offsets and element margins
  25637. return {
  25638. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  25639. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  25640. };
  25641. },
  25642. // This method will return documentElement in the following cases:
  25643. // 1) For the element inside the iframe without offsetParent, this method will return
  25644. // documentElement of the parent window
  25645. // 2) For the hidden or detached element
  25646. // 3) For body or html element, i.e. in case of the html node - it will return itself
  25647. //
  25648. // but those exceptions were never presented as a real life use-cases
  25649. // and might be considered as more preferable results.
  25650. //
  25651. // This logic, however, is not guaranteed and can change at any point in the future
  25652. offsetParent: function() {
  25653. return this.map( function() {
  25654. var offsetParent = this.offsetParent;
  25655. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  25656. offsetParent = offsetParent.offsetParent;
  25657. }
  25658. return offsetParent || documentElement;
  25659. } );
  25660. }
  25661. } );
  25662. // Create scrollLeft and scrollTop methods
  25663. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  25664. var top = "pageYOffset" === prop;
  25665. jQuery.fn[ method ] = function( val ) {
  25666. return access( this, function( elem, method, val ) {
  25667. // Coalesce documents and windows
  25668. var win;
  25669. if ( isWindow( elem ) ) {
  25670. win = elem;
  25671. } else if ( elem.nodeType === 9 ) {
  25672. win = elem.defaultView;
  25673. }
  25674. if ( val === undefined ) {
  25675. return win ? win[ prop ] : elem[ method ];
  25676. }
  25677. if ( win ) {
  25678. win.scrollTo(
  25679. !top ? val : win.pageXOffset,
  25680. top ? val : win.pageYOffset
  25681. );
  25682. } else {
  25683. elem[ method ] = val;
  25684. }
  25685. }, method, val, arguments.length );
  25686. };
  25687. } );
  25688. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  25689. // Add the top/left cssHooks using jQuery.fn.position
  25690. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  25691. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  25692. // getComputedStyle returns percent when specified for top/left/bottom/right;
  25693. // rather than make the css module depend on the offset module, just check for it here
  25694. jQuery.each( [ "top", "left" ], function( _i, prop ) {
  25695. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  25696. function( elem, computed ) {
  25697. if ( computed ) {
  25698. computed = curCSS( elem, prop );
  25699. // If curCSS returns percentage, fallback to offset
  25700. return rnumnonpx.test( computed ) ?
  25701. jQuery( elem ).position()[ prop ] + "px" :
  25702. computed;
  25703. }
  25704. }
  25705. );
  25706. } );
  25707. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  25708. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  25709. jQuery.each( {
  25710. padding: "inner" + name,
  25711. content: type,
  25712. "": "outer" + name
  25713. }, function( defaultExtra, funcName ) {
  25714. // Margin is only for outerHeight, outerWidth
  25715. jQuery.fn[ funcName ] = function( margin, value ) {
  25716. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  25717. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  25718. return access( this, function( elem, type, value ) {
  25719. var doc;
  25720. if ( isWindow( elem ) ) {
  25721. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  25722. return funcName.indexOf( "outer" ) === 0 ?
  25723. elem[ "inner" + name ] :
  25724. elem.document.documentElement[ "client" + name ];
  25725. }
  25726. // Get document width or height
  25727. if ( elem.nodeType === 9 ) {
  25728. doc = elem.documentElement;
  25729. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  25730. // whichever is greatest
  25731. return Math.max(
  25732. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  25733. elem.body[ "offset" + name ], doc[ "offset" + name ],
  25734. doc[ "client" + name ]
  25735. );
  25736. }
  25737. return value === undefined ?
  25738. // Get width or height on the element, requesting but not forcing parseFloat
  25739. jQuery.css( elem, type, extra ) :
  25740. // Set width or height on the element
  25741. jQuery.style( elem, type, value, extra );
  25742. }, type, chainable ? margin : undefined, chainable );
  25743. };
  25744. } );
  25745. } );
  25746. jQuery.each( [
  25747. "ajaxStart",
  25748. "ajaxStop",
  25749. "ajaxComplete",
  25750. "ajaxError",
  25751. "ajaxSuccess",
  25752. "ajaxSend"
  25753. ], function( _i, type ) {
  25754. jQuery.fn[ type ] = function( fn ) {
  25755. return this.on( type, fn );
  25756. };
  25757. } );
  25758. jQuery.fn.extend( {
  25759. bind: function( types, data, fn ) {
  25760. return this.on( types, null, data, fn );
  25761. },
  25762. unbind: function( types, fn ) {
  25763. return this.off( types, null, fn );
  25764. },
  25765. delegate: function( selector, types, data, fn ) {
  25766. return this.on( types, selector, data, fn );
  25767. },
  25768. undelegate: function( selector, types, fn ) {
  25769. // ( namespace ) or ( selector, types [, fn] )
  25770. return arguments.length === 1 ?
  25771. this.off( selector, "**" ) :
  25772. this.off( types, selector || "**", fn );
  25773. },
  25774. hover: function( fnOver, fnOut ) {
  25775. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  25776. }
  25777. } );
  25778. jQuery.each(
  25779. ( "blur focus focusin focusout resize scroll click dblclick " +
  25780. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  25781. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  25782. function( _i, name ) {
  25783. // Handle event binding
  25784. jQuery.fn[ name ] = function( data, fn ) {
  25785. return arguments.length > 0 ?
  25786. this.on( name, null, data, fn ) :
  25787. this.trigger( name );
  25788. };
  25789. }
  25790. );
  25791. // Support: Android <=4.0 only
  25792. // Make sure we trim BOM and NBSP
  25793. var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  25794. // Bind a function to a context, optionally partially applying any
  25795. // arguments.
  25796. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  25797. // However, it is not slated for removal any time soon
  25798. jQuery.proxy = function( fn, context ) {
  25799. var tmp, args, proxy;
  25800. if ( typeof context === "string" ) {
  25801. tmp = fn[ context ];
  25802. context = fn;
  25803. fn = tmp;
  25804. }
  25805. // Quick check to determine if target is callable, in the spec
  25806. // this throws a TypeError, but we will just return undefined.
  25807. if ( !isFunction( fn ) ) {
  25808. return undefined;
  25809. }
  25810. // Simulated bind
  25811. args = slice.call( arguments, 2 );
  25812. proxy = function() {
  25813. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  25814. };
  25815. // Set the guid of unique handler to the same of original handler, so it can be removed
  25816. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  25817. return proxy;
  25818. };
  25819. jQuery.holdReady = function( hold ) {
  25820. if ( hold ) {
  25821. jQuery.readyWait++;
  25822. } else {
  25823. jQuery.ready( true );
  25824. }
  25825. };
  25826. jQuery.isArray = Array.isArray;
  25827. jQuery.parseJSON = JSON.parse;
  25828. jQuery.nodeName = nodeName;
  25829. jQuery.isFunction = isFunction;
  25830. jQuery.isWindow = isWindow;
  25831. jQuery.camelCase = camelCase;
  25832. jQuery.type = toType;
  25833. jQuery.now = Date.now;
  25834. jQuery.isNumeric = function( obj ) {
  25835. // As of jQuery 3.0, isNumeric is limited to
  25836. // strings and numbers (primitives or objects)
  25837. // that can be coerced to finite numbers (gh-2662)
  25838. var type = jQuery.type( obj );
  25839. return ( type === "number" || type === "string" ) &&
  25840. // parseFloat NaNs numeric-cast false positives ("")
  25841. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  25842. // subtraction forces infinities to NaN
  25843. !isNaN( obj - parseFloat( obj ) );
  25844. };
  25845. jQuery.trim = function( text ) {
  25846. return text == null ?
  25847. "" :
  25848. ( text + "" ).replace( rtrim, "" );
  25849. };
  25850. // Register as a named AMD module, since jQuery can be concatenated with other
  25851. // files that may use define, but not via a proper concatenation script that
  25852. // understands anonymous AMD modules. A named AMD is safest and most robust
  25853. // way to register. Lowercase jquery is used because AMD module names are
  25854. // derived from file names, and jQuery is normally delivered in a lowercase
  25855. // file name. Do this after creating the global so that if an AMD module wants
  25856. // to call noConflict to hide this version of jQuery, it will work.
  25857. // Note that for maximum portability, libraries that are not jQuery should
  25858. // declare themselves as anonymous modules, and avoid setting a global if an
  25859. // AMD loader is present. jQuery is a special case. For more information, see
  25860. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  25861. if ( true ) {
  25862. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  25863. return jQuery;
  25864. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  25865. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  25866. }
  25867. var
  25868. // Map over jQuery in case of overwrite
  25869. _jQuery = window.jQuery,
  25870. // Map over the $ in case of overwrite
  25871. _$ = window.$;
  25872. jQuery.noConflict = function( deep ) {
  25873. if ( window.$ === jQuery ) {
  25874. window.$ = _$;
  25875. }
  25876. if ( deep && window.jQuery === jQuery ) {
  25877. window.jQuery = _jQuery;
  25878. }
  25879. return jQuery;
  25880. };
  25881. // Expose jQuery and $ identifiers, even in AMD
  25882. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  25883. // and CommonJS for browser emulators (#13566)
  25884. if ( typeof noGlobal === "undefined" ) {
  25885. window.jQuery = window.$ = jQuery;
  25886. }
  25887. return jQuery;
  25888. } );
  25889. /***/ }),
  25890. /* 15 */
  25891. /***/ (function(module, exports) {
  25892. /*!
  25893. * Bootstrap v3.4.1 (https://getbootstrap.com/)
  25894. * Copyright 2011-2019 Twitter, Inc.
  25895. * Licensed under the MIT license
  25896. */
  25897. if (typeof jQuery === 'undefined') {
  25898. throw new Error('Bootstrap\'s JavaScript requires jQuery')
  25899. }
  25900. +function ($) {
  25901. 'use strict';
  25902. var version = $.fn.jquery.split(' ')[0].split('.')
  25903. if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) {
  25904. throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4')
  25905. }
  25906. }(jQuery);
  25907. /* ========================================================================
  25908. * Bootstrap: transition.js v3.4.1
  25909. * https://getbootstrap.com/docs/3.4/javascript/#transitions
  25910. * ========================================================================
  25911. * Copyright 2011-2019 Twitter, Inc.
  25912. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25913. * ======================================================================== */
  25914. +function ($) {
  25915. 'use strict';
  25916. // CSS TRANSITION SUPPORT (Shoutout: https://modernizr.com/)
  25917. // ============================================================
  25918. function transitionEnd() {
  25919. var el = document.createElement('bootstrap')
  25920. var transEndEventNames = {
  25921. WebkitTransition : 'webkitTransitionEnd',
  25922. MozTransition : 'transitionend',
  25923. OTransition : 'oTransitionEnd otransitionend',
  25924. transition : 'transitionend'
  25925. }
  25926. for (var name in transEndEventNames) {
  25927. if (el.style[name] !== undefined) {
  25928. return { end: transEndEventNames[name] }
  25929. }
  25930. }
  25931. return false // explicit for ie8 ( ._.)
  25932. }
  25933. // https://blog.alexmaccaw.com/css-transitions
  25934. $.fn.emulateTransitionEnd = function (duration) {
  25935. var called = false
  25936. var $el = this
  25937. $(this).one('bsTransitionEnd', function () { called = true })
  25938. var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
  25939. setTimeout(callback, duration)
  25940. return this
  25941. }
  25942. $(function () {
  25943. $.support.transition = transitionEnd()
  25944. if (!$.support.transition) return
  25945. $.event.special.bsTransitionEnd = {
  25946. bindType: $.support.transition.end,
  25947. delegateType: $.support.transition.end,
  25948. handle: function (e) {
  25949. if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
  25950. }
  25951. }
  25952. })
  25953. }(jQuery);
  25954. /* ========================================================================
  25955. * Bootstrap: alert.js v3.4.1
  25956. * https://getbootstrap.com/docs/3.4/javascript/#alerts
  25957. * ========================================================================
  25958. * Copyright 2011-2019 Twitter, Inc.
  25959. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25960. * ======================================================================== */
  25961. +function ($) {
  25962. 'use strict';
  25963. // ALERT CLASS DEFINITION
  25964. // ======================
  25965. var dismiss = '[data-dismiss="alert"]'
  25966. var Alert = function (el) {
  25967. $(el).on('click', dismiss, this.close)
  25968. }
  25969. Alert.VERSION = '3.4.1'
  25970. Alert.TRANSITION_DURATION = 150
  25971. Alert.prototype.close = function (e) {
  25972. var $this = $(this)
  25973. var selector = $this.attr('data-target')
  25974. if (!selector) {
  25975. selector = $this.attr('href')
  25976. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  25977. }
  25978. selector = selector === '#' ? [] : selector
  25979. var $parent = $(document).find(selector)
  25980. if (e) e.preventDefault()
  25981. if (!$parent.length) {
  25982. $parent = $this.closest('.alert')
  25983. }
  25984. $parent.trigger(e = $.Event('close.bs.alert'))
  25985. if (e.isDefaultPrevented()) return
  25986. $parent.removeClass('in')
  25987. function removeElement() {
  25988. // detach from parent, fire event then clean up data
  25989. $parent.detach().trigger('closed.bs.alert').remove()
  25990. }
  25991. $.support.transition && $parent.hasClass('fade') ?
  25992. $parent
  25993. .one('bsTransitionEnd', removeElement)
  25994. .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
  25995. removeElement()
  25996. }
  25997. // ALERT PLUGIN DEFINITION
  25998. // =======================
  25999. function Plugin(option) {
  26000. return this.each(function () {
  26001. var $this = $(this)
  26002. var data = $this.data('bs.alert')
  26003. if (!data) $this.data('bs.alert', (data = new Alert(this)))
  26004. if (typeof option == 'string') data[option].call($this)
  26005. })
  26006. }
  26007. var old = $.fn.alert
  26008. $.fn.alert = Plugin
  26009. $.fn.alert.Constructor = Alert
  26010. // ALERT NO CONFLICT
  26011. // =================
  26012. $.fn.alert.noConflict = function () {
  26013. $.fn.alert = old
  26014. return this
  26015. }
  26016. // ALERT DATA-API
  26017. // ==============
  26018. $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
  26019. }(jQuery);
  26020. /* ========================================================================
  26021. * Bootstrap: button.js v3.4.1
  26022. * https://getbootstrap.com/docs/3.4/javascript/#buttons
  26023. * ========================================================================
  26024. * Copyright 2011-2019 Twitter, Inc.
  26025. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26026. * ======================================================================== */
  26027. +function ($) {
  26028. 'use strict';
  26029. // BUTTON PUBLIC CLASS DEFINITION
  26030. // ==============================
  26031. var Button = function (element, options) {
  26032. this.$element = $(element)
  26033. this.options = $.extend({}, Button.DEFAULTS, options)
  26034. this.isLoading = false
  26035. }
  26036. Button.VERSION = '3.4.1'
  26037. Button.DEFAULTS = {
  26038. loadingText: 'loading...'
  26039. }
  26040. Button.prototype.setState = function (state) {
  26041. var d = 'disabled'
  26042. var $el = this.$element
  26043. var val = $el.is('input') ? 'val' : 'html'
  26044. var data = $el.data()
  26045. state += 'Text'
  26046. if (data.resetText == null) $el.data('resetText', $el[val]())
  26047. // push to event loop to allow forms to submit
  26048. setTimeout($.proxy(function () {
  26049. $el[val](data[state] == null ? this.options[state] : data[state])
  26050. if (state == 'loadingText') {
  26051. this.isLoading = true
  26052. $el.addClass(d).attr(d, d).prop(d, true)
  26053. } else if (this.isLoading) {
  26054. this.isLoading = false
  26055. $el.removeClass(d).removeAttr(d).prop(d, false)
  26056. }
  26057. }, this), 0)
  26058. }
  26059. Button.prototype.toggle = function () {
  26060. var changed = true
  26061. var $parent = this.$element.closest('[data-toggle="buttons"]')
  26062. if ($parent.length) {
  26063. var $input = this.$element.find('input')
  26064. if ($input.prop('type') == 'radio') {
  26065. if ($input.prop('checked')) changed = false
  26066. $parent.find('.active').removeClass('active')
  26067. this.$element.addClass('active')
  26068. } else if ($input.prop('type') == 'checkbox') {
  26069. if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
  26070. this.$element.toggleClass('active')
  26071. }
  26072. $input.prop('checked', this.$element.hasClass('active'))
  26073. if (changed) $input.trigger('change')
  26074. } else {
  26075. this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
  26076. this.$element.toggleClass('active')
  26077. }
  26078. }
  26079. // BUTTON PLUGIN DEFINITION
  26080. // ========================
  26081. function Plugin(option) {
  26082. return this.each(function () {
  26083. var $this = $(this)
  26084. var data = $this.data('bs.button')
  26085. var options = typeof option == 'object' && option
  26086. if (!data) $this.data('bs.button', (data = new Button(this, options)))
  26087. if (option == 'toggle') data.toggle()
  26088. else if (option) data.setState(option)
  26089. })
  26090. }
  26091. var old = $.fn.button
  26092. $.fn.button = Plugin
  26093. $.fn.button.Constructor = Button
  26094. // BUTTON NO CONFLICT
  26095. // ==================
  26096. $.fn.button.noConflict = function () {
  26097. $.fn.button = old
  26098. return this
  26099. }
  26100. // BUTTON DATA-API
  26101. // ===============
  26102. $(document)
  26103. .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  26104. var $btn = $(e.target).closest('.btn')
  26105. Plugin.call($btn, 'toggle')
  26106. if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
  26107. // Prevent double click on radios, and the double selections (so cancellation) on checkboxes
  26108. e.preventDefault()
  26109. // The target component still receive the focus
  26110. if ($btn.is('input,button')) $btn.trigger('focus')
  26111. else $btn.find('input:visible,button:visible').first().trigger('focus')
  26112. }
  26113. })
  26114. .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
  26115. $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
  26116. })
  26117. }(jQuery);
  26118. /* ========================================================================
  26119. * Bootstrap: carousel.js v3.4.1
  26120. * https://getbootstrap.com/docs/3.4/javascript/#carousel
  26121. * ========================================================================
  26122. * Copyright 2011-2019 Twitter, Inc.
  26123. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26124. * ======================================================================== */
  26125. +function ($) {
  26126. 'use strict';
  26127. // CAROUSEL CLASS DEFINITION
  26128. // =========================
  26129. var Carousel = function (element, options) {
  26130. this.$element = $(element)
  26131. this.$indicators = this.$element.find('.carousel-indicators')
  26132. this.options = options
  26133. this.paused = null
  26134. this.sliding = null
  26135. this.interval = null
  26136. this.$active = null
  26137. this.$items = null
  26138. this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
  26139. this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
  26140. .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
  26141. .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
  26142. }
  26143. Carousel.VERSION = '3.4.1'
  26144. Carousel.TRANSITION_DURATION = 600
  26145. Carousel.DEFAULTS = {
  26146. interval: 5000,
  26147. pause: 'hover',
  26148. wrap: true,
  26149. keyboard: true
  26150. }
  26151. Carousel.prototype.keydown = function (e) {
  26152. if (/input|textarea/i.test(e.target.tagName)) return
  26153. switch (e.which) {
  26154. case 37: this.prev(); break
  26155. case 39: this.next(); break
  26156. default: return
  26157. }
  26158. e.preventDefault()
  26159. }
  26160. Carousel.prototype.cycle = function (e) {
  26161. e || (this.paused = false)
  26162. this.interval && clearInterval(this.interval)
  26163. this.options.interval
  26164. && !this.paused
  26165. && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
  26166. return this
  26167. }
  26168. Carousel.prototype.getItemIndex = function (item) {
  26169. this.$items = item.parent().children('.item')
  26170. return this.$items.index(item || this.$active)
  26171. }
  26172. Carousel.prototype.getItemForDirection = function (direction, active) {
  26173. var activeIndex = this.getItemIndex(active)
  26174. var willWrap = (direction == 'prev' && activeIndex === 0)
  26175. || (direction == 'next' && activeIndex == (this.$items.length - 1))
  26176. if (willWrap && !this.options.wrap) return active
  26177. var delta = direction == 'prev' ? -1 : 1
  26178. var itemIndex = (activeIndex + delta) % this.$items.length
  26179. return this.$items.eq(itemIndex)
  26180. }
  26181. Carousel.prototype.to = function (pos) {
  26182. var that = this
  26183. var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
  26184. if (pos > (this.$items.length - 1) || pos < 0) return
  26185. if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
  26186. if (activeIndex == pos) return this.pause().cycle()
  26187. return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
  26188. }
  26189. Carousel.prototype.pause = function (e) {
  26190. e || (this.paused = true)
  26191. if (this.$element.find('.next, .prev').length && $.support.transition) {
  26192. this.$element.trigger($.support.transition.end)
  26193. this.cycle(true)
  26194. }
  26195. this.interval = clearInterval(this.interval)
  26196. return this
  26197. }
  26198. Carousel.prototype.next = function () {
  26199. if (this.sliding) return
  26200. return this.slide('next')
  26201. }
  26202. Carousel.prototype.prev = function () {
  26203. if (this.sliding) return
  26204. return this.slide('prev')
  26205. }
  26206. Carousel.prototype.slide = function (type, next) {
  26207. var $active = this.$element.find('.item.active')
  26208. var $next = next || this.getItemForDirection(type, $active)
  26209. var isCycling = this.interval
  26210. var direction = type == 'next' ? 'left' : 'right'
  26211. var that = this
  26212. if ($next.hasClass('active')) return (this.sliding = false)
  26213. var relatedTarget = $next[0]
  26214. var slideEvent = $.Event('slide.bs.carousel', {
  26215. relatedTarget: relatedTarget,
  26216. direction: direction
  26217. })
  26218. this.$element.trigger(slideEvent)
  26219. if (slideEvent.isDefaultPrevented()) return
  26220. this.sliding = true
  26221. isCycling && this.pause()
  26222. if (this.$indicators.length) {
  26223. this.$indicators.find('.active').removeClass('active')
  26224. var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
  26225. $nextIndicator && $nextIndicator.addClass('active')
  26226. }
  26227. var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
  26228. if ($.support.transition && this.$element.hasClass('slide')) {
  26229. $next.addClass(type)
  26230. if (typeof $next === 'object' && $next.length) {
  26231. $next[0].offsetWidth // force reflow
  26232. }
  26233. $active.addClass(direction)
  26234. $next.addClass(direction)
  26235. $active
  26236. .one('bsTransitionEnd', function () {
  26237. $next.removeClass([type, direction].join(' ')).addClass('active')
  26238. $active.removeClass(['active', direction].join(' '))
  26239. that.sliding = false
  26240. setTimeout(function () {
  26241. that.$element.trigger(slidEvent)
  26242. }, 0)
  26243. })
  26244. .emulateTransitionEnd(Carousel.TRANSITION_DURATION)
  26245. } else {
  26246. $active.removeClass('active')
  26247. $next.addClass('active')
  26248. this.sliding = false
  26249. this.$element.trigger(slidEvent)
  26250. }
  26251. isCycling && this.cycle()
  26252. return this
  26253. }
  26254. // CAROUSEL PLUGIN DEFINITION
  26255. // ==========================
  26256. function Plugin(option) {
  26257. return this.each(function () {
  26258. var $this = $(this)
  26259. var data = $this.data('bs.carousel')
  26260. var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
  26261. var action = typeof option == 'string' ? option : options.slide
  26262. if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
  26263. if (typeof option == 'number') data.to(option)
  26264. else if (action) data[action]()
  26265. else if (options.interval) data.pause().cycle()
  26266. })
  26267. }
  26268. var old = $.fn.carousel
  26269. $.fn.carousel = Plugin
  26270. $.fn.carousel.Constructor = Carousel
  26271. // CAROUSEL NO CONFLICT
  26272. // ====================
  26273. $.fn.carousel.noConflict = function () {
  26274. $.fn.carousel = old
  26275. return this
  26276. }
  26277. // CAROUSEL DATA-API
  26278. // =================
  26279. var clickHandler = function (e) {
  26280. var $this = $(this)
  26281. var href = $this.attr('href')
  26282. if (href) {
  26283. href = href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
  26284. }
  26285. var target = $this.attr('data-target') || href
  26286. var $target = $(document).find(target)
  26287. if (!$target.hasClass('carousel')) return
  26288. var options = $.extend({}, $target.data(), $this.data())
  26289. var slideIndex = $this.attr('data-slide-to')
  26290. if (slideIndex) options.interval = false
  26291. Plugin.call($target, options)
  26292. if (slideIndex) {
  26293. $target.data('bs.carousel').to(slideIndex)
  26294. }
  26295. e.preventDefault()
  26296. }
  26297. $(document)
  26298. .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
  26299. .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
  26300. $(window).on('load', function () {
  26301. $('[data-ride="carousel"]').each(function () {
  26302. var $carousel = $(this)
  26303. Plugin.call($carousel, $carousel.data())
  26304. })
  26305. })
  26306. }(jQuery);
  26307. /* ========================================================================
  26308. * Bootstrap: collapse.js v3.4.1
  26309. * https://getbootstrap.com/docs/3.4/javascript/#collapse
  26310. * ========================================================================
  26311. * Copyright 2011-2019 Twitter, Inc.
  26312. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26313. * ======================================================================== */
  26314. /* jshint latedef: false */
  26315. +function ($) {
  26316. 'use strict';
  26317. // COLLAPSE PUBLIC CLASS DEFINITION
  26318. // ================================
  26319. var Collapse = function (element, options) {
  26320. this.$element = $(element)
  26321. this.options = $.extend({}, Collapse.DEFAULTS, options)
  26322. this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
  26323. '[data-toggle="collapse"][data-target="#' + element.id + '"]')
  26324. this.transitioning = null
  26325. if (this.options.parent) {
  26326. this.$parent = this.getParent()
  26327. } else {
  26328. this.addAriaAndCollapsedClass(this.$element, this.$trigger)
  26329. }
  26330. if (this.options.toggle) this.toggle()
  26331. }
  26332. Collapse.VERSION = '3.4.1'
  26333. Collapse.TRANSITION_DURATION = 350
  26334. Collapse.DEFAULTS = {
  26335. toggle: true
  26336. }
  26337. Collapse.prototype.dimension = function () {
  26338. var hasWidth = this.$element.hasClass('width')
  26339. return hasWidth ? 'width' : 'height'
  26340. }
  26341. Collapse.prototype.show = function () {
  26342. if (this.transitioning || this.$element.hasClass('in')) return
  26343. var activesData
  26344. var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
  26345. if (actives && actives.length) {
  26346. activesData = actives.data('bs.collapse')
  26347. if (activesData && activesData.transitioning) return
  26348. }
  26349. var startEvent = $.Event('show.bs.collapse')
  26350. this.$element.trigger(startEvent)
  26351. if (startEvent.isDefaultPrevented()) return
  26352. if (actives && actives.length) {
  26353. Plugin.call(actives, 'hide')
  26354. activesData || actives.data('bs.collapse', null)
  26355. }
  26356. var dimension = this.dimension()
  26357. this.$element
  26358. .removeClass('collapse')
  26359. .addClass('collapsing')[dimension](0)
  26360. .attr('aria-expanded', true)
  26361. this.$trigger
  26362. .removeClass('collapsed')
  26363. .attr('aria-expanded', true)
  26364. this.transitioning = 1
  26365. var complete = function () {
  26366. this.$element
  26367. .removeClass('collapsing')
  26368. .addClass('collapse in')[dimension]('')
  26369. this.transitioning = 0
  26370. this.$element
  26371. .trigger('shown.bs.collapse')
  26372. }
  26373. if (!$.support.transition) return complete.call(this)
  26374. var scrollSize = $.camelCase(['scroll', dimension].join('-'))
  26375. this.$element
  26376. .one('bsTransitionEnd', $.proxy(complete, this))
  26377. .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
  26378. }
  26379. Collapse.prototype.hide = function () {
  26380. if (this.transitioning || !this.$element.hasClass('in')) return
  26381. var startEvent = $.Event('hide.bs.collapse')
  26382. this.$element.trigger(startEvent)
  26383. if (startEvent.isDefaultPrevented()) return
  26384. var dimension = this.dimension()
  26385. this.$element[dimension](this.$element[dimension]())[0].offsetHeight
  26386. this.$element
  26387. .addClass('collapsing')
  26388. .removeClass('collapse in')
  26389. .attr('aria-expanded', false)
  26390. this.$trigger
  26391. .addClass('collapsed')
  26392. .attr('aria-expanded', false)
  26393. this.transitioning = 1
  26394. var complete = function () {
  26395. this.transitioning = 0
  26396. this.$element
  26397. .removeClass('collapsing')
  26398. .addClass('collapse')
  26399. .trigger('hidden.bs.collapse')
  26400. }
  26401. if (!$.support.transition) return complete.call(this)
  26402. this.$element
  26403. [dimension](0)
  26404. .one('bsTransitionEnd', $.proxy(complete, this))
  26405. .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
  26406. }
  26407. Collapse.prototype.toggle = function () {
  26408. this[this.$element.hasClass('in') ? 'hide' : 'show']()
  26409. }
  26410. Collapse.prototype.getParent = function () {
  26411. return $(document).find(this.options.parent)
  26412. .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
  26413. .each($.proxy(function (i, element) {
  26414. var $element = $(element)
  26415. this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
  26416. }, this))
  26417. .end()
  26418. }
  26419. Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
  26420. var isOpen = $element.hasClass('in')
  26421. $element.attr('aria-expanded', isOpen)
  26422. $trigger
  26423. .toggleClass('collapsed', !isOpen)
  26424. .attr('aria-expanded', isOpen)
  26425. }
  26426. function getTargetFromTrigger($trigger) {
  26427. var href
  26428. var target = $trigger.attr('data-target')
  26429. || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
  26430. return $(document).find(target)
  26431. }
  26432. // COLLAPSE PLUGIN DEFINITION
  26433. // ==========================
  26434. function Plugin(option) {
  26435. return this.each(function () {
  26436. var $this = $(this)
  26437. var data = $this.data('bs.collapse')
  26438. var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
  26439. if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
  26440. if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
  26441. if (typeof option == 'string') data[option]()
  26442. })
  26443. }
  26444. var old = $.fn.collapse
  26445. $.fn.collapse = Plugin
  26446. $.fn.collapse.Constructor = Collapse
  26447. // COLLAPSE NO CONFLICT
  26448. // ====================
  26449. $.fn.collapse.noConflict = function () {
  26450. $.fn.collapse = old
  26451. return this
  26452. }
  26453. // COLLAPSE DATA-API
  26454. // =================
  26455. $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
  26456. var $this = $(this)
  26457. if (!$this.attr('data-target')) e.preventDefault()
  26458. var $target = getTargetFromTrigger($this)
  26459. var data = $target.data('bs.collapse')
  26460. var option = data ? 'toggle' : $this.data()
  26461. Plugin.call($target, option)
  26462. })
  26463. }(jQuery);
  26464. /* ========================================================================
  26465. * Bootstrap: dropdown.js v3.4.1
  26466. * https://getbootstrap.com/docs/3.4/javascript/#dropdowns
  26467. * ========================================================================
  26468. * Copyright 2011-2019 Twitter, Inc.
  26469. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26470. * ======================================================================== */
  26471. +function ($) {
  26472. 'use strict';
  26473. // DROPDOWN CLASS DEFINITION
  26474. // =========================
  26475. var backdrop = '.dropdown-backdrop'
  26476. var toggle = '[data-toggle="dropdown"]'
  26477. var Dropdown = function (element) {
  26478. $(element).on('click.bs.dropdown', this.toggle)
  26479. }
  26480. Dropdown.VERSION = '3.4.1'
  26481. function getParent($this) {
  26482. var selector = $this.attr('data-target')
  26483. if (!selector) {
  26484. selector = $this.attr('href')
  26485. selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  26486. }
  26487. var $parent = selector !== '#' ? $(document).find(selector) : null
  26488. return $parent && $parent.length ? $parent : $this.parent()
  26489. }
  26490. function clearMenus(e) {
  26491. if (e && e.which === 3) return
  26492. $(backdrop).remove()
  26493. $(toggle).each(function () {
  26494. var $this = $(this)
  26495. var $parent = getParent($this)
  26496. var relatedTarget = { relatedTarget: this }
  26497. if (!$parent.hasClass('open')) return
  26498. if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
  26499. $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
  26500. if (e.isDefaultPrevented()) return
  26501. $this.attr('aria-expanded', 'false')
  26502. $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
  26503. })
  26504. }
  26505. Dropdown.prototype.toggle = function (e) {
  26506. var $this = $(this)
  26507. if ($this.is('.disabled, :disabled')) return
  26508. var $parent = getParent($this)
  26509. var isActive = $parent.hasClass('open')
  26510. clearMenus()
  26511. if (!isActive) {
  26512. if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
  26513. // if mobile we use a backdrop because click events don't delegate
  26514. $(document.createElement('div'))
  26515. .addClass('dropdown-backdrop')
  26516. .insertAfter($(this))
  26517. .on('click', clearMenus)
  26518. }
  26519. var relatedTarget = { relatedTarget: this }
  26520. $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
  26521. if (e.isDefaultPrevented()) return
  26522. $this
  26523. .trigger('focus')
  26524. .attr('aria-expanded', 'true')
  26525. $parent
  26526. .toggleClass('open')
  26527. .trigger($.Event('shown.bs.dropdown', relatedTarget))
  26528. }
  26529. return false
  26530. }
  26531. Dropdown.prototype.keydown = function (e) {
  26532. if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
  26533. var $this = $(this)
  26534. e.preventDefault()
  26535. e.stopPropagation()
  26536. if ($this.is('.disabled, :disabled')) return
  26537. var $parent = getParent($this)
  26538. var isActive = $parent.hasClass('open')
  26539. if (!isActive && e.which != 27 || isActive && e.which == 27) {
  26540. if (e.which == 27) $parent.find(toggle).trigger('focus')
  26541. return $this.trigger('click')
  26542. }
  26543. var desc = ' li:not(.disabled):visible a'
  26544. var $items = $parent.find('.dropdown-menu' + desc)
  26545. if (!$items.length) return
  26546. var index = $items.index(e.target)
  26547. if (e.which == 38 && index > 0) index-- // up
  26548. if (e.which == 40 && index < $items.length - 1) index++ // down
  26549. if (!~index) index = 0
  26550. $items.eq(index).trigger('focus')
  26551. }
  26552. // DROPDOWN PLUGIN DEFINITION
  26553. // ==========================
  26554. function Plugin(option) {
  26555. return this.each(function () {
  26556. var $this = $(this)
  26557. var data = $this.data('bs.dropdown')
  26558. if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
  26559. if (typeof option == 'string') data[option].call($this)
  26560. })
  26561. }
  26562. var old = $.fn.dropdown
  26563. $.fn.dropdown = Plugin
  26564. $.fn.dropdown.Constructor = Dropdown
  26565. // DROPDOWN NO CONFLICT
  26566. // ====================
  26567. $.fn.dropdown.noConflict = function () {
  26568. $.fn.dropdown = old
  26569. return this
  26570. }
  26571. // APPLY TO STANDARD DROPDOWN ELEMENTS
  26572. // ===================================
  26573. $(document)
  26574. .on('click.bs.dropdown.data-api', clearMenus)
  26575. .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
  26576. .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
  26577. .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
  26578. .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
  26579. }(jQuery);
  26580. /* ========================================================================
  26581. * Bootstrap: modal.js v3.4.1
  26582. * https://getbootstrap.com/docs/3.4/javascript/#modals
  26583. * ========================================================================
  26584. * Copyright 2011-2019 Twitter, Inc.
  26585. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26586. * ======================================================================== */
  26587. +function ($) {
  26588. 'use strict';
  26589. // MODAL CLASS DEFINITION
  26590. // ======================
  26591. var Modal = function (element, options) {
  26592. this.options = options
  26593. this.$body = $(document.body)
  26594. this.$element = $(element)
  26595. this.$dialog = this.$element.find('.modal-dialog')
  26596. this.$backdrop = null
  26597. this.isShown = null
  26598. this.originalBodyPad = null
  26599. this.scrollbarWidth = 0
  26600. this.ignoreBackdropClick = false
  26601. this.fixedContent = '.navbar-fixed-top, .navbar-fixed-bottom'
  26602. if (this.options.remote) {
  26603. this.$element
  26604. .find('.modal-content')
  26605. .load(this.options.remote, $.proxy(function () {
  26606. this.$element.trigger('loaded.bs.modal')
  26607. }, this))
  26608. }
  26609. }
  26610. Modal.VERSION = '3.4.1'
  26611. Modal.TRANSITION_DURATION = 300
  26612. Modal.BACKDROP_TRANSITION_DURATION = 150
  26613. Modal.DEFAULTS = {
  26614. backdrop: true,
  26615. keyboard: true,
  26616. show: true
  26617. }
  26618. Modal.prototype.toggle = function (_relatedTarget) {
  26619. return this.isShown ? this.hide() : this.show(_relatedTarget)
  26620. }
  26621. Modal.prototype.show = function (_relatedTarget) {
  26622. var that = this
  26623. var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
  26624. this.$element.trigger(e)
  26625. if (this.isShown || e.isDefaultPrevented()) return
  26626. this.isShown = true
  26627. this.checkScrollbar()
  26628. this.setScrollbar()
  26629. this.$body.addClass('modal-open')
  26630. this.escape()
  26631. this.resize()
  26632. this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
  26633. this.$dialog.on('mousedown.dismiss.bs.modal', function () {
  26634. that.$element.one('mouseup.dismiss.bs.modal', function (e) {
  26635. if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
  26636. })
  26637. })
  26638. this.backdrop(function () {
  26639. var transition = $.support.transition && that.$element.hasClass('fade')
  26640. if (!that.$element.parent().length) {
  26641. that.$element.appendTo(that.$body) // don't move modals dom position
  26642. }
  26643. that.$element
  26644. .show()
  26645. .scrollTop(0)
  26646. that.adjustDialog()
  26647. if (transition) {
  26648. that.$element[0].offsetWidth // force reflow
  26649. }
  26650. that.$element.addClass('in')
  26651. that.enforceFocus()
  26652. var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
  26653. transition ?
  26654. that.$dialog // wait for modal to slide in
  26655. .one('bsTransitionEnd', function () {
  26656. that.$element.trigger('focus').trigger(e)
  26657. })
  26658. .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
  26659. that.$element.trigger('focus').trigger(e)
  26660. })
  26661. }
  26662. Modal.prototype.hide = function (e) {
  26663. if (e) e.preventDefault()
  26664. e = $.Event('hide.bs.modal')
  26665. this.$element.trigger(e)
  26666. if (!this.isShown || e.isDefaultPrevented()) return
  26667. this.isShown = false
  26668. this.escape()
  26669. this.resize()
  26670. $(document).off('focusin.bs.modal')
  26671. this.$element
  26672. .removeClass('in')
  26673. .off('click.dismiss.bs.modal')
  26674. .off('mouseup.dismiss.bs.modal')
  26675. this.$dialog.off('mousedown.dismiss.bs.modal')
  26676. $.support.transition && this.$element.hasClass('fade') ?
  26677. this.$element
  26678. .one('bsTransitionEnd', $.proxy(this.hideModal, this))
  26679. .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
  26680. this.hideModal()
  26681. }
  26682. Modal.prototype.enforceFocus = function () {
  26683. $(document)
  26684. .off('focusin.bs.modal') // guard against infinite focus loop
  26685. .on('focusin.bs.modal', $.proxy(function (e) {
  26686. if (document !== e.target &&
  26687. this.$element[0] !== e.target &&
  26688. !this.$element.has(e.target).length) {
  26689. this.$element.trigger('focus')
  26690. }
  26691. }, this))
  26692. }
  26693. Modal.prototype.escape = function () {
  26694. if (this.isShown && this.options.keyboard) {
  26695. this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
  26696. e.which == 27 && this.hide()
  26697. }, this))
  26698. } else if (!this.isShown) {
  26699. this.$element.off('keydown.dismiss.bs.modal')
  26700. }
  26701. }
  26702. Modal.prototype.resize = function () {
  26703. if (this.isShown) {
  26704. $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
  26705. } else {
  26706. $(window).off('resize.bs.modal')
  26707. }
  26708. }
  26709. Modal.prototype.hideModal = function () {
  26710. var that = this
  26711. this.$element.hide()
  26712. this.backdrop(function () {
  26713. that.$body.removeClass('modal-open')
  26714. that.resetAdjustments()
  26715. that.resetScrollbar()
  26716. that.$element.trigger('hidden.bs.modal')
  26717. })
  26718. }
  26719. Modal.prototype.removeBackdrop = function () {
  26720. this.$backdrop && this.$backdrop.remove()
  26721. this.$backdrop = null
  26722. }
  26723. Modal.prototype.backdrop = function (callback) {
  26724. var that = this
  26725. var animate = this.$element.hasClass('fade') ? 'fade' : ''
  26726. if (this.isShown && this.options.backdrop) {
  26727. var doAnimate = $.support.transition && animate
  26728. this.$backdrop = $(document.createElement('div'))
  26729. .addClass('modal-backdrop ' + animate)
  26730. .appendTo(this.$body)
  26731. this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
  26732. if (this.ignoreBackdropClick) {
  26733. this.ignoreBackdropClick = false
  26734. return
  26735. }
  26736. if (e.target !== e.currentTarget) return
  26737. this.options.backdrop == 'static'
  26738. ? this.$element[0].focus()
  26739. : this.hide()
  26740. }, this))
  26741. if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
  26742. this.$backdrop.addClass('in')
  26743. if (!callback) return
  26744. doAnimate ?
  26745. this.$backdrop
  26746. .one('bsTransitionEnd', callback)
  26747. .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
  26748. callback()
  26749. } else if (!this.isShown && this.$backdrop) {
  26750. this.$backdrop.removeClass('in')
  26751. var callbackRemove = function () {
  26752. that.removeBackdrop()
  26753. callback && callback()
  26754. }
  26755. $.support.transition && this.$element.hasClass('fade') ?
  26756. this.$backdrop
  26757. .one('bsTransitionEnd', callbackRemove)
  26758. .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
  26759. callbackRemove()
  26760. } else if (callback) {
  26761. callback()
  26762. }
  26763. }
  26764. // these following methods are used to handle overflowing modals
  26765. Modal.prototype.handleUpdate = function () {
  26766. this.adjustDialog()
  26767. }
  26768. Modal.prototype.adjustDialog = function () {
  26769. var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
  26770. this.$element.css({
  26771. paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
  26772. paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
  26773. })
  26774. }
  26775. Modal.prototype.resetAdjustments = function () {
  26776. this.$element.css({
  26777. paddingLeft: '',
  26778. paddingRight: ''
  26779. })
  26780. }
  26781. Modal.prototype.checkScrollbar = function () {
  26782. var fullWindowWidth = window.innerWidth
  26783. if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
  26784. var documentElementRect = document.documentElement.getBoundingClientRect()
  26785. fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
  26786. }
  26787. this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
  26788. this.scrollbarWidth = this.measureScrollbar()
  26789. }
  26790. Modal.prototype.setScrollbar = function () {
  26791. var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
  26792. this.originalBodyPad = document.body.style.paddingRight || ''
  26793. var scrollbarWidth = this.scrollbarWidth
  26794. if (this.bodyIsOverflowing) {
  26795. this.$body.css('padding-right', bodyPad + scrollbarWidth)
  26796. $(this.fixedContent).each(function (index, element) {
  26797. var actualPadding = element.style.paddingRight
  26798. var calculatedPadding = $(element).css('padding-right')
  26799. $(element)
  26800. .data('padding-right', actualPadding)
  26801. .css('padding-right', parseFloat(calculatedPadding) + scrollbarWidth + 'px')
  26802. })
  26803. }
  26804. }
  26805. Modal.prototype.resetScrollbar = function () {
  26806. this.$body.css('padding-right', this.originalBodyPad)
  26807. $(this.fixedContent).each(function (index, element) {
  26808. var padding = $(element).data('padding-right')
  26809. $(element).removeData('padding-right')
  26810. element.style.paddingRight = padding ? padding : ''
  26811. })
  26812. }
  26813. Modal.prototype.measureScrollbar = function () { // thx walsh
  26814. var scrollDiv = document.createElement('div')
  26815. scrollDiv.className = 'modal-scrollbar-measure'
  26816. this.$body.append(scrollDiv)
  26817. var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
  26818. this.$body[0].removeChild(scrollDiv)
  26819. return scrollbarWidth
  26820. }
  26821. // MODAL PLUGIN DEFINITION
  26822. // =======================
  26823. function Plugin(option, _relatedTarget) {
  26824. return this.each(function () {
  26825. var $this = $(this)
  26826. var data = $this.data('bs.modal')
  26827. var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
  26828. if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
  26829. if (typeof option == 'string') data[option](_relatedTarget)
  26830. else if (options.show) data.show(_relatedTarget)
  26831. })
  26832. }
  26833. var old = $.fn.modal
  26834. $.fn.modal = Plugin
  26835. $.fn.modal.Constructor = Modal
  26836. // MODAL NO CONFLICT
  26837. // =================
  26838. $.fn.modal.noConflict = function () {
  26839. $.fn.modal = old
  26840. return this
  26841. }
  26842. // MODAL DATA-API
  26843. // ==============
  26844. $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
  26845. var $this = $(this)
  26846. var href = $this.attr('href')
  26847. var target = $this.attr('data-target') ||
  26848. (href && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
  26849. var $target = $(document).find(target)
  26850. var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
  26851. if ($this.is('a')) e.preventDefault()
  26852. $target.one('show.bs.modal', function (showEvent) {
  26853. if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
  26854. $target.one('hidden.bs.modal', function () {
  26855. $this.is(':visible') && $this.trigger('focus')
  26856. })
  26857. })
  26858. Plugin.call($target, option, this)
  26859. })
  26860. }(jQuery);
  26861. /* ========================================================================
  26862. * Bootstrap: tooltip.js v3.4.1
  26863. * https://getbootstrap.com/docs/3.4/javascript/#tooltip
  26864. * Inspired by the original jQuery.tipsy by Jason Frame
  26865. * ========================================================================
  26866. * Copyright 2011-2019 Twitter, Inc.
  26867. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  26868. * ======================================================================== */
  26869. +function ($) {
  26870. 'use strict';
  26871. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']
  26872. var uriAttrs = [
  26873. 'background',
  26874. 'cite',
  26875. 'href',
  26876. 'itemtype',
  26877. 'longdesc',
  26878. 'poster',
  26879. 'src',
  26880. 'xlink:href'
  26881. ]
  26882. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i
  26883. var DefaultWhitelist = {
  26884. // Global attributes allowed on any supplied element below.
  26885. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  26886. a: ['target', 'href', 'title', 'rel'],
  26887. area: [],
  26888. b: [],
  26889. br: [],
  26890. col: [],
  26891. code: [],
  26892. div: [],
  26893. em: [],
  26894. hr: [],
  26895. h1: [],
  26896. h2: [],
  26897. h3: [],
  26898. h4: [],
  26899. h5: [],
  26900. h6: [],
  26901. i: [],
  26902. img: ['src', 'alt', 'title', 'width', 'height'],
  26903. li: [],
  26904. ol: [],
  26905. p: [],
  26906. pre: [],
  26907. s: [],
  26908. small: [],
  26909. span: [],
  26910. sub: [],
  26911. sup: [],
  26912. strong: [],
  26913. u: [],
  26914. ul: []
  26915. }
  26916. /**
  26917. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  26918. *
  26919. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  26920. */
  26921. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi
  26922. /**
  26923. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  26924. *
  26925. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  26926. */
  26927. var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i
  26928. function allowedAttribute(attr, allowedAttributeList) {
  26929. var attrName = attr.nodeName.toLowerCase()
  26930. if ($.inArray(attrName, allowedAttributeList) !== -1) {
  26931. if ($.inArray(attrName, uriAttrs) !== -1) {
  26932. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN))
  26933. }
  26934. return true
  26935. }
  26936. var regExp = $(allowedAttributeList).filter(function (index, value) {
  26937. return value instanceof RegExp
  26938. })
  26939. // Check if a regular expression validates the attribute.
  26940. for (var i = 0, l = regExp.length; i < l; i++) {
  26941. if (attrName.match(regExp[i])) {
  26942. return true
  26943. }
  26944. }
  26945. return false
  26946. }
  26947. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  26948. if (unsafeHtml.length === 0) {
  26949. return unsafeHtml
  26950. }
  26951. if (sanitizeFn && typeof sanitizeFn === 'function') {
  26952. return sanitizeFn(unsafeHtml)
  26953. }
  26954. // IE 8 and below don't support createHTMLDocument
  26955. if (!document.implementation || !document.implementation.createHTMLDocument) {
  26956. return unsafeHtml
  26957. }
  26958. var createdDocument = document.implementation.createHTMLDocument('sanitization')
  26959. createdDocument.body.innerHTML = unsafeHtml
  26960. var whitelistKeys = $.map(whiteList, function (el, i) { return i })
  26961. var elements = $(createdDocument.body).find('*')
  26962. for (var i = 0, len = elements.length; i < len; i++) {
  26963. var el = elements[i]
  26964. var elName = el.nodeName.toLowerCase()
  26965. if ($.inArray(elName, whitelistKeys) === -1) {
  26966. el.parentNode.removeChild(el)
  26967. continue
  26968. }
  26969. var attributeList = $.map(el.attributes, function (el) { return el })
  26970. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])
  26971. for (var j = 0, len2 = attributeList.length; j < len2; j++) {
  26972. if (!allowedAttribute(attributeList[j], whitelistedAttributes)) {
  26973. el.removeAttribute(attributeList[j].nodeName)
  26974. }
  26975. }
  26976. }
  26977. return createdDocument.body.innerHTML
  26978. }
  26979. // TOOLTIP PUBLIC CLASS DEFINITION
  26980. // ===============================
  26981. var Tooltip = function (element, options) {
  26982. this.type = null
  26983. this.options = null
  26984. this.enabled = null
  26985. this.timeout = null
  26986. this.hoverState = null
  26987. this.$element = null
  26988. this.inState = null
  26989. this.init('tooltip', element, options)
  26990. }
  26991. Tooltip.VERSION = '3.4.1'
  26992. Tooltip.TRANSITION_DURATION = 150
  26993. Tooltip.DEFAULTS = {
  26994. animation: true,
  26995. placement: 'top',
  26996. selector: false,
  26997. template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  26998. trigger: 'hover focus',
  26999. title: '',
  27000. delay: 0,
  27001. html: false,
  27002. container: false,
  27003. viewport: {
  27004. selector: 'body',
  27005. padding: 0
  27006. },
  27007. sanitize : true,
  27008. sanitizeFn : null,
  27009. whiteList : DefaultWhitelist
  27010. }
  27011. Tooltip.prototype.init = function (type, element, options) {
  27012. this.enabled = true
  27013. this.type = type
  27014. this.$element = $(element)
  27015. this.options = this.getOptions(options)
  27016. this.$viewport = this.options.viewport && $(document).find($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
  27017. this.inState = { click: false, hover: false, focus: false }
  27018. if (this.$element[0] instanceof document.constructor && !this.options.selector) {
  27019. throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
  27020. }
  27021. var triggers = this.options.trigger.split(' ')
  27022. for (var i = triggers.length; i--;) {
  27023. var trigger = triggers[i]
  27024. if (trigger == 'click') {
  27025. this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
  27026. } else if (trigger != 'manual') {
  27027. var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
  27028. var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
  27029. this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
  27030. this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
  27031. }
  27032. }
  27033. this.options.selector ?
  27034. (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
  27035. this.fixTitle()
  27036. }
  27037. Tooltip.prototype.getDefaults = function () {
  27038. return Tooltip.DEFAULTS
  27039. }
  27040. Tooltip.prototype.getOptions = function (options) {
  27041. var dataAttributes = this.$element.data()
  27042. for (var dataAttr in dataAttributes) {
  27043. if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) {
  27044. delete dataAttributes[dataAttr]
  27045. }
  27046. }
  27047. options = $.extend({}, this.getDefaults(), dataAttributes, options)
  27048. if (options.delay && typeof options.delay == 'number') {
  27049. options.delay = {
  27050. show: options.delay,
  27051. hide: options.delay
  27052. }
  27053. }
  27054. if (options.sanitize) {
  27055. options.template = sanitizeHtml(options.template, options.whiteList, options.sanitizeFn)
  27056. }
  27057. return options
  27058. }
  27059. Tooltip.prototype.getDelegateOptions = function () {
  27060. var options = {}
  27061. var defaults = this.getDefaults()
  27062. this._options && $.each(this._options, function (key, value) {
  27063. if (defaults[key] != value) options[key] = value
  27064. })
  27065. return options
  27066. }
  27067. Tooltip.prototype.enter = function (obj) {
  27068. var self = obj instanceof this.constructor ?
  27069. obj : $(obj.currentTarget).data('bs.' + this.type)
  27070. if (!self) {
  27071. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  27072. $(obj.currentTarget).data('bs.' + this.type, self)
  27073. }
  27074. if (obj instanceof $.Event) {
  27075. self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
  27076. }
  27077. if (self.tip().hasClass('in') || self.hoverState == 'in') {
  27078. self.hoverState = 'in'
  27079. return
  27080. }
  27081. clearTimeout(self.timeout)
  27082. self.hoverState = 'in'
  27083. if (!self.options.delay || !self.options.delay.show) return self.show()
  27084. self.timeout = setTimeout(function () {
  27085. if (self.hoverState == 'in') self.show()
  27086. }, self.options.delay.show)
  27087. }
  27088. Tooltip.prototype.isInStateTrue = function () {
  27089. for (var key in this.inState) {
  27090. if (this.inState[key]) return true
  27091. }
  27092. return false
  27093. }
  27094. Tooltip.prototype.leave = function (obj) {
  27095. var self = obj instanceof this.constructor ?
  27096. obj : $(obj.currentTarget).data('bs.' + this.type)
  27097. if (!self) {
  27098. self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
  27099. $(obj.currentTarget).data('bs.' + this.type, self)
  27100. }
  27101. if (obj instanceof $.Event) {
  27102. self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
  27103. }
  27104. if (self.isInStateTrue()) return
  27105. clearTimeout(self.timeout)
  27106. self.hoverState = 'out'
  27107. if (!self.options.delay || !self.options.delay.hide) return self.hide()
  27108. self.timeout = setTimeout(function () {
  27109. if (self.hoverState == 'out') self.hide()
  27110. }, self.options.delay.hide)
  27111. }
  27112. Tooltip.prototype.show = function () {
  27113. var e = $.Event('show.bs.' + this.type)
  27114. if (this.hasContent() && this.enabled) {
  27115. this.$element.trigger(e)
  27116. var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
  27117. if (e.isDefaultPrevented() || !inDom) return
  27118. var that = this
  27119. var $tip = this.tip()
  27120. var tipId = this.getUID(this.type)
  27121. this.setContent()
  27122. $tip.attr('id', tipId)
  27123. this.$element.attr('aria-describedby', tipId)
  27124. if (this.options.animation) $tip.addClass('fade')
  27125. var placement = typeof this.options.placement == 'function' ?
  27126. this.options.placement.call(this, $tip[0], this.$element[0]) :
  27127. this.options.placement
  27128. var autoToken = /\s?auto?\s?/i
  27129. var autoPlace = autoToken.test(placement)
  27130. if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
  27131. $tip
  27132. .detach()
  27133. .css({ top: 0, left: 0, display: 'block' })
  27134. .addClass(placement)
  27135. .data('bs.' + this.type, this)
  27136. this.options.container ? $tip.appendTo($(document).find(this.options.container)) : $tip.insertAfter(this.$element)
  27137. this.$element.trigger('inserted.bs.' + this.type)
  27138. var pos = this.getPosition()
  27139. var actualWidth = $tip[0].offsetWidth
  27140. var actualHeight = $tip[0].offsetHeight
  27141. if (autoPlace) {
  27142. var orgPlacement = placement
  27143. var viewportDim = this.getPosition(this.$viewport)
  27144. placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
  27145. placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
  27146. placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
  27147. placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
  27148. placement
  27149. $tip
  27150. .removeClass(orgPlacement)
  27151. .addClass(placement)
  27152. }
  27153. var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
  27154. this.applyPlacement(calculatedOffset, placement)
  27155. var complete = function () {
  27156. var prevHoverState = that.hoverState
  27157. that.$element.trigger('shown.bs.' + that.type)
  27158. that.hoverState = null
  27159. if (prevHoverState == 'out') that.leave(that)
  27160. }
  27161. $.support.transition && this.$tip.hasClass('fade') ?
  27162. $tip
  27163. .one('bsTransitionEnd', complete)
  27164. .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
  27165. complete()
  27166. }
  27167. }
  27168. Tooltip.prototype.applyPlacement = function (offset, placement) {
  27169. var $tip = this.tip()
  27170. var width = $tip[0].offsetWidth
  27171. var height = $tip[0].offsetHeight
  27172. // manually read margins because getBoundingClientRect includes difference
  27173. var marginTop = parseInt($tip.css('margin-top'), 10)
  27174. var marginLeft = parseInt($tip.css('margin-left'), 10)
  27175. // we must check for NaN for ie 8/9
  27176. if (isNaN(marginTop)) marginTop = 0
  27177. if (isNaN(marginLeft)) marginLeft = 0
  27178. offset.top += marginTop
  27179. offset.left += marginLeft
  27180. // $.fn.offset doesn't round pixel values
  27181. // so we use setOffset directly with our own function B-0
  27182. $.offset.setOffset($tip[0], $.extend({
  27183. using: function (props) {
  27184. $tip.css({
  27185. top: Math.round(props.top),
  27186. left: Math.round(props.left)
  27187. })
  27188. }
  27189. }, offset), 0)
  27190. $tip.addClass('in')
  27191. // check to see if placing tip in new offset caused the tip to resize itself
  27192. var actualWidth = $tip[0].offsetWidth
  27193. var actualHeight = $tip[0].offsetHeight
  27194. if (placement == 'top' && actualHeight != height) {
  27195. offset.top = offset.top + height - actualHeight
  27196. }
  27197. var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
  27198. if (delta.left) offset.left += delta.left
  27199. else offset.top += delta.top
  27200. var isVertical = /top|bottom/.test(placement)
  27201. var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
  27202. var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
  27203. $tip.offset(offset)
  27204. this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
  27205. }
  27206. Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
  27207. this.arrow()
  27208. .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
  27209. .css(isVertical ? 'top' : 'left', '')
  27210. }
  27211. Tooltip.prototype.setContent = function () {
  27212. var $tip = this.tip()
  27213. var title = this.getTitle()
  27214. if (this.options.html) {
  27215. if (this.options.sanitize) {
  27216. title = sanitizeHtml(title, this.options.whiteList, this.options.sanitizeFn)
  27217. }
  27218. $tip.find('.tooltip-inner').html(title)
  27219. } else {
  27220. $tip.find('.tooltip-inner').text(title)
  27221. }
  27222. $tip.removeClass('fade in top bottom left right')
  27223. }
  27224. Tooltip.prototype.hide = function (callback) {
  27225. var that = this
  27226. var $tip = $(this.$tip)
  27227. var e = $.Event('hide.bs.' + this.type)
  27228. function complete() {
  27229. if (that.hoverState != 'in') $tip.detach()
  27230. if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
  27231. that.$element
  27232. .removeAttr('aria-describedby')
  27233. .trigger('hidden.bs.' + that.type)
  27234. }
  27235. callback && callback()
  27236. }
  27237. this.$element.trigger(e)
  27238. if (e.isDefaultPrevented()) return
  27239. $tip.removeClass('in')
  27240. $.support.transition && $tip.hasClass('fade') ?
  27241. $tip
  27242. .one('bsTransitionEnd', complete)
  27243. .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
  27244. complete()
  27245. this.hoverState = null
  27246. return this
  27247. }
  27248. Tooltip.prototype.fixTitle = function () {
  27249. var $e = this.$element
  27250. if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
  27251. $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
  27252. }
  27253. }
  27254. Tooltip.prototype.hasContent = function () {
  27255. return this.getTitle()
  27256. }
  27257. Tooltip.prototype.getPosition = function ($element) {
  27258. $element = $element || this.$element
  27259. var el = $element[0]
  27260. var isBody = el.tagName == 'BODY'
  27261. var elRect = el.getBoundingClientRect()
  27262. if (elRect.width == null) {
  27263. // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
  27264. elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
  27265. }
  27266. var isSvg = window.SVGElement && el instanceof window.SVGElement
  27267. // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
  27268. // See https://github.com/twbs/bootstrap/issues/20280
  27269. var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
  27270. var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
  27271. var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
  27272. return $.extend({}, elRect, scroll, outerDims, elOffset)
  27273. }
  27274. Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
  27275. return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  27276. placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
  27277. placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
  27278. /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
  27279. }
  27280. Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
  27281. var delta = { top: 0, left: 0 }
  27282. if (!this.$viewport) return delta
  27283. var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
  27284. var viewportDimensions = this.getPosition(this.$viewport)
  27285. if (/right|left/.test(placement)) {
  27286. var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
  27287. var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
  27288. if (topEdgeOffset < viewportDimensions.top) { // top overflow
  27289. delta.top = viewportDimensions.top - topEdgeOffset
  27290. } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
  27291. delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
  27292. }
  27293. } else {
  27294. var leftEdgeOffset = pos.left - viewportPadding
  27295. var rightEdgeOffset = pos.left + viewportPadding + actualWidth
  27296. if (leftEdgeOffset < viewportDimensions.left) { // left overflow
  27297. delta.left = viewportDimensions.left - leftEdgeOffset
  27298. } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
  27299. delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
  27300. }
  27301. }
  27302. return delta
  27303. }
  27304. Tooltip.prototype.getTitle = function () {
  27305. var title
  27306. var $e = this.$element
  27307. var o = this.options
  27308. title = $e.attr('data-original-title')
  27309. || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
  27310. return title
  27311. }
  27312. Tooltip.prototype.getUID = function (prefix) {
  27313. do prefix += ~~(Math.random() * 1000000)
  27314. while (document.getElementById(prefix))
  27315. return prefix
  27316. }
  27317. Tooltip.prototype.tip = function () {
  27318. if (!this.$tip) {
  27319. this.$tip = $(this.options.template)
  27320. if (this.$tip.length != 1) {
  27321. throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
  27322. }
  27323. }
  27324. return this.$tip
  27325. }
  27326. Tooltip.prototype.arrow = function () {
  27327. return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
  27328. }
  27329. Tooltip.prototype.enable = function () {
  27330. this.enabled = true
  27331. }
  27332. Tooltip.prototype.disable = function () {
  27333. this.enabled = false
  27334. }
  27335. Tooltip.prototype.toggleEnabled = function () {
  27336. this.enabled = !this.enabled
  27337. }
  27338. Tooltip.prototype.toggle = function (e) {
  27339. var self = this
  27340. if (e) {
  27341. self = $(e.currentTarget).data('bs.' + this.type)
  27342. if (!self) {
  27343. self = new this.constructor(e.currentTarget, this.getDelegateOptions())
  27344. $(e.currentTarget).data('bs.' + this.type, self)
  27345. }
  27346. }
  27347. if (e) {
  27348. self.inState.click = !self.inState.click
  27349. if (self.isInStateTrue()) self.enter(self)
  27350. else self.leave(self)
  27351. } else {
  27352. self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
  27353. }
  27354. }
  27355. Tooltip.prototype.destroy = function () {
  27356. var that = this
  27357. clearTimeout(this.timeout)
  27358. this.hide(function () {
  27359. that.$element.off('.' + that.type).removeData('bs.' + that.type)
  27360. if (that.$tip) {
  27361. that.$tip.detach()
  27362. }
  27363. that.$tip = null
  27364. that.$arrow = null
  27365. that.$viewport = null
  27366. that.$element = null
  27367. })
  27368. }
  27369. Tooltip.prototype.sanitizeHtml = function (unsafeHtml) {
  27370. return sanitizeHtml(unsafeHtml, this.options.whiteList, this.options.sanitizeFn)
  27371. }
  27372. // TOOLTIP PLUGIN DEFINITION
  27373. // =========================
  27374. function Plugin(option) {
  27375. return this.each(function () {
  27376. var $this = $(this)
  27377. var data = $this.data('bs.tooltip')
  27378. var options = typeof option == 'object' && option
  27379. if (!data && /destroy|hide/.test(option)) return
  27380. if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
  27381. if (typeof option == 'string') data[option]()
  27382. })
  27383. }
  27384. var old = $.fn.tooltip
  27385. $.fn.tooltip = Plugin
  27386. $.fn.tooltip.Constructor = Tooltip
  27387. // TOOLTIP NO CONFLICT
  27388. // ===================
  27389. $.fn.tooltip.noConflict = function () {
  27390. $.fn.tooltip = old
  27391. return this
  27392. }
  27393. }(jQuery);
  27394. /* ========================================================================
  27395. * Bootstrap: popover.js v3.4.1
  27396. * https://getbootstrap.com/docs/3.4/javascript/#popovers
  27397. * ========================================================================
  27398. * Copyright 2011-2019 Twitter, Inc.
  27399. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  27400. * ======================================================================== */
  27401. +function ($) {
  27402. 'use strict';
  27403. // POPOVER PUBLIC CLASS DEFINITION
  27404. // ===============================
  27405. var Popover = function (element, options) {
  27406. this.init('popover', element, options)
  27407. }
  27408. if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
  27409. Popover.VERSION = '3.4.1'
  27410. Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
  27411. placement: 'right',
  27412. trigger: 'click',
  27413. content: '',
  27414. template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  27415. })
  27416. // NOTE: POPOVER EXTENDS tooltip.js
  27417. // ================================
  27418. Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
  27419. Popover.prototype.constructor = Popover
  27420. Popover.prototype.getDefaults = function () {
  27421. return Popover.DEFAULTS
  27422. }
  27423. Popover.prototype.setContent = function () {
  27424. var $tip = this.tip()
  27425. var title = this.getTitle()
  27426. var content = this.getContent()
  27427. if (this.options.html) {
  27428. var typeContent = typeof content
  27429. if (this.options.sanitize) {
  27430. title = this.sanitizeHtml(title)
  27431. if (typeContent === 'string') {
  27432. content = this.sanitizeHtml(content)
  27433. }
  27434. }
  27435. $tip.find('.popover-title').html(title)
  27436. $tip.find('.popover-content').children().detach().end()[
  27437. typeContent === 'string' ? 'html' : 'append'
  27438. ](content)
  27439. } else {
  27440. $tip.find('.popover-title').text(title)
  27441. $tip.find('.popover-content').children().detach().end().text(content)
  27442. }
  27443. $tip.removeClass('fade top bottom left right in')
  27444. // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
  27445. // this manually by checking the contents.
  27446. if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
  27447. }
  27448. Popover.prototype.hasContent = function () {
  27449. return this.getTitle() || this.getContent()
  27450. }
  27451. Popover.prototype.getContent = function () {
  27452. var $e = this.$element
  27453. var o = this.options
  27454. return $e.attr('data-content')
  27455. || (typeof o.content == 'function' ?
  27456. o.content.call($e[0]) :
  27457. o.content)
  27458. }
  27459. Popover.prototype.arrow = function () {
  27460. return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
  27461. }
  27462. // POPOVER PLUGIN DEFINITION
  27463. // =========================
  27464. function Plugin(option) {
  27465. return this.each(function () {
  27466. var $this = $(this)
  27467. var data = $this.data('bs.popover')
  27468. var options = typeof option == 'object' && option
  27469. if (!data && /destroy|hide/.test(option)) return
  27470. if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
  27471. if (typeof option == 'string') data[option]()
  27472. })
  27473. }
  27474. var old = $.fn.popover
  27475. $.fn.popover = Plugin
  27476. $.fn.popover.Constructor = Popover
  27477. // POPOVER NO CONFLICT
  27478. // ===================
  27479. $.fn.popover.noConflict = function () {
  27480. $.fn.popover = old
  27481. return this
  27482. }
  27483. }(jQuery);
  27484. /* ========================================================================
  27485. * Bootstrap: scrollspy.js v3.4.1
  27486. * https://getbootstrap.com/docs/3.4/javascript/#scrollspy
  27487. * ========================================================================
  27488. * Copyright 2011-2019 Twitter, Inc.
  27489. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  27490. * ======================================================================== */
  27491. +function ($) {
  27492. 'use strict';
  27493. // SCROLLSPY CLASS DEFINITION
  27494. // ==========================
  27495. function ScrollSpy(element, options) {
  27496. this.$body = $(document.body)
  27497. this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
  27498. this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
  27499. this.selector = (this.options.target || '') + ' .nav li > a'
  27500. this.offsets = []
  27501. this.targets = []
  27502. this.activeTarget = null
  27503. this.scrollHeight = 0
  27504. this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
  27505. this.refresh()
  27506. this.process()
  27507. }
  27508. ScrollSpy.VERSION = '3.4.1'
  27509. ScrollSpy.DEFAULTS = {
  27510. offset: 10
  27511. }
  27512. ScrollSpy.prototype.getScrollHeight = function () {
  27513. return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
  27514. }
  27515. ScrollSpy.prototype.refresh = function () {
  27516. var that = this
  27517. var offsetMethod = 'offset'
  27518. var offsetBase = 0
  27519. this.offsets = []
  27520. this.targets = []
  27521. this.scrollHeight = this.getScrollHeight()
  27522. if (!$.isWindow(this.$scrollElement[0])) {
  27523. offsetMethod = 'position'
  27524. offsetBase = this.$scrollElement.scrollTop()
  27525. }
  27526. this.$body
  27527. .find(this.selector)
  27528. .map(function () {
  27529. var $el = $(this)
  27530. var href = $el.data('target') || $el.attr('href')
  27531. var $href = /^#./.test(href) && $(href)
  27532. return ($href
  27533. && $href.length
  27534. && $href.is(':visible')
  27535. && [[$href[offsetMethod]().top + offsetBase, href]]) || null
  27536. })
  27537. .sort(function (a, b) { return a[0] - b[0] })
  27538. .each(function () {
  27539. that.offsets.push(this[0])
  27540. that.targets.push(this[1])
  27541. })
  27542. }
  27543. ScrollSpy.prototype.process = function () {
  27544. var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
  27545. var scrollHeight = this.getScrollHeight()
  27546. var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
  27547. var offsets = this.offsets
  27548. var targets = this.targets
  27549. var activeTarget = this.activeTarget
  27550. var i
  27551. if (this.scrollHeight != scrollHeight) {
  27552. this.refresh()
  27553. }
  27554. if (scrollTop >= maxScroll) {
  27555. return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
  27556. }
  27557. if (activeTarget && scrollTop < offsets[0]) {
  27558. this.activeTarget = null
  27559. return this.clear()
  27560. }
  27561. for (i = offsets.length; i--;) {
  27562. activeTarget != targets[i]
  27563. && scrollTop >= offsets[i]
  27564. && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
  27565. && this.activate(targets[i])
  27566. }
  27567. }
  27568. ScrollSpy.prototype.activate = function (target) {
  27569. this.activeTarget = target
  27570. this.clear()
  27571. var selector = this.selector +
  27572. '[data-target="' + target + '"],' +
  27573. this.selector + '[href="' + target + '"]'
  27574. var active = $(selector)
  27575. .parents('li')
  27576. .addClass('active')
  27577. if (active.parent('.dropdown-menu').length) {
  27578. active = active
  27579. .closest('li.dropdown')
  27580. .addClass('active')
  27581. }
  27582. active.trigger('activate.bs.scrollspy')
  27583. }
  27584. ScrollSpy.prototype.clear = function () {
  27585. $(this.selector)
  27586. .parentsUntil(this.options.target, '.active')
  27587. .removeClass('active')
  27588. }
  27589. // SCROLLSPY PLUGIN DEFINITION
  27590. // ===========================
  27591. function Plugin(option) {
  27592. return this.each(function () {
  27593. var $this = $(this)
  27594. var data = $this.data('bs.scrollspy')
  27595. var options = typeof option == 'object' && option
  27596. if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
  27597. if (typeof option == 'string') data[option]()
  27598. })
  27599. }
  27600. var old = $.fn.scrollspy
  27601. $.fn.scrollspy = Plugin
  27602. $.fn.scrollspy.Constructor = ScrollSpy
  27603. // SCROLLSPY NO CONFLICT
  27604. // =====================
  27605. $.fn.scrollspy.noConflict = function () {
  27606. $.fn.scrollspy = old
  27607. return this
  27608. }
  27609. // SCROLLSPY DATA-API
  27610. // ==================
  27611. $(window).on('load.bs.scrollspy.data-api', function () {
  27612. $('[data-spy="scroll"]').each(function () {
  27613. var $spy = $(this)
  27614. Plugin.call($spy, $spy.data())
  27615. })
  27616. })
  27617. }(jQuery);
  27618. /* ========================================================================
  27619. * Bootstrap: tab.js v3.4.1
  27620. * https://getbootstrap.com/docs/3.4/javascript/#tabs
  27621. * ========================================================================
  27622. * Copyright 2011-2019 Twitter, Inc.
  27623. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  27624. * ======================================================================== */
  27625. +function ($) {
  27626. 'use strict';
  27627. // TAB CLASS DEFINITION
  27628. // ====================
  27629. var Tab = function (element) {
  27630. // jscs:disable requireDollarBeforejQueryAssignment
  27631. this.element = $(element)
  27632. // jscs:enable requireDollarBeforejQueryAssignment
  27633. }
  27634. Tab.VERSION = '3.4.1'
  27635. Tab.TRANSITION_DURATION = 150
  27636. Tab.prototype.show = function () {
  27637. var $this = this.element
  27638. var $ul = $this.closest('ul:not(.dropdown-menu)')
  27639. var selector = $this.data('target')
  27640. if (!selector) {
  27641. selector = $this.attr('href')
  27642. selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
  27643. }
  27644. if ($this.parent('li').hasClass('active')) return
  27645. var $previous = $ul.find('.active:last a')
  27646. var hideEvent = $.Event('hide.bs.tab', {
  27647. relatedTarget: $this[0]
  27648. })
  27649. var showEvent = $.Event('show.bs.tab', {
  27650. relatedTarget: $previous[0]
  27651. })
  27652. $previous.trigger(hideEvent)
  27653. $this.trigger(showEvent)
  27654. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
  27655. var $target = $(document).find(selector)
  27656. this.activate($this.closest('li'), $ul)
  27657. this.activate($target, $target.parent(), function () {
  27658. $previous.trigger({
  27659. type: 'hidden.bs.tab',
  27660. relatedTarget: $this[0]
  27661. })
  27662. $this.trigger({
  27663. type: 'shown.bs.tab',
  27664. relatedTarget: $previous[0]
  27665. })
  27666. })
  27667. }
  27668. Tab.prototype.activate = function (element, container, callback) {
  27669. var $active = container.find('> .active')
  27670. var transition = callback
  27671. && $.support.transition
  27672. && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
  27673. function next() {
  27674. $active
  27675. .removeClass('active')
  27676. .find('> .dropdown-menu > .active')
  27677. .removeClass('active')
  27678. .end()
  27679. .find('[data-toggle="tab"]')
  27680. .attr('aria-expanded', false)
  27681. element
  27682. .addClass('active')
  27683. .find('[data-toggle="tab"]')
  27684. .attr('aria-expanded', true)
  27685. if (transition) {
  27686. element[0].offsetWidth // reflow for transition
  27687. element.addClass('in')
  27688. } else {
  27689. element.removeClass('fade')
  27690. }
  27691. if (element.parent('.dropdown-menu').length) {
  27692. element
  27693. .closest('li.dropdown')
  27694. .addClass('active')
  27695. .end()
  27696. .find('[data-toggle="tab"]')
  27697. .attr('aria-expanded', true)
  27698. }
  27699. callback && callback()
  27700. }
  27701. $active.length && transition ?
  27702. $active
  27703. .one('bsTransitionEnd', next)
  27704. .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
  27705. next()
  27706. $active.removeClass('in')
  27707. }
  27708. // TAB PLUGIN DEFINITION
  27709. // =====================
  27710. function Plugin(option) {
  27711. return this.each(function () {
  27712. var $this = $(this)
  27713. var data = $this.data('bs.tab')
  27714. if (!data) $this.data('bs.tab', (data = new Tab(this)))
  27715. if (typeof option == 'string') data[option]()
  27716. })
  27717. }
  27718. var old = $.fn.tab
  27719. $.fn.tab = Plugin
  27720. $.fn.tab.Constructor = Tab
  27721. // TAB NO CONFLICT
  27722. // ===============
  27723. $.fn.tab.noConflict = function () {
  27724. $.fn.tab = old
  27725. return this
  27726. }
  27727. // TAB DATA-API
  27728. // ============
  27729. var clickHandler = function (e) {
  27730. e.preventDefault()
  27731. Plugin.call($(this), 'show')
  27732. }
  27733. $(document)
  27734. .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
  27735. .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
  27736. }(jQuery);
  27737. /* ========================================================================
  27738. * Bootstrap: affix.js v3.4.1
  27739. * https://getbootstrap.com/docs/3.4/javascript/#affix
  27740. * ========================================================================
  27741. * Copyright 2011-2019 Twitter, Inc.
  27742. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  27743. * ======================================================================== */
  27744. +function ($) {
  27745. 'use strict';
  27746. // AFFIX CLASS DEFINITION
  27747. // ======================
  27748. var Affix = function (element, options) {
  27749. this.options = $.extend({}, Affix.DEFAULTS, options)
  27750. var target = this.options.target === Affix.DEFAULTS.target ? $(this.options.target) : $(document).find(this.options.target)
  27751. this.$target = target
  27752. .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
  27753. .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
  27754. this.$element = $(element)
  27755. this.affixed = null
  27756. this.unpin = null
  27757. this.pinnedOffset = null
  27758. this.checkPosition()
  27759. }
  27760. Affix.VERSION = '3.4.1'
  27761. Affix.RESET = 'affix affix-top affix-bottom'
  27762. Affix.DEFAULTS = {
  27763. offset: 0,
  27764. target: window
  27765. }
  27766. Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
  27767. var scrollTop = this.$target.scrollTop()
  27768. var position = this.$element.offset()
  27769. var targetHeight = this.$target.height()
  27770. if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
  27771. if (this.affixed == 'bottom') {
  27772. if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
  27773. return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
  27774. }
  27775. var initializing = this.affixed == null
  27776. var colliderTop = initializing ? scrollTop : position.top
  27777. var colliderHeight = initializing ? targetHeight : height
  27778. if (offsetTop != null && scrollTop <= offsetTop) return 'top'
  27779. if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
  27780. return false
  27781. }
  27782. Affix.prototype.getPinnedOffset = function () {
  27783. if (this.pinnedOffset) return this.pinnedOffset
  27784. this.$element.removeClass(Affix.RESET).addClass('affix')
  27785. var scrollTop = this.$target.scrollTop()
  27786. var position = this.$element.offset()
  27787. return (this.pinnedOffset = position.top - scrollTop)
  27788. }
  27789. Affix.prototype.checkPositionWithEventLoop = function () {
  27790. setTimeout($.proxy(this.checkPosition, this), 1)
  27791. }
  27792. Affix.prototype.checkPosition = function () {
  27793. if (!this.$element.is(':visible')) return
  27794. var height = this.$element.height()
  27795. var offset = this.options.offset
  27796. var offsetTop = offset.top
  27797. var offsetBottom = offset.bottom
  27798. var scrollHeight = Math.max($(document).height(), $(document.body).height())
  27799. if (typeof offset != 'object') offsetBottom = offsetTop = offset
  27800. if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
  27801. if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
  27802. var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
  27803. if (this.affixed != affix) {
  27804. if (this.unpin != null) this.$element.css('top', '')
  27805. var affixType = 'affix' + (affix ? '-' + affix : '')
  27806. var e = $.Event(affixType + '.bs.affix')
  27807. this.$element.trigger(e)
  27808. if (e.isDefaultPrevented()) return
  27809. this.affixed = affix
  27810. this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
  27811. this.$element
  27812. .removeClass(Affix.RESET)
  27813. .addClass(affixType)
  27814. .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
  27815. }
  27816. if (affix == 'bottom') {
  27817. this.$element.offset({
  27818. top: scrollHeight - height - offsetBottom
  27819. })
  27820. }
  27821. }
  27822. // AFFIX PLUGIN DEFINITION
  27823. // =======================
  27824. function Plugin(option) {
  27825. return this.each(function () {
  27826. var $this = $(this)
  27827. var data = $this.data('bs.affix')
  27828. var options = typeof option == 'object' && option
  27829. if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
  27830. if (typeof option == 'string') data[option]()
  27831. })
  27832. }
  27833. var old = $.fn.affix
  27834. $.fn.affix = Plugin
  27835. $.fn.affix.Constructor = Affix
  27836. // AFFIX NO CONFLICT
  27837. // =================
  27838. $.fn.affix.noConflict = function () {
  27839. $.fn.affix = old
  27840. return this
  27841. }
  27842. // AFFIX DATA-API
  27843. // ==============
  27844. $(window).on('load', function () {
  27845. $('[data-spy="affix"]').each(function () {
  27846. var $spy = $(this)
  27847. var data = $spy.data()
  27848. data.offset = data.offset || {}
  27849. if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
  27850. if (data.offsetTop != null) data.offset.top = data.offsetTop
  27851. Plugin.call($spy, data)
  27852. })
  27853. })
  27854. }(jQuery);
  27855. /***/ }),
  27856. /* 16 */
  27857. /***/ (function(module, exports, __webpack_require__) {
  27858. module.exports = __webpack_require__(17);
  27859. /***/ }),
  27860. /* 17 */
  27861. /***/ (function(module, exports, __webpack_require__) {
  27862. "use strict";
  27863. var utils = __webpack_require__(0);
  27864. var bind = __webpack_require__(3);
  27865. var Axios = __webpack_require__(19);
  27866. var defaults = __webpack_require__(2);
  27867. /**
  27868. * Create an instance of Axios
  27869. *
  27870. * @param {Object} defaultConfig The default config for the instance
  27871. * @return {Axios} A new instance of Axios
  27872. */
  27873. function createInstance(defaultConfig) {
  27874. var context = new Axios(defaultConfig);
  27875. var instance = bind(Axios.prototype.request, context);
  27876. // Copy axios.prototype to instance
  27877. utils.extend(instance, Axios.prototype, context);
  27878. // Copy context to instance
  27879. utils.extend(instance, context);
  27880. return instance;
  27881. }
  27882. // Create the default instance to be exported
  27883. var axios = createInstance(defaults);
  27884. // Expose Axios class to allow class inheritance
  27885. axios.Axios = Axios;
  27886. // Factory for creating new instances
  27887. axios.create = function create(instanceConfig) {
  27888. return createInstance(utils.merge(defaults, instanceConfig));
  27889. };
  27890. // Expose Cancel & CancelToken
  27891. axios.Cancel = __webpack_require__(8);
  27892. axios.CancelToken = __webpack_require__(33);
  27893. axios.isCancel = __webpack_require__(7);
  27894. // Expose all/spread
  27895. axios.all = function all(promises) {
  27896. return Promise.all(promises);
  27897. };
  27898. axios.spread = __webpack_require__(34);
  27899. module.exports = axios;
  27900. // Allow use of default import syntax in TypeScript
  27901. module.exports.default = axios;
  27902. /***/ }),
  27903. /* 18 */
  27904. /***/ (function(module, exports) {
  27905. /*!
  27906. * Determine if an object is a Buffer
  27907. *
  27908. * @author Feross Aboukhadijeh <https://feross.org>
  27909. * @license MIT
  27910. */
  27911. // The _isBuffer check is for Safari 5-7 support, because it's missing
  27912. // Object.prototype.constructor. Remove this eventually
  27913. module.exports = function (obj) {
  27914. return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
  27915. }
  27916. function isBuffer (obj) {
  27917. return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
  27918. }
  27919. // For Node v0.10 support. Remove this eventually.
  27920. function isSlowBuffer (obj) {
  27921. return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
  27922. }
  27923. /***/ }),
  27924. /* 19 */
  27925. /***/ (function(module, exports, __webpack_require__) {
  27926. "use strict";
  27927. var defaults = __webpack_require__(2);
  27928. var utils = __webpack_require__(0);
  27929. var InterceptorManager = __webpack_require__(28);
  27930. var dispatchRequest = __webpack_require__(29);
  27931. /**
  27932. * Create a new instance of Axios
  27933. *
  27934. * @param {Object} instanceConfig The default config for the instance
  27935. */
  27936. function Axios(instanceConfig) {
  27937. this.defaults = instanceConfig;
  27938. this.interceptors = {
  27939. request: new InterceptorManager(),
  27940. response: new InterceptorManager()
  27941. };
  27942. }
  27943. /**
  27944. * Dispatch a request
  27945. *
  27946. * @param {Object} config The config specific for this request (merged with this.defaults)
  27947. */
  27948. Axios.prototype.request = function request(config) {
  27949. /*eslint no-param-reassign:0*/
  27950. // Allow for axios('example/url'[, config]) a la fetch API
  27951. if (typeof config === 'string') {
  27952. config = utils.merge({
  27953. url: arguments[0]
  27954. }, arguments[1]);
  27955. }
  27956. config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
  27957. config.method = config.method.toLowerCase();
  27958. // Hook up interceptors middleware
  27959. var chain = [dispatchRequest, undefined];
  27960. var promise = Promise.resolve(config);
  27961. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  27962. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  27963. });
  27964. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  27965. chain.push(interceptor.fulfilled, interceptor.rejected);
  27966. });
  27967. while (chain.length) {
  27968. promise = promise.then(chain.shift(), chain.shift());
  27969. }
  27970. return promise;
  27971. };
  27972. // Provide aliases for supported request methods
  27973. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  27974. /*eslint func-names:0*/
  27975. Axios.prototype[method] = function(url, config) {
  27976. return this.request(utils.merge(config || {}, {
  27977. method: method,
  27978. url: url
  27979. }));
  27980. };
  27981. });
  27982. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  27983. /*eslint func-names:0*/
  27984. Axios.prototype[method] = function(url, data, config) {
  27985. return this.request(utils.merge(config || {}, {
  27986. method: method,
  27987. url: url,
  27988. data: data
  27989. }));
  27990. };
  27991. });
  27992. module.exports = Axios;
  27993. /***/ }),
  27994. /* 20 */
  27995. /***/ (function(module, exports, __webpack_require__) {
  27996. "use strict";
  27997. var utils = __webpack_require__(0);
  27998. module.exports = function normalizeHeaderName(headers, normalizedName) {
  27999. utils.forEach(headers, function processHeader(value, name) {
  28000. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  28001. headers[normalizedName] = value;
  28002. delete headers[name];
  28003. }
  28004. });
  28005. };
  28006. /***/ }),
  28007. /* 21 */
  28008. /***/ (function(module, exports, __webpack_require__) {
  28009. "use strict";
  28010. var createError = __webpack_require__(6);
  28011. /**
  28012. * Resolve or reject a Promise based on response status.
  28013. *
  28014. * @param {Function} resolve A function that resolves the promise.
  28015. * @param {Function} reject A function that rejects the promise.
  28016. * @param {object} response The response.
  28017. */
  28018. module.exports = function settle(resolve, reject, response) {
  28019. var validateStatus = response.config.validateStatus;
  28020. // Note: status is not exposed by XDomainRequest
  28021. if (!response.status || !validateStatus || validateStatus(response.status)) {
  28022. resolve(response);
  28023. } else {
  28024. reject(createError(
  28025. 'Request failed with status code ' + response.status,
  28026. response.config,
  28027. null,
  28028. response.request,
  28029. response
  28030. ));
  28031. }
  28032. };
  28033. /***/ }),
  28034. /* 22 */
  28035. /***/ (function(module, exports, __webpack_require__) {
  28036. "use strict";
  28037. /**
  28038. * Update an Error with the specified config, error code, and response.
  28039. *
  28040. * @param {Error} error The error to update.
  28041. * @param {Object} config The config.
  28042. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  28043. * @param {Object} [request] The request.
  28044. * @param {Object} [response] The response.
  28045. * @returns {Error} The error.
  28046. */
  28047. module.exports = function enhanceError(error, config, code, request, response) {
  28048. error.config = config;
  28049. if (code) {
  28050. error.code = code;
  28051. }
  28052. error.request = request;
  28053. error.response = response;
  28054. return error;
  28055. };
  28056. /***/ }),
  28057. /* 23 */
  28058. /***/ (function(module, exports, __webpack_require__) {
  28059. "use strict";
  28060. var utils = __webpack_require__(0);
  28061. function encode(val) {
  28062. return encodeURIComponent(val).
  28063. replace(/%40/gi, '@').
  28064. replace(/%3A/gi, ':').
  28065. replace(/%24/g, '$').
  28066. replace(/%2C/gi, ',').
  28067. replace(/%20/g, '+').
  28068. replace(/%5B/gi, '[').
  28069. replace(/%5D/gi, ']');
  28070. }
  28071. /**
  28072. * Build a URL by appending params to the end
  28073. *
  28074. * @param {string} url The base of the url (e.g., http://www.google.com)
  28075. * @param {object} [params] The params to be appended
  28076. * @returns {string} The formatted url
  28077. */
  28078. module.exports = function buildURL(url, params, paramsSerializer) {
  28079. /*eslint no-param-reassign:0*/
  28080. if (!params) {
  28081. return url;
  28082. }
  28083. var serializedParams;
  28084. if (paramsSerializer) {
  28085. serializedParams = paramsSerializer(params);
  28086. } else if (utils.isURLSearchParams(params)) {
  28087. serializedParams = params.toString();
  28088. } else {
  28089. var parts = [];
  28090. utils.forEach(params, function serialize(val, key) {
  28091. if (val === null || typeof val === 'undefined') {
  28092. return;
  28093. }
  28094. if (utils.isArray(val)) {
  28095. key = key + '[]';
  28096. }
  28097. if (!utils.isArray(val)) {
  28098. val = [val];
  28099. }
  28100. utils.forEach(val, function parseValue(v) {
  28101. if (utils.isDate(v)) {
  28102. v = v.toISOString();
  28103. } else if (utils.isObject(v)) {
  28104. v = JSON.stringify(v);
  28105. }
  28106. parts.push(encode(key) + '=' + encode(v));
  28107. });
  28108. });
  28109. serializedParams = parts.join('&');
  28110. }
  28111. if (serializedParams) {
  28112. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  28113. }
  28114. return url;
  28115. };
  28116. /***/ }),
  28117. /* 24 */
  28118. /***/ (function(module, exports, __webpack_require__) {
  28119. "use strict";
  28120. var utils = __webpack_require__(0);
  28121. // Headers whose duplicates are ignored by node
  28122. // c.f. https://nodejs.org/api/http.html#http_message_headers
  28123. var ignoreDuplicateOf = [
  28124. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  28125. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  28126. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  28127. 'referer', 'retry-after', 'user-agent'
  28128. ];
  28129. /**
  28130. * Parse headers into an object
  28131. *
  28132. * ```
  28133. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  28134. * Content-Type: application/json
  28135. * Connection: keep-alive
  28136. * Transfer-Encoding: chunked
  28137. * ```
  28138. *
  28139. * @param {String} headers Headers needing to be parsed
  28140. * @returns {Object} Headers parsed into an object
  28141. */
  28142. module.exports = function parseHeaders(headers) {
  28143. var parsed = {};
  28144. var key;
  28145. var val;
  28146. var i;
  28147. if (!headers) { return parsed; }
  28148. utils.forEach(headers.split('\n'), function parser(line) {
  28149. i = line.indexOf(':');
  28150. key = utils.trim(line.substr(0, i)).toLowerCase();
  28151. val = utils.trim(line.substr(i + 1));
  28152. if (key) {
  28153. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  28154. return;
  28155. }
  28156. if (key === 'set-cookie') {
  28157. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  28158. } else {
  28159. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  28160. }
  28161. }
  28162. });
  28163. return parsed;
  28164. };
  28165. /***/ }),
  28166. /* 25 */
  28167. /***/ (function(module, exports, __webpack_require__) {
  28168. "use strict";
  28169. var utils = __webpack_require__(0);
  28170. module.exports = (
  28171. utils.isStandardBrowserEnv() ?
  28172. // Standard browser envs have full support of the APIs needed to test
  28173. // whether the request URL is of the same origin as current location.
  28174. (function standardBrowserEnv() {
  28175. var msie = /(msie|trident)/i.test(navigator.userAgent);
  28176. var urlParsingNode = document.createElement('a');
  28177. var originURL;
  28178. /**
  28179. * Parse a URL to discover it's components
  28180. *
  28181. * @param {String} url The URL to be parsed
  28182. * @returns {Object}
  28183. */
  28184. function resolveURL(url) {
  28185. var href = url;
  28186. if (msie) {
  28187. // IE needs attribute set twice to normalize properties
  28188. urlParsingNode.setAttribute('href', href);
  28189. href = urlParsingNode.href;
  28190. }
  28191. urlParsingNode.setAttribute('href', href);
  28192. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  28193. return {
  28194. href: urlParsingNode.href,
  28195. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  28196. host: urlParsingNode.host,
  28197. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  28198. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  28199. hostname: urlParsingNode.hostname,
  28200. port: urlParsingNode.port,
  28201. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  28202. urlParsingNode.pathname :
  28203. '/' + urlParsingNode.pathname
  28204. };
  28205. }
  28206. originURL = resolveURL(window.location.href);
  28207. /**
  28208. * Determine if a URL shares the same origin as the current location
  28209. *
  28210. * @param {String} requestURL The URL to test
  28211. * @returns {boolean} True if URL shares the same origin, otherwise false
  28212. */
  28213. return function isURLSameOrigin(requestURL) {
  28214. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  28215. return (parsed.protocol === originURL.protocol &&
  28216. parsed.host === originURL.host);
  28217. };
  28218. })() :
  28219. // Non standard browser envs (web workers, react-native) lack needed support.
  28220. (function nonStandardBrowserEnv() {
  28221. return function isURLSameOrigin() {
  28222. return true;
  28223. };
  28224. })()
  28225. );
  28226. /***/ }),
  28227. /* 26 */
  28228. /***/ (function(module, exports, __webpack_require__) {
  28229. "use strict";
  28230. // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
  28231. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  28232. function E() {
  28233. this.message = 'String contains an invalid character';
  28234. }
  28235. E.prototype = new Error;
  28236. E.prototype.code = 5;
  28237. E.prototype.name = 'InvalidCharacterError';
  28238. function btoa(input) {
  28239. var str = String(input);
  28240. var output = '';
  28241. for (
  28242. // initialize result and counter
  28243. var block, charCode, idx = 0, map = chars;
  28244. // if the next str index does not exist:
  28245. // change the mapping table to "="
  28246. // check if d has no fractional digits
  28247. str.charAt(idx | 0) || (map = '=', idx % 1);
  28248. // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
  28249. output += map.charAt(63 & block >> 8 - idx % 1 * 8)
  28250. ) {
  28251. charCode = str.charCodeAt(idx += 3 / 4);
  28252. if (charCode > 0xFF) {
  28253. throw new E();
  28254. }
  28255. block = block << 8 | charCode;
  28256. }
  28257. return output;
  28258. }
  28259. module.exports = btoa;
  28260. /***/ }),
  28261. /* 27 */
  28262. /***/ (function(module, exports, __webpack_require__) {
  28263. "use strict";
  28264. var utils = __webpack_require__(0);
  28265. module.exports = (
  28266. utils.isStandardBrowserEnv() ?
  28267. // Standard browser envs support document.cookie
  28268. (function standardBrowserEnv() {
  28269. return {
  28270. write: function write(name, value, expires, path, domain, secure) {
  28271. var cookie = [];
  28272. cookie.push(name + '=' + encodeURIComponent(value));
  28273. if (utils.isNumber(expires)) {
  28274. cookie.push('expires=' + new Date(expires).toGMTString());
  28275. }
  28276. if (utils.isString(path)) {
  28277. cookie.push('path=' + path);
  28278. }
  28279. if (utils.isString(domain)) {
  28280. cookie.push('domain=' + domain);
  28281. }
  28282. if (secure === true) {
  28283. cookie.push('secure');
  28284. }
  28285. document.cookie = cookie.join('; ');
  28286. },
  28287. read: function read(name) {
  28288. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  28289. return (match ? decodeURIComponent(match[3]) : null);
  28290. },
  28291. remove: function remove(name) {
  28292. this.write(name, '', Date.now() - 86400000);
  28293. }
  28294. };
  28295. })() :
  28296. // Non standard browser env (web workers, react-native) lack needed support.
  28297. (function nonStandardBrowserEnv() {
  28298. return {
  28299. write: function write() {},
  28300. read: function read() { return null; },
  28301. remove: function remove() {}
  28302. };
  28303. })()
  28304. );
  28305. /***/ }),
  28306. /* 28 */
  28307. /***/ (function(module, exports, __webpack_require__) {
  28308. "use strict";
  28309. var utils = __webpack_require__(0);
  28310. function InterceptorManager() {
  28311. this.handlers = [];
  28312. }
  28313. /**
  28314. * Add a new interceptor to the stack
  28315. *
  28316. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  28317. * @param {Function} rejected The function to handle `reject` for a `Promise`
  28318. *
  28319. * @return {Number} An ID used to remove interceptor later
  28320. */
  28321. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  28322. this.handlers.push({
  28323. fulfilled: fulfilled,
  28324. rejected: rejected
  28325. });
  28326. return this.handlers.length - 1;
  28327. };
  28328. /**
  28329. * Remove an interceptor from the stack
  28330. *
  28331. * @param {Number} id The ID that was returned by `use`
  28332. */
  28333. InterceptorManager.prototype.eject = function eject(id) {
  28334. if (this.handlers[id]) {
  28335. this.handlers[id] = null;
  28336. }
  28337. };
  28338. /**
  28339. * Iterate over all the registered interceptors
  28340. *
  28341. * This method is particularly useful for skipping over any
  28342. * interceptors that may have become `null` calling `eject`.
  28343. *
  28344. * @param {Function} fn The function to call for each interceptor
  28345. */
  28346. InterceptorManager.prototype.forEach = function forEach(fn) {
  28347. utils.forEach(this.handlers, function forEachHandler(h) {
  28348. if (h !== null) {
  28349. fn(h);
  28350. }
  28351. });
  28352. };
  28353. module.exports = InterceptorManager;
  28354. /***/ }),
  28355. /* 29 */
  28356. /***/ (function(module, exports, __webpack_require__) {
  28357. "use strict";
  28358. var utils = __webpack_require__(0);
  28359. var transformData = __webpack_require__(30);
  28360. var isCancel = __webpack_require__(7);
  28361. var defaults = __webpack_require__(2);
  28362. var isAbsoluteURL = __webpack_require__(31);
  28363. var combineURLs = __webpack_require__(32);
  28364. /**
  28365. * Throws a `Cancel` if cancellation has been requested.
  28366. */
  28367. function throwIfCancellationRequested(config) {
  28368. if (config.cancelToken) {
  28369. config.cancelToken.throwIfRequested();
  28370. }
  28371. }
  28372. /**
  28373. * Dispatch a request to the server using the configured adapter.
  28374. *
  28375. * @param {object} config The config that is to be used for the request
  28376. * @returns {Promise} The Promise to be fulfilled
  28377. */
  28378. module.exports = function dispatchRequest(config) {
  28379. throwIfCancellationRequested(config);
  28380. // Support baseURL config
  28381. if (config.baseURL && !isAbsoluteURL(config.url)) {
  28382. config.url = combineURLs(config.baseURL, config.url);
  28383. }
  28384. // Ensure headers exist
  28385. config.headers = config.headers || {};
  28386. // Transform request data
  28387. config.data = transformData(
  28388. config.data,
  28389. config.headers,
  28390. config.transformRequest
  28391. );
  28392. // Flatten headers
  28393. config.headers = utils.merge(
  28394. config.headers.common || {},
  28395. config.headers[config.method] || {},
  28396. config.headers || {}
  28397. );
  28398. utils.forEach(
  28399. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  28400. function cleanHeaderConfig(method) {
  28401. delete config.headers[method];
  28402. }
  28403. );
  28404. var adapter = config.adapter || defaults.adapter;
  28405. return adapter(config).then(function onAdapterResolution(response) {
  28406. throwIfCancellationRequested(config);
  28407. // Transform response data
  28408. response.data = transformData(
  28409. response.data,
  28410. response.headers,
  28411. config.transformResponse
  28412. );
  28413. return response;
  28414. }, function onAdapterRejection(reason) {
  28415. if (!isCancel(reason)) {
  28416. throwIfCancellationRequested(config);
  28417. // Transform response data
  28418. if (reason && reason.response) {
  28419. reason.response.data = transformData(
  28420. reason.response.data,
  28421. reason.response.headers,
  28422. config.transformResponse
  28423. );
  28424. }
  28425. }
  28426. return Promise.reject(reason);
  28427. });
  28428. };
  28429. /***/ }),
  28430. /* 30 */
  28431. /***/ (function(module, exports, __webpack_require__) {
  28432. "use strict";
  28433. var utils = __webpack_require__(0);
  28434. /**
  28435. * Transform the data for a request or a response
  28436. *
  28437. * @param {Object|String} data The data to be transformed
  28438. * @param {Array} headers The headers for the request or response
  28439. * @param {Array|Function} fns A single function or Array of functions
  28440. * @returns {*} The resulting transformed data
  28441. */
  28442. module.exports = function transformData(data, headers, fns) {
  28443. /*eslint no-param-reassign:0*/
  28444. utils.forEach(fns, function transform(fn) {
  28445. data = fn(data, headers);
  28446. });
  28447. return data;
  28448. };
  28449. /***/ }),
  28450. /* 31 */
  28451. /***/ (function(module, exports, __webpack_require__) {
  28452. "use strict";
  28453. /**
  28454. * Determines whether the specified URL is absolute
  28455. *
  28456. * @param {string} url The URL to test
  28457. * @returns {boolean} True if the specified URL is absolute, otherwise false
  28458. */
  28459. module.exports = function isAbsoluteURL(url) {
  28460. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  28461. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  28462. // by any combination of letters, digits, plus, period, or hyphen.
  28463. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  28464. };
  28465. /***/ }),
  28466. /* 32 */
  28467. /***/ (function(module, exports, __webpack_require__) {
  28468. "use strict";
  28469. /**
  28470. * Creates a new URL by combining the specified URLs
  28471. *
  28472. * @param {string} baseURL The base URL
  28473. * @param {string} relativeURL The relative URL
  28474. * @returns {string} The combined URL
  28475. */
  28476. module.exports = function combineURLs(baseURL, relativeURL) {
  28477. return relativeURL
  28478. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  28479. : baseURL;
  28480. };
  28481. /***/ }),
  28482. /* 33 */
  28483. /***/ (function(module, exports, __webpack_require__) {
  28484. "use strict";
  28485. var Cancel = __webpack_require__(8);
  28486. /**
  28487. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  28488. *
  28489. * @class
  28490. * @param {Function} executor The executor function.
  28491. */
  28492. function CancelToken(executor) {
  28493. if (typeof executor !== 'function') {
  28494. throw new TypeError('executor must be a function.');
  28495. }
  28496. var resolvePromise;
  28497. this.promise = new Promise(function promiseExecutor(resolve) {
  28498. resolvePromise = resolve;
  28499. });
  28500. var token = this;
  28501. executor(function cancel(message) {
  28502. if (token.reason) {
  28503. // Cancellation has already been requested
  28504. return;
  28505. }
  28506. token.reason = new Cancel(message);
  28507. resolvePromise(token.reason);
  28508. });
  28509. }
  28510. /**
  28511. * Throws a `Cancel` if cancellation has been requested.
  28512. */
  28513. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  28514. if (this.reason) {
  28515. throw this.reason;
  28516. }
  28517. };
  28518. /**
  28519. * Returns an object that contains a new `CancelToken` and a function that, when called,
  28520. * cancels the `CancelToken`.
  28521. */
  28522. CancelToken.source = function source() {
  28523. var cancel;
  28524. var token = new CancelToken(function executor(c) {
  28525. cancel = c;
  28526. });
  28527. return {
  28528. token: token,
  28529. cancel: cancel
  28530. };
  28531. };
  28532. module.exports = CancelToken;
  28533. /***/ }),
  28534. /* 34 */
  28535. /***/ (function(module, exports, __webpack_require__) {
  28536. "use strict";
  28537. /**
  28538. * Syntactic sugar for invoking a function and expanding an array for arguments.
  28539. *
  28540. * Common use case would be to use `Function.prototype.apply`.
  28541. *
  28542. * ```js
  28543. * function f(x, y, z) {}
  28544. * var args = [1, 2, 3];
  28545. * f.apply(null, args);
  28546. * ```
  28547. *
  28548. * With `spread` this example can be re-written.
  28549. *
  28550. * ```js
  28551. * spread(function(x, y, z) {})([1, 2, 3]);
  28552. * ```
  28553. *
  28554. * @param {Function} callback
  28555. * @returns {Function}
  28556. */
  28557. module.exports = function spread(callback) {
  28558. return function wrap(arr) {
  28559. return callback.apply(null, arr);
  28560. };
  28561. };
  28562. /***/ }),
  28563. /* 35 */
  28564. /***/ (function(module, exports, __webpack_require__) {
  28565. if (false) {
  28566. module.exports = require('./vue.common.prod.js')
  28567. } else {
  28568. module.exports = __webpack_require__(36)
  28569. }
  28570. /***/ }),
  28571. /* 36 */
  28572. /***/ (function(module, exports, __webpack_require__) {
  28573. "use strict";
  28574. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  28575. * Vue.js v2.6.12
  28576. * (c) 2014-2020 Evan You
  28577. * Released under the MIT License.
  28578. */
  28579. /* */
  28580. var emptyObject = Object.freeze({});
  28581. // These helpers produce better VM code in JS engines due to their
  28582. // explicitness and function inlining.
  28583. function isUndef (v) {
  28584. return v === undefined || v === null
  28585. }
  28586. function isDef (v) {
  28587. return v !== undefined && v !== null
  28588. }
  28589. function isTrue (v) {
  28590. return v === true
  28591. }
  28592. function isFalse (v) {
  28593. return v === false
  28594. }
  28595. /**
  28596. * Check if value is primitive.
  28597. */
  28598. function isPrimitive (value) {
  28599. return (
  28600. typeof value === 'string' ||
  28601. typeof value === 'number' ||
  28602. // $flow-disable-line
  28603. typeof value === 'symbol' ||
  28604. typeof value === 'boolean'
  28605. )
  28606. }
  28607. /**
  28608. * Quick object check - this is primarily used to tell
  28609. * Objects from primitive values when we know the value
  28610. * is a JSON-compliant type.
  28611. */
  28612. function isObject (obj) {
  28613. return obj !== null && typeof obj === 'object'
  28614. }
  28615. /**
  28616. * Get the raw type string of a value, e.g., [object Object].
  28617. */
  28618. var _toString = Object.prototype.toString;
  28619. function toRawType (value) {
  28620. return _toString.call(value).slice(8, -1)
  28621. }
  28622. /**
  28623. * Strict object type check. Only returns true
  28624. * for plain JavaScript objects.
  28625. */
  28626. function isPlainObject (obj) {
  28627. return _toString.call(obj) === '[object Object]'
  28628. }
  28629. function isRegExp (v) {
  28630. return _toString.call(v) === '[object RegExp]'
  28631. }
  28632. /**
  28633. * Check if val is a valid array index.
  28634. */
  28635. function isValidArrayIndex (val) {
  28636. var n = parseFloat(String(val));
  28637. return n >= 0 && Math.floor(n) === n && isFinite(val)
  28638. }
  28639. function isPromise (val) {
  28640. return (
  28641. isDef(val) &&
  28642. typeof val.then === 'function' &&
  28643. typeof val.catch === 'function'
  28644. )
  28645. }
  28646. /**
  28647. * Convert a value to a string that is actually rendered.
  28648. */
  28649. function toString (val) {
  28650. return val == null
  28651. ? ''
  28652. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  28653. ? JSON.stringify(val, null, 2)
  28654. : String(val)
  28655. }
  28656. /**
  28657. * Convert an input value to a number for persistence.
  28658. * If the conversion fails, return original string.
  28659. */
  28660. function toNumber (val) {
  28661. var n = parseFloat(val);
  28662. return isNaN(n) ? val : n
  28663. }
  28664. /**
  28665. * Make a map and return a function for checking if a key
  28666. * is in that map.
  28667. */
  28668. function makeMap (
  28669. str,
  28670. expectsLowerCase
  28671. ) {
  28672. var map = Object.create(null);
  28673. var list = str.split(',');
  28674. for (var i = 0; i < list.length; i++) {
  28675. map[list[i]] = true;
  28676. }
  28677. return expectsLowerCase
  28678. ? function (val) { return map[val.toLowerCase()]; }
  28679. : function (val) { return map[val]; }
  28680. }
  28681. /**
  28682. * Check if a tag is a built-in tag.
  28683. */
  28684. var isBuiltInTag = makeMap('slot,component', true);
  28685. /**
  28686. * Check if an attribute is a reserved attribute.
  28687. */
  28688. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  28689. /**
  28690. * Remove an item from an array.
  28691. */
  28692. function remove (arr, item) {
  28693. if (arr.length) {
  28694. var index = arr.indexOf(item);
  28695. if (index > -1) {
  28696. return arr.splice(index, 1)
  28697. }
  28698. }
  28699. }
  28700. /**
  28701. * Check whether an object has the property.
  28702. */
  28703. var hasOwnProperty = Object.prototype.hasOwnProperty;
  28704. function hasOwn (obj, key) {
  28705. return hasOwnProperty.call(obj, key)
  28706. }
  28707. /**
  28708. * Create a cached version of a pure function.
  28709. */
  28710. function cached (fn) {
  28711. var cache = Object.create(null);
  28712. return (function cachedFn (str) {
  28713. var hit = cache[str];
  28714. return hit || (cache[str] = fn(str))
  28715. })
  28716. }
  28717. /**
  28718. * Camelize a hyphen-delimited string.
  28719. */
  28720. var camelizeRE = /-(\w)/g;
  28721. var camelize = cached(function (str) {
  28722. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  28723. });
  28724. /**
  28725. * Capitalize a string.
  28726. */
  28727. var capitalize = cached(function (str) {
  28728. return str.charAt(0).toUpperCase() + str.slice(1)
  28729. });
  28730. /**
  28731. * Hyphenate a camelCase string.
  28732. */
  28733. var hyphenateRE = /\B([A-Z])/g;
  28734. var hyphenate = cached(function (str) {
  28735. return str.replace(hyphenateRE, '-$1').toLowerCase()
  28736. });
  28737. /**
  28738. * Simple bind polyfill for environments that do not support it,
  28739. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  28740. * since native bind is now performant enough in most browsers.
  28741. * But removing it would mean breaking code that was able to run in
  28742. * PhantomJS 1.x, so this must be kept for backward compatibility.
  28743. */
  28744. /* istanbul ignore next */
  28745. function polyfillBind (fn, ctx) {
  28746. function boundFn (a) {
  28747. var l = arguments.length;
  28748. return l
  28749. ? l > 1
  28750. ? fn.apply(ctx, arguments)
  28751. : fn.call(ctx, a)
  28752. : fn.call(ctx)
  28753. }
  28754. boundFn._length = fn.length;
  28755. return boundFn
  28756. }
  28757. function nativeBind (fn, ctx) {
  28758. return fn.bind(ctx)
  28759. }
  28760. var bind = Function.prototype.bind
  28761. ? nativeBind
  28762. : polyfillBind;
  28763. /**
  28764. * Convert an Array-like object to a real Array.
  28765. */
  28766. function toArray (list, start) {
  28767. start = start || 0;
  28768. var i = list.length - start;
  28769. var ret = new Array(i);
  28770. while (i--) {
  28771. ret[i] = list[i + start];
  28772. }
  28773. return ret
  28774. }
  28775. /**
  28776. * Mix properties into target object.
  28777. */
  28778. function extend (to, _from) {
  28779. for (var key in _from) {
  28780. to[key] = _from[key];
  28781. }
  28782. return to
  28783. }
  28784. /**
  28785. * Merge an Array of Objects into a single Object.
  28786. */
  28787. function toObject (arr) {
  28788. var res = {};
  28789. for (var i = 0; i < arr.length; i++) {
  28790. if (arr[i]) {
  28791. extend(res, arr[i]);
  28792. }
  28793. }
  28794. return res
  28795. }
  28796. /* eslint-disable no-unused-vars */
  28797. /**
  28798. * Perform no operation.
  28799. * Stubbing args to make Flow happy without leaving useless transpiled code
  28800. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  28801. */
  28802. function noop (a, b, c) {}
  28803. /**
  28804. * Always return false.
  28805. */
  28806. var no = function (a, b, c) { return false; };
  28807. /* eslint-enable no-unused-vars */
  28808. /**
  28809. * Return the same value.
  28810. */
  28811. var identity = function (_) { return _; };
  28812. /**
  28813. * Generate a string containing static keys from compiler modules.
  28814. */
  28815. function genStaticKeys (modules) {
  28816. return modules.reduce(function (keys, m) {
  28817. return keys.concat(m.staticKeys || [])
  28818. }, []).join(',')
  28819. }
  28820. /**
  28821. * Check if two values are loosely equal - that is,
  28822. * if they are plain objects, do they have the same shape?
  28823. */
  28824. function looseEqual (a, b) {
  28825. if (a === b) { return true }
  28826. var isObjectA = isObject(a);
  28827. var isObjectB = isObject(b);
  28828. if (isObjectA && isObjectB) {
  28829. try {
  28830. var isArrayA = Array.isArray(a);
  28831. var isArrayB = Array.isArray(b);
  28832. if (isArrayA && isArrayB) {
  28833. return a.length === b.length && a.every(function (e, i) {
  28834. return looseEqual(e, b[i])
  28835. })
  28836. } else if (a instanceof Date && b instanceof Date) {
  28837. return a.getTime() === b.getTime()
  28838. } else if (!isArrayA && !isArrayB) {
  28839. var keysA = Object.keys(a);
  28840. var keysB = Object.keys(b);
  28841. return keysA.length === keysB.length && keysA.every(function (key) {
  28842. return looseEqual(a[key], b[key])
  28843. })
  28844. } else {
  28845. /* istanbul ignore next */
  28846. return false
  28847. }
  28848. } catch (e) {
  28849. /* istanbul ignore next */
  28850. return false
  28851. }
  28852. } else if (!isObjectA && !isObjectB) {
  28853. return String(a) === String(b)
  28854. } else {
  28855. return false
  28856. }
  28857. }
  28858. /**
  28859. * Return the first index at which a loosely equal value can be
  28860. * found in the array (if value is a plain object, the array must
  28861. * contain an object of the same shape), or -1 if it is not present.
  28862. */
  28863. function looseIndexOf (arr, val) {
  28864. for (var i = 0; i < arr.length; i++) {
  28865. if (looseEqual(arr[i], val)) { return i }
  28866. }
  28867. return -1
  28868. }
  28869. /**
  28870. * Ensure a function is called only once.
  28871. */
  28872. function once (fn) {
  28873. var called = false;
  28874. return function () {
  28875. if (!called) {
  28876. called = true;
  28877. fn.apply(this, arguments);
  28878. }
  28879. }
  28880. }
  28881. var SSR_ATTR = 'data-server-rendered';
  28882. var ASSET_TYPES = [
  28883. 'component',
  28884. 'directive',
  28885. 'filter'
  28886. ];
  28887. var LIFECYCLE_HOOKS = [
  28888. 'beforeCreate',
  28889. 'created',
  28890. 'beforeMount',
  28891. 'mounted',
  28892. 'beforeUpdate',
  28893. 'updated',
  28894. 'beforeDestroy',
  28895. 'destroyed',
  28896. 'activated',
  28897. 'deactivated',
  28898. 'errorCaptured',
  28899. 'serverPrefetch'
  28900. ];
  28901. /* */
  28902. var config = ({
  28903. /**
  28904. * Option merge strategies (used in core/util/options)
  28905. */
  28906. // $flow-disable-line
  28907. optionMergeStrategies: Object.create(null),
  28908. /**
  28909. * Whether to suppress warnings.
  28910. */
  28911. silent: false,
  28912. /**
  28913. * Show production mode tip message on boot?
  28914. */
  28915. productionTip: "development" !== 'production',
  28916. /**
  28917. * Whether to enable devtools
  28918. */
  28919. devtools: "development" !== 'production',
  28920. /**
  28921. * Whether to record perf
  28922. */
  28923. performance: false,
  28924. /**
  28925. * Error handler for watcher errors
  28926. */
  28927. errorHandler: null,
  28928. /**
  28929. * Warn handler for watcher warns
  28930. */
  28931. warnHandler: null,
  28932. /**
  28933. * Ignore certain custom elements
  28934. */
  28935. ignoredElements: [],
  28936. /**
  28937. * Custom user key aliases for v-on
  28938. */
  28939. // $flow-disable-line
  28940. keyCodes: Object.create(null),
  28941. /**
  28942. * Check if a tag is reserved so that it cannot be registered as a
  28943. * component. This is platform-dependent and may be overwritten.
  28944. */
  28945. isReservedTag: no,
  28946. /**
  28947. * Check if an attribute is reserved so that it cannot be used as a component
  28948. * prop. This is platform-dependent and may be overwritten.
  28949. */
  28950. isReservedAttr: no,
  28951. /**
  28952. * Check if a tag is an unknown element.
  28953. * Platform-dependent.
  28954. */
  28955. isUnknownElement: no,
  28956. /**
  28957. * Get the namespace of an element
  28958. */
  28959. getTagNamespace: noop,
  28960. /**
  28961. * Parse the real tag name for the specific platform.
  28962. */
  28963. parsePlatformTagName: identity,
  28964. /**
  28965. * Check if an attribute must be bound using property, e.g. value
  28966. * Platform-dependent.
  28967. */
  28968. mustUseProp: no,
  28969. /**
  28970. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  28971. * This will significantly reduce performance if set to false.
  28972. */
  28973. async: true,
  28974. /**
  28975. * Exposed for legacy reasons
  28976. */
  28977. _lifecycleHooks: LIFECYCLE_HOOKS
  28978. });
  28979. /* */
  28980. /**
  28981. * unicode letters used for parsing html tags, component names and property paths.
  28982. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  28983. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  28984. */
  28985. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  28986. /**
  28987. * Check if a string starts with $ or _
  28988. */
  28989. function isReserved (str) {
  28990. var c = (str + '').charCodeAt(0);
  28991. return c === 0x24 || c === 0x5F
  28992. }
  28993. /**
  28994. * Define a property.
  28995. */
  28996. function def (obj, key, val, enumerable) {
  28997. Object.defineProperty(obj, key, {
  28998. value: val,
  28999. enumerable: !!enumerable,
  29000. writable: true,
  29001. configurable: true
  29002. });
  29003. }
  29004. /**
  29005. * Parse simple path.
  29006. */
  29007. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  29008. function parsePath (path) {
  29009. if (bailRE.test(path)) {
  29010. return
  29011. }
  29012. var segments = path.split('.');
  29013. return function (obj) {
  29014. for (var i = 0; i < segments.length; i++) {
  29015. if (!obj) { return }
  29016. obj = obj[segments[i]];
  29017. }
  29018. return obj
  29019. }
  29020. }
  29021. /* */
  29022. // can we use __proto__?
  29023. var hasProto = '__proto__' in {};
  29024. // Browser environment sniffing
  29025. var inBrowser = typeof window !== 'undefined';
  29026. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  29027. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  29028. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  29029. var isIE = UA && /msie|trident/.test(UA);
  29030. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  29031. var isEdge = UA && UA.indexOf('edge/') > 0;
  29032. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  29033. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  29034. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  29035. var isPhantomJS = UA && /phantomjs/.test(UA);
  29036. var isFF = UA && UA.match(/firefox\/(\d+)/);
  29037. // Firefox has a "watch" function on Object.prototype...
  29038. var nativeWatch = ({}).watch;
  29039. var supportsPassive = false;
  29040. if (inBrowser) {
  29041. try {
  29042. var opts = {};
  29043. Object.defineProperty(opts, 'passive', ({
  29044. get: function get () {
  29045. /* istanbul ignore next */
  29046. supportsPassive = true;
  29047. }
  29048. })); // https://github.com/facebook/flow/issues/285
  29049. window.addEventListener('test-passive', null, opts);
  29050. } catch (e) {}
  29051. }
  29052. // this needs to be lazy-evaled because vue may be required before
  29053. // vue-server-renderer can set VUE_ENV
  29054. var _isServer;
  29055. var isServerRendering = function () {
  29056. if (_isServer === undefined) {
  29057. /* istanbul ignore if */
  29058. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  29059. // detect presence of vue-server-renderer and avoid
  29060. // Webpack shimming the process
  29061. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  29062. } else {
  29063. _isServer = false;
  29064. }
  29065. }
  29066. return _isServer
  29067. };
  29068. // detect devtools
  29069. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  29070. /* istanbul ignore next */
  29071. function isNative (Ctor) {
  29072. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  29073. }
  29074. var hasSymbol =
  29075. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  29076. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  29077. var _Set;
  29078. /* istanbul ignore if */ // $flow-disable-line
  29079. if (typeof Set !== 'undefined' && isNative(Set)) {
  29080. // use native Set when available.
  29081. _Set = Set;
  29082. } else {
  29083. // a non-standard Set polyfill that only works with primitive keys.
  29084. _Set = /*@__PURE__*/(function () {
  29085. function Set () {
  29086. this.set = Object.create(null);
  29087. }
  29088. Set.prototype.has = function has (key) {
  29089. return this.set[key] === true
  29090. };
  29091. Set.prototype.add = function add (key) {
  29092. this.set[key] = true;
  29093. };
  29094. Set.prototype.clear = function clear () {
  29095. this.set = Object.create(null);
  29096. };
  29097. return Set;
  29098. }());
  29099. }
  29100. /* */
  29101. var warn = noop;
  29102. var tip = noop;
  29103. var generateComponentTrace = (noop); // work around flow check
  29104. var formatComponentName = (noop);
  29105. {
  29106. var hasConsole = typeof console !== 'undefined';
  29107. var classifyRE = /(?:^|[-_])(\w)/g;
  29108. var classify = function (str) { return str
  29109. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  29110. .replace(/[-_]/g, ''); };
  29111. warn = function (msg, vm) {
  29112. var trace = vm ? generateComponentTrace(vm) : '';
  29113. if (config.warnHandler) {
  29114. config.warnHandler.call(null, msg, vm, trace);
  29115. } else if (hasConsole && (!config.silent)) {
  29116. console.error(("[Vue warn]: " + msg + trace));
  29117. }
  29118. };
  29119. tip = function (msg, vm) {
  29120. if (hasConsole && (!config.silent)) {
  29121. console.warn("[Vue tip]: " + msg + (
  29122. vm ? generateComponentTrace(vm) : ''
  29123. ));
  29124. }
  29125. };
  29126. formatComponentName = function (vm, includeFile) {
  29127. if (vm.$root === vm) {
  29128. return '<Root>'
  29129. }
  29130. var options = typeof vm === 'function' && vm.cid != null
  29131. ? vm.options
  29132. : vm._isVue
  29133. ? vm.$options || vm.constructor.options
  29134. : vm;
  29135. var name = options.name || options._componentTag;
  29136. var file = options.__file;
  29137. if (!name && file) {
  29138. var match = file.match(/([^/\\]+)\.vue$/);
  29139. name = match && match[1];
  29140. }
  29141. return (
  29142. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  29143. (file && includeFile !== false ? (" at " + file) : '')
  29144. )
  29145. };
  29146. var repeat = function (str, n) {
  29147. var res = '';
  29148. while (n) {
  29149. if (n % 2 === 1) { res += str; }
  29150. if (n > 1) { str += str; }
  29151. n >>= 1;
  29152. }
  29153. return res
  29154. };
  29155. generateComponentTrace = function (vm) {
  29156. if (vm._isVue && vm.$parent) {
  29157. var tree = [];
  29158. var currentRecursiveSequence = 0;
  29159. while (vm) {
  29160. if (tree.length > 0) {
  29161. var last = tree[tree.length - 1];
  29162. if (last.constructor === vm.constructor) {
  29163. currentRecursiveSequence++;
  29164. vm = vm.$parent;
  29165. continue
  29166. } else if (currentRecursiveSequence > 0) {
  29167. tree[tree.length - 1] = [last, currentRecursiveSequence];
  29168. currentRecursiveSequence = 0;
  29169. }
  29170. }
  29171. tree.push(vm);
  29172. vm = vm.$parent;
  29173. }
  29174. return '\n\nfound in\n\n' + tree
  29175. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  29176. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  29177. : formatComponentName(vm))); })
  29178. .join('\n')
  29179. } else {
  29180. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  29181. }
  29182. };
  29183. }
  29184. /* */
  29185. var uid = 0;
  29186. /**
  29187. * A dep is an observable that can have multiple
  29188. * directives subscribing to it.
  29189. */
  29190. var Dep = function Dep () {
  29191. this.id = uid++;
  29192. this.subs = [];
  29193. };
  29194. Dep.prototype.addSub = function addSub (sub) {
  29195. this.subs.push(sub);
  29196. };
  29197. Dep.prototype.removeSub = function removeSub (sub) {
  29198. remove(this.subs, sub);
  29199. };
  29200. Dep.prototype.depend = function depend () {
  29201. if (Dep.target) {
  29202. Dep.target.addDep(this);
  29203. }
  29204. };
  29205. Dep.prototype.notify = function notify () {
  29206. // stabilize the subscriber list first
  29207. var subs = this.subs.slice();
  29208. if (!config.async) {
  29209. // subs aren't sorted in scheduler if not running async
  29210. // we need to sort them now to make sure they fire in correct
  29211. // order
  29212. subs.sort(function (a, b) { return a.id - b.id; });
  29213. }
  29214. for (var i = 0, l = subs.length; i < l; i++) {
  29215. subs[i].update();
  29216. }
  29217. };
  29218. // The current target watcher being evaluated.
  29219. // This is globally unique because only one watcher
  29220. // can be evaluated at a time.
  29221. Dep.target = null;
  29222. var targetStack = [];
  29223. function pushTarget (target) {
  29224. targetStack.push(target);
  29225. Dep.target = target;
  29226. }
  29227. function popTarget () {
  29228. targetStack.pop();
  29229. Dep.target = targetStack[targetStack.length - 1];
  29230. }
  29231. /* */
  29232. var VNode = function VNode (
  29233. tag,
  29234. data,
  29235. children,
  29236. text,
  29237. elm,
  29238. context,
  29239. componentOptions,
  29240. asyncFactory
  29241. ) {
  29242. this.tag = tag;
  29243. this.data = data;
  29244. this.children = children;
  29245. this.text = text;
  29246. this.elm = elm;
  29247. this.ns = undefined;
  29248. this.context = context;
  29249. this.fnContext = undefined;
  29250. this.fnOptions = undefined;
  29251. this.fnScopeId = undefined;
  29252. this.key = data && data.key;
  29253. this.componentOptions = componentOptions;
  29254. this.componentInstance = undefined;
  29255. this.parent = undefined;
  29256. this.raw = false;
  29257. this.isStatic = false;
  29258. this.isRootInsert = true;
  29259. this.isComment = false;
  29260. this.isCloned = false;
  29261. this.isOnce = false;
  29262. this.asyncFactory = asyncFactory;
  29263. this.asyncMeta = undefined;
  29264. this.isAsyncPlaceholder = false;
  29265. };
  29266. var prototypeAccessors = { child: { configurable: true } };
  29267. // DEPRECATED: alias for componentInstance for backwards compat.
  29268. /* istanbul ignore next */
  29269. prototypeAccessors.child.get = function () {
  29270. return this.componentInstance
  29271. };
  29272. Object.defineProperties( VNode.prototype, prototypeAccessors );
  29273. var createEmptyVNode = function (text) {
  29274. if ( text === void 0 ) text = '';
  29275. var node = new VNode();
  29276. node.text = text;
  29277. node.isComment = true;
  29278. return node
  29279. };
  29280. function createTextVNode (val) {
  29281. return new VNode(undefined, undefined, undefined, String(val))
  29282. }
  29283. // optimized shallow clone
  29284. // used for static nodes and slot nodes because they may be reused across
  29285. // multiple renders, cloning them avoids errors when DOM manipulations rely
  29286. // on their elm reference.
  29287. function cloneVNode (vnode) {
  29288. var cloned = new VNode(
  29289. vnode.tag,
  29290. vnode.data,
  29291. // #7975
  29292. // clone children array to avoid mutating original in case of cloning
  29293. // a child.
  29294. vnode.children && vnode.children.slice(),
  29295. vnode.text,
  29296. vnode.elm,
  29297. vnode.context,
  29298. vnode.componentOptions,
  29299. vnode.asyncFactory
  29300. );
  29301. cloned.ns = vnode.ns;
  29302. cloned.isStatic = vnode.isStatic;
  29303. cloned.key = vnode.key;
  29304. cloned.isComment = vnode.isComment;
  29305. cloned.fnContext = vnode.fnContext;
  29306. cloned.fnOptions = vnode.fnOptions;
  29307. cloned.fnScopeId = vnode.fnScopeId;
  29308. cloned.asyncMeta = vnode.asyncMeta;
  29309. cloned.isCloned = true;
  29310. return cloned
  29311. }
  29312. /*
  29313. * not type checking this file because flow doesn't play well with
  29314. * dynamically accessing methods on Array prototype
  29315. */
  29316. var arrayProto = Array.prototype;
  29317. var arrayMethods = Object.create(arrayProto);
  29318. var methodsToPatch = [
  29319. 'push',
  29320. 'pop',
  29321. 'shift',
  29322. 'unshift',
  29323. 'splice',
  29324. 'sort',
  29325. 'reverse'
  29326. ];
  29327. /**
  29328. * Intercept mutating methods and emit events
  29329. */
  29330. methodsToPatch.forEach(function (method) {
  29331. // cache original method
  29332. var original = arrayProto[method];
  29333. def(arrayMethods, method, function mutator () {
  29334. var args = [], len = arguments.length;
  29335. while ( len-- ) args[ len ] = arguments[ len ];
  29336. var result = original.apply(this, args);
  29337. var ob = this.__ob__;
  29338. var inserted;
  29339. switch (method) {
  29340. case 'push':
  29341. case 'unshift':
  29342. inserted = args;
  29343. break
  29344. case 'splice':
  29345. inserted = args.slice(2);
  29346. break
  29347. }
  29348. if (inserted) { ob.observeArray(inserted); }
  29349. // notify change
  29350. ob.dep.notify();
  29351. return result
  29352. });
  29353. });
  29354. /* */
  29355. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  29356. /**
  29357. * In some cases we may want to disable observation inside a component's
  29358. * update computation.
  29359. */
  29360. var shouldObserve = true;
  29361. function toggleObserving (value) {
  29362. shouldObserve = value;
  29363. }
  29364. /**
  29365. * Observer class that is attached to each observed
  29366. * object. Once attached, the observer converts the target
  29367. * object's property keys into getter/setters that
  29368. * collect dependencies and dispatch updates.
  29369. */
  29370. var Observer = function Observer (value) {
  29371. this.value = value;
  29372. this.dep = new Dep();
  29373. this.vmCount = 0;
  29374. def(value, '__ob__', this);
  29375. if (Array.isArray(value)) {
  29376. if (hasProto) {
  29377. protoAugment(value, arrayMethods);
  29378. } else {
  29379. copyAugment(value, arrayMethods, arrayKeys);
  29380. }
  29381. this.observeArray(value);
  29382. } else {
  29383. this.walk(value);
  29384. }
  29385. };
  29386. /**
  29387. * Walk through all properties and convert them into
  29388. * getter/setters. This method should only be called when
  29389. * value type is Object.
  29390. */
  29391. Observer.prototype.walk = function walk (obj) {
  29392. var keys = Object.keys(obj);
  29393. for (var i = 0; i < keys.length; i++) {
  29394. defineReactive$$1(obj, keys[i]);
  29395. }
  29396. };
  29397. /**
  29398. * Observe a list of Array items.
  29399. */
  29400. Observer.prototype.observeArray = function observeArray (items) {
  29401. for (var i = 0, l = items.length; i < l; i++) {
  29402. observe(items[i]);
  29403. }
  29404. };
  29405. // helpers
  29406. /**
  29407. * Augment a target Object or Array by intercepting
  29408. * the prototype chain using __proto__
  29409. */
  29410. function protoAugment (target, src) {
  29411. /* eslint-disable no-proto */
  29412. target.__proto__ = src;
  29413. /* eslint-enable no-proto */
  29414. }
  29415. /**
  29416. * Augment a target Object or Array by defining
  29417. * hidden properties.
  29418. */
  29419. /* istanbul ignore next */
  29420. function copyAugment (target, src, keys) {
  29421. for (var i = 0, l = keys.length; i < l; i++) {
  29422. var key = keys[i];
  29423. def(target, key, src[key]);
  29424. }
  29425. }
  29426. /**
  29427. * Attempt to create an observer instance for a value,
  29428. * returns the new observer if successfully observed,
  29429. * or the existing observer if the value already has one.
  29430. */
  29431. function observe (value, asRootData) {
  29432. if (!isObject(value) || value instanceof VNode) {
  29433. return
  29434. }
  29435. var ob;
  29436. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  29437. ob = value.__ob__;
  29438. } else if (
  29439. shouldObserve &&
  29440. !isServerRendering() &&
  29441. (Array.isArray(value) || isPlainObject(value)) &&
  29442. Object.isExtensible(value) &&
  29443. !value._isVue
  29444. ) {
  29445. ob = new Observer(value);
  29446. }
  29447. if (asRootData && ob) {
  29448. ob.vmCount++;
  29449. }
  29450. return ob
  29451. }
  29452. /**
  29453. * Define a reactive property on an Object.
  29454. */
  29455. function defineReactive$$1 (
  29456. obj,
  29457. key,
  29458. val,
  29459. customSetter,
  29460. shallow
  29461. ) {
  29462. var dep = new Dep();
  29463. var property = Object.getOwnPropertyDescriptor(obj, key);
  29464. if (property && property.configurable === false) {
  29465. return
  29466. }
  29467. // cater for pre-defined getter/setters
  29468. var getter = property && property.get;
  29469. var setter = property && property.set;
  29470. if ((!getter || setter) && arguments.length === 2) {
  29471. val = obj[key];
  29472. }
  29473. var childOb = !shallow && observe(val);
  29474. Object.defineProperty(obj, key, {
  29475. enumerable: true,
  29476. configurable: true,
  29477. get: function reactiveGetter () {
  29478. var value = getter ? getter.call(obj) : val;
  29479. if (Dep.target) {
  29480. dep.depend();
  29481. if (childOb) {
  29482. childOb.dep.depend();
  29483. if (Array.isArray(value)) {
  29484. dependArray(value);
  29485. }
  29486. }
  29487. }
  29488. return value
  29489. },
  29490. set: function reactiveSetter (newVal) {
  29491. var value = getter ? getter.call(obj) : val;
  29492. /* eslint-disable no-self-compare */
  29493. if (newVal === value || (newVal !== newVal && value !== value)) {
  29494. return
  29495. }
  29496. /* eslint-enable no-self-compare */
  29497. if (customSetter) {
  29498. customSetter();
  29499. }
  29500. // #7981: for accessor properties without setter
  29501. if (getter && !setter) { return }
  29502. if (setter) {
  29503. setter.call(obj, newVal);
  29504. } else {
  29505. val = newVal;
  29506. }
  29507. childOb = !shallow && observe(newVal);
  29508. dep.notify();
  29509. }
  29510. });
  29511. }
  29512. /**
  29513. * Set a property on an object. Adds the new property and
  29514. * triggers change notification if the property doesn't
  29515. * already exist.
  29516. */
  29517. function set (target, key, val) {
  29518. if (isUndef(target) || isPrimitive(target)
  29519. ) {
  29520. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  29521. }
  29522. if (Array.isArray(target) && isValidArrayIndex(key)) {
  29523. target.length = Math.max(target.length, key);
  29524. target.splice(key, 1, val);
  29525. return val
  29526. }
  29527. if (key in target && !(key in Object.prototype)) {
  29528. target[key] = val;
  29529. return val
  29530. }
  29531. var ob = (target).__ob__;
  29532. if (target._isVue || (ob && ob.vmCount)) {
  29533. warn(
  29534. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  29535. 'at runtime - declare it upfront in the data option.'
  29536. );
  29537. return val
  29538. }
  29539. if (!ob) {
  29540. target[key] = val;
  29541. return val
  29542. }
  29543. defineReactive$$1(ob.value, key, val);
  29544. ob.dep.notify();
  29545. return val
  29546. }
  29547. /**
  29548. * Delete a property and trigger change if necessary.
  29549. */
  29550. function del (target, key) {
  29551. if (isUndef(target) || isPrimitive(target)
  29552. ) {
  29553. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  29554. }
  29555. if (Array.isArray(target) && isValidArrayIndex(key)) {
  29556. target.splice(key, 1);
  29557. return
  29558. }
  29559. var ob = (target).__ob__;
  29560. if (target._isVue || (ob && ob.vmCount)) {
  29561. warn(
  29562. 'Avoid deleting properties on a Vue instance or its root $data ' +
  29563. '- just set it to null.'
  29564. );
  29565. return
  29566. }
  29567. if (!hasOwn(target, key)) {
  29568. return
  29569. }
  29570. delete target[key];
  29571. if (!ob) {
  29572. return
  29573. }
  29574. ob.dep.notify();
  29575. }
  29576. /**
  29577. * Collect dependencies on array elements when the array is touched, since
  29578. * we cannot intercept array element access like property getters.
  29579. */
  29580. function dependArray (value) {
  29581. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  29582. e = value[i];
  29583. e && e.__ob__ && e.__ob__.dep.depend();
  29584. if (Array.isArray(e)) {
  29585. dependArray(e);
  29586. }
  29587. }
  29588. }
  29589. /* */
  29590. /**
  29591. * Option overwriting strategies are functions that handle
  29592. * how to merge a parent option value and a child option
  29593. * value into the final value.
  29594. */
  29595. var strats = config.optionMergeStrategies;
  29596. /**
  29597. * Options with restrictions
  29598. */
  29599. {
  29600. strats.el = strats.propsData = function (parent, child, vm, key) {
  29601. if (!vm) {
  29602. warn(
  29603. "option \"" + key + "\" can only be used during instance " +
  29604. 'creation with the `new` keyword.'
  29605. );
  29606. }
  29607. return defaultStrat(parent, child)
  29608. };
  29609. }
  29610. /**
  29611. * Helper that recursively merges two data objects together.
  29612. */
  29613. function mergeData (to, from) {
  29614. if (!from) { return to }
  29615. var key, toVal, fromVal;
  29616. var keys = hasSymbol
  29617. ? Reflect.ownKeys(from)
  29618. : Object.keys(from);
  29619. for (var i = 0; i < keys.length; i++) {
  29620. key = keys[i];
  29621. // in case the object is already observed...
  29622. if (key === '__ob__') { continue }
  29623. toVal = to[key];
  29624. fromVal = from[key];
  29625. if (!hasOwn(to, key)) {
  29626. set(to, key, fromVal);
  29627. } else if (
  29628. toVal !== fromVal &&
  29629. isPlainObject(toVal) &&
  29630. isPlainObject(fromVal)
  29631. ) {
  29632. mergeData(toVal, fromVal);
  29633. }
  29634. }
  29635. return to
  29636. }
  29637. /**
  29638. * Data
  29639. */
  29640. function mergeDataOrFn (
  29641. parentVal,
  29642. childVal,
  29643. vm
  29644. ) {
  29645. if (!vm) {
  29646. // in a Vue.extend merge, both should be functions
  29647. if (!childVal) {
  29648. return parentVal
  29649. }
  29650. if (!parentVal) {
  29651. return childVal
  29652. }
  29653. // when parentVal & childVal are both present,
  29654. // we need to return a function that returns the
  29655. // merged result of both functions... no need to
  29656. // check if parentVal is a function here because
  29657. // it has to be a function to pass previous merges.
  29658. return function mergedDataFn () {
  29659. return mergeData(
  29660. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  29661. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  29662. )
  29663. }
  29664. } else {
  29665. return function mergedInstanceDataFn () {
  29666. // instance merge
  29667. var instanceData = typeof childVal === 'function'
  29668. ? childVal.call(vm, vm)
  29669. : childVal;
  29670. var defaultData = typeof parentVal === 'function'
  29671. ? parentVal.call(vm, vm)
  29672. : parentVal;
  29673. if (instanceData) {
  29674. return mergeData(instanceData, defaultData)
  29675. } else {
  29676. return defaultData
  29677. }
  29678. }
  29679. }
  29680. }
  29681. strats.data = function (
  29682. parentVal,
  29683. childVal,
  29684. vm
  29685. ) {
  29686. if (!vm) {
  29687. if (childVal && typeof childVal !== 'function') {
  29688. warn(
  29689. 'The "data" option should be a function ' +
  29690. 'that returns a per-instance value in component ' +
  29691. 'definitions.',
  29692. vm
  29693. );
  29694. return parentVal
  29695. }
  29696. return mergeDataOrFn(parentVal, childVal)
  29697. }
  29698. return mergeDataOrFn(parentVal, childVal, vm)
  29699. };
  29700. /**
  29701. * Hooks and props are merged as arrays.
  29702. */
  29703. function mergeHook (
  29704. parentVal,
  29705. childVal
  29706. ) {
  29707. var res = childVal
  29708. ? parentVal
  29709. ? parentVal.concat(childVal)
  29710. : Array.isArray(childVal)
  29711. ? childVal
  29712. : [childVal]
  29713. : parentVal;
  29714. return res
  29715. ? dedupeHooks(res)
  29716. : res
  29717. }
  29718. function dedupeHooks (hooks) {
  29719. var res = [];
  29720. for (var i = 0; i < hooks.length; i++) {
  29721. if (res.indexOf(hooks[i]) === -1) {
  29722. res.push(hooks[i]);
  29723. }
  29724. }
  29725. return res
  29726. }
  29727. LIFECYCLE_HOOKS.forEach(function (hook) {
  29728. strats[hook] = mergeHook;
  29729. });
  29730. /**
  29731. * Assets
  29732. *
  29733. * When a vm is present (instance creation), we need to do
  29734. * a three-way merge between constructor options, instance
  29735. * options and parent options.
  29736. */
  29737. function mergeAssets (
  29738. parentVal,
  29739. childVal,
  29740. vm,
  29741. key
  29742. ) {
  29743. var res = Object.create(parentVal || null);
  29744. if (childVal) {
  29745. assertObjectType(key, childVal, vm);
  29746. return extend(res, childVal)
  29747. } else {
  29748. return res
  29749. }
  29750. }
  29751. ASSET_TYPES.forEach(function (type) {
  29752. strats[type + 's'] = mergeAssets;
  29753. });
  29754. /**
  29755. * Watchers.
  29756. *
  29757. * Watchers hashes should not overwrite one
  29758. * another, so we merge them as arrays.
  29759. */
  29760. strats.watch = function (
  29761. parentVal,
  29762. childVal,
  29763. vm,
  29764. key
  29765. ) {
  29766. // work around Firefox's Object.prototype.watch...
  29767. if (parentVal === nativeWatch) { parentVal = undefined; }
  29768. if (childVal === nativeWatch) { childVal = undefined; }
  29769. /* istanbul ignore if */
  29770. if (!childVal) { return Object.create(parentVal || null) }
  29771. {
  29772. assertObjectType(key, childVal, vm);
  29773. }
  29774. if (!parentVal) { return childVal }
  29775. var ret = {};
  29776. extend(ret, parentVal);
  29777. for (var key$1 in childVal) {
  29778. var parent = ret[key$1];
  29779. var child = childVal[key$1];
  29780. if (parent && !Array.isArray(parent)) {
  29781. parent = [parent];
  29782. }
  29783. ret[key$1] = parent
  29784. ? parent.concat(child)
  29785. : Array.isArray(child) ? child : [child];
  29786. }
  29787. return ret
  29788. };
  29789. /**
  29790. * Other object hashes.
  29791. */
  29792. strats.props =
  29793. strats.methods =
  29794. strats.inject =
  29795. strats.computed = function (
  29796. parentVal,
  29797. childVal,
  29798. vm,
  29799. key
  29800. ) {
  29801. if (childVal && "development" !== 'production') {
  29802. assertObjectType(key, childVal, vm);
  29803. }
  29804. if (!parentVal) { return childVal }
  29805. var ret = Object.create(null);
  29806. extend(ret, parentVal);
  29807. if (childVal) { extend(ret, childVal); }
  29808. return ret
  29809. };
  29810. strats.provide = mergeDataOrFn;
  29811. /**
  29812. * Default strategy.
  29813. */
  29814. var defaultStrat = function (parentVal, childVal) {
  29815. return childVal === undefined
  29816. ? parentVal
  29817. : childVal
  29818. };
  29819. /**
  29820. * Validate component names
  29821. */
  29822. function checkComponents (options) {
  29823. for (var key in options.components) {
  29824. validateComponentName(key);
  29825. }
  29826. }
  29827. function validateComponentName (name) {
  29828. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  29829. warn(
  29830. 'Invalid component name: "' + name + '". Component names ' +
  29831. 'should conform to valid custom element name in html5 specification.'
  29832. );
  29833. }
  29834. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  29835. warn(
  29836. 'Do not use built-in or reserved HTML elements as component ' +
  29837. 'id: ' + name
  29838. );
  29839. }
  29840. }
  29841. /**
  29842. * Ensure all props option syntax are normalized into the
  29843. * Object-based format.
  29844. */
  29845. function normalizeProps (options, vm) {
  29846. var props = options.props;
  29847. if (!props) { return }
  29848. var res = {};
  29849. var i, val, name;
  29850. if (Array.isArray(props)) {
  29851. i = props.length;
  29852. while (i--) {
  29853. val = props[i];
  29854. if (typeof val === 'string') {
  29855. name = camelize(val);
  29856. res[name] = { type: null };
  29857. } else {
  29858. warn('props must be strings when using array syntax.');
  29859. }
  29860. }
  29861. } else if (isPlainObject(props)) {
  29862. for (var key in props) {
  29863. val = props[key];
  29864. name = camelize(key);
  29865. res[name] = isPlainObject(val)
  29866. ? val
  29867. : { type: val };
  29868. }
  29869. } else {
  29870. warn(
  29871. "Invalid value for option \"props\": expected an Array or an Object, " +
  29872. "but got " + (toRawType(props)) + ".",
  29873. vm
  29874. );
  29875. }
  29876. options.props = res;
  29877. }
  29878. /**
  29879. * Normalize all injections into Object-based format
  29880. */
  29881. function normalizeInject (options, vm) {
  29882. var inject = options.inject;
  29883. if (!inject) { return }
  29884. var normalized = options.inject = {};
  29885. if (Array.isArray(inject)) {
  29886. for (var i = 0; i < inject.length; i++) {
  29887. normalized[inject[i]] = { from: inject[i] };
  29888. }
  29889. } else if (isPlainObject(inject)) {
  29890. for (var key in inject) {
  29891. var val = inject[key];
  29892. normalized[key] = isPlainObject(val)
  29893. ? extend({ from: key }, val)
  29894. : { from: val };
  29895. }
  29896. } else {
  29897. warn(
  29898. "Invalid value for option \"inject\": expected an Array or an Object, " +
  29899. "but got " + (toRawType(inject)) + ".",
  29900. vm
  29901. );
  29902. }
  29903. }
  29904. /**
  29905. * Normalize raw function directives into object format.
  29906. */
  29907. function normalizeDirectives (options) {
  29908. var dirs = options.directives;
  29909. if (dirs) {
  29910. for (var key in dirs) {
  29911. var def$$1 = dirs[key];
  29912. if (typeof def$$1 === 'function') {
  29913. dirs[key] = { bind: def$$1, update: def$$1 };
  29914. }
  29915. }
  29916. }
  29917. }
  29918. function assertObjectType (name, value, vm) {
  29919. if (!isPlainObject(value)) {
  29920. warn(
  29921. "Invalid value for option \"" + name + "\": expected an Object, " +
  29922. "but got " + (toRawType(value)) + ".",
  29923. vm
  29924. );
  29925. }
  29926. }
  29927. /**
  29928. * Merge two option objects into a new one.
  29929. * Core utility used in both instantiation and inheritance.
  29930. */
  29931. function mergeOptions (
  29932. parent,
  29933. child,
  29934. vm
  29935. ) {
  29936. {
  29937. checkComponents(child);
  29938. }
  29939. if (typeof child === 'function') {
  29940. child = child.options;
  29941. }
  29942. normalizeProps(child, vm);
  29943. normalizeInject(child, vm);
  29944. normalizeDirectives(child);
  29945. // Apply extends and mixins on the child options,
  29946. // but only if it is a raw options object that isn't
  29947. // the result of another mergeOptions call.
  29948. // Only merged options has the _base property.
  29949. if (!child._base) {
  29950. if (child.extends) {
  29951. parent = mergeOptions(parent, child.extends, vm);
  29952. }
  29953. if (child.mixins) {
  29954. for (var i = 0, l = child.mixins.length; i < l; i++) {
  29955. parent = mergeOptions(parent, child.mixins[i], vm);
  29956. }
  29957. }
  29958. }
  29959. var options = {};
  29960. var key;
  29961. for (key in parent) {
  29962. mergeField(key);
  29963. }
  29964. for (key in child) {
  29965. if (!hasOwn(parent, key)) {
  29966. mergeField(key);
  29967. }
  29968. }
  29969. function mergeField (key) {
  29970. var strat = strats[key] || defaultStrat;
  29971. options[key] = strat(parent[key], child[key], vm, key);
  29972. }
  29973. return options
  29974. }
  29975. /**
  29976. * Resolve an asset.
  29977. * This function is used because child instances need access
  29978. * to assets defined in its ancestor chain.
  29979. */
  29980. function resolveAsset (
  29981. options,
  29982. type,
  29983. id,
  29984. warnMissing
  29985. ) {
  29986. /* istanbul ignore if */
  29987. if (typeof id !== 'string') {
  29988. return
  29989. }
  29990. var assets = options[type];
  29991. // check local registration variations first
  29992. if (hasOwn(assets, id)) { return assets[id] }
  29993. var camelizedId = camelize(id);
  29994. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  29995. var PascalCaseId = capitalize(camelizedId);
  29996. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  29997. // fallback to prototype chain
  29998. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  29999. if (warnMissing && !res) {
  30000. warn(
  30001. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  30002. options
  30003. );
  30004. }
  30005. return res
  30006. }
  30007. /* */
  30008. function validateProp (
  30009. key,
  30010. propOptions,
  30011. propsData,
  30012. vm
  30013. ) {
  30014. var prop = propOptions[key];
  30015. var absent = !hasOwn(propsData, key);
  30016. var value = propsData[key];
  30017. // boolean casting
  30018. var booleanIndex = getTypeIndex(Boolean, prop.type);
  30019. if (booleanIndex > -1) {
  30020. if (absent && !hasOwn(prop, 'default')) {
  30021. value = false;
  30022. } else if (value === '' || value === hyphenate(key)) {
  30023. // only cast empty string / same name to boolean if
  30024. // boolean has higher priority
  30025. var stringIndex = getTypeIndex(String, prop.type);
  30026. if (stringIndex < 0 || booleanIndex < stringIndex) {
  30027. value = true;
  30028. }
  30029. }
  30030. }
  30031. // check default value
  30032. if (value === undefined) {
  30033. value = getPropDefaultValue(vm, prop, key);
  30034. // since the default value is a fresh copy,
  30035. // make sure to observe it.
  30036. var prevShouldObserve = shouldObserve;
  30037. toggleObserving(true);
  30038. observe(value);
  30039. toggleObserving(prevShouldObserve);
  30040. }
  30041. {
  30042. assertProp(prop, key, value, vm, absent);
  30043. }
  30044. return value
  30045. }
  30046. /**
  30047. * Get the default value of a prop.
  30048. */
  30049. function getPropDefaultValue (vm, prop, key) {
  30050. // no default, return undefined
  30051. if (!hasOwn(prop, 'default')) {
  30052. return undefined
  30053. }
  30054. var def = prop.default;
  30055. // warn against non-factory defaults for Object & Array
  30056. if (isObject(def)) {
  30057. warn(
  30058. 'Invalid default value for prop "' + key + '": ' +
  30059. 'Props with type Object/Array must use a factory function ' +
  30060. 'to return the default value.',
  30061. vm
  30062. );
  30063. }
  30064. // the raw prop value was also undefined from previous render,
  30065. // return previous default value to avoid unnecessary watcher trigger
  30066. if (vm && vm.$options.propsData &&
  30067. vm.$options.propsData[key] === undefined &&
  30068. vm._props[key] !== undefined
  30069. ) {
  30070. return vm._props[key]
  30071. }
  30072. // call factory function for non-Function types
  30073. // a value is Function if its prototype is function even across different execution context
  30074. return typeof def === 'function' && getType(prop.type) !== 'Function'
  30075. ? def.call(vm)
  30076. : def
  30077. }
  30078. /**
  30079. * Assert whether a prop is valid.
  30080. */
  30081. function assertProp (
  30082. prop,
  30083. name,
  30084. value,
  30085. vm,
  30086. absent
  30087. ) {
  30088. if (prop.required && absent) {
  30089. warn(
  30090. 'Missing required prop: "' + name + '"',
  30091. vm
  30092. );
  30093. return
  30094. }
  30095. if (value == null && !prop.required) {
  30096. return
  30097. }
  30098. var type = prop.type;
  30099. var valid = !type || type === true;
  30100. var expectedTypes = [];
  30101. if (type) {
  30102. if (!Array.isArray(type)) {
  30103. type = [type];
  30104. }
  30105. for (var i = 0; i < type.length && !valid; i++) {
  30106. var assertedType = assertType(value, type[i]);
  30107. expectedTypes.push(assertedType.expectedType || '');
  30108. valid = assertedType.valid;
  30109. }
  30110. }
  30111. if (!valid) {
  30112. warn(
  30113. getInvalidTypeMessage(name, value, expectedTypes),
  30114. vm
  30115. );
  30116. return
  30117. }
  30118. var validator = prop.validator;
  30119. if (validator) {
  30120. if (!validator(value)) {
  30121. warn(
  30122. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  30123. vm
  30124. );
  30125. }
  30126. }
  30127. }
  30128. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  30129. function assertType (value, type) {
  30130. var valid;
  30131. var expectedType = getType(type);
  30132. if (simpleCheckRE.test(expectedType)) {
  30133. var t = typeof value;
  30134. valid = t === expectedType.toLowerCase();
  30135. // for primitive wrapper objects
  30136. if (!valid && t === 'object') {
  30137. valid = value instanceof type;
  30138. }
  30139. } else if (expectedType === 'Object') {
  30140. valid = isPlainObject(value);
  30141. } else if (expectedType === 'Array') {
  30142. valid = Array.isArray(value);
  30143. } else {
  30144. valid = value instanceof type;
  30145. }
  30146. return {
  30147. valid: valid,
  30148. expectedType: expectedType
  30149. }
  30150. }
  30151. /**
  30152. * Use function string name to check built-in types,
  30153. * because a simple equality check will fail when running
  30154. * across different vms / iframes.
  30155. */
  30156. function getType (fn) {
  30157. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  30158. return match ? match[1] : ''
  30159. }
  30160. function isSameType (a, b) {
  30161. return getType(a) === getType(b)
  30162. }
  30163. function getTypeIndex (type, expectedTypes) {
  30164. if (!Array.isArray(expectedTypes)) {
  30165. return isSameType(expectedTypes, type) ? 0 : -1
  30166. }
  30167. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  30168. if (isSameType(expectedTypes[i], type)) {
  30169. return i
  30170. }
  30171. }
  30172. return -1
  30173. }
  30174. function getInvalidTypeMessage (name, value, expectedTypes) {
  30175. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  30176. " Expected " + (expectedTypes.map(capitalize).join(', '));
  30177. var expectedType = expectedTypes[0];
  30178. var receivedType = toRawType(value);
  30179. var expectedValue = styleValue(value, expectedType);
  30180. var receivedValue = styleValue(value, receivedType);
  30181. // check if we need to specify expected value
  30182. if (expectedTypes.length === 1 &&
  30183. isExplicable(expectedType) &&
  30184. !isBoolean(expectedType, receivedType)) {
  30185. message += " with value " + expectedValue;
  30186. }
  30187. message += ", got " + receivedType + " ";
  30188. // check if we need to specify received value
  30189. if (isExplicable(receivedType)) {
  30190. message += "with value " + receivedValue + ".";
  30191. }
  30192. return message
  30193. }
  30194. function styleValue (value, type) {
  30195. if (type === 'String') {
  30196. return ("\"" + value + "\"")
  30197. } else if (type === 'Number') {
  30198. return ("" + (Number(value)))
  30199. } else {
  30200. return ("" + value)
  30201. }
  30202. }
  30203. function isExplicable (value) {
  30204. var explicitTypes = ['string', 'number', 'boolean'];
  30205. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  30206. }
  30207. function isBoolean () {
  30208. var args = [], len = arguments.length;
  30209. while ( len-- ) args[ len ] = arguments[ len ];
  30210. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  30211. }
  30212. /* */
  30213. function handleError (err, vm, info) {
  30214. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  30215. // See: https://github.com/vuejs/vuex/issues/1505
  30216. pushTarget();
  30217. try {
  30218. if (vm) {
  30219. var cur = vm;
  30220. while ((cur = cur.$parent)) {
  30221. var hooks = cur.$options.errorCaptured;
  30222. if (hooks) {
  30223. for (var i = 0; i < hooks.length; i++) {
  30224. try {
  30225. var capture = hooks[i].call(cur, err, vm, info) === false;
  30226. if (capture) { return }
  30227. } catch (e) {
  30228. globalHandleError(e, cur, 'errorCaptured hook');
  30229. }
  30230. }
  30231. }
  30232. }
  30233. }
  30234. globalHandleError(err, vm, info);
  30235. } finally {
  30236. popTarget();
  30237. }
  30238. }
  30239. function invokeWithErrorHandling (
  30240. handler,
  30241. context,
  30242. args,
  30243. vm,
  30244. info
  30245. ) {
  30246. var res;
  30247. try {
  30248. res = args ? handler.apply(context, args) : handler.call(context);
  30249. if (res && !res._isVue && isPromise(res) && !res._handled) {
  30250. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  30251. // issue #9511
  30252. // avoid catch triggering multiple times when nested calls
  30253. res._handled = true;
  30254. }
  30255. } catch (e) {
  30256. handleError(e, vm, info);
  30257. }
  30258. return res
  30259. }
  30260. function globalHandleError (err, vm, info) {
  30261. if (config.errorHandler) {
  30262. try {
  30263. return config.errorHandler.call(null, err, vm, info)
  30264. } catch (e) {
  30265. // if the user intentionally throws the original error in the handler,
  30266. // do not log it twice
  30267. if (e !== err) {
  30268. logError(e, null, 'config.errorHandler');
  30269. }
  30270. }
  30271. }
  30272. logError(err, vm, info);
  30273. }
  30274. function logError (err, vm, info) {
  30275. {
  30276. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  30277. }
  30278. /* istanbul ignore else */
  30279. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  30280. console.error(err);
  30281. } else {
  30282. throw err
  30283. }
  30284. }
  30285. /* */
  30286. var isUsingMicroTask = false;
  30287. var callbacks = [];
  30288. var pending = false;
  30289. function flushCallbacks () {
  30290. pending = false;
  30291. var copies = callbacks.slice(0);
  30292. callbacks.length = 0;
  30293. for (var i = 0; i < copies.length; i++) {
  30294. copies[i]();
  30295. }
  30296. }
  30297. // Here we have async deferring wrappers using microtasks.
  30298. // In 2.5 we used (macro) tasks (in combination with microtasks).
  30299. // However, it has subtle problems when state is changed right before repaint
  30300. // (e.g. #6813, out-in transitions).
  30301. // Also, using (macro) tasks in event handler would cause some weird behaviors
  30302. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  30303. // So we now use microtasks everywhere, again.
  30304. // A major drawback of this tradeoff is that there are some scenarios
  30305. // where microtasks have too high a priority and fire in between supposedly
  30306. // sequential events (e.g. #4521, #6690, which have workarounds)
  30307. // or even between bubbling of the same event (#6566).
  30308. var timerFunc;
  30309. // The nextTick behavior leverages the microtask queue, which can be accessed
  30310. // via either native Promise.then or MutationObserver.
  30311. // MutationObserver has wider support, however it is seriously bugged in
  30312. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  30313. // completely stops working after triggering a few times... so, if native
  30314. // Promise is available, we will use it:
  30315. /* istanbul ignore next, $flow-disable-line */
  30316. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  30317. var p = Promise.resolve();
  30318. timerFunc = function () {
  30319. p.then(flushCallbacks);
  30320. // In problematic UIWebViews, Promise.then doesn't completely break, but
  30321. // it can get stuck in a weird state where callbacks are pushed into the
  30322. // microtask queue but the queue isn't being flushed, until the browser
  30323. // needs to do some other work, e.g. handle a timer. Therefore we can
  30324. // "force" the microtask queue to be flushed by adding an empty timer.
  30325. if (isIOS) { setTimeout(noop); }
  30326. };
  30327. isUsingMicroTask = true;
  30328. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  30329. isNative(MutationObserver) ||
  30330. // PhantomJS and iOS 7.x
  30331. MutationObserver.toString() === '[object MutationObserverConstructor]'
  30332. )) {
  30333. // Use MutationObserver where native Promise is not available,
  30334. // e.g. PhantomJS, iOS7, Android 4.4
  30335. // (#6466 MutationObserver is unreliable in IE11)
  30336. var counter = 1;
  30337. var observer = new MutationObserver(flushCallbacks);
  30338. var textNode = document.createTextNode(String(counter));
  30339. observer.observe(textNode, {
  30340. characterData: true
  30341. });
  30342. timerFunc = function () {
  30343. counter = (counter + 1) % 2;
  30344. textNode.data = String(counter);
  30345. };
  30346. isUsingMicroTask = true;
  30347. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  30348. // Fallback to setImmediate.
  30349. // Technically it leverages the (macro) task queue,
  30350. // but it is still a better choice than setTimeout.
  30351. timerFunc = function () {
  30352. setImmediate(flushCallbacks);
  30353. };
  30354. } else {
  30355. // Fallback to setTimeout.
  30356. timerFunc = function () {
  30357. setTimeout(flushCallbacks, 0);
  30358. };
  30359. }
  30360. function nextTick (cb, ctx) {
  30361. var _resolve;
  30362. callbacks.push(function () {
  30363. if (cb) {
  30364. try {
  30365. cb.call(ctx);
  30366. } catch (e) {
  30367. handleError(e, ctx, 'nextTick');
  30368. }
  30369. } else if (_resolve) {
  30370. _resolve(ctx);
  30371. }
  30372. });
  30373. if (!pending) {
  30374. pending = true;
  30375. timerFunc();
  30376. }
  30377. // $flow-disable-line
  30378. if (!cb && typeof Promise !== 'undefined') {
  30379. return new Promise(function (resolve) {
  30380. _resolve = resolve;
  30381. })
  30382. }
  30383. }
  30384. /* */
  30385. var mark;
  30386. var measure;
  30387. {
  30388. var perf = inBrowser && window.performance;
  30389. /* istanbul ignore if */
  30390. if (
  30391. perf &&
  30392. perf.mark &&
  30393. perf.measure &&
  30394. perf.clearMarks &&
  30395. perf.clearMeasures
  30396. ) {
  30397. mark = function (tag) { return perf.mark(tag); };
  30398. measure = function (name, startTag, endTag) {
  30399. perf.measure(name, startTag, endTag);
  30400. perf.clearMarks(startTag);
  30401. perf.clearMarks(endTag);
  30402. // perf.clearMeasures(name)
  30403. };
  30404. }
  30405. }
  30406. /* not type checking this file because flow doesn't play well with Proxy */
  30407. var initProxy;
  30408. {
  30409. var allowedGlobals = makeMap(
  30410. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  30411. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  30412. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  30413. 'require' // for Webpack/Browserify
  30414. );
  30415. var warnNonPresent = function (target, key) {
  30416. warn(
  30417. "Property or method \"" + key + "\" is not defined on the instance but " +
  30418. 'referenced during render. Make sure that this property is reactive, ' +
  30419. 'either in the data option, or for class-based components, by ' +
  30420. 'initializing the property. ' +
  30421. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  30422. target
  30423. );
  30424. };
  30425. var warnReservedPrefix = function (target, key) {
  30426. warn(
  30427. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  30428. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  30429. 'prevent conflicts with Vue internals. ' +
  30430. 'See: https://vuejs.org/v2/api/#data',
  30431. target
  30432. );
  30433. };
  30434. var hasProxy =
  30435. typeof Proxy !== 'undefined' && isNative(Proxy);
  30436. if (hasProxy) {
  30437. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  30438. config.keyCodes = new Proxy(config.keyCodes, {
  30439. set: function set (target, key, value) {
  30440. if (isBuiltInModifier(key)) {
  30441. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  30442. return false
  30443. } else {
  30444. target[key] = value;
  30445. return true
  30446. }
  30447. }
  30448. });
  30449. }
  30450. var hasHandler = {
  30451. has: function has (target, key) {
  30452. var has = key in target;
  30453. var isAllowed = allowedGlobals(key) ||
  30454. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  30455. if (!has && !isAllowed) {
  30456. if (key in target.$data) { warnReservedPrefix(target, key); }
  30457. else { warnNonPresent(target, key); }
  30458. }
  30459. return has || !isAllowed
  30460. }
  30461. };
  30462. var getHandler = {
  30463. get: function get (target, key) {
  30464. if (typeof key === 'string' && !(key in target)) {
  30465. if (key in target.$data) { warnReservedPrefix(target, key); }
  30466. else { warnNonPresent(target, key); }
  30467. }
  30468. return target[key]
  30469. }
  30470. };
  30471. initProxy = function initProxy (vm) {
  30472. if (hasProxy) {
  30473. // determine which proxy handler to use
  30474. var options = vm.$options;
  30475. var handlers = options.render && options.render._withStripped
  30476. ? getHandler
  30477. : hasHandler;
  30478. vm._renderProxy = new Proxy(vm, handlers);
  30479. } else {
  30480. vm._renderProxy = vm;
  30481. }
  30482. };
  30483. }
  30484. /* */
  30485. var seenObjects = new _Set();
  30486. /**
  30487. * Recursively traverse an object to evoke all converted
  30488. * getters, so that every nested property inside the object
  30489. * is collected as a "deep" dependency.
  30490. */
  30491. function traverse (val) {
  30492. _traverse(val, seenObjects);
  30493. seenObjects.clear();
  30494. }
  30495. function _traverse (val, seen) {
  30496. var i, keys;
  30497. var isA = Array.isArray(val);
  30498. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  30499. return
  30500. }
  30501. if (val.__ob__) {
  30502. var depId = val.__ob__.dep.id;
  30503. if (seen.has(depId)) {
  30504. return
  30505. }
  30506. seen.add(depId);
  30507. }
  30508. if (isA) {
  30509. i = val.length;
  30510. while (i--) { _traverse(val[i], seen); }
  30511. } else {
  30512. keys = Object.keys(val);
  30513. i = keys.length;
  30514. while (i--) { _traverse(val[keys[i]], seen); }
  30515. }
  30516. }
  30517. /* */
  30518. var normalizeEvent = cached(function (name) {
  30519. var passive = name.charAt(0) === '&';
  30520. name = passive ? name.slice(1) : name;
  30521. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  30522. name = once$$1 ? name.slice(1) : name;
  30523. var capture = name.charAt(0) === '!';
  30524. name = capture ? name.slice(1) : name;
  30525. return {
  30526. name: name,
  30527. once: once$$1,
  30528. capture: capture,
  30529. passive: passive
  30530. }
  30531. });
  30532. function createFnInvoker (fns, vm) {
  30533. function invoker () {
  30534. var arguments$1 = arguments;
  30535. var fns = invoker.fns;
  30536. if (Array.isArray(fns)) {
  30537. var cloned = fns.slice();
  30538. for (var i = 0; i < cloned.length; i++) {
  30539. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  30540. }
  30541. } else {
  30542. // return handler return value for single handlers
  30543. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  30544. }
  30545. }
  30546. invoker.fns = fns;
  30547. return invoker
  30548. }
  30549. function updateListeners (
  30550. on,
  30551. oldOn,
  30552. add,
  30553. remove$$1,
  30554. createOnceHandler,
  30555. vm
  30556. ) {
  30557. var name, def$$1, cur, old, event;
  30558. for (name in on) {
  30559. def$$1 = cur = on[name];
  30560. old = oldOn[name];
  30561. event = normalizeEvent(name);
  30562. if (isUndef(cur)) {
  30563. warn(
  30564. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  30565. vm
  30566. );
  30567. } else if (isUndef(old)) {
  30568. if (isUndef(cur.fns)) {
  30569. cur = on[name] = createFnInvoker(cur, vm);
  30570. }
  30571. if (isTrue(event.once)) {
  30572. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  30573. }
  30574. add(event.name, cur, event.capture, event.passive, event.params);
  30575. } else if (cur !== old) {
  30576. old.fns = cur;
  30577. on[name] = old;
  30578. }
  30579. }
  30580. for (name in oldOn) {
  30581. if (isUndef(on[name])) {
  30582. event = normalizeEvent(name);
  30583. remove$$1(event.name, oldOn[name], event.capture);
  30584. }
  30585. }
  30586. }
  30587. /* */
  30588. function mergeVNodeHook (def, hookKey, hook) {
  30589. if (def instanceof VNode) {
  30590. def = def.data.hook || (def.data.hook = {});
  30591. }
  30592. var invoker;
  30593. var oldHook = def[hookKey];
  30594. function wrappedHook () {
  30595. hook.apply(this, arguments);
  30596. // important: remove merged hook to ensure it's called only once
  30597. // and prevent memory leak
  30598. remove(invoker.fns, wrappedHook);
  30599. }
  30600. if (isUndef(oldHook)) {
  30601. // no existing hook
  30602. invoker = createFnInvoker([wrappedHook]);
  30603. } else {
  30604. /* istanbul ignore if */
  30605. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  30606. // already a merged invoker
  30607. invoker = oldHook;
  30608. invoker.fns.push(wrappedHook);
  30609. } else {
  30610. // existing plain hook
  30611. invoker = createFnInvoker([oldHook, wrappedHook]);
  30612. }
  30613. }
  30614. invoker.merged = true;
  30615. def[hookKey] = invoker;
  30616. }
  30617. /* */
  30618. function extractPropsFromVNodeData (
  30619. data,
  30620. Ctor,
  30621. tag
  30622. ) {
  30623. // we are only extracting raw values here.
  30624. // validation and default values are handled in the child
  30625. // component itself.
  30626. var propOptions = Ctor.options.props;
  30627. if (isUndef(propOptions)) {
  30628. return
  30629. }
  30630. var res = {};
  30631. var attrs = data.attrs;
  30632. var props = data.props;
  30633. if (isDef(attrs) || isDef(props)) {
  30634. for (var key in propOptions) {
  30635. var altKey = hyphenate(key);
  30636. {
  30637. var keyInLowerCase = key.toLowerCase();
  30638. if (
  30639. key !== keyInLowerCase &&
  30640. attrs && hasOwn(attrs, keyInLowerCase)
  30641. ) {
  30642. tip(
  30643. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  30644. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  30645. " \"" + key + "\". " +
  30646. "Note that HTML attributes are case-insensitive and camelCased " +
  30647. "props need to use their kebab-case equivalents when using in-DOM " +
  30648. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  30649. );
  30650. }
  30651. }
  30652. checkProp(res, props, key, altKey, true) ||
  30653. checkProp(res, attrs, key, altKey, false);
  30654. }
  30655. }
  30656. return res
  30657. }
  30658. function checkProp (
  30659. res,
  30660. hash,
  30661. key,
  30662. altKey,
  30663. preserve
  30664. ) {
  30665. if (isDef(hash)) {
  30666. if (hasOwn(hash, key)) {
  30667. res[key] = hash[key];
  30668. if (!preserve) {
  30669. delete hash[key];
  30670. }
  30671. return true
  30672. } else if (hasOwn(hash, altKey)) {
  30673. res[key] = hash[altKey];
  30674. if (!preserve) {
  30675. delete hash[altKey];
  30676. }
  30677. return true
  30678. }
  30679. }
  30680. return false
  30681. }
  30682. /* */
  30683. // The template compiler attempts to minimize the need for normalization by
  30684. // statically analyzing the template at compile time.
  30685. //
  30686. // For plain HTML markup, normalization can be completely skipped because the
  30687. // generated render function is guaranteed to return Array<VNode>. There are
  30688. // two cases where extra normalization is needed:
  30689. // 1. When the children contains components - because a functional component
  30690. // may return an Array instead of a single root. In this case, just a simple
  30691. // normalization is needed - if any child is an Array, we flatten the whole
  30692. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  30693. // because functional components already normalize their own children.
  30694. function simpleNormalizeChildren (children) {
  30695. for (var i = 0; i < children.length; i++) {
  30696. if (Array.isArray(children[i])) {
  30697. return Array.prototype.concat.apply([], children)
  30698. }
  30699. }
  30700. return children
  30701. }
  30702. // 2. When the children contains constructs that always generated nested Arrays,
  30703. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  30704. // with hand-written render functions / JSX. In such cases a full normalization
  30705. // is needed to cater to all possible types of children values.
  30706. function normalizeChildren (children) {
  30707. return isPrimitive(children)
  30708. ? [createTextVNode(children)]
  30709. : Array.isArray(children)
  30710. ? normalizeArrayChildren(children)
  30711. : undefined
  30712. }
  30713. function isTextNode (node) {
  30714. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  30715. }
  30716. function normalizeArrayChildren (children, nestedIndex) {
  30717. var res = [];
  30718. var i, c, lastIndex, last;
  30719. for (i = 0; i < children.length; i++) {
  30720. c = children[i];
  30721. if (isUndef(c) || typeof c === 'boolean') { continue }
  30722. lastIndex = res.length - 1;
  30723. last = res[lastIndex];
  30724. // nested
  30725. if (Array.isArray(c)) {
  30726. if (c.length > 0) {
  30727. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  30728. // merge adjacent text nodes
  30729. if (isTextNode(c[0]) && isTextNode(last)) {
  30730. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  30731. c.shift();
  30732. }
  30733. res.push.apply(res, c);
  30734. }
  30735. } else if (isPrimitive(c)) {
  30736. if (isTextNode(last)) {
  30737. // merge adjacent text nodes
  30738. // this is necessary for SSR hydration because text nodes are
  30739. // essentially merged when rendered to HTML strings
  30740. res[lastIndex] = createTextVNode(last.text + c);
  30741. } else if (c !== '') {
  30742. // convert primitive to vnode
  30743. res.push(createTextVNode(c));
  30744. }
  30745. } else {
  30746. if (isTextNode(c) && isTextNode(last)) {
  30747. // merge adjacent text nodes
  30748. res[lastIndex] = createTextVNode(last.text + c.text);
  30749. } else {
  30750. // default key for nested array children (likely generated by v-for)
  30751. if (isTrue(children._isVList) &&
  30752. isDef(c.tag) &&
  30753. isUndef(c.key) &&
  30754. isDef(nestedIndex)) {
  30755. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  30756. }
  30757. res.push(c);
  30758. }
  30759. }
  30760. }
  30761. return res
  30762. }
  30763. /* */
  30764. function initProvide (vm) {
  30765. var provide = vm.$options.provide;
  30766. if (provide) {
  30767. vm._provided = typeof provide === 'function'
  30768. ? provide.call(vm)
  30769. : provide;
  30770. }
  30771. }
  30772. function initInjections (vm) {
  30773. var result = resolveInject(vm.$options.inject, vm);
  30774. if (result) {
  30775. toggleObserving(false);
  30776. Object.keys(result).forEach(function (key) {
  30777. /* istanbul ignore else */
  30778. {
  30779. defineReactive$$1(vm, key, result[key], function () {
  30780. warn(
  30781. "Avoid mutating an injected value directly since the changes will be " +
  30782. "overwritten whenever the provided component re-renders. " +
  30783. "injection being mutated: \"" + key + "\"",
  30784. vm
  30785. );
  30786. });
  30787. }
  30788. });
  30789. toggleObserving(true);
  30790. }
  30791. }
  30792. function resolveInject (inject, vm) {
  30793. if (inject) {
  30794. // inject is :any because flow is not smart enough to figure out cached
  30795. var result = Object.create(null);
  30796. var keys = hasSymbol
  30797. ? Reflect.ownKeys(inject)
  30798. : Object.keys(inject);
  30799. for (var i = 0; i < keys.length; i++) {
  30800. var key = keys[i];
  30801. // #6574 in case the inject object is observed...
  30802. if (key === '__ob__') { continue }
  30803. var provideKey = inject[key].from;
  30804. var source = vm;
  30805. while (source) {
  30806. if (source._provided && hasOwn(source._provided, provideKey)) {
  30807. result[key] = source._provided[provideKey];
  30808. break
  30809. }
  30810. source = source.$parent;
  30811. }
  30812. if (!source) {
  30813. if ('default' in inject[key]) {
  30814. var provideDefault = inject[key].default;
  30815. result[key] = typeof provideDefault === 'function'
  30816. ? provideDefault.call(vm)
  30817. : provideDefault;
  30818. } else {
  30819. warn(("Injection \"" + key + "\" not found"), vm);
  30820. }
  30821. }
  30822. }
  30823. return result
  30824. }
  30825. }
  30826. /* */
  30827. /**
  30828. * Runtime helper for resolving raw children VNodes into a slot object.
  30829. */
  30830. function resolveSlots (
  30831. children,
  30832. context
  30833. ) {
  30834. if (!children || !children.length) {
  30835. return {}
  30836. }
  30837. var slots = {};
  30838. for (var i = 0, l = children.length; i < l; i++) {
  30839. var child = children[i];
  30840. var data = child.data;
  30841. // remove slot attribute if the node is resolved as a Vue slot node
  30842. if (data && data.attrs && data.attrs.slot) {
  30843. delete data.attrs.slot;
  30844. }
  30845. // named slots should only be respected if the vnode was rendered in the
  30846. // same context.
  30847. if ((child.context === context || child.fnContext === context) &&
  30848. data && data.slot != null
  30849. ) {
  30850. var name = data.slot;
  30851. var slot = (slots[name] || (slots[name] = []));
  30852. if (child.tag === 'template') {
  30853. slot.push.apply(slot, child.children || []);
  30854. } else {
  30855. slot.push(child);
  30856. }
  30857. } else {
  30858. (slots.default || (slots.default = [])).push(child);
  30859. }
  30860. }
  30861. // ignore slots that contains only whitespace
  30862. for (var name$1 in slots) {
  30863. if (slots[name$1].every(isWhitespace)) {
  30864. delete slots[name$1];
  30865. }
  30866. }
  30867. return slots
  30868. }
  30869. function isWhitespace (node) {
  30870. return (node.isComment && !node.asyncFactory) || node.text === ' '
  30871. }
  30872. /* */
  30873. function normalizeScopedSlots (
  30874. slots,
  30875. normalSlots,
  30876. prevSlots
  30877. ) {
  30878. var res;
  30879. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  30880. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  30881. var key = slots && slots.$key;
  30882. if (!slots) {
  30883. res = {};
  30884. } else if (slots._normalized) {
  30885. // fast path 1: child component re-render only, parent did not change
  30886. return slots._normalized
  30887. } else if (
  30888. isStable &&
  30889. prevSlots &&
  30890. prevSlots !== emptyObject &&
  30891. key === prevSlots.$key &&
  30892. !hasNormalSlots &&
  30893. !prevSlots.$hasNormal
  30894. ) {
  30895. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  30896. // only need to normalize once
  30897. return prevSlots
  30898. } else {
  30899. res = {};
  30900. for (var key$1 in slots) {
  30901. if (slots[key$1] && key$1[0] !== '$') {
  30902. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  30903. }
  30904. }
  30905. }
  30906. // expose normal slots on scopedSlots
  30907. for (var key$2 in normalSlots) {
  30908. if (!(key$2 in res)) {
  30909. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  30910. }
  30911. }
  30912. // avoriaz seems to mock a non-extensible $scopedSlots object
  30913. // and when that is passed down this would cause an error
  30914. if (slots && Object.isExtensible(slots)) {
  30915. (slots)._normalized = res;
  30916. }
  30917. def(res, '$stable', isStable);
  30918. def(res, '$key', key);
  30919. def(res, '$hasNormal', hasNormalSlots);
  30920. return res
  30921. }
  30922. function normalizeScopedSlot(normalSlots, key, fn) {
  30923. var normalized = function () {
  30924. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  30925. res = res && typeof res === 'object' && !Array.isArray(res)
  30926. ? [res] // single vnode
  30927. : normalizeChildren(res);
  30928. return res && (
  30929. res.length === 0 ||
  30930. (res.length === 1 && res[0].isComment) // #9658
  30931. ) ? undefined
  30932. : res
  30933. };
  30934. // this is a slot using the new v-slot syntax without scope. although it is
  30935. // compiled as a scoped slot, render fn users would expect it to be present
  30936. // on this.$slots because the usage is semantically a normal slot.
  30937. if (fn.proxy) {
  30938. Object.defineProperty(normalSlots, key, {
  30939. get: normalized,
  30940. enumerable: true,
  30941. configurable: true
  30942. });
  30943. }
  30944. return normalized
  30945. }
  30946. function proxyNormalSlot(slots, key) {
  30947. return function () { return slots[key]; }
  30948. }
  30949. /* */
  30950. /**
  30951. * Runtime helper for rendering v-for lists.
  30952. */
  30953. function renderList (
  30954. val,
  30955. render
  30956. ) {
  30957. var ret, i, l, keys, key;
  30958. if (Array.isArray(val) || typeof val === 'string') {
  30959. ret = new Array(val.length);
  30960. for (i = 0, l = val.length; i < l; i++) {
  30961. ret[i] = render(val[i], i);
  30962. }
  30963. } else if (typeof val === 'number') {
  30964. ret = new Array(val);
  30965. for (i = 0; i < val; i++) {
  30966. ret[i] = render(i + 1, i);
  30967. }
  30968. } else if (isObject(val)) {
  30969. if (hasSymbol && val[Symbol.iterator]) {
  30970. ret = [];
  30971. var iterator = val[Symbol.iterator]();
  30972. var result = iterator.next();
  30973. while (!result.done) {
  30974. ret.push(render(result.value, ret.length));
  30975. result = iterator.next();
  30976. }
  30977. } else {
  30978. keys = Object.keys(val);
  30979. ret = new Array(keys.length);
  30980. for (i = 0, l = keys.length; i < l; i++) {
  30981. key = keys[i];
  30982. ret[i] = render(val[key], key, i);
  30983. }
  30984. }
  30985. }
  30986. if (!isDef(ret)) {
  30987. ret = [];
  30988. }
  30989. (ret)._isVList = true;
  30990. return ret
  30991. }
  30992. /* */
  30993. /**
  30994. * Runtime helper for rendering <slot>
  30995. */
  30996. function renderSlot (
  30997. name,
  30998. fallback,
  30999. props,
  31000. bindObject
  31001. ) {
  31002. var scopedSlotFn = this.$scopedSlots[name];
  31003. var nodes;
  31004. if (scopedSlotFn) { // scoped slot
  31005. props = props || {};
  31006. if (bindObject) {
  31007. if (!isObject(bindObject)) {
  31008. warn(
  31009. 'slot v-bind without argument expects an Object',
  31010. this
  31011. );
  31012. }
  31013. props = extend(extend({}, bindObject), props);
  31014. }
  31015. nodes = scopedSlotFn(props) || fallback;
  31016. } else {
  31017. nodes = this.$slots[name] || fallback;
  31018. }
  31019. var target = props && props.slot;
  31020. if (target) {
  31021. return this.$createElement('template', { slot: target }, nodes)
  31022. } else {
  31023. return nodes
  31024. }
  31025. }
  31026. /* */
  31027. /**
  31028. * Runtime helper for resolving filters
  31029. */
  31030. function resolveFilter (id) {
  31031. return resolveAsset(this.$options, 'filters', id, true) || identity
  31032. }
  31033. /* */
  31034. function isKeyNotMatch (expect, actual) {
  31035. if (Array.isArray(expect)) {
  31036. return expect.indexOf(actual) === -1
  31037. } else {
  31038. return expect !== actual
  31039. }
  31040. }
  31041. /**
  31042. * Runtime helper for checking keyCodes from config.
  31043. * exposed as Vue.prototype._k
  31044. * passing in eventKeyName as last argument separately for backwards compat
  31045. */
  31046. function checkKeyCodes (
  31047. eventKeyCode,
  31048. key,
  31049. builtInKeyCode,
  31050. eventKeyName,
  31051. builtInKeyName
  31052. ) {
  31053. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  31054. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  31055. return isKeyNotMatch(builtInKeyName, eventKeyName)
  31056. } else if (mappedKeyCode) {
  31057. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  31058. } else if (eventKeyName) {
  31059. return hyphenate(eventKeyName) !== key
  31060. }
  31061. }
  31062. /* */
  31063. /**
  31064. * Runtime helper for merging v-bind="object" into a VNode's data.
  31065. */
  31066. function bindObjectProps (
  31067. data,
  31068. tag,
  31069. value,
  31070. asProp,
  31071. isSync
  31072. ) {
  31073. if (value) {
  31074. if (!isObject(value)) {
  31075. warn(
  31076. 'v-bind without argument expects an Object or Array value',
  31077. this
  31078. );
  31079. } else {
  31080. if (Array.isArray(value)) {
  31081. value = toObject(value);
  31082. }
  31083. var hash;
  31084. var loop = function ( key ) {
  31085. if (
  31086. key === 'class' ||
  31087. key === 'style' ||
  31088. isReservedAttribute(key)
  31089. ) {
  31090. hash = data;
  31091. } else {
  31092. var type = data.attrs && data.attrs.type;
  31093. hash = asProp || config.mustUseProp(tag, type, key)
  31094. ? data.domProps || (data.domProps = {})
  31095. : data.attrs || (data.attrs = {});
  31096. }
  31097. var camelizedKey = camelize(key);
  31098. var hyphenatedKey = hyphenate(key);
  31099. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  31100. hash[key] = value[key];
  31101. if (isSync) {
  31102. var on = data.on || (data.on = {});
  31103. on[("update:" + key)] = function ($event) {
  31104. value[key] = $event;
  31105. };
  31106. }
  31107. }
  31108. };
  31109. for (var key in value) loop( key );
  31110. }
  31111. }
  31112. return data
  31113. }
  31114. /* */
  31115. /**
  31116. * Runtime helper for rendering static trees.
  31117. */
  31118. function renderStatic (
  31119. index,
  31120. isInFor
  31121. ) {
  31122. var cached = this._staticTrees || (this._staticTrees = []);
  31123. var tree = cached[index];
  31124. // if has already-rendered static tree and not inside v-for,
  31125. // we can reuse the same tree.
  31126. if (tree && !isInFor) {
  31127. return tree
  31128. }
  31129. // otherwise, render a fresh tree.
  31130. tree = cached[index] = this.$options.staticRenderFns[index].call(
  31131. this._renderProxy,
  31132. null,
  31133. this // for render fns generated for functional component templates
  31134. );
  31135. markStatic(tree, ("__static__" + index), false);
  31136. return tree
  31137. }
  31138. /**
  31139. * Runtime helper for v-once.
  31140. * Effectively it means marking the node as static with a unique key.
  31141. */
  31142. function markOnce (
  31143. tree,
  31144. index,
  31145. key
  31146. ) {
  31147. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  31148. return tree
  31149. }
  31150. function markStatic (
  31151. tree,
  31152. key,
  31153. isOnce
  31154. ) {
  31155. if (Array.isArray(tree)) {
  31156. for (var i = 0; i < tree.length; i++) {
  31157. if (tree[i] && typeof tree[i] !== 'string') {
  31158. markStaticNode(tree[i], (key + "_" + i), isOnce);
  31159. }
  31160. }
  31161. } else {
  31162. markStaticNode(tree, key, isOnce);
  31163. }
  31164. }
  31165. function markStaticNode (node, key, isOnce) {
  31166. node.isStatic = true;
  31167. node.key = key;
  31168. node.isOnce = isOnce;
  31169. }
  31170. /* */
  31171. function bindObjectListeners (data, value) {
  31172. if (value) {
  31173. if (!isPlainObject(value)) {
  31174. warn(
  31175. 'v-on without argument expects an Object value',
  31176. this
  31177. );
  31178. } else {
  31179. var on = data.on = data.on ? extend({}, data.on) : {};
  31180. for (var key in value) {
  31181. var existing = on[key];
  31182. var ours = value[key];
  31183. on[key] = existing ? [].concat(existing, ours) : ours;
  31184. }
  31185. }
  31186. }
  31187. return data
  31188. }
  31189. /* */
  31190. function resolveScopedSlots (
  31191. fns, // see flow/vnode
  31192. res,
  31193. // the following are added in 2.6
  31194. hasDynamicKeys,
  31195. contentHashKey
  31196. ) {
  31197. res = res || { $stable: !hasDynamicKeys };
  31198. for (var i = 0; i < fns.length; i++) {
  31199. var slot = fns[i];
  31200. if (Array.isArray(slot)) {
  31201. resolveScopedSlots(slot, res, hasDynamicKeys);
  31202. } else if (slot) {
  31203. // marker for reverse proxying v-slot without scope on this.$slots
  31204. if (slot.proxy) {
  31205. slot.fn.proxy = true;
  31206. }
  31207. res[slot.key] = slot.fn;
  31208. }
  31209. }
  31210. if (contentHashKey) {
  31211. (res).$key = contentHashKey;
  31212. }
  31213. return res
  31214. }
  31215. /* */
  31216. function bindDynamicKeys (baseObj, values) {
  31217. for (var i = 0; i < values.length; i += 2) {
  31218. var key = values[i];
  31219. if (typeof key === 'string' && key) {
  31220. baseObj[values[i]] = values[i + 1];
  31221. } else if (key !== '' && key !== null) {
  31222. // null is a special value for explicitly removing a binding
  31223. warn(
  31224. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  31225. this
  31226. );
  31227. }
  31228. }
  31229. return baseObj
  31230. }
  31231. // helper to dynamically append modifier runtime markers to event names.
  31232. // ensure only append when value is already string, otherwise it will be cast
  31233. // to string and cause the type check to miss.
  31234. function prependModifier (value, symbol) {
  31235. return typeof value === 'string' ? symbol + value : value
  31236. }
  31237. /* */
  31238. function installRenderHelpers (target) {
  31239. target._o = markOnce;
  31240. target._n = toNumber;
  31241. target._s = toString;
  31242. target._l = renderList;
  31243. target._t = renderSlot;
  31244. target._q = looseEqual;
  31245. target._i = looseIndexOf;
  31246. target._m = renderStatic;
  31247. target._f = resolveFilter;
  31248. target._k = checkKeyCodes;
  31249. target._b = bindObjectProps;
  31250. target._v = createTextVNode;
  31251. target._e = createEmptyVNode;
  31252. target._u = resolveScopedSlots;
  31253. target._g = bindObjectListeners;
  31254. target._d = bindDynamicKeys;
  31255. target._p = prependModifier;
  31256. }
  31257. /* */
  31258. function FunctionalRenderContext (
  31259. data,
  31260. props,
  31261. children,
  31262. parent,
  31263. Ctor
  31264. ) {
  31265. var this$1 = this;
  31266. var options = Ctor.options;
  31267. // ensure the createElement function in functional components
  31268. // gets a unique context - this is necessary for correct named slot check
  31269. var contextVm;
  31270. if (hasOwn(parent, '_uid')) {
  31271. contextVm = Object.create(parent);
  31272. // $flow-disable-line
  31273. contextVm._original = parent;
  31274. } else {
  31275. // the context vm passed in is a functional context as well.
  31276. // in this case we want to make sure we are able to get a hold to the
  31277. // real context instance.
  31278. contextVm = parent;
  31279. // $flow-disable-line
  31280. parent = parent._original;
  31281. }
  31282. var isCompiled = isTrue(options._compiled);
  31283. var needNormalization = !isCompiled;
  31284. this.data = data;
  31285. this.props = props;
  31286. this.children = children;
  31287. this.parent = parent;
  31288. this.listeners = data.on || emptyObject;
  31289. this.injections = resolveInject(options.inject, parent);
  31290. this.slots = function () {
  31291. if (!this$1.$slots) {
  31292. normalizeScopedSlots(
  31293. data.scopedSlots,
  31294. this$1.$slots = resolveSlots(children, parent)
  31295. );
  31296. }
  31297. return this$1.$slots
  31298. };
  31299. Object.defineProperty(this, 'scopedSlots', ({
  31300. enumerable: true,
  31301. get: function get () {
  31302. return normalizeScopedSlots(data.scopedSlots, this.slots())
  31303. }
  31304. }));
  31305. // support for compiled functional template
  31306. if (isCompiled) {
  31307. // exposing $options for renderStatic()
  31308. this.$options = options;
  31309. // pre-resolve slots for renderSlot()
  31310. this.$slots = this.slots();
  31311. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  31312. }
  31313. if (options._scopeId) {
  31314. this._c = function (a, b, c, d) {
  31315. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  31316. if (vnode && !Array.isArray(vnode)) {
  31317. vnode.fnScopeId = options._scopeId;
  31318. vnode.fnContext = parent;
  31319. }
  31320. return vnode
  31321. };
  31322. } else {
  31323. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  31324. }
  31325. }
  31326. installRenderHelpers(FunctionalRenderContext.prototype);
  31327. function createFunctionalComponent (
  31328. Ctor,
  31329. propsData,
  31330. data,
  31331. contextVm,
  31332. children
  31333. ) {
  31334. var options = Ctor.options;
  31335. var props = {};
  31336. var propOptions = options.props;
  31337. if (isDef(propOptions)) {
  31338. for (var key in propOptions) {
  31339. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  31340. }
  31341. } else {
  31342. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  31343. if (isDef(data.props)) { mergeProps(props, data.props); }
  31344. }
  31345. var renderContext = new FunctionalRenderContext(
  31346. data,
  31347. props,
  31348. children,
  31349. contextVm,
  31350. Ctor
  31351. );
  31352. var vnode = options.render.call(null, renderContext._c, renderContext);
  31353. if (vnode instanceof VNode) {
  31354. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  31355. } else if (Array.isArray(vnode)) {
  31356. var vnodes = normalizeChildren(vnode) || [];
  31357. var res = new Array(vnodes.length);
  31358. for (var i = 0; i < vnodes.length; i++) {
  31359. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  31360. }
  31361. return res
  31362. }
  31363. }
  31364. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  31365. // #7817 clone node before setting fnContext, otherwise if the node is reused
  31366. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  31367. // that should not be matched to match.
  31368. var clone = cloneVNode(vnode);
  31369. clone.fnContext = contextVm;
  31370. clone.fnOptions = options;
  31371. {
  31372. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  31373. }
  31374. if (data.slot) {
  31375. (clone.data || (clone.data = {})).slot = data.slot;
  31376. }
  31377. return clone
  31378. }
  31379. function mergeProps (to, from) {
  31380. for (var key in from) {
  31381. to[camelize(key)] = from[key];
  31382. }
  31383. }
  31384. /* */
  31385. /* */
  31386. /* */
  31387. /* */
  31388. // inline hooks to be invoked on component VNodes during patch
  31389. var componentVNodeHooks = {
  31390. init: function init (vnode, hydrating) {
  31391. if (
  31392. vnode.componentInstance &&
  31393. !vnode.componentInstance._isDestroyed &&
  31394. vnode.data.keepAlive
  31395. ) {
  31396. // kept-alive components, treat as a patch
  31397. var mountedNode = vnode; // work around flow
  31398. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  31399. } else {
  31400. var child = vnode.componentInstance = createComponentInstanceForVnode(
  31401. vnode,
  31402. activeInstance
  31403. );
  31404. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  31405. }
  31406. },
  31407. prepatch: function prepatch (oldVnode, vnode) {
  31408. var options = vnode.componentOptions;
  31409. var child = vnode.componentInstance = oldVnode.componentInstance;
  31410. updateChildComponent(
  31411. child,
  31412. options.propsData, // updated props
  31413. options.listeners, // updated listeners
  31414. vnode, // new parent vnode
  31415. options.children // new children
  31416. );
  31417. },
  31418. insert: function insert (vnode) {
  31419. var context = vnode.context;
  31420. var componentInstance = vnode.componentInstance;
  31421. if (!componentInstance._isMounted) {
  31422. componentInstance._isMounted = true;
  31423. callHook(componentInstance, 'mounted');
  31424. }
  31425. if (vnode.data.keepAlive) {
  31426. if (context._isMounted) {
  31427. // vue-router#1212
  31428. // During updates, a kept-alive component's child components may
  31429. // change, so directly walking the tree here may call activated hooks
  31430. // on incorrect children. Instead we push them into a queue which will
  31431. // be processed after the whole patch process ended.
  31432. queueActivatedComponent(componentInstance);
  31433. } else {
  31434. activateChildComponent(componentInstance, true /* direct */);
  31435. }
  31436. }
  31437. },
  31438. destroy: function destroy (vnode) {
  31439. var componentInstance = vnode.componentInstance;
  31440. if (!componentInstance._isDestroyed) {
  31441. if (!vnode.data.keepAlive) {
  31442. componentInstance.$destroy();
  31443. } else {
  31444. deactivateChildComponent(componentInstance, true /* direct */);
  31445. }
  31446. }
  31447. }
  31448. };
  31449. var hooksToMerge = Object.keys(componentVNodeHooks);
  31450. function createComponent (
  31451. Ctor,
  31452. data,
  31453. context,
  31454. children,
  31455. tag
  31456. ) {
  31457. if (isUndef(Ctor)) {
  31458. return
  31459. }
  31460. var baseCtor = context.$options._base;
  31461. // plain options object: turn it into a constructor
  31462. if (isObject(Ctor)) {
  31463. Ctor = baseCtor.extend(Ctor);
  31464. }
  31465. // if at this stage it's not a constructor or an async component factory,
  31466. // reject.
  31467. if (typeof Ctor !== 'function') {
  31468. {
  31469. warn(("Invalid Component definition: " + (String(Ctor))), context);
  31470. }
  31471. return
  31472. }
  31473. // async component
  31474. var asyncFactory;
  31475. if (isUndef(Ctor.cid)) {
  31476. asyncFactory = Ctor;
  31477. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  31478. if (Ctor === undefined) {
  31479. // return a placeholder node for async component, which is rendered
  31480. // as a comment node but preserves all the raw information for the node.
  31481. // the information will be used for async server-rendering and hydration.
  31482. return createAsyncPlaceholder(
  31483. asyncFactory,
  31484. data,
  31485. context,
  31486. children,
  31487. tag
  31488. )
  31489. }
  31490. }
  31491. data = data || {};
  31492. // resolve constructor options in case global mixins are applied after
  31493. // component constructor creation
  31494. resolveConstructorOptions(Ctor);
  31495. // transform component v-model data into props & events
  31496. if (isDef(data.model)) {
  31497. transformModel(Ctor.options, data);
  31498. }
  31499. // extract props
  31500. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  31501. // functional component
  31502. if (isTrue(Ctor.options.functional)) {
  31503. return createFunctionalComponent(Ctor, propsData, data, context, children)
  31504. }
  31505. // extract listeners, since these needs to be treated as
  31506. // child component listeners instead of DOM listeners
  31507. var listeners = data.on;
  31508. // replace with listeners with .native modifier
  31509. // so it gets processed during parent component patch.
  31510. data.on = data.nativeOn;
  31511. if (isTrue(Ctor.options.abstract)) {
  31512. // abstract components do not keep anything
  31513. // other than props & listeners & slot
  31514. // work around flow
  31515. var slot = data.slot;
  31516. data = {};
  31517. if (slot) {
  31518. data.slot = slot;
  31519. }
  31520. }
  31521. // install component management hooks onto the placeholder node
  31522. installComponentHooks(data);
  31523. // return a placeholder vnode
  31524. var name = Ctor.options.name || tag;
  31525. var vnode = new VNode(
  31526. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  31527. data, undefined, undefined, undefined, context,
  31528. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  31529. asyncFactory
  31530. );
  31531. return vnode
  31532. }
  31533. function createComponentInstanceForVnode (
  31534. vnode, // we know it's MountedComponentVNode but flow doesn't
  31535. parent // activeInstance in lifecycle state
  31536. ) {
  31537. var options = {
  31538. _isComponent: true,
  31539. _parentVnode: vnode,
  31540. parent: parent
  31541. };
  31542. // check inline-template render functions
  31543. var inlineTemplate = vnode.data.inlineTemplate;
  31544. if (isDef(inlineTemplate)) {
  31545. options.render = inlineTemplate.render;
  31546. options.staticRenderFns = inlineTemplate.staticRenderFns;
  31547. }
  31548. return new vnode.componentOptions.Ctor(options)
  31549. }
  31550. function installComponentHooks (data) {
  31551. var hooks = data.hook || (data.hook = {});
  31552. for (var i = 0; i < hooksToMerge.length; i++) {
  31553. var key = hooksToMerge[i];
  31554. var existing = hooks[key];
  31555. var toMerge = componentVNodeHooks[key];
  31556. if (existing !== toMerge && !(existing && existing._merged)) {
  31557. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  31558. }
  31559. }
  31560. }
  31561. function mergeHook$1 (f1, f2) {
  31562. var merged = function (a, b) {
  31563. // flow complains about extra args which is why we use any
  31564. f1(a, b);
  31565. f2(a, b);
  31566. };
  31567. merged._merged = true;
  31568. return merged
  31569. }
  31570. // transform component v-model info (value and callback) into
  31571. // prop and event handler respectively.
  31572. function transformModel (options, data) {
  31573. var prop = (options.model && options.model.prop) || 'value';
  31574. var event = (options.model && options.model.event) || 'input'
  31575. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  31576. var on = data.on || (data.on = {});
  31577. var existing = on[event];
  31578. var callback = data.model.callback;
  31579. if (isDef(existing)) {
  31580. if (
  31581. Array.isArray(existing)
  31582. ? existing.indexOf(callback) === -1
  31583. : existing !== callback
  31584. ) {
  31585. on[event] = [callback].concat(existing);
  31586. }
  31587. } else {
  31588. on[event] = callback;
  31589. }
  31590. }
  31591. /* */
  31592. var SIMPLE_NORMALIZE = 1;
  31593. var ALWAYS_NORMALIZE = 2;
  31594. // wrapper function for providing a more flexible interface
  31595. // without getting yelled at by flow
  31596. function createElement (
  31597. context,
  31598. tag,
  31599. data,
  31600. children,
  31601. normalizationType,
  31602. alwaysNormalize
  31603. ) {
  31604. if (Array.isArray(data) || isPrimitive(data)) {
  31605. normalizationType = children;
  31606. children = data;
  31607. data = undefined;
  31608. }
  31609. if (isTrue(alwaysNormalize)) {
  31610. normalizationType = ALWAYS_NORMALIZE;
  31611. }
  31612. return _createElement(context, tag, data, children, normalizationType)
  31613. }
  31614. function _createElement (
  31615. context,
  31616. tag,
  31617. data,
  31618. children,
  31619. normalizationType
  31620. ) {
  31621. if (isDef(data) && isDef((data).__ob__)) {
  31622. warn(
  31623. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  31624. 'Always create fresh vnode data objects in each render!',
  31625. context
  31626. );
  31627. return createEmptyVNode()
  31628. }
  31629. // object syntax in v-bind
  31630. if (isDef(data) && isDef(data.is)) {
  31631. tag = data.is;
  31632. }
  31633. if (!tag) {
  31634. // in case of component :is set to falsy value
  31635. return createEmptyVNode()
  31636. }
  31637. // warn against non-primitive key
  31638. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  31639. ) {
  31640. {
  31641. warn(
  31642. 'Avoid using non-primitive value as key, ' +
  31643. 'use string/number value instead.',
  31644. context
  31645. );
  31646. }
  31647. }
  31648. // support single function children as default scoped slot
  31649. if (Array.isArray(children) &&
  31650. typeof children[0] === 'function'
  31651. ) {
  31652. data = data || {};
  31653. data.scopedSlots = { default: children[0] };
  31654. children.length = 0;
  31655. }
  31656. if (normalizationType === ALWAYS_NORMALIZE) {
  31657. children = normalizeChildren(children);
  31658. } else if (normalizationType === SIMPLE_NORMALIZE) {
  31659. children = simpleNormalizeChildren(children);
  31660. }
  31661. var vnode, ns;
  31662. if (typeof tag === 'string') {
  31663. var Ctor;
  31664. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  31665. if (config.isReservedTag(tag)) {
  31666. // platform built-in elements
  31667. if (isDef(data) && isDef(data.nativeOn)) {
  31668. warn(
  31669. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  31670. context
  31671. );
  31672. }
  31673. vnode = new VNode(
  31674. config.parsePlatformTagName(tag), data, children,
  31675. undefined, undefined, context
  31676. );
  31677. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  31678. // component
  31679. vnode = createComponent(Ctor, data, context, children, tag);
  31680. } else {
  31681. // unknown or unlisted namespaced elements
  31682. // check at runtime because it may get assigned a namespace when its
  31683. // parent normalizes children
  31684. vnode = new VNode(
  31685. tag, data, children,
  31686. undefined, undefined, context
  31687. );
  31688. }
  31689. } else {
  31690. // direct component options / constructor
  31691. vnode = createComponent(tag, data, context, children);
  31692. }
  31693. if (Array.isArray(vnode)) {
  31694. return vnode
  31695. } else if (isDef(vnode)) {
  31696. if (isDef(ns)) { applyNS(vnode, ns); }
  31697. if (isDef(data)) { registerDeepBindings(data); }
  31698. return vnode
  31699. } else {
  31700. return createEmptyVNode()
  31701. }
  31702. }
  31703. function applyNS (vnode, ns, force) {
  31704. vnode.ns = ns;
  31705. if (vnode.tag === 'foreignObject') {
  31706. // use default namespace inside foreignObject
  31707. ns = undefined;
  31708. force = true;
  31709. }
  31710. if (isDef(vnode.children)) {
  31711. for (var i = 0, l = vnode.children.length; i < l; i++) {
  31712. var child = vnode.children[i];
  31713. if (isDef(child.tag) && (
  31714. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  31715. applyNS(child, ns, force);
  31716. }
  31717. }
  31718. }
  31719. }
  31720. // ref #5318
  31721. // necessary to ensure parent re-render when deep bindings like :style and
  31722. // :class are used on slot nodes
  31723. function registerDeepBindings (data) {
  31724. if (isObject(data.style)) {
  31725. traverse(data.style);
  31726. }
  31727. if (isObject(data.class)) {
  31728. traverse(data.class);
  31729. }
  31730. }
  31731. /* */
  31732. function initRender (vm) {
  31733. vm._vnode = null; // the root of the child tree
  31734. vm._staticTrees = null; // v-once cached trees
  31735. var options = vm.$options;
  31736. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  31737. var renderContext = parentVnode && parentVnode.context;
  31738. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  31739. vm.$scopedSlots = emptyObject;
  31740. // bind the createElement fn to this instance
  31741. // so that we get proper render context inside it.
  31742. // args order: tag, data, children, normalizationType, alwaysNormalize
  31743. // internal version is used by render functions compiled from templates
  31744. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  31745. // normalization is always applied for the public version, used in
  31746. // user-written render functions.
  31747. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  31748. // $attrs & $listeners are exposed for easier HOC creation.
  31749. // they need to be reactive so that HOCs using them are always updated
  31750. var parentData = parentVnode && parentVnode.data;
  31751. /* istanbul ignore else */
  31752. {
  31753. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  31754. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  31755. }, true);
  31756. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  31757. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  31758. }, true);
  31759. }
  31760. }
  31761. var currentRenderingInstance = null;
  31762. function renderMixin (Vue) {
  31763. // install runtime convenience helpers
  31764. installRenderHelpers(Vue.prototype);
  31765. Vue.prototype.$nextTick = function (fn) {
  31766. return nextTick(fn, this)
  31767. };
  31768. Vue.prototype._render = function () {
  31769. var vm = this;
  31770. var ref = vm.$options;
  31771. var render = ref.render;
  31772. var _parentVnode = ref._parentVnode;
  31773. if (_parentVnode) {
  31774. vm.$scopedSlots = normalizeScopedSlots(
  31775. _parentVnode.data.scopedSlots,
  31776. vm.$slots,
  31777. vm.$scopedSlots
  31778. );
  31779. }
  31780. // set parent vnode. this allows render functions to have access
  31781. // to the data on the placeholder node.
  31782. vm.$vnode = _parentVnode;
  31783. // render self
  31784. var vnode;
  31785. try {
  31786. // There's no need to maintain a stack because all render fns are called
  31787. // separately from one another. Nested component's render fns are called
  31788. // when parent component is patched.
  31789. currentRenderingInstance = vm;
  31790. vnode = render.call(vm._renderProxy, vm.$createElement);
  31791. } catch (e) {
  31792. handleError(e, vm, "render");
  31793. // return error render result,
  31794. // or previous vnode to prevent render error causing blank component
  31795. /* istanbul ignore else */
  31796. if (vm.$options.renderError) {
  31797. try {
  31798. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  31799. } catch (e) {
  31800. handleError(e, vm, "renderError");
  31801. vnode = vm._vnode;
  31802. }
  31803. } else {
  31804. vnode = vm._vnode;
  31805. }
  31806. } finally {
  31807. currentRenderingInstance = null;
  31808. }
  31809. // if the returned array contains only a single node, allow it
  31810. if (Array.isArray(vnode) && vnode.length === 1) {
  31811. vnode = vnode[0];
  31812. }
  31813. // return empty vnode in case the render function errored out
  31814. if (!(vnode instanceof VNode)) {
  31815. if (Array.isArray(vnode)) {
  31816. warn(
  31817. 'Multiple root nodes returned from render function. Render function ' +
  31818. 'should return a single root node.',
  31819. vm
  31820. );
  31821. }
  31822. vnode = createEmptyVNode();
  31823. }
  31824. // set parent
  31825. vnode.parent = _parentVnode;
  31826. return vnode
  31827. };
  31828. }
  31829. /* */
  31830. function ensureCtor (comp, base) {
  31831. if (
  31832. comp.__esModule ||
  31833. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  31834. ) {
  31835. comp = comp.default;
  31836. }
  31837. return isObject(comp)
  31838. ? base.extend(comp)
  31839. : comp
  31840. }
  31841. function createAsyncPlaceholder (
  31842. factory,
  31843. data,
  31844. context,
  31845. children,
  31846. tag
  31847. ) {
  31848. var node = createEmptyVNode();
  31849. node.asyncFactory = factory;
  31850. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  31851. return node
  31852. }
  31853. function resolveAsyncComponent (
  31854. factory,
  31855. baseCtor
  31856. ) {
  31857. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  31858. return factory.errorComp
  31859. }
  31860. if (isDef(factory.resolved)) {
  31861. return factory.resolved
  31862. }
  31863. var owner = currentRenderingInstance;
  31864. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  31865. // already pending
  31866. factory.owners.push(owner);
  31867. }
  31868. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  31869. return factory.loadingComp
  31870. }
  31871. if (owner && !isDef(factory.owners)) {
  31872. var owners = factory.owners = [owner];
  31873. var sync = true;
  31874. var timerLoading = null;
  31875. var timerTimeout = null
  31876. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  31877. var forceRender = function (renderCompleted) {
  31878. for (var i = 0, l = owners.length; i < l; i++) {
  31879. (owners[i]).$forceUpdate();
  31880. }
  31881. if (renderCompleted) {
  31882. owners.length = 0;
  31883. if (timerLoading !== null) {
  31884. clearTimeout(timerLoading);
  31885. timerLoading = null;
  31886. }
  31887. if (timerTimeout !== null) {
  31888. clearTimeout(timerTimeout);
  31889. timerTimeout = null;
  31890. }
  31891. }
  31892. };
  31893. var resolve = once(function (res) {
  31894. // cache resolved
  31895. factory.resolved = ensureCtor(res, baseCtor);
  31896. // invoke callbacks only if this is not a synchronous resolve
  31897. // (async resolves are shimmed as synchronous during SSR)
  31898. if (!sync) {
  31899. forceRender(true);
  31900. } else {
  31901. owners.length = 0;
  31902. }
  31903. });
  31904. var reject = once(function (reason) {
  31905. warn(
  31906. "Failed to resolve async component: " + (String(factory)) +
  31907. (reason ? ("\nReason: " + reason) : '')
  31908. );
  31909. if (isDef(factory.errorComp)) {
  31910. factory.error = true;
  31911. forceRender(true);
  31912. }
  31913. });
  31914. var res = factory(resolve, reject);
  31915. if (isObject(res)) {
  31916. if (isPromise(res)) {
  31917. // () => Promise
  31918. if (isUndef(factory.resolved)) {
  31919. res.then(resolve, reject);
  31920. }
  31921. } else if (isPromise(res.component)) {
  31922. res.component.then(resolve, reject);
  31923. if (isDef(res.error)) {
  31924. factory.errorComp = ensureCtor(res.error, baseCtor);
  31925. }
  31926. if (isDef(res.loading)) {
  31927. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  31928. if (res.delay === 0) {
  31929. factory.loading = true;
  31930. } else {
  31931. timerLoading = setTimeout(function () {
  31932. timerLoading = null;
  31933. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  31934. factory.loading = true;
  31935. forceRender(false);
  31936. }
  31937. }, res.delay || 200);
  31938. }
  31939. }
  31940. if (isDef(res.timeout)) {
  31941. timerTimeout = setTimeout(function () {
  31942. timerTimeout = null;
  31943. if (isUndef(factory.resolved)) {
  31944. reject(
  31945. "timeout (" + (res.timeout) + "ms)"
  31946. );
  31947. }
  31948. }, res.timeout);
  31949. }
  31950. }
  31951. }
  31952. sync = false;
  31953. // return in case resolved synchronously
  31954. return factory.loading
  31955. ? factory.loadingComp
  31956. : factory.resolved
  31957. }
  31958. }
  31959. /* */
  31960. function isAsyncPlaceholder (node) {
  31961. return node.isComment && node.asyncFactory
  31962. }
  31963. /* */
  31964. function getFirstComponentChild (children) {
  31965. if (Array.isArray(children)) {
  31966. for (var i = 0; i < children.length; i++) {
  31967. var c = children[i];
  31968. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  31969. return c
  31970. }
  31971. }
  31972. }
  31973. }
  31974. /* */
  31975. /* */
  31976. function initEvents (vm) {
  31977. vm._events = Object.create(null);
  31978. vm._hasHookEvent = false;
  31979. // init parent attached events
  31980. var listeners = vm.$options._parentListeners;
  31981. if (listeners) {
  31982. updateComponentListeners(vm, listeners);
  31983. }
  31984. }
  31985. var target;
  31986. function add (event, fn) {
  31987. target.$on(event, fn);
  31988. }
  31989. function remove$1 (event, fn) {
  31990. target.$off(event, fn);
  31991. }
  31992. function createOnceHandler (event, fn) {
  31993. var _target = target;
  31994. return function onceHandler () {
  31995. var res = fn.apply(null, arguments);
  31996. if (res !== null) {
  31997. _target.$off(event, onceHandler);
  31998. }
  31999. }
  32000. }
  32001. function updateComponentListeners (
  32002. vm,
  32003. listeners,
  32004. oldListeners
  32005. ) {
  32006. target = vm;
  32007. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  32008. target = undefined;
  32009. }
  32010. function eventsMixin (Vue) {
  32011. var hookRE = /^hook:/;
  32012. Vue.prototype.$on = function (event, fn) {
  32013. var vm = this;
  32014. if (Array.isArray(event)) {
  32015. for (var i = 0, l = event.length; i < l; i++) {
  32016. vm.$on(event[i], fn);
  32017. }
  32018. } else {
  32019. (vm._events[event] || (vm._events[event] = [])).push(fn);
  32020. // optimize hook:event cost by using a boolean flag marked at registration
  32021. // instead of a hash lookup
  32022. if (hookRE.test(event)) {
  32023. vm._hasHookEvent = true;
  32024. }
  32025. }
  32026. return vm
  32027. };
  32028. Vue.prototype.$once = function (event, fn) {
  32029. var vm = this;
  32030. function on () {
  32031. vm.$off(event, on);
  32032. fn.apply(vm, arguments);
  32033. }
  32034. on.fn = fn;
  32035. vm.$on(event, on);
  32036. return vm
  32037. };
  32038. Vue.prototype.$off = function (event, fn) {
  32039. var vm = this;
  32040. // all
  32041. if (!arguments.length) {
  32042. vm._events = Object.create(null);
  32043. return vm
  32044. }
  32045. // array of events
  32046. if (Array.isArray(event)) {
  32047. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  32048. vm.$off(event[i$1], fn);
  32049. }
  32050. return vm
  32051. }
  32052. // specific event
  32053. var cbs = vm._events[event];
  32054. if (!cbs) {
  32055. return vm
  32056. }
  32057. if (!fn) {
  32058. vm._events[event] = null;
  32059. return vm
  32060. }
  32061. // specific handler
  32062. var cb;
  32063. var i = cbs.length;
  32064. while (i--) {
  32065. cb = cbs[i];
  32066. if (cb === fn || cb.fn === fn) {
  32067. cbs.splice(i, 1);
  32068. break
  32069. }
  32070. }
  32071. return vm
  32072. };
  32073. Vue.prototype.$emit = function (event) {
  32074. var vm = this;
  32075. {
  32076. var lowerCaseEvent = event.toLowerCase();
  32077. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  32078. tip(
  32079. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  32080. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  32081. "Note that HTML attributes are case-insensitive and you cannot use " +
  32082. "v-on to listen to camelCase events when using in-DOM templates. " +
  32083. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  32084. );
  32085. }
  32086. }
  32087. var cbs = vm._events[event];
  32088. if (cbs) {
  32089. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  32090. var args = toArray(arguments, 1);
  32091. var info = "event handler for \"" + event + "\"";
  32092. for (var i = 0, l = cbs.length; i < l; i++) {
  32093. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  32094. }
  32095. }
  32096. return vm
  32097. };
  32098. }
  32099. /* */
  32100. var activeInstance = null;
  32101. var isUpdatingChildComponent = false;
  32102. function setActiveInstance(vm) {
  32103. var prevActiveInstance = activeInstance;
  32104. activeInstance = vm;
  32105. return function () {
  32106. activeInstance = prevActiveInstance;
  32107. }
  32108. }
  32109. function initLifecycle (vm) {
  32110. var options = vm.$options;
  32111. // locate first non-abstract parent
  32112. var parent = options.parent;
  32113. if (parent && !options.abstract) {
  32114. while (parent.$options.abstract && parent.$parent) {
  32115. parent = parent.$parent;
  32116. }
  32117. parent.$children.push(vm);
  32118. }
  32119. vm.$parent = parent;
  32120. vm.$root = parent ? parent.$root : vm;
  32121. vm.$children = [];
  32122. vm.$refs = {};
  32123. vm._watcher = null;
  32124. vm._inactive = null;
  32125. vm._directInactive = false;
  32126. vm._isMounted = false;
  32127. vm._isDestroyed = false;
  32128. vm._isBeingDestroyed = false;
  32129. }
  32130. function lifecycleMixin (Vue) {
  32131. Vue.prototype._update = function (vnode, hydrating) {
  32132. var vm = this;
  32133. var prevEl = vm.$el;
  32134. var prevVnode = vm._vnode;
  32135. var restoreActiveInstance = setActiveInstance(vm);
  32136. vm._vnode = vnode;
  32137. // Vue.prototype.__patch__ is injected in entry points
  32138. // based on the rendering backend used.
  32139. if (!prevVnode) {
  32140. // initial render
  32141. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  32142. } else {
  32143. // updates
  32144. vm.$el = vm.__patch__(prevVnode, vnode);
  32145. }
  32146. restoreActiveInstance();
  32147. // update __vue__ reference
  32148. if (prevEl) {
  32149. prevEl.__vue__ = null;
  32150. }
  32151. if (vm.$el) {
  32152. vm.$el.__vue__ = vm;
  32153. }
  32154. // if parent is an HOC, update its $el as well
  32155. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  32156. vm.$parent.$el = vm.$el;
  32157. }
  32158. // updated hook is called by the scheduler to ensure that children are
  32159. // updated in a parent's updated hook.
  32160. };
  32161. Vue.prototype.$forceUpdate = function () {
  32162. var vm = this;
  32163. if (vm._watcher) {
  32164. vm._watcher.update();
  32165. }
  32166. };
  32167. Vue.prototype.$destroy = function () {
  32168. var vm = this;
  32169. if (vm._isBeingDestroyed) {
  32170. return
  32171. }
  32172. callHook(vm, 'beforeDestroy');
  32173. vm._isBeingDestroyed = true;
  32174. // remove self from parent
  32175. var parent = vm.$parent;
  32176. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  32177. remove(parent.$children, vm);
  32178. }
  32179. // teardown watchers
  32180. if (vm._watcher) {
  32181. vm._watcher.teardown();
  32182. }
  32183. var i = vm._watchers.length;
  32184. while (i--) {
  32185. vm._watchers[i].teardown();
  32186. }
  32187. // remove reference from data ob
  32188. // frozen object may not have observer.
  32189. if (vm._data.__ob__) {
  32190. vm._data.__ob__.vmCount--;
  32191. }
  32192. // call the last hook...
  32193. vm._isDestroyed = true;
  32194. // invoke destroy hooks on current rendered tree
  32195. vm.__patch__(vm._vnode, null);
  32196. // fire destroyed hook
  32197. callHook(vm, 'destroyed');
  32198. // turn off all instance listeners.
  32199. vm.$off();
  32200. // remove __vue__ reference
  32201. if (vm.$el) {
  32202. vm.$el.__vue__ = null;
  32203. }
  32204. // release circular reference (#6759)
  32205. if (vm.$vnode) {
  32206. vm.$vnode.parent = null;
  32207. }
  32208. };
  32209. }
  32210. function mountComponent (
  32211. vm,
  32212. el,
  32213. hydrating
  32214. ) {
  32215. vm.$el = el;
  32216. if (!vm.$options.render) {
  32217. vm.$options.render = createEmptyVNode;
  32218. {
  32219. /* istanbul ignore if */
  32220. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  32221. vm.$options.el || el) {
  32222. warn(
  32223. 'You are using the runtime-only build of Vue where the template ' +
  32224. 'compiler is not available. Either pre-compile the templates into ' +
  32225. 'render functions, or use the compiler-included build.',
  32226. vm
  32227. );
  32228. } else {
  32229. warn(
  32230. 'Failed to mount component: template or render function not defined.',
  32231. vm
  32232. );
  32233. }
  32234. }
  32235. }
  32236. callHook(vm, 'beforeMount');
  32237. var updateComponent;
  32238. /* istanbul ignore if */
  32239. if (config.performance && mark) {
  32240. updateComponent = function () {
  32241. var name = vm._name;
  32242. var id = vm._uid;
  32243. var startTag = "vue-perf-start:" + id;
  32244. var endTag = "vue-perf-end:" + id;
  32245. mark(startTag);
  32246. var vnode = vm._render();
  32247. mark(endTag);
  32248. measure(("vue " + name + " render"), startTag, endTag);
  32249. mark(startTag);
  32250. vm._update(vnode, hydrating);
  32251. mark(endTag);
  32252. measure(("vue " + name + " patch"), startTag, endTag);
  32253. };
  32254. } else {
  32255. updateComponent = function () {
  32256. vm._update(vm._render(), hydrating);
  32257. };
  32258. }
  32259. // we set this to vm._watcher inside the watcher's constructor
  32260. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  32261. // component's mounted hook), which relies on vm._watcher being already defined
  32262. new Watcher(vm, updateComponent, noop, {
  32263. before: function before () {
  32264. if (vm._isMounted && !vm._isDestroyed) {
  32265. callHook(vm, 'beforeUpdate');
  32266. }
  32267. }
  32268. }, true /* isRenderWatcher */);
  32269. hydrating = false;
  32270. // manually mounted instance, call mounted on self
  32271. // mounted is called for render-created child components in its inserted hook
  32272. if (vm.$vnode == null) {
  32273. vm._isMounted = true;
  32274. callHook(vm, 'mounted');
  32275. }
  32276. return vm
  32277. }
  32278. function updateChildComponent (
  32279. vm,
  32280. propsData,
  32281. listeners,
  32282. parentVnode,
  32283. renderChildren
  32284. ) {
  32285. {
  32286. isUpdatingChildComponent = true;
  32287. }
  32288. // determine whether component has slot children
  32289. // we need to do this before overwriting $options._renderChildren.
  32290. // check if there are dynamic scopedSlots (hand-written or compiled but with
  32291. // dynamic slot names). Static scoped slots compiled from template has the
  32292. // "$stable" marker.
  32293. var newScopedSlots = parentVnode.data.scopedSlots;
  32294. var oldScopedSlots = vm.$scopedSlots;
  32295. var hasDynamicScopedSlot = !!(
  32296. (newScopedSlots && !newScopedSlots.$stable) ||
  32297. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  32298. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  32299. );
  32300. // Any static slot children from the parent may have changed during parent's
  32301. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  32302. // update is necessary to ensure correctness.
  32303. var needsForceUpdate = !!(
  32304. renderChildren || // has new static slots
  32305. vm.$options._renderChildren || // has old static slots
  32306. hasDynamicScopedSlot
  32307. );
  32308. vm.$options._parentVnode = parentVnode;
  32309. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  32310. if (vm._vnode) { // update child tree's parent
  32311. vm._vnode.parent = parentVnode;
  32312. }
  32313. vm.$options._renderChildren = renderChildren;
  32314. // update $attrs and $listeners hash
  32315. // these are also reactive so they may trigger child update if the child
  32316. // used them during render
  32317. vm.$attrs = parentVnode.data.attrs || emptyObject;
  32318. vm.$listeners = listeners || emptyObject;
  32319. // update props
  32320. if (propsData && vm.$options.props) {
  32321. toggleObserving(false);
  32322. var props = vm._props;
  32323. var propKeys = vm.$options._propKeys || [];
  32324. for (var i = 0; i < propKeys.length; i++) {
  32325. var key = propKeys[i];
  32326. var propOptions = vm.$options.props; // wtf flow?
  32327. props[key] = validateProp(key, propOptions, propsData, vm);
  32328. }
  32329. toggleObserving(true);
  32330. // keep a copy of raw propsData
  32331. vm.$options.propsData = propsData;
  32332. }
  32333. // update listeners
  32334. listeners = listeners || emptyObject;
  32335. var oldListeners = vm.$options._parentListeners;
  32336. vm.$options._parentListeners = listeners;
  32337. updateComponentListeners(vm, listeners, oldListeners);
  32338. // resolve slots + force update if has children
  32339. if (needsForceUpdate) {
  32340. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  32341. vm.$forceUpdate();
  32342. }
  32343. {
  32344. isUpdatingChildComponent = false;
  32345. }
  32346. }
  32347. function isInInactiveTree (vm) {
  32348. while (vm && (vm = vm.$parent)) {
  32349. if (vm._inactive) { return true }
  32350. }
  32351. return false
  32352. }
  32353. function activateChildComponent (vm, direct) {
  32354. if (direct) {
  32355. vm._directInactive = false;
  32356. if (isInInactiveTree(vm)) {
  32357. return
  32358. }
  32359. } else if (vm._directInactive) {
  32360. return
  32361. }
  32362. if (vm._inactive || vm._inactive === null) {
  32363. vm._inactive = false;
  32364. for (var i = 0; i < vm.$children.length; i++) {
  32365. activateChildComponent(vm.$children[i]);
  32366. }
  32367. callHook(vm, 'activated');
  32368. }
  32369. }
  32370. function deactivateChildComponent (vm, direct) {
  32371. if (direct) {
  32372. vm._directInactive = true;
  32373. if (isInInactiveTree(vm)) {
  32374. return
  32375. }
  32376. }
  32377. if (!vm._inactive) {
  32378. vm._inactive = true;
  32379. for (var i = 0; i < vm.$children.length; i++) {
  32380. deactivateChildComponent(vm.$children[i]);
  32381. }
  32382. callHook(vm, 'deactivated');
  32383. }
  32384. }
  32385. function callHook (vm, hook) {
  32386. // #7573 disable dep collection when invoking lifecycle hooks
  32387. pushTarget();
  32388. var handlers = vm.$options[hook];
  32389. var info = hook + " hook";
  32390. if (handlers) {
  32391. for (var i = 0, j = handlers.length; i < j; i++) {
  32392. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  32393. }
  32394. }
  32395. if (vm._hasHookEvent) {
  32396. vm.$emit('hook:' + hook);
  32397. }
  32398. popTarget();
  32399. }
  32400. /* */
  32401. var MAX_UPDATE_COUNT = 100;
  32402. var queue = [];
  32403. var activatedChildren = [];
  32404. var has = {};
  32405. var circular = {};
  32406. var waiting = false;
  32407. var flushing = false;
  32408. var index = 0;
  32409. /**
  32410. * Reset the scheduler's state.
  32411. */
  32412. function resetSchedulerState () {
  32413. index = queue.length = activatedChildren.length = 0;
  32414. has = {};
  32415. {
  32416. circular = {};
  32417. }
  32418. waiting = flushing = false;
  32419. }
  32420. // Async edge case #6566 requires saving the timestamp when event listeners are
  32421. // attached. However, calling performance.now() has a perf overhead especially
  32422. // if the page has thousands of event listeners. Instead, we take a timestamp
  32423. // every time the scheduler flushes and use that for all event listeners
  32424. // attached during that flush.
  32425. var currentFlushTimestamp = 0;
  32426. // Async edge case fix requires storing an event listener's attach timestamp.
  32427. var getNow = Date.now;
  32428. // Determine what event timestamp the browser is using. Annoyingly, the
  32429. // timestamp can either be hi-res (relative to page load) or low-res
  32430. // (relative to UNIX epoch), so in order to compare time we have to use the
  32431. // same timestamp type when saving the flush timestamp.
  32432. // All IE versions use low-res event timestamps, and have problematic clock
  32433. // implementations (#9632)
  32434. if (inBrowser && !isIE) {
  32435. var performance = window.performance;
  32436. if (
  32437. performance &&
  32438. typeof performance.now === 'function' &&
  32439. getNow() > document.createEvent('Event').timeStamp
  32440. ) {
  32441. // if the event timestamp, although evaluated AFTER the Date.now(), is
  32442. // smaller than it, it means the event is using a hi-res timestamp,
  32443. // and we need to use the hi-res version for event listener timestamps as
  32444. // well.
  32445. getNow = function () { return performance.now(); };
  32446. }
  32447. }
  32448. /**
  32449. * Flush both queues and run the watchers.
  32450. */
  32451. function flushSchedulerQueue () {
  32452. currentFlushTimestamp = getNow();
  32453. flushing = true;
  32454. var watcher, id;
  32455. // Sort queue before flush.
  32456. // This ensures that:
  32457. // 1. Components are updated from parent to child. (because parent is always
  32458. // created before the child)
  32459. // 2. A component's user watchers are run before its render watcher (because
  32460. // user watchers are created before the render watcher)
  32461. // 3. If a component is destroyed during a parent component's watcher run,
  32462. // its watchers can be skipped.
  32463. queue.sort(function (a, b) { return a.id - b.id; });
  32464. // do not cache length because more watchers might be pushed
  32465. // as we run existing watchers
  32466. for (index = 0; index < queue.length; index++) {
  32467. watcher = queue[index];
  32468. if (watcher.before) {
  32469. watcher.before();
  32470. }
  32471. id = watcher.id;
  32472. has[id] = null;
  32473. watcher.run();
  32474. // in dev build, check and stop circular updates.
  32475. if (has[id] != null) {
  32476. circular[id] = (circular[id] || 0) + 1;
  32477. if (circular[id] > MAX_UPDATE_COUNT) {
  32478. warn(
  32479. 'You may have an infinite update loop ' + (
  32480. watcher.user
  32481. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  32482. : "in a component render function."
  32483. ),
  32484. watcher.vm
  32485. );
  32486. break
  32487. }
  32488. }
  32489. }
  32490. // keep copies of post queues before resetting state
  32491. var activatedQueue = activatedChildren.slice();
  32492. var updatedQueue = queue.slice();
  32493. resetSchedulerState();
  32494. // call component updated and activated hooks
  32495. callActivatedHooks(activatedQueue);
  32496. callUpdatedHooks(updatedQueue);
  32497. // devtool hook
  32498. /* istanbul ignore if */
  32499. if (devtools && config.devtools) {
  32500. devtools.emit('flush');
  32501. }
  32502. }
  32503. function callUpdatedHooks (queue) {
  32504. var i = queue.length;
  32505. while (i--) {
  32506. var watcher = queue[i];
  32507. var vm = watcher.vm;
  32508. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  32509. callHook(vm, 'updated');
  32510. }
  32511. }
  32512. }
  32513. /**
  32514. * Queue a kept-alive component that was activated during patch.
  32515. * The queue will be processed after the entire tree has been patched.
  32516. */
  32517. function queueActivatedComponent (vm) {
  32518. // setting _inactive to false here so that a render function can
  32519. // rely on checking whether it's in an inactive tree (e.g. router-view)
  32520. vm._inactive = false;
  32521. activatedChildren.push(vm);
  32522. }
  32523. function callActivatedHooks (queue) {
  32524. for (var i = 0; i < queue.length; i++) {
  32525. queue[i]._inactive = true;
  32526. activateChildComponent(queue[i], true /* true */);
  32527. }
  32528. }
  32529. /**
  32530. * Push a watcher into the watcher queue.
  32531. * Jobs with duplicate IDs will be skipped unless it's
  32532. * pushed when the queue is being flushed.
  32533. */
  32534. function queueWatcher (watcher) {
  32535. var id = watcher.id;
  32536. if (has[id] == null) {
  32537. has[id] = true;
  32538. if (!flushing) {
  32539. queue.push(watcher);
  32540. } else {
  32541. // if already flushing, splice the watcher based on its id
  32542. // if already past its id, it will be run next immediately.
  32543. var i = queue.length - 1;
  32544. while (i > index && queue[i].id > watcher.id) {
  32545. i--;
  32546. }
  32547. queue.splice(i + 1, 0, watcher);
  32548. }
  32549. // queue the flush
  32550. if (!waiting) {
  32551. waiting = true;
  32552. if (!config.async) {
  32553. flushSchedulerQueue();
  32554. return
  32555. }
  32556. nextTick(flushSchedulerQueue);
  32557. }
  32558. }
  32559. }
  32560. /* */
  32561. var uid$2 = 0;
  32562. /**
  32563. * A watcher parses an expression, collects dependencies,
  32564. * and fires callback when the expression value changes.
  32565. * This is used for both the $watch() api and directives.
  32566. */
  32567. var Watcher = function Watcher (
  32568. vm,
  32569. expOrFn,
  32570. cb,
  32571. options,
  32572. isRenderWatcher
  32573. ) {
  32574. this.vm = vm;
  32575. if (isRenderWatcher) {
  32576. vm._watcher = this;
  32577. }
  32578. vm._watchers.push(this);
  32579. // options
  32580. if (options) {
  32581. this.deep = !!options.deep;
  32582. this.user = !!options.user;
  32583. this.lazy = !!options.lazy;
  32584. this.sync = !!options.sync;
  32585. this.before = options.before;
  32586. } else {
  32587. this.deep = this.user = this.lazy = this.sync = false;
  32588. }
  32589. this.cb = cb;
  32590. this.id = ++uid$2; // uid for batching
  32591. this.active = true;
  32592. this.dirty = this.lazy; // for lazy watchers
  32593. this.deps = [];
  32594. this.newDeps = [];
  32595. this.depIds = new _Set();
  32596. this.newDepIds = new _Set();
  32597. this.expression = expOrFn.toString();
  32598. // parse expression for getter
  32599. if (typeof expOrFn === 'function') {
  32600. this.getter = expOrFn;
  32601. } else {
  32602. this.getter = parsePath(expOrFn);
  32603. if (!this.getter) {
  32604. this.getter = noop;
  32605. warn(
  32606. "Failed watching path: \"" + expOrFn + "\" " +
  32607. 'Watcher only accepts simple dot-delimited paths. ' +
  32608. 'For full control, use a function instead.',
  32609. vm
  32610. );
  32611. }
  32612. }
  32613. this.value = this.lazy
  32614. ? undefined
  32615. : this.get();
  32616. };
  32617. /**
  32618. * Evaluate the getter, and re-collect dependencies.
  32619. */
  32620. Watcher.prototype.get = function get () {
  32621. pushTarget(this);
  32622. var value;
  32623. var vm = this.vm;
  32624. try {
  32625. value = this.getter.call(vm, vm);
  32626. } catch (e) {
  32627. if (this.user) {
  32628. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  32629. } else {
  32630. throw e
  32631. }
  32632. } finally {
  32633. // "touch" every property so they are all tracked as
  32634. // dependencies for deep watching
  32635. if (this.deep) {
  32636. traverse(value);
  32637. }
  32638. popTarget();
  32639. this.cleanupDeps();
  32640. }
  32641. return value
  32642. };
  32643. /**
  32644. * Add a dependency to this directive.
  32645. */
  32646. Watcher.prototype.addDep = function addDep (dep) {
  32647. var id = dep.id;
  32648. if (!this.newDepIds.has(id)) {
  32649. this.newDepIds.add(id);
  32650. this.newDeps.push(dep);
  32651. if (!this.depIds.has(id)) {
  32652. dep.addSub(this);
  32653. }
  32654. }
  32655. };
  32656. /**
  32657. * Clean up for dependency collection.
  32658. */
  32659. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  32660. var i = this.deps.length;
  32661. while (i--) {
  32662. var dep = this.deps[i];
  32663. if (!this.newDepIds.has(dep.id)) {
  32664. dep.removeSub(this);
  32665. }
  32666. }
  32667. var tmp = this.depIds;
  32668. this.depIds = this.newDepIds;
  32669. this.newDepIds = tmp;
  32670. this.newDepIds.clear();
  32671. tmp = this.deps;
  32672. this.deps = this.newDeps;
  32673. this.newDeps = tmp;
  32674. this.newDeps.length = 0;
  32675. };
  32676. /**
  32677. * Subscriber interface.
  32678. * Will be called when a dependency changes.
  32679. */
  32680. Watcher.prototype.update = function update () {
  32681. /* istanbul ignore else */
  32682. if (this.lazy) {
  32683. this.dirty = true;
  32684. } else if (this.sync) {
  32685. this.run();
  32686. } else {
  32687. queueWatcher(this);
  32688. }
  32689. };
  32690. /**
  32691. * Scheduler job interface.
  32692. * Will be called by the scheduler.
  32693. */
  32694. Watcher.prototype.run = function run () {
  32695. if (this.active) {
  32696. var value = this.get();
  32697. if (
  32698. value !== this.value ||
  32699. // Deep watchers and watchers on Object/Arrays should fire even
  32700. // when the value is the same, because the value may
  32701. // have mutated.
  32702. isObject(value) ||
  32703. this.deep
  32704. ) {
  32705. // set new value
  32706. var oldValue = this.value;
  32707. this.value = value;
  32708. if (this.user) {
  32709. try {
  32710. this.cb.call(this.vm, value, oldValue);
  32711. } catch (e) {
  32712. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  32713. }
  32714. } else {
  32715. this.cb.call(this.vm, value, oldValue);
  32716. }
  32717. }
  32718. }
  32719. };
  32720. /**
  32721. * Evaluate the value of the watcher.
  32722. * This only gets called for lazy watchers.
  32723. */
  32724. Watcher.prototype.evaluate = function evaluate () {
  32725. this.value = this.get();
  32726. this.dirty = false;
  32727. };
  32728. /**
  32729. * Depend on all deps collected by this watcher.
  32730. */
  32731. Watcher.prototype.depend = function depend () {
  32732. var i = this.deps.length;
  32733. while (i--) {
  32734. this.deps[i].depend();
  32735. }
  32736. };
  32737. /**
  32738. * Remove self from all dependencies' subscriber list.
  32739. */
  32740. Watcher.prototype.teardown = function teardown () {
  32741. if (this.active) {
  32742. // remove self from vm's watcher list
  32743. // this is a somewhat expensive operation so we skip it
  32744. // if the vm is being destroyed.
  32745. if (!this.vm._isBeingDestroyed) {
  32746. remove(this.vm._watchers, this);
  32747. }
  32748. var i = this.deps.length;
  32749. while (i--) {
  32750. this.deps[i].removeSub(this);
  32751. }
  32752. this.active = false;
  32753. }
  32754. };
  32755. /* */
  32756. var sharedPropertyDefinition = {
  32757. enumerable: true,
  32758. configurable: true,
  32759. get: noop,
  32760. set: noop
  32761. };
  32762. function proxy (target, sourceKey, key) {
  32763. sharedPropertyDefinition.get = function proxyGetter () {
  32764. return this[sourceKey][key]
  32765. };
  32766. sharedPropertyDefinition.set = function proxySetter (val) {
  32767. this[sourceKey][key] = val;
  32768. };
  32769. Object.defineProperty(target, key, sharedPropertyDefinition);
  32770. }
  32771. function initState (vm) {
  32772. vm._watchers = [];
  32773. var opts = vm.$options;
  32774. if (opts.props) { initProps(vm, opts.props); }
  32775. if (opts.methods) { initMethods(vm, opts.methods); }
  32776. if (opts.data) {
  32777. initData(vm);
  32778. } else {
  32779. observe(vm._data = {}, true /* asRootData */);
  32780. }
  32781. if (opts.computed) { initComputed(vm, opts.computed); }
  32782. if (opts.watch && opts.watch !== nativeWatch) {
  32783. initWatch(vm, opts.watch);
  32784. }
  32785. }
  32786. function initProps (vm, propsOptions) {
  32787. var propsData = vm.$options.propsData || {};
  32788. var props = vm._props = {};
  32789. // cache prop keys so that future props updates can iterate using Array
  32790. // instead of dynamic object key enumeration.
  32791. var keys = vm.$options._propKeys = [];
  32792. var isRoot = !vm.$parent;
  32793. // root instance props should be converted
  32794. if (!isRoot) {
  32795. toggleObserving(false);
  32796. }
  32797. var loop = function ( key ) {
  32798. keys.push(key);
  32799. var value = validateProp(key, propsOptions, propsData, vm);
  32800. /* istanbul ignore else */
  32801. {
  32802. var hyphenatedKey = hyphenate(key);
  32803. if (isReservedAttribute(hyphenatedKey) ||
  32804. config.isReservedAttr(hyphenatedKey)) {
  32805. warn(
  32806. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  32807. vm
  32808. );
  32809. }
  32810. defineReactive$$1(props, key, value, function () {
  32811. if (!isRoot && !isUpdatingChildComponent) {
  32812. warn(
  32813. "Avoid mutating a prop directly since the value will be " +
  32814. "overwritten whenever the parent component re-renders. " +
  32815. "Instead, use a data or computed property based on the prop's " +
  32816. "value. Prop being mutated: \"" + key + "\"",
  32817. vm
  32818. );
  32819. }
  32820. });
  32821. }
  32822. // static props are already proxied on the component's prototype
  32823. // during Vue.extend(). We only need to proxy props defined at
  32824. // instantiation here.
  32825. if (!(key in vm)) {
  32826. proxy(vm, "_props", key);
  32827. }
  32828. };
  32829. for (var key in propsOptions) loop( key );
  32830. toggleObserving(true);
  32831. }
  32832. function initData (vm) {
  32833. var data = vm.$options.data;
  32834. data = vm._data = typeof data === 'function'
  32835. ? getData(data, vm)
  32836. : data || {};
  32837. if (!isPlainObject(data)) {
  32838. data = {};
  32839. warn(
  32840. 'data functions should return an object:\n' +
  32841. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  32842. vm
  32843. );
  32844. }
  32845. // proxy data on instance
  32846. var keys = Object.keys(data);
  32847. var props = vm.$options.props;
  32848. var methods = vm.$options.methods;
  32849. var i = keys.length;
  32850. while (i--) {
  32851. var key = keys[i];
  32852. {
  32853. if (methods && hasOwn(methods, key)) {
  32854. warn(
  32855. ("Method \"" + key + "\" has already been defined as a data property."),
  32856. vm
  32857. );
  32858. }
  32859. }
  32860. if (props && hasOwn(props, key)) {
  32861. warn(
  32862. "The data property \"" + key + "\" is already declared as a prop. " +
  32863. "Use prop default value instead.",
  32864. vm
  32865. );
  32866. } else if (!isReserved(key)) {
  32867. proxy(vm, "_data", key);
  32868. }
  32869. }
  32870. // observe data
  32871. observe(data, true /* asRootData */);
  32872. }
  32873. function getData (data, vm) {
  32874. // #7573 disable dep collection when invoking data getters
  32875. pushTarget();
  32876. try {
  32877. return data.call(vm, vm)
  32878. } catch (e) {
  32879. handleError(e, vm, "data()");
  32880. return {}
  32881. } finally {
  32882. popTarget();
  32883. }
  32884. }
  32885. var computedWatcherOptions = { lazy: true };
  32886. function initComputed (vm, computed) {
  32887. // $flow-disable-line
  32888. var watchers = vm._computedWatchers = Object.create(null);
  32889. // computed properties are just getters during SSR
  32890. var isSSR = isServerRendering();
  32891. for (var key in computed) {
  32892. var userDef = computed[key];
  32893. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  32894. if (getter == null) {
  32895. warn(
  32896. ("Getter is missing for computed property \"" + key + "\"."),
  32897. vm
  32898. );
  32899. }
  32900. if (!isSSR) {
  32901. // create internal watcher for the computed property.
  32902. watchers[key] = new Watcher(
  32903. vm,
  32904. getter || noop,
  32905. noop,
  32906. computedWatcherOptions
  32907. );
  32908. }
  32909. // component-defined computed properties are already defined on the
  32910. // component prototype. We only need to define computed properties defined
  32911. // at instantiation here.
  32912. if (!(key in vm)) {
  32913. defineComputed(vm, key, userDef);
  32914. } else {
  32915. if (key in vm.$data) {
  32916. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  32917. } else if (vm.$options.props && key in vm.$options.props) {
  32918. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  32919. }
  32920. }
  32921. }
  32922. }
  32923. function defineComputed (
  32924. target,
  32925. key,
  32926. userDef
  32927. ) {
  32928. var shouldCache = !isServerRendering();
  32929. if (typeof userDef === 'function') {
  32930. sharedPropertyDefinition.get = shouldCache
  32931. ? createComputedGetter(key)
  32932. : createGetterInvoker(userDef);
  32933. sharedPropertyDefinition.set = noop;
  32934. } else {
  32935. sharedPropertyDefinition.get = userDef.get
  32936. ? shouldCache && userDef.cache !== false
  32937. ? createComputedGetter(key)
  32938. : createGetterInvoker(userDef.get)
  32939. : noop;
  32940. sharedPropertyDefinition.set = userDef.set || noop;
  32941. }
  32942. if (sharedPropertyDefinition.set === noop) {
  32943. sharedPropertyDefinition.set = function () {
  32944. warn(
  32945. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  32946. this
  32947. );
  32948. };
  32949. }
  32950. Object.defineProperty(target, key, sharedPropertyDefinition);
  32951. }
  32952. function createComputedGetter (key) {
  32953. return function computedGetter () {
  32954. var watcher = this._computedWatchers && this._computedWatchers[key];
  32955. if (watcher) {
  32956. if (watcher.dirty) {
  32957. watcher.evaluate();
  32958. }
  32959. if (Dep.target) {
  32960. watcher.depend();
  32961. }
  32962. return watcher.value
  32963. }
  32964. }
  32965. }
  32966. function createGetterInvoker(fn) {
  32967. return function computedGetter () {
  32968. return fn.call(this, this)
  32969. }
  32970. }
  32971. function initMethods (vm, methods) {
  32972. var props = vm.$options.props;
  32973. for (var key in methods) {
  32974. {
  32975. if (typeof methods[key] !== 'function') {
  32976. warn(
  32977. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  32978. "Did you reference the function correctly?",
  32979. vm
  32980. );
  32981. }
  32982. if (props && hasOwn(props, key)) {
  32983. warn(
  32984. ("Method \"" + key + "\" has already been defined as a prop."),
  32985. vm
  32986. );
  32987. }
  32988. if ((key in vm) && isReserved(key)) {
  32989. warn(
  32990. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  32991. "Avoid defining component methods that start with _ or $."
  32992. );
  32993. }
  32994. }
  32995. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  32996. }
  32997. }
  32998. function initWatch (vm, watch) {
  32999. for (var key in watch) {
  33000. var handler = watch[key];
  33001. if (Array.isArray(handler)) {
  33002. for (var i = 0; i < handler.length; i++) {
  33003. createWatcher(vm, key, handler[i]);
  33004. }
  33005. } else {
  33006. createWatcher(vm, key, handler);
  33007. }
  33008. }
  33009. }
  33010. function createWatcher (
  33011. vm,
  33012. expOrFn,
  33013. handler,
  33014. options
  33015. ) {
  33016. if (isPlainObject(handler)) {
  33017. options = handler;
  33018. handler = handler.handler;
  33019. }
  33020. if (typeof handler === 'string') {
  33021. handler = vm[handler];
  33022. }
  33023. return vm.$watch(expOrFn, handler, options)
  33024. }
  33025. function stateMixin (Vue) {
  33026. // flow somehow has problems with directly declared definition object
  33027. // when using Object.defineProperty, so we have to procedurally build up
  33028. // the object here.
  33029. var dataDef = {};
  33030. dataDef.get = function () { return this._data };
  33031. var propsDef = {};
  33032. propsDef.get = function () { return this._props };
  33033. {
  33034. dataDef.set = function () {
  33035. warn(
  33036. 'Avoid replacing instance root $data. ' +
  33037. 'Use nested data properties instead.',
  33038. this
  33039. );
  33040. };
  33041. propsDef.set = function () {
  33042. warn("$props is readonly.", this);
  33043. };
  33044. }
  33045. Object.defineProperty(Vue.prototype, '$data', dataDef);
  33046. Object.defineProperty(Vue.prototype, '$props', propsDef);
  33047. Vue.prototype.$set = set;
  33048. Vue.prototype.$delete = del;
  33049. Vue.prototype.$watch = function (
  33050. expOrFn,
  33051. cb,
  33052. options
  33053. ) {
  33054. var vm = this;
  33055. if (isPlainObject(cb)) {
  33056. return createWatcher(vm, expOrFn, cb, options)
  33057. }
  33058. options = options || {};
  33059. options.user = true;
  33060. var watcher = new Watcher(vm, expOrFn, cb, options);
  33061. if (options.immediate) {
  33062. try {
  33063. cb.call(vm, watcher.value);
  33064. } catch (error) {
  33065. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  33066. }
  33067. }
  33068. return function unwatchFn () {
  33069. watcher.teardown();
  33070. }
  33071. };
  33072. }
  33073. /* */
  33074. var uid$3 = 0;
  33075. function initMixin (Vue) {
  33076. Vue.prototype._init = function (options) {
  33077. var vm = this;
  33078. // a uid
  33079. vm._uid = uid$3++;
  33080. var startTag, endTag;
  33081. /* istanbul ignore if */
  33082. if (config.performance && mark) {
  33083. startTag = "vue-perf-start:" + (vm._uid);
  33084. endTag = "vue-perf-end:" + (vm._uid);
  33085. mark(startTag);
  33086. }
  33087. // a flag to avoid this being observed
  33088. vm._isVue = true;
  33089. // merge options
  33090. if (options && options._isComponent) {
  33091. // optimize internal component instantiation
  33092. // since dynamic options merging is pretty slow, and none of the
  33093. // internal component options needs special treatment.
  33094. initInternalComponent(vm, options);
  33095. } else {
  33096. vm.$options = mergeOptions(
  33097. resolveConstructorOptions(vm.constructor),
  33098. options || {},
  33099. vm
  33100. );
  33101. }
  33102. /* istanbul ignore else */
  33103. {
  33104. initProxy(vm);
  33105. }
  33106. // expose real self
  33107. vm._self = vm;
  33108. initLifecycle(vm);
  33109. initEvents(vm);
  33110. initRender(vm);
  33111. callHook(vm, 'beforeCreate');
  33112. initInjections(vm); // resolve injections before data/props
  33113. initState(vm);
  33114. initProvide(vm); // resolve provide after data/props
  33115. callHook(vm, 'created');
  33116. /* istanbul ignore if */
  33117. if (config.performance && mark) {
  33118. vm._name = formatComponentName(vm, false);
  33119. mark(endTag);
  33120. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  33121. }
  33122. if (vm.$options.el) {
  33123. vm.$mount(vm.$options.el);
  33124. }
  33125. };
  33126. }
  33127. function initInternalComponent (vm, options) {
  33128. var opts = vm.$options = Object.create(vm.constructor.options);
  33129. // doing this because it's faster than dynamic enumeration.
  33130. var parentVnode = options._parentVnode;
  33131. opts.parent = options.parent;
  33132. opts._parentVnode = parentVnode;
  33133. var vnodeComponentOptions = parentVnode.componentOptions;
  33134. opts.propsData = vnodeComponentOptions.propsData;
  33135. opts._parentListeners = vnodeComponentOptions.listeners;
  33136. opts._renderChildren = vnodeComponentOptions.children;
  33137. opts._componentTag = vnodeComponentOptions.tag;
  33138. if (options.render) {
  33139. opts.render = options.render;
  33140. opts.staticRenderFns = options.staticRenderFns;
  33141. }
  33142. }
  33143. function resolveConstructorOptions (Ctor) {
  33144. var options = Ctor.options;
  33145. if (Ctor.super) {
  33146. var superOptions = resolveConstructorOptions(Ctor.super);
  33147. var cachedSuperOptions = Ctor.superOptions;
  33148. if (superOptions !== cachedSuperOptions) {
  33149. // super option changed,
  33150. // need to resolve new options.
  33151. Ctor.superOptions = superOptions;
  33152. // check if there are any late-modified/attached options (#4976)
  33153. var modifiedOptions = resolveModifiedOptions(Ctor);
  33154. // update base extend options
  33155. if (modifiedOptions) {
  33156. extend(Ctor.extendOptions, modifiedOptions);
  33157. }
  33158. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  33159. if (options.name) {
  33160. options.components[options.name] = Ctor;
  33161. }
  33162. }
  33163. }
  33164. return options
  33165. }
  33166. function resolveModifiedOptions (Ctor) {
  33167. var modified;
  33168. var latest = Ctor.options;
  33169. var sealed = Ctor.sealedOptions;
  33170. for (var key in latest) {
  33171. if (latest[key] !== sealed[key]) {
  33172. if (!modified) { modified = {}; }
  33173. modified[key] = latest[key];
  33174. }
  33175. }
  33176. return modified
  33177. }
  33178. function Vue (options) {
  33179. if (!(this instanceof Vue)
  33180. ) {
  33181. warn('Vue is a constructor and should be called with the `new` keyword');
  33182. }
  33183. this._init(options);
  33184. }
  33185. initMixin(Vue);
  33186. stateMixin(Vue);
  33187. eventsMixin(Vue);
  33188. lifecycleMixin(Vue);
  33189. renderMixin(Vue);
  33190. /* */
  33191. function initUse (Vue) {
  33192. Vue.use = function (plugin) {
  33193. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  33194. if (installedPlugins.indexOf(plugin) > -1) {
  33195. return this
  33196. }
  33197. // additional parameters
  33198. var args = toArray(arguments, 1);
  33199. args.unshift(this);
  33200. if (typeof plugin.install === 'function') {
  33201. plugin.install.apply(plugin, args);
  33202. } else if (typeof plugin === 'function') {
  33203. plugin.apply(null, args);
  33204. }
  33205. installedPlugins.push(plugin);
  33206. return this
  33207. };
  33208. }
  33209. /* */
  33210. function initMixin$1 (Vue) {
  33211. Vue.mixin = function (mixin) {
  33212. this.options = mergeOptions(this.options, mixin);
  33213. return this
  33214. };
  33215. }
  33216. /* */
  33217. function initExtend (Vue) {
  33218. /**
  33219. * Each instance constructor, including Vue, has a unique
  33220. * cid. This enables us to create wrapped "child
  33221. * constructors" for prototypal inheritance and cache them.
  33222. */
  33223. Vue.cid = 0;
  33224. var cid = 1;
  33225. /**
  33226. * Class inheritance
  33227. */
  33228. Vue.extend = function (extendOptions) {
  33229. extendOptions = extendOptions || {};
  33230. var Super = this;
  33231. var SuperId = Super.cid;
  33232. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  33233. if (cachedCtors[SuperId]) {
  33234. return cachedCtors[SuperId]
  33235. }
  33236. var name = extendOptions.name || Super.options.name;
  33237. if (name) {
  33238. validateComponentName(name);
  33239. }
  33240. var Sub = function VueComponent (options) {
  33241. this._init(options);
  33242. };
  33243. Sub.prototype = Object.create(Super.prototype);
  33244. Sub.prototype.constructor = Sub;
  33245. Sub.cid = cid++;
  33246. Sub.options = mergeOptions(
  33247. Super.options,
  33248. extendOptions
  33249. );
  33250. Sub['super'] = Super;
  33251. // For props and computed properties, we define the proxy getters on
  33252. // the Vue instances at extension time, on the extended prototype. This
  33253. // avoids Object.defineProperty calls for each instance created.
  33254. if (Sub.options.props) {
  33255. initProps$1(Sub);
  33256. }
  33257. if (Sub.options.computed) {
  33258. initComputed$1(Sub);
  33259. }
  33260. // allow further extension/mixin/plugin usage
  33261. Sub.extend = Super.extend;
  33262. Sub.mixin = Super.mixin;
  33263. Sub.use = Super.use;
  33264. // create asset registers, so extended classes
  33265. // can have their private assets too.
  33266. ASSET_TYPES.forEach(function (type) {
  33267. Sub[type] = Super[type];
  33268. });
  33269. // enable recursive self-lookup
  33270. if (name) {
  33271. Sub.options.components[name] = Sub;
  33272. }
  33273. // keep a reference to the super options at extension time.
  33274. // later at instantiation we can check if Super's options have
  33275. // been updated.
  33276. Sub.superOptions = Super.options;
  33277. Sub.extendOptions = extendOptions;
  33278. Sub.sealedOptions = extend({}, Sub.options);
  33279. // cache constructor
  33280. cachedCtors[SuperId] = Sub;
  33281. return Sub
  33282. };
  33283. }
  33284. function initProps$1 (Comp) {
  33285. var props = Comp.options.props;
  33286. for (var key in props) {
  33287. proxy(Comp.prototype, "_props", key);
  33288. }
  33289. }
  33290. function initComputed$1 (Comp) {
  33291. var computed = Comp.options.computed;
  33292. for (var key in computed) {
  33293. defineComputed(Comp.prototype, key, computed[key]);
  33294. }
  33295. }
  33296. /* */
  33297. function initAssetRegisters (Vue) {
  33298. /**
  33299. * Create asset registration methods.
  33300. */
  33301. ASSET_TYPES.forEach(function (type) {
  33302. Vue[type] = function (
  33303. id,
  33304. definition
  33305. ) {
  33306. if (!definition) {
  33307. return this.options[type + 's'][id]
  33308. } else {
  33309. /* istanbul ignore if */
  33310. if (type === 'component') {
  33311. validateComponentName(id);
  33312. }
  33313. if (type === 'component' && isPlainObject(definition)) {
  33314. definition.name = definition.name || id;
  33315. definition = this.options._base.extend(definition);
  33316. }
  33317. if (type === 'directive' && typeof definition === 'function') {
  33318. definition = { bind: definition, update: definition };
  33319. }
  33320. this.options[type + 's'][id] = definition;
  33321. return definition
  33322. }
  33323. };
  33324. });
  33325. }
  33326. /* */
  33327. function getComponentName (opts) {
  33328. return opts && (opts.Ctor.options.name || opts.tag)
  33329. }
  33330. function matches (pattern, name) {
  33331. if (Array.isArray(pattern)) {
  33332. return pattern.indexOf(name) > -1
  33333. } else if (typeof pattern === 'string') {
  33334. return pattern.split(',').indexOf(name) > -1
  33335. } else if (isRegExp(pattern)) {
  33336. return pattern.test(name)
  33337. }
  33338. /* istanbul ignore next */
  33339. return false
  33340. }
  33341. function pruneCache (keepAliveInstance, filter) {
  33342. var cache = keepAliveInstance.cache;
  33343. var keys = keepAliveInstance.keys;
  33344. var _vnode = keepAliveInstance._vnode;
  33345. for (var key in cache) {
  33346. var cachedNode = cache[key];
  33347. if (cachedNode) {
  33348. var name = getComponentName(cachedNode.componentOptions);
  33349. if (name && !filter(name)) {
  33350. pruneCacheEntry(cache, key, keys, _vnode);
  33351. }
  33352. }
  33353. }
  33354. }
  33355. function pruneCacheEntry (
  33356. cache,
  33357. key,
  33358. keys,
  33359. current
  33360. ) {
  33361. var cached$$1 = cache[key];
  33362. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  33363. cached$$1.componentInstance.$destroy();
  33364. }
  33365. cache[key] = null;
  33366. remove(keys, key);
  33367. }
  33368. var patternTypes = [String, RegExp, Array];
  33369. var KeepAlive = {
  33370. name: 'keep-alive',
  33371. abstract: true,
  33372. props: {
  33373. include: patternTypes,
  33374. exclude: patternTypes,
  33375. max: [String, Number]
  33376. },
  33377. created: function created () {
  33378. this.cache = Object.create(null);
  33379. this.keys = [];
  33380. },
  33381. destroyed: function destroyed () {
  33382. for (var key in this.cache) {
  33383. pruneCacheEntry(this.cache, key, this.keys);
  33384. }
  33385. },
  33386. mounted: function mounted () {
  33387. var this$1 = this;
  33388. this.$watch('include', function (val) {
  33389. pruneCache(this$1, function (name) { return matches(val, name); });
  33390. });
  33391. this.$watch('exclude', function (val) {
  33392. pruneCache(this$1, function (name) { return !matches(val, name); });
  33393. });
  33394. },
  33395. render: function render () {
  33396. var slot = this.$slots.default;
  33397. var vnode = getFirstComponentChild(slot);
  33398. var componentOptions = vnode && vnode.componentOptions;
  33399. if (componentOptions) {
  33400. // check pattern
  33401. var name = getComponentName(componentOptions);
  33402. var ref = this;
  33403. var include = ref.include;
  33404. var exclude = ref.exclude;
  33405. if (
  33406. // not included
  33407. (include && (!name || !matches(include, name))) ||
  33408. // excluded
  33409. (exclude && name && matches(exclude, name))
  33410. ) {
  33411. return vnode
  33412. }
  33413. var ref$1 = this;
  33414. var cache = ref$1.cache;
  33415. var keys = ref$1.keys;
  33416. var key = vnode.key == null
  33417. // same constructor may get registered as different local components
  33418. // so cid alone is not enough (#3269)
  33419. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  33420. : vnode.key;
  33421. if (cache[key]) {
  33422. vnode.componentInstance = cache[key].componentInstance;
  33423. // make current key freshest
  33424. remove(keys, key);
  33425. keys.push(key);
  33426. } else {
  33427. cache[key] = vnode;
  33428. keys.push(key);
  33429. // prune oldest entry
  33430. if (this.max && keys.length > parseInt(this.max)) {
  33431. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  33432. }
  33433. }
  33434. vnode.data.keepAlive = true;
  33435. }
  33436. return vnode || (slot && slot[0])
  33437. }
  33438. };
  33439. var builtInComponents = {
  33440. KeepAlive: KeepAlive
  33441. };
  33442. /* */
  33443. function initGlobalAPI (Vue) {
  33444. // config
  33445. var configDef = {};
  33446. configDef.get = function () { return config; };
  33447. {
  33448. configDef.set = function () {
  33449. warn(
  33450. 'Do not replace the Vue.config object, set individual fields instead.'
  33451. );
  33452. };
  33453. }
  33454. Object.defineProperty(Vue, 'config', configDef);
  33455. // exposed util methods.
  33456. // NOTE: these are not considered part of the public API - avoid relying on
  33457. // them unless you are aware of the risk.
  33458. Vue.util = {
  33459. warn: warn,
  33460. extend: extend,
  33461. mergeOptions: mergeOptions,
  33462. defineReactive: defineReactive$$1
  33463. };
  33464. Vue.set = set;
  33465. Vue.delete = del;
  33466. Vue.nextTick = nextTick;
  33467. // 2.6 explicit observable API
  33468. Vue.observable = function (obj) {
  33469. observe(obj);
  33470. return obj
  33471. };
  33472. Vue.options = Object.create(null);
  33473. ASSET_TYPES.forEach(function (type) {
  33474. Vue.options[type + 's'] = Object.create(null);
  33475. });
  33476. // this is used to identify the "base" constructor to extend all plain-object
  33477. // components with in Weex's multi-instance scenarios.
  33478. Vue.options._base = Vue;
  33479. extend(Vue.options.components, builtInComponents);
  33480. initUse(Vue);
  33481. initMixin$1(Vue);
  33482. initExtend(Vue);
  33483. initAssetRegisters(Vue);
  33484. }
  33485. initGlobalAPI(Vue);
  33486. Object.defineProperty(Vue.prototype, '$isServer', {
  33487. get: isServerRendering
  33488. });
  33489. Object.defineProperty(Vue.prototype, '$ssrContext', {
  33490. get: function get () {
  33491. /* istanbul ignore next */
  33492. return this.$vnode && this.$vnode.ssrContext
  33493. }
  33494. });
  33495. // expose FunctionalRenderContext for ssr runtime helper installation
  33496. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  33497. value: FunctionalRenderContext
  33498. });
  33499. Vue.version = '2.6.12';
  33500. /* */
  33501. // these are reserved for web because they are directly compiled away
  33502. // during template compilation
  33503. var isReservedAttr = makeMap('style,class');
  33504. // attributes that should be using props for binding
  33505. var acceptValue = makeMap('input,textarea,option,select,progress');
  33506. var mustUseProp = function (tag, type, attr) {
  33507. return (
  33508. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  33509. (attr === 'selected' && tag === 'option') ||
  33510. (attr === 'checked' && tag === 'input') ||
  33511. (attr === 'muted' && tag === 'video')
  33512. )
  33513. };
  33514. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  33515. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  33516. var convertEnumeratedValue = function (key, value) {
  33517. return isFalsyAttrValue(value) || value === 'false'
  33518. ? 'false'
  33519. // allow arbitrary string value for contenteditable
  33520. : key === 'contenteditable' && isValidContentEditableValue(value)
  33521. ? value
  33522. : 'true'
  33523. };
  33524. var isBooleanAttr = makeMap(
  33525. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  33526. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  33527. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  33528. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  33529. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  33530. 'truespeed,typemustmatch,visible'
  33531. );
  33532. var xlinkNS = 'http://www.w3.org/1999/xlink';
  33533. var isXlink = function (name) {
  33534. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  33535. };
  33536. var getXlinkProp = function (name) {
  33537. return isXlink(name) ? name.slice(6, name.length) : ''
  33538. };
  33539. var isFalsyAttrValue = function (val) {
  33540. return val == null || val === false
  33541. };
  33542. /* */
  33543. function genClassForVnode (vnode) {
  33544. var data = vnode.data;
  33545. var parentNode = vnode;
  33546. var childNode = vnode;
  33547. while (isDef(childNode.componentInstance)) {
  33548. childNode = childNode.componentInstance._vnode;
  33549. if (childNode && childNode.data) {
  33550. data = mergeClassData(childNode.data, data);
  33551. }
  33552. }
  33553. while (isDef(parentNode = parentNode.parent)) {
  33554. if (parentNode && parentNode.data) {
  33555. data = mergeClassData(data, parentNode.data);
  33556. }
  33557. }
  33558. return renderClass(data.staticClass, data.class)
  33559. }
  33560. function mergeClassData (child, parent) {
  33561. return {
  33562. staticClass: concat(child.staticClass, parent.staticClass),
  33563. class: isDef(child.class)
  33564. ? [child.class, parent.class]
  33565. : parent.class
  33566. }
  33567. }
  33568. function renderClass (
  33569. staticClass,
  33570. dynamicClass
  33571. ) {
  33572. if (isDef(staticClass) || isDef(dynamicClass)) {
  33573. return concat(staticClass, stringifyClass(dynamicClass))
  33574. }
  33575. /* istanbul ignore next */
  33576. return ''
  33577. }
  33578. function concat (a, b) {
  33579. return a ? b ? (a + ' ' + b) : a : (b || '')
  33580. }
  33581. function stringifyClass (value) {
  33582. if (Array.isArray(value)) {
  33583. return stringifyArray(value)
  33584. }
  33585. if (isObject(value)) {
  33586. return stringifyObject(value)
  33587. }
  33588. if (typeof value === 'string') {
  33589. return value
  33590. }
  33591. /* istanbul ignore next */
  33592. return ''
  33593. }
  33594. function stringifyArray (value) {
  33595. var res = '';
  33596. var stringified;
  33597. for (var i = 0, l = value.length; i < l; i++) {
  33598. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  33599. if (res) { res += ' '; }
  33600. res += stringified;
  33601. }
  33602. }
  33603. return res
  33604. }
  33605. function stringifyObject (value) {
  33606. var res = '';
  33607. for (var key in value) {
  33608. if (value[key]) {
  33609. if (res) { res += ' '; }
  33610. res += key;
  33611. }
  33612. }
  33613. return res
  33614. }
  33615. /* */
  33616. var namespaceMap = {
  33617. svg: 'http://www.w3.org/2000/svg',
  33618. math: 'http://www.w3.org/1998/Math/MathML'
  33619. };
  33620. var isHTMLTag = makeMap(
  33621. 'html,body,base,head,link,meta,style,title,' +
  33622. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  33623. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  33624. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  33625. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  33626. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  33627. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  33628. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  33629. 'output,progress,select,textarea,' +
  33630. 'details,dialog,menu,menuitem,summary,' +
  33631. 'content,element,shadow,template,blockquote,iframe,tfoot'
  33632. );
  33633. // this map is intentionally selective, only covering SVG elements that may
  33634. // contain child elements.
  33635. var isSVG = makeMap(
  33636. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  33637. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  33638. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  33639. true
  33640. );
  33641. var isPreTag = function (tag) { return tag === 'pre'; };
  33642. var isReservedTag = function (tag) {
  33643. return isHTMLTag(tag) || isSVG(tag)
  33644. };
  33645. function getTagNamespace (tag) {
  33646. if (isSVG(tag)) {
  33647. return 'svg'
  33648. }
  33649. // basic support for MathML
  33650. // note it doesn't support other MathML elements being component roots
  33651. if (tag === 'math') {
  33652. return 'math'
  33653. }
  33654. }
  33655. var unknownElementCache = Object.create(null);
  33656. function isUnknownElement (tag) {
  33657. /* istanbul ignore if */
  33658. if (!inBrowser) {
  33659. return true
  33660. }
  33661. if (isReservedTag(tag)) {
  33662. return false
  33663. }
  33664. tag = tag.toLowerCase();
  33665. /* istanbul ignore if */
  33666. if (unknownElementCache[tag] != null) {
  33667. return unknownElementCache[tag]
  33668. }
  33669. var el = document.createElement(tag);
  33670. if (tag.indexOf('-') > -1) {
  33671. // http://stackoverflow.com/a/28210364/1070244
  33672. return (unknownElementCache[tag] = (
  33673. el.constructor === window.HTMLUnknownElement ||
  33674. el.constructor === window.HTMLElement
  33675. ))
  33676. } else {
  33677. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  33678. }
  33679. }
  33680. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  33681. /* */
  33682. /**
  33683. * Query an element selector if it's not an element already.
  33684. */
  33685. function query (el) {
  33686. if (typeof el === 'string') {
  33687. var selected = document.querySelector(el);
  33688. if (!selected) {
  33689. warn(
  33690. 'Cannot find element: ' + el
  33691. );
  33692. return document.createElement('div')
  33693. }
  33694. return selected
  33695. } else {
  33696. return el
  33697. }
  33698. }
  33699. /* */
  33700. function createElement$1 (tagName, vnode) {
  33701. var elm = document.createElement(tagName);
  33702. if (tagName !== 'select') {
  33703. return elm
  33704. }
  33705. // false or null will remove the attribute but undefined will not
  33706. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  33707. elm.setAttribute('multiple', 'multiple');
  33708. }
  33709. return elm
  33710. }
  33711. function createElementNS (namespace, tagName) {
  33712. return document.createElementNS(namespaceMap[namespace], tagName)
  33713. }
  33714. function createTextNode (text) {
  33715. return document.createTextNode(text)
  33716. }
  33717. function createComment (text) {
  33718. return document.createComment(text)
  33719. }
  33720. function insertBefore (parentNode, newNode, referenceNode) {
  33721. parentNode.insertBefore(newNode, referenceNode);
  33722. }
  33723. function removeChild (node, child) {
  33724. node.removeChild(child);
  33725. }
  33726. function appendChild (node, child) {
  33727. node.appendChild(child);
  33728. }
  33729. function parentNode (node) {
  33730. return node.parentNode
  33731. }
  33732. function nextSibling (node) {
  33733. return node.nextSibling
  33734. }
  33735. function tagName (node) {
  33736. return node.tagName
  33737. }
  33738. function setTextContent (node, text) {
  33739. node.textContent = text;
  33740. }
  33741. function setStyleScope (node, scopeId) {
  33742. node.setAttribute(scopeId, '');
  33743. }
  33744. var nodeOps = /*#__PURE__*/Object.freeze({
  33745. createElement: createElement$1,
  33746. createElementNS: createElementNS,
  33747. createTextNode: createTextNode,
  33748. createComment: createComment,
  33749. insertBefore: insertBefore,
  33750. removeChild: removeChild,
  33751. appendChild: appendChild,
  33752. parentNode: parentNode,
  33753. nextSibling: nextSibling,
  33754. tagName: tagName,
  33755. setTextContent: setTextContent,
  33756. setStyleScope: setStyleScope
  33757. });
  33758. /* */
  33759. var ref = {
  33760. create: function create (_, vnode) {
  33761. registerRef(vnode);
  33762. },
  33763. update: function update (oldVnode, vnode) {
  33764. if (oldVnode.data.ref !== vnode.data.ref) {
  33765. registerRef(oldVnode, true);
  33766. registerRef(vnode);
  33767. }
  33768. },
  33769. destroy: function destroy (vnode) {
  33770. registerRef(vnode, true);
  33771. }
  33772. };
  33773. function registerRef (vnode, isRemoval) {
  33774. var key = vnode.data.ref;
  33775. if (!isDef(key)) { return }
  33776. var vm = vnode.context;
  33777. var ref = vnode.componentInstance || vnode.elm;
  33778. var refs = vm.$refs;
  33779. if (isRemoval) {
  33780. if (Array.isArray(refs[key])) {
  33781. remove(refs[key], ref);
  33782. } else if (refs[key] === ref) {
  33783. refs[key] = undefined;
  33784. }
  33785. } else {
  33786. if (vnode.data.refInFor) {
  33787. if (!Array.isArray(refs[key])) {
  33788. refs[key] = [ref];
  33789. } else if (refs[key].indexOf(ref) < 0) {
  33790. // $flow-disable-line
  33791. refs[key].push(ref);
  33792. }
  33793. } else {
  33794. refs[key] = ref;
  33795. }
  33796. }
  33797. }
  33798. /**
  33799. * Virtual DOM patching algorithm based on Snabbdom by
  33800. * Simon Friis Vindum (@paldepind)
  33801. * Licensed under the MIT License
  33802. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  33803. *
  33804. * modified by Evan You (@yyx990803)
  33805. *
  33806. * Not type-checking this because this file is perf-critical and the cost
  33807. * of making flow understand it is not worth it.
  33808. */
  33809. var emptyNode = new VNode('', {}, []);
  33810. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  33811. function sameVnode (a, b) {
  33812. return (
  33813. a.key === b.key && (
  33814. (
  33815. a.tag === b.tag &&
  33816. a.isComment === b.isComment &&
  33817. isDef(a.data) === isDef(b.data) &&
  33818. sameInputType(a, b)
  33819. ) || (
  33820. isTrue(a.isAsyncPlaceholder) &&
  33821. a.asyncFactory === b.asyncFactory &&
  33822. isUndef(b.asyncFactory.error)
  33823. )
  33824. )
  33825. )
  33826. }
  33827. function sameInputType (a, b) {
  33828. if (a.tag !== 'input') { return true }
  33829. var i;
  33830. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  33831. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  33832. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  33833. }
  33834. function createKeyToOldIdx (children, beginIdx, endIdx) {
  33835. var i, key;
  33836. var map = {};
  33837. for (i = beginIdx; i <= endIdx; ++i) {
  33838. key = children[i].key;
  33839. if (isDef(key)) { map[key] = i; }
  33840. }
  33841. return map
  33842. }
  33843. function createPatchFunction (backend) {
  33844. var i, j;
  33845. var cbs = {};
  33846. var modules = backend.modules;
  33847. var nodeOps = backend.nodeOps;
  33848. for (i = 0; i < hooks.length; ++i) {
  33849. cbs[hooks[i]] = [];
  33850. for (j = 0; j < modules.length; ++j) {
  33851. if (isDef(modules[j][hooks[i]])) {
  33852. cbs[hooks[i]].push(modules[j][hooks[i]]);
  33853. }
  33854. }
  33855. }
  33856. function emptyNodeAt (elm) {
  33857. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  33858. }
  33859. function createRmCb (childElm, listeners) {
  33860. function remove$$1 () {
  33861. if (--remove$$1.listeners === 0) {
  33862. removeNode(childElm);
  33863. }
  33864. }
  33865. remove$$1.listeners = listeners;
  33866. return remove$$1
  33867. }
  33868. function removeNode (el) {
  33869. var parent = nodeOps.parentNode(el);
  33870. // element may have already been removed due to v-html / v-text
  33871. if (isDef(parent)) {
  33872. nodeOps.removeChild(parent, el);
  33873. }
  33874. }
  33875. function isUnknownElement$$1 (vnode, inVPre) {
  33876. return (
  33877. !inVPre &&
  33878. !vnode.ns &&
  33879. !(
  33880. config.ignoredElements.length &&
  33881. config.ignoredElements.some(function (ignore) {
  33882. return isRegExp(ignore)
  33883. ? ignore.test(vnode.tag)
  33884. : ignore === vnode.tag
  33885. })
  33886. ) &&
  33887. config.isUnknownElement(vnode.tag)
  33888. )
  33889. }
  33890. var creatingElmInVPre = 0;
  33891. function createElm (
  33892. vnode,
  33893. insertedVnodeQueue,
  33894. parentElm,
  33895. refElm,
  33896. nested,
  33897. ownerArray,
  33898. index
  33899. ) {
  33900. if (isDef(vnode.elm) && isDef(ownerArray)) {
  33901. // This vnode was used in a previous render!
  33902. // now it's used as a new node, overwriting its elm would cause
  33903. // potential patch errors down the road when it's used as an insertion
  33904. // reference node. Instead, we clone the node on-demand before creating
  33905. // associated DOM element for it.
  33906. vnode = ownerArray[index] = cloneVNode(vnode);
  33907. }
  33908. vnode.isRootInsert = !nested; // for transition enter check
  33909. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  33910. return
  33911. }
  33912. var data = vnode.data;
  33913. var children = vnode.children;
  33914. var tag = vnode.tag;
  33915. if (isDef(tag)) {
  33916. {
  33917. if (data && data.pre) {
  33918. creatingElmInVPre++;
  33919. }
  33920. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  33921. warn(
  33922. 'Unknown custom element: <' + tag + '> - did you ' +
  33923. 'register the component correctly? For recursive components, ' +
  33924. 'make sure to provide the "name" option.',
  33925. vnode.context
  33926. );
  33927. }
  33928. }
  33929. vnode.elm = vnode.ns
  33930. ? nodeOps.createElementNS(vnode.ns, tag)
  33931. : nodeOps.createElement(tag, vnode);
  33932. setScope(vnode);
  33933. /* istanbul ignore if */
  33934. {
  33935. createChildren(vnode, children, insertedVnodeQueue);
  33936. if (isDef(data)) {
  33937. invokeCreateHooks(vnode, insertedVnodeQueue);
  33938. }
  33939. insert(parentElm, vnode.elm, refElm);
  33940. }
  33941. if (data && data.pre) {
  33942. creatingElmInVPre--;
  33943. }
  33944. } else if (isTrue(vnode.isComment)) {
  33945. vnode.elm = nodeOps.createComment(vnode.text);
  33946. insert(parentElm, vnode.elm, refElm);
  33947. } else {
  33948. vnode.elm = nodeOps.createTextNode(vnode.text);
  33949. insert(parentElm, vnode.elm, refElm);
  33950. }
  33951. }
  33952. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  33953. var i = vnode.data;
  33954. if (isDef(i)) {
  33955. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  33956. if (isDef(i = i.hook) && isDef(i = i.init)) {
  33957. i(vnode, false /* hydrating */);
  33958. }
  33959. // after calling the init hook, if the vnode is a child component
  33960. // it should've created a child instance and mounted it. the child
  33961. // component also has set the placeholder vnode's elm.
  33962. // in that case we can just return the element and be done.
  33963. if (isDef(vnode.componentInstance)) {
  33964. initComponent(vnode, insertedVnodeQueue);
  33965. insert(parentElm, vnode.elm, refElm);
  33966. if (isTrue(isReactivated)) {
  33967. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  33968. }
  33969. return true
  33970. }
  33971. }
  33972. }
  33973. function initComponent (vnode, insertedVnodeQueue) {
  33974. if (isDef(vnode.data.pendingInsert)) {
  33975. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  33976. vnode.data.pendingInsert = null;
  33977. }
  33978. vnode.elm = vnode.componentInstance.$el;
  33979. if (isPatchable(vnode)) {
  33980. invokeCreateHooks(vnode, insertedVnodeQueue);
  33981. setScope(vnode);
  33982. } else {
  33983. // empty component root.
  33984. // skip all element-related modules except for ref (#3455)
  33985. registerRef(vnode);
  33986. // make sure to invoke the insert hook
  33987. insertedVnodeQueue.push(vnode);
  33988. }
  33989. }
  33990. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  33991. var i;
  33992. // hack for #4339: a reactivated component with inner transition
  33993. // does not trigger because the inner node's created hooks are not called
  33994. // again. It's not ideal to involve module-specific logic in here but
  33995. // there doesn't seem to be a better way to do it.
  33996. var innerNode = vnode;
  33997. while (innerNode.componentInstance) {
  33998. innerNode = innerNode.componentInstance._vnode;
  33999. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  34000. for (i = 0; i < cbs.activate.length; ++i) {
  34001. cbs.activate[i](emptyNode, innerNode);
  34002. }
  34003. insertedVnodeQueue.push(innerNode);
  34004. break
  34005. }
  34006. }
  34007. // unlike a newly created component,
  34008. // a reactivated keep-alive component doesn't insert itself
  34009. insert(parentElm, vnode.elm, refElm);
  34010. }
  34011. function insert (parent, elm, ref$$1) {
  34012. if (isDef(parent)) {
  34013. if (isDef(ref$$1)) {
  34014. if (nodeOps.parentNode(ref$$1) === parent) {
  34015. nodeOps.insertBefore(parent, elm, ref$$1);
  34016. }
  34017. } else {
  34018. nodeOps.appendChild(parent, elm);
  34019. }
  34020. }
  34021. }
  34022. function createChildren (vnode, children, insertedVnodeQueue) {
  34023. if (Array.isArray(children)) {
  34024. {
  34025. checkDuplicateKeys(children);
  34026. }
  34027. for (var i = 0; i < children.length; ++i) {
  34028. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  34029. }
  34030. } else if (isPrimitive(vnode.text)) {
  34031. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  34032. }
  34033. }
  34034. function isPatchable (vnode) {
  34035. while (vnode.componentInstance) {
  34036. vnode = vnode.componentInstance._vnode;
  34037. }
  34038. return isDef(vnode.tag)
  34039. }
  34040. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  34041. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  34042. cbs.create[i$1](emptyNode, vnode);
  34043. }
  34044. i = vnode.data.hook; // Reuse variable
  34045. if (isDef(i)) {
  34046. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  34047. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  34048. }
  34049. }
  34050. // set scope id attribute for scoped CSS.
  34051. // this is implemented as a special case to avoid the overhead
  34052. // of going through the normal attribute patching process.
  34053. function setScope (vnode) {
  34054. var i;
  34055. if (isDef(i = vnode.fnScopeId)) {
  34056. nodeOps.setStyleScope(vnode.elm, i);
  34057. } else {
  34058. var ancestor = vnode;
  34059. while (ancestor) {
  34060. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  34061. nodeOps.setStyleScope(vnode.elm, i);
  34062. }
  34063. ancestor = ancestor.parent;
  34064. }
  34065. }
  34066. // for slot content they should also get the scopeId from the host instance.
  34067. if (isDef(i = activeInstance) &&
  34068. i !== vnode.context &&
  34069. i !== vnode.fnContext &&
  34070. isDef(i = i.$options._scopeId)
  34071. ) {
  34072. nodeOps.setStyleScope(vnode.elm, i);
  34073. }
  34074. }
  34075. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  34076. for (; startIdx <= endIdx; ++startIdx) {
  34077. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  34078. }
  34079. }
  34080. function invokeDestroyHook (vnode) {
  34081. var i, j;
  34082. var data = vnode.data;
  34083. if (isDef(data)) {
  34084. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  34085. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  34086. }
  34087. if (isDef(i = vnode.children)) {
  34088. for (j = 0; j < vnode.children.length; ++j) {
  34089. invokeDestroyHook(vnode.children[j]);
  34090. }
  34091. }
  34092. }
  34093. function removeVnodes (vnodes, startIdx, endIdx) {
  34094. for (; startIdx <= endIdx; ++startIdx) {
  34095. var ch = vnodes[startIdx];
  34096. if (isDef(ch)) {
  34097. if (isDef(ch.tag)) {
  34098. removeAndInvokeRemoveHook(ch);
  34099. invokeDestroyHook(ch);
  34100. } else { // Text node
  34101. removeNode(ch.elm);
  34102. }
  34103. }
  34104. }
  34105. }
  34106. function removeAndInvokeRemoveHook (vnode, rm) {
  34107. if (isDef(rm) || isDef(vnode.data)) {
  34108. var i;
  34109. var listeners = cbs.remove.length + 1;
  34110. if (isDef(rm)) {
  34111. // we have a recursively passed down rm callback
  34112. // increase the listeners count
  34113. rm.listeners += listeners;
  34114. } else {
  34115. // directly removing
  34116. rm = createRmCb(vnode.elm, listeners);
  34117. }
  34118. // recursively invoke hooks on child component root node
  34119. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  34120. removeAndInvokeRemoveHook(i, rm);
  34121. }
  34122. for (i = 0; i < cbs.remove.length; ++i) {
  34123. cbs.remove[i](vnode, rm);
  34124. }
  34125. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  34126. i(vnode, rm);
  34127. } else {
  34128. rm();
  34129. }
  34130. } else {
  34131. removeNode(vnode.elm);
  34132. }
  34133. }
  34134. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  34135. var oldStartIdx = 0;
  34136. var newStartIdx = 0;
  34137. var oldEndIdx = oldCh.length - 1;
  34138. var oldStartVnode = oldCh[0];
  34139. var oldEndVnode = oldCh[oldEndIdx];
  34140. var newEndIdx = newCh.length - 1;
  34141. var newStartVnode = newCh[0];
  34142. var newEndVnode = newCh[newEndIdx];
  34143. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  34144. // removeOnly is a special flag used only by <transition-group>
  34145. // to ensure removed elements stay in correct relative positions
  34146. // during leaving transitions
  34147. var canMove = !removeOnly;
  34148. {
  34149. checkDuplicateKeys(newCh);
  34150. }
  34151. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  34152. if (isUndef(oldStartVnode)) {
  34153. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  34154. } else if (isUndef(oldEndVnode)) {
  34155. oldEndVnode = oldCh[--oldEndIdx];
  34156. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  34157. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  34158. oldStartVnode = oldCh[++oldStartIdx];
  34159. newStartVnode = newCh[++newStartIdx];
  34160. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  34161. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  34162. oldEndVnode = oldCh[--oldEndIdx];
  34163. newEndVnode = newCh[--newEndIdx];
  34164. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  34165. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  34166. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  34167. oldStartVnode = oldCh[++oldStartIdx];
  34168. newEndVnode = newCh[--newEndIdx];
  34169. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  34170. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  34171. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  34172. oldEndVnode = oldCh[--oldEndIdx];
  34173. newStartVnode = newCh[++newStartIdx];
  34174. } else {
  34175. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  34176. idxInOld = isDef(newStartVnode.key)
  34177. ? oldKeyToIdx[newStartVnode.key]
  34178. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  34179. if (isUndef(idxInOld)) { // New element
  34180. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  34181. } else {
  34182. vnodeToMove = oldCh[idxInOld];
  34183. if (sameVnode(vnodeToMove, newStartVnode)) {
  34184. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  34185. oldCh[idxInOld] = undefined;
  34186. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  34187. } else {
  34188. // same key but different element. treat as new element
  34189. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  34190. }
  34191. }
  34192. newStartVnode = newCh[++newStartIdx];
  34193. }
  34194. }
  34195. if (oldStartIdx > oldEndIdx) {
  34196. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  34197. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  34198. } else if (newStartIdx > newEndIdx) {
  34199. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  34200. }
  34201. }
  34202. function checkDuplicateKeys (children) {
  34203. var seenKeys = {};
  34204. for (var i = 0; i < children.length; i++) {
  34205. var vnode = children[i];
  34206. var key = vnode.key;
  34207. if (isDef(key)) {
  34208. if (seenKeys[key]) {
  34209. warn(
  34210. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  34211. vnode.context
  34212. );
  34213. } else {
  34214. seenKeys[key] = true;
  34215. }
  34216. }
  34217. }
  34218. }
  34219. function findIdxInOld (node, oldCh, start, end) {
  34220. for (var i = start; i < end; i++) {
  34221. var c = oldCh[i];
  34222. if (isDef(c) && sameVnode(node, c)) { return i }
  34223. }
  34224. }
  34225. function patchVnode (
  34226. oldVnode,
  34227. vnode,
  34228. insertedVnodeQueue,
  34229. ownerArray,
  34230. index,
  34231. removeOnly
  34232. ) {
  34233. if (oldVnode === vnode) {
  34234. return
  34235. }
  34236. if (isDef(vnode.elm) && isDef(ownerArray)) {
  34237. // clone reused vnode
  34238. vnode = ownerArray[index] = cloneVNode(vnode);
  34239. }
  34240. var elm = vnode.elm = oldVnode.elm;
  34241. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  34242. if (isDef(vnode.asyncFactory.resolved)) {
  34243. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  34244. } else {
  34245. vnode.isAsyncPlaceholder = true;
  34246. }
  34247. return
  34248. }
  34249. // reuse element for static trees.
  34250. // note we only do this if the vnode is cloned -
  34251. // if the new node is not cloned it means the render functions have been
  34252. // reset by the hot-reload-api and we need to do a proper re-render.
  34253. if (isTrue(vnode.isStatic) &&
  34254. isTrue(oldVnode.isStatic) &&
  34255. vnode.key === oldVnode.key &&
  34256. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  34257. ) {
  34258. vnode.componentInstance = oldVnode.componentInstance;
  34259. return
  34260. }
  34261. var i;
  34262. var data = vnode.data;
  34263. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  34264. i(oldVnode, vnode);
  34265. }
  34266. var oldCh = oldVnode.children;
  34267. var ch = vnode.children;
  34268. if (isDef(data) && isPatchable(vnode)) {
  34269. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  34270. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  34271. }
  34272. if (isUndef(vnode.text)) {
  34273. if (isDef(oldCh) && isDef(ch)) {
  34274. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  34275. } else if (isDef(ch)) {
  34276. {
  34277. checkDuplicateKeys(ch);
  34278. }
  34279. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  34280. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  34281. } else if (isDef(oldCh)) {
  34282. removeVnodes(oldCh, 0, oldCh.length - 1);
  34283. } else if (isDef(oldVnode.text)) {
  34284. nodeOps.setTextContent(elm, '');
  34285. }
  34286. } else if (oldVnode.text !== vnode.text) {
  34287. nodeOps.setTextContent(elm, vnode.text);
  34288. }
  34289. if (isDef(data)) {
  34290. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  34291. }
  34292. }
  34293. function invokeInsertHook (vnode, queue, initial) {
  34294. // delay insert hooks for component root nodes, invoke them after the
  34295. // element is really inserted
  34296. if (isTrue(initial) && isDef(vnode.parent)) {
  34297. vnode.parent.data.pendingInsert = queue;
  34298. } else {
  34299. for (var i = 0; i < queue.length; ++i) {
  34300. queue[i].data.hook.insert(queue[i]);
  34301. }
  34302. }
  34303. }
  34304. var hydrationBailed = false;
  34305. // list of modules that can skip create hook during hydration because they
  34306. // are already rendered on the client or has no need for initialization
  34307. // Note: style is excluded because it relies on initial clone for future
  34308. // deep updates (#7063).
  34309. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  34310. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  34311. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  34312. var i;
  34313. var tag = vnode.tag;
  34314. var data = vnode.data;
  34315. var children = vnode.children;
  34316. inVPre = inVPre || (data && data.pre);
  34317. vnode.elm = elm;
  34318. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  34319. vnode.isAsyncPlaceholder = true;
  34320. return true
  34321. }
  34322. // assert node match
  34323. {
  34324. if (!assertNodeMatch(elm, vnode, inVPre)) {
  34325. return false
  34326. }
  34327. }
  34328. if (isDef(data)) {
  34329. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  34330. if (isDef(i = vnode.componentInstance)) {
  34331. // child component. it should have hydrated its own tree.
  34332. initComponent(vnode, insertedVnodeQueue);
  34333. return true
  34334. }
  34335. }
  34336. if (isDef(tag)) {
  34337. if (isDef(children)) {
  34338. // empty element, allow client to pick up and populate children
  34339. if (!elm.hasChildNodes()) {
  34340. createChildren(vnode, children, insertedVnodeQueue);
  34341. } else {
  34342. // v-html and domProps: innerHTML
  34343. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  34344. if (i !== elm.innerHTML) {
  34345. /* istanbul ignore if */
  34346. if (typeof console !== 'undefined' &&
  34347. !hydrationBailed
  34348. ) {
  34349. hydrationBailed = true;
  34350. console.warn('Parent: ', elm);
  34351. console.warn('server innerHTML: ', i);
  34352. console.warn('client innerHTML: ', elm.innerHTML);
  34353. }
  34354. return false
  34355. }
  34356. } else {
  34357. // iterate and compare children lists
  34358. var childrenMatch = true;
  34359. var childNode = elm.firstChild;
  34360. for (var i$1 = 0; i$1 < children.length; i$1++) {
  34361. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  34362. childrenMatch = false;
  34363. break
  34364. }
  34365. childNode = childNode.nextSibling;
  34366. }
  34367. // if childNode is not null, it means the actual childNodes list is
  34368. // longer than the virtual children list.
  34369. if (!childrenMatch || childNode) {
  34370. /* istanbul ignore if */
  34371. if (typeof console !== 'undefined' &&
  34372. !hydrationBailed
  34373. ) {
  34374. hydrationBailed = true;
  34375. console.warn('Parent: ', elm);
  34376. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  34377. }
  34378. return false
  34379. }
  34380. }
  34381. }
  34382. }
  34383. if (isDef(data)) {
  34384. var fullInvoke = false;
  34385. for (var key in data) {
  34386. if (!isRenderedModule(key)) {
  34387. fullInvoke = true;
  34388. invokeCreateHooks(vnode, insertedVnodeQueue);
  34389. break
  34390. }
  34391. }
  34392. if (!fullInvoke && data['class']) {
  34393. // ensure collecting deps for deep class bindings for future updates
  34394. traverse(data['class']);
  34395. }
  34396. }
  34397. } else if (elm.data !== vnode.text) {
  34398. elm.data = vnode.text;
  34399. }
  34400. return true
  34401. }
  34402. function assertNodeMatch (node, vnode, inVPre) {
  34403. if (isDef(vnode.tag)) {
  34404. return vnode.tag.indexOf('vue-component') === 0 || (
  34405. !isUnknownElement$$1(vnode, inVPre) &&
  34406. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  34407. )
  34408. } else {
  34409. return node.nodeType === (vnode.isComment ? 8 : 3)
  34410. }
  34411. }
  34412. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  34413. if (isUndef(vnode)) {
  34414. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  34415. return
  34416. }
  34417. var isInitialPatch = false;
  34418. var insertedVnodeQueue = [];
  34419. if (isUndef(oldVnode)) {
  34420. // empty mount (likely as component), create new root element
  34421. isInitialPatch = true;
  34422. createElm(vnode, insertedVnodeQueue);
  34423. } else {
  34424. var isRealElement = isDef(oldVnode.nodeType);
  34425. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  34426. // patch existing root node
  34427. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  34428. } else {
  34429. if (isRealElement) {
  34430. // mounting to a real element
  34431. // check if this is server-rendered content and if we can perform
  34432. // a successful hydration.
  34433. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  34434. oldVnode.removeAttribute(SSR_ATTR);
  34435. hydrating = true;
  34436. }
  34437. if (isTrue(hydrating)) {
  34438. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  34439. invokeInsertHook(vnode, insertedVnodeQueue, true);
  34440. return oldVnode
  34441. } else {
  34442. warn(
  34443. 'The client-side rendered virtual DOM tree is not matching ' +
  34444. 'server-rendered content. This is likely caused by incorrect ' +
  34445. 'HTML markup, for example nesting block-level elements inside ' +
  34446. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  34447. 'full client-side render.'
  34448. );
  34449. }
  34450. }
  34451. // either not server-rendered, or hydration failed.
  34452. // create an empty node and replace it
  34453. oldVnode = emptyNodeAt(oldVnode);
  34454. }
  34455. // replacing existing element
  34456. var oldElm = oldVnode.elm;
  34457. var parentElm = nodeOps.parentNode(oldElm);
  34458. // create new node
  34459. createElm(
  34460. vnode,
  34461. insertedVnodeQueue,
  34462. // extremely rare edge case: do not insert if old element is in a
  34463. // leaving transition. Only happens when combining transition +
  34464. // keep-alive + HOCs. (#4590)
  34465. oldElm._leaveCb ? null : parentElm,
  34466. nodeOps.nextSibling(oldElm)
  34467. );
  34468. // update parent placeholder node element, recursively
  34469. if (isDef(vnode.parent)) {
  34470. var ancestor = vnode.parent;
  34471. var patchable = isPatchable(vnode);
  34472. while (ancestor) {
  34473. for (var i = 0; i < cbs.destroy.length; ++i) {
  34474. cbs.destroy[i](ancestor);
  34475. }
  34476. ancestor.elm = vnode.elm;
  34477. if (patchable) {
  34478. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  34479. cbs.create[i$1](emptyNode, ancestor);
  34480. }
  34481. // #6513
  34482. // invoke insert hooks that may have been merged by create hooks.
  34483. // e.g. for directives that uses the "inserted" hook.
  34484. var insert = ancestor.data.hook.insert;
  34485. if (insert.merged) {
  34486. // start at index 1 to avoid re-invoking component mounted hook
  34487. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  34488. insert.fns[i$2]();
  34489. }
  34490. }
  34491. } else {
  34492. registerRef(ancestor);
  34493. }
  34494. ancestor = ancestor.parent;
  34495. }
  34496. }
  34497. // destroy old node
  34498. if (isDef(parentElm)) {
  34499. removeVnodes([oldVnode], 0, 0);
  34500. } else if (isDef(oldVnode.tag)) {
  34501. invokeDestroyHook(oldVnode);
  34502. }
  34503. }
  34504. }
  34505. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  34506. return vnode.elm
  34507. }
  34508. }
  34509. /* */
  34510. var directives = {
  34511. create: updateDirectives,
  34512. update: updateDirectives,
  34513. destroy: function unbindDirectives (vnode) {
  34514. updateDirectives(vnode, emptyNode);
  34515. }
  34516. };
  34517. function updateDirectives (oldVnode, vnode) {
  34518. if (oldVnode.data.directives || vnode.data.directives) {
  34519. _update(oldVnode, vnode);
  34520. }
  34521. }
  34522. function _update (oldVnode, vnode) {
  34523. var isCreate = oldVnode === emptyNode;
  34524. var isDestroy = vnode === emptyNode;
  34525. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  34526. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  34527. var dirsWithInsert = [];
  34528. var dirsWithPostpatch = [];
  34529. var key, oldDir, dir;
  34530. for (key in newDirs) {
  34531. oldDir = oldDirs[key];
  34532. dir = newDirs[key];
  34533. if (!oldDir) {
  34534. // new directive, bind
  34535. callHook$1(dir, 'bind', vnode, oldVnode);
  34536. if (dir.def && dir.def.inserted) {
  34537. dirsWithInsert.push(dir);
  34538. }
  34539. } else {
  34540. // existing directive, update
  34541. dir.oldValue = oldDir.value;
  34542. dir.oldArg = oldDir.arg;
  34543. callHook$1(dir, 'update', vnode, oldVnode);
  34544. if (dir.def && dir.def.componentUpdated) {
  34545. dirsWithPostpatch.push(dir);
  34546. }
  34547. }
  34548. }
  34549. if (dirsWithInsert.length) {
  34550. var callInsert = function () {
  34551. for (var i = 0; i < dirsWithInsert.length; i++) {
  34552. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  34553. }
  34554. };
  34555. if (isCreate) {
  34556. mergeVNodeHook(vnode, 'insert', callInsert);
  34557. } else {
  34558. callInsert();
  34559. }
  34560. }
  34561. if (dirsWithPostpatch.length) {
  34562. mergeVNodeHook(vnode, 'postpatch', function () {
  34563. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  34564. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  34565. }
  34566. });
  34567. }
  34568. if (!isCreate) {
  34569. for (key in oldDirs) {
  34570. if (!newDirs[key]) {
  34571. // no longer present, unbind
  34572. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  34573. }
  34574. }
  34575. }
  34576. }
  34577. var emptyModifiers = Object.create(null);
  34578. function normalizeDirectives$1 (
  34579. dirs,
  34580. vm
  34581. ) {
  34582. var res = Object.create(null);
  34583. if (!dirs) {
  34584. // $flow-disable-line
  34585. return res
  34586. }
  34587. var i, dir;
  34588. for (i = 0; i < dirs.length; i++) {
  34589. dir = dirs[i];
  34590. if (!dir.modifiers) {
  34591. // $flow-disable-line
  34592. dir.modifiers = emptyModifiers;
  34593. }
  34594. res[getRawDirName(dir)] = dir;
  34595. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  34596. }
  34597. // $flow-disable-line
  34598. return res
  34599. }
  34600. function getRawDirName (dir) {
  34601. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  34602. }
  34603. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  34604. var fn = dir.def && dir.def[hook];
  34605. if (fn) {
  34606. try {
  34607. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  34608. } catch (e) {
  34609. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  34610. }
  34611. }
  34612. }
  34613. var baseModules = [
  34614. ref,
  34615. directives
  34616. ];
  34617. /* */
  34618. function updateAttrs (oldVnode, vnode) {
  34619. var opts = vnode.componentOptions;
  34620. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  34621. return
  34622. }
  34623. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  34624. return
  34625. }
  34626. var key, cur, old;
  34627. var elm = vnode.elm;
  34628. var oldAttrs = oldVnode.data.attrs || {};
  34629. var attrs = vnode.data.attrs || {};
  34630. // clone observed objects, as the user probably wants to mutate it
  34631. if (isDef(attrs.__ob__)) {
  34632. attrs = vnode.data.attrs = extend({}, attrs);
  34633. }
  34634. for (key in attrs) {
  34635. cur = attrs[key];
  34636. old = oldAttrs[key];
  34637. if (old !== cur) {
  34638. setAttr(elm, key, cur);
  34639. }
  34640. }
  34641. // #4391: in IE9, setting type can reset value for input[type=radio]
  34642. // #6666: IE/Edge forces progress value down to 1 before setting a max
  34643. /* istanbul ignore if */
  34644. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  34645. setAttr(elm, 'value', attrs.value);
  34646. }
  34647. for (key in oldAttrs) {
  34648. if (isUndef(attrs[key])) {
  34649. if (isXlink(key)) {
  34650. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  34651. } else if (!isEnumeratedAttr(key)) {
  34652. elm.removeAttribute(key);
  34653. }
  34654. }
  34655. }
  34656. }
  34657. function setAttr (el, key, value) {
  34658. if (el.tagName.indexOf('-') > -1) {
  34659. baseSetAttr(el, key, value);
  34660. } else if (isBooleanAttr(key)) {
  34661. // set attribute for blank value
  34662. // e.g. <option disabled>Select one</option>
  34663. if (isFalsyAttrValue(value)) {
  34664. el.removeAttribute(key);
  34665. } else {
  34666. // technically allowfullscreen is a boolean attribute for <iframe>,
  34667. // but Flash expects a value of "true" when used on <embed> tag
  34668. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  34669. ? 'true'
  34670. : key;
  34671. el.setAttribute(key, value);
  34672. }
  34673. } else if (isEnumeratedAttr(key)) {
  34674. el.setAttribute(key, convertEnumeratedValue(key, value));
  34675. } else if (isXlink(key)) {
  34676. if (isFalsyAttrValue(value)) {
  34677. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  34678. } else {
  34679. el.setAttributeNS(xlinkNS, key, value);
  34680. }
  34681. } else {
  34682. baseSetAttr(el, key, value);
  34683. }
  34684. }
  34685. function baseSetAttr (el, key, value) {
  34686. if (isFalsyAttrValue(value)) {
  34687. el.removeAttribute(key);
  34688. } else {
  34689. // #7138: IE10 & 11 fires input event when setting placeholder on
  34690. // <textarea>... block the first input event and remove the blocker
  34691. // immediately.
  34692. /* istanbul ignore if */
  34693. if (
  34694. isIE && !isIE9 &&
  34695. el.tagName === 'TEXTAREA' &&
  34696. key === 'placeholder' && value !== '' && !el.__ieph
  34697. ) {
  34698. var blocker = function (e) {
  34699. e.stopImmediatePropagation();
  34700. el.removeEventListener('input', blocker);
  34701. };
  34702. el.addEventListener('input', blocker);
  34703. // $flow-disable-line
  34704. el.__ieph = true; /* IE placeholder patched */
  34705. }
  34706. el.setAttribute(key, value);
  34707. }
  34708. }
  34709. var attrs = {
  34710. create: updateAttrs,
  34711. update: updateAttrs
  34712. };
  34713. /* */
  34714. function updateClass (oldVnode, vnode) {
  34715. var el = vnode.elm;
  34716. var data = vnode.data;
  34717. var oldData = oldVnode.data;
  34718. if (
  34719. isUndef(data.staticClass) &&
  34720. isUndef(data.class) && (
  34721. isUndef(oldData) || (
  34722. isUndef(oldData.staticClass) &&
  34723. isUndef(oldData.class)
  34724. )
  34725. )
  34726. ) {
  34727. return
  34728. }
  34729. var cls = genClassForVnode(vnode);
  34730. // handle transition classes
  34731. var transitionClass = el._transitionClasses;
  34732. if (isDef(transitionClass)) {
  34733. cls = concat(cls, stringifyClass(transitionClass));
  34734. }
  34735. // set the class
  34736. if (cls !== el._prevClass) {
  34737. el.setAttribute('class', cls);
  34738. el._prevClass = cls;
  34739. }
  34740. }
  34741. var klass = {
  34742. create: updateClass,
  34743. update: updateClass
  34744. };
  34745. /* */
  34746. var validDivisionCharRE = /[\w).+\-_$\]]/;
  34747. function parseFilters (exp) {
  34748. var inSingle = false;
  34749. var inDouble = false;
  34750. var inTemplateString = false;
  34751. var inRegex = false;
  34752. var curly = 0;
  34753. var square = 0;
  34754. var paren = 0;
  34755. var lastFilterIndex = 0;
  34756. var c, prev, i, expression, filters;
  34757. for (i = 0; i < exp.length; i++) {
  34758. prev = c;
  34759. c = exp.charCodeAt(i);
  34760. if (inSingle) {
  34761. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  34762. } else if (inDouble) {
  34763. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  34764. } else if (inTemplateString) {
  34765. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  34766. } else if (inRegex) {
  34767. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  34768. } else if (
  34769. c === 0x7C && // pipe
  34770. exp.charCodeAt(i + 1) !== 0x7C &&
  34771. exp.charCodeAt(i - 1) !== 0x7C &&
  34772. !curly && !square && !paren
  34773. ) {
  34774. if (expression === undefined) {
  34775. // first filter, end of expression
  34776. lastFilterIndex = i + 1;
  34777. expression = exp.slice(0, i).trim();
  34778. } else {
  34779. pushFilter();
  34780. }
  34781. } else {
  34782. switch (c) {
  34783. case 0x22: inDouble = true; break // "
  34784. case 0x27: inSingle = true; break // '
  34785. case 0x60: inTemplateString = true; break // `
  34786. case 0x28: paren++; break // (
  34787. case 0x29: paren--; break // )
  34788. case 0x5B: square++; break // [
  34789. case 0x5D: square--; break // ]
  34790. case 0x7B: curly++; break // {
  34791. case 0x7D: curly--; break // }
  34792. }
  34793. if (c === 0x2f) { // /
  34794. var j = i - 1;
  34795. var p = (void 0);
  34796. // find first non-whitespace prev char
  34797. for (; j >= 0; j--) {
  34798. p = exp.charAt(j);
  34799. if (p !== ' ') { break }
  34800. }
  34801. if (!p || !validDivisionCharRE.test(p)) {
  34802. inRegex = true;
  34803. }
  34804. }
  34805. }
  34806. }
  34807. if (expression === undefined) {
  34808. expression = exp.slice(0, i).trim();
  34809. } else if (lastFilterIndex !== 0) {
  34810. pushFilter();
  34811. }
  34812. function pushFilter () {
  34813. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  34814. lastFilterIndex = i + 1;
  34815. }
  34816. if (filters) {
  34817. for (i = 0; i < filters.length; i++) {
  34818. expression = wrapFilter(expression, filters[i]);
  34819. }
  34820. }
  34821. return expression
  34822. }
  34823. function wrapFilter (exp, filter) {
  34824. var i = filter.indexOf('(');
  34825. if (i < 0) {
  34826. // _f: resolveFilter
  34827. return ("_f(\"" + filter + "\")(" + exp + ")")
  34828. } else {
  34829. var name = filter.slice(0, i);
  34830. var args = filter.slice(i + 1);
  34831. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  34832. }
  34833. }
  34834. /* */
  34835. /* eslint-disable no-unused-vars */
  34836. function baseWarn (msg, range) {
  34837. console.error(("[Vue compiler]: " + msg));
  34838. }
  34839. /* eslint-enable no-unused-vars */
  34840. function pluckModuleFunction (
  34841. modules,
  34842. key
  34843. ) {
  34844. return modules
  34845. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  34846. : []
  34847. }
  34848. function addProp (el, name, value, range, dynamic) {
  34849. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  34850. el.plain = false;
  34851. }
  34852. function addAttr (el, name, value, range, dynamic) {
  34853. var attrs = dynamic
  34854. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  34855. : (el.attrs || (el.attrs = []));
  34856. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  34857. el.plain = false;
  34858. }
  34859. // add a raw attr (use this in preTransforms)
  34860. function addRawAttr (el, name, value, range) {
  34861. el.attrsMap[name] = value;
  34862. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  34863. }
  34864. function addDirective (
  34865. el,
  34866. name,
  34867. rawName,
  34868. value,
  34869. arg,
  34870. isDynamicArg,
  34871. modifiers,
  34872. range
  34873. ) {
  34874. (el.directives || (el.directives = [])).push(rangeSetItem({
  34875. name: name,
  34876. rawName: rawName,
  34877. value: value,
  34878. arg: arg,
  34879. isDynamicArg: isDynamicArg,
  34880. modifiers: modifiers
  34881. }, range));
  34882. el.plain = false;
  34883. }
  34884. function prependModifierMarker (symbol, name, dynamic) {
  34885. return dynamic
  34886. ? ("_p(" + name + ",\"" + symbol + "\")")
  34887. : symbol + name // mark the event as captured
  34888. }
  34889. function addHandler (
  34890. el,
  34891. name,
  34892. value,
  34893. modifiers,
  34894. important,
  34895. warn,
  34896. range,
  34897. dynamic
  34898. ) {
  34899. modifiers = modifiers || emptyObject;
  34900. // warn prevent and passive modifier
  34901. /* istanbul ignore if */
  34902. if (
  34903. warn &&
  34904. modifiers.prevent && modifiers.passive
  34905. ) {
  34906. warn(
  34907. 'passive and prevent can\'t be used together. ' +
  34908. 'Passive handler can\'t prevent default event.',
  34909. range
  34910. );
  34911. }
  34912. // normalize click.right and click.middle since they don't actually fire
  34913. // this is technically browser-specific, but at least for now browsers are
  34914. // the only target envs that have right/middle clicks.
  34915. if (modifiers.right) {
  34916. if (dynamic) {
  34917. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  34918. } else if (name === 'click') {
  34919. name = 'contextmenu';
  34920. delete modifiers.right;
  34921. }
  34922. } else if (modifiers.middle) {
  34923. if (dynamic) {
  34924. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  34925. } else if (name === 'click') {
  34926. name = 'mouseup';
  34927. }
  34928. }
  34929. // check capture modifier
  34930. if (modifiers.capture) {
  34931. delete modifiers.capture;
  34932. name = prependModifierMarker('!', name, dynamic);
  34933. }
  34934. if (modifiers.once) {
  34935. delete modifiers.once;
  34936. name = prependModifierMarker('~', name, dynamic);
  34937. }
  34938. /* istanbul ignore if */
  34939. if (modifiers.passive) {
  34940. delete modifiers.passive;
  34941. name = prependModifierMarker('&', name, dynamic);
  34942. }
  34943. var events;
  34944. if (modifiers.native) {
  34945. delete modifiers.native;
  34946. events = el.nativeEvents || (el.nativeEvents = {});
  34947. } else {
  34948. events = el.events || (el.events = {});
  34949. }
  34950. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  34951. if (modifiers !== emptyObject) {
  34952. newHandler.modifiers = modifiers;
  34953. }
  34954. var handlers = events[name];
  34955. /* istanbul ignore if */
  34956. if (Array.isArray(handlers)) {
  34957. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  34958. } else if (handlers) {
  34959. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  34960. } else {
  34961. events[name] = newHandler;
  34962. }
  34963. el.plain = false;
  34964. }
  34965. function getRawBindingAttr (
  34966. el,
  34967. name
  34968. ) {
  34969. return el.rawAttrsMap[':' + name] ||
  34970. el.rawAttrsMap['v-bind:' + name] ||
  34971. el.rawAttrsMap[name]
  34972. }
  34973. function getBindingAttr (
  34974. el,
  34975. name,
  34976. getStatic
  34977. ) {
  34978. var dynamicValue =
  34979. getAndRemoveAttr(el, ':' + name) ||
  34980. getAndRemoveAttr(el, 'v-bind:' + name);
  34981. if (dynamicValue != null) {
  34982. return parseFilters(dynamicValue)
  34983. } else if (getStatic !== false) {
  34984. var staticValue = getAndRemoveAttr(el, name);
  34985. if (staticValue != null) {
  34986. return JSON.stringify(staticValue)
  34987. }
  34988. }
  34989. }
  34990. // note: this only removes the attr from the Array (attrsList) so that it
  34991. // doesn't get processed by processAttrs.
  34992. // By default it does NOT remove it from the map (attrsMap) because the map is
  34993. // needed during codegen.
  34994. function getAndRemoveAttr (
  34995. el,
  34996. name,
  34997. removeFromMap
  34998. ) {
  34999. var val;
  35000. if ((val = el.attrsMap[name]) != null) {
  35001. var list = el.attrsList;
  35002. for (var i = 0, l = list.length; i < l; i++) {
  35003. if (list[i].name === name) {
  35004. list.splice(i, 1);
  35005. break
  35006. }
  35007. }
  35008. }
  35009. if (removeFromMap) {
  35010. delete el.attrsMap[name];
  35011. }
  35012. return val
  35013. }
  35014. function getAndRemoveAttrByRegex (
  35015. el,
  35016. name
  35017. ) {
  35018. var list = el.attrsList;
  35019. for (var i = 0, l = list.length; i < l; i++) {
  35020. var attr = list[i];
  35021. if (name.test(attr.name)) {
  35022. list.splice(i, 1);
  35023. return attr
  35024. }
  35025. }
  35026. }
  35027. function rangeSetItem (
  35028. item,
  35029. range
  35030. ) {
  35031. if (range) {
  35032. if (range.start != null) {
  35033. item.start = range.start;
  35034. }
  35035. if (range.end != null) {
  35036. item.end = range.end;
  35037. }
  35038. }
  35039. return item
  35040. }
  35041. /* */
  35042. /**
  35043. * Cross-platform code generation for component v-model
  35044. */
  35045. function genComponentModel (
  35046. el,
  35047. value,
  35048. modifiers
  35049. ) {
  35050. var ref = modifiers || {};
  35051. var number = ref.number;
  35052. var trim = ref.trim;
  35053. var baseValueExpression = '$$v';
  35054. var valueExpression = baseValueExpression;
  35055. if (trim) {
  35056. valueExpression =
  35057. "(typeof " + baseValueExpression + " === 'string'" +
  35058. "? " + baseValueExpression + ".trim()" +
  35059. ": " + baseValueExpression + ")";
  35060. }
  35061. if (number) {
  35062. valueExpression = "_n(" + valueExpression + ")";
  35063. }
  35064. var assignment = genAssignmentCode(value, valueExpression);
  35065. el.model = {
  35066. value: ("(" + value + ")"),
  35067. expression: JSON.stringify(value),
  35068. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  35069. };
  35070. }
  35071. /**
  35072. * Cross-platform codegen helper for generating v-model value assignment code.
  35073. */
  35074. function genAssignmentCode (
  35075. value,
  35076. assignment
  35077. ) {
  35078. var res = parseModel(value);
  35079. if (res.key === null) {
  35080. return (value + "=" + assignment)
  35081. } else {
  35082. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  35083. }
  35084. }
  35085. /**
  35086. * Parse a v-model expression into a base path and a final key segment.
  35087. * Handles both dot-path and possible square brackets.
  35088. *
  35089. * Possible cases:
  35090. *
  35091. * - test
  35092. * - test[key]
  35093. * - test[test1[key]]
  35094. * - test["a"][key]
  35095. * - xxx.test[a[a].test1[key]]
  35096. * - test.xxx.a["asa"][test1[key]]
  35097. *
  35098. */
  35099. var len, str, chr, index$1, expressionPos, expressionEndPos;
  35100. function parseModel (val) {
  35101. // Fix https://github.com/vuejs/vue/pull/7730
  35102. // allow v-model="obj.val " (trailing whitespace)
  35103. val = val.trim();
  35104. len = val.length;
  35105. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  35106. index$1 = val.lastIndexOf('.');
  35107. if (index$1 > -1) {
  35108. return {
  35109. exp: val.slice(0, index$1),
  35110. key: '"' + val.slice(index$1 + 1) + '"'
  35111. }
  35112. } else {
  35113. return {
  35114. exp: val,
  35115. key: null
  35116. }
  35117. }
  35118. }
  35119. str = val;
  35120. index$1 = expressionPos = expressionEndPos = 0;
  35121. while (!eof()) {
  35122. chr = next();
  35123. /* istanbul ignore if */
  35124. if (isStringStart(chr)) {
  35125. parseString(chr);
  35126. } else if (chr === 0x5B) {
  35127. parseBracket(chr);
  35128. }
  35129. }
  35130. return {
  35131. exp: val.slice(0, expressionPos),
  35132. key: val.slice(expressionPos + 1, expressionEndPos)
  35133. }
  35134. }
  35135. function next () {
  35136. return str.charCodeAt(++index$1)
  35137. }
  35138. function eof () {
  35139. return index$1 >= len
  35140. }
  35141. function isStringStart (chr) {
  35142. return chr === 0x22 || chr === 0x27
  35143. }
  35144. function parseBracket (chr) {
  35145. var inBracket = 1;
  35146. expressionPos = index$1;
  35147. while (!eof()) {
  35148. chr = next();
  35149. if (isStringStart(chr)) {
  35150. parseString(chr);
  35151. continue
  35152. }
  35153. if (chr === 0x5B) { inBracket++; }
  35154. if (chr === 0x5D) { inBracket--; }
  35155. if (inBracket === 0) {
  35156. expressionEndPos = index$1;
  35157. break
  35158. }
  35159. }
  35160. }
  35161. function parseString (chr) {
  35162. var stringQuote = chr;
  35163. while (!eof()) {
  35164. chr = next();
  35165. if (chr === stringQuote) {
  35166. break
  35167. }
  35168. }
  35169. }
  35170. /* */
  35171. var warn$1;
  35172. // in some cases, the event used has to be determined at runtime
  35173. // so we used some reserved tokens during compile.
  35174. var RANGE_TOKEN = '__r';
  35175. var CHECKBOX_RADIO_TOKEN = '__c';
  35176. function model (
  35177. el,
  35178. dir,
  35179. _warn
  35180. ) {
  35181. warn$1 = _warn;
  35182. var value = dir.value;
  35183. var modifiers = dir.modifiers;
  35184. var tag = el.tag;
  35185. var type = el.attrsMap.type;
  35186. {
  35187. // inputs with type="file" are read only and setting the input's
  35188. // value will throw an error.
  35189. if (tag === 'input' && type === 'file') {
  35190. warn$1(
  35191. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  35192. "File inputs are read only. Use a v-on:change listener instead.",
  35193. el.rawAttrsMap['v-model']
  35194. );
  35195. }
  35196. }
  35197. if (el.component) {
  35198. genComponentModel(el, value, modifiers);
  35199. // component v-model doesn't need extra runtime
  35200. return false
  35201. } else if (tag === 'select') {
  35202. genSelect(el, value, modifiers);
  35203. } else if (tag === 'input' && type === 'checkbox') {
  35204. genCheckboxModel(el, value, modifiers);
  35205. } else if (tag === 'input' && type === 'radio') {
  35206. genRadioModel(el, value, modifiers);
  35207. } else if (tag === 'input' || tag === 'textarea') {
  35208. genDefaultModel(el, value, modifiers);
  35209. } else if (!config.isReservedTag(tag)) {
  35210. genComponentModel(el, value, modifiers);
  35211. // component v-model doesn't need extra runtime
  35212. return false
  35213. } else {
  35214. warn$1(
  35215. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  35216. "v-model is not supported on this element type. " +
  35217. 'If you are working with contenteditable, it\'s recommended to ' +
  35218. 'wrap a library dedicated for that purpose inside a custom component.',
  35219. el.rawAttrsMap['v-model']
  35220. );
  35221. }
  35222. // ensure runtime directive metadata
  35223. return true
  35224. }
  35225. function genCheckboxModel (
  35226. el,
  35227. value,
  35228. modifiers
  35229. ) {
  35230. var number = modifiers && modifiers.number;
  35231. var valueBinding = getBindingAttr(el, 'value') || 'null';
  35232. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  35233. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  35234. addProp(el, 'checked',
  35235. "Array.isArray(" + value + ")" +
  35236. "?_i(" + value + "," + valueBinding + ")>-1" + (
  35237. trueValueBinding === 'true'
  35238. ? (":(" + value + ")")
  35239. : (":_q(" + value + "," + trueValueBinding + ")")
  35240. )
  35241. );
  35242. addHandler(el, 'change',
  35243. "var $$a=" + value + "," +
  35244. '$$el=$event.target,' +
  35245. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  35246. 'if(Array.isArray($$a)){' +
  35247. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  35248. '$$i=_i($$a,$$v);' +
  35249. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  35250. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  35251. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  35252. null, true
  35253. );
  35254. }
  35255. function genRadioModel (
  35256. el,
  35257. value,
  35258. modifiers
  35259. ) {
  35260. var number = modifiers && modifiers.number;
  35261. var valueBinding = getBindingAttr(el, 'value') || 'null';
  35262. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  35263. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  35264. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  35265. }
  35266. function genSelect (
  35267. el,
  35268. value,
  35269. modifiers
  35270. ) {
  35271. var number = modifiers && modifiers.number;
  35272. var selectedVal = "Array.prototype.filter" +
  35273. ".call($event.target.options,function(o){return o.selected})" +
  35274. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  35275. "return " + (number ? '_n(val)' : 'val') + "})";
  35276. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  35277. var code = "var $$selectedVal = " + selectedVal + ";";
  35278. code = code + " " + (genAssignmentCode(value, assignment));
  35279. addHandler(el, 'change', code, null, true);
  35280. }
  35281. function genDefaultModel (
  35282. el,
  35283. value,
  35284. modifiers
  35285. ) {
  35286. var type = el.attrsMap.type;
  35287. // warn if v-bind:value conflicts with v-model
  35288. // except for inputs with v-bind:type
  35289. {
  35290. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  35291. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  35292. if (value$1 && !typeBinding) {
  35293. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  35294. warn$1(
  35295. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  35296. 'because the latter already expands to a value binding internally',
  35297. el.rawAttrsMap[binding]
  35298. );
  35299. }
  35300. }
  35301. var ref = modifiers || {};
  35302. var lazy = ref.lazy;
  35303. var number = ref.number;
  35304. var trim = ref.trim;
  35305. var needCompositionGuard = !lazy && type !== 'range';
  35306. var event = lazy
  35307. ? 'change'
  35308. : type === 'range'
  35309. ? RANGE_TOKEN
  35310. : 'input';
  35311. var valueExpression = '$event.target.value';
  35312. if (trim) {
  35313. valueExpression = "$event.target.value.trim()";
  35314. }
  35315. if (number) {
  35316. valueExpression = "_n(" + valueExpression + ")";
  35317. }
  35318. var code = genAssignmentCode(value, valueExpression);
  35319. if (needCompositionGuard) {
  35320. code = "if($event.target.composing)return;" + code;
  35321. }
  35322. addProp(el, 'value', ("(" + value + ")"));
  35323. addHandler(el, event, code, null, true);
  35324. if (trim || number) {
  35325. addHandler(el, 'blur', '$forceUpdate()');
  35326. }
  35327. }
  35328. /* */
  35329. // normalize v-model event tokens that can only be determined at runtime.
  35330. // it's important to place the event as the first in the array because
  35331. // the whole point is ensuring the v-model callback gets called before
  35332. // user-attached handlers.
  35333. function normalizeEvents (on) {
  35334. /* istanbul ignore if */
  35335. if (isDef(on[RANGE_TOKEN])) {
  35336. // IE input[type=range] only supports `change` event
  35337. var event = isIE ? 'change' : 'input';
  35338. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  35339. delete on[RANGE_TOKEN];
  35340. }
  35341. // This was originally intended to fix #4521 but no longer necessary
  35342. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  35343. /* istanbul ignore if */
  35344. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  35345. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  35346. delete on[CHECKBOX_RADIO_TOKEN];
  35347. }
  35348. }
  35349. var target$1;
  35350. function createOnceHandler$1 (event, handler, capture) {
  35351. var _target = target$1; // save current target element in closure
  35352. return function onceHandler () {
  35353. var res = handler.apply(null, arguments);
  35354. if (res !== null) {
  35355. remove$2(event, onceHandler, capture, _target);
  35356. }
  35357. }
  35358. }
  35359. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  35360. // implementation and does not fire microtasks in between event propagation, so
  35361. // safe to exclude.
  35362. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  35363. function add$1 (
  35364. name,
  35365. handler,
  35366. capture,
  35367. passive
  35368. ) {
  35369. // async edge case #6566: inner click event triggers patch, event handler
  35370. // attached to outer element during patch, and triggered again. This
  35371. // happens because browsers fire microtask ticks between event propagation.
  35372. // the solution is simple: we save the timestamp when a handler is attached,
  35373. // and the handler would only fire if the event passed to it was fired
  35374. // AFTER it was attached.
  35375. if (useMicrotaskFix) {
  35376. var attachedTimestamp = currentFlushTimestamp;
  35377. var original = handler;
  35378. handler = original._wrapper = function (e) {
  35379. if (
  35380. // no bubbling, should always fire.
  35381. // this is just a safety net in case event.timeStamp is unreliable in
  35382. // certain weird environments...
  35383. e.target === e.currentTarget ||
  35384. // event is fired after handler attachment
  35385. e.timeStamp >= attachedTimestamp ||
  35386. // bail for environments that have buggy event.timeStamp implementations
  35387. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  35388. // #9681 QtWebEngine event.timeStamp is negative value
  35389. e.timeStamp <= 0 ||
  35390. // #9448 bail if event is fired in another document in a multi-page
  35391. // electron/nw.js app, since event.timeStamp will be using a different
  35392. // starting reference
  35393. e.target.ownerDocument !== document
  35394. ) {
  35395. return original.apply(this, arguments)
  35396. }
  35397. };
  35398. }
  35399. target$1.addEventListener(
  35400. name,
  35401. handler,
  35402. supportsPassive
  35403. ? { capture: capture, passive: passive }
  35404. : capture
  35405. );
  35406. }
  35407. function remove$2 (
  35408. name,
  35409. handler,
  35410. capture,
  35411. _target
  35412. ) {
  35413. (_target || target$1).removeEventListener(
  35414. name,
  35415. handler._wrapper || handler,
  35416. capture
  35417. );
  35418. }
  35419. function updateDOMListeners (oldVnode, vnode) {
  35420. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  35421. return
  35422. }
  35423. var on = vnode.data.on || {};
  35424. var oldOn = oldVnode.data.on || {};
  35425. target$1 = vnode.elm;
  35426. normalizeEvents(on);
  35427. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  35428. target$1 = undefined;
  35429. }
  35430. var events = {
  35431. create: updateDOMListeners,
  35432. update: updateDOMListeners
  35433. };
  35434. /* */
  35435. var svgContainer;
  35436. function updateDOMProps (oldVnode, vnode) {
  35437. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  35438. return
  35439. }
  35440. var key, cur;
  35441. var elm = vnode.elm;
  35442. var oldProps = oldVnode.data.domProps || {};
  35443. var props = vnode.data.domProps || {};
  35444. // clone observed objects, as the user probably wants to mutate it
  35445. if (isDef(props.__ob__)) {
  35446. props = vnode.data.domProps = extend({}, props);
  35447. }
  35448. for (key in oldProps) {
  35449. if (!(key in props)) {
  35450. elm[key] = '';
  35451. }
  35452. }
  35453. for (key in props) {
  35454. cur = props[key];
  35455. // ignore children if the node has textContent or innerHTML,
  35456. // as these will throw away existing DOM nodes and cause removal errors
  35457. // on subsequent patches (#3360)
  35458. if (key === 'textContent' || key === 'innerHTML') {
  35459. if (vnode.children) { vnode.children.length = 0; }
  35460. if (cur === oldProps[key]) { continue }
  35461. // #6601 work around Chrome version <= 55 bug where single textNode
  35462. // replaced by innerHTML/textContent retains its parentNode property
  35463. if (elm.childNodes.length === 1) {
  35464. elm.removeChild(elm.childNodes[0]);
  35465. }
  35466. }
  35467. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  35468. // store value as _value as well since
  35469. // non-string values will be stringified
  35470. elm._value = cur;
  35471. // avoid resetting cursor position when value is the same
  35472. var strCur = isUndef(cur) ? '' : String(cur);
  35473. if (shouldUpdateValue(elm, strCur)) {
  35474. elm.value = strCur;
  35475. }
  35476. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  35477. // IE doesn't support innerHTML for SVG elements
  35478. svgContainer = svgContainer || document.createElement('div');
  35479. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  35480. var svg = svgContainer.firstChild;
  35481. while (elm.firstChild) {
  35482. elm.removeChild(elm.firstChild);
  35483. }
  35484. while (svg.firstChild) {
  35485. elm.appendChild(svg.firstChild);
  35486. }
  35487. } else if (
  35488. // skip the update if old and new VDOM state is the same.
  35489. // `value` is handled separately because the DOM value may be temporarily
  35490. // out of sync with VDOM state due to focus, composition and modifiers.
  35491. // This #4521 by skipping the unnecessary `checked` update.
  35492. cur !== oldProps[key]
  35493. ) {
  35494. // some property updates can throw
  35495. // e.g. `value` on <progress> w/ non-finite value
  35496. try {
  35497. elm[key] = cur;
  35498. } catch (e) {}
  35499. }
  35500. }
  35501. }
  35502. // check platforms/web/util/attrs.js acceptValue
  35503. function shouldUpdateValue (elm, checkVal) {
  35504. return (!elm.composing && (
  35505. elm.tagName === 'OPTION' ||
  35506. isNotInFocusAndDirty(elm, checkVal) ||
  35507. isDirtyWithModifiers(elm, checkVal)
  35508. ))
  35509. }
  35510. function isNotInFocusAndDirty (elm, checkVal) {
  35511. // return true when textbox (.number and .trim) loses focus and its value is
  35512. // not equal to the updated value
  35513. var notInFocus = true;
  35514. // #6157
  35515. // work around IE bug when accessing document.activeElement in an iframe
  35516. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  35517. return notInFocus && elm.value !== checkVal
  35518. }
  35519. function isDirtyWithModifiers (elm, newVal) {
  35520. var value = elm.value;
  35521. var modifiers = elm._vModifiers; // injected by v-model runtime
  35522. if (isDef(modifiers)) {
  35523. if (modifiers.number) {
  35524. return toNumber(value) !== toNumber(newVal)
  35525. }
  35526. if (modifiers.trim) {
  35527. return value.trim() !== newVal.trim()
  35528. }
  35529. }
  35530. return value !== newVal
  35531. }
  35532. var domProps = {
  35533. create: updateDOMProps,
  35534. update: updateDOMProps
  35535. };
  35536. /* */
  35537. var parseStyleText = cached(function (cssText) {
  35538. var res = {};
  35539. var listDelimiter = /;(?![^(]*\))/g;
  35540. var propertyDelimiter = /:(.+)/;
  35541. cssText.split(listDelimiter).forEach(function (item) {
  35542. if (item) {
  35543. var tmp = item.split(propertyDelimiter);
  35544. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  35545. }
  35546. });
  35547. return res
  35548. });
  35549. // merge static and dynamic style data on the same vnode
  35550. function normalizeStyleData (data) {
  35551. var style = normalizeStyleBinding(data.style);
  35552. // static style is pre-processed into an object during compilation
  35553. // and is always a fresh object, so it's safe to merge into it
  35554. return data.staticStyle
  35555. ? extend(data.staticStyle, style)
  35556. : style
  35557. }
  35558. // normalize possible array / string values into Object
  35559. function normalizeStyleBinding (bindingStyle) {
  35560. if (Array.isArray(bindingStyle)) {
  35561. return toObject(bindingStyle)
  35562. }
  35563. if (typeof bindingStyle === 'string') {
  35564. return parseStyleText(bindingStyle)
  35565. }
  35566. return bindingStyle
  35567. }
  35568. /**
  35569. * parent component style should be after child's
  35570. * so that parent component's style could override it
  35571. */
  35572. function getStyle (vnode, checkChild) {
  35573. var res = {};
  35574. var styleData;
  35575. if (checkChild) {
  35576. var childNode = vnode;
  35577. while (childNode.componentInstance) {
  35578. childNode = childNode.componentInstance._vnode;
  35579. if (
  35580. childNode && childNode.data &&
  35581. (styleData = normalizeStyleData(childNode.data))
  35582. ) {
  35583. extend(res, styleData);
  35584. }
  35585. }
  35586. }
  35587. if ((styleData = normalizeStyleData(vnode.data))) {
  35588. extend(res, styleData);
  35589. }
  35590. var parentNode = vnode;
  35591. while ((parentNode = parentNode.parent)) {
  35592. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  35593. extend(res, styleData);
  35594. }
  35595. }
  35596. return res
  35597. }
  35598. /* */
  35599. var cssVarRE = /^--/;
  35600. var importantRE = /\s*!important$/;
  35601. var setProp = function (el, name, val) {
  35602. /* istanbul ignore if */
  35603. if (cssVarRE.test(name)) {
  35604. el.style.setProperty(name, val);
  35605. } else if (importantRE.test(val)) {
  35606. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  35607. } else {
  35608. var normalizedName = normalize(name);
  35609. if (Array.isArray(val)) {
  35610. // Support values array created by autoprefixer, e.g.
  35611. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  35612. // Set them one by one, and the browser will only set those it can recognize
  35613. for (var i = 0, len = val.length; i < len; i++) {
  35614. el.style[normalizedName] = val[i];
  35615. }
  35616. } else {
  35617. el.style[normalizedName] = val;
  35618. }
  35619. }
  35620. };
  35621. var vendorNames = ['Webkit', 'Moz', 'ms'];
  35622. var emptyStyle;
  35623. var normalize = cached(function (prop) {
  35624. emptyStyle = emptyStyle || document.createElement('div').style;
  35625. prop = camelize(prop);
  35626. if (prop !== 'filter' && (prop in emptyStyle)) {
  35627. return prop
  35628. }
  35629. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  35630. for (var i = 0; i < vendorNames.length; i++) {
  35631. var name = vendorNames[i] + capName;
  35632. if (name in emptyStyle) {
  35633. return name
  35634. }
  35635. }
  35636. });
  35637. function updateStyle (oldVnode, vnode) {
  35638. var data = vnode.data;
  35639. var oldData = oldVnode.data;
  35640. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  35641. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  35642. ) {
  35643. return
  35644. }
  35645. var cur, name;
  35646. var el = vnode.elm;
  35647. var oldStaticStyle = oldData.staticStyle;
  35648. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  35649. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  35650. var oldStyle = oldStaticStyle || oldStyleBinding;
  35651. var style = normalizeStyleBinding(vnode.data.style) || {};
  35652. // store normalized style under a different key for next diff
  35653. // make sure to clone it if it's reactive, since the user likely wants
  35654. // to mutate it.
  35655. vnode.data.normalizedStyle = isDef(style.__ob__)
  35656. ? extend({}, style)
  35657. : style;
  35658. var newStyle = getStyle(vnode, true);
  35659. for (name in oldStyle) {
  35660. if (isUndef(newStyle[name])) {
  35661. setProp(el, name, '');
  35662. }
  35663. }
  35664. for (name in newStyle) {
  35665. cur = newStyle[name];
  35666. if (cur !== oldStyle[name]) {
  35667. // ie9 setting to null has no effect, must use empty string
  35668. setProp(el, name, cur == null ? '' : cur);
  35669. }
  35670. }
  35671. }
  35672. var style = {
  35673. create: updateStyle,
  35674. update: updateStyle
  35675. };
  35676. /* */
  35677. var whitespaceRE = /\s+/;
  35678. /**
  35679. * Add class with compatibility for SVG since classList is not supported on
  35680. * SVG elements in IE
  35681. */
  35682. function addClass (el, cls) {
  35683. /* istanbul ignore if */
  35684. if (!cls || !(cls = cls.trim())) {
  35685. return
  35686. }
  35687. /* istanbul ignore else */
  35688. if (el.classList) {
  35689. if (cls.indexOf(' ') > -1) {
  35690. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  35691. } else {
  35692. el.classList.add(cls);
  35693. }
  35694. } else {
  35695. var cur = " " + (el.getAttribute('class') || '') + " ";
  35696. if (cur.indexOf(' ' + cls + ' ') < 0) {
  35697. el.setAttribute('class', (cur + cls).trim());
  35698. }
  35699. }
  35700. }
  35701. /**
  35702. * Remove class with compatibility for SVG since classList is not supported on
  35703. * SVG elements in IE
  35704. */
  35705. function removeClass (el, cls) {
  35706. /* istanbul ignore if */
  35707. if (!cls || !(cls = cls.trim())) {
  35708. return
  35709. }
  35710. /* istanbul ignore else */
  35711. if (el.classList) {
  35712. if (cls.indexOf(' ') > -1) {
  35713. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  35714. } else {
  35715. el.classList.remove(cls);
  35716. }
  35717. if (!el.classList.length) {
  35718. el.removeAttribute('class');
  35719. }
  35720. } else {
  35721. var cur = " " + (el.getAttribute('class') || '') + " ";
  35722. var tar = ' ' + cls + ' ';
  35723. while (cur.indexOf(tar) >= 0) {
  35724. cur = cur.replace(tar, ' ');
  35725. }
  35726. cur = cur.trim();
  35727. if (cur) {
  35728. el.setAttribute('class', cur);
  35729. } else {
  35730. el.removeAttribute('class');
  35731. }
  35732. }
  35733. }
  35734. /* */
  35735. function resolveTransition (def$$1) {
  35736. if (!def$$1) {
  35737. return
  35738. }
  35739. /* istanbul ignore else */
  35740. if (typeof def$$1 === 'object') {
  35741. var res = {};
  35742. if (def$$1.css !== false) {
  35743. extend(res, autoCssTransition(def$$1.name || 'v'));
  35744. }
  35745. extend(res, def$$1);
  35746. return res
  35747. } else if (typeof def$$1 === 'string') {
  35748. return autoCssTransition(def$$1)
  35749. }
  35750. }
  35751. var autoCssTransition = cached(function (name) {
  35752. return {
  35753. enterClass: (name + "-enter"),
  35754. enterToClass: (name + "-enter-to"),
  35755. enterActiveClass: (name + "-enter-active"),
  35756. leaveClass: (name + "-leave"),
  35757. leaveToClass: (name + "-leave-to"),
  35758. leaveActiveClass: (name + "-leave-active")
  35759. }
  35760. });
  35761. var hasTransition = inBrowser && !isIE9;
  35762. var TRANSITION = 'transition';
  35763. var ANIMATION = 'animation';
  35764. // Transition property/event sniffing
  35765. var transitionProp = 'transition';
  35766. var transitionEndEvent = 'transitionend';
  35767. var animationProp = 'animation';
  35768. var animationEndEvent = 'animationend';
  35769. if (hasTransition) {
  35770. /* istanbul ignore if */
  35771. if (window.ontransitionend === undefined &&
  35772. window.onwebkittransitionend !== undefined
  35773. ) {
  35774. transitionProp = 'WebkitTransition';
  35775. transitionEndEvent = 'webkitTransitionEnd';
  35776. }
  35777. if (window.onanimationend === undefined &&
  35778. window.onwebkitanimationend !== undefined
  35779. ) {
  35780. animationProp = 'WebkitAnimation';
  35781. animationEndEvent = 'webkitAnimationEnd';
  35782. }
  35783. }
  35784. // binding to window is necessary to make hot reload work in IE in strict mode
  35785. var raf = inBrowser
  35786. ? window.requestAnimationFrame
  35787. ? window.requestAnimationFrame.bind(window)
  35788. : setTimeout
  35789. : /* istanbul ignore next */ function (fn) { return fn(); };
  35790. function nextFrame (fn) {
  35791. raf(function () {
  35792. raf(fn);
  35793. });
  35794. }
  35795. function addTransitionClass (el, cls) {
  35796. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  35797. if (transitionClasses.indexOf(cls) < 0) {
  35798. transitionClasses.push(cls);
  35799. addClass(el, cls);
  35800. }
  35801. }
  35802. function removeTransitionClass (el, cls) {
  35803. if (el._transitionClasses) {
  35804. remove(el._transitionClasses, cls);
  35805. }
  35806. removeClass(el, cls);
  35807. }
  35808. function whenTransitionEnds (
  35809. el,
  35810. expectedType,
  35811. cb
  35812. ) {
  35813. var ref = getTransitionInfo(el, expectedType);
  35814. var type = ref.type;
  35815. var timeout = ref.timeout;
  35816. var propCount = ref.propCount;
  35817. if (!type) { return cb() }
  35818. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  35819. var ended = 0;
  35820. var end = function () {
  35821. el.removeEventListener(event, onEnd);
  35822. cb();
  35823. };
  35824. var onEnd = function (e) {
  35825. if (e.target === el) {
  35826. if (++ended >= propCount) {
  35827. end();
  35828. }
  35829. }
  35830. };
  35831. setTimeout(function () {
  35832. if (ended < propCount) {
  35833. end();
  35834. }
  35835. }, timeout + 1);
  35836. el.addEventListener(event, onEnd);
  35837. }
  35838. var transformRE = /\b(transform|all)(,|$)/;
  35839. function getTransitionInfo (el, expectedType) {
  35840. var styles = window.getComputedStyle(el);
  35841. // JSDOM may return undefined for transition properties
  35842. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  35843. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  35844. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  35845. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  35846. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  35847. var animationTimeout = getTimeout(animationDelays, animationDurations);
  35848. var type;
  35849. var timeout = 0;
  35850. var propCount = 0;
  35851. /* istanbul ignore if */
  35852. if (expectedType === TRANSITION) {
  35853. if (transitionTimeout > 0) {
  35854. type = TRANSITION;
  35855. timeout = transitionTimeout;
  35856. propCount = transitionDurations.length;
  35857. }
  35858. } else if (expectedType === ANIMATION) {
  35859. if (animationTimeout > 0) {
  35860. type = ANIMATION;
  35861. timeout = animationTimeout;
  35862. propCount = animationDurations.length;
  35863. }
  35864. } else {
  35865. timeout = Math.max(transitionTimeout, animationTimeout);
  35866. type = timeout > 0
  35867. ? transitionTimeout > animationTimeout
  35868. ? TRANSITION
  35869. : ANIMATION
  35870. : null;
  35871. propCount = type
  35872. ? type === TRANSITION
  35873. ? transitionDurations.length
  35874. : animationDurations.length
  35875. : 0;
  35876. }
  35877. var hasTransform =
  35878. type === TRANSITION &&
  35879. transformRE.test(styles[transitionProp + 'Property']);
  35880. return {
  35881. type: type,
  35882. timeout: timeout,
  35883. propCount: propCount,
  35884. hasTransform: hasTransform
  35885. }
  35886. }
  35887. function getTimeout (delays, durations) {
  35888. /* istanbul ignore next */
  35889. while (delays.length < durations.length) {
  35890. delays = delays.concat(delays);
  35891. }
  35892. return Math.max.apply(null, durations.map(function (d, i) {
  35893. return toMs(d) + toMs(delays[i])
  35894. }))
  35895. }
  35896. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  35897. // in a locale-dependent way, using a comma instead of a dot.
  35898. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  35899. // as a floor function) causing unexpected behaviors
  35900. function toMs (s) {
  35901. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  35902. }
  35903. /* */
  35904. function enter (vnode, toggleDisplay) {
  35905. var el = vnode.elm;
  35906. // call leave callback now
  35907. if (isDef(el._leaveCb)) {
  35908. el._leaveCb.cancelled = true;
  35909. el._leaveCb();
  35910. }
  35911. var data = resolveTransition(vnode.data.transition);
  35912. if (isUndef(data)) {
  35913. return
  35914. }
  35915. /* istanbul ignore if */
  35916. if (isDef(el._enterCb) || el.nodeType !== 1) {
  35917. return
  35918. }
  35919. var css = data.css;
  35920. var type = data.type;
  35921. var enterClass = data.enterClass;
  35922. var enterToClass = data.enterToClass;
  35923. var enterActiveClass = data.enterActiveClass;
  35924. var appearClass = data.appearClass;
  35925. var appearToClass = data.appearToClass;
  35926. var appearActiveClass = data.appearActiveClass;
  35927. var beforeEnter = data.beforeEnter;
  35928. var enter = data.enter;
  35929. var afterEnter = data.afterEnter;
  35930. var enterCancelled = data.enterCancelled;
  35931. var beforeAppear = data.beforeAppear;
  35932. var appear = data.appear;
  35933. var afterAppear = data.afterAppear;
  35934. var appearCancelled = data.appearCancelled;
  35935. var duration = data.duration;
  35936. // activeInstance will always be the <transition> component managing this
  35937. // transition. One edge case to check is when the <transition> is placed
  35938. // as the root node of a child component. In that case we need to check
  35939. // <transition>'s parent for appear check.
  35940. var context = activeInstance;
  35941. var transitionNode = activeInstance.$vnode;
  35942. while (transitionNode && transitionNode.parent) {
  35943. context = transitionNode.context;
  35944. transitionNode = transitionNode.parent;
  35945. }
  35946. var isAppear = !context._isMounted || !vnode.isRootInsert;
  35947. if (isAppear && !appear && appear !== '') {
  35948. return
  35949. }
  35950. var startClass = isAppear && appearClass
  35951. ? appearClass
  35952. : enterClass;
  35953. var activeClass = isAppear && appearActiveClass
  35954. ? appearActiveClass
  35955. : enterActiveClass;
  35956. var toClass = isAppear && appearToClass
  35957. ? appearToClass
  35958. : enterToClass;
  35959. var beforeEnterHook = isAppear
  35960. ? (beforeAppear || beforeEnter)
  35961. : beforeEnter;
  35962. var enterHook = isAppear
  35963. ? (typeof appear === 'function' ? appear : enter)
  35964. : enter;
  35965. var afterEnterHook = isAppear
  35966. ? (afterAppear || afterEnter)
  35967. : afterEnter;
  35968. var enterCancelledHook = isAppear
  35969. ? (appearCancelled || enterCancelled)
  35970. : enterCancelled;
  35971. var explicitEnterDuration = toNumber(
  35972. isObject(duration)
  35973. ? duration.enter
  35974. : duration
  35975. );
  35976. if (explicitEnterDuration != null) {
  35977. checkDuration(explicitEnterDuration, 'enter', vnode);
  35978. }
  35979. var expectsCSS = css !== false && !isIE9;
  35980. var userWantsControl = getHookArgumentsLength(enterHook);
  35981. var cb = el._enterCb = once(function () {
  35982. if (expectsCSS) {
  35983. removeTransitionClass(el, toClass);
  35984. removeTransitionClass(el, activeClass);
  35985. }
  35986. if (cb.cancelled) {
  35987. if (expectsCSS) {
  35988. removeTransitionClass(el, startClass);
  35989. }
  35990. enterCancelledHook && enterCancelledHook(el);
  35991. } else {
  35992. afterEnterHook && afterEnterHook(el);
  35993. }
  35994. el._enterCb = null;
  35995. });
  35996. if (!vnode.data.show) {
  35997. // remove pending leave element on enter by injecting an insert hook
  35998. mergeVNodeHook(vnode, 'insert', function () {
  35999. var parent = el.parentNode;
  36000. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  36001. if (pendingNode &&
  36002. pendingNode.tag === vnode.tag &&
  36003. pendingNode.elm._leaveCb
  36004. ) {
  36005. pendingNode.elm._leaveCb();
  36006. }
  36007. enterHook && enterHook(el, cb);
  36008. });
  36009. }
  36010. // start enter transition
  36011. beforeEnterHook && beforeEnterHook(el);
  36012. if (expectsCSS) {
  36013. addTransitionClass(el, startClass);
  36014. addTransitionClass(el, activeClass);
  36015. nextFrame(function () {
  36016. removeTransitionClass(el, startClass);
  36017. if (!cb.cancelled) {
  36018. addTransitionClass(el, toClass);
  36019. if (!userWantsControl) {
  36020. if (isValidDuration(explicitEnterDuration)) {
  36021. setTimeout(cb, explicitEnterDuration);
  36022. } else {
  36023. whenTransitionEnds(el, type, cb);
  36024. }
  36025. }
  36026. }
  36027. });
  36028. }
  36029. if (vnode.data.show) {
  36030. toggleDisplay && toggleDisplay();
  36031. enterHook && enterHook(el, cb);
  36032. }
  36033. if (!expectsCSS && !userWantsControl) {
  36034. cb();
  36035. }
  36036. }
  36037. function leave (vnode, rm) {
  36038. var el = vnode.elm;
  36039. // call enter callback now
  36040. if (isDef(el._enterCb)) {
  36041. el._enterCb.cancelled = true;
  36042. el._enterCb();
  36043. }
  36044. var data = resolveTransition(vnode.data.transition);
  36045. if (isUndef(data) || el.nodeType !== 1) {
  36046. return rm()
  36047. }
  36048. /* istanbul ignore if */
  36049. if (isDef(el._leaveCb)) {
  36050. return
  36051. }
  36052. var css = data.css;
  36053. var type = data.type;
  36054. var leaveClass = data.leaveClass;
  36055. var leaveToClass = data.leaveToClass;
  36056. var leaveActiveClass = data.leaveActiveClass;
  36057. var beforeLeave = data.beforeLeave;
  36058. var leave = data.leave;
  36059. var afterLeave = data.afterLeave;
  36060. var leaveCancelled = data.leaveCancelled;
  36061. var delayLeave = data.delayLeave;
  36062. var duration = data.duration;
  36063. var expectsCSS = css !== false && !isIE9;
  36064. var userWantsControl = getHookArgumentsLength(leave);
  36065. var explicitLeaveDuration = toNumber(
  36066. isObject(duration)
  36067. ? duration.leave
  36068. : duration
  36069. );
  36070. if (isDef(explicitLeaveDuration)) {
  36071. checkDuration(explicitLeaveDuration, 'leave', vnode);
  36072. }
  36073. var cb = el._leaveCb = once(function () {
  36074. if (el.parentNode && el.parentNode._pending) {
  36075. el.parentNode._pending[vnode.key] = null;
  36076. }
  36077. if (expectsCSS) {
  36078. removeTransitionClass(el, leaveToClass);
  36079. removeTransitionClass(el, leaveActiveClass);
  36080. }
  36081. if (cb.cancelled) {
  36082. if (expectsCSS) {
  36083. removeTransitionClass(el, leaveClass);
  36084. }
  36085. leaveCancelled && leaveCancelled(el);
  36086. } else {
  36087. rm();
  36088. afterLeave && afterLeave(el);
  36089. }
  36090. el._leaveCb = null;
  36091. });
  36092. if (delayLeave) {
  36093. delayLeave(performLeave);
  36094. } else {
  36095. performLeave();
  36096. }
  36097. function performLeave () {
  36098. // the delayed leave may have already been cancelled
  36099. if (cb.cancelled) {
  36100. return
  36101. }
  36102. // record leaving element
  36103. if (!vnode.data.show && el.parentNode) {
  36104. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  36105. }
  36106. beforeLeave && beforeLeave(el);
  36107. if (expectsCSS) {
  36108. addTransitionClass(el, leaveClass);
  36109. addTransitionClass(el, leaveActiveClass);
  36110. nextFrame(function () {
  36111. removeTransitionClass(el, leaveClass);
  36112. if (!cb.cancelled) {
  36113. addTransitionClass(el, leaveToClass);
  36114. if (!userWantsControl) {
  36115. if (isValidDuration(explicitLeaveDuration)) {
  36116. setTimeout(cb, explicitLeaveDuration);
  36117. } else {
  36118. whenTransitionEnds(el, type, cb);
  36119. }
  36120. }
  36121. }
  36122. });
  36123. }
  36124. leave && leave(el, cb);
  36125. if (!expectsCSS && !userWantsControl) {
  36126. cb();
  36127. }
  36128. }
  36129. }
  36130. // only used in dev mode
  36131. function checkDuration (val, name, vnode) {
  36132. if (typeof val !== 'number') {
  36133. warn(
  36134. "<transition> explicit " + name + " duration is not a valid number - " +
  36135. "got " + (JSON.stringify(val)) + ".",
  36136. vnode.context
  36137. );
  36138. } else if (isNaN(val)) {
  36139. warn(
  36140. "<transition> explicit " + name + " duration is NaN - " +
  36141. 'the duration expression might be incorrect.',
  36142. vnode.context
  36143. );
  36144. }
  36145. }
  36146. function isValidDuration (val) {
  36147. return typeof val === 'number' && !isNaN(val)
  36148. }
  36149. /**
  36150. * Normalize a transition hook's argument length. The hook may be:
  36151. * - a merged hook (invoker) with the original in .fns
  36152. * - a wrapped component method (check ._length)
  36153. * - a plain function (.length)
  36154. */
  36155. function getHookArgumentsLength (fn) {
  36156. if (isUndef(fn)) {
  36157. return false
  36158. }
  36159. var invokerFns = fn.fns;
  36160. if (isDef(invokerFns)) {
  36161. // invoker
  36162. return getHookArgumentsLength(
  36163. Array.isArray(invokerFns)
  36164. ? invokerFns[0]
  36165. : invokerFns
  36166. )
  36167. } else {
  36168. return (fn._length || fn.length) > 1
  36169. }
  36170. }
  36171. function _enter (_, vnode) {
  36172. if (vnode.data.show !== true) {
  36173. enter(vnode);
  36174. }
  36175. }
  36176. var transition = inBrowser ? {
  36177. create: _enter,
  36178. activate: _enter,
  36179. remove: function remove$$1 (vnode, rm) {
  36180. /* istanbul ignore else */
  36181. if (vnode.data.show !== true) {
  36182. leave(vnode, rm);
  36183. } else {
  36184. rm();
  36185. }
  36186. }
  36187. } : {};
  36188. var platformModules = [
  36189. attrs,
  36190. klass,
  36191. events,
  36192. domProps,
  36193. style,
  36194. transition
  36195. ];
  36196. /* */
  36197. // the directive module should be applied last, after all
  36198. // built-in modules have been applied.
  36199. var modules = platformModules.concat(baseModules);
  36200. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  36201. /**
  36202. * Not type checking this file because flow doesn't like attaching
  36203. * properties to Elements.
  36204. */
  36205. /* istanbul ignore if */
  36206. if (isIE9) {
  36207. // http://www.matts411.com/post/internet-explorer-9-oninput/
  36208. document.addEventListener('selectionchange', function () {
  36209. var el = document.activeElement;
  36210. if (el && el.vmodel) {
  36211. trigger(el, 'input');
  36212. }
  36213. });
  36214. }
  36215. var directive = {
  36216. inserted: function inserted (el, binding, vnode, oldVnode) {
  36217. if (vnode.tag === 'select') {
  36218. // #6903
  36219. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  36220. mergeVNodeHook(vnode, 'postpatch', function () {
  36221. directive.componentUpdated(el, binding, vnode);
  36222. });
  36223. } else {
  36224. setSelected(el, binding, vnode.context);
  36225. }
  36226. el._vOptions = [].map.call(el.options, getValue);
  36227. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  36228. el._vModifiers = binding.modifiers;
  36229. if (!binding.modifiers.lazy) {
  36230. el.addEventListener('compositionstart', onCompositionStart);
  36231. el.addEventListener('compositionend', onCompositionEnd);
  36232. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  36233. // switching focus before confirming composition choice
  36234. // this also fixes the issue where some browsers e.g. iOS Chrome
  36235. // fires "change" instead of "input" on autocomplete.
  36236. el.addEventListener('change', onCompositionEnd);
  36237. /* istanbul ignore if */
  36238. if (isIE9) {
  36239. el.vmodel = true;
  36240. }
  36241. }
  36242. }
  36243. },
  36244. componentUpdated: function componentUpdated (el, binding, vnode) {
  36245. if (vnode.tag === 'select') {
  36246. setSelected(el, binding, vnode.context);
  36247. // in case the options rendered by v-for have changed,
  36248. // it's possible that the value is out-of-sync with the rendered options.
  36249. // detect such cases and filter out values that no longer has a matching
  36250. // option in the DOM.
  36251. var prevOptions = el._vOptions;
  36252. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  36253. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  36254. // trigger change event if
  36255. // no matching option found for at least one value
  36256. var needReset = el.multiple
  36257. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  36258. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  36259. if (needReset) {
  36260. trigger(el, 'change');
  36261. }
  36262. }
  36263. }
  36264. }
  36265. };
  36266. function setSelected (el, binding, vm) {
  36267. actuallySetSelected(el, binding, vm);
  36268. /* istanbul ignore if */
  36269. if (isIE || isEdge) {
  36270. setTimeout(function () {
  36271. actuallySetSelected(el, binding, vm);
  36272. }, 0);
  36273. }
  36274. }
  36275. function actuallySetSelected (el, binding, vm) {
  36276. var value = binding.value;
  36277. var isMultiple = el.multiple;
  36278. if (isMultiple && !Array.isArray(value)) {
  36279. warn(
  36280. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  36281. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  36282. vm
  36283. );
  36284. return
  36285. }
  36286. var selected, option;
  36287. for (var i = 0, l = el.options.length; i < l; i++) {
  36288. option = el.options[i];
  36289. if (isMultiple) {
  36290. selected = looseIndexOf(value, getValue(option)) > -1;
  36291. if (option.selected !== selected) {
  36292. option.selected = selected;
  36293. }
  36294. } else {
  36295. if (looseEqual(getValue(option), value)) {
  36296. if (el.selectedIndex !== i) {
  36297. el.selectedIndex = i;
  36298. }
  36299. return
  36300. }
  36301. }
  36302. }
  36303. if (!isMultiple) {
  36304. el.selectedIndex = -1;
  36305. }
  36306. }
  36307. function hasNoMatchingOption (value, options) {
  36308. return options.every(function (o) { return !looseEqual(o, value); })
  36309. }
  36310. function getValue (option) {
  36311. return '_value' in option
  36312. ? option._value
  36313. : option.value
  36314. }
  36315. function onCompositionStart (e) {
  36316. e.target.composing = true;
  36317. }
  36318. function onCompositionEnd (e) {
  36319. // prevent triggering an input event for no reason
  36320. if (!e.target.composing) { return }
  36321. e.target.composing = false;
  36322. trigger(e.target, 'input');
  36323. }
  36324. function trigger (el, type) {
  36325. var e = document.createEvent('HTMLEvents');
  36326. e.initEvent(type, true, true);
  36327. el.dispatchEvent(e);
  36328. }
  36329. /* */
  36330. // recursively search for possible transition defined inside the component root
  36331. function locateNode (vnode) {
  36332. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  36333. ? locateNode(vnode.componentInstance._vnode)
  36334. : vnode
  36335. }
  36336. var show = {
  36337. bind: function bind (el, ref, vnode) {
  36338. var value = ref.value;
  36339. vnode = locateNode(vnode);
  36340. var transition$$1 = vnode.data && vnode.data.transition;
  36341. var originalDisplay = el.__vOriginalDisplay =
  36342. el.style.display === 'none' ? '' : el.style.display;
  36343. if (value && transition$$1) {
  36344. vnode.data.show = true;
  36345. enter(vnode, function () {
  36346. el.style.display = originalDisplay;
  36347. });
  36348. } else {
  36349. el.style.display = value ? originalDisplay : 'none';
  36350. }
  36351. },
  36352. update: function update (el, ref, vnode) {
  36353. var value = ref.value;
  36354. var oldValue = ref.oldValue;
  36355. /* istanbul ignore if */
  36356. if (!value === !oldValue) { return }
  36357. vnode = locateNode(vnode);
  36358. var transition$$1 = vnode.data && vnode.data.transition;
  36359. if (transition$$1) {
  36360. vnode.data.show = true;
  36361. if (value) {
  36362. enter(vnode, function () {
  36363. el.style.display = el.__vOriginalDisplay;
  36364. });
  36365. } else {
  36366. leave(vnode, function () {
  36367. el.style.display = 'none';
  36368. });
  36369. }
  36370. } else {
  36371. el.style.display = value ? el.__vOriginalDisplay : 'none';
  36372. }
  36373. },
  36374. unbind: function unbind (
  36375. el,
  36376. binding,
  36377. vnode,
  36378. oldVnode,
  36379. isDestroy
  36380. ) {
  36381. if (!isDestroy) {
  36382. el.style.display = el.__vOriginalDisplay;
  36383. }
  36384. }
  36385. };
  36386. var platformDirectives = {
  36387. model: directive,
  36388. show: show
  36389. };
  36390. /* */
  36391. var transitionProps = {
  36392. name: String,
  36393. appear: Boolean,
  36394. css: Boolean,
  36395. mode: String,
  36396. type: String,
  36397. enterClass: String,
  36398. leaveClass: String,
  36399. enterToClass: String,
  36400. leaveToClass: String,
  36401. enterActiveClass: String,
  36402. leaveActiveClass: String,
  36403. appearClass: String,
  36404. appearActiveClass: String,
  36405. appearToClass: String,
  36406. duration: [Number, String, Object]
  36407. };
  36408. // in case the child is also an abstract component, e.g. <keep-alive>
  36409. // we want to recursively retrieve the real component to be rendered
  36410. function getRealChild (vnode) {
  36411. var compOptions = vnode && vnode.componentOptions;
  36412. if (compOptions && compOptions.Ctor.options.abstract) {
  36413. return getRealChild(getFirstComponentChild(compOptions.children))
  36414. } else {
  36415. return vnode
  36416. }
  36417. }
  36418. function extractTransitionData (comp) {
  36419. var data = {};
  36420. var options = comp.$options;
  36421. // props
  36422. for (var key in options.propsData) {
  36423. data[key] = comp[key];
  36424. }
  36425. // events.
  36426. // extract listeners and pass them directly to the transition methods
  36427. var listeners = options._parentListeners;
  36428. for (var key$1 in listeners) {
  36429. data[camelize(key$1)] = listeners[key$1];
  36430. }
  36431. return data
  36432. }
  36433. function placeholder (h, rawChild) {
  36434. if (/\d-keep-alive$/.test(rawChild.tag)) {
  36435. return h('keep-alive', {
  36436. props: rawChild.componentOptions.propsData
  36437. })
  36438. }
  36439. }
  36440. function hasParentTransition (vnode) {
  36441. while ((vnode = vnode.parent)) {
  36442. if (vnode.data.transition) {
  36443. return true
  36444. }
  36445. }
  36446. }
  36447. function isSameChild (child, oldChild) {
  36448. return oldChild.key === child.key && oldChild.tag === child.tag
  36449. }
  36450. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  36451. var isVShowDirective = function (d) { return d.name === 'show'; };
  36452. var Transition = {
  36453. name: 'transition',
  36454. props: transitionProps,
  36455. abstract: true,
  36456. render: function render (h) {
  36457. var this$1 = this;
  36458. var children = this.$slots.default;
  36459. if (!children) {
  36460. return
  36461. }
  36462. // filter out text nodes (possible whitespaces)
  36463. children = children.filter(isNotTextNode);
  36464. /* istanbul ignore if */
  36465. if (!children.length) {
  36466. return
  36467. }
  36468. // warn multiple elements
  36469. if (children.length > 1) {
  36470. warn(
  36471. '<transition> can only be used on a single element. Use ' +
  36472. '<transition-group> for lists.',
  36473. this.$parent
  36474. );
  36475. }
  36476. var mode = this.mode;
  36477. // warn invalid mode
  36478. if (mode && mode !== 'in-out' && mode !== 'out-in'
  36479. ) {
  36480. warn(
  36481. 'invalid <transition> mode: ' + mode,
  36482. this.$parent
  36483. );
  36484. }
  36485. var rawChild = children[0];
  36486. // if this is a component root node and the component's
  36487. // parent container node also has transition, skip.
  36488. if (hasParentTransition(this.$vnode)) {
  36489. return rawChild
  36490. }
  36491. // apply transition data to child
  36492. // use getRealChild() to ignore abstract components e.g. keep-alive
  36493. var child = getRealChild(rawChild);
  36494. /* istanbul ignore if */
  36495. if (!child) {
  36496. return rawChild
  36497. }
  36498. if (this._leaving) {
  36499. return placeholder(h, rawChild)
  36500. }
  36501. // ensure a key that is unique to the vnode type and to this transition
  36502. // component instance. This key will be used to remove pending leaving nodes
  36503. // during entering.
  36504. var id = "__transition-" + (this._uid) + "-";
  36505. child.key = child.key == null
  36506. ? child.isComment
  36507. ? id + 'comment'
  36508. : id + child.tag
  36509. : isPrimitive(child.key)
  36510. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  36511. : child.key;
  36512. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  36513. var oldRawChild = this._vnode;
  36514. var oldChild = getRealChild(oldRawChild);
  36515. // mark v-show
  36516. // so that the transition module can hand over the control to the directive
  36517. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  36518. child.data.show = true;
  36519. }
  36520. if (
  36521. oldChild &&
  36522. oldChild.data &&
  36523. !isSameChild(child, oldChild) &&
  36524. !isAsyncPlaceholder(oldChild) &&
  36525. // #6687 component root is a comment node
  36526. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  36527. ) {
  36528. // replace old child transition data with fresh one
  36529. // important for dynamic transitions!
  36530. var oldData = oldChild.data.transition = extend({}, data);
  36531. // handle transition mode
  36532. if (mode === 'out-in') {
  36533. // return placeholder node and queue update when leave finishes
  36534. this._leaving = true;
  36535. mergeVNodeHook(oldData, 'afterLeave', function () {
  36536. this$1._leaving = false;
  36537. this$1.$forceUpdate();
  36538. });
  36539. return placeholder(h, rawChild)
  36540. } else if (mode === 'in-out') {
  36541. if (isAsyncPlaceholder(child)) {
  36542. return oldRawChild
  36543. }
  36544. var delayedLeave;
  36545. var performLeave = function () { delayedLeave(); };
  36546. mergeVNodeHook(data, 'afterEnter', performLeave);
  36547. mergeVNodeHook(data, 'enterCancelled', performLeave);
  36548. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  36549. }
  36550. }
  36551. return rawChild
  36552. }
  36553. };
  36554. /* */
  36555. var props = extend({
  36556. tag: String,
  36557. moveClass: String
  36558. }, transitionProps);
  36559. delete props.mode;
  36560. var TransitionGroup = {
  36561. props: props,
  36562. beforeMount: function beforeMount () {
  36563. var this$1 = this;
  36564. var update = this._update;
  36565. this._update = function (vnode, hydrating) {
  36566. var restoreActiveInstance = setActiveInstance(this$1);
  36567. // force removing pass
  36568. this$1.__patch__(
  36569. this$1._vnode,
  36570. this$1.kept,
  36571. false, // hydrating
  36572. true // removeOnly (!important, avoids unnecessary moves)
  36573. );
  36574. this$1._vnode = this$1.kept;
  36575. restoreActiveInstance();
  36576. update.call(this$1, vnode, hydrating);
  36577. };
  36578. },
  36579. render: function render (h) {
  36580. var tag = this.tag || this.$vnode.data.tag || 'span';
  36581. var map = Object.create(null);
  36582. var prevChildren = this.prevChildren = this.children;
  36583. var rawChildren = this.$slots.default || [];
  36584. var children = this.children = [];
  36585. var transitionData = extractTransitionData(this);
  36586. for (var i = 0; i < rawChildren.length; i++) {
  36587. var c = rawChildren[i];
  36588. if (c.tag) {
  36589. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  36590. children.push(c);
  36591. map[c.key] = c
  36592. ;(c.data || (c.data = {})).transition = transitionData;
  36593. } else {
  36594. var opts = c.componentOptions;
  36595. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  36596. warn(("<transition-group> children must be keyed: <" + name + ">"));
  36597. }
  36598. }
  36599. }
  36600. if (prevChildren) {
  36601. var kept = [];
  36602. var removed = [];
  36603. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  36604. var c$1 = prevChildren[i$1];
  36605. c$1.data.transition = transitionData;
  36606. c$1.data.pos = c$1.elm.getBoundingClientRect();
  36607. if (map[c$1.key]) {
  36608. kept.push(c$1);
  36609. } else {
  36610. removed.push(c$1);
  36611. }
  36612. }
  36613. this.kept = h(tag, null, kept);
  36614. this.removed = removed;
  36615. }
  36616. return h(tag, null, children)
  36617. },
  36618. updated: function updated () {
  36619. var children = this.prevChildren;
  36620. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  36621. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  36622. return
  36623. }
  36624. // we divide the work into three loops to avoid mixing DOM reads and writes
  36625. // in each iteration - which helps prevent layout thrashing.
  36626. children.forEach(callPendingCbs);
  36627. children.forEach(recordPosition);
  36628. children.forEach(applyTranslation);
  36629. // force reflow to put everything in position
  36630. // assign to this to avoid being removed in tree-shaking
  36631. // $flow-disable-line
  36632. this._reflow = document.body.offsetHeight;
  36633. children.forEach(function (c) {
  36634. if (c.data.moved) {
  36635. var el = c.elm;
  36636. var s = el.style;
  36637. addTransitionClass(el, moveClass);
  36638. s.transform = s.WebkitTransform = s.transitionDuration = '';
  36639. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  36640. if (e && e.target !== el) {
  36641. return
  36642. }
  36643. if (!e || /transform$/.test(e.propertyName)) {
  36644. el.removeEventListener(transitionEndEvent, cb);
  36645. el._moveCb = null;
  36646. removeTransitionClass(el, moveClass);
  36647. }
  36648. });
  36649. }
  36650. });
  36651. },
  36652. methods: {
  36653. hasMove: function hasMove (el, moveClass) {
  36654. /* istanbul ignore if */
  36655. if (!hasTransition) {
  36656. return false
  36657. }
  36658. /* istanbul ignore if */
  36659. if (this._hasMove) {
  36660. return this._hasMove
  36661. }
  36662. // Detect whether an element with the move class applied has
  36663. // CSS transitions. Since the element may be inside an entering
  36664. // transition at this very moment, we make a clone of it and remove
  36665. // all other transition classes applied to ensure only the move class
  36666. // is applied.
  36667. var clone = el.cloneNode();
  36668. if (el._transitionClasses) {
  36669. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  36670. }
  36671. addClass(clone, moveClass);
  36672. clone.style.display = 'none';
  36673. this.$el.appendChild(clone);
  36674. var info = getTransitionInfo(clone);
  36675. this.$el.removeChild(clone);
  36676. return (this._hasMove = info.hasTransform)
  36677. }
  36678. }
  36679. };
  36680. function callPendingCbs (c) {
  36681. /* istanbul ignore if */
  36682. if (c.elm._moveCb) {
  36683. c.elm._moveCb();
  36684. }
  36685. /* istanbul ignore if */
  36686. if (c.elm._enterCb) {
  36687. c.elm._enterCb();
  36688. }
  36689. }
  36690. function recordPosition (c) {
  36691. c.data.newPos = c.elm.getBoundingClientRect();
  36692. }
  36693. function applyTranslation (c) {
  36694. var oldPos = c.data.pos;
  36695. var newPos = c.data.newPos;
  36696. var dx = oldPos.left - newPos.left;
  36697. var dy = oldPos.top - newPos.top;
  36698. if (dx || dy) {
  36699. c.data.moved = true;
  36700. var s = c.elm.style;
  36701. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  36702. s.transitionDuration = '0s';
  36703. }
  36704. }
  36705. var platformComponents = {
  36706. Transition: Transition,
  36707. TransitionGroup: TransitionGroup
  36708. };
  36709. /* */
  36710. // install platform specific utils
  36711. Vue.config.mustUseProp = mustUseProp;
  36712. Vue.config.isReservedTag = isReservedTag;
  36713. Vue.config.isReservedAttr = isReservedAttr;
  36714. Vue.config.getTagNamespace = getTagNamespace;
  36715. Vue.config.isUnknownElement = isUnknownElement;
  36716. // install platform runtime directives & components
  36717. extend(Vue.options.directives, platformDirectives);
  36718. extend(Vue.options.components, platformComponents);
  36719. // install platform patch function
  36720. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  36721. // public mount method
  36722. Vue.prototype.$mount = function (
  36723. el,
  36724. hydrating
  36725. ) {
  36726. el = el && inBrowser ? query(el) : undefined;
  36727. return mountComponent(this, el, hydrating)
  36728. };
  36729. // devtools global hook
  36730. /* istanbul ignore next */
  36731. if (inBrowser) {
  36732. setTimeout(function () {
  36733. if (config.devtools) {
  36734. if (devtools) {
  36735. devtools.emit('init', Vue);
  36736. } else {
  36737. console[console.info ? 'info' : 'log'](
  36738. 'Download the Vue Devtools extension for a better development experience:\n' +
  36739. 'https://github.com/vuejs/vue-devtools'
  36740. );
  36741. }
  36742. }
  36743. if (config.productionTip !== false &&
  36744. typeof console !== 'undefined'
  36745. ) {
  36746. console[console.info ? 'info' : 'log'](
  36747. "You are running Vue in development mode.\n" +
  36748. "Make sure to turn on production mode when deploying for production.\n" +
  36749. "See more tips at https://vuejs.org/guide/deployment.html"
  36750. );
  36751. }
  36752. }, 0);
  36753. }
  36754. /* */
  36755. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  36756. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  36757. var buildRegex = cached(function (delimiters) {
  36758. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  36759. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  36760. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  36761. });
  36762. function parseText (
  36763. text,
  36764. delimiters
  36765. ) {
  36766. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  36767. if (!tagRE.test(text)) {
  36768. return
  36769. }
  36770. var tokens = [];
  36771. var rawTokens = [];
  36772. var lastIndex = tagRE.lastIndex = 0;
  36773. var match, index, tokenValue;
  36774. while ((match = tagRE.exec(text))) {
  36775. index = match.index;
  36776. // push text token
  36777. if (index > lastIndex) {
  36778. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  36779. tokens.push(JSON.stringify(tokenValue));
  36780. }
  36781. // tag token
  36782. var exp = parseFilters(match[1].trim());
  36783. tokens.push(("_s(" + exp + ")"));
  36784. rawTokens.push({ '@binding': exp });
  36785. lastIndex = index + match[0].length;
  36786. }
  36787. if (lastIndex < text.length) {
  36788. rawTokens.push(tokenValue = text.slice(lastIndex));
  36789. tokens.push(JSON.stringify(tokenValue));
  36790. }
  36791. return {
  36792. expression: tokens.join('+'),
  36793. tokens: rawTokens
  36794. }
  36795. }
  36796. /* */
  36797. function transformNode (el, options) {
  36798. var warn = options.warn || baseWarn;
  36799. var staticClass = getAndRemoveAttr(el, 'class');
  36800. if (staticClass) {
  36801. var res = parseText(staticClass, options.delimiters);
  36802. if (res) {
  36803. warn(
  36804. "class=\"" + staticClass + "\": " +
  36805. 'Interpolation inside attributes has been removed. ' +
  36806. 'Use v-bind or the colon shorthand instead. For example, ' +
  36807. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  36808. el.rawAttrsMap['class']
  36809. );
  36810. }
  36811. }
  36812. if (staticClass) {
  36813. el.staticClass = JSON.stringify(staticClass);
  36814. }
  36815. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  36816. if (classBinding) {
  36817. el.classBinding = classBinding;
  36818. }
  36819. }
  36820. function genData (el) {
  36821. var data = '';
  36822. if (el.staticClass) {
  36823. data += "staticClass:" + (el.staticClass) + ",";
  36824. }
  36825. if (el.classBinding) {
  36826. data += "class:" + (el.classBinding) + ",";
  36827. }
  36828. return data
  36829. }
  36830. var klass$1 = {
  36831. staticKeys: ['staticClass'],
  36832. transformNode: transformNode,
  36833. genData: genData
  36834. };
  36835. /* */
  36836. function transformNode$1 (el, options) {
  36837. var warn = options.warn || baseWarn;
  36838. var staticStyle = getAndRemoveAttr(el, 'style');
  36839. if (staticStyle) {
  36840. /* istanbul ignore if */
  36841. {
  36842. var res = parseText(staticStyle, options.delimiters);
  36843. if (res) {
  36844. warn(
  36845. "style=\"" + staticStyle + "\": " +
  36846. 'Interpolation inside attributes has been removed. ' +
  36847. 'Use v-bind or the colon shorthand instead. For example, ' +
  36848. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  36849. el.rawAttrsMap['style']
  36850. );
  36851. }
  36852. }
  36853. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  36854. }
  36855. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  36856. if (styleBinding) {
  36857. el.styleBinding = styleBinding;
  36858. }
  36859. }
  36860. function genData$1 (el) {
  36861. var data = '';
  36862. if (el.staticStyle) {
  36863. data += "staticStyle:" + (el.staticStyle) + ",";
  36864. }
  36865. if (el.styleBinding) {
  36866. data += "style:(" + (el.styleBinding) + "),";
  36867. }
  36868. return data
  36869. }
  36870. var style$1 = {
  36871. staticKeys: ['staticStyle'],
  36872. transformNode: transformNode$1,
  36873. genData: genData$1
  36874. };
  36875. /* */
  36876. var decoder;
  36877. var he = {
  36878. decode: function decode (html) {
  36879. decoder = decoder || document.createElement('div');
  36880. decoder.innerHTML = html;
  36881. return decoder.textContent
  36882. }
  36883. };
  36884. /* */
  36885. var isUnaryTag = makeMap(
  36886. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  36887. 'link,meta,param,source,track,wbr'
  36888. );
  36889. // Elements that you can, intentionally, leave open
  36890. // (and which close themselves)
  36891. var canBeLeftOpenTag = makeMap(
  36892. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  36893. );
  36894. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  36895. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  36896. var isNonPhrasingTag = makeMap(
  36897. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  36898. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  36899. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  36900. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  36901. 'title,tr,track'
  36902. );
  36903. /**
  36904. * Not type-checking this file because it's mostly vendor code.
  36905. */
  36906. // Regular Expressions for parsing tags and attributes
  36907. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  36908. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  36909. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  36910. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  36911. var startTagOpen = new RegExp(("^<" + qnameCapture));
  36912. var startTagClose = /^\s*(\/?)>/;
  36913. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  36914. var doctype = /^<!DOCTYPE [^>]+>/i;
  36915. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  36916. var comment = /^<!\--/;
  36917. var conditionalComment = /^<!\[/;
  36918. // Special Elements (can contain anything)
  36919. var isPlainTextElement = makeMap('script,style,textarea', true);
  36920. var reCache = {};
  36921. var decodingMap = {
  36922. '&lt;': '<',
  36923. '&gt;': '>',
  36924. '&quot;': '"',
  36925. '&amp;': '&',
  36926. '&#10;': '\n',
  36927. '&#9;': '\t',
  36928. '&#39;': "'"
  36929. };
  36930. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  36931. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  36932. // #5992
  36933. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  36934. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  36935. function decodeAttr (value, shouldDecodeNewlines) {
  36936. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  36937. return value.replace(re, function (match) { return decodingMap[match]; })
  36938. }
  36939. function parseHTML (html, options) {
  36940. var stack = [];
  36941. var expectHTML = options.expectHTML;
  36942. var isUnaryTag$$1 = options.isUnaryTag || no;
  36943. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  36944. var index = 0;
  36945. var last, lastTag;
  36946. while (html) {
  36947. last = html;
  36948. // Make sure we're not in a plaintext content element like script/style
  36949. if (!lastTag || !isPlainTextElement(lastTag)) {
  36950. var textEnd = html.indexOf('<');
  36951. if (textEnd === 0) {
  36952. // Comment:
  36953. if (comment.test(html)) {
  36954. var commentEnd = html.indexOf('-->');
  36955. if (commentEnd >= 0) {
  36956. if (options.shouldKeepComment) {
  36957. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  36958. }
  36959. advance(commentEnd + 3);
  36960. continue
  36961. }
  36962. }
  36963. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  36964. if (conditionalComment.test(html)) {
  36965. var conditionalEnd = html.indexOf(']>');
  36966. if (conditionalEnd >= 0) {
  36967. advance(conditionalEnd + 2);
  36968. continue
  36969. }
  36970. }
  36971. // Doctype:
  36972. var doctypeMatch = html.match(doctype);
  36973. if (doctypeMatch) {
  36974. advance(doctypeMatch[0].length);
  36975. continue
  36976. }
  36977. // End tag:
  36978. var endTagMatch = html.match(endTag);
  36979. if (endTagMatch) {
  36980. var curIndex = index;
  36981. advance(endTagMatch[0].length);
  36982. parseEndTag(endTagMatch[1], curIndex, index);
  36983. continue
  36984. }
  36985. // Start tag:
  36986. var startTagMatch = parseStartTag();
  36987. if (startTagMatch) {
  36988. handleStartTag(startTagMatch);
  36989. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  36990. advance(1);
  36991. }
  36992. continue
  36993. }
  36994. }
  36995. var text = (void 0), rest = (void 0), next = (void 0);
  36996. if (textEnd >= 0) {
  36997. rest = html.slice(textEnd);
  36998. while (
  36999. !endTag.test(rest) &&
  37000. !startTagOpen.test(rest) &&
  37001. !comment.test(rest) &&
  37002. !conditionalComment.test(rest)
  37003. ) {
  37004. // < in plain text, be forgiving and treat it as text
  37005. next = rest.indexOf('<', 1);
  37006. if (next < 0) { break }
  37007. textEnd += next;
  37008. rest = html.slice(textEnd);
  37009. }
  37010. text = html.substring(0, textEnd);
  37011. }
  37012. if (textEnd < 0) {
  37013. text = html;
  37014. }
  37015. if (text) {
  37016. advance(text.length);
  37017. }
  37018. if (options.chars && text) {
  37019. options.chars(text, index - text.length, index);
  37020. }
  37021. } else {
  37022. var endTagLength = 0;
  37023. var stackedTag = lastTag.toLowerCase();
  37024. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  37025. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  37026. endTagLength = endTag.length;
  37027. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  37028. text = text
  37029. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  37030. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  37031. }
  37032. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  37033. text = text.slice(1);
  37034. }
  37035. if (options.chars) {
  37036. options.chars(text);
  37037. }
  37038. return ''
  37039. });
  37040. index += html.length - rest$1.length;
  37041. html = rest$1;
  37042. parseEndTag(stackedTag, index - endTagLength, index);
  37043. }
  37044. if (html === last) {
  37045. options.chars && options.chars(html);
  37046. if (!stack.length && options.warn) {
  37047. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  37048. }
  37049. break
  37050. }
  37051. }
  37052. // Clean up any remaining tags
  37053. parseEndTag();
  37054. function advance (n) {
  37055. index += n;
  37056. html = html.substring(n);
  37057. }
  37058. function parseStartTag () {
  37059. var start = html.match(startTagOpen);
  37060. if (start) {
  37061. var match = {
  37062. tagName: start[1],
  37063. attrs: [],
  37064. start: index
  37065. };
  37066. advance(start[0].length);
  37067. var end, attr;
  37068. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  37069. attr.start = index;
  37070. advance(attr[0].length);
  37071. attr.end = index;
  37072. match.attrs.push(attr);
  37073. }
  37074. if (end) {
  37075. match.unarySlash = end[1];
  37076. advance(end[0].length);
  37077. match.end = index;
  37078. return match
  37079. }
  37080. }
  37081. }
  37082. function handleStartTag (match) {
  37083. var tagName = match.tagName;
  37084. var unarySlash = match.unarySlash;
  37085. if (expectHTML) {
  37086. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  37087. parseEndTag(lastTag);
  37088. }
  37089. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  37090. parseEndTag(tagName);
  37091. }
  37092. }
  37093. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  37094. var l = match.attrs.length;
  37095. var attrs = new Array(l);
  37096. for (var i = 0; i < l; i++) {
  37097. var args = match.attrs[i];
  37098. var value = args[3] || args[4] || args[5] || '';
  37099. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  37100. ? options.shouldDecodeNewlinesForHref
  37101. : options.shouldDecodeNewlines;
  37102. attrs[i] = {
  37103. name: args[1],
  37104. value: decodeAttr(value, shouldDecodeNewlines)
  37105. };
  37106. if (options.outputSourceRange) {
  37107. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  37108. attrs[i].end = args.end;
  37109. }
  37110. }
  37111. if (!unary) {
  37112. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  37113. lastTag = tagName;
  37114. }
  37115. if (options.start) {
  37116. options.start(tagName, attrs, unary, match.start, match.end);
  37117. }
  37118. }
  37119. function parseEndTag (tagName, start, end) {
  37120. var pos, lowerCasedTagName;
  37121. if (start == null) { start = index; }
  37122. if (end == null) { end = index; }
  37123. // Find the closest opened tag of the same type
  37124. if (tagName) {
  37125. lowerCasedTagName = tagName.toLowerCase();
  37126. for (pos = stack.length - 1; pos >= 0; pos--) {
  37127. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  37128. break
  37129. }
  37130. }
  37131. } else {
  37132. // If no tag name is provided, clean shop
  37133. pos = 0;
  37134. }
  37135. if (pos >= 0) {
  37136. // Close all the open elements, up the stack
  37137. for (var i = stack.length - 1; i >= pos; i--) {
  37138. if (i > pos || !tagName &&
  37139. options.warn
  37140. ) {
  37141. options.warn(
  37142. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  37143. { start: stack[i].start, end: stack[i].end }
  37144. );
  37145. }
  37146. if (options.end) {
  37147. options.end(stack[i].tag, start, end);
  37148. }
  37149. }
  37150. // Remove the open elements from the stack
  37151. stack.length = pos;
  37152. lastTag = pos && stack[pos - 1].tag;
  37153. } else if (lowerCasedTagName === 'br') {
  37154. if (options.start) {
  37155. options.start(tagName, [], true, start, end);
  37156. }
  37157. } else if (lowerCasedTagName === 'p') {
  37158. if (options.start) {
  37159. options.start(tagName, [], false, start, end);
  37160. }
  37161. if (options.end) {
  37162. options.end(tagName, start, end);
  37163. }
  37164. }
  37165. }
  37166. }
  37167. /* */
  37168. var onRE = /^@|^v-on:/;
  37169. var dirRE = /^v-|^@|^:|^#/;
  37170. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  37171. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  37172. var stripParensRE = /^\(|\)$/g;
  37173. var dynamicArgRE = /^\[.*\]$/;
  37174. var argRE = /:(.*)$/;
  37175. var bindRE = /^:|^\.|^v-bind:/;
  37176. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  37177. var slotRE = /^v-slot(:|$)|^#/;
  37178. var lineBreakRE = /[\r\n]/;
  37179. var whitespaceRE$1 = /\s+/g;
  37180. var invalidAttributeRE = /[\s"'<>\/=]/;
  37181. var decodeHTMLCached = cached(he.decode);
  37182. var emptySlotScopeToken = "_empty_";
  37183. // configurable state
  37184. var warn$2;
  37185. var delimiters;
  37186. var transforms;
  37187. var preTransforms;
  37188. var postTransforms;
  37189. var platformIsPreTag;
  37190. var platformMustUseProp;
  37191. var platformGetTagNamespace;
  37192. var maybeComponent;
  37193. function createASTElement (
  37194. tag,
  37195. attrs,
  37196. parent
  37197. ) {
  37198. return {
  37199. type: 1,
  37200. tag: tag,
  37201. attrsList: attrs,
  37202. attrsMap: makeAttrsMap(attrs),
  37203. rawAttrsMap: {},
  37204. parent: parent,
  37205. children: []
  37206. }
  37207. }
  37208. /**
  37209. * Convert HTML string to AST.
  37210. */
  37211. function parse (
  37212. template,
  37213. options
  37214. ) {
  37215. warn$2 = options.warn || baseWarn;
  37216. platformIsPreTag = options.isPreTag || no;
  37217. platformMustUseProp = options.mustUseProp || no;
  37218. platformGetTagNamespace = options.getTagNamespace || no;
  37219. var isReservedTag = options.isReservedTag || no;
  37220. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  37221. transforms = pluckModuleFunction(options.modules, 'transformNode');
  37222. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  37223. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  37224. delimiters = options.delimiters;
  37225. var stack = [];
  37226. var preserveWhitespace = options.preserveWhitespace !== false;
  37227. var whitespaceOption = options.whitespace;
  37228. var root;
  37229. var currentParent;
  37230. var inVPre = false;
  37231. var inPre = false;
  37232. var warned = false;
  37233. function warnOnce (msg, range) {
  37234. if (!warned) {
  37235. warned = true;
  37236. warn$2(msg, range);
  37237. }
  37238. }
  37239. function closeElement (element) {
  37240. trimEndingWhitespace(element);
  37241. if (!inVPre && !element.processed) {
  37242. element = processElement(element, options);
  37243. }
  37244. // tree management
  37245. if (!stack.length && element !== root) {
  37246. // allow root elements with v-if, v-else-if and v-else
  37247. if (root.if && (element.elseif || element.else)) {
  37248. {
  37249. checkRootConstraints(element);
  37250. }
  37251. addIfCondition(root, {
  37252. exp: element.elseif,
  37253. block: element
  37254. });
  37255. } else {
  37256. warnOnce(
  37257. "Component template should contain exactly one root element. " +
  37258. "If you are using v-if on multiple elements, " +
  37259. "use v-else-if to chain them instead.",
  37260. { start: element.start }
  37261. );
  37262. }
  37263. }
  37264. if (currentParent && !element.forbidden) {
  37265. if (element.elseif || element.else) {
  37266. processIfConditions(element, currentParent);
  37267. } else {
  37268. if (element.slotScope) {
  37269. // scoped slot
  37270. // keep it in the children list so that v-else(-if) conditions can
  37271. // find it as the prev node.
  37272. var name = element.slotTarget || '"default"'
  37273. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  37274. }
  37275. currentParent.children.push(element);
  37276. element.parent = currentParent;
  37277. }
  37278. }
  37279. // final children cleanup
  37280. // filter out scoped slots
  37281. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  37282. // remove trailing whitespace node again
  37283. trimEndingWhitespace(element);
  37284. // check pre state
  37285. if (element.pre) {
  37286. inVPre = false;
  37287. }
  37288. if (platformIsPreTag(element.tag)) {
  37289. inPre = false;
  37290. }
  37291. // apply post-transforms
  37292. for (var i = 0; i < postTransforms.length; i++) {
  37293. postTransforms[i](element, options);
  37294. }
  37295. }
  37296. function trimEndingWhitespace (el) {
  37297. // remove trailing whitespace node
  37298. if (!inPre) {
  37299. var lastNode;
  37300. while (
  37301. (lastNode = el.children[el.children.length - 1]) &&
  37302. lastNode.type === 3 &&
  37303. lastNode.text === ' '
  37304. ) {
  37305. el.children.pop();
  37306. }
  37307. }
  37308. }
  37309. function checkRootConstraints (el) {
  37310. if (el.tag === 'slot' || el.tag === 'template') {
  37311. warnOnce(
  37312. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  37313. 'contain multiple nodes.',
  37314. { start: el.start }
  37315. );
  37316. }
  37317. if (el.attrsMap.hasOwnProperty('v-for')) {
  37318. warnOnce(
  37319. 'Cannot use v-for on stateful component root element because ' +
  37320. 'it renders multiple elements.',
  37321. el.rawAttrsMap['v-for']
  37322. );
  37323. }
  37324. }
  37325. parseHTML(template, {
  37326. warn: warn$2,
  37327. expectHTML: options.expectHTML,
  37328. isUnaryTag: options.isUnaryTag,
  37329. canBeLeftOpenTag: options.canBeLeftOpenTag,
  37330. shouldDecodeNewlines: options.shouldDecodeNewlines,
  37331. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  37332. shouldKeepComment: options.comments,
  37333. outputSourceRange: options.outputSourceRange,
  37334. start: function start (tag, attrs, unary, start$1, end) {
  37335. // check namespace.
  37336. // inherit parent ns if there is one
  37337. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  37338. // handle IE svg bug
  37339. /* istanbul ignore if */
  37340. if (isIE && ns === 'svg') {
  37341. attrs = guardIESVGBug(attrs);
  37342. }
  37343. var element = createASTElement(tag, attrs, currentParent);
  37344. if (ns) {
  37345. element.ns = ns;
  37346. }
  37347. {
  37348. if (options.outputSourceRange) {
  37349. element.start = start$1;
  37350. element.end = end;
  37351. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  37352. cumulated[attr.name] = attr;
  37353. return cumulated
  37354. }, {});
  37355. }
  37356. attrs.forEach(function (attr) {
  37357. if (invalidAttributeRE.test(attr.name)) {
  37358. warn$2(
  37359. "Invalid dynamic argument expression: attribute names cannot contain " +
  37360. "spaces, quotes, <, >, / or =.",
  37361. {
  37362. start: attr.start + attr.name.indexOf("["),
  37363. end: attr.start + attr.name.length
  37364. }
  37365. );
  37366. }
  37367. });
  37368. }
  37369. if (isForbiddenTag(element) && !isServerRendering()) {
  37370. element.forbidden = true;
  37371. warn$2(
  37372. 'Templates should only be responsible for mapping the state to the ' +
  37373. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  37374. "<" + tag + ">" + ', as they will not be parsed.',
  37375. { start: element.start }
  37376. );
  37377. }
  37378. // apply pre-transforms
  37379. for (var i = 0; i < preTransforms.length; i++) {
  37380. element = preTransforms[i](element, options) || element;
  37381. }
  37382. if (!inVPre) {
  37383. processPre(element);
  37384. if (element.pre) {
  37385. inVPre = true;
  37386. }
  37387. }
  37388. if (platformIsPreTag(element.tag)) {
  37389. inPre = true;
  37390. }
  37391. if (inVPre) {
  37392. processRawAttrs(element);
  37393. } else if (!element.processed) {
  37394. // structural directives
  37395. processFor(element);
  37396. processIf(element);
  37397. processOnce(element);
  37398. }
  37399. if (!root) {
  37400. root = element;
  37401. {
  37402. checkRootConstraints(root);
  37403. }
  37404. }
  37405. if (!unary) {
  37406. currentParent = element;
  37407. stack.push(element);
  37408. } else {
  37409. closeElement(element);
  37410. }
  37411. },
  37412. end: function end (tag, start, end$1) {
  37413. var element = stack[stack.length - 1];
  37414. // pop stack
  37415. stack.length -= 1;
  37416. currentParent = stack[stack.length - 1];
  37417. if (options.outputSourceRange) {
  37418. element.end = end$1;
  37419. }
  37420. closeElement(element);
  37421. },
  37422. chars: function chars (text, start, end) {
  37423. if (!currentParent) {
  37424. {
  37425. if (text === template) {
  37426. warnOnce(
  37427. 'Component template requires a root element, rather than just text.',
  37428. { start: start }
  37429. );
  37430. } else if ((text = text.trim())) {
  37431. warnOnce(
  37432. ("text \"" + text + "\" outside root element will be ignored."),
  37433. { start: start }
  37434. );
  37435. }
  37436. }
  37437. return
  37438. }
  37439. // IE textarea placeholder bug
  37440. /* istanbul ignore if */
  37441. if (isIE &&
  37442. currentParent.tag === 'textarea' &&
  37443. currentParent.attrsMap.placeholder === text
  37444. ) {
  37445. return
  37446. }
  37447. var children = currentParent.children;
  37448. if (inPre || text.trim()) {
  37449. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  37450. } else if (!children.length) {
  37451. // remove the whitespace-only node right after an opening tag
  37452. text = '';
  37453. } else if (whitespaceOption) {
  37454. if (whitespaceOption === 'condense') {
  37455. // in condense mode, remove the whitespace node if it contains
  37456. // line break, otherwise condense to a single space
  37457. text = lineBreakRE.test(text) ? '' : ' ';
  37458. } else {
  37459. text = ' ';
  37460. }
  37461. } else {
  37462. text = preserveWhitespace ? ' ' : '';
  37463. }
  37464. if (text) {
  37465. if (!inPre && whitespaceOption === 'condense') {
  37466. // condense consecutive whitespaces into single space
  37467. text = text.replace(whitespaceRE$1, ' ');
  37468. }
  37469. var res;
  37470. var child;
  37471. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  37472. child = {
  37473. type: 2,
  37474. expression: res.expression,
  37475. tokens: res.tokens,
  37476. text: text
  37477. };
  37478. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  37479. child = {
  37480. type: 3,
  37481. text: text
  37482. };
  37483. }
  37484. if (child) {
  37485. if (options.outputSourceRange) {
  37486. child.start = start;
  37487. child.end = end;
  37488. }
  37489. children.push(child);
  37490. }
  37491. }
  37492. },
  37493. comment: function comment (text, start, end) {
  37494. // adding anything as a sibling to the root node is forbidden
  37495. // comments should still be allowed, but ignored
  37496. if (currentParent) {
  37497. var child = {
  37498. type: 3,
  37499. text: text,
  37500. isComment: true
  37501. };
  37502. if (options.outputSourceRange) {
  37503. child.start = start;
  37504. child.end = end;
  37505. }
  37506. currentParent.children.push(child);
  37507. }
  37508. }
  37509. });
  37510. return root
  37511. }
  37512. function processPre (el) {
  37513. if (getAndRemoveAttr(el, 'v-pre') != null) {
  37514. el.pre = true;
  37515. }
  37516. }
  37517. function processRawAttrs (el) {
  37518. var list = el.attrsList;
  37519. var len = list.length;
  37520. if (len) {
  37521. var attrs = el.attrs = new Array(len);
  37522. for (var i = 0; i < len; i++) {
  37523. attrs[i] = {
  37524. name: list[i].name,
  37525. value: JSON.stringify(list[i].value)
  37526. };
  37527. if (list[i].start != null) {
  37528. attrs[i].start = list[i].start;
  37529. attrs[i].end = list[i].end;
  37530. }
  37531. }
  37532. } else if (!el.pre) {
  37533. // non root node in pre blocks with no attributes
  37534. el.plain = true;
  37535. }
  37536. }
  37537. function processElement (
  37538. element,
  37539. options
  37540. ) {
  37541. processKey(element);
  37542. // determine whether this is a plain element after
  37543. // removing structural attributes
  37544. element.plain = (
  37545. !element.key &&
  37546. !element.scopedSlots &&
  37547. !element.attrsList.length
  37548. );
  37549. processRef(element);
  37550. processSlotContent(element);
  37551. processSlotOutlet(element);
  37552. processComponent(element);
  37553. for (var i = 0; i < transforms.length; i++) {
  37554. element = transforms[i](element, options) || element;
  37555. }
  37556. processAttrs(element);
  37557. return element
  37558. }
  37559. function processKey (el) {
  37560. var exp = getBindingAttr(el, 'key');
  37561. if (exp) {
  37562. {
  37563. if (el.tag === 'template') {
  37564. warn$2(
  37565. "<template> cannot be keyed. Place the key on real elements instead.",
  37566. getRawBindingAttr(el, 'key')
  37567. );
  37568. }
  37569. if (el.for) {
  37570. var iterator = el.iterator2 || el.iterator1;
  37571. var parent = el.parent;
  37572. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  37573. warn$2(
  37574. "Do not use v-for index as key on <transition-group> children, " +
  37575. "this is the same as not using keys.",
  37576. getRawBindingAttr(el, 'key'),
  37577. true /* tip */
  37578. );
  37579. }
  37580. }
  37581. }
  37582. el.key = exp;
  37583. }
  37584. }
  37585. function processRef (el) {
  37586. var ref = getBindingAttr(el, 'ref');
  37587. if (ref) {
  37588. el.ref = ref;
  37589. el.refInFor = checkInFor(el);
  37590. }
  37591. }
  37592. function processFor (el) {
  37593. var exp;
  37594. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  37595. var res = parseFor(exp);
  37596. if (res) {
  37597. extend(el, res);
  37598. } else {
  37599. warn$2(
  37600. ("Invalid v-for expression: " + exp),
  37601. el.rawAttrsMap['v-for']
  37602. );
  37603. }
  37604. }
  37605. }
  37606. function parseFor (exp) {
  37607. var inMatch = exp.match(forAliasRE);
  37608. if (!inMatch) { return }
  37609. var res = {};
  37610. res.for = inMatch[2].trim();
  37611. var alias = inMatch[1].trim().replace(stripParensRE, '');
  37612. var iteratorMatch = alias.match(forIteratorRE);
  37613. if (iteratorMatch) {
  37614. res.alias = alias.replace(forIteratorRE, '').trim();
  37615. res.iterator1 = iteratorMatch[1].trim();
  37616. if (iteratorMatch[2]) {
  37617. res.iterator2 = iteratorMatch[2].trim();
  37618. }
  37619. } else {
  37620. res.alias = alias;
  37621. }
  37622. return res
  37623. }
  37624. function processIf (el) {
  37625. var exp = getAndRemoveAttr(el, 'v-if');
  37626. if (exp) {
  37627. el.if = exp;
  37628. addIfCondition(el, {
  37629. exp: exp,
  37630. block: el
  37631. });
  37632. } else {
  37633. if (getAndRemoveAttr(el, 'v-else') != null) {
  37634. el.else = true;
  37635. }
  37636. var elseif = getAndRemoveAttr(el, 'v-else-if');
  37637. if (elseif) {
  37638. el.elseif = elseif;
  37639. }
  37640. }
  37641. }
  37642. function processIfConditions (el, parent) {
  37643. var prev = findPrevElement(parent.children);
  37644. if (prev && prev.if) {
  37645. addIfCondition(prev, {
  37646. exp: el.elseif,
  37647. block: el
  37648. });
  37649. } else {
  37650. warn$2(
  37651. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  37652. "used on element <" + (el.tag) + "> without corresponding v-if.",
  37653. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  37654. );
  37655. }
  37656. }
  37657. function findPrevElement (children) {
  37658. var i = children.length;
  37659. while (i--) {
  37660. if (children[i].type === 1) {
  37661. return children[i]
  37662. } else {
  37663. if (children[i].text !== ' ') {
  37664. warn$2(
  37665. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  37666. "will be ignored.",
  37667. children[i]
  37668. );
  37669. }
  37670. children.pop();
  37671. }
  37672. }
  37673. }
  37674. function addIfCondition (el, condition) {
  37675. if (!el.ifConditions) {
  37676. el.ifConditions = [];
  37677. }
  37678. el.ifConditions.push(condition);
  37679. }
  37680. function processOnce (el) {
  37681. var once$$1 = getAndRemoveAttr(el, 'v-once');
  37682. if (once$$1 != null) {
  37683. el.once = true;
  37684. }
  37685. }
  37686. // handle content being passed to a component as slot,
  37687. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  37688. function processSlotContent (el) {
  37689. var slotScope;
  37690. if (el.tag === 'template') {
  37691. slotScope = getAndRemoveAttr(el, 'scope');
  37692. /* istanbul ignore if */
  37693. if (slotScope) {
  37694. warn$2(
  37695. "the \"scope\" attribute for scoped slots have been deprecated and " +
  37696. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  37697. "can also be used on plain elements in addition to <template> to " +
  37698. "denote scoped slots.",
  37699. el.rawAttrsMap['scope'],
  37700. true
  37701. );
  37702. }
  37703. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  37704. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  37705. /* istanbul ignore if */
  37706. if (el.attrsMap['v-for']) {
  37707. warn$2(
  37708. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  37709. "(v-for takes higher priority). Use a wrapper <template> for the " +
  37710. "scoped slot to make it clearer.",
  37711. el.rawAttrsMap['slot-scope'],
  37712. true
  37713. );
  37714. }
  37715. el.slotScope = slotScope;
  37716. }
  37717. // slot="xxx"
  37718. var slotTarget = getBindingAttr(el, 'slot');
  37719. if (slotTarget) {
  37720. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  37721. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  37722. // preserve slot as an attribute for native shadow DOM compat
  37723. // only for non-scoped slots.
  37724. if (el.tag !== 'template' && !el.slotScope) {
  37725. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  37726. }
  37727. }
  37728. // 2.6 v-slot syntax
  37729. {
  37730. if (el.tag === 'template') {
  37731. // v-slot on <template>
  37732. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  37733. if (slotBinding) {
  37734. {
  37735. if (el.slotTarget || el.slotScope) {
  37736. warn$2(
  37737. "Unexpected mixed usage of different slot syntaxes.",
  37738. el
  37739. );
  37740. }
  37741. if (el.parent && !maybeComponent(el.parent)) {
  37742. warn$2(
  37743. "<template v-slot> can only appear at the root level inside " +
  37744. "the receiving component",
  37745. el
  37746. );
  37747. }
  37748. }
  37749. var ref = getSlotName(slotBinding);
  37750. var name = ref.name;
  37751. var dynamic = ref.dynamic;
  37752. el.slotTarget = name;
  37753. el.slotTargetDynamic = dynamic;
  37754. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  37755. }
  37756. } else {
  37757. // v-slot on component, denotes default slot
  37758. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  37759. if (slotBinding$1) {
  37760. {
  37761. if (!maybeComponent(el)) {
  37762. warn$2(
  37763. "v-slot can only be used on components or <template>.",
  37764. slotBinding$1
  37765. );
  37766. }
  37767. if (el.slotScope || el.slotTarget) {
  37768. warn$2(
  37769. "Unexpected mixed usage of different slot syntaxes.",
  37770. el
  37771. );
  37772. }
  37773. if (el.scopedSlots) {
  37774. warn$2(
  37775. "To avoid scope ambiguity, the default slot should also use " +
  37776. "<template> syntax when there are other named slots.",
  37777. slotBinding$1
  37778. );
  37779. }
  37780. }
  37781. // add the component's children to its default slot
  37782. var slots = el.scopedSlots || (el.scopedSlots = {});
  37783. var ref$1 = getSlotName(slotBinding$1);
  37784. var name$1 = ref$1.name;
  37785. var dynamic$1 = ref$1.dynamic;
  37786. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  37787. slotContainer.slotTarget = name$1;
  37788. slotContainer.slotTargetDynamic = dynamic$1;
  37789. slotContainer.children = el.children.filter(function (c) {
  37790. if (!c.slotScope) {
  37791. c.parent = slotContainer;
  37792. return true
  37793. }
  37794. });
  37795. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  37796. // remove children as they are returned from scopedSlots now
  37797. el.children = [];
  37798. // mark el non-plain so data gets generated
  37799. el.plain = false;
  37800. }
  37801. }
  37802. }
  37803. }
  37804. function getSlotName (binding) {
  37805. var name = binding.name.replace(slotRE, '');
  37806. if (!name) {
  37807. if (binding.name[0] !== '#') {
  37808. name = 'default';
  37809. } else {
  37810. warn$2(
  37811. "v-slot shorthand syntax requires a slot name.",
  37812. binding
  37813. );
  37814. }
  37815. }
  37816. return dynamicArgRE.test(name)
  37817. // dynamic [name]
  37818. ? { name: name.slice(1, -1), dynamic: true }
  37819. // static name
  37820. : { name: ("\"" + name + "\""), dynamic: false }
  37821. }
  37822. // handle <slot/> outlets
  37823. function processSlotOutlet (el) {
  37824. if (el.tag === 'slot') {
  37825. el.slotName = getBindingAttr(el, 'name');
  37826. if (el.key) {
  37827. warn$2(
  37828. "`key` does not work on <slot> because slots are abstract outlets " +
  37829. "and can possibly expand into multiple elements. " +
  37830. "Use the key on a wrapping element instead.",
  37831. getRawBindingAttr(el, 'key')
  37832. );
  37833. }
  37834. }
  37835. }
  37836. function processComponent (el) {
  37837. var binding;
  37838. if ((binding = getBindingAttr(el, 'is'))) {
  37839. el.component = binding;
  37840. }
  37841. if (getAndRemoveAttr(el, 'inline-template') != null) {
  37842. el.inlineTemplate = true;
  37843. }
  37844. }
  37845. function processAttrs (el) {
  37846. var list = el.attrsList;
  37847. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  37848. for (i = 0, l = list.length; i < l; i++) {
  37849. name = rawName = list[i].name;
  37850. value = list[i].value;
  37851. if (dirRE.test(name)) {
  37852. // mark element as dynamic
  37853. el.hasBindings = true;
  37854. // modifiers
  37855. modifiers = parseModifiers(name.replace(dirRE, ''));
  37856. // support .foo shorthand syntax for the .prop modifier
  37857. if (modifiers) {
  37858. name = name.replace(modifierRE, '');
  37859. }
  37860. if (bindRE.test(name)) { // v-bind
  37861. name = name.replace(bindRE, '');
  37862. value = parseFilters(value);
  37863. isDynamic = dynamicArgRE.test(name);
  37864. if (isDynamic) {
  37865. name = name.slice(1, -1);
  37866. }
  37867. if (
  37868. value.trim().length === 0
  37869. ) {
  37870. warn$2(
  37871. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  37872. );
  37873. }
  37874. if (modifiers) {
  37875. if (modifiers.prop && !isDynamic) {
  37876. name = camelize(name);
  37877. if (name === 'innerHtml') { name = 'innerHTML'; }
  37878. }
  37879. if (modifiers.camel && !isDynamic) {
  37880. name = camelize(name);
  37881. }
  37882. if (modifiers.sync) {
  37883. syncGen = genAssignmentCode(value, "$event");
  37884. if (!isDynamic) {
  37885. addHandler(
  37886. el,
  37887. ("update:" + (camelize(name))),
  37888. syncGen,
  37889. null,
  37890. false,
  37891. warn$2,
  37892. list[i]
  37893. );
  37894. if (hyphenate(name) !== camelize(name)) {
  37895. addHandler(
  37896. el,
  37897. ("update:" + (hyphenate(name))),
  37898. syncGen,
  37899. null,
  37900. false,
  37901. warn$2,
  37902. list[i]
  37903. );
  37904. }
  37905. } else {
  37906. // handler w/ dynamic event name
  37907. addHandler(
  37908. el,
  37909. ("\"update:\"+(" + name + ")"),
  37910. syncGen,
  37911. null,
  37912. false,
  37913. warn$2,
  37914. list[i],
  37915. true // dynamic
  37916. );
  37917. }
  37918. }
  37919. }
  37920. if ((modifiers && modifiers.prop) || (
  37921. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  37922. )) {
  37923. addProp(el, name, value, list[i], isDynamic);
  37924. } else {
  37925. addAttr(el, name, value, list[i], isDynamic);
  37926. }
  37927. } else if (onRE.test(name)) { // v-on
  37928. name = name.replace(onRE, '');
  37929. isDynamic = dynamicArgRE.test(name);
  37930. if (isDynamic) {
  37931. name = name.slice(1, -1);
  37932. }
  37933. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  37934. } else { // normal directives
  37935. name = name.replace(dirRE, '');
  37936. // parse arg
  37937. var argMatch = name.match(argRE);
  37938. var arg = argMatch && argMatch[1];
  37939. isDynamic = false;
  37940. if (arg) {
  37941. name = name.slice(0, -(arg.length + 1));
  37942. if (dynamicArgRE.test(arg)) {
  37943. arg = arg.slice(1, -1);
  37944. isDynamic = true;
  37945. }
  37946. }
  37947. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  37948. if (name === 'model') {
  37949. checkForAliasModel(el, value);
  37950. }
  37951. }
  37952. } else {
  37953. // literal attribute
  37954. {
  37955. var res = parseText(value, delimiters);
  37956. if (res) {
  37957. warn$2(
  37958. name + "=\"" + value + "\": " +
  37959. 'Interpolation inside attributes has been removed. ' +
  37960. 'Use v-bind or the colon shorthand instead. For example, ' +
  37961. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  37962. list[i]
  37963. );
  37964. }
  37965. }
  37966. addAttr(el, name, JSON.stringify(value), list[i]);
  37967. // #6887 firefox doesn't update muted state if set via attribute
  37968. // even immediately after element creation
  37969. if (!el.component &&
  37970. name === 'muted' &&
  37971. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  37972. addProp(el, name, 'true', list[i]);
  37973. }
  37974. }
  37975. }
  37976. }
  37977. function checkInFor (el) {
  37978. var parent = el;
  37979. while (parent) {
  37980. if (parent.for !== undefined) {
  37981. return true
  37982. }
  37983. parent = parent.parent;
  37984. }
  37985. return false
  37986. }
  37987. function parseModifiers (name) {
  37988. var match = name.match(modifierRE);
  37989. if (match) {
  37990. var ret = {};
  37991. match.forEach(function (m) { ret[m.slice(1)] = true; });
  37992. return ret
  37993. }
  37994. }
  37995. function makeAttrsMap (attrs) {
  37996. var map = {};
  37997. for (var i = 0, l = attrs.length; i < l; i++) {
  37998. if (
  37999. map[attrs[i].name] && !isIE && !isEdge
  38000. ) {
  38001. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  38002. }
  38003. map[attrs[i].name] = attrs[i].value;
  38004. }
  38005. return map
  38006. }
  38007. // for script (e.g. type="x/template") or style, do not decode content
  38008. function isTextTag (el) {
  38009. return el.tag === 'script' || el.tag === 'style'
  38010. }
  38011. function isForbiddenTag (el) {
  38012. return (
  38013. el.tag === 'style' ||
  38014. (el.tag === 'script' && (
  38015. !el.attrsMap.type ||
  38016. el.attrsMap.type === 'text/javascript'
  38017. ))
  38018. )
  38019. }
  38020. var ieNSBug = /^xmlns:NS\d+/;
  38021. var ieNSPrefix = /^NS\d+:/;
  38022. /* istanbul ignore next */
  38023. function guardIESVGBug (attrs) {
  38024. var res = [];
  38025. for (var i = 0; i < attrs.length; i++) {
  38026. var attr = attrs[i];
  38027. if (!ieNSBug.test(attr.name)) {
  38028. attr.name = attr.name.replace(ieNSPrefix, '');
  38029. res.push(attr);
  38030. }
  38031. }
  38032. return res
  38033. }
  38034. function checkForAliasModel (el, value) {
  38035. var _el = el;
  38036. while (_el) {
  38037. if (_el.for && _el.alias === value) {
  38038. warn$2(
  38039. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  38040. "You are binding v-model directly to a v-for iteration alias. " +
  38041. "This will not be able to modify the v-for source array because " +
  38042. "writing to the alias is like modifying a function local variable. " +
  38043. "Consider using an array of objects and use v-model on an object property instead.",
  38044. el.rawAttrsMap['v-model']
  38045. );
  38046. }
  38047. _el = _el.parent;
  38048. }
  38049. }
  38050. /* */
  38051. function preTransformNode (el, options) {
  38052. if (el.tag === 'input') {
  38053. var map = el.attrsMap;
  38054. if (!map['v-model']) {
  38055. return
  38056. }
  38057. var typeBinding;
  38058. if (map[':type'] || map['v-bind:type']) {
  38059. typeBinding = getBindingAttr(el, 'type');
  38060. }
  38061. if (!map.type && !typeBinding && map['v-bind']) {
  38062. typeBinding = "(" + (map['v-bind']) + ").type";
  38063. }
  38064. if (typeBinding) {
  38065. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  38066. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  38067. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  38068. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  38069. // 1. checkbox
  38070. var branch0 = cloneASTElement(el);
  38071. // process for on the main node
  38072. processFor(branch0);
  38073. addRawAttr(branch0, 'type', 'checkbox');
  38074. processElement(branch0, options);
  38075. branch0.processed = true; // prevent it from double-processed
  38076. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  38077. addIfCondition(branch0, {
  38078. exp: branch0.if,
  38079. block: branch0
  38080. });
  38081. // 2. add radio else-if condition
  38082. var branch1 = cloneASTElement(el);
  38083. getAndRemoveAttr(branch1, 'v-for', true);
  38084. addRawAttr(branch1, 'type', 'radio');
  38085. processElement(branch1, options);
  38086. addIfCondition(branch0, {
  38087. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  38088. block: branch1
  38089. });
  38090. // 3. other
  38091. var branch2 = cloneASTElement(el);
  38092. getAndRemoveAttr(branch2, 'v-for', true);
  38093. addRawAttr(branch2, ':type', typeBinding);
  38094. processElement(branch2, options);
  38095. addIfCondition(branch0, {
  38096. exp: ifCondition,
  38097. block: branch2
  38098. });
  38099. if (hasElse) {
  38100. branch0.else = true;
  38101. } else if (elseIfCondition) {
  38102. branch0.elseif = elseIfCondition;
  38103. }
  38104. return branch0
  38105. }
  38106. }
  38107. }
  38108. function cloneASTElement (el) {
  38109. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  38110. }
  38111. var model$1 = {
  38112. preTransformNode: preTransformNode
  38113. };
  38114. var modules$1 = [
  38115. klass$1,
  38116. style$1,
  38117. model$1
  38118. ];
  38119. /* */
  38120. function text (el, dir) {
  38121. if (dir.value) {
  38122. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  38123. }
  38124. }
  38125. /* */
  38126. function html (el, dir) {
  38127. if (dir.value) {
  38128. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  38129. }
  38130. }
  38131. var directives$1 = {
  38132. model: model,
  38133. text: text,
  38134. html: html
  38135. };
  38136. /* */
  38137. var baseOptions = {
  38138. expectHTML: true,
  38139. modules: modules$1,
  38140. directives: directives$1,
  38141. isPreTag: isPreTag,
  38142. isUnaryTag: isUnaryTag,
  38143. mustUseProp: mustUseProp,
  38144. canBeLeftOpenTag: canBeLeftOpenTag,
  38145. isReservedTag: isReservedTag,
  38146. getTagNamespace: getTagNamespace,
  38147. staticKeys: genStaticKeys(modules$1)
  38148. };
  38149. /* */
  38150. var isStaticKey;
  38151. var isPlatformReservedTag;
  38152. var genStaticKeysCached = cached(genStaticKeys$1);
  38153. /**
  38154. * Goal of the optimizer: walk the generated template AST tree
  38155. * and detect sub-trees that are purely static, i.e. parts of
  38156. * the DOM that never needs to change.
  38157. *
  38158. * Once we detect these sub-trees, we can:
  38159. *
  38160. * 1. Hoist them into constants, so that we no longer need to
  38161. * create fresh nodes for them on each re-render;
  38162. * 2. Completely skip them in the patching process.
  38163. */
  38164. function optimize (root, options) {
  38165. if (!root) { return }
  38166. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  38167. isPlatformReservedTag = options.isReservedTag || no;
  38168. // first pass: mark all non-static nodes.
  38169. markStatic$1(root);
  38170. // second pass: mark static roots.
  38171. markStaticRoots(root, false);
  38172. }
  38173. function genStaticKeys$1 (keys) {
  38174. return makeMap(
  38175. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  38176. (keys ? ',' + keys : '')
  38177. )
  38178. }
  38179. function markStatic$1 (node) {
  38180. node.static = isStatic(node);
  38181. if (node.type === 1) {
  38182. // do not make component slot content static. this avoids
  38183. // 1. components not able to mutate slot nodes
  38184. // 2. static slot content fails for hot-reloading
  38185. if (
  38186. !isPlatformReservedTag(node.tag) &&
  38187. node.tag !== 'slot' &&
  38188. node.attrsMap['inline-template'] == null
  38189. ) {
  38190. return
  38191. }
  38192. for (var i = 0, l = node.children.length; i < l; i++) {
  38193. var child = node.children[i];
  38194. markStatic$1(child);
  38195. if (!child.static) {
  38196. node.static = false;
  38197. }
  38198. }
  38199. if (node.ifConditions) {
  38200. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  38201. var block = node.ifConditions[i$1].block;
  38202. markStatic$1(block);
  38203. if (!block.static) {
  38204. node.static = false;
  38205. }
  38206. }
  38207. }
  38208. }
  38209. }
  38210. function markStaticRoots (node, isInFor) {
  38211. if (node.type === 1) {
  38212. if (node.static || node.once) {
  38213. node.staticInFor = isInFor;
  38214. }
  38215. // For a node to qualify as a static root, it should have children that
  38216. // are not just static text. Otherwise the cost of hoisting out will
  38217. // outweigh the benefits and it's better off to just always render it fresh.
  38218. if (node.static && node.children.length && !(
  38219. node.children.length === 1 &&
  38220. node.children[0].type === 3
  38221. )) {
  38222. node.staticRoot = true;
  38223. return
  38224. } else {
  38225. node.staticRoot = false;
  38226. }
  38227. if (node.children) {
  38228. for (var i = 0, l = node.children.length; i < l; i++) {
  38229. markStaticRoots(node.children[i], isInFor || !!node.for);
  38230. }
  38231. }
  38232. if (node.ifConditions) {
  38233. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  38234. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  38235. }
  38236. }
  38237. }
  38238. }
  38239. function isStatic (node) {
  38240. if (node.type === 2) { // expression
  38241. return false
  38242. }
  38243. if (node.type === 3) { // text
  38244. return true
  38245. }
  38246. return !!(node.pre || (
  38247. !node.hasBindings && // no dynamic bindings
  38248. !node.if && !node.for && // not v-if or v-for or v-else
  38249. !isBuiltInTag(node.tag) && // not a built-in
  38250. isPlatformReservedTag(node.tag) && // not a component
  38251. !isDirectChildOfTemplateFor(node) &&
  38252. Object.keys(node).every(isStaticKey)
  38253. ))
  38254. }
  38255. function isDirectChildOfTemplateFor (node) {
  38256. while (node.parent) {
  38257. node = node.parent;
  38258. if (node.tag !== 'template') {
  38259. return false
  38260. }
  38261. if (node.for) {
  38262. return true
  38263. }
  38264. }
  38265. return false
  38266. }
  38267. /* */
  38268. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  38269. var fnInvokeRE = /\([^)]*?\);*$/;
  38270. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  38271. // KeyboardEvent.keyCode aliases
  38272. var keyCodes = {
  38273. esc: 27,
  38274. tab: 9,
  38275. enter: 13,
  38276. space: 32,
  38277. up: 38,
  38278. left: 37,
  38279. right: 39,
  38280. down: 40,
  38281. 'delete': [8, 46]
  38282. };
  38283. // KeyboardEvent.key aliases
  38284. var keyNames = {
  38285. // #7880: IE11 and Edge use `Esc` for Escape key name.
  38286. esc: ['Esc', 'Escape'],
  38287. tab: 'Tab',
  38288. enter: 'Enter',
  38289. // #9112: IE11 uses `Spacebar` for Space key name.
  38290. space: [' ', 'Spacebar'],
  38291. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  38292. up: ['Up', 'ArrowUp'],
  38293. left: ['Left', 'ArrowLeft'],
  38294. right: ['Right', 'ArrowRight'],
  38295. down: ['Down', 'ArrowDown'],
  38296. // #9112: IE11 uses `Del` for Delete key name.
  38297. 'delete': ['Backspace', 'Delete', 'Del']
  38298. };
  38299. // #4868: modifiers that prevent the execution of the listener
  38300. // need to explicitly return null so that we can determine whether to remove
  38301. // the listener for .once
  38302. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  38303. var modifierCode = {
  38304. stop: '$event.stopPropagation();',
  38305. prevent: '$event.preventDefault();',
  38306. self: genGuard("$event.target !== $event.currentTarget"),
  38307. ctrl: genGuard("!$event.ctrlKey"),
  38308. shift: genGuard("!$event.shiftKey"),
  38309. alt: genGuard("!$event.altKey"),
  38310. meta: genGuard("!$event.metaKey"),
  38311. left: genGuard("'button' in $event && $event.button !== 0"),
  38312. middle: genGuard("'button' in $event && $event.button !== 1"),
  38313. right: genGuard("'button' in $event && $event.button !== 2")
  38314. };
  38315. function genHandlers (
  38316. events,
  38317. isNative
  38318. ) {
  38319. var prefix = isNative ? 'nativeOn:' : 'on:';
  38320. var staticHandlers = "";
  38321. var dynamicHandlers = "";
  38322. for (var name in events) {
  38323. var handlerCode = genHandler(events[name]);
  38324. if (events[name] && events[name].dynamic) {
  38325. dynamicHandlers += name + "," + handlerCode + ",";
  38326. } else {
  38327. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  38328. }
  38329. }
  38330. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  38331. if (dynamicHandlers) {
  38332. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  38333. } else {
  38334. return prefix + staticHandlers
  38335. }
  38336. }
  38337. function genHandler (handler) {
  38338. if (!handler) {
  38339. return 'function(){}'
  38340. }
  38341. if (Array.isArray(handler)) {
  38342. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  38343. }
  38344. var isMethodPath = simplePathRE.test(handler.value);
  38345. var isFunctionExpression = fnExpRE.test(handler.value);
  38346. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  38347. if (!handler.modifiers) {
  38348. if (isMethodPath || isFunctionExpression) {
  38349. return handler.value
  38350. }
  38351. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  38352. } else {
  38353. var code = '';
  38354. var genModifierCode = '';
  38355. var keys = [];
  38356. for (var key in handler.modifiers) {
  38357. if (modifierCode[key]) {
  38358. genModifierCode += modifierCode[key];
  38359. // left/right
  38360. if (keyCodes[key]) {
  38361. keys.push(key);
  38362. }
  38363. } else if (key === 'exact') {
  38364. var modifiers = (handler.modifiers);
  38365. genModifierCode += genGuard(
  38366. ['ctrl', 'shift', 'alt', 'meta']
  38367. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  38368. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  38369. .join('||')
  38370. );
  38371. } else {
  38372. keys.push(key);
  38373. }
  38374. }
  38375. if (keys.length) {
  38376. code += genKeyFilter(keys);
  38377. }
  38378. // Make sure modifiers like prevent and stop get executed after key filtering
  38379. if (genModifierCode) {
  38380. code += genModifierCode;
  38381. }
  38382. var handlerCode = isMethodPath
  38383. ? ("return " + (handler.value) + "($event)")
  38384. : isFunctionExpression
  38385. ? ("return (" + (handler.value) + ")($event)")
  38386. : isFunctionInvocation
  38387. ? ("return " + (handler.value))
  38388. : handler.value;
  38389. return ("function($event){" + code + handlerCode + "}")
  38390. }
  38391. }
  38392. function genKeyFilter (keys) {
  38393. return (
  38394. // make sure the key filters only apply to KeyboardEvents
  38395. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  38396. // key events that do not have keyCode property...
  38397. "if(!$event.type.indexOf('key')&&" +
  38398. (keys.map(genFilterCode).join('&&')) + ")return null;"
  38399. )
  38400. }
  38401. function genFilterCode (key) {
  38402. var keyVal = parseInt(key, 10);
  38403. if (keyVal) {
  38404. return ("$event.keyCode!==" + keyVal)
  38405. }
  38406. var keyCode = keyCodes[key];
  38407. var keyName = keyNames[key];
  38408. return (
  38409. "_k($event.keyCode," +
  38410. (JSON.stringify(key)) + "," +
  38411. (JSON.stringify(keyCode)) + "," +
  38412. "$event.key," +
  38413. "" + (JSON.stringify(keyName)) +
  38414. ")"
  38415. )
  38416. }
  38417. /* */
  38418. function on (el, dir) {
  38419. if (dir.modifiers) {
  38420. warn("v-on without argument does not support modifiers.");
  38421. }
  38422. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  38423. }
  38424. /* */
  38425. function bind$1 (el, dir) {
  38426. el.wrapData = function (code) {
  38427. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  38428. };
  38429. }
  38430. /* */
  38431. var baseDirectives = {
  38432. on: on,
  38433. bind: bind$1,
  38434. cloak: noop
  38435. };
  38436. /* */
  38437. var CodegenState = function CodegenState (options) {
  38438. this.options = options;
  38439. this.warn = options.warn || baseWarn;
  38440. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  38441. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  38442. this.directives = extend(extend({}, baseDirectives), options.directives);
  38443. var isReservedTag = options.isReservedTag || no;
  38444. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  38445. this.onceId = 0;
  38446. this.staticRenderFns = [];
  38447. this.pre = false;
  38448. };
  38449. function generate (
  38450. ast,
  38451. options
  38452. ) {
  38453. var state = new CodegenState(options);
  38454. var code = ast ? genElement(ast, state) : '_c("div")';
  38455. return {
  38456. render: ("with(this){return " + code + "}"),
  38457. staticRenderFns: state.staticRenderFns
  38458. }
  38459. }
  38460. function genElement (el, state) {
  38461. if (el.parent) {
  38462. el.pre = el.pre || el.parent.pre;
  38463. }
  38464. if (el.staticRoot && !el.staticProcessed) {
  38465. return genStatic(el, state)
  38466. } else if (el.once && !el.onceProcessed) {
  38467. return genOnce(el, state)
  38468. } else if (el.for && !el.forProcessed) {
  38469. return genFor(el, state)
  38470. } else if (el.if && !el.ifProcessed) {
  38471. return genIf(el, state)
  38472. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  38473. return genChildren(el, state) || 'void 0'
  38474. } else if (el.tag === 'slot') {
  38475. return genSlot(el, state)
  38476. } else {
  38477. // component or element
  38478. var code;
  38479. if (el.component) {
  38480. code = genComponent(el.component, el, state);
  38481. } else {
  38482. var data;
  38483. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  38484. data = genData$2(el, state);
  38485. }
  38486. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  38487. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  38488. }
  38489. // module transforms
  38490. for (var i = 0; i < state.transforms.length; i++) {
  38491. code = state.transforms[i](el, code);
  38492. }
  38493. return code
  38494. }
  38495. }
  38496. // hoist static sub-trees out
  38497. function genStatic (el, state) {
  38498. el.staticProcessed = true;
  38499. // Some elements (templates) need to behave differently inside of a v-pre
  38500. // node. All pre nodes are static roots, so we can use this as a location to
  38501. // wrap a state change and reset it upon exiting the pre node.
  38502. var originalPreState = state.pre;
  38503. if (el.pre) {
  38504. state.pre = el.pre;
  38505. }
  38506. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  38507. state.pre = originalPreState;
  38508. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  38509. }
  38510. // v-once
  38511. function genOnce (el, state) {
  38512. el.onceProcessed = true;
  38513. if (el.if && !el.ifProcessed) {
  38514. return genIf(el, state)
  38515. } else if (el.staticInFor) {
  38516. var key = '';
  38517. var parent = el.parent;
  38518. while (parent) {
  38519. if (parent.for) {
  38520. key = parent.key;
  38521. break
  38522. }
  38523. parent = parent.parent;
  38524. }
  38525. if (!key) {
  38526. state.warn(
  38527. "v-once can only be used inside v-for that is keyed. ",
  38528. el.rawAttrsMap['v-once']
  38529. );
  38530. return genElement(el, state)
  38531. }
  38532. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  38533. } else {
  38534. return genStatic(el, state)
  38535. }
  38536. }
  38537. function genIf (
  38538. el,
  38539. state,
  38540. altGen,
  38541. altEmpty
  38542. ) {
  38543. el.ifProcessed = true; // avoid recursion
  38544. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  38545. }
  38546. function genIfConditions (
  38547. conditions,
  38548. state,
  38549. altGen,
  38550. altEmpty
  38551. ) {
  38552. if (!conditions.length) {
  38553. return altEmpty || '_e()'
  38554. }
  38555. var condition = conditions.shift();
  38556. if (condition.exp) {
  38557. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  38558. } else {
  38559. return ("" + (genTernaryExp(condition.block)))
  38560. }
  38561. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  38562. function genTernaryExp (el) {
  38563. return altGen
  38564. ? altGen(el, state)
  38565. : el.once
  38566. ? genOnce(el, state)
  38567. : genElement(el, state)
  38568. }
  38569. }
  38570. function genFor (
  38571. el,
  38572. state,
  38573. altGen,
  38574. altHelper
  38575. ) {
  38576. var exp = el.for;
  38577. var alias = el.alias;
  38578. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  38579. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  38580. if (state.maybeComponent(el) &&
  38581. el.tag !== 'slot' &&
  38582. el.tag !== 'template' &&
  38583. !el.key
  38584. ) {
  38585. state.warn(
  38586. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  38587. "v-for should have explicit keys. " +
  38588. "See https://vuejs.org/guide/list.html#key for more info.",
  38589. el.rawAttrsMap['v-for'],
  38590. true /* tip */
  38591. );
  38592. }
  38593. el.forProcessed = true; // avoid recursion
  38594. return (altHelper || '_l') + "((" + exp + ")," +
  38595. "function(" + alias + iterator1 + iterator2 + "){" +
  38596. "return " + ((altGen || genElement)(el, state)) +
  38597. '})'
  38598. }
  38599. function genData$2 (el, state) {
  38600. var data = '{';
  38601. // directives first.
  38602. // directives may mutate the el's other properties before they are generated.
  38603. var dirs = genDirectives(el, state);
  38604. if (dirs) { data += dirs + ','; }
  38605. // key
  38606. if (el.key) {
  38607. data += "key:" + (el.key) + ",";
  38608. }
  38609. // ref
  38610. if (el.ref) {
  38611. data += "ref:" + (el.ref) + ",";
  38612. }
  38613. if (el.refInFor) {
  38614. data += "refInFor:true,";
  38615. }
  38616. // pre
  38617. if (el.pre) {
  38618. data += "pre:true,";
  38619. }
  38620. // record original tag name for components using "is" attribute
  38621. if (el.component) {
  38622. data += "tag:\"" + (el.tag) + "\",";
  38623. }
  38624. // module data generation functions
  38625. for (var i = 0; i < state.dataGenFns.length; i++) {
  38626. data += state.dataGenFns[i](el);
  38627. }
  38628. // attributes
  38629. if (el.attrs) {
  38630. data += "attrs:" + (genProps(el.attrs)) + ",";
  38631. }
  38632. // DOM props
  38633. if (el.props) {
  38634. data += "domProps:" + (genProps(el.props)) + ",";
  38635. }
  38636. // event handlers
  38637. if (el.events) {
  38638. data += (genHandlers(el.events, false)) + ",";
  38639. }
  38640. if (el.nativeEvents) {
  38641. data += (genHandlers(el.nativeEvents, true)) + ",";
  38642. }
  38643. // slot target
  38644. // only for non-scoped slots
  38645. if (el.slotTarget && !el.slotScope) {
  38646. data += "slot:" + (el.slotTarget) + ",";
  38647. }
  38648. // scoped slots
  38649. if (el.scopedSlots) {
  38650. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  38651. }
  38652. // component v-model
  38653. if (el.model) {
  38654. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  38655. }
  38656. // inline-template
  38657. if (el.inlineTemplate) {
  38658. var inlineTemplate = genInlineTemplate(el, state);
  38659. if (inlineTemplate) {
  38660. data += inlineTemplate + ",";
  38661. }
  38662. }
  38663. data = data.replace(/,$/, '') + '}';
  38664. // v-bind dynamic argument wrap
  38665. // v-bind with dynamic arguments must be applied using the same v-bind object
  38666. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  38667. if (el.dynamicAttrs) {
  38668. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  38669. }
  38670. // v-bind data wrap
  38671. if (el.wrapData) {
  38672. data = el.wrapData(data);
  38673. }
  38674. // v-on data wrap
  38675. if (el.wrapListeners) {
  38676. data = el.wrapListeners(data);
  38677. }
  38678. return data
  38679. }
  38680. function genDirectives (el, state) {
  38681. var dirs = el.directives;
  38682. if (!dirs) { return }
  38683. var res = 'directives:[';
  38684. var hasRuntime = false;
  38685. var i, l, dir, needRuntime;
  38686. for (i = 0, l = dirs.length; i < l; i++) {
  38687. dir = dirs[i];
  38688. needRuntime = true;
  38689. var gen = state.directives[dir.name];
  38690. if (gen) {
  38691. // compile-time directive that manipulates AST.
  38692. // returns true if it also needs a runtime counterpart.
  38693. needRuntime = !!gen(el, dir, state.warn);
  38694. }
  38695. if (needRuntime) {
  38696. hasRuntime = true;
  38697. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  38698. }
  38699. }
  38700. if (hasRuntime) {
  38701. return res.slice(0, -1) + ']'
  38702. }
  38703. }
  38704. function genInlineTemplate (el, state) {
  38705. var ast = el.children[0];
  38706. if (el.children.length !== 1 || ast.type !== 1) {
  38707. state.warn(
  38708. 'Inline-template components must have exactly one child element.',
  38709. { start: el.start }
  38710. );
  38711. }
  38712. if (ast && ast.type === 1) {
  38713. var inlineRenderFns = generate(ast, state.options);
  38714. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  38715. }
  38716. }
  38717. function genScopedSlots (
  38718. el,
  38719. slots,
  38720. state
  38721. ) {
  38722. // by default scoped slots are considered "stable", this allows child
  38723. // components with only scoped slots to skip forced updates from parent.
  38724. // but in some cases we have to bail-out of this optimization
  38725. // for example if the slot contains dynamic names, has v-if or v-for on them...
  38726. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  38727. var slot = slots[key];
  38728. return (
  38729. slot.slotTargetDynamic ||
  38730. slot.if ||
  38731. slot.for ||
  38732. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  38733. )
  38734. });
  38735. // #9534: if a component with scoped slots is inside a conditional branch,
  38736. // it's possible for the same component to be reused but with different
  38737. // compiled slot content. To avoid that, we generate a unique key based on
  38738. // the generated code of all the slot contents.
  38739. var needsKey = !!el.if;
  38740. // OR when it is inside another scoped slot or v-for (the reactivity may be
  38741. // disconnected due to the intermediate scope variable)
  38742. // #9438, #9506
  38743. // TODO: this can be further optimized by properly analyzing in-scope bindings
  38744. // and skip force updating ones that do not actually use scope variables.
  38745. if (!needsForceUpdate) {
  38746. var parent = el.parent;
  38747. while (parent) {
  38748. if (
  38749. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  38750. parent.for
  38751. ) {
  38752. needsForceUpdate = true;
  38753. break
  38754. }
  38755. if (parent.if) {
  38756. needsKey = true;
  38757. }
  38758. parent = parent.parent;
  38759. }
  38760. }
  38761. var generatedSlots = Object.keys(slots)
  38762. .map(function (key) { return genScopedSlot(slots[key], state); })
  38763. .join(',');
  38764. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  38765. }
  38766. function hash(str) {
  38767. var hash = 5381;
  38768. var i = str.length;
  38769. while(i) {
  38770. hash = (hash * 33) ^ str.charCodeAt(--i);
  38771. }
  38772. return hash >>> 0
  38773. }
  38774. function containsSlotChild (el) {
  38775. if (el.type === 1) {
  38776. if (el.tag === 'slot') {
  38777. return true
  38778. }
  38779. return el.children.some(containsSlotChild)
  38780. }
  38781. return false
  38782. }
  38783. function genScopedSlot (
  38784. el,
  38785. state
  38786. ) {
  38787. var isLegacySyntax = el.attrsMap['slot-scope'];
  38788. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  38789. return genIf(el, state, genScopedSlot, "null")
  38790. }
  38791. if (el.for && !el.forProcessed) {
  38792. return genFor(el, state, genScopedSlot)
  38793. }
  38794. var slotScope = el.slotScope === emptySlotScopeToken
  38795. ? ""
  38796. : String(el.slotScope);
  38797. var fn = "function(" + slotScope + "){" +
  38798. "return " + (el.tag === 'template'
  38799. ? el.if && isLegacySyntax
  38800. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  38801. : genChildren(el, state) || 'undefined'
  38802. : genElement(el, state)) + "}";
  38803. // reverse proxy v-slot without scope on this.$slots
  38804. var reverseProxy = slotScope ? "" : ",proxy:true";
  38805. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  38806. }
  38807. function genChildren (
  38808. el,
  38809. state,
  38810. checkSkip,
  38811. altGenElement,
  38812. altGenNode
  38813. ) {
  38814. var children = el.children;
  38815. if (children.length) {
  38816. var el$1 = children[0];
  38817. // optimize single v-for
  38818. if (children.length === 1 &&
  38819. el$1.for &&
  38820. el$1.tag !== 'template' &&
  38821. el$1.tag !== 'slot'
  38822. ) {
  38823. var normalizationType = checkSkip
  38824. ? state.maybeComponent(el$1) ? ",1" : ",0"
  38825. : "";
  38826. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  38827. }
  38828. var normalizationType$1 = checkSkip
  38829. ? getNormalizationType(children, state.maybeComponent)
  38830. : 0;
  38831. var gen = altGenNode || genNode;
  38832. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  38833. }
  38834. }
  38835. // determine the normalization needed for the children array.
  38836. // 0: no normalization needed
  38837. // 1: simple normalization needed (possible 1-level deep nested array)
  38838. // 2: full normalization needed
  38839. function getNormalizationType (
  38840. children,
  38841. maybeComponent
  38842. ) {
  38843. var res = 0;
  38844. for (var i = 0; i < children.length; i++) {
  38845. var el = children[i];
  38846. if (el.type !== 1) {
  38847. continue
  38848. }
  38849. if (needsNormalization(el) ||
  38850. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  38851. res = 2;
  38852. break
  38853. }
  38854. if (maybeComponent(el) ||
  38855. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  38856. res = 1;
  38857. }
  38858. }
  38859. return res
  38860. }
  38861. function needsNormalization (el) {
  38862. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  38863. }
  38864. function genNode (node, state) {
  38865. if (node.type === 1) {
  38866. return genElement(node, state)
  38867. } else if (node.type === 3 && node.isComment) {
  38868. return genComment(node)
  38869. } else {
  38870. return genText(node)
  38871. }
  38872. }
  38873. function genText (text) {
  38874. return ("_v(" + (text.type === 2
  38875. ? text.expression // no need for () because already wrapped in _s()
  38876. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  38877. }
  38878. function genComment (comment) {
  38879. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  38880. }
  38881. function genSlot (el, state) {
  38882. var slotName = el.slotName || '"default"';
  38883. var children = genChildren(el, state);
  38884. var res = "_t(" + slotName + (children ? ("," + children) : '');
  38885. var attrs = el.attrs || el.dynamicAttrs
  38886. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  38887. // slot props are camelized
  38888. name: camelize(attr.name),
  38889. value: attr.value,
  38890. dynamic: attr.dynamic
  38891. }); }))
  38892. : null;
  38893. var bind$$1 = el.attrsMap['v-bind'];
  38894. if ((attrs || bind$$1) && !children) {
  38895. res += ",null";
  38896. }
  38897. if (attrs) {
  38898. res += "," + attrs;
  38899. }
  38900. if (bind$$1) {
  38901. res += (attrs ? '' : ',null') + "," + bind$$1;
  38902. }
  38903. return res + ')'
  38904. }
  38905. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  38906. function genComponent (
  38907. componentName,
  38908. el,
  38909. state
  38910. ) {
  38911. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  38912. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  38913. }
  38914. function genProps (props) {
  38915. var staticProps = "";
  38916. var dynamicProps = "";
  38917. for (var i = 0; i < props.length; i++) {
  38918. var prop = props[i];
  38919. var value = transformSpecialNewlines(prop.value);
  38920. if (prop.dynamic) {
  38921. dynamicProps += (prop.name) + "," + value + ",";
  38922. } else {
  38923. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  38924. }
  38925. }
  38926. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  38927. if (dynamicProps) {
  38928. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  38929. } else {
  38930. return staticProps
  38931. }
  38932. }
  38933. // #3895, #4268
  38934. function transformSpecialNewlines (text) {
  38935. return text
  38936. .replace(/\u2028/g, '\\u2028')
  38937. .replace(/\u2029/g, '\\u2029')
  38938. }
  38939. /* */
  38940. // these keywords should not appear inside expressions, but operators like
  38941. // typeof, instanceof and in are allowed
  38942. var prohibitedKeywordRE = new RegExp('\\b' + (
  38943. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  38944. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  38945. 'extends,finally,continue,debugger,function,arguments'
  38946. ).split(',').join('\\b|\\b') + '\\b');
  38947. // these unary operators should not be used as property/method names
  38948. var unaryOperatorsRE = new RegExp('\\b' + (
  38949. 'delete,typeof,void'
  38950. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  38951. // strip strings in expressions
  38952. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  38953. // detect problematic expressions in a template
  38954. function detectErrors (ast, warn) {
  38955. if (ast) {
  38956. checkNode(ast, warn);
  38957. }
  38958. }
  38959. function checkNode (node, warn) {
  38960. if (node.type === 1) {
  38961. for (var name in node.attrsMap) {
  38962. if (dirRE.test(name)) {
  38963. var value = node.attrsMap[name];
  38964. if (value) {
  38965. var range = node.rawAttrsMap[name];
  38966. if (name === 'v-for') {
  38967. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  38968. } else if (name === 'v-slot' || name[0] === '#') {
  38969. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  38970. } else if (onRE.test(name)) {
  38971. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  38972. } else {
  38973. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  38974. }
  38975. }
  38976. }
  38977. }
  38978. if (node.children) {
  38979. for (var i = 0; i < node.children.length; i++) {
  38980. checkNode(node.children[i], warn);
  38981. }
  38982. }
  38983. } else if (node.type === 2) {
  38984. checkExpression(node.expression, node.text, warn, node);
  38985. }
  38986. }
  38987. function checkEvent (exp, text, warn, range) {
  38988. var stripped = exp.replace(stripStringRE, '');
  38989. var keywordMatch = stripped.match(unaryOperatorsRE);
  38990. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  38991. warn(
  38992. "avoid using JavaScript unary operator as property name: " +
  38993. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  38994. range
  38995. );
  38996. }
  38997. checkExpression(exp, text, warn, range);
  38998. }
  38999. function checkFor (node, text, warn, range) {
  39000. checkExpression(node.for || '', text, warn, range);
  39001. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  39002. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  39003. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  39004. }
  39005. function checkIdentifier (
  39006. ident,
  39007. type,
  39008. text,
  39009. warn,
  39010. range
  39011. ) {
  39012. if (typeof ident === 'string') {
  39013. try {
  39014. new Function(("var " + ident + "=_"));
  39015. } catch (e) {
  39016. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  39017. }
  39018. }
  39019. }
  39020. function checkExpression (exp, text, warn, range) {
  39021. try {
  39022. new Function(("return " + exp));
  39023. } catch (e) {
  39024. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  39025. if (keywordMatch) {
  39026. warn(
  39027. "avoid using JavaScript keyword as property name: " +
  39028. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  39029. range
  39030. );
  39031. } else {
  39032. warn(
  39033. "invalid expression: " + (e.message) + " in\n\n" +
  39034. " " + exp + "\n\n" +
  39035. " Raw expression: " + (text.trim()) + "\n",
  39036. range
  39037. );
  39038. }
  39039. }
  39040. }
  39041. function checkFunctionParameterExpression (exp, text, warn, range) {
  39042. try {
  39043. new Function(exp, '');
  39044. } catch (e) {
  39045. warn(
  39046. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  39047. " " + exp + "\n\n" +
  39048. " Raw expression: " + (text.trim()) + "\n",
  39049. range
  39050. );
  39051. }
  39052. }
  39053. /* */
  39054. var range = 2;
  39055. function generateCodeFrame (
  39056. source,
  39057. start,
  39058. end
  39059. ) {
  39060. if ( start === void 0 ) start = 0;
  39061. if ( end === void 0 ) end = source.length;
  39062. var lines = source.split(/\r?\n/);
  39063. var count = 0;
  39064. var res = [];
  39065. for (var i = 0; i < lines.length; i++) {
  39066. count += lines[i].length + 1;
  39067. if (count >= start) {
  39068. for (var j = i - range; j <= i + range || end > count; j++) {
  39069. if (j < 0 || j >= lines.length) { continue }
  39070. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  39071. var lineLength = lines[j].length;
  39072. if (j === i) {
  39073. // push underline
  39074. var pad = start - (count - lineLength) + 1;
  39075. var length = end > count ? lineLength - pad : end - start;
  39076. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  39077. } else if (j > i) {
  39078. if (end > count) {
  39079. var length$1 = Math.min(end - count, lineLength);
  39080. res.push(" | " + repeat$1("^", length$1));
  39081. }
  39082. count += lineLength + 1;
  39083. }
  39084. }
  39085. break
  39086. }
  39087. }
  39088. return res.join('\n')
  39089. }
  39090. function repeat$1 (str, n) {
  39091. var result = '';
  39092. if (n > 0) {
  39093. while (true) { // eslint-disable-line
  39094. if (n & 1) { result += str; }
  39095. n >>>= 1;
  39096. if (n <= 0) { break }
  39097. str += str;
  39098. }
  39099. }
  39100. return result
  39101. }
  39102. /* */
  39103. function createFunction (code, errors) {
  39104. try {
  39105. return new Function(code)
  39106. } catch (err) {
  39107. errors.push({ err: err, code: code });
  39108. return noop
  39109. }
  39110. }
  39111. function createCompileToFunctionFn (compile) {
  39112. var cache = Object.create(null);
  39113. return function compileToFunctions (
  39114. template,
  39115. options,
  39116. vm
  39117. ) {
  39118. options = extend({}, options);
  39119. var warn$$1 = options.warn || warn;
  39120. delete options.warn;
  39121. /* istanbul ignore if */
  39122. {
  39123. // detect possible CSP restriction
  39124. try {
  39125. new Function('return 1');
  39126. } catch (e) {
  39127. if (e.toString().match(/unsafe-eval|CSP/)) {
  39128. warn$$1(
  39129. 'It seems you are using the standalone build of Vue.js in an ' +
  39130. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  39131. 'The template compiler cannot work in this environment. Consider ' +
  39132. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  39133. 'templates into render functions.'
  39134. );
  39135. }
  39136. }
  39137. }
  39138. // check cache
  39139. var key = options.delimiters
  39140. ? String(options.delimiters) + template
  39141. : template;
  39142. if (cache[key]) {
  39143. return cache[key]
  39144. }
  39145. // compile
  39146. var compiled = compile(template, options);
  39147. // check compilation errors/tips
  39148. {
  39149. if (compiled.errors && compiled.errors.length) {
  39150. if (options.outputSourceRange) {
  39151. compiled.errors.forEach(function (e) {
  39152. warn$$1(
  39153. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  39154. generateCodeFrame(template, e.start, e.end),
  39155. vm
  39156. );
  39157. });
  39158. } else {
  39159. warn$$1(
  39160. "Error compiling template:\n\n" + template + "\n\n" +
  39161. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  39162. vm
  39163. );
  39164. }
  39165. }
  39166. if (compiled.tips && compiled.tips.length) {
  39167. if (options.outputSourceRange) {
  39168. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  39169. } else {
  39170. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  39171. }
  39172. }
  39173. }
  39174. // turn code into functions
  39175. var res = {};
  39176. var fnGenErrors = [];
  39177. res.render = createFunction(compiled.render, fnGenErrors);
  39178. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  39179. return createFunction(code, fnGenErrors)
  39180. });
  39181. // check function generation errors.
  39182. // this should only happen if there is a bug in the compiler itself.
  39183. // mostly for codegen development use
  39184. /* istanbul ignore if */
  39185. {
  39186. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  39187. warn$$1(
  39188. "Failed to generate render function:\n\n" +
  39189. fnGenErrors.map(function (ref) {
  39190. var err = ref.err;
  39191. var code = ref.code;
  39192. return ((err.toString()) + " in\n\n" + code + "\n");
  39193. }).join('\n'),
  39194. vm
  39195. );
  39196. }
  39197. }
  39198. return (cache[key] = res)
  39199. }
  39200. }
  39201. /* */
  39202. function createCompilerCreator (baseCompile) {
  39203. return function createCompiler (baseOptions) {
  39204. function compile (
  39205. template,
  39206. options
  39207. ) {
  39208. var finalOptions = Object.create(baseOptions);
  39209. var errors = [];
  39210. var tips = [];
  39211. var warn = function (msg, range, tip) {
  39212. (tip ? tips : errors).push(msg);
  39213. };
  39214. if (options) {
  39215. if (options.outputSourceRange) {
  39216. // $flow-disable-line
  39217. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  39218. warn = function (msg, range, tip) {
  39219. var data = { msg: msg };
  39220. if (range) {
  39221. if (range.start != null) {
  39222. data.start = range.start + leadingSpaceLength;
  39223. }
  39224. if (range.end != null) {
  39225. data.end = range.end + leadingSpaceLength;
  39226. }
  39227. }
  39228. (tip ? tips : errors).push(data);
  39229. };
  39230. }
  39231. // merge custom modules
  39232. if (options.modules) {
  39233. finalOptions.modules =
  39234. (baseOptions.modules || []).concat(options.modules);
  39235. }
  39236. // merge custom directives
  39237. if (options.directives) {
  39238. finalOptions.directives = extend(
  39239. Object.create(baseOptions.directives || null),
  39240. options.directives
  39241. );
  39242. }
  39243. // copy other options
  39244. for (var key in options) {
  39245. if (key !== 'modules' && key !== 'directives') {
  39246. finalOptions[key] = options[key];
  39247. }
  39248. }
  39249. }
  39250. finalOptions.warn = warn;
  39251. var compiled = baseCompile(template.trim(), finalOptions);
  39252. {
  39253. detectErrors(compiled.ast, warn);
  39254. }
  39255. compiled.errors = errors;
  39256. compiled.tips = tips;
  39257. return compiled
  39258. }
  39259. return {
  39260. compile: compile,
  39261. compileToFunctions: createCompileToFunctionFn(compile)
  39262. }
  39263. }
  39264. }
  39265. /* */
  39266. // `createCompilerCreator` allows creating compilers that use alternative
  39267. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  39268. // Here we just export a default compiler using the default parts.
  39269. var createCompiler = createCompilerCreator(function baseCompile (
  39270. template,
  39271. options
  39272. ) {
  39273. var ast = parse(template.trim(), options);
  39274. if (options.optimize !== false) {
  39275. optimize(ast, options);
  39276. }
  39277. var code = generate(ast, options);
  39278. return {
  39279. ast: ast,
  39280. render: code.render,
  39281. staticRenderFns: code.staticRenderFns
  39282. }
  39283. });
  39284. /* */
  39285. var ref$1 = createCompiler(baseOptions);
  39286. var compile = ref$1.compile;
  39287. var compileToFunctions = ref$1.compileToFunctions;
  39288. /* */
  39289. // check whether current browser encodes a char inside attribute values
  39290. var div;
  39291. function getShouldDecode (href) {
  39292. div = div || document.createElement('div');
  39293. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  39294. return div.innerHTML.indexOf('&#10;') > 0
  39295. }
  39296. // #3663: IE encodes newlines inside attribute values while other browsers don't
  39297. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  39298. // #6828: chrome encodes content in a[href]
  39299. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  39300. /* */
  39301. var idToTemplate = cached(function (id) {
  39302. var el = query(id);
  39303. return el && el.innerHTML
  39304. });
  39305. var mount = Vue.prototype.$mount;
  39306. Vue.prototype.$mount = function (
  39307. el,
  39308. hydrating
  39309. ) {
  39310. el = el && query(el);
  39311. /* istanbul ignore if */
  39312. if (el === document.body || el === document.documentElement) {
  39313. warn(
  39314. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  39315. );
  39316. return this
  39317. }
  39318. var options = this.$options;
  39319. // resolve template/el and convert to render function
  39320. if (!options.render) {
  39321. var template = options.template;
  39322. if (template) {
  39323. if (typeof template === 'string') {
  39324. if (template.charAt(0) === '#') {
  39325. template = idToTemplate(template);
  39326. /* istanbul ignore if */
  39327. if (!template) {
  39328. warn(
  39329. ("Template element not found or is empty: " + (options.template)),
  39330. this
  39331. );
  39332. }
  39333. }
  39334. } else if (template.nodeType) {
  39335. template = template.innerHTML;
  39336. } else {
  39337. {
  39338. warn('invalid template option:' + template, this);
  39339. }
  39340. return this
  39341. }
  39342. } else if (el) {
  39343. template = getOuterHTML(el);
  39344. }
  39345. if (template) {
  39346. /* istanbul ignore if */
  39347. if (config.performance && mark) {
  39348. mark('compile');
  39349. }
  39350. var ref = compileToFunctions(template, {
  39351. outputSourceRange: "development" !== 'production',
  39352. shouldDecodeNewlines: shouldDecodeNewlines,
  39353. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  39354. delimiters: options.delimiters,
  39355. comments: options.comments
  39356. }, this);
  39357. var render = ref.render;
  39358. var staticRenderFns = ref.staticRenderFns;
  39359. options.render = render;
  39360. options.staticRenderFns = staticRenderFns;
  39361. /* istanbul ignore if */
  39362. if (config.performance && mark) {
  39363. mark('compile end');
  39364. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  39365. }
  39366. }
  39367. }
  39368. return mount.call(this, el, hydrating)
  39369. };
  39370. /**
  39371. * Get outerHTML of elements, taking care
  39372. * of SVG elements in IE as well.
  39373. */
  39374. function getOuterHTML (el) {
  39375. if (el.outerHTML) {
  39376. return el.outerHTML
  39377. } else {
  39378. var container = document.createElement('div');
  39379. container.appendChild(el.cloneNode(true));
  39380. return container.innerHTML
  39381. }
  39382. }
  39383. Vue.compile = compileToFunctions;
  39384. module.exports = Vue;
  39385. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(37).setImmediate))
  39386. /***/ }),
  39387. /* 37 */
  39388. /***/ (function(module, exports, __webpack_require__) {
  39389. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  39390. (typeof self !== "undefined" && self) ||
  39391. window;
  39392. var apply = Function.prototype.apply;
  39393. // DOM APIs, for completeness
  39394. exports.setTimeout = function() {
  39395. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  39396. };
  39397. exports.setInterval = function() {
  39398. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  39399. };
  39400. exports.clearTimeout =
  39401. exports.clearInterval = function(timeout) {
  39402. if (timeout) {
  39403. timeout.close();
  39404. }
  39405. };
  39406. function Timeout(id, clearFn) {
  39407. this._id = id;
  39408. this._clearFn = clearFn;
  39409. }
  39410. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  39411. Timeout.prototype.close = function() {
  39412. this._clearFn.call(scope, this._id);
  39413. };
  39414. // Does not start the time, just sets up the members needed.
  39415. exports.enroll = function(item, msecs) {
  39416. clearTimeout(item._idleTimeoutId);
  39417. item._idleTimeout = msecs;
  39418. };
  39419. exports.unenroll = function(item) {
  39420. clearTimeout(item._idleTimeoutId);
  39421. item._idleTimeout = -1;
  39422. };
  39423. exports._unrefActive = exports.active = function(item) {
  39424. clearTimeout(item._idleTimeoutId);
  39425. var msecs = item._idleTimeout;
  39426. if (msecs >= 0) {
  39427. item._idleTimeoutId = setTimeout(function onTimeout() {
  39428. if (item._onTimeout)
  39429. item._onTimeout();
  39430. }, msecs);
  39431. }
  39432. };
  39433. // setimmediate attaches itself to the global object
  39434. __webpack_require__(38);
  39435. // On some exotic environments, it's not clear which object `setimmediate` was
  39436. // able to install onto. Search each possibility in the same order as the
  39437. // `setimmediate` library.
  39438. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  39439. (typeof global !== "undefined" && global.setImmediate) ||
  39440. (this && this.setImmediate);
  39441. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  39442. (typeof global !== "undefined" && global.clearImmediate) ||
  39443. (this && this.clearImmediate);
  39444. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
  39445. /***/ }),
  39446. /* 38 */
  39447. /***/ (function(module, exports, __webpack_require__) {
  39448. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  39449. "use strict";
  39450. if (global.setImmediate) {
  39451. return;
  39452. }
  39453. var nextHandle = 1; // Spec says greater than zero
  39454. var tasksByHandle = {};
  39455. var currentlyRunningATask = false;
  39456. var doc = global.document;
  39457. var registerImmediate;
  39458. function setImmediate(callback) {
  39459. // Callback can either be a function or a string
  39460. if (typeof callback !== "function") {
  39461. callback = new Function("" + callback);
  39462. }
  39463. // Copy function arguments
  39464. var args = new Array(arguments.length - 1);
  39465. for (var i = 0; i < args.length; i++) {
  39466. args[i] = arguments[i + 1];
  39467. }
  39468. // Store and register the task
  39469. var task = { callback: callback, args: args };
  39470. tasksByHandle[nextHandle] = task;
  39471. registerImmediate(nextHandle);
  39472. return nextHandle++;
  39473. }
  39474. function clearImmediate(handle) {
  39475. delete tasksByHandle[handle];
  39476. }
  39477. function run(task) {
  39478. var callback = task.callback;
  39479. var args = task.args;
  39480. switch (args.length) {
  39481. case 0:
  39482. callback();
  39483. break;
  39484. case 1:
  39485. callback(args[0]);
  39486. break;
  39487. case 2:
  39488. callback(args[0], args[1]);
  39489. break;
  39490. case 3:
  39491. callback(args[0], args[1], args[2]);
  39492. break;
  39493. default:
  39494. callback.apply(undefined, args);
  39495. break;
  39496. }
  39497. }
  39498. function runIfPresent(handle) {
  39499. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  39500. // So if we're currently running a task, we'll need to delay this invocation.
  39501. if (currentlyRunningATask) {
  39502. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  39503. // "too much recursion" error.
  39504. setTimeout(runIfPresent, 0, handle);
  39505. } else {
  39506. var task = tasksByHandle[handle];
  39507. if (task) {
  39508. currentlyRunningATask = true;
  39509. try {
  39510. run(task);
  39511. } finally {
  39512. clearImmediate(handle);
  39513. currentlyRunningATask = false;
  39514. }
  39515. }
  39516. }
  39517. }
  39518. function installNextTickImplementation() {
  39519. registerImmediate = function(handle) {
  39520. process.nextTick(function () { runIfPresent(handle); });
  39521. };
  39522. }
  39523. function canUsePostMessage() {
  39524. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  39525. // where `global.postMessage` means something completely different and can't be used for this purpose.
  39526. if (global.postMessage && !global.importScripts) {
  39527. var postMessageIsAsynchronous = true;
  39528. var oldOnMessage = global.onmessage;
  39529. global.onmessage = function() {
  39530. postMessageIsAsynchronous = false;
  39531. };
  39532. global.postMessage("", "*");
  39533. global.onmessage = oldOnMessage;
  39534. return postMessageIsAsynchronous;
  39535. }
  39536. }
  39537. function installPostMessageImplementation() {
  39538. // Installs an event handler on `global` for the `message` event: see
  39539. // * https://developer.mozilla.org/en/DOM/window.postMessage
  39540. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  39541. var messagePrefix = "setImmediate$" + Math.random() + "$";
  39542. var onGlobalMessage = function(event) {
  39543. if (event.source === global &&
  39544. typeof event.data === "string" &&
  39545. event.data.indexOf(messagePrefix) === 0) {
  39546. runIfPresent(+event.data.slice(messagePrefix.length));
  39547. }
  39548. };
  39549. if (global.addEventListener) {
  39550. global.addEventListener("message", onGlobalMessage, false);
  39551. } else {
  39552. global.attachEvent("onmessage", onGlobalMessage);
  39553. }
  39554. registerImmediate = function(handle) {
  39555. global.postMessage(messagePrefix + handle, "*");
  39556. };
  39557. }
  39558. function installMessageChannelImplementation() {
  39559. var channel = new MessageChannel();
  39560. channel.port1.onmessage = function(event) {
  39561. var handle = event.data;
  39562. runIfPresent(handle);
  39563. };
  39564. registerImmediate = function(handle) {
  39565. channel.port2.postMessage(handle);
  39566. };
  39567. }
  39568. function installReadyStateChangeImplementation() {
  39569. var html = doc.documentElement;
  39570. registerImmediate = function(handle) {
  39571. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  39572. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  39573. var script = doc.createElement("script");
  39574. script.onreadystatechange = function () {
  39575. runIfPresent(handle);
  39576. script.onreadystatechange = null;
  39577. html.removeChild(script);
  39578. script = null;
  39579. };
  39580. html.appendChild(script);
  39581. };
  39582. }
  39583. function installSetTimeoutImplementation() {
  39584. registerImmediate = function(handle) {
  39585. setTimeout(runIfPresent, 0, handle);
  39586. };
  39587. }
  39588. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  39589. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  39590. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  39591. // Don't get fooled by e.g. browserify environments.
  39592. if ({}.toString.call(global.process) === "[object process]") {
  39593. // For Node.js before 0.9
  39594. installNextTickImplementation();
  39595. } else if (canUsePostMessage()) {
  39596. // For non-IE10 modern browsers
  39597. installPostMessageImplementation();
  39598. } else if (global.MessageChannel) {
  39599. // For web workers, where supported
  39600. installMessageChannelImplementation();
  39601. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  39602. // For IE 6–8
  39603. installReadyStateChangeImplementation();
  39604. } else {
  39605. // For older browsers
  39606. installSetTimeoutImplementation();
  39607. }
  39608. attachTo.setImmediate = setImmediate;
  39609. attachTo.clearImmediate = clearImmediate;
  39610. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  39611. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(4)))
  39612. /***/ }),
  39613. /* 39 */
  39614. /***/ (function(module, exports, __webpack_require__) {
  39615. var disposed = false
  39616. var normalizeComponent = __webpack_require__(40)
  39617. /* script */
  39618. var __vue_script__ = __webpack_require__(41)
  39619. /* template */
  39620. var __vue_template__ = __webpack_require__(42)
  39621. /* template functional */
  39622. var __vue_template_functional__ = false
  39623. /* styles */
  39624. var __vue_styles__ = null
  39625. /* scopeId */
  39626. var __vue_scopeId__ = null
  39627. /* moduleIdentifier (server only) */
  39628. var __vue_module_identifier__ = null
  39629. var Component = normalizeComponent(
  39630. __vue_script__,
  39631. __vue_template__,
  39632. __vue_template_functional__,
  39633. __vue_styles__,
  39634. __vue_scopeId__,
  39635. __vue_module_identifier__
  39636. )
  39637. Component.options.__file = "resources/assets/js/components/ExampleComponent.vue"
  39638. /* hot reload */
  39639. if (false) {(function () {
  39640. var hotAPI = require("vue-hot-reload-api")
  39641. hotAPI.install(require("vue"), false)
  39642. if (!hotAPI.compatible) return
  39643. module.hot.accept()
  39644. if (!module.hot.data) {
  39645. hotAPI.createRecord("data-v-7168fb6a", Component.options)
  39646. } else {
  39647. hotAPI.reload("data-v-7168fb6a", Component.options)
  39648. }
  39649. module.hot.dispose(function (data) {
  39650. disposed = true
  39651. })
  39652. })()}
  39653. module.exports = Component.exports
  39654. /***/ }),
  39655. /* 40 */
  39656. /***/ (function(module, exports) {
  39657. /* globals __VUE_SSR_CONTEXT__ */
  39658. // IMPORTANT: Do NOT use ES2015 features in this file.
  39659. // This module is a runtime utility for cleaner component module output and will
  39660. // be included in the final webpack user bundle.
  39661. module.exports = function normalizeComponent (
  39662. rawScriptExports,
  39663. compiledTemplate,
  39664. functionalTemplate,
  39665. injectStyles,
  39666. scopeId,
  39667. moduleIdentifier /* server only */
  39668. ) {
  39669. var esModule
  39670. var scriptExports = rawScriptExports = rawScriptExports || {}
  39671. // ES6 modules interop
  39672. var type = typeof rawScriptExports.default
  39673. if (type === 'object' || type === 'function') {
  39674. esModule = rawScriptExports
  39675. scriptExports = rawScriptExports.default
  39676. }
  39677. // Vue.extend constructor export interop
  39678. var options = typeof scriptExports === 'function'
  39679. ? scriptExports.options
  39680. : scriptExports
  39681. // render functions
  39682. if (compiledTemplate) {
  39683. options.render = compiledTemplate.render
  39684. options.staticRenderFns = compiledTemplate.staticRenderFns
  39685. options._compiled = true
  39686. }
  39687. // functional template
  39688. if (functionalTemplate) {
  39689. options.functional = true
  39690. }
  39691. // scopedId
  39692. if (scopeId) {
  39693. options._scopeId = scopeId
  39694. }
  39695. var hook
  39696. if (moduleIdentifier) { // server build
  39697. hook = function (context) {
  39698. // 2.3 injection
  39699. context =
  39700. context || // cached call
  39701. (this.$vnode && this.$vnode.ssrContext) || // stateful
  39702. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  39703. // 2.2 with runInNewContext: true
  39704. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  39705. context = __VUE_SSR_CONTEXT__
  39706. }
  39707. // inject component styles
  39708. if (injectStyles) {
  39709. injectStyles.call(this, context)
  39710. }
  39711. // register component module identifier for async chunk inferrence
  39712. if (context && context._registeredComponents) {
  39713. context._registeredComponents.add(moduleIdentifier)
  39714. }
  39715. }
  39716. // used by ssr in case component is cached and beforeCreate
  39717. // never gets called
  39718. options._ssrRegister = hook
  39719. } else if (injectStyles) {
  39720. hook = injectStyles
  39721. }
  39722. if (hook) {
  39723. var functional = options.functional
  39724. var existing = functional
  39725. ? options.render
  39726. : options.beforeCreate
  39727. if (!functional) {
  39728. // inject component registration as beforeCreate hook
  39729. options.beforeCreate = existing
  39730. ? [].concat(existing, hook)
  39731. : [hook]
  39732. } else {
  39733. // for template-only hot-reload because in that case the render fn doesn't
  39734. // go through the normalizer
  39735. options._injectStyles = hook
  39736. // register for functioal component in vue file
  39737. options.render = function renderWithStyleInjection (h, context) {
  39738. hook.call(context)
  39739. return existing(h, context)
  39740. }
  39741. }
  39742. }
  39743. return {
  39744. esModule: esModule,
  39745. exports: scriptExports,
  39746. options: options
  39747. }
  39748. }
  39749. /***/ }),
  39750. /* 41 */
  39751. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39752. "use strict";
  39753. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  39754. //
  39755. //
  39756. //
  39757. //
  39758. //
  39759. //
  39760. //
  39761. //
  39762. //
  39763. //
  39764. //
  39765. //
  39766. //
  39767. //
  39768. //
  39769. //
  39770. /* harmony default export */ __webpack_exports__["default"] = ({
  39771. mounted: function mounted() {
  39772. console.log('Component mounted.');
  39773. }
  39774. });
  39775. /***/ }),
  39776. /* 42 */
  39777. /***/ (function(module, exports, __webpack_require__) {
  39778. var render = function() {
  39779. var _vm = this
  39780. var _h = _vm.$createElement
  39781. var _c = _vm._self._c || _h
  39782. return _vm._m(0)
  39783. }
  39784. var staticRenderFns = [
  39785. function() {
  39786. var _vm = this
  39787. var _h = _vm.$createElement
  39788. var _c = _vm._self._c || _h
  39789. return _c("div", { staticClass: "container" }, [
  39790. _c("div", { staticClass: "row" }, [
  39791. _c("div", { staticClass: "col-md-8 col-md-offset-2" }, [
  39792. _c("div", { staticClass: "panel panel-default" }, [
  39793. _c("div", { staticClass: "panel-heading" }, [
  39794. _vm._v("Example Component")
  39795. ]),
  39796. _vm._v(" "),
  39797. _c("div", { staticClass: "panel-body" }, [
  39798. _vm._v(
  39799. "\n I'm an example component!\n "
  39800. )
  39801. ])
  39802. ])
  39803. ])
  39804. ])
  39805. ])
  39806. }
  39807. ]
  39808. render._withStripped = true
  39809. module.exports = { render: render, staticRenderFns: staticRenderFns }
  39810. if (false) {
  39811. module.hot.accept()
  39812. if (module.hot.data) {
  39813. require("vue-hot-reload-api") .rerender("data-v-7168fb6a", module.exports)
  39814. }
  39815. }
  39816. /***/ }),
  39817. /* 43 */
  39818. /***/ (function(module, exports) {
  39819. throw new Error("Module build failed: ModuleBuildError: Module build failed: Error: Cannot find module 'node-sass'\nRequire stack:\n- /home/wwwroot/jucai/node_modules/sass-loader/lib/loader.js\n- /home/wwwroot/jucai/node_modules/loader-runner/lib/loadLoader.js\n- /home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js\n- /home/wwwroot/jucai/node_modules/webpack/lib/NormalModule.js\n- /home/wwwroot/jucai/node_modules/webpack/lib/NormalModuleFactory.js\n- /home/wwwroot/jucai/node_modules/webpack/lib/Compiler.js\n- /home/wwwroot/jucai/node_modules/webpack/lib/webpack.js\n- /home/wwwroot/jucai/node_modules/laravel-mix/src/Api.js\n- /home/wwwroot/jucai/node_modules/laravel-mix/src/index.js\n- /home/wwwroot/jucai/node_modules/laravel-mix/setup/webpack.config.js\n- /home/wwwroot/jucai/node_modules/webpack/bin/convert-argv.js\n- /home/wwwroot/jucai/node_modules/webpack/bin/webpack.js\n at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)\n at Function.Module._load (internal/modules/cjs/loader.js:862:27)\n at Module.require (internal/modules/cjs/loader.js:1042:19)\n at require (internal/modules/cjs/helpers.js:77:18)\n at Object.<anonymous> (/home/wwwroot/jucai/node_modules/sass-loader/lib/loader.js:3:14)\n at Module._compile (internal/modules/cjs/loader.js:1156:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)\n at Module.load (internal/modules/cjs/loader.js:1000:32)\n at Function.Module._load (internal/modules/cjs/loader.js:899:14)\n at Module.require (internal/modules/cjs/loader.js:1042:19)\n at require (internal/modules/cjs/helpers.js:77:18)\n at loadLoader (/home/wwwroot/jucai/node_modules/loader-runner/lib/loadLoader.js:18:17)\n at iteratePitchingLoaders (/home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:169:2)\n at iteratePitchingLoaders (/home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:165:10)\n at /home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:176:18\n at loadLoader (/home/wwwroot/jucai/node_modules/loader-runner/lib/loadLoader.js:47:3)\n at iteratePitchingLoaders (/home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:169:2)\n at iteratePitchingLoaders (/home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:165:10)\n at /home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:176:18\n at loadLoader (/home/wwwroot/jucai/node_modules/loader-runner/lib/loadLoader.js:47:3)\n at iteratePitchingLoaders (/home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:169:2)\n at iteratePitchingLoaders (/home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:165:10)\n at /home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:176:18\n at loadLoader (/home/wwwroot/jucai/node_modules/loader-runner/lib/loadLoader.js:47:3)\n at iteratePitchingLoaders (/home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:169:2)\n at runLoaders (/home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:365:2)\n at NormalModule.doBuild (/home/wwwroot/jucai/node_modules/webpack/lib/NormalModule.js:182:3)\n at NormalModule.build (/home/wwwroot/jucai/node_modules/webpack/lib/NormalModule.js:275:15)\n at Compilation.buildModule (/home/wwwroot/jucai/node_modules/webpack/lib/Compilation.js:157:10)\n at /home/wwwroot/jucai/node_modules/webpack/lib/Compilation.js:460:10\n at /home/wwwroot/jucai/node_modules/webpack/lib/NormalModule.js:195:19\n at /home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:367:11\n at /home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:172:11\n at loadLoader (/home/wwwroot/jucai/node_modules/loader-runner/lib/loadLoader.js:32:11)\n at iteratePitchingLoaders (/home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:169:2)\n at iteratePitchingLoaders (/home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:165:10)\n at /home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:176:18\n at loadLoader (/home/wwwroot/jucai/node_modules/loader-runner/lib/loadLoader.js:47:3)\n at iteratePitchingLoaders (/home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:169:2)\n at iteratePitchingLoaders (/home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:165:10)\n at /home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:176:18\n at loadLoader (/home/wwwroot/jucai/node_modules/loader-runner/lib/loadLoader.js:47:3)\n at iteratePitchingLoaders (/home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:169:2)\n at iteratePitchingLoaders (/home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:165:10)\n at /home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:176:18\n at loadLoader (/home/wwwroot/jucai/node_modules/loader-runner/lib/loadLoader.js:47:3)\n at iteratePitchingLoaders (/home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:169:2)\n at runLoaders (/home/wwwroot/jucai/node_modules/loader-runner/lib/LoaderRunner.js:365:2)\n at NormalModule.doBuild (/home/wwwroot/jucai/node_modules/webpack/lib/NormalModule.js:182:3)\n at NormalModule.build (/home/wwwroot/jucai/node_modules/webpack/lib/NormalModule.js:275:15)\n at Compilation.buildModule (/home/wwwroot/jucai/node_modules/webpack/lib/Compilation.js:157:10)\n at /home/wwwroot/jucai/node_modules/webpack/lib/Compilation.js:460:10\n at /home/wwwroot/jucai/node_modules/webpack/lib/NormalModuleFactory.js:243:5\n at /home/wwwroot/jucai/node_modules/webpack/lib/NormalModuleFactory.js:94:13\n at /home/wwwroot/jucai/node_modules/tapable/lib/Tapable.js:268:11\n at NormalModuleFactory.<anonymous> (/home/wwwroot/jucai/node_modules/webpack/lib/CompatibilityPlugin.js:52:5)\n at NormalModuleFactory.applyPluginsAsyncWaterfall (/home/wwwroot/jucai/node_modules/tapable/lib/Tapable.js:272:13)\n at /home/wwwroot/jucai/node_modules/webpack/lib/NormalModuleFactory.js:69:10\n at /home/wwwroot/jucai/node_modules/webpack/lib/NormalModuleFactory.js:196:7\n at processTicksAndRejections (internal/process/task_queues.js:79:11)");
  39820. /***/ })
  39821. /******/ ]);