app.js 1.4 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670
  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, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "/";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = 0);
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./node_modules/axios/index.js":
  89. /*!*************************************!*\
  90. !*** ./node_modules/axios/index.js ***!
  91. \*************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports, __webpack_require__) {
  94. module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
  95. /***/ }),
  96. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  97. /*!************************************************!*\
  98. !*** ./node_modules/axios/lib/adapters/xhr.js ***!
  99. \************************************************/
  100. /*! no static exports found */
  101. /***/ (function(module, exports, __webpack_require__) {
  102. "use strict";
  103. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  104. var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
  105. var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  106. var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
  107. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  108. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  109. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  110. module.exports = function xhrAdapter(config) {
  111. return new Promise(function dispatchXhrRequest(resolve, reject) {
  112. var requestData = config.data;
  113. var requestHeaders = config.headers;
  114. if (utils.isFormData(requestData)) {
  115. delete requestHeaders['Content-Type']; // Let the browser set it
  116. }
  117. var request = new XMLHttpRequest();
  118. // HTTP basic authentication
  119. if (config.auth) {
  120. var username = config.auth.username || '';
  121. var password = config.auth.password || '';
  122. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  123. }
  124. var fullPath = buildFullPath(config.baseURL, config.url);
  125. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  126. // Set the request timeout in MS
  127. request.timeout = config.timeout;
  128. // Listen for ready state
  129. request.onreadystatechange = function handleLoad() {
  130. if (!request || request.readyState !== 4) {
  131. return;
  132. }
  133. // The request errored out and we didn't get a response, this will be
  134. // handled by onerror instead
  135. // With one exception: request that using file: protocol, most browsers
  136. // will return status as 0 even though it's a successful request
  137. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  138. return;
  139. }
  140. // Prepare the response
  141. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  142. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  143. var response = {
  144. data: responseData,
  145. status: request.status,
  146. statusText: request.statusText,
  147. headers: responseHeaders,
  148. config: config,
  149. request: request
  150. };
  151. settle(resolve, reject, response);
  152. // Clean up request
  153. request = null;
  154. };
  155. // Handle browser request cancellation (as opposed to a manual cancellation)
  156. request.onabort = function handleAbort() {
  157. if (!request) {
  158. return;
  159. }
  160. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  161. // Clean up request
  162. request = null;
  163. };
  164. // Handle low level network errors
  165. request.onerror = function handleError() {
  166. // Real errors are hidden from us by the browser
  167. // onerror should only fire if it's a network error
  168. reject(createError('Network Error', config, null, request));
  169. // Clean up request
  170. request = null;
  171. };
  172. // Handle timeout
  173. request.ontimeout = function handleTimeout() {
  174. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  175. if (config.timeoutErrorMessage) {
  176. timeoutErrorMessage = config.timeoutErrorMessage;
  177. }
  178. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  179. request));
  180. // Clean up request
  181. request = null;
  182. };
  183. // Add xsrf header
  184. // This is only done if running in a standard browser environment.
  185. // Specifically not if we're in a web worker, or react-native.
  186. if (utils.isStandardBrowserEnv()) {
  187. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  188. // Add xsrf header
  189. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  190. cookies.read(config.xsrfCookieName) :
  191. undefined;
  192. if (xsrfValue) {
  193. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  194. }
  195. }
  196. // Add headers to the request
  197. if ('setRequestHeader' in request) {
  198. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  199. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  200. // Remove Content-Type if data is undefined
  201. delete requestHeaders[key];
  202. } else {
  203. // Otherwise add header to the request
  204. request.setRequestHeader(key, val);
  205. }
  206. });
  207. }
  208. // Add withCredentials to request if needed
  209. if (!utils.isUndefined(config.withCredentials)) {
  210. request.withCredentials = !!config.withCredentials;
  211. }
  212. // Add responseType to request if needed
  213. if (config.responseType) {
  214. try {
  215. request.responseType = config.responseType;
  216. } catch (e) {
  217. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  218. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  219. if (config.responseType !== 'json') {
  220. throw e;
  221. }
  222. }
  223. }
  224. // Handle progress if needed
  225. if (typeof config.onDownloadProgress === 'function') {
  226. request.addEventListener('progress', config.onDownloadProgress);
  227. }
  228. // Not all browsers support upload events
  229. if (typeof config.onUploadProgress === 'function' && request.upload) {
  230. request.upload.addEventListener('progress', config.onUploadProgress);
  231. }
  232. if (config.cancelToken) {
  233. // Handle cancellation
  234. config.cancelToken.promise.then(function onCanceled(cancel) {
  235. if (!request) {
  236. return;
  237. }
  238. request.abort();
  239. reject(cancel);
  240. // Clean up request
  241. request = null;
  242. });
  243. }
  244. if (requestData === undefined) {
  245. requestData = null;
  246. }
  247. // Send the request
  248. request.send(requestData);
  249. });
  250. };
  251. /***/ }),
  252. /***/ "./node_modules/axios/lib/axios.js":
  253. /*!*****************************************!*\
  254. !*** ./node_modules/axios/lib/axios.js ***!
  255. \*****************************************/
  256. /*! no static exports found */
  257. /***/ (function(module, exports, __webpack_require__) {
  258. "use strict";
  259. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  260. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  261. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  262. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  263. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  264. /**
  265. * Create an instance of Axios
  266. *
  267. * @param {Object} defaultConfig The default config for the instance
  268. * @return {Axios} A new instance of Axios
  269. */
  270. function createInstance(defaultConfig) {
  271. var context = new Axios(defaultConfig);
  272. var instance = bind(Axios.prototype.request, context);
  273. // Copy axios.prototype to instance
  274. utils.extend(instance, Axios.prototype, context);
  275. // Copy context to instance
  276. utils.extend(instance, context);
  277. return instance;
  278. }
  279. // Create the default instance to be exported
  280. var axios = createInstance(defaults);
  281. // Expose Axios class to allow class inheritance
  282. axios.Axios = Axios;
  283. // Factory for creating new instances
  284. axios.create = function create(instanceConfig) {
  285. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  286. };
  287. // Expose Cancel & CancelToken
  288. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  289. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  290. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  291. // Expose all/spread
  292. axios.all = function all(promises) {
  293. return Promise.all(promises);
  294. };
  295. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  296. module.exports = axios;
  297. // Allow use of default import syntax in TypeScript
  298. module.exports.default = axios;
  299. /***/ }),
  300. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  301. /*!*************************************************!*\
  302. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  303. \*************************************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports, __webpack_require__) {
  306. "use strict";
  307. /**
  308. * A `Cancel` is an object that is thrown when an operation is canceled.
  309. *
  310. * @class
  311. * @param {string=} message The message.
  312. */
  313. function Cancel(message) {
  314. this.message = message;
  315. }
  316. Cancel.prototype.toString = function toString() {
  317. return 'Cancel' + (this.message ? ': ' + this.message : '');
  318. };
  319. Cancel.prototype.__CANCEL__ = true;
  320. module.exports = Cancel;
  321. /***/ }),
  322. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  323. /*!******************************************************!*\
  324. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  325. \******************************************************/
  326. /*! no static exports found */
  327. /***/ (function(module, exports, __webpack_require__) {
  328. "use strict";
  329. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  330. /**
  331. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  332. *
  333. * @class
  334. * @param {Function} executor The executor function.
  335. */
  336. function CancelToken(executor) {
  337. if (typeof executor !== 'function') {
  338. throw new TypeError('executor must be a function.');
  339. }
  340. var resolvePromise;
  341. this.promise = new Promise(function promiseExecutor(resolve) {
  342. resolvePromise = resolve;
  343. });
  344. var token = this;
  345. executor(function cancel(message) {
  346. if (token.reason) {
  347. // Cancellation has already been requested
  348. return;
  349. }
  350. token.reason = new Cancel(message);
  351. resolvePromise(token.reason);
  352. });
  353. }
  354. /**
  355. * Throws a `Cancel` if cancellation has been requested.
  356. */
  357. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  358. if (this.reason) {
  359. throw this.reason;
  360. }
  361. };
  362. /**
  363. * Returns an object that contains a new `CancelToken` and a function that, when called,
  364. * cancels the `CancelToken`.
  365. */
  366. CancelToken.source = function source() {
  367. var cancel;
  368. var token = new CancelToken(function executor(c) {
  369. cancel = c;
  370. });
  371. return {
  372. token: token,
  373. cancel: cancel
  374. };
  375. };
  376. module.exports = CancelToken;
  377. /***/ }),
  378. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  379. /*!***************************************************!*\
  380. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  381. \***************************************************/
  382. /*! no static exports found */
  383. /***/ (function(module, exports, __webpack_require__) {
  384. "use strict";
  385. module.exports = function isCancel(value) {
  386. return !!(value && value.__CANCEL__);
  387. };
  388. /***/ }),
  389. /***/ "./node_modules/axios/lib/core/Axios.js":
  390. /*!**********************************************!*\
  391. !*** ./node_modules/axios/lib/core/Axios.js ***!
  392. \**********************************************/
  393. /*! no static exports found */
  394. /***/ (function(module, exports, __webpack_require__) {
  395. "use strict";
  396. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  397. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  398. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  399. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  400. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  401. /**
  402. * Create a new instance of Axios
  403. *
  404. * @param {Object} instanceConfig The default config for the instance
  405. */
  406. function Axios(instanceConfig) {
  407. this.defaults = instanceConfig;
  408. this.interceptors = {
  409. request: new InterceptorManager(),
  410. response: new InterceptorManager()
  411. };
  412. }
  413. /**
  414. * Dispatch a request
  415. *
  416. * @param {Object} config The config specific for this request (merged with this.defaults)
  417. */
  418. Axios.prototype.request = function request(config) {
  419. /*eslint no-param-reassign:0*/
  420. // Allow for axios('example/url'[, config]) a la fetch API
  421. if (typeof config === 'string') {
  422. config = arguments[1] || {};
  423. config.url = arguments[0];
  424. } else {
  425. config = config || {};
  426. }
  427. config = mergeConfig(this.defaults, config);
  428. // Set config.method
  429. if (config.method) {
  430. config.method = config.method.toLowerCase();
  431. } else if (this.defaults.method) {
  432. config.method = this.defaults.method.toLowerCase();
  433. } else {
  434. config.method = 'get';
  435. }
  436. // Hook up interceptors middleware
  437. var chain = [dispatchRequest, undefined];
  438. var promise = Promise.resolve(config);
  439. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  440. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  441. });
  442. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  443. chain.push(interceptor.fulfilled, interceptor.rejected);
  444. });
  445. while (chain.length) {
  446. promise = promise.then(chain.shift(), chain.shift());
  447. }
  448. return promise;
  449. };
  450. Axios.prototype.getUri = function getUri(config) {
  451. config = mergeConfig(this.defaults, config);
  452. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  453. };
  454. // Provide aliases for supported request methods
  455. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  456. /*eslint func-names:0*/
  457. Axios.prototype[method] = function(url, config) {
  458. return this.request(utils.merge(config || {}, {
  459. method: method,
  460. url: url
  461. }));
  462. };
  463. });
  464. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  465. /*eslint func-names:0*/
  466. Axios.prototype[method] = function(url, data, config) {
  467. return this.request(utils.merge(config || {}, {
  468. method: method,
  469. url: url,
  470. data: data
  471. }));
  472. };
  473. });
  474. module.exports = Axios;
  475. /***/ }),
  476. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  477. /*!***********************************************************!*\
  478. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  479. \***********************************************************/
  480. /*! no static exports found */
  481. /***/ (function(module, exports, __webpack_require__) {
  482. "use strict";
  483. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  484. function InterceptorManager() {
  485. this.handlers = [];
  486. }
  487. /**
  488. * Add a new interceptor to the stack
  489. *
  490. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  491. * @param {Function} rejected The function to handle `reject` for a `Promise`
  492. *
  493. * @return {Number} An ID used to remove interceptor later
  494. */
  495. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  496. this.handlers.push({
  497. fulfilled: fulfilled,
  498. rejected: rejected
  499. });
  500. return this.handlers.length - 1;
  501. };
  502. /**
  503. * Remove an interceptor from the stack
  504. *
  505. * @param {Number} id The ID that was returned by `use`
  506. */
  507. InterceptorManager.prototype.eject = function eject(id) {
  508. if (this.handlers[id]) {
  509. this.handlers[id] = null;
  510. }
  511. };
  512. /**
  513. * Iterate over all the registered interceptors
  514. *
  515. * This method is particularly useful for skipping over any
  516. * interceptors that may have become `null` calling `eject`.
  517. *
  518. * @param {Function} fn The function to call for each interceptor
  519. */
  520. InterceptorManager.prototype.forEach = function forEach(fn) {
  521. utils.forEach(this.handlers, function forEachHandler(h) {
  522. if (h !== null) {
  523. fn(h);
  524. }
  525. });
  526. };
  527. module.exports = InterceptorManager;
  528. /***/ }),
  529. /***/ "./node_modules/axios/lib/core/buildFullPath.js":
  530. /*!******************************************************!*\
  531. !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
  532. \******************************************************/
  533. /*! no static exports found */
  534. /***/ (function(module, exports, __webpack_require__) {
  535. "use strict";
  536. var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  537. var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  538. /**
  539. * Creates a new URL by combining the baseURL with the requestedURL,
  540. * only when the requestedURL is not already an absolute URL.
  541. * If the requestURL is absolute, this function returns the requestedURL untouched.
  542. *
  543. * @param {string} baseURL The base URL
  544. * @param {string} requestedURL Absolute or relative URL to combine
  545. * @returns {string} The combined full path
  546. */
  547. module.exports = function buildFullPath(baseURL, requestedURL) {
  548. if (baseURL && !isAbsoluteURL(requestedURL)) {
  549. return combineURLs(baseURL, requestedURL);
  550. }
  551. return requestedURL;
  552. };
  553. /***/ }),
  554. /***/ "./node_modules/axios/lib/core/createError.js":
  555. /*!****************************************************!*\
  556. !*** ./node_modules/axios/lib/core/createError.js ***!
  557. \****************************************************/
  558. /*! no static exports found */
  559. /***/ (function(module, exports, __webpack_require__) {
  560. "use strict";
  561. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  562. /**
  563. * Create an Error with the specified message, config, error code, request and response.
  564. *
  565. * @param {string} message The error message.
  566. * @param {Object} config The config.
  567. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  568. * @param {Object} [request] The request.
  569. * @param {Object} [response] The response.
  570. * @returns {Error} The created error.
  571. */
  572. module.exports = function createError(message, config, code, request, response) {
  573. var error = new Error(message);
  574. return enhanceError(error, config, code, request, response);
  575. };
  576. /***/ }),
  577. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  578. /*!********************************************************!*\
  579. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  580. \********************************************************/
  581. /*! no static exports found */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. "use strict";
  584. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  585. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  586. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  587. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  588. /**
  589. * Throws a `Cancel` if cancellation has been requested.
  590. */
  591. function throwIfCancellationRequested(config) {
  592. if (config.cancelToken) {
  593. config.cancelToken.throwIfRequested();
  594. }
  595. }
  596. /**
  597. * Dispatch a request to the server using the configured adapter.
  598. *
  599. * @param {object} config The config that is to be used for the request
  600. * @returns {Promise} The Promise to be fulfilled
  601. */
  602. module.exports = function dispatchRequest(config) {
  603. throwIfCancellationRequested(config);
  604. // Ensure headers exist
  605. config.headers = config.headers || {};
  606. // Transform request data
  607. config.data = transformData(
  608. config.data,
  609. config.headers,
  610. config.transformRequest
  611. );
  612. // Flatten headers
  613. config.headers = utils.merge(
  614. config.headers.common || {},
  615. config.headers[config.method] || {},
  616. config.headers
  617. );
  618. utils.forEach(
  619. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  620. function cleanHeaderConfig(method) {
  621. delete config.headers[method];
  622. }
  623. );
  624. var adapter = config.adapter || defaults.adapter;
  625. return adapter(config).then(function onAdapterResolution(response) {
  626. throwIfCancellationRequested(config);
  627. // Transform response data
  628. response.data = transformData(
  629. response.data,
  630. response.headers,
  631. config.transformResponse
  632. );
  633. return response;
  634. }, function onAdapterRejection(reason) {
  635. if (!isCancel(reason)) {
  636. throwIfCancellationRequested(config);
  637. // Transform response data
  638. if (reason && reason.response) {
  639. reason.response.data = transformData(
  640. reason.response.data,
  641. reason.response.headers,
  642. config.transformResponse
  643. );
  644. }
  645. }
  646. return Promise.reject(reason);
  647. });
  648. };
  649. /***/ }),
  650. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  651. /*!*****************************************************!*\
  652. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  653. \*****************************************************/
  654. /*! no static exports found */
  655. /***/ (function(module, exports, __webpack_require__) {
  656. "use strict";
  657. /**
  658. * Update an Error with the specified config, error code, and response.
  659. *
  660. * @param {Error} error The error to update.
  661. * @param {Object} config The config.
  662. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  663. * @param {Object} [request] The request.
  664. * @param {Object} [response] The response.
  665. * @returns {Error} The error.
  666. */
  667. module.exports = function enhanceError(error, config, code, request, response) {
  668. error.config = config;
  669. if (code) {
  670. error.code = code;
  671. }
  672. error.request = request;
  673. error.response = response;
  674. error.isAxiosError = true;
  675. error.toJSON = function() {
  676. return {
  677. // Standard
  678. message: this.message,
  679. name: this.name,
  680. // Microsoft
  681. description: this.description,
  682. number: this.number,
  683. // Mozilla
  684. fileName: this.fileName,
  685. lineNumber: this.lineNumber,
  686. columnNumber: this.columnNumber,
  687. stack: this.stack,
  688. // Axios
  689. config: this.config,
  690. code: this.code
  691. };
  692. };
  693. return error;
  694. };
  695. /***/ }),
  696. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  697. /*!****************************************************!*\
  698. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  699. \****************************************************/
  700. /*! no static exports found */
  701. /***/ (function(module, exports, __webpack_require__) {
  702. "use strict";
  703. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  704. /**
  705. * Config-specific merge-function which creates a new config-object
  706. * by merging two configuration objects together.
  707. *
  708. * @param {Object} config1
  709. * @param {Object} config2
  710. * @returns {Object} New object resulting from merging config2 to config1
  711. */
  712. module.exports = function mergeConfig(config1, config2) {
  713. // eslint-disable-next-line no-param-reassign
  714. config2 = config2 || {};
  715. var config = {};
  716. var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
  717. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
  718. var defaultToConfig2Keys = [
  719. 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
  720. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  721. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
  722. 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
  723. 'httpsAgent', 'cancelToken', 'socketPath'
  724. ];
  725. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  726. if (typeof config2[prop] !== 'undefined') {
  727. config[prop] = config2[prop];
  728. }
  729. });
  730. utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
  731. if (utils.isObject(config2[prop])) {
  732. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  733. } else if (typeof config2[prop] !== 'undefined') {
  734. config[prop] = config2[prop];
  735. } else if (utils.isObject(config1[prop])) {
  736. config[prop] = utils.deepMerge(config1[prop]);
  737. } else if (typeof config1[prop] !== 'undefined') {
  738. config[prop] = config1[prop];
  739. }
  740. });
  741. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  742. if (typeof config2[prop] !== 'undefined') {
  743. config[prop] = config2[prop];
  744. } else if (typeof config1[prop] !== 'undefined') {
  745. config[prop] = config1[prop];
  746. }
  747. });
  748. var axiosKeys = valueFromConfig2Keys
  749. .concat(mergeDeepPropertiesKeys)
  750. .concat(defaultToConfig2Keys);
  751. var otherKeys = Object
  752. .keys(config2)
  753. .filter(function filterAxiosKeys(key) {
  754. return axiosKeys.indexOf(key) === -1;
  755. });
  756. utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
  757. if (typeof config2[prop] !== 'undefined') {
  758. config[prop] = config2[prop];
  759. } else if (typeof config1[prop] !== 'undefined') {
  760. config[prop] = config1[prop];
  761. }
  762. });
  763. return config;
  764. };
  765. /***/ }),
  766. /***/ "./node_modules/axios/lib/core/settle.js":
  767. /*!***********************************************!*\
  768. !*** ./node_modules/axios/lib/core/settle.js ***!
  769. \***********************************************/
  770. /*! no static exports found */
  771. /***/ (function(module, exports, __webpack_require__) {
  772. "use strict";
  773. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  774. /**
  775. * Resolve or reject a Promise based on response status.
  776. *
  777. * @param {Function} resolve A function that resolves the promise.
  778. * @param {Function} reject A function that rejects the promise.
  779. * @param {object} response The response.
  780. */
  781. module.exports = function settle(resolve, reject, response) {
  782. var validateStatus = response.config.validateStatus;
  783. if (!validateStatus || validateStatus(response.status)) {
  784. resolve(response);
  785. } else {
  786. reject(createError(
  787. 'Request failed with status code ' + response.status,
  788. response.config,
  789. null,
  790. response.request,
  791. response
  792. ));
  793. }
  794. };
  795. /***/ }),
  796. /***/ "./node_modules/axios/lib/core/transformData.js":
  797. /*!******************************************************!*\
  798. !*** ./node_modules/axios/lib/core/transformData.js ***!
  799. \******************************************************/
  800. /*! no static exports found */
  801. /***/ (function(module, exports, __webpack_require__) {
  802. "use strict";
  803. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  804. /**
  805. * Transform the data for a request or a response
  806. *
  807. * @param {Object|String} data The data to be transformed
  808. * @param {Array} headers The headers for the request or response
  809. * @param {Array|Function} fns A single function or Array of functions
  810. * @returns {*} The resulting transformed data
  811. */
  812. module.exports = function transformData(data, headers, fns) {
  813. /*eslint no-param-reassign:0*/
  814. utils.forEach(fns, function transform(fn) {
  815. data = fn(data, headers);
  816. });
  817. return data;
  818. };
  819. /***/ }),
  820. /***/ "./node_modules/axios/lib/defaults.js":
  821. /*!********************************************!*\
  822. !*** ./node_modules/axios/lib/defaults.js ***!
  823. \********************************************/
  824. /*! no static exports found */
  825. /***/ (function(module, exports, __webpack_require__) {
  826. "use strict";
  827. /* WEBPACK VAR INJECTION */(function(process) {
  828. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  829. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  830. var DEFAULT_CONTENT_TYPE = {
  831. 'Content-Type': 'application/x-www-form-urlencoded'
  832. };
  833. function setContentTypeIfUnset(headers, value) {
  834. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  835. headers['Content-Type'] = value;
  836. }
  837. }
  838. function getDefaultAdapter() {
  839. var adapter;
  840. if (typeof XMLHttpRequest !== 'undefined') {
  841. // For browsers use XHR adapter
  842. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  843. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  844. // For node use HTTP adapter
  845. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  846. }
  847. return adapter;
  848. }
  849. var defaults = {
  850. adapter: getDefaultAdapter(),
  851. transformRequest: [function transformRequest(data, headers) {
  852. normalizeHeaderName(headers, 'Accept');
  853. normalizeHeaderName(headers, 'Content-Type');
  854. if (utils.isFormData(data) ||
  855. utils.isArrayBuffer(data) ||
  856. utils.isBuffer(data) ||
  857. utils.isStream(data) ||
  858. utils.isFile(data) ||
  859. utils.isBlob(data)
  860. ) {
  861. return data;
  862. }
  863. if (utils.isArrayBufferView(data)) {
  864. return data.buffer;
  865. }
  866. if (utils.isURLSearchParams(data)) {
  867. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  868. return data.toString();
  869. }
  870. if (utils.isObject(data)) {
  871. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  872. return JSON.stringify(data);
  873. }
  874. return data;
  875. }],
  876. transformResponse: [function transformResponse(data) {
  877. /*eslint no-param-reassign:0*/
  878. if (typeof data === 'string') {
  879. try {
  880. data = JSON.parse(data);
  881. } catch (e) { /* Ignore */ }
  882. }
  883. return data;
  884. }],
  885. /**
  886. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  887. * timeout is not created.
  888. */
  889. timeout: 0,
  890. xsrfCookieName: 'XSRF-TOKEN',
  891. xsrfHeaderName: 'X-XSRF-TOKEN',
  892. maxContentLength: -1,
  893. validateStatus: function validateStatus(status) {
  894. return status >= 200 && status < 300;
  895. }
  896. };
  897. defaults.headers = {
  898. common: {
  899. 'Accept': 'application/json, text/plain, */*'
  900. }
  901. };
  902. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  903. defaults.headers[method] = {};
  904. });
  905. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  906. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  907. });
  908. module.exports = defaults;
  909. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  910. /***/ }),
  911. /***/ "./node_modules/axios/lib/helpers/bind.js":
  912. /*!************************************************!*\
  913. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  914. \************************************************/
  915. /*! no static exports found */
  916. /***/ (function(module, exports, __webpack_require__) {
  917. "use strict";
  918. module.exports = function bind(fn, thisArg) {
  919. return function wrap() {
  920. var args = new Array(arguments.length);
  921. for (var i = 0; i < args.length; i++) {
  922. args[i] = arguments[i];
  923. }
  924. return fn.apply(thisArg, args);
  925. };
  926. };
  927. /***/ }),
  928. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  929. /*!****************************************************!*\
  930. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  931. \****************************************************/
  932. /*! no static exports found */
  933. /***/ (function(module, exports, __webpack_require__) {
  934. "use strict";
  935. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  936. function encode(val) {
  937. return encodeURIComponent(val).
  938. replace(/%40/gi, '@').
  939. replace(/%3A/gi, ':').
  940. replace(/%24/g, '$').
  941. replace(/%2C/gi, ',').
  942. replace(/%20/g, '+').
  943. replace(/%5B/gi, '[').
  944. replace(/%5D/gi, ']');
  945. }
  946. /**
  947. * Build a URL by appending params to the end
  948. *
  949. * @param {string} url The base of the url (e.g., http://www.google.com)
  950. * @param {object} [params] The params to be appended
  951. * @returns {string} The formatted url
  952. */
  953. module.exports = function buildURL(url, params, paramsSerializer) {
  954. /*eslint no-param-reassign:0*/
  955. if (!params) {
  956. return url;
  957. }
  958. var serializedParams;
  959. if (paramsSerializer) {
  960. serializedParams = paramsSerializer(params);
  961. } else if (utils.isURLSearchParams(params)) {
  962. serializedParams = params.toString();
  963. } else {
  964. var parts = [];
  965. utils.forEach(params, function serialize(val, key) {
  966. if (val === null || typeof val === 'undefined') {
  967. return;
  968. }
  969. if (utils.isArray(val)) {
  970. key = key + '[]';
  971. } else {
  972. val = [val];
  973. }
  974. utils.forEach(val, function parseValue(v) {
  975. if (utils.isDate(v)) {
  976. v = v.toISOString();
  977. } else if (utils.isObject(v)) {
  978. v = JSON.stringify(v);
  979. }
  980. parts.push(encode(key) + '=' + encode(v));
  981. });
  982. });
  983. serializedParams = parts.join('&');
  984. }
  985. if (serializedParams) {
  986. var hashmarkIndex = url.indexOf('#');
  987. if (hashmarkIndex !== -1) {
  988. url = url.slice(0, hashmarkIndex);
  989. }
  990. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  991. }
  992. return url;
  993. };
  994. /***/ }),
  995. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  996. /*!*******************************************************!*\
  997. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  998. \*******************************************************/
  999. /*! no static exports found */
  1000. /***/ (function(module, exports, __webpack_require__) {
  1001. "use strict";
  1002. /**
  1003. * Creates a new URL by combining the specified URLs
  1004. *
  1005. * @param {string} baseURL The base URL
  1006. * @param {string} relativeURL The relative URL
  1007. * @returns {string} The combined URL
  1008. */
  1009. module.exports = function combineURLs(baseURL, relativeURL) {
  1010. return relativeURL
  1011. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1012. : baseURL;
  1013. };
  1014. /***/ }),
  1015. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  1016. /*!***************************************************!*\
  1017. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  1018. \***************************************************/
  1019. /*! no static exports found */
  1020. /***/ (function(module, exports, __webpack_require__) {
  1021. "use strict";
  1022. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1023. module.exports = (
  1024. utils.isStandardBrowserEnv() ?
  1025. // Standard browser envs support document.cookie
  1026. (function standardBrowserEnv() {
  1027. return {
  1028. write: function write(name, value, expires, path, domain, secure) {
  1029. var cookie = [];
  1030. cookie.push(name + '=' + encodeURIComponent(value));
  1031. if (utils.isNumber(expires)) {
  1032. cookie.push('expires=' + new Date(expires).toGMTString());
  1033. }
  1034. if (utils.isString(path)) {
  1035. cookie.push('path=' + path);
  1036. }
  1037. if (utils.isString(domain)) {
  1038. cookie.push('domain=' + domain);
  1039. }
  1040. if (secure === true) {
  1041. cookie.push('secure');
  1042. }
  1043. document.cookie = cookie.join('; ');
  1044. },
  1045. read: function read(name) {
  1046. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1047. return (match ? decodeURIComponent(match[3]) : null);
  1048. },
  1049. remove: function remove(name) {
  1050. this.write(name, '', Date.now() - 86400000);
  1051. }
  1052. };
  1053. })() :
  1054. // Non standard browser env (web workers, react-native) lack needed support.
  1055. (function nonStandardBrowserEnv() {
  1056. return {
  1057. write: function write() {},
  1058. read: function read() { return null; },
  1059. remove: function remove() {}
  1060. };
  1061. })()
  1062. );
  1063. /***/ }),
  1064. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1065. /*!*********************************************************!*\
  1066. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1067. \*********************************************************/
  1068. /*! no static exports found */
  1069. /***/ (function(module, exports, __webpack_require__) {
  1070. "use strict";
  1071. /**
  1072. * Determines whether the specified URL is absolute
  1073. *
  1074. * @param {string} url The URL to test
  1075. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1076. */
  1077. module.exports = function isAbsoluteURL(url) {
  1078. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1079. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1080. // by any combination of letters, digits, plus, period, or hyphen.
  1081. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1082. };
  1083. /***/ }),
  1084. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1085. /*!***********************************************************!*\
  1086. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1087. \***********************************************************/
  1088. /*! no static exports found */
  1089. /***/ (function(module, exports, __webpack_require__) {
  1090. "use strict";
  1091. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1092. module.exports = (
  1093. utils.isStandardBrowserEnv() ?
  1094. // Standard browser envs have full support of the APIs needed to test
  1095. // whether the request URL is of the same origin as current location.
  1096. (function standardBrowserEnv() {
  1097. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1098. var urlParsingNode = document.createElement('a');
  1099. var originURL;
  1100. /**
  1101. * Parse a URL to discover it's components
  1102. *
  1103. * @param {String} url The URL to be parsed
  1104. * @returns {Object}
  1105. */
  1106. function resolveURL(url) {
  1107. var href = url;
  1108. if (msie) {
  1109. // IE needs attribute set twice to normalize properties
  1110. urlParsingNode.setAttribute('href', href);
  1111. href = urlParsingNode.href;
  1112. }
  1113. urlParsingNode.setAttribute('href', href);
  1114. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1115. return {
  1116. href: urlParsingNode.href,
  1117. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1118. host: urlParsingNode.host,
  1119. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1120. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1121. hostname: urlParsingNode.hostname,
  1122. port: urlParsingNode.port,
  1123. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1124. urlParsingNode.pathname :
  1125. '/' + urlParsingNode.pathname
  1126. };
  1127. }
  1128. originURL = resolveURL(window.location.href);
  1129. /**
  1130. * Determine if a URL shares the same origin as the current location
  1131. *
  1132. * @param {String} requestURL The URL to test
  1133. * @returns {boolean} True if URL shares the same origin, otherwise false
  1134. */
  1135. return function isURLSameOrigin(requestURL) {
  1136. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1137. return (parsed.protocol === originURL.protocol &&
  1138. parsed.host === originURL.host);
  1139. };
  1140. })() :
  1141. // Non standard browser envs (web workers, react-native) lack needed support.
  1142. (function nonStandardBrowserEnv() {
  1143. return function isURLSameOrigin() {
  1144. return true;
  1145. };
  1146. })()
  1147. );
  1148. /***/ }),
  1149. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1150. /*!***************************************************************!*\
  1151. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1152. \***************************************************************/
  1153. /*! no static exports found */
  1154. /***/ (function(module, exports, __webpack_require__) {
  1155. "use strict";
  1156. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1157. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1158. utils.forEach(headers, function processHeader(value, name) {
  1159. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1160. headers[normalizedName] = value;
  1161. delete headers[name];
  1162. }
  1163. });
  1164. };
  1165. /***/ }),
  1166. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1167. /*!********************************************************!*\
  1168. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1169. \********************************************************/
  1170. /*! no static exports found */
  1171. /***/ (function(module, exports, __webpack_require__) {
  1172. "use strict";
  1173. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1174. // Headers whose duplicates are ignored by node
  1175. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1176. var ignoreDuplicateOf = [
  1177. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1178. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1179. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1180. 'referer', 'retry-after', 'user-agent'
  1181. ];
  1182. /**
  1183. * Parse headers into an object
  1184. *
  1185. * ```
  1186. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1187. * Content-Type: application/json
  1188. * Connection: keep-alive
  1189. * Transfer-Encoding: chunked
  1190. * ```
  1191. *
  1192. * @param {String} headers Headers needing to be parsed
  1193. * @returns {Object} Headers parsed into an object
  1194. */
  1195. module.exports = function parseHeaders(headers) {
  1196. var parsed = {};
  1197. var key;
  1198. var val;
  1199. var i;
  1200. if (!headers) { return parsed; }
  1201. utils.forEach(headers.split('\n'), function parser(line) {
  1202. i = line.indexOf(':');
  1203. key = utils.trim(line.substr(0, i)).toLowerCase();
  1204. val = utils.trim(line.substr(i + 1));
  1205. if (key) {
  1206. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1207. return;
  1208. }
  1209. if (key === 'set-cookie') {
  1210. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1211. } else {
  1212. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1213. }
  1214. }
  1215. });
  1216. return parsed;
  1217. };
  1218. /***/ }),
  1219. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1220. /*!**************************************************!*\
  1221. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1222. \**************************************************/
  1223. /*! no static exports found */
  1224. /***/ (function(module, exports, __webpack_require__) {
  1225. "use strict";
  1226. /**
  1227. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1228. *
  1229. * Common use case would be to use `Function.prototype.apply`.
  1230. *
  1231. * ```js
  1232. * function f(x, y, z) {}
  1233. * var args = [1, 2, 3];
  1234. * f.apply(null, args);
  1235. * ```
  1236. *
  1237. * With `spread` this example can be re-written.
  1238. *
  1239. * ```js
  1240. * spread(function(x, y, z) {})([1, 2, 3]);
  1241. * ```
  1242. *
  1243. * @param {Function} callback
  1244. * @returns {Function}
  1245. */
  1246. module.exports = function spread(callback) {
  1247. return function wrap(arr) {
  1248. return callback.apply(null, arr);
  1249. };
  1250. };
  1251. /***/ }),
  1252. /***/ "./node_modules/axios/lib/utils.js":
  1253. /*!*****************************************!*\
  1254. !*** ./node_modules/axios/lib/utils.js ***!
  1255. \*****************************************/
  1256. /*! no static exports found */
  1257. /***/ (function(module, exports, __webpack_require__) {
  1258. "use strict";
  1259. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1260. /*global toString:true*/
  1261. // utils is a library of generic helper functions non-specific to axios
  1262. var toString = Object.prototype.toString;
  1263. /**
  1264. * Determine if a value is an Array
  1265. *
  1266. * @param {Object} val The value to test
  1267. * @returns {boolean} True if value is an Array, otherwise false
  1268. */
  1269. function isArray(val) {
  1270. return toString.call(val) === '[object Array]';
  1271. }
  1272. /**
  1273. * Determine if a value is undefined
  1274. *
  1275. * @param {Object} val The value to test
  1276. * @returns {boolean} True if the value is undefined, otherwise false
  1277. */
  1278. function isUndefined(val) {
  1279. return typeof val === 'undefined';
  1280. }
  1281. /**
  1282. * Determine if a value is a Buffer
  1283. *
  1284. * @param {Object} val The value to test
  1285. * @returns {boolean} True if value is a Buffer, otherwise false
  1286. */
  1287. function isBuffer(val) {
  1288. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  1289. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  1290. }
  1291. /**
  1292. * Determine if a value is an ArrayBuffer
  1293. *
  1294. * @param {Object} val The value to test
  1295. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1296. */
  1297. function isArrayBuffer(val) {
  1298. return toString.call(val) === '[object ArrayBuffer]';
  1299. }
  1300. /**
  1301. * Determine if a value is a FormData
  1302. *
  1303. * @param {Object} val The value to test
  1304. * @returns {boolean} True if value is an FormData, otherwise false
  1305. */
  1306. function isFormData(val) {
  1307. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1308. }
  1309. /**
  1310. * Determine if a value is a view on an ArrayBuffer
  1311. *
  1312. * @param {Object} val The value to test
  1313. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1314. */
  1315. function isArrayBufferView(val) {
  1316. var result;
  1317. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1318. result = ArrayBuffer.isView(val);
  1319. } else {
  1320. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1321. }
  1322. return result;
  1323. }
  1324. /**
  1325. * Determine if a value is a String
  1326. *
  1327. * @param {Object} val The value to test
  1328. * @returns {boolean} True if value is a String, otherwise false
  1329. */
  1330. function isString(val) {
  1331. return typeof val === 'string';
  1332. }
  1333. /**
  1334. * Determine if a value is a Number
  1335. *
  1336. * @param {Object} val The value to test
  1337. * @returns {boolean} True if value is a Number, otherwise false
  1338. */
  1339. function isNumber(val) {
  1340. return typeof val === 'number';
  1341. }
  1342. /**
  1343. * Determine if a value is an Object
  1344. *
  1345. * @param {Object} val The value to test
  1346. * @returns {boolean} True if value is an Object, otherwise false
  1347. */
  1348. function isObject(val) {
  1349. return val !== null && typeof val === 'object';
  1350. }
  1351. /**
  1352. * Determine if a value is a Date
  1353. *
  1354. * @param {Object} val The value to test
  1355. * @returns {boolean} True if value is a Date, otherwise false
  1356. */
  1357. function isDate(val) {
  1358. return toString.call(val) === '[object Date]';
  1359. }
  1360. /**
  1361. * Determine if a value is a File
  1362. *
  1363. * @param {Object} val The value to test
  1364. * @returns {boolean} True if value is a File, otherwise false
  1365. */
  1366. function isFile(val) {
  1367. return toString.call(val) === '[object File]';
  1368. }
  1369. /**
  1370. * Determine if a value is a Blob
  1371. *
  1372. * @param {Object} val The value to test
  1373. * @returns {boolean} True if value is a Blob, otherwise false
  1374. */
  1375. function isBlob(val) {
  1376. return toString.call(val) === '[object Blob]';
  1377. }
  1378. /**
  1379. * Determine if a value is a Function
  1380. *
  1381. * @param {Object} val The value to test
  1382. * @returns {boolean} True if value is a Function, otherwise false
  1383. */
  1384. function isFunction(val) {
  1385. return toString.call(val) === '[object Function]';
  1386. }
  1387. /**
  1388. * Determine if a value is a Stream
  1389. *
  1390. * @param {Object} val The value to test
  1391. * @returns {boolean} True if value is a Stream, otherwise false
  1392. */
  1393. function isStream(val) {
  1394. return isObject(val) && isFunction(val.pipe);
  1395. }
  1396. /**
  1397. * Determine if a value is a URLSearchParams object
  1398. *
  1399. * @param {Object} val The value to test
  1400. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1401. */
  1402. function isURLSearchParams(val) {
  1403. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1404. }
  1405. /**
  1406. * Trim excess whitespace off the beginning and end of a string
  1407. *
  1408. * @param {String} str The String to trim
  1409. * @returns {String} The String freed of excess whitespace
  1410. */
  1411. function trim(str) {
  1412. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1413. }
  1414. /**
  1415. * Determine if we're running in a standard browser environment
  1416. *
  1417. * This allows axios to run in a web worker, and react-native.
  1418. * Both environments support XMLHttpRequest, but not fully standard globals.
  1419. *
  1420. * web workers:
  1421. * typeof window -> undefined
  1422. * typeof document -> undefined
  1423. *
  1424. * react-native:
  1425. * navigator.product -> 'ReactNative'
  1426. * nativescript
  1427. * navigator.product -> 'NativeScript' or 'NS'
  1428. */
  1429. function isStandardBrowserEnv() {
  1430. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1431. navigator.product === 'NativeScript' ||
  1432. navigator.product === 'NS')) {
  1433. return false;
  1434. }
  1435. return (
  1436. typeof window !== 'undefined' &&
  1437. typeof document !== 'undefined'
  1438. );
  1439. }
  1440. /**
  1441. * Iterate over an Array or an Object invoking a function for each item.
  1442. *
  1443. * If `obj` is an Array callback will be called passing
  1444. * the value, index, and complete array for each item.
  1445. *
  1446. * If 'obj' is an Object callback will be called passing
  1447. * the value, key, and complete object for each property.
  1448. *
  1449. * @param {Object|Array} obj The object to iterate
  1450. * @param {Function} fn The callback to invoke for each item
  1451. */
  1452. function forEach(obj, fn) {
  1453. // Don't bother if no value provided
  1454. if (obj === null || typeof obj === 'undefined') {
  1455. return;
  1456. }
  1457. // Force an array if not already something iterable
  1458. if (typeof obj !== 'object') {
  1459. /*eslint no-param-reassign:0*/
  1460. obj = [obj];
  1461. }
  1462. if (isArray(obj)) {
  1463. // Iterate over array values
  1464. for (var i = 0, l = obj.length; i < l; i++) {
  1465. fn.call(null, obj[i], i, obj);
  1466. }
  1467. } else {
  1468. // Iterate over object keys
  1469. for (var key in obj) {
  1470. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1471. fn.call(null, obj[key], key, obj);
  1472. }
  1473. }
  1474. }
  1475. }
  1476. /**
  1477. * Accepts varargs expecting each argument to be an object, then
  1478. * immutably merges the properties of each object and returns result.
  1479. *
  1480. * When multiple objects contain the same key the later object in
  1481. * the arguments list will take precedence.
  1482. *
  1483. * Example:
  1484. *
  1485. * ```js
  1486. * var result = merge({foo: 123}, {foo: 456});
  1487. * console.log(result.foo); // outputs 456
  1488. * ```
  1489. *
  1490. * @param {Object} obj1 Object to merge
  1491. * @returns {Object} Result of all merge properties
  1492. */
  1493. function merge(/* obj1, obj2, obj3, ... */) {
  1494. var result = {};
  1495. function assignValue(val, key) {
  1496. if (typeof result[key] === 'object' && typeof val === 'object') {
  1497. result[key] = merge(result[key], val);
  1498. } else {
  1499. result[key] = val;
  1500. }
  1501. }
  1502. for (var i = 0, l = arguments.length; i < l; i++) {
  1503. forEach(arguments[i], assignValue);
  1504. }
  1505. return result;
  1506. }
  1507. /**
  1508. * Function equal to merge with the difference being that no reference
  1509. * to original objects is kept.
  1510. *
  1511. * @see merge
  1512. * @param {Object} obj1 Object to merge
  1513. * @returns {Object} Result of all merge properties
  1514. */
  1515. function deepMerge(/* obj1, obj2, obj3, ... */) {
  1516. var result = {};
  1517. function assignValue(val, key) {
  1518. if (typeof result[key] === 'object' && typeof val === 'object') {
  1519. result[key] = deepMerge(result[key], val);
  1520. } else if (typeof val === 'object') {
  1521. result[key] = deepMerge({}, val);
  1522. } else {
  1523. result[key] = val;
  1524. }
  1525. }
  1526. for (var i = 0, l = arguments.length; i < l; i++) {
  1527. forEach(arguments[i], assignValue);
  1528. }
  1529. return result;
  1530. }
  1531. /**
  1532. * Extends object a by mutably adding to it the properties of object b.
  1533. *
  1534. * @param {Object} a The object to be extended
  1535. * @param {Object} b The object to copy properties from
  1536. * @param {Object} thisArg The object to bind function to
  1537. * @return {Object} The resulting value of object a
  1538. */
  1539. function extend(a, b, thisArg) {
  1540. forEach(b, function assignValue(val, key) {
  1541. if (thisArg && typeof val === 'function') {
  1542. a[key] = bind(val, thisArg);
  1543. } else {
  1544. a[key] = val;
  1545. }
  1546. });
  1547. return a;
  1548. }
  1549. module.exports = {
  1550. isArray: isArray,
  1551. isArrayBuffer: isArrayBuffer,
  1552. isBuffer: isBuffer,
  1553. isFormData: isFormData,
  1554. isArrayBufferView: isArrayBufferView,
  1555. isString: isString,
  1556. isNumber: isNumber,
  1557. isObject: isObject,
  1558. isUndefined: isUndefined,
  1559. isDate: isDate,
  1560. isFile: isFile,
  1561. isBlob: isBlob,
  1562. isFunction: isFunction,
  1563. isStream: isStream,
  1564. isURLSearchParams: isURLSearchParams,
  1565. isStandardBrowserEnv: isStandardBrowserEnv,
  1566. forEach: forEach,
  1567. merge: merge,
  1568. deepMerge: deepMerge,
  1569. extend: extend,
  1570. trim: trim
  1571. };
  1572. /***/ }),
  1573. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  1574. /*!***************************************************************************************************************************************************************************!*\
  1575. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  1576. \***************************************************************************************************************************************************************************/
  1577. /*! exports provided: default */
  1578. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1579. "use strict";
  1580. __webpack_require__.r(__webpack_exports__);
  1581. //
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. //
  1596. //
  1597. /* harmony default export */ __webpack_exports__["default"] = ({
  1598. mounted: function mounted() {
  1599. console.log('Component mounted.');
  1600. }
  1601. });
  1602. /***/ }),
  1603. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  1604. /*!*****************************************************!*\
  1605. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  1606. \*****************************************************/
  1607. /*! no static exports found */
  1608. /***/ (function(module, exports, __webpack_require__) {
  1609. /*!
  1610. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  1611. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  1612. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1613. */
  1614. (function (global, factory) {
  1615. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  1616. undefined;
  1617. }(this, (function (exports, $, Popper) { 'use strict';
  1618. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  1619. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  1620. function _defineProperties(target, props) {
  1621. for (var i = 0; i < props.length; i++) {
  1622. var descriptor = props[i];
  1623. descriptor.enumerable = descriptor.enumerable || false;
  1624. descriptor.configurable = true;
  1625. if ("value" in descriptor) descriptor.writable = true;
  1626. Object.defineProperty(target, descriptor.key, descriptor);
  1627. }
  1628. }
  1629. function _createClass(Constructor, protoProps, staticProps) {
  1630. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  1631. if (staticProps) _defineProperties(Constructor, staticProps);
  1632. return Constructor;
  1633. }
  1634. function _defineProperty(obj, key, value) {
  1635. if (key in obj) {
  1636. Object.defineProperty(obj, key, {
  1637. value: value,
  1638. enumerable: true,
  1639. configurable: true,
  1640. writable: true
  1641. });
  1642. } else {
  1643. obj[key] = value;
  1644. }
  1645. return obj;
  1646. }
  1647. function ownKeys(object, enumerableOnly) {
  1648. var keys = Object.keys(object);
  1649. if (Object.getOwnPropertySymbols) {
  1650. var symbols = Object.getOwnPropertySymbols(object);
  1651. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  1652. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  1653. });
  1654. keys.push.apply(keys, symbols);
  1655. }
  1656. return keys;
  1657. }
  1658. function _objectSpread2(target) {
  1659. for (var i = 1; i < arguments.length; i++) {
  1660. var source = arguments[i] != null ? arguments[i] : {};
  1661. if (i % 2) {
  1662. ownKeys(Object(source), true).forEach(function (key) {
  1663. _defineProperty(target, key, source[key]);
  1664. });
  1665. } else if (Object.getOwnPropertyDescriptors) {
  1666. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  1667. } else {
  1668. ownKeys(Object(source)).forEach(function (key) {
  1669. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  1670. });
  1671. }
  1672. }
  1673. return target;
  1674. }
  1675. function _inheritsLoose(subClass, superClass) {
  1676. subClass.prototype = Object.create(superClass.prototype);
  1677. subClass.prototype.constructor = subClass;
  1678. subClass.__proto__ = superClass;
  1679. }
  1680. /**
  1681. * --------------------------------------------------------------------------
  1682. * Bootstrap (v4.4.1): util.js
  1683. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1684. * --------------------------------------------------------------------------
  1685. */
  1686. /**
  1687. * ------------------------------------------------------------------------
  1688. * Private TransitionEnd Helpers
  1689. * ------------------------------------------------------------------------
  1690. */
  1691. var TRANSITION_END = 'transitionend';
  1692. var MAX_UID = 1000000;
  1693. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  1694. function toType(obj) {
  1695. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  1696. }
  1697. function getSpecialTransitionEndEvent() {
  1698. return {
  1699. bindType: TRANSITION_END,
  1700. delegateType: TRANSITION_END,
  1701. handle: function handle(event) {
  1702. if ($(event.target).is(this)) {
  1703. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  1704. }
  1705. return undefined; // eslint-disable-line no-undefined
  1706. }
  1707. };
  1708. }
  1709. function transitionEndEmulator(duration) {
  1710. var _this = this;
  1711. var called = false;
  1712. $(this).one(Util.TRANSITION_END, function () {
  1713. called = true;
  1714. });
  1715. setTimeout(function () {
  1716. if (!called) {
  1717. Util.triggerTransitionEnd(_this);
  1718. }
  1719. }, duration);
  1720. return this;
  1721. }
  1722. function setTransitionEndSupport() {
  1723. $.fn.emulateTransitionEnd = transitionEndEmulator;
  1724. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  1725. }
  1726. /**
  1727. * --------------------------------------------------------------------------
  1728. * Public Util Api
  1729. * --------------------------------------------------------------------------
  1730. */
  1731. var Util = {
  1732. TRANSITION_END: 'bsTransitionEnd',
  1733. getUID: function getUID(prefix) {
  1734. do {
  1735. // eslint-disable-next-line no-bitwise
  1736. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  1737. } while (document.getElementById(prefix));
  1738. return prefix;
  1739. },
  1740. getSelectorFromElement: function getSelectorFromElement(element) {
  1741. var selector = element.getAttribute('data-target');
  1742. if (!selector || selector === '#') {
  1743. var hrefAttr = element.getAttribute('href');
  1744. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  1745. }
  1746. try {
  1747. return document.querySelector(selector) ? selector : null;
  1748. } catch (err) {
  1749. return null;
  1750. }
  1751. },
  1752. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  1753. if (!element) {
  1754. return 0;
  1755. } // Get transition-duration of the element
  1756. var transitionDuration = $(element).css('transition-duration');
  1757. var transitionDelay = $(element).css('transition-delay');
  1758. var floatTransitionDuration = parseFloat(transitionDuration);
  1759. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  1760. if (!floatTransitionDuration && !floatTransitionDelay) {
  1761. return 0;
  1762. } // If multiple durations are defined, take the first
  1763. transitionDuration = transitionDuration.split(',')[0];
  1764. transitionDelay = transitionDelay.split(',')[0];
  1765. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  1766. },
  1767. reflow: function reflow(element) {
  1768. return element.offsetHeight;
  1769. },
  1770. triggerTransitionEnd: function triggerTransitionEnd(element) {
  1771. $(element).trigger(TRANSITION_END);
  1772. },
  1773. // TODO: Remove in v5
  1774. supportsTransitionEnd: function supportsTransitionEnd() {
  1775. return Boolean(TRANSITION_END);
  1776. },
  1777. isElement: function isElement(obj) {
  1778. return (obj[0] || obj).nodeType;
  1779. },
  1780. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  1781. for (var property in configTypes) {
  1782. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  1783. var expectedTypes = configTypes[property];
  1784. var value = config[property];
  1785. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  1786. if (!new RegExp(expectedTypes).test(valueType)) {
  1787. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  1788. }
  1789. }
  1790. }
  1791. },
  1792. findShadowRoot: function findShadowRoot(element) {
  1793. if (!document.documentElement.attachShadow) {
  1794. return null;
  1795. } // Can find the shadow root otherwise it'll return the document
  1796. if (typeof element.getRootNode === 'function') {
  1797. var root = element.getRootNode();
  1798. return root instanceof ShadowRoot ? root : null;
  1799. }
  1800. if (element instanceof ShadowRoot) {
  1801. return element;
  1802. } // when we don't find a shadow root
  1803. if (!element.parentNode) {
  1804. return null;
  1805. }
  1806. return Util.findShadowRoot(element.parentNode);
  1807. },
  1808. jQueryDetection: function jQueryDetection() {
  1809. if (typeof $ === 'undefined') {
  1810. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  1811. }
  1812. var version = $.fn.jquery.split(' ')[0].split('.');
  1813. var minMajor = 1;
  1814. var ltMajor = 2;
  1815. var minMinor = 9;
  1816. var minPatch = 1;
  1817. var maxMajor = 4;
  1818. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  1819. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  1820. }
  1821. }
  1822. };
  1823. Util.jQueryDetection();
  1824. setTransitionEndSupport();
  1825. /**
  1826. * ------------------------------------------------------------------------
  1827. * Constants
  1828. * ------------------------------------------------------------------------
  1829. */
  1830. var NAME = 'alert';
  1831. var VERSION = '4.4.1';
  1832. var DATA_KEY = 'bs.alert';
  1833. var EVENT_KEY = "." + DATA_KEY;
  1834. var DATA_API_KEY = '.data-api';
  1835. var JQUERY_NO_CONFLICT = $.fn[NAME];
  1836. var Selector = {
  1837. DISMISS: '[data-dismiss="alert"]'
  1838. };
  1839. var Event = {
  1840. CLOSE: "close" + EVENT_KEY,
  1841. CLOSED: "closed" + EVENT_KEY,
  1842. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  1843. };
  1844. var ClassName = {
  1845. ALERT: 'alert',
  1846. FADE: 'fade',
  1847. SHOW: 'show'
  1848. };
  1849. /**
  1850. * ------------------------------------------------------------------------
  1851. * Class Definition
  1852. * ------------------------------------------------------------------------
  1853. */
  1854. var Alert =
  1855. /*#__PURE__*/
  1856. function () {
  1857. function Alert(element) {
  1858. this._element = element;
  1859. } // Getters
  1860. var _proto = Alert.prototype;
  1861. // Public
  1862. _proto.close = function close(element) {
  1863. var rootElement = this._element;
  1864. if (element) {
  1865. rootElement = this._getRootElement(element);
  1866. }
  1867. var customEvent = this._triggerCloseEvent(rootElement);
  1868. if (customEvent.isDefaultPrevented()) {
  1869. return;
  1870. }
  1871. this._removeElement(rootElement);
  1872. };
  1873. _proto.dispose = function dispose() {
  1874. $.removeData(this._element, DATA_KEY);
  1875. this._element = null;
  1876. } // Private
  1877. ;
  1878. _proto._getRootElement = function _getRootElement(element) {
  1879. var selector = Util.getSelectorFromElement(element);
  1880. var parent = false;
  1881. if (selector) {
  1882. parent = document.querySelector(selector);
  1883. }
  1884. if (!parent) {
  1885. parent = $(element).closest("." + ClassName.ALERT)[0];
  1886. }
  1887. return parent;
  1888. };
  1889. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  1890. var closeEvent = $.Event(Event.CLOSE);
  1891. $(element).trigger(closeEvent);
  1892. return closeEvent;
  1893. };
  1894. _proto._removeElement = function _removeElement(element) {
  1895. var _this = this;
  1896. $(element).removeClass(ClassName.SHOW);
  1897. if (!$(element).hasClass(ClassName.FADE)) {
  1898. this._destroyElement(element);
  1899. return;
  1900. }
  1901. var transitionDuration = Util.getTransitionDurationFromElement(element);
  1902. $(element).one(Util.TRANSITION_END, function (event) {
  1903. return _this._destroyElement(element, event);
  1904. }).emulateTransitionEnd(transitionDuration);
  1905. };
  1906. _proto._destroyElement = function _destroyElement(element) {
  1907. $(element).detach().trigger(Event.CLOSED).remove();
  1908. } // Static
  1909. ;
  1910. Alert._jQueryInterface = function _jQueryInterface(config) {
  1911. return this.each(function () {
  1912. var $element = $(this);
  1913. var data = $element.data(DATA_KEY);
  1914. if (!data) {
  1915. data = new Alert(this);
  1916. $element.data(DATA_KEY, data);
  1917. }
  1918. if (config === 'close') {
  1919. data[config](this);
  1920. }
  1921. });
  1922. };
  1923. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  1924. return function (event) {
  1925. if (event) {
  1926. event.preventDefault();
  1927. }
  1928. alertInstance.close(this);
  1929. };
  1930. };
  1931. _createClass(Alert, null, [{
  1932. key: "VERSION",
  1933. get: function get() {
  1934. return VERSION;
  1935. }
  1936. }]);
  1937. return Alert;
  1938. }();
  1939. /**
  1940. * ------------------------------------------------------------------------
  1941. * Data Api implementation
  1942. * ------------------------------------------------------------------------
  1943. */
  1944. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  1945. /**
  1946. * ------------------------------------------------------------------------
  1947. * jQuery
  1948. * ------------------------------------------------------------------------
  1949. */
  1950. $.fn[NAME] = Alert._jQueryInterface;
  1951. $.fn[NAME].Constructor = Alert;
  1952. $.fn[NAME].noConflict = function () {
  1953. $.fn[NAME] = JQUERY_NO_CONFLICT;
  1954. return Alert._jQueryInterface;
  1955. };
  1956. /**
  1957. * ------------------------------------------------------------------------
  1958. * Constants
  1959. * ------------------------------------------------------------------------
  1960. */
  1961. var NAME$1 = 'button';
  1962. var VERSION$1 = '4.4.1';
  1963. var DATA_KEY$1 = 'bs.button';
  1964. var EVENT_KEY$1 = "." + DATA_KEY$1;
  1965. var DATA_API_KEY$1 = '.data-api';
  1966. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  1967. var ClassName$1 = {
  1968. ACTIVE: 'active',
  1969. BUTTON: 'btn',
  1970. FOCUS: 'focus'
  1971. };
  1972. var Selector$1 = {
  1973. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  1974. DATA_TOGGLES: '[data-toggle="buttons"]',
  1975. DATA_TOGGLE: '[data-toggle="button"]',
  1976. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  1977. INPUT: 'input:not([type="hidden"])',
  1978. ACTIVE: '.active',
  1979. BUTTON: '.btn'
  1980. };
  1981. var Event$1 = {
  1982. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  1983. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  1984. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  1985. };
  1986. /**
  1987. * ------------------------------------------------------------------------
  1988. * Class Definition
  1989. * ------------------------------------------------------------------------
  1990. */
  1991. var Button =
  1992. /*#__PURE__*/
  1993. function () {
  1994. function Button(element) {
  1995. this._element = element;
  1996. } // Getters
  1997. var _proto = Button.prototype;
  1998. // Public
  1999. _proto.toggle = function toggle() {
  2000. var triggerChangeEvent = true;
  2001. var addAriaPressed = true;
  2002. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2003. if (rootElement) {
  2004. var input = this._element.querySelector(Selector$1.INPUT);
  2005. if (input) {
  2006. if (input.type === 'radio') {
  2007. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2008. triggerChangeEvent = false;
  2009. } else {
  2010. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2011. if (activeElement) {
  2012. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2013. }
  2014. }
  2015. } else if (input.type === 'checkbox') {
  2016. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2017. triggerChangeEvent = false;
  2018. }
  2019. } else {
  2020. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2021. triggerChangeEvent = false;
  2022. }
  2023. if (triggerChangeEvent) {
  2024. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2025. $(input).trigger('change');
  2026. }
  2027. input.focus();
  2028. addAriaPressed = false;
  2029. }
  2030. }
  2031. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2032. if (addAriaPressed) {
  2033. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2034. }
  2035. if (triggerChangeEvent) {
  2036. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2037. }
  2038. }
  2039. };
  2040. _proto.dispose = function dispose() {
  2041. $.removeData(this._element, DATA_KEY$1);
  2042. this._element = null;
  2043. } // Static
  2044. ;
  2045. Button._jQueryInterface = function _jQueryInterface(config) {
  2046. return this.each(function () {
  2047. var data = $(this).data(DATA_KEY$1);
  2048. if (!data) {
  2049. data = new Button(this);
  2050. $(this).data(DATA_KEY$1, data);
  2051. }
  2052. if (config === 'toggle') {
  2053. data[config]();
  2054. }
  2055. });
  2056. };
  2057. _createClass(Button, null, [{
  2058. key: "VERSION",
  2059. get: function get() {
  2060. return VERSION$1;
  2061. }
  2062. }]);
  2063. return Button;
  2064. }();
  2065. /**
  2066. * ------------------------------------------------------------------------
  2067. * Data Api implementation
  2068. * ------------------------------------------------------------------------
  2069. */
  2070. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2071. var button = event.target;
  2072. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2073. button = $(button).closest(Selector$1.BUTTON)[0];
  2074. }
  2075. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2076. event.preventDefault(); // work around Firefox bug #1540995
  2077. } else {
  2078. var inputBtn = button.querySelector(Selector$1.INPUT);
  2079. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2080. event.preventDefault(); // work around Firefox bug #1540995
  2081. return;
  2082. }
  2083. Button._jQueryInterface.call($(button), 'toggle');
  2084. }
  2085. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2086. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2087. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2088. });
  2089. $(window).on(Event$1.LOAD_DATA_API, function () {
  2090. // ensure correct active class is set to match the controls' actual values/states
  2091. // find all checkboxes/readio buttons inside data-toggle groups
  2092. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2093. for (var i = 0, len = buttons.length; i < len; i++) {
  2094. var button = buttons[i];
  2095. var input = button.querySelector(Selector$1.INPUT);
  2096. if (input.checked || input.hasAttribute('checked')) {
  2097. button.classList.add(ClassName$1.ACTIVE);
  2098. } else {
  2099. button.classList.remove(ClassName$1.ACTIVE);
  2100. }
  2101. } // find all button toggles
  2102. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2103. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2104. var _button = buttons[_i];
  2105. if (_button.getAttribute('aria-pressed') === 'true') {
  2106. _button.classList.add(ClassName$1.ACTIVE);
  2107. } else {
  2108. _button.classList.remove(ClassName$1.ACTIVE);
  2109. }
  2110. }
  2111. });
  2112. /**
  2113. * ------------------------------------------------------------------------
  2114. * jQuery
  2115. * ------------------------------------------------------------------------
  2116. */
  2117. $.fn[NAME$1] = Button._jQueryInterface;
  2118. $.fn[NAME$1].Constructor = Button;
  2119. $.fn[NAME$1].noConflict = function () {
  2120. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2121. return Button._jQueryInterface;
  2122. };
  2123. /**
  2124. * ------------------------------------------------------------------------
  2125. * Constants
  2126. * ------------------------------------------------------------------------
  2127. */
  2128. var NAME$2 = 'carousel';
  2129. var VERSION$2 = '4.4.1';
  2130. var DATA_KEY$2 = 'bs.carousel';
  2131. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2132. var DATA_API_KEY$2 = '.data-api';
  2133. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2134. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2135. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2136. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2137. var SWIPE_THRESHOLD = 40;
  2138. var Default = {
  2139. interval: 5000,
  2140. keyboard: true,
  2141. slide: false,
  2142. pause: 'hover',
  2143. wrap: true,
  2144. touch: true
  2145. };
  2146. var DefaultType = {
  2147. interval: '(number|boolean)',
  2148. keyboard: 'boolean',
  2149. slide: '(boolean|string)',
  2150. pause: '(string|boolean)',
  2151. wrap: 'boolean',
  2152. touch: 'boolean'
  2153. };
  2154. var Direction = {
  2155. NEXT: 'next',
  2156. PREV: 'prev',
  2157. LEFT: 'left',
  2158. RIGHT: 'right'
  2159. };
  2160. var Event$2 = {
  2161. SLIDE: "slide" + EVENT_KEY$2,
  2162. SLID: "slid" + EVENT_KEY$2,
  2163. KEYDOWN: "keydown" + EVENT_KEY$2,
  2164. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2165. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2166. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2167. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2168. TOUCHEND: "touchend" + EVENT_KEY$2,
  2169. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2170. POINTERUP: "pointerup" + EVENT_KEY$2,
  2171. DRAG_START: "dragstart" + EVENT_KEY$2,
  2172. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2173. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2174. };
  2175. var ClassName$2 = {
  2176. CAROUSEL: 'carousel',
  2177. ACTIVE: 'active',
  2178. SLIDE: 'slide',
  2179. RIGHT: 'carousel-item-right',
  2180. LEFT: 'carousel-item-left',
  2181. NEXT: 'carousel-item-next',
  2182. PREV: 'carousel-item-prev',
  2183. ITEM: 'carousel-item',
  2184. POINTER_EVENT: 'pointer-event'
  2185. };
  2186. var Selector$2 = {
  2187. ACTIVE: '.active',
  2188. ACTIVE_ITEM: '.active.carousel-item',
  2189. ITEM: '.carousel-item',
  2190. ITEM_IMG: '.carousel-item img',
  2191. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  2192. INDICATORS: '.carousel-indicators',
  2193. DATA_SLIDE: '[data-slide], [data-slide-to]',
  2194. DATA_RIDE: '[data-ride="carousel"]'
  2195. };
  2196. var PointerType = {
  2197. TOUCH: 'touch',
  2198. PEN: 'pen'
  2199. };
  2200. /**
  2201. * ------------------------------------------------------------------------
  2202. * Class Definition
  2203. * ------------------------------------------------------------------------
  2204. */
  2205. var Carousel =
  2206. /*#__PURE__*/
  2207. function () {
  2208. function Carousel(element, config) {
  2209. this._items = null;
  2210. this._interval = null;
  2211. this._activeElement = null;
  2212. this._isPaused = false;
  2213. this._isSliding = false;
  2214. this.touchTimeout = null;
  2215. this.touchStartX = 0;
  2216. this.touchDeltaX = 0;
  2217. this._config = this._getConfig(config);
  2218. this._element = element;
  2219. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  2220. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2221. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2222. this._addEventListeners();
  2223. } // Getters
  2224. var _proto = Carousel.prototype;
  2225. // Public
  2226. _proto.next = function next() {
  2227. if (!this._isSliding) {
  2228. this._slide(Direction.NEXT);
  2229. }
  2230. };
  2231. _proto.nextWhenVisible = function nextWhenVisible() {
  2232. // Don't call next when the page isn't visible
  2233. // or the carousel or its parent isn't visible
  2234. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  2235. this.next();
  2236. }
  2237. };
  2238. _proto.prev = function prev() {
  2239. if (!this._isSliding) {
  2240. this._slide(Direction.PREV);
  2241. }
  2242. };
  2243. _proto.pause = function pause(event) {
  2244. if (!event) {
  2245. this._isPaused = true;
  2246. }
  2247. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  2248. Util.triggerTransitionEnd(this._element);
  2249. this.cycle(true);
  2250. }
  2251. clearInterval(this._interval);
  2252. this._interval = null;
  2253. };
  2254. _proto.cycle = function cycle(event) {
  2255. if (!event) {
  2256. this._isPaused = false;
  2257. }
  2258. if (this._interval) {
  2259. clearInterval(this._interval);
  2260. this._interval = null;
  2261. }
  2262. if (this._config.interval && !this._isPaused) {
  2263. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2264. }
  2265. };
  2266. _proto.to = function to(index) {
  2267. var _this = this;
  2268. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2269. var activeIndex = this._getItemIndex(this._activeElement);
  2270. if (index > this._items.length - 1 || index < 0) {
  2271. return;
  2272. }
  2273. if (this._isSliding) {
  2274. $(this._element).one(Event$2.SLID, function () {
  2275. return _this.to(index);
  2276. });
  2277. return;
  2278. }
  2279. if (activeIndex === index) {
  2280. this.pause();
  2281. this.cycle();
  2282. return;
  2283. }
  2284. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  2285. this._slide(direction, this._items[index]);
  2286. };
  2287. _proto.dispose = function dispose() {
  2288. $(this._element).off(EVENT_KEY$2);
  2289. $.removeData(this._element, DATA_KEY$2);
  2290. this._items = null;
  2291. this._config = null;
  2292. this._element = null;
  2293. this._interval = null;
  2294. this._isPaused = null;
  2295. this._isSliding = null;
  2296. this._activeElement = null;
  2297. this._indicatorsElement = null;
  2298. } // Private
  2299. ;
  2300. _proto._getConfig = function _getConfig(config) {
  2301. config = _objectSpread2({}, Default, {}, config);
  2302. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2303. return config;
  2304. };
  2305. _proto._handleSwipe = function _handleSwipe() {
  2306. var absDeltax = Math.abs(this.touchDeltaX);
  2307. if (absDeltax <= SWIPE_THRESHOLD) {
  2308. return;
  2309. }
  2310. var direction = absDeltax / this.touchDeltaX;
  2311. this.touchDeltaX = 0; // swipe left
  2312. if (direction > 0) {
  2313. this.prev();
  2314. } // swipe right
  2315. if (direction < 0) {
  2316. this.next();
  2317. }
  2318. };
  2319. _proto._addEventListeners = function _addEventListeners() {
  2320. var _this2 = this;
  2321. if (this._config.keyboard) {
  2322. $(this._element).on(Event$2.KEYDOWN, function (event) {
  2323. return _this2._keydown(event);
  2324. });
  2325. }
  2326. if (this._config.pause === 'hover') {
  2327. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  2328. return _this2.pause(event);
  2329. }).on(Event$2.MOUSELEAVE, function (event) {
  2330. return _this2.cycle(event);
  2331. });
  2332. }
  2333. if (this._config.touch) {
  2334. this._addTouchEventListeners();
  2335. }
  2336. };
  2337. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2338. var _this3 = this;
  2339. if (!this._touchSupported) {
  2340. return;
  2341. }
  2342. var start = function start(event) {
  2343. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2344. _this3.touchStartX = event.originalEvent.clientX;
  2345. } else if (!_this3._pointerEvent) {
  2346. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2347. }
  2348. };
  2349. var move = function move(event) {
  2350. // ensure swiping with one touch and not pinching
  2351. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2352. _this3.touchDeltaX = 0;
  2353. } else {
  2354. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2355. }
  2356. };
  2357. var end = function end(event) {
  2358. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2359. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2360. }
  2361. _this3._handleSwipe();
  2362. if (_this3._config.pause === 'hover') {
  2363. // If it's a touch-enabled device, mouseenter/leave are fired as
  2364. // part of the mouse compatibility events on first tap - the carousel
  2365. // would stop cycling until user tapped out of it;
  2366. // here, we listen for touchend, explicitly pause the carousel
  2367. // (as if it's the second time we tap on it, mouseenter compat event
  2368. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2369. // events to fire) we explicitly restart cycling
  2370. _this3.pause();
  2371. if (_this3.touchTimeout) {
  2372. clearTimeout(_this3.touchTimeout);
  2373. }
  2374. _this3.touchTimeout = setTimeout(function (event) {
  2375. return _this3.cycle(event);
  2376. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2377. }
  2378. };
  2379. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  2380. return e.preventDefault();
  2381. });
  2382. if (this._pointerEvent) {
  2383. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  2384. return start(event);
  2385. });
  2386. $(this._element).on(Event$2.POINTERUP, function (event) {
  2387. return end(event);
  2388. });
  2389. this._element.classList.add(ClassName$2.POINTER_EVENT);
  2390. } else {
  2391. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  2392. return start(event);
  2393. });
  2394. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  2395. return move(event);
  2396. });
  2397. $(this._element).on(Event$2.TOUCHEND, function (event) {
  2398. return end(event);
  2399. });
  2400. }
  2401. };
  2402. _proto._keydown = function _keydown(event) {
  2403. if (/input|textarea/i.test(event.target.tagName)) {
  2404. return;
  2405. }
  2406. switch (event.which) {
  2407. case ARROW_LEFT_KEYCODE:
  2408. event.preventDefault();
  2409. this.prev();
  2410. break;
  2411. case ARROW_RIGHT_KEYCODE:
  2412. event.preventDefault();
  2413. this.next();
  2414. break;
  2415. }
  2416. };
  2417. _proto._getItemIndex = function _getItemIndex(element) {
  2418. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  2419. return this._items.indexOf(element);
  2420. };
  2421. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2422. var isNextDirection = direction === Direction.NEXT;
  2423. var isPrevDirection = direction === Direction.PREV;
  2424. var activeIndex = this._getItemIndex(activeElement);
  2425. var lastItemIndex = this._items.length - 1;
  2426. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2427. if (isGoingToWrap && !this._config.wrap) {
  2428. return activeElement;
  2429. }
  2430. var delta = direction === Direction.PREV ? -1 : 1;
  2431. var itemIndex = (activeIndex + delta) % this._items.length;
  2432. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2433. };
  2434. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2435. var targetIndex = this._getItemIndex(relatedTarget);
  2436. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  2437. var slideEvent = $.Event(Event$2.SLIDE, {
  2438. relatedTarget: relatedTarget,
  2439. direction: eventDirectionName,
  2440. from: fromIndex,
  2441. to: targetIndex
  2442. });
  2443. $(this._element).trigger(slideEvent);
  2444. return slideEvent;
  2445. };
  2446. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  2447. if (this._indicatorsElement) {
  2448. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  2449. $(indicators).removeClass(ClassName$2.ACTIVE);
  2450. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  2451. if (nextIndicator) {
  2452. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  2453. }
  2454. }
  2455. };
  2456. _proto._slide = function _slide(direction, element) {
  2457. var _this4 = this;
  2458. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2459. var activeElementIndex = this._getItemIndex(activeElement);
  2460. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  2461. var nextElementIndex = this._getItemIndex(nextElement);
  2462. var isCycling = Boolean(this._interval);
  2463. var directionalClassName;
  2464. var orderClassName;
  2465. var eventDirectionName;
  2466. if (direction === Direction.NEXT) {
  2467. directionalClassName = ClassName$2.LEFT;
  2468. orderClassName = ClassName$2.NEXT;
  2469. eventDirectionName = Direction.LEFT;
  2470. } else {
  2471. directionalClassName = ClassName$2.RIGHT;
  2472. orderClassName = ClassName$2.PREV;
  2473. eventDirectionName = Direction.RIGHT;
  2474. }
  2475. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  2476. this._isSliding = false;
  2477. return;
  2478. }
  2479. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  2480. if (slideEvent.isDefaultPrevented()) {
  2481. return;
  2482. }
  2483. if (!activeElement || !nextElement) {
  2484. // Some weirdness is happening, so we bail
  2485. return;
  2486. }
  2487. this._isSliding = true;
  2488. if (isCycling) {
  2489. this.pause();
  2490. }
  2491. this._setActiveIndicatorElement(nextElement);
  2492. var slidEvent = $.Event(Event$2.SLID, {
  2493. relatedTarget: nextElement,
  2494. direction: eventDirectionName,
  2495. from: activeElementIndex,
  2496. to: nextElementIndex
  2497. });
  2498. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  2499. $(nextElement).addClass(orderClassName);
  2500. Util.reflow(nextElement);
  2501. $(activeElement).addClass(directionalClassName);
  2502. $(nextElement).addClass(directionalClassName);
  2503. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  2504. if (nextElementInterval) {
  2505. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  2506. this._config.interval = nextElementInterval;
  2507. } else {
  2508. this._config.interval = this._config.defaultInterval || this._config.interval;
  2509. }
  2510. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  2511. $(activeElement).one(Util.TRANSITION_END, function () {
  2512. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  2513. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  2514. _this4._isSliding = false;
  2515. setTimeout(function () {
  2516. return $(_this4._element).trigger(slidEvent);
  2517. }, 0);
  2518. }).emulateTransitionEnd(transitionDuration);
  2519. } else {
  2520. $(activeElement).removeClass(ClassName$2.ACTIVE);
  2521. $(nextElement).addClass(ClassName$2.ACTIVE);
  2522. this._isSliding = false;
  2523. $(this._element).trigger(slidEvent);
  2524. }
  2525. if (isCycling) {
  2526. this.cycle();
  2527. }
  2528. } // Static
  2529. ;
  2530. Carousel._jQueryInterface = function _jQueryInterface(config) {
  2531. return this.each(function () {
  2532. var data = $(this).data(DATA_KEY$2);
  2533. var _config = _objectSpread2({}, Default, {}, $(this).data());
  2534. if (typeof config === 'object') {
  2535. _config = _objectSpread2({}, _config, {}, config);
  2536. }
  2537. var action = typeof config === 'string' ? config : _config.slide;
  2538. if (!data) {
  2539. data = new Carousel(this, _config);
  2540. $(this).data(DATA_KEY$2, data);
  2541. }
  2542. if (typeof config === 'number') {
  2543. data.to(config);
  2544. } else if (typeof action === 'string') {
  2545. if (typeof data[action] === 'undefined') {
  2546. throw new TypeError("No method named \"" + action + "\"");
  2547. }
  2548. data[action]();
  2549. } else if (_config.interval && _config.ride) {
  2550. data.pause();
  2551. data.cycle();
  2552. }
  2553. });
  2554. };
  2555. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  2556. var selector = Util.getSelectorFromElement(this);
  2557. if (!selector) {
  2558. return;
  2559. }
  2560. var target = $(selector)[0];
  2561. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  2562. return;
  2563. }
  2564. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  2565. var slideIndex = this.getAttribute('data-slide-to');
  2566. if (slideIndex) {
  2567. config.interval = false;
  2568. }
  2569. Carousel._jQueryInterface.call($(target), config);
  2570. if (slideIndex) {
  2571. $(target).data(DATA_KEY$2).to(slideIndex);
  2572. }
  2573. event.preventDefault();
  2574. };
  2575. _createClass(Carousel, null, [{
  2576. key: "VERSION",
  2577. get: function get() {
  2578. return VERSION$2;
  2579. }
  2580. }, {
  2581. key: "Default",
  2582. get: function get() {
  2583. return Default;
  2584. }
  2585. }]);
  2586. return Carousel;
  2587. }();
  2588. /**
  2589. * ------------------------------------------------------------------------
  2590. * Data Api implementation
  2591. * ------------------------------------------------------------------------
  2592. */
  2593. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  2594. $(window).on(Event$2.LOAD_DATA_API, function () {
  2595. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  2596. for (var i = 0, len = carousels.length; i < len; i++) {
  2597. var $carousel = $(carousels[i]);
  2598. Carousel._jQueryInterface.call($carousel, $carousel.data());
  2599. }
  2600. });
  2601. /**
  2602. * ------------------------------------------------------------------------
  2603. * jQuery
  2604. * ------------------------------------------------------------------------
  2605. */
  2606. $.fn[NAME$2] = Carousel._jQueryInterface;
  2607. $.fn[NAME$2].Constructor = Carousel;
  2608. $.fn[NAME$2].noConflict = function () {
  2609. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  2610. return Carousel._jQueryInterface;
  2611. };
  2612. /**
  2613. * ------------------------------------------------------------------------
  2614. * Constants
  2615. * ------------------------------------------------------------------------
  2616. */
  2617. var NAME$3 = 'collapse';
  2618. var VERSION$3 = '4.4.1';
  2619. var DATA_KEY$3 = 'bs.collapse';
  2620. var EVENT_KEY$3 = "." + DATA_KEY$3;
  2621. var DATA_API_KEY$3 = '.data-api';
  2622. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  2623. var Default$1 = {
  2624. toggle: true,
  2625. parent: ''
  2626. };
  2627. var DefaultType$1 = {
  2628. toggle: 'boolean',
  2629. parent: '(string|element)'
  2630. };
  2631. var Event$3 = {
  2632. SHOW: "show" + EVENT_KEY$3,
  2633. SHOWN: "shown" + EVENT_KEY$3,
  2634. HIDE: "hide" + EVENT_KEY$3,
  2635. HIDDEN: "hidden" + EVENT_KEY$3,
  2636. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  2637. };
  2638. var ClassName$3 = {
  2639. SHOW: 'show',
  2640. COLLAPSE: 'collapse',
  2641. COLLAPSING: 'collapsing',
  2642. COLLAPSED: 'collapsed'
  2643. };
  2644. var Dimension = {
  2645. WIDTH: 'width',
  2646. HEIGHT: 'height'
  2647. };
  2648. var Selector$3 = {
  2649. ACTIVES: '.show, .collapsing',
  2650. DATA_TOGGLE: '[data-toggle="collapse"]'
  2651. };
  2652. /**
  2653. * ------------------------------------------------------------------------
  2654. * Class Definition
  2655. * ------------------------------------------------------------------------
  2656. */
  2657. var Collapse =
  2658. /*#__PURE__*/
  2659. function () {
  2660. function Collapse(element, config) {
  2661. this._isTransitioning = false;
  2662. this._element = element;
  2663. this._config = this._getConfig(config);
  2664. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  2665. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  2666. for (var i = 0, len = toggleList.length; i < len; i++) {
  2667. var elem = toggleList[i];
  2668. var selector = Util.getSelectorFromElement(elem);
  2669. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  2670. return foundElem === element;
  2671. });
  2672. if (selector !== null && filterElement.length > 0) {
  2673. this._selector = selector;
  2674. this._triggerArray.push(elem);
  2675. }
  2676. }
  2677. this._parent = this._config.parent ? this._getParent() : null;
  2678. if (!this._config.parent) {
  2679. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  2680. }
  2681. if (this._config.toggle) {
  2682. this.toggle();
  2683. }
  2684. } // Getters
  2685. var _proto = Collapse.prototype;
  2686. // Public
  2687. _proto.toggle = function toggle() {
  2688. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  2689. this.hide();
  2690. } else {
  2691. this.show();
  2692. }
  2693. };
  2694. _proto.show = function show() {
  2695. var _this = this;
  2696. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  2697. return;
  2698. }
  2699. var actives;
  2700. var activesData;
  2701. if (this._parent) {
  2702. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  2703. if (typeof _this._config.parent === 'string') {
  2704. return elem.getAttribute('data-parent') === _this._config.parent;
  2705. }
  2706. return elem.classList.contains(ClassName$3.COLLAPSE);
  2707. });
  2708. if (actives.length === 0) {
  2709. actives = null;
  2710. }
  2711. }
  2712. if (actives) {
  2713. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  2714. if (activesData && activesData._isTransitioning) {
  2715. return;
  2716. }
  2717. }
  2718. var startEvent = $.Event(Event$3.SHOW);
  2719. $(this._element).trigger(startEvent);
  2720. if (startEvent.isDefaultPrevented()) {
  2721. return;
  2722. }
  2723. if (actives) {
  2724. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  2725. if (!activesData) {
  2726. $(actives).data(DATA_KEY$3, null);
  2727. }
  2728. }
  2729. var dimension = this._getDimension();
  2730. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  2731. this._element.style[dimension] = 0;
  2732. if (this._triggerArray.length) {
  2733. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  2734. }
  2735. this.setTransitioning(true);
  2736. var complete = function complete() {
  2737. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  2738. _this._element.style[dimension] = '';
  2739. _this.setTransitioning(false);
  2740. $(_this._element).trigger(Event$3.SHOWN);
  2741. };
  2742. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  2743. var scrollSize = "scroll" + capitalizedDimension;
  2744. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  2745. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  2746. this._element.style[dimension] = this._element[scrollSize] + "px";
  2747. };
  2748. _proto.hide = function hide() {
  2749. var _this2 = this;
  2750. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  2751. return;
  2752. }
  2753. var startEvent = $.Event(Event$3.HIDE);
  2754. $(this._element).trigger(startEvent);
  2755. if (startEvent.isDefaultPrevented()) {
  2756. return;
  2757. }
  2758. var dimension = this._getDimension();
  2759. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  2760. Util.reflow(this._element);
  2761. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  2762. var triggerArrayLength = this._triggerArray.length;
  2763. if (triggerArrayLength > 0) {
  2764. for (var i = 0; i < triggerArrayLength; i++) {
  2765. var trigger = this._triggerArray[i];
  2766. var selector = Util.getSelectorFromElement(trigger);
  2767. if (selector !== null) {
  2768. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  2769. if (!$elem.hasClass(ClassName$3.SHOW)) {
  2770. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  2771. }
  2772. }
  2773. }
  2774. }
  2775. this.setTransitioning(true);
  2776. var complete = function complete() {
  2777. _this2.setTransitioning(false);
  2778. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  2779. };
  2780. this._element.style[dimension] = '';
  2781. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  2782. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  2783. };
  2784. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  2785. this._isTransitioning = isTransitioning;
  2786. };
  2787. _proto.dispose = function dispose() {
  2788. $.removeData(this._element, DATA_KEY$3);
  2789. this._config = null;
  2790. this._parent = null;
  2791. this._element = null;
  2792. this._triggerArray = null;
  2793. this._isTransitioning = null;
  2794. } // Private
  2795. ;
  2796. _proto._getConfig = function _getConfig(config) {
  2797. config = _objectSpread2({}, Default$1, {}, config);
  2798. config.toggle = Boolean(config.toggle); // Coerce string values
  2799. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  2800. return config;
  2801. };
  2802. _proto._getDimension = function _getDimension() {
  2803. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  2804. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  2805. };
  2806. _proto._getParent = function _getParent() {
  2807. var _this3 = this;
  2808. var parent;
  2809. if (Util.isElement(this._config.parent)) {
  2810. parent = this._config.parent; // It's a jQuery object
  2811. if (typeof this._config.parent.jquery !== 'undefined') {
  2812. parent = this._config.parent[0];
  2813. }
  2814. } else {
  2815. parent = document.querySelector(this._config.parent);
  2816. }
  2817. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  2818. var children = [].slice.call(parent.querySelectorAll(selector));
  2819. $(children).each(function (i, element) {
  2820. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  2821. });
  2822. return parent;
  2823. };
  2824. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  2825. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  2826. if (triggerArray.length) {
  2827. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  2828. }
  2829. } // Static
  2830. ;
  2831. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  2832. var selector = Util.getSelectorFromElement(element);
  2833. return selector ? document.querySelector(selector) : null;
  2834. };
  2835. Collapse._jQueryInterface = function _jQueryInterface(config) {
  2836. return this.each(function () {
  2837. var $this = $(this);
  2838. var data = $this.data(DATA_KEY$3);
  2839. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  2840. if (!data && _config.toggle && /show|hide/.test(config)) {
  2841. _config.toggle = false;
  2842. }
  2843. if (!data) {
  2844. data = new Collapse(this, _config);
  2845. $this.data(DATA_KEY$3, data);
  2846. }
  2847. if (typeof config === 'string') {
  2848. if (typeof data[config] === 'undefined') {
  2849. throw new TypeError("No method named \"" + config + "\"");
  2850. }
  2851. data[config]();
  2852. }
  2853. });
  2854. };
  2855. _createClass(Collapse, null, [{
  2856. key: "VERSION",
  2857. get: function get() {
  2858. return VERSION$3;
  2859. }
  2860. }, {
  2861. key: "Default",
  2862. get: function get() {
  2863. return Default$1;
  2864. }
  2865. }]);
  2866. return Collapse;
  2867. }();
  2868. /**
  2869. * ------------------------------------------------------------------------
  2870. * Data Api implementation
  2871. * ------------------------------------------------------------------------
  2872. */
  2873. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  2874. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  2875. if (event.currentTarget.tagName === 'A') {
  2876. event.preventDefault();
  2877. }
  2878. var $trigger = $(this);
  2879. var selector = Util.getSelectorFromElement(this);
  2880. var selectors = [].slice.call(document.querySelectorAll(selector));
  2881. $(selectors).each(function () {
  2882. var $target = $(this);
  2883. var data = $target.data(DATA_KEY$3);
  2884. var config = data ? 'toggle' : $trigger.data();
  2885. Collapse._jQueryInterface.call($target, config);
  2886. });
  2887. });
  2888. /**
  2889. * ------------------------------------------------------------------------
  2890. * jQuery
  2891. * ------------------------------------------------------------------------
  2892. */
  2893. $.fn[NAME$3] = Collapse._jQueryInterface;
  2894. $.fn[NAME$3].Constructor = Collapse;
  2895. $.fn[NAME$3].noConflict = function () {
  2896. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  2897. return Collapse._jQueryInterface;
  2898. };
  2899. /**
  2900. * ------------------------------------------------------------------------
  2901. * Constants
  2902. * ------------------------------------------------------------------------
  2903. */
  2904. var NAME$4 = 'dropdown';
  2905. var VERSION$4 = '4.4.1';
  2906. var DATA_KEY$4 = 'bs.dropdown';
  2907. var EVENT_KEY$4 = "." + DATA_KEY$4;
  2908. var DATA_API_KEY$4 = '.data-api';
  2909. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  2910. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  2911. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  2912. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  2913. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  2914. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  2915. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  2916. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  2917. var Event$4 = {
  2918. HIDE: "hide" + EVENT_KEY$4,
  2919. HIDDEN: "hidden" + EVENT_KEY$4,
  2920. SHOW: "show" + EVENT_KEY$4,
  2921. SHOWN: "shown" + EVENT_KEY$4,
  2922. CLICK: "click" + EVENT_KEY$4,
  2923. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  2924. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  2925. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  2926. };
  2927. var ClassName$4 = {
  2928. DISABLED: 'disabled',
  2929. SHOW: 'show',
  2930. DROPUP: 'dropup',
  2931. DROPRIGHT: 'dropright',
  2932. DROPLEFT: 'dropleft',
  2933. MENURIGHT: 'dropdown-menu-right',
  2934. MENULEFT: 'dropdown-menu-left',
  2935. POSITION_STATIC: 'position-static'
  2936. };
  2937. var Selector$4 = {
  2938. DATA_TOGGLE: '[data-toggle="dropdown"]',
  2939. FORM_CHILD: '.dropdown form',
  2940. MENU: '.dropdown-menu',
  2941. NAVBAR_NAV: '.navbar-nav',
  2942. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  2943. };
  2944. var AttachmentMap = {
  2945. TOP: 'top-start',
  2946. TOPEND: 'top-end',
  2947. BOTTOM: 'bottom-start',
  2948. BOTTOMEND: 'bottom-end',
  2949. RIGHT: 'right-start',
  2950. RIGHTEND: 'right-end',
  2951. LEFT: 'left-start',
  2952. LEFTEND: 'left-end'
  2953. };
  2954. var Default$2 = {
  2955. offset: 0,
  2956. flip: true,
  2957. boundary: 'scrollParent',
  2958. reference: 'toggle',
  2959. display: 'dynamic',
  2960. popperConfig: null
  2961. };
  2962. var DefaultType$2 = {
  2963. offset: '(number|string|function)',
  2964. flip: 'boolean',
  2965. boundary: '(string|element)',
  2966. reference: '(string|element)',
  2967. display: 'string',
  2968. popperConfig: '(null|object)'
  2969. };
  2970. /**
  2971. * ------------------------------------------------------------------------
  2972. * Class Definition
  2973. * ------------------------------------------------------------------------
  2974. */
  2975. var Dropdown =
  2976. /*#__PURE__*/
  2977. function () {
  2978. function Dropdown(element, config) {
  2979. this._element = element;
  2980. this._popper = null;
  2981. this._config = this._getConfig(config);
  2982. this._menu = this._getMenuElement();
  2983. this._inNavbar = this._detectNavbar();
  2984. this._addEventListeners();
  2985. } // Getters
  2986. var _proto = Dropdown.prototype;
  2987. // Public
  2988. _proto.toggle = function toggle() {
  2989. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  2990. return;
  2991. }
  2992. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  2993. Dropdown._clearMenus();
  2994. if (isActive) {
  2995. return;
  2996. }
  2997. this.show(true);
  2998. };
  2999. _proto.show = function show(usePopper) {
  3000. if (usePopper === void 0) {
  3001. usePopper = false;
  3002. }
  3003. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3004. return;
  3005. }
  3006. var relatedTarget = {
  3007. relatedTarget: this._element
  3008. };
  3009. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3010. var parent = Dropdown._getParentFromElement(this._element);
  3011. $(parent).trigger(showEvent);
  3012. if (showEvent.isDefaultPrevented()) {
  3013. return;
  3014. } // Disable totally Popper.js for Dropdown in Navbar
  3015. if (!this._inNavbar && usePopper) {
  3016. /**
  3017. * Check for Popper dependency
  3018. * Popper - https://popper.js.org
  3019. */
  3020. if (typeof Popper === 'undefined') {
  3021. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3022. }
  3023. var referenceElement = this._element;
  3024. if (this._config.reference === 'parent') {
  3025. referenceElement = parent;
  3026. } else if (Util.isElement(this._config.reference)) {
  3027. referenceElement = this._config.reference; // Check if it's jQuery element
  3028. if (typeof this._config.reference.jquery !== 'undefined') {
  3029. referenceElement = this._config.reference[0];
  3030. }
  3031. } // If boundary is not `scrollParent`, then set position to `static`
  3032. // to allow the menu to "escape" the scroll parent's boundaries
  3033. // https://github.com/twbs/bootstrap/issues/24251
  3034. if (this._config.boundary !== 'scrollParent') {
  3035. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3036. }
  3037. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3038. } // If this is a touch-enabled device we add extra
  3039. // empty mouseover listeners to the body's immediate children;
  3040. // only needed because of broken event delegation on iOS
  3041. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3042. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3043. $(document.body).children().on('mouseover', null, $.noop);
  3044. }
  3045. this._element.focus();
  3046. this._element.setAttribute('aria-expanded', true);
  3047. $(this._menu).toggleClass(ClassName$4.SHOW);
  3048. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3049. };
  3050. _proto.hide = function hide() {
  3051. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3052. return;
  3053. }
  3054. var relatedTarget = {
  3055. relatedTarget: this._element
  3056. };
  3057. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3058. var parent = Dropdown._getParentFromElement(this._element);
  3059. $(parent).trigger(hideEvent);
  3060. if (hideEvent.isDefaultPrevented()) {
  3061. return;
  3062. }
  3063. if (this._popper) {
  3064. this._popper.destroy();
  3065. }
  3066. $(this._menu).toggleClass(ClassName$4.SHOW);
  3067. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3068. };
  3069. _proto.dispose = function dispose() {
  3070. $.removeData(this._element, DATA_KEY$4);
  3071. $(this._element).off(EVENT_KEY$4);
  3072. this._element = null;
  3073. this._menu = null;
  3074. if (this._popper !== null) {
  3075. this._popper.destroy();
  3076. this._popper = null;
  3077. }
  3078. };
  3079. _proto.update = function update() {
  3080. this._inNavbar = this._detectNavbar();
  3081. if (this._popper !== null) {
  3082. this._popper.scheduleUpdate();
  3083. }
  3084. } // Private
  3085. ;
  3086. _proto._addEventListeners = function _addEventListeners() {
  3087. var _this = this;
  3088. $(this._element).on(Event$4.CLICK, function (event) {
  3089. event.preventDefault();
  3090. event.stopPropagation();
  3091. _this.toggle();
  3092. });
  3093. };
  3094. _proto._getConfig = function _getConfig(config) {
  3095. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3096. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3097. return config;
  3098. };
  3099. _proto._getMenuElement = function _getMenuElement() {
  3100. if (!this._menu) {
  3101. var parent = Dropdown._getParentFromElement(this._element);
  3102. if (parent) {
  3103. this._menu = parent.querySelector(Selector$4.MENU);
  3104. }
  3105. }
  3106. return this._menu;
  3107. };
  3108. _proto._getPlacement = function _getPlacement() {
  3109. var $parentDropdown = $(this._element.parentNode);
  3110. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3111. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3112. placement = AttachmentMap.TOP;
  3113. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3114. placement = AttachmentMap.TOPEND;
  3115. }
  3116. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3117. placement = AttachmentMap.RIGHT;
  3118. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3119. placement = AttachmentMap.LEFT;
  3120. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3121. placement = AttachmentMap.BOTTOMEND;
  3122. }
  3123. return placement;
  3124. };
  3125. _proto._detectNavbar = function _detectNavbar() {
  3126. return $(this._element).closest('.navbar').length > 0;
  3127. };
  3128. _proto._getOffset = function _getOffset() {
  3129. var _this2 = this;
  3130. var offset = {};
  3131. if (typeof this._config.offset === 'function') {
  3132. offset.fn = function (data) {
  3133. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3134. return data;
  3135. };
  3136. } else {
  3137. offset.offset = this._config.offset;
  3138. }
  3139. return offset;
  3140. };
  3141. _proto._getPopperConfig = function _getPopperConfig() {
  3142. var popperConfig = {
  3143. placement: this._getPlacement(),
  3144. modifiers: {
  3145. offset: this._getOffset(),
  3146. flip: {
  3147. enabled: this._config.flip
  3148. },
  3149. preventOverflow: {
  3150. boundariesElement: this._config.boundary
  3151. }
  3152. }
  3153. }; // Disable Popper.js if we have a static display
  3154. if (this._config.display === 'static') {
  3155. popperConfig.modifiers.applyStyle = {
  3156. enabled: false
  3157. };
  3158. }
  3159. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3160. } // Static
  3161. ;
  3162. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3163. return this.each(function () {
  3164. var data = $(this).data(DATA_KEY$4);
  3165. var _config = typeof config === 'object' ? config : null;
  3166. if (!data) {
  3167. data = new Dropdown(this, _config);
  3168. $(this).data(DATA_KEY$4, data);
  3169. }
  3170. if (typeof config === 'string') {
  3171. if (typeof data[config] === 'undefined') {
  3172. throw new TypeError("No method named \"" + config + "\"");
  3173. }
  3174. data[config]();
  3175. }
  3176. });
  3177. };
  3178. Dropdown._clearMenus = function _clearMenus(event) {
  3179. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3180. return;
  3181. }
  3182. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3183. for (var i = 0, len = toggles.length; i < len; i++) {
  3184. var parent = Dropdown._getParentFromElement(toggles[i]);
  3185. var context = $(toggles[i]).data(DATA_KEY$4);
  3186. var relatedTarget = {
  3187. relatedTarget: toggles[i]
  3188. };
  3189. if (event && event.type === 'click') {
  3190. relatedTarget.clickEvent = event;
  3191. }
  3192. if (!context) {
  3193. continue;
  3194. }
  3195. var dropdownMenu = context._menu;
  3196. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3197. continue;
  3198. }
  3199. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3200. continue;
  3201. }
  3202. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3203. $(parent).trigger(hideEvent);
  3204. if (hideEvent.isDefaultPrevented()) {
  3205. continue;
  3206. } // If this is a touch-enabled device we remove the extra
  3207. // empty mouseover listeners we added for iOS support
  3208. if ('ontouchstart' in document.documentElement) {
  3209. $(document.body).children().off('mouseover', null, $.noop);
  3210. }
  3211. toggles[i].setAttribute('aria-expanded', 'false');
  3212. if (context._popper) {
  3213. context._popper.destroy();
  3214. }
  3215. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3216. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3217. }
  3218. };
  3219. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3220. var parent;
  3221. var selector = Util.getSelectorFromElement(element);
  3222. if (selector) {
  3223. parent = document.querySelector(selector);
  3224. }
  3225. return parent || element.parentNode;
  3226. } // eslint-disable-next-line complexity
  3227. ;
  3228. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3229. // If not input/textarea:
  3230. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3231. // If input/textarea:
  3232. // - If space key => not a dropdown command
  3233. // - If key is other than escape
  3234. // - If key is not up or down => not a dropdown command
  3235. // - If trigger inside the menu => not a dropdown command
  3236. if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
  3237. return;
  3238. }
  3239. event.preventDefault();
  3240. event.stopPropagation();
  3241. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3242. return;
  3243. }
  3244. var parent = Dropdown._getParentFromElement(this);
  3245. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3246. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3247. return;
  3248. }
  3249. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3250. if (event.which === ESCAPE_KEYCODE) {
  3251. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3252. $(toggle).trigger('focus');
  3253. }
  3254. $(this).trigger('click');
  3255. return;
  3256. }
  3257. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  3258. return $(item).is(':visible');
  3259. });
  3260. if (items.length === 0) {
  3261. return;
  3262. }
  3263. var index = items.indexOf(event.target);
  3264. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3265. // Up
  3266. index--;
  3267. }
  3268. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3269. // Down
  3270. index++;
  3271. }
  3272. if (index < 0) {
  3273. index = 0;
  3274. }
  3275. items[index].focus();
  3276. };
  3277. _createClass(Dropdown, null, [{
  3278. key: "VERSION",
  3279. get: function get() {
  3280. return VERSION$4;
  3281. }
  3282. }, {
  3283. key: "Default",
  3284. get: function get() {
  3285. return Default$2;
  3286. }
  3287. }, {
  3288. key: "DefaultType",
  3289. get: function get() {
  3290. return DefaultType$2;
  3291. }
  3292. }]);
  3293. return Dropdown;
  3294. }();
  3295. /**
  3296. * ------------------------------------------------------------------------
  3297. * Data Api implementation
  3298. * ------------------------------------------------------------------------
  3299. */
  3300. $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
  3301. event.preventDefault();
  3302. event.stopPropagation();
  3303. Dropdown._jQueryInterface.call($(this), 'toggle');
  3304. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  3305. e.stopPropagation();
  3306. });
  3307. /**
  3308. * ------------------------------------------------------------------------
  3309. * jQuery
  3310. * ------------------------------------------------------------------------
  3311. */
  3312. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3313. $.fn[NAME$4].Constructor = Dropdown;
  3314. $.fn[NAME$4].noConflict = function () {
  3315. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3316. return Dropdown._jQueryInterface;
  3317. };
  3318. /**
  3319. * ------------------------------------------------------------------------
  3320. * Constants
  3321. * ------------------------------------------------------------------------
  3322. */
  3323. var NAME$5 = 'modal';
  3324. var VERSION$5 = '4.4.1';
  3325. var DATA_KEY$5 = 'bs.modal';
  3326. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3327. var DATA_API_KEY$5 = '.data-api';
  3328. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3329. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3330. var Default$3 = {
  3331. backdrop: true,
  3332. keyboard: true,
  3333. focus: true,
  3334. show: true
  3335. };
  3336. var DefaultType$3 = {
  3337. backdrop: '(boolean|string)',
  3338. keyboard: 'boolean',
  3339. focus: 'boolean',
  3340. show: 'boolean'
  3341. };
  3342. var Event$5 = {
  3343. HIDE: "hide" + EVENT_KEY$5,
  3344. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  3345. HIDDEN: "hidden" + EVENT_KEY$5,
  3346. SHOW: "show" + EVENT_KEY$5,
  3347. SHOWN: "shown" + EVENT_KEY$5,
  3348. FOCUSIN: "focusin" + EVENT_KEY$5,
  3349. RESIZE: "resize" + EVENT_KEY$5,
  3350. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  3351. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  3352. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  3353. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  3354. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  3355. };
  3356. var ClassName$5 = {
  3357. SCROLLABLE: 'modal-dialog-scrollable',
  3358. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  3359. BACKDROP: 'modal-backdrop',
  3360. OPEN: 'modal-open',
  3361. FADE: 'fade',
  3362. SHOW: 'show',
  3363. STATIC: 'modal-static'
  3364. };
  3365. var Selector$5 = {
  3366. DIALOG: '.modal-dialog',
  3367. MODAL_BODY: '.modal-body',
  3368. DATA_TOGGLE: '[data-toggle="modal"]',
  3369. DATA_DISMISS: '[data-dismiss="modal"]',
  3370. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  3371. STICKY_CONTENT: '.sticky-top'
  3372. };
  3373. /**
  3374. * ------------------------------------------------------------------------
  3375. * Class Definition
  3376. * ------------------------------------------------------------------------
  3377. */
  3378. var Modal =
  3379. /*#__PURE__*/
  3380. function () {
  3381. function Modal(element, config) {
  3382. this._config = this._getConfig(config);
  3383. this._element = element;
  3384. this._dialog = element.querySelector(Selector$5.DIALOG);
  3385. this._backdrop = null;
  3386. this._isShown = false;
  3387. this._isBodyOverflowing = false;
  3388. this._ignoreBackdropClick = false;
  3389. this._isTransitioning = false;
  3390. this._scrollbarWidth = 0;
  3391. } // Getters
  3392. var _proto = Modal.prototype;
  3393. // Public
  3394. _proto.toggle = function toggle(relatedTarget) {
  3395. return this._isShown ? this.hide() : this.show(relatedTarget);
  3396. };
  3397. _proto.show = function show(relatedTarget) {
  3398. var _this = this;
  3399. if (this._isShown || this._isTransitioning) {
  3400. return;
  3401. }
  3402. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3403. this._isTransitioning = true;
  3404. }
  3405. var showEvent = $.Event(Event$5.SHOW, {
  3406. relatedTarget: relatedTarget
  3407. });
  3408. $(this._element).trigger(showEvent);
  3409. if (this._isShown || showEvent.isDefaultPrevented()) {
  3410. return;
  3411. }
  3412. this._isShown = true;
  3413. this._checkScrollbar();
  3414. this._setScrollbar();
  3415. this._adjustDialog();
  3416. this._setEscapeEvent();
  3417. this._setResizeEvent();
  3418. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  3419. return _this.hide(event);
  3420. });
  3421. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  3422. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  3423. if ($(event.target).is(_this._element)) {
  3424. _this._ignoreBackdropClick = true;
  3425. }
  3426. });
  3427. });
  3428. this._showBackdrop(function () {
  3429. return _this._showElement(relatedTarget);
  3430. });
  3431. };
  3432. _proto.hide = function hide(event) {
  3433. var _this2 = this;
  3434. if (event) {
  3435. event.preventDefault();
  3436. }
  3437. if (!this._isShown || this._isTransitioning) {
  3438. return;
  3439. }
  3440. var hideEvent = $.Event(Event$5.HIDE);
  3441. $(this._element).trigger(hideEvent);
  3442. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3443. return;
  3444. }
  3445. this._isShown = false;
  3446. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3447. if (transition) {
  3448. this._isTransitioning = true;
  3449. }
  3450. this._setEscapeEvent();
  3451. this._setResizeEvent();
  3452. $(document).off(Event$5.FOCUSIN);
  3453. $(this._element).removeClass(ClassName$5.SHOW);
  3454. $(this._element).off(Event$5.CLICK_DISMISS);
  3455. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  3456. if (transition) {
  3457. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3458. $(this._element).one(Util.TRANSITION_END, function (event) {
  3459. return _this2._hideModal(event);
  3460. }).emulateTransitionEnd(transitionDuration);
  3461. } else {
  3462. this._hideModal();
  3463. }
  3464. };
  3465. _proto.dispose = function dispose() {
  3466. [window, this._element, this._dialog].forEach(function (htmlElement) {
  3467. return $(htmlElement).off(EVENT_KEY$5);
  3468. });
  3469. /**
  3470. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  3471. * Do not move `document` in `htmlElements` array
  3472. * It will remove `Event.CLICK_DATA_API` event that should remain
  3473. */
  3474. $(document).off(Event$5.FOCUSIN);
  3475. $.removeData(this._element, DATA_KEY$5);
  3476. this._config = null;
  3477. this._element = null;
  3478. this._dialog = null;
  3479. this._backdrop = null;
  3480. this._isShown = null;
  3481. this._isBodyOverflowing = null;
  3482. this._ignoreBackdropClick = null;
  3483. this._isTransitioning = null;
  3484. this._scrollbarWidth = null;
  3485. };
  3486. _proto.handleUpdate = function handleUpdate() {
  3487. this._adjustDialog();
  3488. } // Private
  3489. ;
  3490. _proto._getConfig = function _getConfig(config) {
  3491. config = _objectSpread2({}, Default$3, {}, config);
  3492. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  3493. return config;
  3494. };
  3495. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  3496. var _this3 = this;
  3497. if (this._config.backdrop === 'static') {
  3498. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  3499. $(this._element).trigger(hideEventPrevented);
  3500. if (hideEventPrevented.defaultPrevented) {
  3501. return;
  3502. }
  3503. this._element.classList.add(ClassName$5.STATIC);
  3504. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  3505. $(this._element).one(Util.TRANSITION_END, function () {
  3506. _this3._element.classList.remove(ClassName$5.STATIC);
  3507. }).emulateTransitionEnd(modalTransitionDuration);
  3508. this._element.focus();
  3509. } else {
  3510. this.hide();
  3511. }
  3512. };
  3513. _proto._showElement = function _showElement(relatedTarget) {
  3514. var _this4 = this;
  3515. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3516. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  3517. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  3518. // Don't move modal's DOM position
  3519. document.body.appendChild(this._element);
  3520. }
  3521. this._element.style.display = 'block';
  3522. this._element.removeAttribute('aria-hidden');
  3523. this._element.setAttribute('aria-modal', true);
  3524. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  3525. modalBody.scrollTop = 0;
  3526. } else {
  3527. this._element.scrollTop = 0;
  3528. }
  3529. if (transition) {
  3530. Util.reflow(this._element);
  3531. }
  3532. $(this._element).addClass(ClassName$5.SHOW);
  3533. if (this._config.focus) {
  3534. this._enforceFocus();
  3535. }
  3536. var shownEvent = $.Event(Event$5.SHOWN, {
  3537. relatedTarget: relatedTarget
  3538. });
  3539. var transitionComplete = function transitionComplete() {
  3540. if (_this4._config.focus) {
  3541. _this4._element.focus();
  3542. }
  3543. _this4._isTransitioning = false;
  3544. $(_this4._element).trigger(shownEvent);
  3545. };
  3546. if (transition) {
  3547. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3548. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  3549. } else {
  3550. transitionComplete();
  3551. }
  3552. };
  3553. _proto._enforceFocus = function _enforceFocus() {
  3554. var _this5 = this;
  3555. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  3556. .on(Event$5.FOCUSIN, function (event) {
  3557. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  3558. _this5._element.focus();
  3559. }
  3560. });
  3561. };
  3562. _proto._setEscapeEvent = function _setEscapeEvent() {
  3563. var _this6 = this;
  3564. if (this._isShown && this._config.keyboard) {
  3565. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  3566. if (event.which === ESCAPE_KEYCODE$1) {
  3567. _this6._triggerBackdropTransition();
  3568. }
  3569. });
  3570. } else if (!this._isShown) {
  3571. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  3572. }
  3573. };
  3574. _proto._setResizeEvent = function _setResizeEvent() {
  3575. var _this7 = this;
  3576. if (this._isShown) {
  3577. $(window).on(Event$5.RESIZE, function (event) {
  3578. return _this7.handleUpdate(event);
  3579. });
  3580. } else {
  3581. $(window).off(Event$5.RESIZE);
  3582. }
  3583. };
  3584. _proto._hideModal = function _hideModal() {
  3585. var _this8 = this;
  3586. this._element.style.display = 'none';
  3587. this._element.setAttribute('aria-hidden', true);
  3588. this._element.removeAttribute('aria-modal');
  3589. this._isTransitioning = false;
  3590. this._showBackdrop(function () {
  3591. $(document.body).removeClass(ClassName$5.OPEN);
  3592. _this8._resetAdjustments();
  3593. _this8._resetScrollbar();
  3594. $(_this8._element).trigger(Event$5.HIDDEN);
  3595. });
  3596. };
  3597. _proto._removeBackdrop = function _removeBackdrop() {
  3598. if (this._backdrop) {
  3599. $(this._backdrop).remove();
  3600. this._backdrop = null;
  3601. }
  3602. };
  3603. _proto._showBackdrop = function _showBackdrop(callback) {
  3604. var _this9 = this;
  3605. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  3606. if (this._isShown && this._config.backdrop) {
  3607. this._backdrop = document.createElement('div');
  3608. this._backdrop.className = ClassName$5.BACKDROP;
  3609. if (animate) {
  3610. this._backdrop.classList.add(animate);
  3611. }
  3612. $(this._backdrop).appendTo(document.body);
  3613. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  3614. if (_this9._ignoreBackdropClick) {
  3615. _this9._ignoreBackdropClick = false;
  3616. return;
  3617. }
  3618. if (event.target !== event.currentTarget) {
  3619. return;
  3620. }
  3621. _this9._triggerBackdropTransition();
  3622. });
  3623. if (animate) {
  3624. Util.reflow(this._backdrop);
  3625. }
  3626. $(this._backdrop).addClass(ClassName$5.SHOW);
  3627. if (!callback) {
  3628. return;
  3629. }
  3630. if (!animate) {
  3631. callback();
  3632. return;
  3633. }
  3634. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3635. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  3636. } else if (!this._isShown && this._backdrop) {
  3637. $(this._backdrop).removeClass(ClassName$5.SHOW);
  3638. var callbackRemove = function callbackRemove() {
  3639. _this9._removeBackdrop();
  3640. if (callback) {
  3641. callback();
  3642. }
  3643. };
  3644. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3645. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3646. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  3647. } else {
  3648. callbackRemove();
  3649. }
  3650. } else if (callback) {
  3651. callback();
  3652. }
  3653. } // ----------------------------------------------------------------------
  3654. // the following methods are used to handle overflowing modals
  3655. // todo (fat): these should probably be refactored out of modal.js
  3656. // ----------------------------------------------------------------------
  3657. ;
  3658. _proto._adjustDialog = function _adjustDialog() {
  3659. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  3660. if (!this._isBodyOverflowing && isModalOverflowing) {
  3661. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  3662. }
  3663. if (this._isBodyOverflowing && !isModalOverflowing) {
  3664. this._element.style.paddingRight = this._scrollbarWidth + "px";
  3665. }
  3666. };
  3667. _proto._resetAdjustments = function _resetAdjustments() {
  3668. this._element.style.paddingLeft = '';
  3669. this._element.style.paddingRight = '';
  3670. };
  3671. _proto._checkScrollbar = function _checkScrollbar() {
  3672. var rect = document.body.getBoundingClientRect();
  3673. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  3674. this._scrollbarWidth = this._getScrollbarWidth();
  3675. };
  3676. _proto._setScrollbar = function _setScrollbar() {
  3677. var _this10 = this;
  3678. if (this._isBodyOverflowing) {
  3679. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  3680. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  3681. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  3682. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  3683. $(fixedContent).each(function (index, element) {
  3684. var actualPadding = element.style.paddingRight;
  3685. var calculatedPadding = $(element).css('padding-right');
  3686. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  3687. }); // Adjust sticky content margin
  3688. $(stickyContent).each(function (index, element) {
  3689. var actualMargin = element.style.marginRight;
  3690. var calculatedMargin = $(element).css('margin-right');
  3691. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  3692. }); // Adjust body padding
  3693. var actualPadding = document.body.style.paddingRight;
  3694. var calculatedPadding = $(document.body).css('padding-right');
  3695. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  3696. }
  3697. $(document.body).addClass(ClassName$5.OPEN);
  3698. };
  3699. _proto._resetScrollbar = function _resetScrollbar() {
  3700. // Restore fixed content padding
  3701. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  3702. $(fixedContent).each(function (index, element) {
  3703. var padding = $(element).data('padding-right');
  3704. $(element).removeData('padding-right');
  3705. element.style.paddingRight = padding ? padding : '';
  3706. }); // Restore sticky content
  3707. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  3708. $(elements).each(function (index, element) {
  3709. var margin = $(element).data('margin-right');
  3710. if (typeof margin !== 'undefined') {
  3711. $(element).css('margin-right', margin).removeData('margin-right');
  3712. }
  3713. }); // Restore body padding
  3714. var padding = $(document.body).data('padding-right');
  3715. $(document.body).removeData('padding-right');
  3716. document.body.style.paddingRight = padding ? padding : '';
  3717. };
  3718. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  3719. // thx d.walsh
  3720. var scrollDiv = document.createElement('div');
  3721. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  3722. document.body.appendChild(scrollDiv);
  3723. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  3724. document.body.removeChild(scrollDiv);
  3725. return scrollbarWidth;
  3726. } // Static
  3727. ;
  3728. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  3729. return this.each(function () {
  3730. var data = $(this).data(DATA_KEY$5);
  3731. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  3732. if (!data) {
  3733. data = new Modal(this, _config);
  3734. $(this).data(DATA_KEY$5, data);
  3735. }
  3736. if (typeof config === 'string') {
  3737. if (typeof data[config] === 'undefined') {
  3738. throw new TypeError("No method named \"" + config + "\"");
  3739. }
  3740. data[config](relatedTarget);
  3741. } else if (_config.show) {
  3742. data.show(relatedTarget);
  3743. }
  3744. });
  3745. };
  3746. _createClass(Modal, null, [{
  3747. key: "VERSION",
  3748. get: function get() {
  3749. return VERSION$5;
  3750. }
  3751. }, {
  3752. key: "Default",
  3753. get: function get() {
  3754. return Default$3;
  3755. }
  3756. }]);
  3757. return Modal;
  3758. }();
  3759. /**
  3760. * ------------------------------------------------------------------------
  3761. * Data Api implementation
  3762. * ------------------------------------------------------------------------
  3763. */
  3764. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  3765. var _this11 = this;
  3766. var target;
  3767. var selector = Util.getSelectorFromElement(this);
  3768. if (selector) {
  3769. target = document.querySelector(selector);
  3770. }
  3771. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  3772. if (this.tagName === 'A' || this.tagName === 'AREA') {
  3773. event.preventDefault();
  3774. }
  3775. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  3776. if (showEvent.isDefaultPrevented()) {
  3777. // Only register focus restorer if modal will actually get shown
  3778. return;
  3779. }
  3780. $target.one(Event$5.HIDDEN, function () {
  3781. if ($(_this11).is(':visible')) {
  3782. _this11.focus();
  3783. }
  3784. });
  3785. });
  3786. Modal._jQueryInterface.call($(target), config, this);
  3787. });
  3788. /**
  3789. * ------------------------------------------------------------------------
  3790. * jQuery
  3791. * ------------------------------------------------------------------------
  3792. */
  3793. $.fn[NAME$5] = Modal._jQueryInterface;
  3794. $.fn[NAME$5].Constructor = Modal;
  3795. $.fn[NAME$5].noConflict = function () {
  3796. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  3797. return Modal._jQueryInterface;
  3798. };
  3799. /**
  3800. * --------------------------------------------------------------------------
  3801. * Bootstrap (v4.4.1): tools/sanitizer.js
  3802. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3803. * --------------------------------------------------------------------------
  3804. */
  3805. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  3806. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  3807. var DefaultWhitelist = {
  3808. // Global attributes allowed on any supplied element below.
  3809. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  3810. a: ['target', 'href', 'title', 'rel'],
  3811. area: [],
  3812. b: [],
  3813. br: [],
  3814. col: [],
  3815. code: [],
  3816. div: [],
  3817. em: [],
  3818. hr: [],
  3819. h1: [],
  3820. h2: [],
  3821. h3: [],
  3822. h4: [],
  3823. h5: [],
  3824. h6: [],
  3825. i: [],
  3826. img: ['src', 'alt', 'title', 'width', 'height'],
  3827. li: [],
  3828. ol: [],
  3829. p: [],
  3830. pre: [],
  3831. s: [],
  3832. small: [],
  3833. span: [],
  3834. sub: [],
  3835. sup: [],
  3836. strong: [],
  3837. u: [],
  3838. ul: []
  3839. };
  3840. /**
  3841. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  3842. *
  3843. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  3844. */
  3845. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  3846. /**
  3847. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  3848. *
  3849. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  3850. */
  3851. 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;
  3852. function allowedAttribute(attr, allowedAttributeList) {
  3853. var attrName = attr.nodeName.toLowerCase();
  3854. if (allowedAttributeList.indexOf(attrName) !== -1) {
  3855. if (uriAttrs.indexOf(attrName) !== -1) {
  3856. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  3857. }
  3858. return true;
  3859. }
  3860. var regExp = allowedAttributeList.filter(function (attrRegex) {
  3861. return attrRegex instanceof RegExp;
  3862. }); // Check if a regular expression validates the attribute.
  3863. for (var i = 0, l = regExp.length; i < l; i++) {
  3864. if (attrName.match(regExp[i])) {
  3865. return true;
  3866. }
  3867. }
  3868. return false;
  3869. }
  3870. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  3871. if (unsafeHtml.length === 0) {
  3872. return unsafeHtml;
  3873. }
  3874. if (sanitizeFn && typeof sanitizeFn === 'function') {
  3875. return sanitizeFn(unsafeHtml);
  3876. }
  3877. var domParser = new window.DOMParser();
  3878. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  3879. var whitelistKeys = Object.keys(whiteList);
  3880. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  3881. var _loop = function _loop(i, len) {
  3882. var el = elements[i];
  3883. var elName = el.nodeName.toLowerCase();
  3884. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  3885. el.parentNode.removeChild(el);
  3886. return "continue";
  3887. }
  3888. var attributeList = [].slice.call(el.attributes);
  3889. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  3890. attributeList.forEach(function (attr) {
  3891. if (!allowedAttribute(attr, whitelistedAttributes)) {
  3892. el.removeAttribute(attr.nodeName);
  3893. }
  3894. });
  3895. };
  3896. for (var i = 0, len = elements.length; i < len; i++) {
  3897. var _ret = _loop(i);
  3898. if (_ret === "continue") continue;
  3899. }
  3900. return createdDocument.body.innerHTML;
  3901. }
  3902. /**
  3903. * ------------------------------------------------------------------------
  3904. * Constants
  3905. * ------------------------------------------------------------------------
  3906. */
  3907. var NAME$6 = 'tooltip';
  3908. var VERSION$6 = '4.4.1';
  3909. var DATA_KEY$6 = 'bs.tooltip';
  3910. var EVENT_KEY$6 = "." + DATA_KEY$6;
  3911. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  3912. var CLASS_PREFIX = 'bs-tooltip';
  3913. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  3914. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  3915. var DefaultType$4 = {
  3916. animation: 'boolean',
  3917. template: 'string',
  3918. title: '(string|element|function)',
  3919. trigger: 'string',
  3920. delay: '(number|object)',
  3921. html: 'boolean',
  3922. selector: '(string|boolean)',
  3923. placement: '(string|function)',
  3924. offset: '(number|string|function)',
  3925. container: '(string|element|boolean)',
  3926. fallbackPlacement: '(string|array)',
  3927. boundary: '(string|element)',
  3928. sanitize: 'boolean',
  3929. sanitizeFn: '(null|function)',
  3930. whiteList: 'object',
  3931. popperConfig: '(null|object)'
  3932. };
  3933. var AttachmentMap$1 = {
  3934. AUTO: 'auto',
  3935. TOP: 'top',
  3936. RIGHT: 'right',
  3937. BOTTOM: 'bottom',
  3938. LEFT: 'left'
  3939. };
  3940. var Default$4 = {
  3941. animation: true,
  3942. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  3943. trigger: 'hover focus',
  3944. title: '',
  3945. delay: 0,
  3946. html: false,
  3947. selector: false,
  3948. placement: 'top',
  3949. offset: 0,
  3950. container: false,
  3951. fallbackPlacement: 'flip',
  3952. boundary: 'scrollParent',
  3953. sanitize: true,
  3954. sanitizeFn: null,
  3955. whiteList: DefaultWhitelist,
  3956. popperConfig: null
  3957. };
  3958. var HoverState = {
  3959. SHOW: 'show',
  3960. OUT: 'out'
  3961. };
  3962. var Event$6 = {
  3963. HIDE: "hide" + EVENT_KEY$6,
  3964. HIDDEN: "hidden" + EVENT_KEY$6,
  3965. SHOW: "show" + EVENT_KEY$6,
  3966. SHOWN: "shown" + EVENT_KEY$6,
  3967. INSERTED: "inserted" + EVENT_KEY$6,
  3968. CLICK: "click" + EVENT_KEY$6,
  3969. FOCUSIN: "focusin" + EVENT_KEY$6,
  3970. FOCUSOUT: "focusout" + EVENT_KEY$6,
  3971. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  3972. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  3973. };
  3974. var ClassName$6 = {
  3975. FADE: 'fade',
  3976. SHOW: 'show'
  3977. };
  3978. var Selector$6 = {
  3979. TOOLTIP: '.tooltip',
  3980. TOOLTIP_INNER: '.tooltip-inner',
  3981. ARROW: '.arrow'
  3982. };
  3983. var Trigger = {
  3984. HOVER: 'hover',
  3985. FOCUS: 'focus',
  3986. CLICK: 'click',
  3987. MANUAL: 'manual'
  3988. };
  3989. /**
  3990. * ------------------------------------------------------------------------
  3991. * Class Definition
  3992. * ------------------------------------------------------------------------
  3993. */
  3994. var Tooltip =
  3995. /*#__PURE__*/
  3996. function () {
  3997. function Tooltip(element, config) {
  3998. if (typeof Popper === 'undefined') {
  3999. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4000. } // private
  4001. this._isEnabled = true;
  4002. this._timeout = 0;
  4003. this._hoverState = '';
  4004. this._activeTrigger = {};
  4005. this._popper = null; // Protected
  4006. this.element = element;
  4007. this.config = this._getConfig(config);
  4008. this.tip = null;
  4009. this._setListeners();
  4010. } // Getters
  4011. var _proto = Tooltip.prototype;
  4012. // Public
  4013. _proto.enable = function enable() {
  4014. this._isEnabled = true;
  4015. };
  4016. _proto.disable = function disable() {
  4017. this._isEnabled = false;
  4018. };
  4019. _proto.toggleEnabled = function toggleEnabled() {
  4020. this._isEnabled = !this._isEnabled;
  4021. };
  4022. _proto.toggle = function toggle(event) {
  4023. if (!this._isEnabled) {
  4024. return;
  4025. }
  4026. if (event) {
  4027. var dataKey = this.constructor.DATA_KEY;
  4028. var context = $(event.currentTarget).data(dataKey);
  4029. if (!context) {
  4030. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4031. $(event.currentTarget).data(dataKey, context);
  4032. }
  4033. context._activeTrigger.click = !context._activeTrigger.click;
  4034. if (context._isWithActiveTrigger()) {
  4035. context._enter(null, context);
  4036. } else {
  4037. context._leave(null, context);
  4038. }
  4039. } else {
  4040. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4041. this._leave(null, this);
  4042. return;
  4043. }
  4044. this._enter(null, this);
  4045. }
  4046. };
  4047. _proto.dispose = function dispose() {
  4048. clearTimeout(this._timeout);
  4049. $.removeData(this.element, this.constructor.DATA_KEY);
  4050. $(this.element).off(this.constructor.EVENT_KEY);
  4051. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4052. if (this.tip) {
  4053. $(this.tip).remove();
  4054. }
  4055. this._isEnabled = null;
  4056. this._timeout = null;
  4057. this._hoverState = null;
  4058. this._activeTrigger = null;
  4059. if (this._popper) {
  4060. this._popper.destroy();
  4061. }
  4062. this._popper = null;
  4063. this.element = null;
  4064. this.config = null;
  4065. this.tip = null;
  4066. };
  4067. _proto.show = function show() {
  4068. var _this = this;
  4069. if ($(this.element).css('display') === 'none') {
  4070. throw new Error('Please use show on visible elements');
  4071. }
  4072. var showEvent = $.Event(this.constructor.Event.SHOW);
  4073. if (this.isWithContent() && this._isEnabled) {
  4074. $(this.element).trigger(showEvent);
  4075. var shadowRoot = Util.findShadowRoot(this.element);
  4076. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4077. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4078. return;
  4079. }
  4080. var tip = this.getTipElement();
  4081. var tipId = Util.getUID(this.constructor.NAME);
  4082. tip.setAttribute('id', tipId);
  4083. this.element.setAttribute('aria-describedby', tipId);
  4084. this.setContent();
  4085. if (this.config.animation) {
  4086. $(tip).addClass(ClassName$6.FADE);
  4087. }
  4088. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4089. var attachment = this._getAttachment(placement);
  4090. this.addAttachmentClass(attachment);
  4091. var container = this._getContainer();
  4092. $(tip).data(this.constructor.DATA_KEY, this);
  4093. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4094. $(tip).appendTo(container);
  4095. }
  4096. $(this.element).trigger(this.constructor.Event.INSERTED);
  4097. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4098. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4099. // empty mouseover listeners to the body's immediate children;
  4100. // only needed because of broken event delegation on iOS
  4101. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4102. if ('ontouchstart' in document.documentElement) {
  4103. $(document.body).children().on('mouseover', null, $.noop);
  4104. }
  4105. var complete = function complete() {
  4106. if (_this.config.animation) {
  4107. _this._fixTransition();
  4108. }
  4109. var prevHoverState = _this._hoverState;
  4110. _this._hoverState = null;
  4111. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4112. if (prevHoverState === HoverState.OUT) {
  4113. _this._leave(null, _this);
  4114. }
  4115. };
  4116. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4117. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4118. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4119. } else {
  4120. complete();
  4121. }
  4122. }
  4123. };
  4124. _proto.hide = function hide(callback) {
  4125. var _this2 = this;
  4126. var tip = this.getTipElement();
  4127. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4128. var complete = function complete() {
  4129. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4130. tip.parentNode.removeChild(tip);
  4131. }
  4132. _this2._cleanTipClass();
  4133. _this2.element.removeAttribute('aria-describedby');
  4134. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4135. if (_this2._popper !== null) {
  4136. _this2._popper.destroy();
  4137. }
  4138. if (callback) {
  4139. callback();
  4140. }
  4141. };
  4142. $(this.element).trigger(hideEvent);
  4143. if (hideEvent.isDefaultPrevented()) {
  4144. return;
  4145. }
  4146. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4147. // empty mouseover listeners we added for iOS support
  4148. if ('ontouchstart' in document.documentElement) {
  4149. $(document.body).children().off('mouseover', null, $.noop);
  4150. }
  4151. this._activeTrigger[Trigger.CLICK] = false;
  4152. this._activeTrigger[Trigger.FOCUS] = false;
  4153. this._activeTrigger[Trigger.HOVER] = false;
  4154. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4155. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4156. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4157. } else {
  4158. complete();
  4159. }
  4160. this._hoverState = '';
  4161. };
  4162. _proto.update = function update() {
  4163. if (this._popper !== null) {
  4164. this._popper.scheduleUpdate();
  4165. }
  4166. } // Protected
  4167. ;
  4168. _proto.isWithContent = function isWithContent() {
  4169. return Boolean(this.getTitle());
  4170. };
  4171. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4172. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4173. };
  4174. _proto.getTipElement = function getTipElement() {
  4175. this.tip = this.tip || $(this.config.template)[0];
  4176. return this.tip;
  4177. };
  4178. _proto.setContent = function setContent() {
  4179. var tip = this.getTipElement();
  4180. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4181. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4182. };
  4183. _proto.setElementContent = function setElementContent($element, content) {
  4184. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4185. // Content is a DOM node or a jQuery
  4186. if (this.config.html) {
  4187. if (!$(content).parent().is($element)) {
  4188. $element.empty().append(content);
  4189. }
  4190. } else {
  4191. $element.text($(content).text());
  4192. }
  4193. return;
  4194. }
  4195. if (this.config.html) {
  4196. if (this.config.sanitize) {
  4197. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4198. }
  4199. $element.html(content);
  4200. } else {
  4201. $element.text(content);
  4202. }
  4203. };
  4204. _proto.getTitle = function getTitle() {
  4205. var title = this.element.getAttribute('data-original-title');
  4206. if (!title) {
  4207. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4208. }
  4209. return title;
  4210. } // Private
  4211. ;
  4212. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4213. var _this3 = this;
  4214. var defaultBsConfig = {
  4215. placement: attachment,
  4216. modifiers: {
  4217. offset: this._getOffset(),
  4218. flip: {
  4219. behavior: this.config.fallbackPlacement
  4220. },
  4221. arrow: {
  4222. element: Selector$6.ARROW
  4223. },
  4224. preventOverflow: {
  4225. boundariesElement: this.config.boundary
  4226. }
  4227. },
  4228. onCreate: function onCreate(data) {
  4229. if (data.originalPlacement !== data.placement) {
  4230. _this3._handlePopperPlacementChange(data);
  4231. }
  4232. },
  4233. onUpdate: function onUpdate(data) {
  4234. return _this3._handlePopperPlacementChange(data);
  4235. }
  4236. };
  4237. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  4238. };
  4239. _proto._getOffset = function _getOffset() {
  4240. var _this4 = this;
  4241. var offset = {};
  4242. if (typeof this.config.offset === 'function') {
  4243. offset.fn = function (data) {
  4244. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  4245. return data;
  4246. };
  4247. } else {
  4248. offset.offset = this.config.offset;
  4249. }
  4250. return offset;
  4251. };
  4252. _proto._getContainer = function _getContainer() {
  4253. if (this.config.container === false) {
  4254. return document.body;
  4255. }
  4256. if (Util.isElement(this.config.container)) {
  4257. return $(this.config.container);
  4258. }
  4259. return $(document).find(this.config.container);
  4260. };
  4261. _proto._getAttachment = function _getAttachment(placement) {
  4262. return AttachmentMap$1[placement.toUpperCase()];
  4263. };
  4264. _proto._setListeners = function _setListeners() {
  4265. var _this5 = this;
  4266. var triggers = this.config.trigger.split(' ');
  4267. triggers.forEach(function (trigger) {
  4268. if (trigger === 'click') {
  4269. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4270. return _this5.toggle(event);
  4271. });
  4272. } else if (trigger !== Trigger.MANUAL) {
  4273. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4274. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4275. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4276. return _this5._enter(event);
  4277. }).on(eventOut, _this5.config.selector, function (event) {
  4278. return _this5._leave(event);
  4279. });
  4280. }
  4281. });
  4282. this._hideModalHandler = function () {
  4283. if (_this5.element) {
  4284. _this5.hide();
  4285. }
  4286. };
  4287. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4288. if (this.config.selector) {
  4289. this.config = _objectSpread2({}, this.config, {
  4290. trigger: 'manual',
  4291. selector: ''
  4292. });
  4293. } else {
  4294. this._fixTitle();
  4295. }
  4296. };
  4297. _proto._fixTitle = function _fixTitle() {
  4298. var titleType = typeof this.element.getAttribute('data-original-title');
  4299. if (this.element.getAttribute('title') || titleType !== 'string') {
  4300. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4301. this.element.setAttribute('title', '');
  4302. }
  4303. };
  4304. _proto._enter = function _enter(event, context) {
  4305. var dataKey = this.constructor.DATA_KEY;
  4306. context = context || $(event.currentTarget).data(dataKey);
  4307. if (!context) {
  4308. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4309. $(event.currentTarget).data(dataKey, context);
  4310. }
  4311. if (event) {
  4312. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  4313. }
  4314. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  4315. context._hoverState = HoverState.SHOW;
  4316. return;
  4317. }
  4318. clearTimeout(context._timeout);
  4319. context._hoverState = HoverState.SHOW;
  4320. if (!context.config.delay || !context.config.delay.show) {
  4321. context.show();
  4322. return;
  4323. }
  4324. context._timeout = setTimeout(function () {
  4325. if (context._hoverState === HoverState.SHOW) {
  4326. context.show();
  4327. }
  4328. }, context.config.delay.show);
  4329. };
  4330. _proto._leave = function _leave(event, context) {
  4331. var dataKey = this.constructor.DATA_KEY;
  4332. context = context || $(event.currentTarget).data(dataKey);
  4333. if (!context) {
  4334. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4335. $(event.currentTarget).data(dataKey, context);
  4336. }
  4337. if (event) {
  4338. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  4339. }
  4340. if (context._isWithActiveTrigger()) {
  4341. return;
  4342. }
  4343. clearTimeout(context._timeout);
  4344. context._hoverState = HoverState.OUT;
  4345. if (!context.config.delay || !context.config.delay.hide) {
  4346. context.hide();
  4347. return;
  4348. }
  4349. context._timeout = setTimeout(function () {
  4350. if (context._hoverState === HoverState.OUT) {
  4351. context.hide();
  4352. }
  4353. }, context.config.delay.hide);
  4354. };
  4355. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4356. for (var trigger in this._activeTrigger) {
  4357. if (this._activeTrigger[trigger]) {
  4358. return true;
  4359. }
  4360. }
  4361. return false;
  4362. };
  4363. _proto._getConfig = function _getConfig(config) {
  4364. var dataAttributes = $(this.element).data();
  4365. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4366. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4367. delete dataAttributes[dataAttr];
  4368. }
  4369. });
  4370. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  4371. if (typeof config.delay === 'number') {
  4372. config.delay = {
  4373. show: config.delay,
  4374. hide: config.delay
  4375. };
  4376. }
  4377. if (typeof config.title === 'number') {
  4378. config.title = config.title.toString();
  4379. }
  4380. if (typeof config.content === 'number') {
  4381. config.content = config.content.toString();
  4382. }
  4383. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4384. if (config.sanitize) {
  4385. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4386. }
  4387. return config;
  4388. };
  4389. _proto._getDelegateConfig = function _getDelegateConfig() {
  4390. var config = {};
  4391. if (this.config) {
  4392. for (var key in this.config) {
  4393. if (this.constructor.Default[key] !== this.config[key]) {
  4394. config[key] = this.config[key];
  4395. }
  4396. }
  4397. }
  4398. return config;
  4399. };
  4400. _proto._cleanTipClass = function _cleanTipClass() {
  4401. var $tip = $(this.getTipElement());
  4402. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4403. if (tabClass !== null && tabClass.length) {
  4404. $tip.removeClass(tabClass.join(''));
  4405. }
  4406. };
  4407. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4408. var popperInstance = popperData.instance;
  4409. this.tip = popperInstance.popper;
  4410. this._cleanTipClass();
  4411. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4412. };
  4413. _proto._fixTransition = function _fixTransition() {
  4414. var tip = this.getTipElement();
  4415. var initConfigAnimation = this.config.animation;
  4416. if (tip.getAttribute('x-placement') !== null) {
  4417. return;
  4418. }
  4419. $(tip).removeClass(ClassName$6.FADE);
  4420. this.config.animation = false;
  4421. this.hide();
  4422. this.show();
  4423. this.config.animation = initConfigAnimation;
  4424. } // Static
  4425. ;
  4426. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4427. return this.each(function () {
  4428. var data = $(this).data(DATA_KEY$6);
  4429. var _config = typeof config === 'object' && config;
  4430. if (!data && /dispose|hide/.test(config)) {
  4431. return;
  4432. }
  4433. if (!data) {
  4434. data = new Tooltip(this, _config);
  4435. $(this).data(DATA_KEY$6, data);
  4436. }
  4437. if (typeof config === 'string') {
  4438. if (typeof data[config] === 'undefined') {
  4439. throw new TypeError("No method named \"" + config + "\"");
  4440. }
  4441. data[config]();
  4442. }
  4443. });
  4444. };
  4445. _createClass(Tooltip, null, [{
  4446. key: "VERSION",
  4447. get: function get() {
  4448. return VERSION$6;
  4449. }
  4450. }, {
  4451. key: "Default",
  4452. get: function get() {
  4453. return Default$4;
  4454. }
  4455. }, {
  4456. key: "NAME",
  4457. get: function get() {
  4458. return NAME$6;
  4459. }
  4460. }, {
  4461. key: "DATA_KEY",
  4462. get: function get() {
  4463. return DATA_KEY$6;
  4464. }
  4465. }, {
  4466. key: "Event",
  4467. get: function get() {
  4468. return Event$6;
  4469. }
  4470. }, {
  4471. key: "EVENT_KEY",
  4472. get: function get() {
  4473. return EVENT_KEY$6;
  4474. }
  4475. }, {
  4476. key: "DefaultType",
  4477. get: function get() {
  4478. return DefaultType$4;
  4479. }
  4480. }]);
  4481. return Tooltip;
  4482. }();
  4483. /**
  4484. * ------------------------------------------------------------------------
  4485. * jQuery
  4486. * ------------------------------------------------------------------------
  4487. */
  4488. $.fn[NAME$6] = Tooltip._jQueryInterface;
  4489. $.fn[NAME$6].Constructor = Tooltip;
  4490. $.fn[NAME$6].noConflict = function () {
  4491. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  4492. return Tooltip._jQueryInterface;
  4493. };
  4494. /**
  4495. * ------------------------------------------------------------------------
  4496. * Constants
  4497. * ------------------------------------------------------------------------
  4498. */
  4499. var NAME$7 = 'popover';
  4500. var VERSION$7 = '4.4.1';
  4501. var DATA_KEY$7 = 'bs.popover';
  4502. var EVENT_KEY$7 = "." + DATA_KEY$7;
  4503. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  4504. var CLASS_PREFIX$1 = 'bs-popover';
  4505. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  4506. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  4507. placement: 'right',
  4508. trigger: 'click',
  4509. content: '',
  4510. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  4511. });
  4512. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  4513. content: '(string|element|function)'
  4514. });
  4515. var ClassName$7 = {
  4516. FADE: 'fade',
  4517. SHOW: 'show'
  4518. };
  4519. var Selector$7 = {
  4520. TITLE: '.popover-header',
  4521. CONTENT: '.popover-body'
  4522. };
  4523. var Event$7 = {
  4524. HIDE: "hide" + EVENT_KEY$7,
  4525. HIDDEN: "hidden" + EVENT_KEY$7,
  4526. SHOW: "show" + EVENT_KEY$7,
  4527. SHOWN: "shown" + EVENT_KEY$7,
  4528. INSERTED: "inserted" + EVENT_KEY$7,
  4529. CLICK: "click" + EVENT_KEY$7,
  4530. FOCUSIN: "focusin" + EVENT_KEY$7,
  4531. FOCUSOUT: "focusout" + EVENT_KEY$7,
  4532. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  4533. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  4534. };
  4535. /**
  4536. * ------------------------------------------------------------------------
  4537. * Class Definition
  4538. * ------------------------------------------------------------------------
  4539. */
  4540. var Popover =
  4541. /*#__PURE__*/
  4542. function (_Tooltip) {
  4543. _inheritsLoose(Popover, _Tooltip);
  4544. function Popover() {
  4545. return _Tooltip.apply(this, arguments) || this;
  4546. }
  4547. var _proto = Popover.prototype;
  4548. // Overrides
  4549. _proto.isWithContent = function isWithContent() {
  4550. return this.getTitle() || this._getContent();
  4551. };
  4552. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4553. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  4554. };
  4555. _proto.getTipElement = function getTipElement() {
  4556. this.tip = this.tip || $(this.config.template)[0];
  4557. return this.tip;
  4558. };
  4559. _proto.setContent = function setContent() {
  4560. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  4561. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  4562. var content = this._getContent();
  4563. if (typeof content === 'function') {
  4564. content = content.call(this.element);
  4565. }
  4566. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  4567. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  4568. } // Private
  4569. ;
  4570. _proto._getContent = function _getContent() {
  4571. return this.element.getAttribute('data-content') || this.config.content;
  4572. };
  4573. _proto._cleanTipClass = function _cleanTipClass() {
  4574. var $tip = $(this.getTipElement());
  4575. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  4576. if (tabClass !== null && tabClass.length > 0) {
  4577. $tip.removeClass(tabClass.join(''));
  4578. }
  4579. } // Static
  4580. ;
  4581. Popover._jQueryInterface = function _jQueryInterface(config) {
  4582. return this.each(function () {
  4583. var data = $(this).data(DATA_KEY$7);
  4584. var _config = typeof config === 'object' ? config : null;
  4585. if (!data && /dispose|hide/.test(config)) {
  4586. return;
  4587. }
  4588. if (!data) {
  4589. data = new Popover(this, _config);
  4590. $(this).data(DATA_KEY$7, data);
  4591. }
  4592. if (typeof config === 'string') {
  4593. if (typeof data[config] === 'undefined') {
  4594. throw new TypeError("No method named \"" + config + "\"");
  4595. }
  4596. data[config]();
  4597. }
  4598. });
  4599. };
  4600. _createClass(Popover, null, [{
  4601. key: "VERSION",
  4602. // Getters
  4603. get: function get() {
  4604. return VERSION$7;
  4605. }
  4606. }, {
  4607. key: "Default",
  4608. get: function get() {
  4609. return Default$5;
  4610. }
  4611. }, {
  4612. key: "NAME",
  4613. get: function get() {
  4614. return NAME$7;
  4615. }
  4616. }, {
  4617. key: "DATA_KEY",
  4618. get: function get() {
  4619. return DATA_KEY$7;
  4620. }
  4621. }, {
  4622. key: "Event",
  4623. get: function get() {
  4624. return Event$7;
  4625. }
  4626. }, {
  4627. key: "EVENT_KEY",
  4628. get: function get() {
  4629. return EVENT_KEY$7;
  4630. }
  4631. }, {
  4632. key: "DefaultType",
  4633. get: function get() {
  4634. return DefaultType$5;
  4635. }
  4636. }]);
  4637. return Popover;
  4638. }(Tooltip);
  4639. /**
  4640. * ------------------------------------------------------------------------
  4641. * jQuery
  4642. * ------------------------------------------------------------------------
  4643. */
  4644. $.fn[NAME$7] = Popover._jQueryInterface;
  4645. $.fn[NAME$7].Constructor = Popover;
  4646. $.fn[NAME$7].noConflict = function () {
  4647. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  4648. return Popover._jQueryInterface;
  4649. };
  4650. /**
  4651. * ------------------------------------------------------------------------
  4652. * Constants
  4653. * ------------------------------------------------------------------------
  4654. */
  4655. var NAME$8 = 'scrollspy';
  4656. var VERSION$8 = '4.4.1';
  4657. var DATA_KEY$8 = 'bs.scrollspy';
  4658. var EVENT_KEY$8 = "." + DATA_KEY$8;
  4659. var DATA_API_KEY$6 = '.data-api';
  4660. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  4661. var Default$6 = {
  4662. offset: 10,
  4663. method: 'auto',
  4664. target: ''
  4665. };
  4666. var DefaultType$6 = {
  4667. offset: 'number',
  4668. method: 'string',
  4669. target: '(string|element)'
  4670. };
  4671. var Event$8 = {
  4672. ACTIVATE: "activate" + EVENT_KEY$8,
  4673. SCROLL: "scroll" + EVENT_KEY$8,
  4674. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  4675. };
  4676. var ClassName$8 = {
  4677. DROPDOWN_ITEM: 'dropdown-item',
  4678. DROPDOWN_MENU: 'dropdown-menu',
  4679. ACTIVE: 'active'
  4680. };
  4681. var Selector$8 = {
  4682. DATA_SPY: '[data-spy="scroll"]',
  4683. ACTIVE: '.active',
  4684. NAV_LIST_GROUP: '.nav, .list-group',
  4685. NAV_LINKS: '.nav-link',
  4686. NAV_ITEMS: '.nav-item',
  4687. LIST_ITEMS: '.list-group-item',
  4688. DROPDOWN: '.dropdown',
  4689. DROPDOWN_ITEMS: '.dropdown-item',
  4690. DROPDOWN_TOGGLE: '.dropdown-toggle'
  4691. };
  4692. var OffsetMethod = {
  4693. OFFSET: 'offset',
  4694. POSITION: 'position'
  4695. };
  4696. /**
  4697. * ------------------------------------------------------------------------
  4698. * Class Definition
  4699. * ------------------------------------------------------------------------
  4700. */
  4701. var ScrollSpy =
  4702. /*#__PURE__*/
  4703. function () {
  4704. function ScrollSpy(element, config) {
  4705. var _this = this;
  4706. this._element = element;
  4707. this._scrollElement = element.tagName === 'BODY' ? window : element;
  4708. this._config = this._getConfig(config);
  4709. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  4710. this._offsets = [];
  4711. this._targets = [];
  4712. this._activeTarget = null;
  4713. this._scrollHeight = 0;
  4714. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  4715. return _this._process(event);
  4716. });
  4717. this.refresh();
  4718. this._process();
  4719. } // Getters
  4720. var _proto = ScrollSpy.prototype;
  4721. // Public
  4722. _proto.refresh = function refresh() {
  4723. var _this2 = this;
  4724. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  4725. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  4726. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  4727. this._offsets = [];
  4728. this._targets = [];
  4729. this._scrollHeight = this._getScrollHeight();
  4730. var targets = [].slice.call(document.querySelectorAll(this._selector));
  4731. targets.map(function (element) {
  4732. var target;
  4733. var targetSelector = Util.getSelectorFromElement(element);
  4734. if (targetSelector) {
  4735. target = document.querySelector(targetSelector);
  4736. }
  4737. if (target) {
  4738. var targetBCR = target.getBoundingClientRect();
  4739. if (targetBCR.width || targetBCR.height) {
  4740. // TODO (fat): remove sketch reliance on jQuery position/offset
  4741. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  4742. }
  4743. }
  4744. return null;
  4745. }).filter(function (item) {
  4746. return item;
  4747. }).sort(function (a, b) {
  4748. return a[0] - b[0];
  4749. }).forEach(function (item) {
  4750. _this2._offsets.push(item[0]);
  4751. _this2._targets.push(item[1]);
  4752. });
  4753. };
  4754. _proto.dispose = function dispose() {
  4755. $.removeData(this._element, DATA_KEY$8);
  4756. $(this._scrollElement).off(EVENT_KEY$8);
  4757. this._element = null;
  4758. this._scrollElement = null;
  4759. this._config = null;
  4760. this._selector = null;
  4761. this._offsets = null;
  4762. this._targets = null;
  4763. this._activeTarget = null;
  4764. this._scrollHeight = null;
  4765. } // Private
  4766. ;
  4767. _proto._getConfig = function _getConfig(config) {
  4768. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  4769. if (typeof config.target !== 'string') {
  4770. var id = $(config.target).attr('id');
  4771. if (!id) {
  4772. id = Util.getUID(NAME$8);
  4773. $(config.target).attr('id', id);
  4774. }
  4775. config.target = "#" + id;
  4776. }
  4777. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  4778. return config;
  4779. };
  4780. _proto._getScrollTop = function _getScrollTop() {
  4781. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  4782. };
  4783. _proto._getScrollHeight = function _getScrollHeight() {
  4784. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  4785. };
  4786. _proto._getOffsetHeight = function _getOffsetHeight() {
  4787. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  4788. };
  4789. _proto._process = function _process() {
  4790. var scrollTop = this._getScrollTop() + this._config.offset;
  4791. var scrollHeight = this._getScrollHeight();
  4792. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  4793. if (this._scrollHeight !== scrollHeight) {
  4794. this.refresh();
  4795. }
  4796. if (scrollTop >= maxScroll) {
  4797. var target = this._targets[this._targets.length - 1];
  4798. if (this._activeTarget !== target) {
  4799. this._activate(target);
  4800. }
  4801. return;
  4802. }
  4803. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  4804. this._activeTarget = null;
  4805. this._clear();
  4806. return;
  4807. }
  4808. var offsetLength = this._offsets.length;
  4809. for (var i = offsetLength; i--;) {
  4810. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  4811. if (isActiveTarget) {
  4812. this._activate(this._targets[i]);
  4813. }
  4814. }
  4815. };
  4816. _proto._activate = function _activate(target) {
  4817. this._activeTarget = target;
  4818. this._clear();
  4819. var queries = this._selector.split(',').map(function (selector) {
  4820. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  4821. });
  4822. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  4823. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  4824. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  4825. $link.addClass(ClassName$8.ACTIVE);
  4826. } else {
  4827. // Set triggered link as active
  4828. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  4829. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  4830. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item
  4831. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  4832. }
  4833. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  4834. relatedTarget: target
  4835. });
  4836. };
  4837. _proto._clear = function _clear() {
  4838. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  4839. return node.classList.contains(ClassName$8.ACTIVE);
  4840. }).forEach(function (node) {
  4841. return node.classList.remove(ClassName$8.ACTIVE);
  4842. });
  4843. } // Static
  4844. ;
  4845. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  4846. return this.each(function () {
  4847. var data = $(this).data(DATA_KEY$8);
  4848. var _config = typeof config === 'object' && config;
  4849. if (!data) {
  4850. data = new ScrollSpy(this, _config);
  4851. $(this).data(DATA_KEY$8, data);
  4852. }
  4853. if (typeof config === 'string') {
  4854. if (typeof data[config] === 'undefined') {
  4855. throw new TypeError("No method named \"" + config + "\"");
  4856. }
  4857. data[config]();
  4858. }
  4859. });
  4860. };
  4861. _createClass(ScrollSpy, null, [{
  4862. key: "VERSION",
  4863. get: function get() {
  4864. return VERSION$8;
  4865. }
  4866. }, {
  4867. key: "Default",
  4868. get: function get() {
  4869. return Default$6;
  4870. }
  4871. }]);
  4872. return ScrollSpy;
  4873. }();
  4874. /**
  4875. * ------------------------------------------------------------------------
  4876. * Data Api implementation
  4877. * ------------------------------------------------------------------------
  4878. */
  4879. $(window).on(Event$8.LOAD_DATA_API, function () {
  4880. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  4881. var scrollSpysLength = scrollSpys.length;
  4882. for (var i = scrollSpysLength; i--;) {
  4883. var $spy = $(scrollSpys[i]);
  4884. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  4885. }
  4886. });
  4887. /**
  4888. * ------------------------------------------------------------------------
  4889. * jQuery
  4890. * ------------------------------------------------------------------------
  4891. */
  4892. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  4893. $.fn[NAME$8].Constructor = ScrollSpy;
  4894. $.fn[NAME$8].noConflict = function () {
  4895. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  4896. return ScrollSpy._jQueryInterface;
  4897. };
  4898. /**
  4899. * ------------------------------------------------------------------------
  4900. * Constants
  4901. * ------------------------------------------------------------------------
  4902. */
  4903. var NAME$9 = 'tab';
  4904. var VERSION$9 = '4.4.1';
  4905. var DATA_KEY$9 = 'bs.tab';
  4906. var EVENT_KEY$9 = "." + DATA_KEY$9;
  4907. var DATA_API_KEY$7 = '.data-api';
  4908. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  4909. var Event$9 = {
  4910. HIDE: "hide" + EVENT_KEY$9,
  4911. HIDDEN: "hidden" + EVENT_KEY$9,
  4912. SHOW: "show" + EVENT_KEY$9,
  4913. SHOWN: "shown" + EVENT_KEY$9,
  4914. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  4915. };
  4916. var ClassName$9 = {
  4917. DROPDOWN_MENU: 'dropdown-menu',
  4918. ACTIVE: 'active',
  4919. DISABLED: 'disabled',
  4920. FADE: 'fade',
  4921. SHOW: 'show'
  4922. };
  4923. var Selector$9 = {
  4924. DROPDOWN: '.dropdown',
  4925. NAV_LIST_GROUP: '.nav, .list-group',
  4926. ACTIVE: '.active',
  4927. ACTIVE_UL: '> li > .active',
  4928. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  4929. DROPDOWN_TOGGLE: '.dropdown-toggle',
  4930. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  4931. };
  4932. /**
  4933. * ------------------------------------------------------------------------
  4934. * Class Definition
  4935. * ------------------------------------------------------------------------
  4936. */
  4937. var Tab =
  4938. /*#__PURE__*/
  4939. function () {
  4940. function Tab(element) {
  4941. this._element = element;
  4942. } // Getters
  4943. var _proto = Tab.prototype;
  4944. // Public
  4945. _proto.show = function show() {
  4946. var _this = this;
  4947. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  4948. return;
  4949. }
  4950. var target;
  4951. var previous;
  4952. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  4953. var selector = Util.getSelectorFromElement(this._element);
  4954. if (listElement) {
  4955. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  4956. previous = $.makeArray($(listElement).find(itemSelector));
  4957. previous = previous[previous.length - 1];
  4958. }
  4959. var hideEvent = $.Event(Event$9.HIDE, {
  4960. relatedTarget: this._element
  4961. });
  4962. var showEvent = $.Event(Event$9.SHOW, {
  4963. relatedTarget: previous
  4964. });
  4965. if (previous) {
  4966. $(previous).trigger(hideEvent);
  4967. }
  4968. $(this._element).trigger(showEvent);
  4969. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  4970. return;
  4971. }
  4972. if (selector) {
  4973. target = document.querySelector(selector);
  4974. }
  4975. this._activate(this._element, listElement);
  4976. var complete = function complete() {
  4977. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  4978. relatedTarget: _this._element
  4979. });
  4980. var shownEvent = $.Event(Event$9.SHOWN, {
  4981. relatedTarget: previous
  4982. });
  4983. $(previous).trigger(hiddenEvent);
  4984. $(_this._element).trigger(shownEvent);
  4985. };
  4986. if (target) {
  4987. this._activate(target, target.parentNode, complete);
  4988. } else {
  4989. complete();
  4990. }
  4991. };
  4992. _proto.dispose = function dispose() {
  4993. $.removeData(this._element, DATA_KEY$9);
  4994. this._element = null;
  4995. } // Private
  4996. ;
  4997. _proto._activate = function _activate(element, container, callback) {
  4998. var _this2 = this;
  4999. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5000. var active = activeElements[0];
  5001. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5002. var complete = function complete() {
  5003. return _this2._transitionComplete(element, active, callback);
  5004. };
  5005. if (active && isTransitioning) {
  5006. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5007. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5008. } else {
  5009. complete();
  5010. }
  5011. };
  5012. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5013. if (active) {
  5014. $(active).removeClass(ClassName$9.ACTIVE);
  5015. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5016. if (dropdownChild) {
  5017. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5018. }
  5019. if (active.getAttribute('role') === 'tab') {
  5020. active.setAttribute('aria-selected', false);
  5021. }
  5022. }
  5023. $(element).addClass(ClassName$9.ACTIVE);
  5024. if (element.getAttribute('role') === 'tab') {
  5025. element.setAttribute('aria-selected', true);
  5026. }
  5027. Util.reflow(element);
  5028. if (element.classList.contains(ClassName$9.FADE)) {
  5029. element.classList.add(ClassName$9.SHOW);
  5030. }
  5031. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5032. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5033. if (dropdownElement) {
  5034. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5035. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5036. }
  5037. element.setAttribute('aria-expanded', true);
  5038. }
  5039. if (callback) {
  5040. callback();
  5041. }
  5042. } // Static
  5043. ;
  5044. Tab._jQueryInterface = function _jQueryInterface(config) {
  5045. return this.each(function () {
  5046. var $this = $(this);
  5047. var data = $this.data(DATA_KEY$9);
  5048. if (!data) {
  5049. data = new Tab(this);
  5050. $this.data(DATA_KEY$9, data);
  5051. }
  5052. if (typeof config === 'string') {
  5053. if (typeof data[config] === 'undefined') {
  5054. throw new TypeError("No method named \"" + config + "\"");
  5055. }
  5056. data[config]();
  5057. }
  5058. });
  5059. };
  5060. _createClass(Tab, null, [{
  5061. key: "VERSION",
  5062. get: function get() {
  5063. return VERSION$9;
  5064. }
  5065. }]);
  5066. return Tab;
  5067. }();
  5068. /**
  5069. * ------------------------------------------------------------------------
  5070. * Data Api implementation
  5071. * ------------------------------------------------------------------------
  5072. */
  5073. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5074. event.preventDefault();
  5075. Tab._jQueryInterface.call($(this), 'show');
  5076. });
  5077. /**
  5078. * ------------------------------------------------------------------------
  5079. * jQuery
  5080. * ------------------------------------------------------------------------
  5081. */
  5082. $.fn[NAME$9] = Tab._jQueryInterface;
  5083. $.fn[NAME$9].Constructor = Tab;
  5084. $.fn[NAME$9].noConflict = function () {
  5085. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5086. return Tab._jQueryInterface;
  5087. };
  5088. /**
  5089. * ------------------------------------------------------------------------
  5090. * Constants
  5091. * ------------------------------------------------------------------------
  5092. */
  5093. var NAME$a = 'toast';
  5094. var VERSION$a = '4.4.1';
  5095. var DATA_KEY$a = 'bs.toast';
  5096. var EVENT_KEY$a = "." + DATA_KEY$a;
  5097. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5098. var Event$a = {
  5099. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5100. HIDE: "hide" + EVENT_KEY$a,
  5101. HIDDEN: "hidden" + EVENT_KEY$a,
  5102. SHOW: "show" + EVENT_KEY$a,
  5103. SHOWN: "shown" + EVENT_KEY$a
  5104. };
  5105. var ClassName$a = {
  5106. FADE: 'fade',
  5107. HIDE: 'hide',
  5108. SHOW: 'show',
  5109. SHOWING: 'showing'
  5110. };
  5111. var DefaultType$7 = {
  5112. animation: 'boolean',
  5113. autohide: 'boolean',
  5114. delay: 'number'
  5115. };
  5116. var Default$7 = {
  5117. animation: true,
  5118. autohide: true,
  5119. delay: 500
  5120. };
  5121. var Selector$a = {
  5122. DATA_DISMISS: '[data-dismiss="toast"]'
  5123. };
  5124. /**
  5125. * ------------------------------------------------------------------------
  5126. * Class Definition
  5127. * ------------------------------------------------------------------------
  5128. */
  5129. var Toast =
  5130. /*#__PURE__*/
  5131. function () {
  5132. function Toast(element, config) {
  5133. this._element = element;
  5134. this._config = this._getConfig(config);
  5135. this._timeout = null;
  5136. this._setListeners();
  5137. } // Getters
  5138. var _proto = Toast.prototype;
  5139. // Public
  5140. _proto.show = function show() {
  5141. var _this = this;
  5142. var showEvent = $.Event(Event$a.SHOW);
  5143. $(this._element).trigger(showEvent);
  5144. if (showEvent.isDefaultPrevented()) {
  5145. return;
  5146. }
  5147. if (this._config.animation) {
  5148. this._element.classList.add(ClassName$a.FADE);
  5149. }
  5150. var complete = function complete() {
  5151. _this._element.classList.remove(ClassName$a.SHOWING);
  5152. _this._element.classList.add(ClassName$a.SHOW);
  5153. $(_this._element).trigger(Event$a.SHOWN);
  5154. if (_this._config.autohide) {
  5155. _this._timeout = setTimeout(function () {
  5156. _this.hide();
  5157. }, _this._config.delay);
  5158. }
  5159. };
  5160. this._element.classList.remove(ClassName$a.HIDE);
  5161. Util.reflow(this._element);
  5162. this._element.classList.add(ClassName$a.SHOWING);
  5163. if (this._config.animation) {
  5164. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5165. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5166. } else {
  5167. complete();
  5168. }
  5169. };
  5170. _proto.hide = function hide() {
  5171. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5172. return;
  5173. }
  5174. var hideEvent = $.Event(Event$a.HIDE);
  5175. $(this._element).trigger(hideEvent);
  5176. if (hideEvent.isDefaultPrevented()) {
  5177. return;
  5178. }
  5179. this._close();
  5180. };
  5181. _proto.dispose = function dispose() {
  5182. clearTimeout(this._timeout);
  5183. this._timeout = null;
  5184. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5185. this._element.classList.remove(ClassName$a.SHOW);
  5186. }
  5187. $(this._element).off(Event$a.CLICK_DISMISS);
  5188. $.removeData(this._element, DATA_KEY$a);
  5189. this._element = null;
  5190. this._config = null;
  5191. } // Private
  5192. ;
  5193. _proto._getConfig = function _getConfig(config) {
  5194. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  5195. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5196. return config;
  5197. };
  5198. _proto._setListeners = function _setListeners() {
  5199. var _this2 = this;
  5200. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5201. return _this2.hide();
  5202. });
  5203. };
  5204. _proto._close = function _close() {
  5205. var _this3 = this;
  5206. var complete = function complete() {
  5207. _this3._element.classList.add(ClassName$a.HIDE);
  5208. $(_this3._element).trigger(Event$a.HIDDEN);
  5209. };
  5210. this._element.classList.remove(ClassName$a.SHOW);
  5211. if (this._config.animation) {
  5212. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5213. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5214. } else {
  5215. complete();
  5216. }
  5217. } // Static
  5218. ;
  5219. Toast._jQueryInterface = function _jQueryInterface(config) {
  5220. return this.each(function () {
  5221. var $element = $(this);
  5222. var data = $element.data(DATA_KEY$a);
  5223. var _config = typeof config === 'object' && config;
  5224. if (!data) {
  5225. data = new Toast(this, _config);
  5226. $element.data(DATA_KEY$a, data);
  5227. }
  5228. if (typeof config === 'string') {
  5229. if (typeof data[config] === 'undefined') {
  5230. throw new TypeError("No method named \"" + config + "\"");
  5231. }
  5232. data[config](this);
  5233. }
  5234. });
  5235. };
  5236. _createClass(Toast, null, [{
  5237. key: "VERSION",
  5238. get: function get() {
  5239. return VERSION$a;
  5240. }
  5241. }, {
  5242. key: "DefaultType",
  5243. get: function get() {
  5244. return DefaultType$7;
  5245. }
  5246. }, {
  5247. key: "Default",
  5248. get: function get() {
  5249. return Default$7;
  5250. }
  5251. }]);
  5252. return Toast;
  5253. }();
  5254. /**
  5255. * ------------------------------------------------------------------------
  5256. * jQuery
  5257. * ------------------------------------------------------------------------
  5258. */
  5259. $.fn[NAME$a] = Toast._jQueryInterface;
  5260. $.fn[NAME$a].Constructor = Toast;
  5261. $.fn[NAME$a].noConflict = function () {
  5262. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5263. return Toast._jQueryInterface;
  5264. };
  5265. exports.Alert = Alert;
  5266. exports.Button = Button;
  5267. exports.Carousel = Carousel;
  5268. exports.Collapse = Collapse;
  5269. exports.Dropdown = Dropdown;
  5270. exports.Modal = Modal;
  5271. exports.Popover = Popover;
  5272. exports.Scrollspy = ScrollSpy;
  5273. exports.Tab = Tab;
  5274. exports.Toast = Toast;
  5275. exports.Tooltip = Tooltip;
  5276. exports.Util = Util;
  5277. Object.defineProperty(exports, '__esModule', { value: true });
  5278. })));
  5279. //# sourceMappingURL=bootstrap.js.map
  5280. /***/ }),
  5281. /***/ "./node_modules/jquery/dist/jquery.js":
  5282. /*!********************************************!*\
  5283. !*** ./node_modules/jquery/dist/jquery.js ***!
  5284. \********************************************/
  5285. /*! no static exports found */
  5286. /***/ (function(module, exports, __webpack_require__) {
  5287. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  5288. * jQuery JavaScript Library v3.4.1
  5289. * https://jquery.com/
  5290. *
  5291. * Includes Sizzle.js
  5292. * https://sizzlejs.com/
  5293. *
  5294. * Copyright JS Foundation and other contributors
  5295. * Released under the MIT license
  5296. * https://jquery.org/license
  5297. *
  5298. * Date: 2019-05-01T21:04Z
  5299. */
  5300. ( function( global, factory ) {
  5301. "use strict";
  5302. if ( true && typeof module.exports === "object" ) {
  5303. // For CommonJS and CommonJS-like environments where a proper `window`
  5304. // is present, execute the factory and get jQuery.
  5305. // For environments that do not have a `window` with a `document`
  5306. // (such as Node.js), expose a factory as module.exports.
  5307. // This accentuates the need for the creation of a real `window`.
  5308. // e.g. var jQuery = require("jquery")(window);
  5309. // See ticket #14549 for more info.
  5310. module.exports = global.document ?
  5311. factory( global, true ) :
  5312. function( w ) {
  5313. if ( !w.document ) {
  5314. throw new Error( "jQuery requires a window with a document" );
  5315. }
  5316. return factory( w );
  5317. };
  5318. } else {
  5319. factory( global );
  5320. }
  5321. // Pass this if window is not defined yet
  5322. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  5323. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  5324. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  5325. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  5326. // enough that all such attempts are guarded in a try block.
  5327. "use strict";
  5328. var arr = [];
  5329. var document = window.document;
  5330. var getProto = Object.getPrototypeOf;
  5331. var slice = arr.slice;
  5332. var concat = arr.concat;
  5333. var push = arr.push;
  5334. var indexOf = arr.indexOf;
  5335. var class2type = {};
  5336. var toString = class2type.toString;
  5337. var hasOwn = class2type.hasOwnProperty;
  5338. var fnToString = hasOwn.toString;
  5339. var ObjectFunctionString = fnToString.call( Object );
  5340. var support = {};
  5341. var isFunction = function isFunction( obj ) {
  5342. // Support: Chrome <=57, Firefox <=52
  5343. // In some browsers, typeof returns "function" for HTML <object> elements
  5344. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  5345. // We don't want to classify *any* DOM node as a function.
  5346. return typeof obj === "function" && typeof obj.nodeType !== "number";
  5347. };
  5348. var isWindow = function isWindow( obj ) {
  5349. return obj != null && obj === obj.window;
  5350. };
  5351. var preservedScriptAttributes = {
  5352. type: true,
  5353. src: true,
  5354. nonce: true,
  5355. noModule: true
  5356. };
  5357. function DOMEval( code, node, doc ) {
  5358. doc = doc || document;
  5359. var i, val,
  5360. script = doc.createElement( "script" );
  5361. script.text = code;
  5362. if ( node ) {
  5363. for ( i in preservedScriptAttributes ) {
  5364. // Support: Firefox 64+, Edge 18+
  5365. // Some browsers don't support the "nonce" property on scripts.
  5366. // On the other hand, just using `getAttribute` is not enough as
  5367. // the `nonce` attribute is reset to an empty string whenever it
  5368. // becomes browsing-context connected.
  5369. // See https://github.com/whatwg/html/issues/2369
  5370. // See https://html.spec.whatwg.org/#nonce-attributes
  5371. // The `node.getAttribute` check was added for the sake of
  5372. // `jQuery.globalEval` so that it can fake a nonce-containing node
  5373. // via an object.
  5374. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  5375. if ( val ) {
  5376. script.setAttribute( i, val );
  5377. }
  5378. }
  5379. }
  5380. doc.head.appendChild( script ).parentNode.removeChild( script );
  5381. }
  5382. function toType( obj ) {
  5383. if ( obj == null ) {
  5384. return obj + "";
  5385. }
  5386. // Support: Android <=2.3 only (functionish RegExp)
  5387. return typeof obj === "object" || typeof obj === "function" ?
  5388. class2type[ toString.call( obj ) ] || "object" :
  5389. typeof obj;
  5390. }
  5391. /* global Symbol */
  5392. // Defining this global in .eslintrc.json would create a danger of using the global
  5393. // unguarded in another place, it seems safer to define global only for this module
  5394. var
  5395. version = "3.4.1",
  5396. // Define a local copy of jQuery
  5397. jQuery = function( selector, context ) {
  5398. // The jQuery object is actually just the init constructor 'enhanced'
  5399. // Need init if jQuery is called (just allow error to be thrown if not included)
  5400. return new jQuery.fn.init( selector, context );
  5401. },
  5402. // Support: Android <=4.0 only
  5403. // Make sure we trim BOM and NBSP
  5404. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  5405. jQuery.fn = jQuery.prototype = {
  5406. // The current version of jQuery being used
  5407. jquery: version,
  5408. constructor: jQuery,
  5409. // The default length of a jQuery object is 0
  5410. length: 0,
  5411. toArray: function() {
  5412. return slice.call( this );
  5413. },
  5414. // Get the Nth element in the matched element set OR
  5415. // Get the whole matched element set as a clean array
  5416. get: function( num ) {
  5417. // Return all the elements in a clean array
  5418. if ( num == null ) {
  5419. return slice.call( this );
  5420. }
  5421. // Return just the one element from the set
  5422. return num < 0 ? this[ num + this.length ] : this[ num ];
  5423. },
  5424. // Take an array of elements and push it onto the stack
  5425. // (returning the new matched element set)
  5426. pushStack: function( elems ) {
  5427. // Build a new jQuery matched element set
  5428. var ret = jQuery.merge( this.constructor(), elems );
  5429. // Add the old object onto the stack (as a reference)
  5430. ret.prevObject = this;
  5431. // Return the newly-formed element set
  5432. return ret;
  5433. },
  5434. // Execute a callback for every element in the matched set.
  5435. each: function( callback ) {
  5436. return jQuery.each( this, callback );
  5437. },
  5438. map: function( callback ) {
  5439. return this.pushStack( jQuery.map( this, function( elem, i ) {
  5440. return callback.call( elem, i, elem );
  5441. } ) );
  5442. },
  5443. slice: function() {
  5444. return this.pushStack( slice.apply( this, arguments ) );
  5445. },
  5446. first: function() {
  5447. return this.eq( 0 );
  5448. },
  5449. last: function() {
  5450. return this.eq( -1 );
  5451. },
  5452. eq: function( i ) {
  5453. var len = this.length,
  5454. j = +i + ( i < 0 ? len : 0 );
  5455. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  5456. },
  5457. end: function() {
  5458. return this.prevObject || this.constructor();
  5459. },
  5460. // For internal use only.
  5461. // Behaves like an Array's method, not like a jQuery method.
  5462. push: push,
  5463. sort: arr.sort,
  5464. splice: arr.splice
  5465. };
  5466. jQuery.extend = jQuery.fn.extend = function() {
  5467. var options, name, src, copy, copyIsArray, clone,
  5468. target = arguments[ 0 ] || {},
  5469. i = 1,
  5470. length = arguments.length,
  5471. deep = false;
  5472. // Handle a deep copy situation
  5473. if ( typeof target === "boolean" ) {
  5474. deep = target;
  5475. // Skip the boolean and the target
  5476. target = arguments[ i ] || {};
  5477. i++;
  5478. }
  5479. // Handle case when target is a string or something (possible in deep copy)
  5480. if ( typeof target !== "object" && !isFunction( target ) ) {
  5481. target = {};
  5482. }
  5483. // Extend jQuery itself if only one argument is passed
  5484. if ( i === length ) {
  5485. target = this;
  5486. i--;
  5487. }
  5488. for ( ; i < length; i++ ) {
  5489. // Only deal with non-null/undefined values
  5490. if ( ( options = arguments[ i ] ) != null ) {
  5491. // Extend the base object
  5492. for ( name in options ) {
  5493. copy = options[ name ];
  5494. // Prevent Object.prototype pollution
  5495. // Prevent never-ending loop
  5496. if ( name === "__proto__" || target === copy ) {
  5497. continue;
  5498. }
  5499. // Recurse if we're merging plain objects or arrays
  5500. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  5501. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  5502. src = target[ name ];
  5503. // Ensure proper type for the source value
  5504. if ( copyIsArray && !Array.isArray( src ) ) {
  5505. clone = [];
  5506. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  5507. clone = {};
  5508. } else {
  5509. clone = src;
  5510. }
  5511. copyIsArray = false;
  5512. // Never move original objects, clone them
  5513. target[ name ] = jQuery.extend( deep, clone, copy );
  5514. // Don't bring in undefined values
  5515. } else if ( copy !== undefined ) {
  5516. target[ name ] = copy;
  5517. }
  5518. }
  5519. }
  5520. }
  5521. // Return the modified object
  5522. return target;
  5523. };
  5524. jQuery.extend( {
  5525. // Unique for each copy of jQuery on the page
  5526. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  5527. // Assume jQuery is ready without the ready module
  5528. isReady: true,
  5529. error: function( msg ) {
  5530. throw new Error( msg );
  5531. },
  5532. noop: function() {},
  5533. isPlainObject: function( obj ) {
  5534. var proto, Ctor;
  5535. // Detect obvious negatives
  5536. // Use toString instead of jQuery.type to catch host objects
  5537. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  5538. return false;
  5539. }
  5540. proto = getProto( obj );
  5541. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  5542. if ( !proto ) {
  5543. return true;
  5544. }
  5545. // Objects with prototype are plain iff they were constructed by a global Object function
  5546. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  5547. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  5548. },
  5549. isEmptyObject: function( obj ) {
  5550. var name;
  5551. for ( name in obj ) {
  5552. return false;
  5553. }
  5554. return true;
  5555. },
  5556. // Evaluates a script in a global context
  5557. globalEval: function( code, options ) {
  5558. DOMEval( code, { nonce: options && options.nonce } );
  5559. },
  5560. each: function( obj, callback ) {
  5561. var length, i = 0;
  5562. if ( isArrayLike( obj ) ) {
  5563. length = obj.length;
  5564. for ( ; i < length; i++ ) {
  5565. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  5566. break;
  5567. }
  5568. }
  5569. } else {
  5570. for ( i in obj ) {
  5571. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  5572. break;
  5573. }
  5574. }
  5575. }
  5576. return obj;
  5577. },
  5578. // Support: Android <=4.0 only
  5579. trim: function( text ) {
  5580. return text == null ?
  5581. "" :
  5582. ( text + "" ).replace( rtrim, "" );
  5583. },
  5584. // results is for internal usage only
  5585. makeArray: function( arr, results ) {
  5586. var ret = results || [];
  5587. if ( arr != null ) {
  5588. if ( isArrayLike( Object( arr ) ) ) {
  5589. jQuery.merge( ret,
  5590. typeof arr === "string" ?
  5591. [ arr ] : arr
  5592. );
  5593. } else {
  5594. push.call( ret, arr );
  5595. }
  5596. }
  5597. return ret;
  5598. },
  5599. inArray: function( elem, arr, i ) {
  5600. return arr == null ? -1 : indexOf.call( arr, elem, i );
  5601. },
  5602. // Support: Android <=4.0 only, PhantomJS 1 only
  5603. // push.apply(_, arraylike) throws on ancient WebKit
  5604. merge: function( first, second ) {
  5605. var len = +second.length,
  5606. j = 0,
  5607. i = first.length;
  5608. for ( ; j < len; j++ ) {
  5609. first[ i++ ] = second[ j ];
  5610. }
  5611. first.length = i;
  5612. return first;
  5613. },
  5614. grep: function( elems, callback, invert ) {
  5615. var callbackInverse,
  5616. matches = [],
  5617. i = 0,
  5618. length = elems.length,
  5619. callbackExpect = !invert;
  5620. // Go through the array, only saving the items
  5621. // that pass the validator function
  5622. for ( ; i < length; i++ ) {
  5623. callbackInverse = !callback( elems[ i ], i );
  5624. if ( callbackInverse !== callbackExpect ) {
  5625. matches.push( elems[ i ] );
  5626. }
  5627. }
  5628. return matches;
  5629. },
  5630. // arg is for internal usage only
  5631. map: function( elems, callback, arg ) {
  5632. var length, value,
  5633. i = 0,
  5634. ret = [];
  5635. // Go through the array, translating each of the items to their new values
  5636. if ( isArrayLike( elems ) ) {
  5637. length = elems.length;
  5638. for ( ; i < length; i++ ) {
  5639. value = callback( elems[ i ], i, arg );
  5640. if ( value != null ) {
  5641. ret.push( value );
  5642. }
  5643. }
  5644. // Go through every key on the object,
  5645. } else {
  5646. for ( i in elems ) {
  5647. value = callback( elems[ i ], i, arg );
  5648. if ( value != null ) {
  5649. ret.push( value );
  5650. }
  5651. }
  5652. }
  5653. // Flatten any nested arrays
  5654. return concat.apply( [], ret );
  5655. },
  5656. // A global GUID counter for objects
  5657. guid: 1,
  5658. // jQuery.support is not used in Core but other projects attach their
  5659. // properties to it so it needs to exist.
  5660. support: support
  5661. } );
  5662. if ( typeof Symbol === "function" ) {
  5663. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  5664. }
  5665. // Populate the class2type map
  5666. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  5667. function( i, name ) {
  5668. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  5669. } );
  5670. function isArrayLike( obj ) {
  5671. // Support: real iOS 8.2 only (not reproducible in simulator)
  5672. // `in` check used to prevent JIT error (gh-2145)
  5673. // hasOwn isn't used here due to false negatives
  5674. // regarding Nodelist length in IE
  5675. var length = !!obj && "length" in obj && obj.length,
  5676. type = toType( obj );
  5677. if ( isFunction( obj ) || isWindow( obj ) ) {
  5678. return false;
  5679. }
  5680. return type === "array" || length === 0 ||
  5681. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  5682. }
  5683. var Sizzle =
  5684. /*!
  5685. * Sizzle CSS Selector Engine v2.3.4
  5686. * https://sizzlejs.com/
  5687. *
  5688. * Copyright JS Foundation and other contributors
  5689. * Released under the MIT license
  5690. * https://js.foundation/
  5691. *
  5692. * Date: 2019-04-08
  5693. */
  5694. (function( window ) {
  5695. var i,
  5696. support,
  5697. Expr,
  5698. getText,
  5699. isXML,
  5700. tokenize,
  5701. compile,
  5702. select,
  5703. outermostContext,
  5704. sortInput,
  5705. hasDuplicate,
  5706. // Local document vars
  5707. setDocument,
  5708. document,
  5709. docElem,
  5710. documentIsHTML,
  5711. rbuggyQSA,
  5712. rbuggyMatches,
  5713. matches,
  5714. contains,
  5715. // Instance-specific data
  5716. expando = "sizzle" + 1 * new Date(),
  5717. preferredDoc = window.document,
  5718. dirruns = 0,
  5719. done = 0,
  5720. classCache = createCache(),
  5721. tokenCache = createCache(),
  5722. compilerCache = createCache(),
  5723. nonnativeSelectorCache = createCache(),
  5724. sortOrder = function( a, b ) {
  5725. if ( a === b ) {
  5726. hasDuplicate = true;
  5727. }
  5728. return 0;
  5729. },
  5730. // Instance methods
  5731. hasOwn = ({}).hasOwnProperty,
  5732. arr = [],
  5733. pop = arr.pop,
  5734. push_native = arr.push,
  5735. push = arr.push,
  5736. slice = arr.slice,
  5737. // Use a stripped-down indexOf as it's faster than native
  5738. // https://jsperf.com/thor-indexof-vs-for/5
  5739. indexOf = function( list, elem ) {
  5740. var i = 0,
  5741. len = list.length;
  5742. for ( ; i < len; i++ ) {
  5743. if ( list[i] === elem ) {
  5744. return i;
  5745. }
  5746. }
  5747. return -1;
  5748. },
  5749. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  5750. // Regular expressions
  5751. // http://www.w3.org/TR/css3-selectors/#whitespace
  5752. whitespace = "[\\x20\\t\\r\\n\\f]",
  5753. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  5754. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  5755. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  5756. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  5757. // Operator (capture 2)
  5758. "*([*^$|!~]?=)" + whitespace +
  5759. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  5760. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  5761. "*\\]",
  5762. pseudos = ":(" + identifier + ")(?:\\((" +
  5763. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  5764. // 1. quoted (capture 3; capture 4 or capture 5)
  5765. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  5766. // 2. simple (capture 6)
  5767. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  5768. // 3. anything else (capture 2)
  5769. ".*" +
  5770. ")\\)|)",
  5771. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  5772. rwhitespace = new RegExp( whitespace + "+", "g" ),
  5773. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  5774. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  5775. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  5776. rdescend = new RegExp( whitespace + "|>" ),
  5777. rpseudo = new RegExp( pseudos ),
  5778. ridentifier = new RegExp( "^" + identifier + "$" ),
  5779. matchExpr = {
  5780. "ID": new RegExp( "^#(" + identifier + ")" ),
  5781. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  5782. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  5783. "ATTR": new RegExp( "^" + attributes ),
  5784. "PSEUDO": new RegExp( "^" + pseudos ),
  5785. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  5786. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  5787. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  5788. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  5789. // For use in libraries implementing .is()
  5790. // We use this for POS matching in `select`
  5791. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  5792. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  5793. },
  5794. rhtml = /HTML$/i,
  5795. rinputs = /^(?:input|select|textarea|button)$/i,
  5796. rheader = /^h\d$/i,
  5797. rnative = /^[^{]+\{\s*\[native \w/,
  5798. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  5799. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  5800. rsibling = /[+~]/,
  5801. // CSS escapes
  5802. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  5803. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  5804. funescape = function( _, escaped, escapedWhitespace ) {
  5805. var high = "0x" + escaped - 0x10000;
  5806. // NaN means non-codepoint
  5807. // Support: Firefox<24
  5808. // Workaround erroneous numeric interpretation of +"0x"
  5809. return high !== high || escapedWhitespace ?
  5810. escaped :
  5811. high < 0 ?
  5812. // BMP codepoint
  5813. String.fromCharCode( high + 0x10000 ) :
  5814. // Supplemental Plane codepoint (surrogate pair)
  5815. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  5816. },
  5817. // CSS string/identifier serialization
  5818. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  5819. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  5820. fcssescape = function( ch, asCodePoint ) {
  5821. if ( asCodePoint ) {
  5822. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  5823. if ( ch === "\0" ) {
  5824. return "\uFFFD";
  5825. }
  5826. // Control characters and (dependent upon position) numbers get escaped as code points
  5827. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  5828. }
  5829. // Other potentially-special ASCII characters get backslash-escaped
  5830. return "\\" + ch;
  5831. },
  5832. // Used for iframes
  5833. // See setDocument()
  5834. // Removing the function wrapper causes a "Permission Denied"
  5835. // error in IE
  5836. unloadHandler = function() {
  5837. setDocument();
  5838. },
  5839. inDisabledFieldset = addCombinator(
  5840. function( elem ) {
  5841. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  5842. },
  5843. { dir: "parentNode", next: "legend" }
  5844. );
  5845. // Optimize for push.apply( _, NodeList )
  5846. try {
  5847. push.apply(
  5848. (arr = slice.call( preferredDoc.childNodes )),
  5849. preferredDoc.childNodes
  5850. );
  5851. // Support: Android<4.0
  5852. // Detect silently failing push.apply
  5853. arr[ preferredDoc.childNodes.length ].nodeType;
  5854. } catch ( e ) {
  5855. push = { apply: arr.length ?
  5856. // Leverage slice if possible
  5857. function( target, els ) {
  5858. push_native.apply( target, slice.call(els) );
  5859. } :
  5860. // Support: IE<9
  5861. // Otherwise append directly
  5862. function( target, els ) {
  5863. var j = target.length,
  5864. i = 0;
  5865. // Can't trust NodeList.length
  5866. while ( (target[j++] = els[i++]) ) {}
  5867. target.length = j - 1;
  5868. }
  5869. };
  5870. }
  5871. function Sizzle( selector, context, results, seed ) {
  5872. var m, i, elem, nid, match, groups, newSelector,
  5873. newContext = context && context.ownerDocument,
  5874. // nodeType defaults to 9, since context defaults to document
  5875. nodeType = context ? context.nodeType : 9;
  5876. results = results || [];
  5877. // Return early from calls with invalid selector or context
  5878. if ( typeof selector !== "string" || !selector ||
  5879. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  5880. return results;
  5881. }
  5882. // Try to shortcut find operations (as opposed to filters) in HTML documents
  5883. if ( !seed ) {
  5884. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  5885. setDocument( context );
  5886. }
  5887. context = context || document;
  5888. if ( documentIsHTML ) {
  5889. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  5890. // (excepting DocumentFragment context, where the methods don't exist)
  5891. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  5892. // ID selector
  5893. if ( (m = match[1]) ) {
  5894. // Document context
  5895. if ( nodeType === 9 ) {
  5896. if ( (elem = context.getElementById( m )) ) {
  5897. // Support: IE, Opera, Webkit
  5898. // TODO: identify versions
  5899. // getElementById can match elements by name instead of ID
  5900. if ( elem.id === m ) {
  5901. results.push( elem );
  5902. return results;
  5903. }
  5904. } else {
  5905. return results;
  5906. }
  5907. // Element context
  5908. } else {
  5909. // Support: IE, Opera, Webkit
  5910. // TODO: identify versions
  5911. // getElementById can match elements by name instead of ID
  5912. if ( newContext && (elem = newContext.getElementById( m )) &&
  5913. contains( context, elem ) &&
  5914. elem.id === m ) {
  5915. results.push( elem );
  5916. return results;
  5917. }
  5918. }
  5919. // Type selector
  5920. } else if ( match[2] ) {
  5921. push.apply( results, context.getElementsByTagName( selector ) );
  5922. return results;
  5923. // Class selector
  5924. } else if ( (m = match[3]) && support.getElementsByClassName &&
  5925. context.getElementsByClassName ) {
  5926. push.apply( results, context.getElementsByClassName( m ) );
  5927. return results;
  5928. }
  5929. }
  5930. // Take advantage of querySelectorAll
  5931. if ( support.qsa &&
  5932. !nonnativeSelectorCache[ selector + " " ] &&
  5933. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  5934. // Support: IE 8 only
  5935. // Exclude object elements
  5936. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  5937. newSelector = selector;
  5938. newContext = context;
  5939. // qSA considers elements outside a scoping root when evaluating child or
  5940. // descendant combinators, which is not what we want.
  5941. // In such cases, we work around the behavior by prefixing every selector in the
  5942. // list with an ID selector referencing the scope context.
  5943. // Thanks to Andrew Dupont for this technique.
  5944. if ( nodeType === 1 && rdescend.test( selector ) ) {
  5945. // Capture the context ID, setting it first if necessary
  5946. if ( (nid = context.getAttribute( "id" )) ) {
  5947. nid = nid.replace( rcssescape, fcssescape );
  5948. } else {
  5949. context.setAttribute( "id", (nid = expando) );
  5950. }
  5951. // Prefix every selector in the list
  5952. groups = tokenize( selector );
  5953. i = groups.length;
  5954. while ( i-- ) {
  5955. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  5956. }
  5957. newSelector = groups.join( "," );
  5958. // Expand context for sibling selectors
  5959. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  5960. context;
  5961. }
  5962. try {
  5963. push.apply( results,
  5964. newContext.querySelectorAll( newSelector )
  5965. );
  5966. return results;
  5967. } catch ( qsaError ) {
  5968. nonnativeSelectorCache( selector, true );
  5969. } finally {
  5970. if ( nid === expando ) {
  5971. context.removeAttribute( "id" );
  5972. }
  5973. }
  5974. }
  5975. }
  5976. }
  5977. // All others
  5978. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  5979. }
  5980. /**
  5981. * Create key-value caches of limited size
  5982. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  5983. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  5984. * deleting the oldest entry
  5985. */
  5986. function createCache() {
  5987. var keys = [];
  5988. function cache( key, value ) {
  5989. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  5990. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  5991. // Only keep the most recent entries
  5992. delete cache[ keys.shift() ];
  5993. }
  5994. return (cache[ key + " " ] = value);
  5995. }
  5996. return cache;
  5997. }
  5998. /**
  5999. * Mark a function for special use by Sizzle
  6000. * @param {Function} fn The function to mark
  6001. */
  6002. function markFunction( fn ) {
  6003. fn[ expando ] = true;
  6004. return fn;
  6005. }
  6006. /**
  6007. * Support testing using an element
  6008. * @param {Function} fn Passed the created element and returns a boolean result
  6009. */
  6010. function assert( fn ) {
  6011. var el = document.createElement("fieldset");
  6012. try {
  6013. return !!fn( el );
  6014. } catch (e) {
  6015. return false;
  6016. } finally {
  6017. // Remove from its parent by default
  6018. if ( el.parentNode ) {
  6019. el.parentNode.removeChild( el );
  6020. }
  6021. // release memory in IE
  6022. el = null;
  6023. }
  6024. }
  6025. /**
  6026. * Adds the same handler for all of the specified attrs
  6027. * @param {String} attrs Pipe-separated list of attributes
  6028. * @param {Function} handler The method that will be applied
  6029. */
  6030. function addHandle( attrs, handler ) {
  6031. var arr = attrs.split("|"),
  6032. i = arr.length;
  6033. while ( i-- ) {
  6034. Expr.attrHandle[ arr[i] ] = handler;
  6035. }
  6036. }
  6037. /**
  6038. * Checks document order of two siblings
  6039. * @param {Element} a
  6040. * @param {Element} b
  6041. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  6042. */
  6043. function siblingCheck( a, b ) {
  6044. var cur = b && a,
  6045. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  6046. a.sourceIndex - b.sourceIndex;
  6047. // Use IE sourceIndex if available on both nodes
  6048. if ( diff ) {
  6049. return diff;
  6050. }
  6051. // Check if b follows a
  6052. if ( cur ) {
  6053. while ( (cur = cur.nextSibling) ) {
  6054. if ( cur === b ) {
  6055. return -1;
  6056. }
  6057. }
  6058. }
  6059. return a ? 1 : -1;
  6060. }
  6061. /**
  6062. * Returns a function to use in pseudos for input types
  6063. * @param {String} type
  6064. */
  6065. function createInputPseudo( type ) {
  6066. return function( elem ) {
  6067. var name = elem.nodeName.toLowerCase();
  6068. return name === "input" && elem.type === type;
  6069. };
  6070. }
  6071. /**
  6072. * Returns a function to use in pseudos for buttons
  6073. * @param {String} type
  6074. */
  6075. function createButtonPseudo( type ) {
  6076. return function( elem ) {
  6077. var name = elem.nodeName.toLowerCase();
  6078. return (name === "input" || name === "button") && elem.type === type;
  6079. };
  6080. }
  6081. /**
  6082. * Returns a function to use in pseudos for :enabled/:disabled
  6083. * @param {Boolean} disabled true for :disabled; false for :enabled
  6084. */
  6085. function createDisabledPseudo( disabled ) {
  6086. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  6087. return function( elem ) {
  6088. // Only certain elements can match :enabled or :disabled
  6089. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  6090. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  6091. if ( "form" in elem ) {
  6092. // Check for inherited disabledness on relevant non-disabled elements:
  6093. // * listed form-associated elements in a disabled fieldset
  6094. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  6095. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  6096. // * option elements in a disabled optgroup
  6097. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  6098. // All such elements have a "form" property.
  6099. if ( elem.parentNode && elem.disabled === false ) {
  6100. // Option elements defer to a parent optgroup if present
  6101. if ( "label" in elem ) {
  6102. if ( "label" in elem.parentNode ) {
  6103. return elem.parentNode.disabled === disabled;
  6104. } else {
  6105. return elem.disabled === disabled;
  6106. }
  6107. }
  6108. // Support: IE 6 - 11
  6109. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  6110. return elem.isDisabled === disabled ||
  6111. // Where there is no isDisabled, check manually
  6112. /* jshint -W018 */
  6113. elem.isDisabled !== !disabled &&
  6114. inDisabledFieldset( elem ) === disabled;
  6115. }
  6116. return elem.disabled === disabled;
  6117. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  6118. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  6119. // even exist on them, let alone have a boolean value.
  6120. } else if ( "label" in elem ) {
  6121. return elem.disabled === disabled;
  6122. }
  6123. // Remaining elements are neither :enabled nor :disabled
  6124. return false;
  6125. };
  6126. }
  6127. /**
  6128. * Returns a function to use in pseudos for positionals
  6129. * @param {Function} fn
  6130. */
  6131. function createPositionalPseudo( fn ) {
  6132. return markFunction(function( argument ) {
  6133. argument = +argument;
  6134. return markFunction(function( seed, matches ) {
  6135. var j,
  6136. matchIndexes = fn( [], seed.length, argument ),
  6137. i = matchIndexes.length;
  6138. // Match elements found at the specified indexes
  6139. while ( i-- ) {
  6140. if ( seed[ (j = matchIndexes[i]) ] ) {
  6141. seed[j] = !(matches[j] = seed[j]);
  6142. }
  6143. }
  6144. });
  6145. });
  6146. }
  6147. /**
  6148. * Checks a node for validity as a Sizzle context
  6149. * @param {Element|Object=} context
  6150. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  6151. */
  6152. function testContext( context ) {
  6153. return context && typeof context.getElementsByTagName !== "undefined" && context;
  6154. }
  6155. // Expose support vars for convenience
  6156. support = Sizzle.support = {};
  6157. /**
  6158. * Detects XML nodes
  6159. * @param {Element|Object} elem An element or a document
  6160. * @returns {Boolean} True iff elem is a non-HTML XML node
  6161. */
  6162. isXML = Sizzle.isXML = function( elem ) {
  6163. var namespace = elem.namespaceURI,
  6164. docElem = (elem.ownerDocument || elem).documentElement;
  6165. // Support: IE <=8
  6166. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  6167. // https://bugs.jquery.com/ticket/4833
  6168. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  6169. };
  6170. /**
  6171. * Sets document-related variables once based on the current document
  6172. * @param {Element|Object} [doc] An element or document object to use to set the document
  6173. * @returns {Object} Returns the current document
  6174. */
  6175. setDocument = Sizzle.setDocument = function( node ) {
  6176. var hasCompare, subWindow,
  6177. doc = node ? node.ownerDocument || node : preferredDoc;
  6178. // Return early if doc is invalid or already selected
  6179. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  6180. return document;
  6181. }
  6182. // Update global variables
  6183. document = doc;
  6184. docElem = document.documentElement;
  6185. documentIsHTML = !isXML( document );
  6186. // Support: IE 9-11, Edge
  6187. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  6188. if ( preferredDoc !== document &&
  6189. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  6190. // Support: IE 11, Edge
  6191. if ( subWindow.addEventListener ) {
  6192. subWindow.addEventListener( "unload", unloadHandler, false );
  6193. // Support: IE 9 - 10 only
  6194. } else if ( subWindow.attachEvent ) {
  6195. subWindow.attachEvent( "onunload", unloadHandler );
  6196. }
  6197. }
  6198. /* Attributes
  6199. ---------------------------------------------------------------------- */
  6200. // Support: IE<8
  6201. // Verify that getAttribute really returns attributes and not properties
  6202. // (excepting IE8 booleans)
  6203. support.attributes = assert(function( el ) {
  6204. el.className = "i";
  6205. return !el.getAttribute("className");
  6206. });
  6207. /* getElement(s)By*
  6208. ---------------------------------------------------------------------- */
  6209. // Check if getElementsByTagName("*") returns only elements
  6210. support.getElementsByTagName = assert(function( el ) {
  6211. el.appendChild( document.createComment("") );
  6212. return !el.getElementsByTagName("*").length;
  6213. });
  6214. // Support: IE<9
  6215. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  6216. // Support: IE<10
  6217. // Check if getElementById returns elements by name
  6218. // The broken getElementById methods don't pick up programmatically-set names,
  6219. // so use a roundabout getElementsByName test
  6220. support.getById = assert(function( el ) {
  6221. docElem.appendChild( el ).id = expando;
  6222. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  6223. });
  6224. // ID filter and find
  6225. if ( support.getById ) {
  6226. Expr.filter["ID"] = function( id ) {
  6227. var attrId = id.replace( runescape, funescape );
  6228. return function( elem ) {
  6229. return elem.getAttribute("id") === attrId;
  6230. };
  6231. };
  6232. Expr.find["ID"] = function( id, context ) {
  6233. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  6234. var elem = context.getElementById( id );
  6235. return elem ? [ elem ] : [];
  6236. }
  6237. };
  6238. } else {
  6239. Expr.filter["ID"] = function( id ) {
  6240. var attrId = id.replace( runescape, funescape );
  6241. return function( elem ) {
  6242. var node = typeof elem.getAttributeNode !== "undefined" &&
  6243. elem.getAttributeNode("id");
  6244. return node && node.value === attrId;
  6245. };
  6246. };
  6247. // Support: IE 6 - 7 only
  6248. // getElementById is not reliable as a find shortcut
  6249. Expr.find["ID"] = function( id, context ) {
  6250. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  6251. var node, i, elems,
  6252. elem = context.getElementById( id );
  6253. if ( elem ) {
  6254. // Verify the id attribute
  6255. node = elem.getAttributeNode("id");
  6256. if ( node && node.value === id ) {
  6257. return [ elem ];
  6258. }
  6259. // Fall back on getElementsByName
  6260. elems = context.getElementsByName( id );
  6261. i = 0;
  6262. while ( (elem = elems[i++]) ) {
  6263. node = elem.getAttributeNode("id");
  6264. if ( node && node.value === id ) {
  6265. return [ elem ];
  6266. }
  6267. }
  6268. }
  6269. return [];
  6270. }
  6271. };
  6272. }
  6273. // Tag
  6274. Expr.find["TAG"] = support.getElementsByTagName ?
  6275. function( tag, context ) {
  6276. if ( typeof context.getElementsByTagName !== "undefined" ) {
  6277. return context.getElementsByTagName( tag );
  6278. // DocumentFragment nodes don't have gEBTN
  6279. } else if ( support.qsa ) {
  6280. return context.querySelectorAll( tag );
  6281. }
  6282. } :
  6283. function( tag, context ) {
  6284. var elem,
  6285. tmp = [],
  6286. i = 0,
  6287. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  6288. results = context.getElementsByTagName( tag );
  6289. // Filter out possible comments
  6290. if ( tag === "*" ) {
  6291. while ( (elem = results[i++]) ) {
  6292. if ( elem.nodeType === 1 ) {
  6293. tmp.push( elem );
  6294. }
  6295. }
  6296. return tmp;
  6297. }
  6298. return results;
  6299. };
  6300. // Class
  6301. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  6302. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  6303. return context.getElementsByClassName( className );
  6304. }
  6305. };
  6306. /* QSA/matchesSelector
  6307. ---------------------------------------------------------------------- */
  6308. // QSA and matchesSelector support
  6309. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  6310. rbuggyMatches = [];
  6311. // qSa(:focus) reports false when true (Chrome 21)
  6312. // We allow this because of a bug in IE8/9 that throws an error
  6313. // whenever `document.activeElement` is accessed on an iframe
  6314. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  6315. // See https://bugs.jquery.com/ticket/13378
  6316. rbuggyQSA = [];
  6317. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  6318. // Build QSA regex
  6319. // Regex strategy adopted from Diego Perini
  6320. assert(function( el ) {
  6321. // Select is set to empty string on purpose
  6322. // This is to test IE's treatment of not explicitly
  6323. // setting a boolean content attribute,
  6324. // since its presence should be enough
  6325. // https://bugs.jquery.com/ticket/12359
  6326. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  6327. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  6328. "<option selected=''></option></select>";
  6329. // Support: IE8, Opera 11-12.16
  6330. // Nothing should be selected when empty strings follow ^= or $= or *=
  6331. // The test attribute must be unknown in Opera but "safe" for WinRT
  6332. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  6333. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  6334. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  6335. }
  6336. // Support: IE8
  6337. // Boolean attributes and "value" are not treated correctly
  6338. if ( !el.querySelectorAll("[selected]").length ) {
  6339. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  6340. }
  6341. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  6342. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  6343. rbuggyQSA.push("~=");
  6344. }
  6345. // Webkit/Opera - :checked should return selected option elements
  6346. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  6347. // IE8 throws error here and will not see later tests
  6348. if ( !el.querySelectorAll(":checked").length ) {
  6349. rbuggyQSA.push(":checked");
  6350. }
  6351. // Support: Safari 8+, iOS 8+
  6352. // https://bugs.webkit.org/show_bug.cgi?id=136851
  6353. // In-page `selector#id sibling-combinator selector` fails
  6354. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  6355. rbuggyQSA.push(".#.+[+~]");
  6356. }
  6357. });
  6358. assert(function( el ) {
  6359. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  6360. "<select disabled='disabled'><option/></select>";
  6361. // Support: Windows 8 Native Apps
  6362. // The type and name attributes are restricted during .innerHTML assignment
  6363. var input = document.createElement("input");
  6364. input.setAttribute( "type", "hidden" );
  6365. el.appendChild( input ).setAttribute( "name", "D" );
  6366. // Support: IE8
  6367. // Enforce case-sensitivity of name attribute
  6368. if ( el.querySelectorAll("[name=d]").length ) {
  6369. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  6370. }
  6371. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  6372. // IE8 throws error here and will not see later tests
  6373. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  6374. rbuggyQSA.push( ":enabled", ":disabled" );
  6375. }
  6376. // Support: IE9-11+
  6377. // IE's :disabled selector does not pick up the children of disabled fieldsets
  6378. docElem.appendChild( el ).disabled = true;
  6379. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  6380. rbuggyQSA.push( ":enabled", ":disabled" );
  6381. }
  6382. // Opera 10-11 does not throw on post-comma invalid pseudos
  6383. el.querySelectorAll("*,:x");
  6384. rbuggyQSA.push(",.*:");
  6385. });
  6386. }
  6387. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  6388. docElem.webkitMatchesSelector ||
  6389. docElem.mozMatchesSelector ||
  6390. docElem.oMatchesSelector ||
  6391. docElem.msMatchesSelector) )) ) {
  6392. assert(function( el ) {
  6393. // Check to see if it's possible to do matchesSelector
  6394. // on a disconnected node (IE 9)
  6395. support.disconnectedMatch = matches.call( el, "*" );
  6396. // This should fail with an exception
  6397. // Gecko does not error, returns false instead
  6398. matches.call( el, "[s!='']:x" );
  6399. rbuggyMatches.push( "!=", pseudos );
  6400. });
  6401. }
  6402. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  6403. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  6404. /* Contains
  6405. ---------------------------------------------------------------------- */
  6406. hasCompare = rnative.test( docElem.compareDocumentPosition );
  6407. // Element contains another
  6408. // Purposefully self-exclusive
  6409. // As in, an element does not contain itself
  6410. contains = hasCompare || rnative.test( docElem.contains ) ?
  6411. function( a, b ) {
  6412. var adown = a.nodeType === 9 ? a.documentElement : a,
  6413. bup = b && b.parentNode;
  6414. return a === bup || !!( bup && bup.nodeType === 1 && (
  6415. adown.contains ?
  6416. adown.contains( bup ) :
  6417. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  6418. ));
  6419. } :
  6420. function( a, b ) {
  6421. if ( b ) {
  6422. while ( (b = b.parentNode) ) {
  6423. if ( b === a ) {
  6424. return true;
  6425. }
  6426. }
  6427. }
  6428. return false;
  6429. };
  6430. /* Sorting
  6431. ---------------------------------------------------------------------- */
  6432. // Document order sorting
  6433. sortOrder = hasCompare ?
  6434. function( a, b ) {
  6435. // Flag for duplicate removal
  6436. if ( a === b ) {
  6437. hasDuplicate = true;
  6438. return 0;
  6439. }
  6440. // Sort on method existence if only one input has compareDocumentPosition
  6441. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  6442. if ( compare ) {
  6443. return compare;
  6444. }
  6445. // Calculate position if both inputs belong to the same document
  6446. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  6447. a.compareDocumentPosition( b ) :
  6448. // Otherwise we know they are disconnected
  6449. 1;
  6450. // Disconnected nodes
  6451. if ( compare & 1 ||
  6452. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  6453. // Choose the first element that is related to our preferred document
  6454. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  6455. return -1;
  6456. }
  6457. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  6458. return 1;
  6459. }
  6460. // Maintain original order
  6461. return sortInput ?
  6462. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  6463. 0;
  6464. }
  6465. return compare & 4 ? -1 : 1;
  6466. } :
  6467. function( a, b ) {
  6468. // Exit early if the nodes are identical
  6469. if ( a === b ) {
  6470. hasDuplicate = true;
  6471. return 0;
  6472. }
  6473. var cur,
  6474. i = 0,
  6475. aup = a.parentNode,
  6476. bup = b.parentNode,
  6477. ap = [ a ],
  6478. bp = [ b ];
  6479. // Parentless nodes are either documents or disconnected
  6480. if ( !aup || !bup ) {
  6481. return a === document ? -1 :
  6482. b === document ? 1 :
  6483. aup ? -1 :
  6484. bup ? 1 :
  6485. sortInput ?
  6486. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  6487. 0;
  6488. // If the nodes are siblings, we can do a quick check
  6489. } else if ( aup === bup ) {
  6490. return siblingCheck( a, b );
  6491. }
  6492. // Otherwise we need full lists of their ancestors for comparison
  6493. cur = a;
  6494. while ( (cur = cur.parentNode) ) {
  6495. ap.unshift( cur );
  6496. }
  6497. cur = b;
  6498. while ( (cur = cur.parentNode) ) {
  6499. bp.unshift( cur );
  6500. }
  6501. // Walk down the tree looking for a discrepancy
  6502. while ( ap[i] === bp[i] ) {
  6503. i++;
  6504. }
  6505. return i ?
  6506. // Do a sibling check if the nodes have a common ancestor
  6507. siblingCheck( ap[i], bp[i] ) :
  6508. // Otherwise nodes in our document sort first
  6509. ap[i] === preferredDoc ? -1 :
  6510. bp[i] === preferredDoc ? 1 :
  6511. 0;
  6512. };
  6513. return document;
  6514. };
  6515. Sizzle.matches = function( expr, elements ) {
  6516. return Sizzle( expr, null, null, elements );
  6517. };
  6518. Sizzle.matchesSelector = function( elem, expr ) {
  6519. // Set document vars if needed
  6520. if ( ( elem.ownerDocument || elem ) !== document ) {
  6521. setDocument( elem );
  6522. }
  6523. if ( support.matchesSelector && documentIsHTML &&
  6524. !nonnativeSelectorCache[ expr + " " ] &&
  6525. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  6526. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  6527. try {
  6528. var ret = matches.call( elem, expr );
  6529. // IE 9's matchesSelector returns false on disconnected nodes
  6530. if ( ret || support.disconnectedMatch ||
  6531. // As well, disconnected nodes are said to be in a document
  6532. // fragment in IE 9
  6533. elem.document && elem.document.nodeType !== 11 ) {
  6534. return ret;
  6535. }
  6536. } catch (e) {
  6537. nonnativeSelectorCache( expr, true );
  6538. }
  6539. }
  6540. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  6541. };
  6542. Sizzle.contains = function( context, elem ) {
  6543. // Set document vars if needed
  6544. if ( ( context.ownerDocument || context ) !== document ) {
  6545. setDocument( context );
  6546. }
  6547. return contains( context, elem );
  6548. };
  6549. Sizzle.attr = function( elem, name ) {
  6550. // Set document vars if needed
  6551. if ( ( elem.ownerDocument || elem ) !== document ) {
  6552. setDocument( elem );
  6553. }
  6554. var fn = Expr.attrHandle[ name.toLowerCase() ],
  6555. // Don't get fooled by Object.prototype properties (jQuery #13807)
  6556. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  6557. fn( elem, name, !documentIsHTML ) :
  6558. undefined;
  6559. return val !== undefined ?
  6560. val :
  6561. support.attributes || !documentIsHTML ?
  6562. elem.getAttribute( name ) :
  6563. (val = elem.getAttributeNode(name)) && val.specified ?
  6564. val.value :
  6565. null;
  6566. };
  6567. Sizzle.escape = function( sel ) {
  6568. return (sel + "").replace( rcssescape, fcssescape );
  6569. };
  6570. Sizzle.error = function( msg ) {
  6571. throw new Error( "Syntax error, unrecognized expression: " + msg );
  6572. };
  6573. /**
  6574. * Document sorting and removing duplicates
  6575. * @param {ArrayLike} results
  6576. */
  6577. Sizzle.uniqueSort = function( results ) {
  6578. var elem,
  6579. duplicates = [],
  6580. j = 0,
  6581. i = 0;
  6582. // Unless we *know* we can detect duplicates, assume their presence
  6583. hasDuplicate = !support.detectDuplicates;
  6584. sortInput = !support.sortStable && results.slice( 0 );
  6585. results.sort( sortOrder );
  6586. if ( hasDuplicate ) {
  6587. while ( (elem = results[i++]) ) {
  6588. if ( elem === results[ i ] ) {
  6589. j = duplicates.push( i );
  6590. }
  6591. }
  6592. while ( j-- ) {
  6593. results.splice( duplicates[ j ], 1 );
  6594. }
  6595. }
  6596. // Clear input after sorting to release objects
  6597. // See https://github.com/jquery/sizzle/pull/225
  6598. sortInput = null;
  6599. return results;
  6600. };
  6601. /**
  6602. * Utility function for retrieving the text value of an array of DOM nodes
  6603. * @param {Array|Element} elem
  6604. */
  6605. getText = Sizzle.getText = function( elem ) {
  6606. var node,
  6607. ret = "",
  6608. i = 0,
  6609. nodeType = elem.nodeType;
  6610. if ( !nodeType ) {
  6611. // If no nodeType, this is expected to be an array
  6612. while ( (node = elem[i++]) ) {
  6613. // Do not traverse comment nodes
  6614. ret += getText( node );
  6615. }
  6616. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  6617. // Use textContent for elements
  6618. // innerText usage removed for consistency of new lines (jQuery #11153)
  6619. if ( typeof elem.textContent === "string" ) {
  6620. return elem.textContent;
  6621. } else {
  6622. // Traverse its children
  6623. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  6624. ret += getText( elem );
  6625. }
  6626. }
  6627. } else if ( nodeType === 3 || nodeType === 4 ) {
  6628. return elem.nodeValue;
  6629. }
  6630. // Do not include comment or processing instruction nodes
  6631. return ret;
  6632. };
  6633. Expr = Sizzle.selectors = {
  6634. // Can be adjusted by the user
  6635. cacheLength: 50,
  6636. createPseudo: markFunction,
  6637. match: matchExpr,
  6638. attrHandle: {},
  6639. find: {},
  6640. relative: {
  6641. ">": { dir: "parentNode", first: true },
  6642. " ": { dir: "parentNode" },
  6643. "+": { dir: "previousSibling", first: true },
  6644. "~": { dir: "previousSibling" }
  6645. },
  6646. preFilter: {
  6647. "ATTR": function( match ) {
  6648. match[1] = match[1].replace( runescape, funescape );
  6649. // Move the given value to match[3] whether quoted or unquoted
  6650. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  6651. if ( match[2] === "~=" ) {
  6652. match[3] = " " + match[3] + " ";
  6653. }
  6654. return match.slice( 0, 4 );
  6655. },
  6656. "CHILD": function( match ) {
  6657. /* matches from matchExpr["CHILD"]
  6658. 1 type (only|nth|...)
  6659. 2 what (child|of-type)
  6660. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  6661. 4 xn-component of xn+y argument ([+-]?\d*n|)
  6662. 5 sign of xn-component
  6663. 6 x of xn-component
  6664. 7 sign of y-component
  6665. 8 y of y-component
  6666. */
  6667. match[1] = match[1].toLowerCase();
  6668. if ( match[1].slice( 0, 3 ) === "nth" ) {
  6669. // nth-* requires argument
  6670. if ( !match[3] ) {
  6671. Sizzle.error( match[0] );
  6672. }
  6673. // numeric x and y parameters for Expr.filter.CHILD
  6674. // remember that false/true cast respectively to 0/1
  6675. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  6676. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  6677. // other types prohibit arguments
  6678. } else if ( match[3] ) {
  6679. Sizzle.error( match[0] );
  6680. }
  6681. return match;
  6682. },
  6683. "PSEUDO": function( match ) {
  6684. var excess,
  6685. unquoted = !match[6] && match[2];
  6686. if ( matchExpr["CHILD"].test( match[0] ) ) {
  6687. return null;
  6688. }
  6689. // Accept quoted arguments as-is
  6690. if ( match[3] ) {
  6691. match[2] = match[4] || match[5] || "";
  6692. // Strip excess characters from unquoted arguments
  6693. } else if ( unquoted && rpseudo.test( unquoted ) &&
  6694. // Get excess from tokenize (recursively)
  6695. (excess = tokenize( unquoted, true )) &&
  6696. // advance to the next closing parenthesis
  6697. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  6698. // excess is a negative index
  6699. match[0] = match[0].slice( 0, excess );
  6700. match[2] = unquoted.slice( 0, excess );
  6701. }
  6702. // Return only captures needed by the pseudo filter method (type and argument)
  6703. return match.slice( 0, 3 );
  6704. }
  6705. },
  6706. filter: {
  6707. "TAG": function( nodeNameSelector ) {
  6708. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  6709. return nodeNameSelector === "*" ?
  6710. function() { return true; } :
  6711. function( elem ) {
  6712. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  6713. };
  6714. },
  6715. "CLASS": function( className ) {
  6716. var pattern = classCache[ className + " " ];
  6717. return pattern ||
  6718. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  6719. classCache( className, function( elem ) {
  6720. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  6721. });
  6722. },
  6723. "ATTR": function( name, operator, check ) {
  6724. return function( elem ) {
  6725. var result = Sizzle.attr( elem, name );
  6726. if ( result == null ) {
  6727. return operator === "!=";
  6728. }
  6729. if ( !operator ) {
  6730. return true;
  6731. }
  6732. result += "";
  6733. return operator === "=" ? result === check :
  6734. operator === "!=" ? result !== check :
  6735. operator === "^=" ? check && result.indexOf( check ) === 0 :
  6736. operator === "*=" ? check && result.indexOf( check ) > -1 :
  6737. operator === "$=" ? check && result.slice( -check.length ) === check :
  6738. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  6739. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  6740. false;
  6741. };
  6742. },
  6743. "CHILD": function( type, what, argument, first, last ) {
  6744. var simple = type.slice( 0, 3 ) !== "nth",
  6745. forward = type.slice( -4 ) !== "last",
  6746. ofType = what === "of-type";
  6747. return first === 1 && last === 0 ?
  6748. // Shortcut for :nth-*(n)
  6749. function( elem ) {
  6750. return !!elem.parentNode;
  6751. } :
  6752. function( elem, context, xml ) {
  6753. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  6754. dir = simple !== forward ? "nextSibling" : "previousSibling",
  6755. parent = elem.parentNode,
  6756. name = ofType && elem.nodeName.toLowerCase(),
  6757. useCache = !xml && !ofType,
  6758. diff = false;
  6759. if ( parent ) {
  6760. // :(first|last|only)-(child|of-type)
  6761. if ( simple ) {
  6762. while ( dir ) {
  6763. node = elem;
  6764. while ( (node = node[ dir ]) ) {
  6765. if ( ofType ?
  6766. node.nodeName.toLowerCase() === name :
  6767. node.nodeType === 1 ) {
  6768. return false;
  6769. }
  6770. }
  6771. // Reverse direction for :only-* (if we haven't yet done so)
  6772. start = dir = type === "only" && !start && "nextSibling";
  6773. }
  6774. return true;
  6775. }
  6776. start = [ forward ? parent.firstChild : parent.lastChild ];
  6777. // non-xml :nth-child(...) stores cache data on `parent`
  6778. if ( forward && useCache ) {
  6779. // Seek `elem` from a previously-cached index
  6780. // ...in a gzip-friendly way
  6781. node = parent;
  6782. outerCache = node[ expando ] || (node[ expando ] = {});
  6783. // Support: IE <9 only
  6784. // Defend against cloned attroperties (jQuery gh-1709)
  6785. uniqueCache = outerCache[ node.uniqueID ] ||
  6786. (outerCache[ node.uniqueID ] = {});
  6787. cache = uniqueCache[ type ] || [];
  6788. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  6789. diff = nodeIndex && cache[ 2 ];
  6790. node = nodeIndex && parent.childNodes[ nodeIndex ];
  6791. while ( (node = ++nodeIndex && node && node[ dir ] ||
  6792. // Fallback to seeking `elem` from the start
  6793. (diff = nodeIndex = 0) || start.pop()) ) {
  6794. // When found, cache indexes on `parent` and break
  6795. if ( node.nodeType === 1 && ++diff && node === elem ) {
  6796. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  6797. break;
  6798. }
  6799. }
  6800. } else {
  6801. // Use previously-cached element index if available
  6802. if ( useCache ) {
  6803. // ...in a gzip-friendly way
  6804. node = elem;
  6805. outerCache = node[ expando ] || (node[ expando ] = {});
  6806. // Support: IE <9 only
  6807. // Defend against cloned attroperties (jQuery gh-1709)
  6808. uniqueCache = outerCache[ node.uniqueID ] ||
  6809. (outerCache[ node.uniqueID ] = {});
  6810. cache = uniqueCache[ type ] || [];
  6811. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  6812. diff = nodeIndex;
  6813. }
  6814. // xml :nth-child(...)
  6815. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  6816. if ( diff === false ) {
  6817. // Use the same loop as above to seek `elem` from the start
  6818. while ( (node = ++nodeIndex && node && node[ dir ] ||
  6819. (diff = nodeIndex = 0) || start.pop()) ) {
  6820. if ( ( ofType ?
  6821. node.nodeName.toLowerCase() === name :
  6822. node.nodeType === 1 ) &&
  6823. ++diff ) {
  6824. // Cache the index of each encountered element
  6825. if ( useCache ) {
  6826. outerCache = node[ expando ] || (node[ expando ] = {});
  6827. // Support: IE <9 only
  6828. // Defend against cloned attroperties (jQuery gh-1709)
  6829. uniqueCache = outerCache[ node.uniqueID ] ||
  6830. (outerCache[ node.uniqueID ] = {});
  6831. uniqueCache[ type ] = [ dirruns, diff ];
  6832. }
  6833. if ( node === elem ) {
  6834. break;
  6835. }
  6836. }
  6837. }
  6838. }
  6839. }
  6840. // Incorporate the offset, then check against cycle size
  6841. diff -= last;
  6842. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  6843. }
  6844. };
  6845. },
  6846. "PSEUDO": function( pseudo, argument ) {
  6847. // pseudo-class names are case-insensitive
  6848. // http://www.w3.org/TR/selectors/#pseudo-classes
  6849. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  6850. // Remember that setFilters inherits from pseudos
  6851. var args,
  6852. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  6853. Sizzle.error( "unsupported pseudo: " + pseudo );
  6854. // The user may use createPseudo to indicate that
  6855. // arguments are needed to create the filter function
  6856. // just as Sizzle does
  6857. if ( fn[ expando ] ) {
  6858. return fn( argument );
  6859. }
  6860. // But maintain support for old signatures
  6861. if ( fn.length > 1 ) {
  6862. args = [ pseudo, pseudo, "", argument ];
  6863. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  6864. markFunction(function( seed, matches ) {
  6865. var idx,
  6866. matched = fn( seed, argument ),
  6867. i = matched.length;
  6868. while ( i-- ) {
  6869. idx = indexOf( seed, matched[i] );
  6870. seed[ idx ] = !( matches[ idx ] = matched[i] );
  6871. }
  6872. }) :
  6873. function( elem ) {
  6874. return fn( elem, 0, args );
  6875. };
  6876. }
  6877. return fn;
  6878. }
  6879. },
  6880. pseudos: {
  6881. // Potentially complex pseudos
  6882. "not": markFunction(function( selector ) {
  6883. // Trim the selector passed to compile
  6884. // to avoid treating leading and trailing
  6885. // spaces as combinators
  6886. var input = [],
  6887. results = [],
  6888. matcher = compile( selector.replace( rtrim, "$1" ) );
  6889. return matcher[ expando ] ?
  6890. markFunction(function( seed, matches, context, xml ) {
  6891. var elem,
  6892. unmatched = matcher( seed, null, xml, [] ),
  6893. i = seed.length;
  6894. // Match elements unmatched by `matcher`
  6895. while ( i-- ) {
  6896. if ( (elem = unmatched[i]) ) {
  6897. seed[i] = !(matches[i] = elem);
  6898. }
  6899. }
  6900. }) :
  6901. function( elem, context, xml ) {
  6902. input[0] = elem;
  6903. matcher( input, null, xml, results );
  6904. // Don't keep the element (issue #299)
  6905. input[0] = null;
  6906. return !results.pop();
  6907. };
  6908. }),
  6909. "has": markFunction(function( selector ) {
  6910. return function( elem ) {
  6911. return Sizzle( selector, elem ).length > 0;
  6912. };
  6913. }),
  6914. "contains": markFunction(function( text ) {
  6915. text = text.replace( runescape, funescape );
  6916. return function( elem ) {
  6917. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  6918. };
  6919. }),
  6920. // "Whether an element is represented by a :lang() selector
  6921. // is based solely on the element's language value
  6922. // being equal to the identifier C,
  6923. // or beginning with the identifier C immediately followed by "-".
  6924. // The matching of C against the element's language value is performed case-insensitively.
  6925. // The identifier C does not have to be a valid language name."
  6926. // http://www.w3.org/TR/selectors/#lang-pseudo
  6927. "lang": markFunction( function( lang ) {
  6928. // lang value must be a valid identifier
  6929. if ( !ridentifier.test(lang || "") ) {
  6930. Sizzle.error( "unsupported lang: " + lang );
  6931. }
  6932. lang = lang.replace( runescape, funescape ).toLowerCase();
  6933. return function( elem ) {
  6934. var elemLang;
  6935. do {
  6936. if ( (elemLang = documentIsHTML ?
  6937. elem.lang :
  6938. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  6939. elemLang = elemLang.toLowerCase();
  6940. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  6941. }
  6942. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  6943. return false;
  6944. };
  6945. }),
  6946. // Miscellaneous
  6947. "target": function( elem ) {
  6948. var hash = window.location && window.location.hash;
  6949. return hash && hash.slice( 1 ) === elem.id;
  6950. },
  6951. "root": function( elem ) {
  6952. return elem === docElem;
  6953. },
  6954. "focus": function( elem ) {
  6955. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  6956. },
  6957. // Boolean properties
  6958. "enabled": createDisabledPseudo( false ),
  6959. "disabled": createDisabledPseudo( true ),
  6960. "checked": function( elem ) {
  6961. // In CSS3, :checked should return both checked and selected elements
  6962. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  6963. var nodeName = elem.nodeName.toLowerCase();
  6964. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  6965. },
  6966. "selected": function( elem ) {
  6967. // Accessing this property makes selected-by-default
  6968. // options in Safari work properly
  6969. if ( elem.parentNode ) {
  6970. elem.parentNode.selectedIndex;
  6971. }
  6972. return elem.selected === true;
  6973. },
  6974. // Contents
  6975. "empty": function( elem ) {
  6976. // http://www.w3.org/TR/selectors/#empty-pseudo
  6977. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  6978. // but not by others (comment: 8; processing instruction: 7; etc.)
  6979. // nodeType < 6 works because attributes (2) do not appear as children
  6980. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  6981. if ( elem.nodeType < 6 ) {
  6982. return false;
  6983. }
  6984. }
  6985. return true;
  6986. },
  6987. "parent": function( elem ) {
  6988. return !Expr.pseudos["empty"]( elem );
  6989. },
  6990. // Element/input types
  6991. "header": function( elem ) {
  6992. return rheader.test( elem.nodeName );
  6993. },
  6994. "input": function( elem ) {
  6995. return rinputs.test( elem.nodeName );
  6996. },
  6997. "button": function( elem ) {
  6998. var name = elem.nodeName.toLowerCase();
  6999. return name === "input" && elem.type === "button" || name === "button";
  7000. },
  7001. "text": function( elem ) {
  7002. var attr;
  7003. return elem.nodeName.toLowerCase() === "input" &&
  7004. elem.type === "text" &&
  7005. // Support: IE<8
  7006. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  7007. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  7008. },
  7009. // Position-in-collection
  7010. "first": createPositionalPseudo(function() {
  7011. return [ 0 ];
  7012. }),
  7013. "last": createPositionalPseudo(function( matchIndexes, length ) {
  7014. return [ length - 1 ];
  7015. }),
  7016. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  7017. return [ argument < 0 ? argument + length : argument ];
  7018. }),
  7019. "even": createPositionalPseudo(function( matchIndexes, length ) {
  7020. var i = 0;
  7021. for ( ; i < length; i += 2 ) {
  7022. matchIndexes.push( i );
  7023. }
  7024. return matchIndexes;
  7025. }),
  7026. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  7027. var i = 1;
  7028. for ( ; i < length; i += 2 ) {
  7029. matchIndexes.push( i );
  7030. }
  7031. return matchIndexes;
  7032. }),
  7033. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  7034. var i = argument < 0 ?
  7035. argument + length :
  7036. argument > length ?
  7037. length :
  7038. argument;
  7039. for ( ; --i >= 0; ) {
  7040. matchIndexes.push( i );
  7041. }
  7042. return matchIndexes;
  7043. }),
  7044. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  7045. var i = argument < 0 ? argument + length : argument;
  7046. for ( ; ++i < length; ) {
  7047. matchIndexes.push( i );
  7048. }
  7049. return matchIndexes;
  7050. })
  7051. }
  7052. };
  7053. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  7054. // Add button/input type pseudos
  7055. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  7056. Expr.pseudos[ i ] = createInputPseudo( i );
  7057. }
  7058. for ( i in { submit: true, reset: true } ) {
  7059. Expr.pseudos[ i ] = createButtonPseudo( i );
  7060. }
  7061. // Easy API for creating new setFilters
  7062. function setFilters() {}
  7063. setFilters.prototype = Expr.filters = Expr.pseudos;
  7064. Expr.setFilters = new setFilters();
  7065. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  7066. var matched, match, tokens, type,
  7067. soFar, groups, preFilters,
  7068. cached = tokenCache[ selector + " " ];
  7069. if ( cached ) {
  7070. return parseOnly ? 0 : cached.slice( 0 );
  7071. }
  7072. soFar = selector;
  7073. groups = [];
  7074. preFilters = Expr.preFilter;
  7075. while ( soFar ) {
  7076. // Comma and first run
  7077. if ( !matched || (match = rcomma.exec( soFar )) ) {
  7078. if ( match ) {
  7079. // Don't consume trailing commas as valid
  7080. soFar = soFar.slice( match[0].length ) || soFar;
  7081. }
  7082. groups.push( (tokens = []) );
  7083. }
  7084. matched = false;
  7085. // Combinators
  7086. if ( (match = rcombinators.exec( soFar )) ) {
  7087. matched = match.shift();
  7088. tokens.push({
  7089. value: matched,
  7090. // Cast descendant combinators to space
  7091. type: match[0].replace( rtrim, " " )
  7092. });
  7093. soFar = soFar.slice( matched.length );
  7094. }
  7095. // Filters
  7096. for ( type in Expr.filter ) {
  7097. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  7098. (match = preFilters[ type ]( match ))) ) {
  7099. matched = match.shift();
  7100. tokens.push({
  7101. value: matched,
  7102. type: type,
  7103. matches: match
  7104. });
  7105. soFar = soFar.slice( matched.length );
  7106. }
  7107. }
  7108. if ( !matched ) {
  7109. break;
  7110. }
  7111. }
  7112. // Return the length of the invalid excess
  7113. // if we're just parsing
  7114. // Otherwise, throw an error or return tokens
  7115. return parseOnly ?
  7116. soFar.length :
  7117. soFar ?
  7118. Sizzle.error( selector ) :
  7119. // Cache the tokens
  7120. tokenCache( selector, groups ).slice( 0 );
  7121. };
  7122. function toSelector( tokens ) {
  7123. var i = 0,
  7124. len = tokens.length,
  7125. selector = "";
  7126. for ( ; i < len; i++ ) {
  7127. selector += tokens[i].value;
  7128. }
  7129. return selector;
  7130. }
  7131. function addCombinator( matcher, combinator, base ) {
  7132. var dir = combinator.dir,
  7133. skip = combinator.next,
  7134. key = skip || dir,
  7135. checkNonElements = base && key === "parentNode",
  7136. doneName = done++;
  7137. return combinator.first ?
  7138. // Check against closest ancestor/preceding element
  7139. function( elem, context, xml ) {
  7140. while ( (elem = elem[ dir ]) ) {
  7141. if ( elem.nodeType === 1 || checkNonElements ) {
  7142. return matcher( elem, context, xml );
  7143. }
  7144. }
  7145. return false;
  7146. } :
  7147. // Check against all ancestor/preceding elements
  7148. function( elem, context, xml ) {
  7149. var oldCache, uniqueCache, outerCache,
  7150. newCache = [ dirruns, doneName ];
  7151. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  7152. if ( xml ) {
  7153. while ( (elem = elem[ dir ]) ) {
  7154. if ( elem.nodeType === 1 || checkNonElements ) {
  7155. if ( matcher( elem, context, xml ) ) {
  7156. return true;
  7157. }
  7158. }
  7159. }
  7160. } else {
  7161. while ( (elem = elem[ dir ]) ) {
  7162. if ( elem.nodeType === 1 || checkNonElements ) {
  7163. outerCache = elem[ expando ] || (elem[ expando ] = {});
  7164. // Support: IE <9 only
  7165. // Defend against cloned attroperties (jQuery gh-1709)
  7166. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  7167. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  7168. elem = elem[ dir ] || elem;
  7169. } else if ( (oldCache = uniqueCache[ key ]) &&
  7170. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  7171. // Assign to newCache so results back-propagate to previous elements
  7172. return (newCache[ 2 ] = oldCache[ 2 ]);
  7173. } else {
  7174. // Reuse newcache so results back-propagate to previous elements
  7175. uniqueCache[ key ] = newCache;
  7176. // A match means we're done; a fail means we have to keep checking
  7177. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  7178. return true;
  7179. }
  7180. }
  7181. }
  7182. }
  7183. }
  7184. return false;
  7185. };
  7186. }
  7187. function elementMatcher( matchers ) {
  7188. return matchers.length > 1 ?
  7189. function( elem, context, xml ) {
  7190. var i = matchers.length;
  7191. while ( i-- ) {
  7192. if ( !matchers[i]( elem, context, xml ) ) {
  7193. return false;
  7194. }
  7195. }
  7196. return true;
  7197. } :
  7198. matchers[0];
  7199. }
  7200. function multipleContexts( selector, contexts, results ) {
  7201. var i = 0,
  7202. len = contexts.length;
  7203. for ( ; i < len; i++ ) {
  7204. Sizzle( selector, contexts[i], results );
  7205. }
  7206. return results;
  7207. }
  7208. function condense( unmatched, map, filter, context, xml ) {
  7209. var elem,
  7210. newUnmatched = [],
  7211. i = 0,
  7212. len = unmatched.length,
  7213. mapped = map != null;
  7214. for ( ; i < len; i++ ) {
  7215. if ( (elem = unmatched[i]) ) {
  7216. if ( !filter || filter( elem, context, xml ) ) {
  7217. newUnmatched.push( elem );
  7218. if ( mapped ) {
  7219. map.push( i );
  7220. }
  7221. }
  7222. }
  7223. }
  7224. return newUnmatched;
  7225. }
  7226. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  7227. if ( postFilter && !postFilter[ expando ] ) {
  7228. postFilter = setMatcher( postFilter );
  7229. }
  7230. if ( postFinder && !postFinder[ expando ] ) {
  7231. postFinder = setMatcher( postFinder, postSelector );
  7232. }
  7233. return markFunction(function( seed, results, context, xml ) {
  7234. var temp, i, elem,
  7235. preMap = [],
  7236. postMap = [],
  7237. preexisting = results.length,
  7238. // Get initial elements from seed or context
  7239. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  7240. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  7241. matcherIn = preFilter && ( seed || !selector ) ?
  7242. condense( elems, preMap, preFilter, context, xml ) :
  7243. elems,
  7244. matcherOut = matcher ?
  7245. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  7246. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  7247. // ...intermediate processing is necessary
  7248. [] :
  7249. // ...otherwise use results directly
  7250. results :
  7251. matcherIn;
  7252. // Find primary matches
  7253. if ( matcher ) {
  7254. matcher( matcherIn, matcherOut, context, xml );
  7255. }
  7256. // Apply postFilter
  7257. if ( postFilter ) {
  7258. temp = condense( matcherOut, postMap );
  7259. postFilter( temp, [], context, xml );
  7260. // Un-match failing elements by moving them back to matcherIn
  7261. i = temp.length;
  7262. while ( i-- ) {
  7263. if ( (elem = temp[i]) ) {
  7264. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  7265. }
  7266. }
  7267. }
  7268. if ( seed ) {
  7269. if ( postFinder || preFilter ) {
  7270. if ( postFinder ) {
  7271. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  7272. temp = [];
  7273. i = matcherOut.length;
  7274. while ( i-- ) {
  7275. if ( (elem = matcherOut[i]) ) {
  7276. // Restore matcherIn since elem is not yet a final match
  7277. temp.push( (matcherIn[i] = elem) );
  7278. }
  7279. }
  7280. postFinder( null, (matcherOut = []), temp, xml );
  7281. }
  7282. // Move matched elements from seed to results to keep them synchronized
  7283. i = matcherOut.length;
  7284. while ( i-- ) {
  7285. if ( (elem = matcherOut[i]) &&
  7286. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  7287. seed[temp] = !(results[temp] = elem);
  7288. }
  7289. }
  7290. }
  7291. // Add elements to results, through postFinder if defined
  7292. } else {
  7293. matcherOut = condense(
  7294. matcherOut === results ?
  7295. matcherOut.splice( preexisting, matcherOut.length ) :
  7296. matcherOut
  7297. );
  7298. if ( postFinder ) {
  7299. postFinder( null, results, matcherOut, xml );
  7300. } else {
  7301. push.apply( results, matcherOut );
  7302. }
  7303. }
  7304. });
  7305. }
  7306. function matcherFromTokens( tokens ) {
  7307. var checkContext, matcher, j,
  7308. len = tokens.length,
  7309. leadingRelative = Expr.relative[ tokens[0].type ],
  7310. implicitRelative = leadingRelative || Expr.relative[" "],
  7311. i = leadingRelative ? 1 : 0,
  7312. // The foundational matcher ensures that elements are reachable from top-level context(s)
  7313. matchContext = addCombinator( function( elem ) {
  7314. return elem === checkContext;
  7315. }, implicitRelative, true ),
  7316. matchAnyContext = addCombinator( function( elem ) {
  7317. return indexOf( checkContext, elem ) > -1;
  7318. }, implicitRelative, true ),
  7319. matchers = [ function( elem, context, xml ) {
  7320. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  7321. (checkContext = context).nodeType ?
  7322. matchContext( elem, context, xml ) :
  7323. matchAnyContext( elem, context, xml ) );
  7324. // Avoid hanging onto element (issue #299)
  7325. checkContext = null;
  7326. return ret;
  7327. } ];
  7328. for ( ; i < len; i++ ) {
  7329. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  7330. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  7331. } else {
  7332. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  7333. // Return special upon seeing a positional matcher
  7334. if ( matcher[ expando ] ) {
  7335. // Find the next relative operator (if any) for proper handling
  7336. j = ++i;
  7337. for ( ; j < len; j++ ) {
  7338. if ( Expr.relative[ tokens[j].type ] ) {
  7339. break;
  7340. }
  7341. }
  7342. return setMatcher(
  7343. i > 1 && elementMatcher( matchers ),
  7344. i > 1 && toSelector(
  7345. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  7346. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  7347. ).replace( rtrim, "$1" ),
  7348. matcher,
  7349. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  7350. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  7351. j < len && toSelector( tokens )
  7352. );
  7353. }
  7354. matchers.push( matcher );
  7355. }
  7356. }
  7357. return elementMatcher( matchers );
  7358. }
  7359. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  7360. var bySet = setMatchers.length > 0,
  7361. byElement = elementMatchers.length > 0,
  7362. superMatcher = function( seed, context, xml, results, outermost ) {
  7363. var elem, j, matcher,
  7364. matchedCount = 0,
  7365. i = "0",
  7366. unmatched = seed && [],
  7367. setMatched = [],
  7368. contextBackup = outermostContext,
  7369. // We must always have either seed elements or outermost context
  7370. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  7371. // Use integer dirruns iff this is the outermost matcher
  7372. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  7373. len = elems.length;
  7374. if ( outermost ) {
  7375. outermostContext = context === document || context || outermost;
  7376. }
  7377. // Add elements passing elementMatchers directly to results
  7378. // Support: IE<9, Safari
  7379. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  7380. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  7381. if ( byElement && elem ) {
  7382. j = 0;
  7383. if ( !context && elem.ownerDocument !== document ) {
  7384. setDocument( elem );
  7385. xml = !documentIsHTML;
  7386. }
  7387. while ( (matcher = elementMatchers[j++]) ) {
  7388. if ( matcher( elem, context || document, xml) ) {
  7389. results.push( elem );
  7390. break;
  7391. }
  7392. }
  7393. if ( outermost ) {
  7394. dirruns = dirrunsUnique;
  7395. }
  7396. }
  7397. // Track unmatched elements for set filters
  7398. if ( bySet ) {
  7399. // They will have gone through all possible matchers
  7400. if ( (elem = !matcher && elem) ) {
  7401. matchedCount--;
  7402. }
  7403. // Lengthen the array for every element, matched or not
  7404. if ( seed ) {
  7405. unmatched.push( elem );
  7406. }
  7407. }
  7408. }
  7409. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  7410. // makes the latter nonnegative.
  7411. matchedCount += i;
  7412. // Apply set filters to unmatched elements
  7413. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  7414. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  7415. // no element matchers and no seed.
  7416. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  7417. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  7418. // numerically zero.
  7419. if ( bySet && i !== matchedCount ) {
  7420. j = 0;
  7421. while ( (matcher = setMatchers[j++]) ) {
  7422. matcher( unmatched, setMatched, context, xml );
  7423. }
  7424. if ( seed ) {
  7425. // Reintegrate element matches to eliminate the need for sorting
  7426. if ( matchedCount > 0 ) {
  7427. while ( i-- ) {
  7428. if ( !(unmatched[i] || setMatched[i]) ) {
  7429. setMatched[i] = pop.call( results );
  7430. }
  7431. }
  7432. }
  7433. // Discard index placeholder values to get only actual matches
  7434. setMatched = condense( setMatched );
  7435. }
  7436. // Add matches to results
  7437. push.apply( results, setMatched );
  7438. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  7439. if ( outermost && !seed && setMatched.length > 0 &&
  7440. ( matchedCount + setMatchers.length ) > 1 ) {
  7441. Sizzle.uniqueSort( results );
  7442. }
  7443. }
  7444. // Override manipulation of globals by nested matchers
  7445. if ( outermost ) {
  7446. dirruns = dirrunsUnique;
  7447. outermostContext = contextBackup;
  7448. }
  7449. return unmatched;
  7450. };
  7451. return bySet ?
  7452. markFunction( superMatcher ) :
  7453. superMatcher;
  7454. }
  7455. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  7456. var i,
  7457. setMatchers = [],
  7458. elementMatchers = [],
  7459. cached = compilerCache[ selector + " " ];
  7460. if ( !cached ) {
  7461. // Generate a function of recursive functions that can be used to check each element
  7462. if ( !match ) {
  7463. match = tokenize( selector );
  7464. }
  7465. i = match.length;
  7466. while ( i-- ) {
  7467. cached = matcherFromTokens( match[i] );
  7468. if ( cached[ expando ] ) {
  7469. setMatchers.push( cached );
  7470. } else {
  7471. elementMatchers.push( cached );
  7472. }
  7473. }
  7474. // Cache the compiled function
  7475. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  7476. // Save selector and tokenization
  7477. cached.selector = selector;
  7478. }
  7479. return cached;
  7480. };
  7481. /**
  7482. * A low-level selection function that works with Sizzle's compiled
  7483. * selector functions
  7484. * @param {String|Function} selector A selector or a pre-compiled
  7485. * selector function built with Sizzle.compile
  7486. * @param {Element} context
  7487. * @param {Array} [results]
  7488. * @param {Array} [seed] A set of elements to match against
  7489. */
  7490. select = Sizzle.select = function( selector, context, results, seed ) {
  7491. var i, tokens, token, type, find,
  7492. compiled = typeof selector === "function" && selector,
  7493. match = !seed && tokenize( (selector = compiled.selector || selector) );
  7494. results = results || [];
  7495. // Try to minimize operations if there is only one selector in the list and no seed
  7496. // (the latter of which guarantees us context)
  7497. if ( match.length === 1 ) {
  7498. // Reduce context if the leading compound selector is an ID
  7499. tokens = match[0] = match[0].slice( 0 );
  7500. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  7501. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  7502. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  7503. if ( !context ) {
  7504. return results;
  7505. // Precompiled matchers will still verify ancestry, so step up a level
  7506. } else if ( compiled ) {
  7507. context = context.parentNode;
  7508. }
  7509. selector = selector.slice( tokens.shift().value.length );
  7510. }
  7511. // Fetch a seed set for right-to-left matching
  7512. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  7513. while ( i-- ) {
  7514. token = tokens[i];
  7515. // Abort if we hit a combinator
  7516. if ( Expr.relative[ (type = token.type) ] ) {
  7517. break;
  7518. }
  7519. if ( (find = Expr.find[ type ]) ) {
  7520. // Search, expanding context for leading sibling combinators
  7521. if ( (seed = find(
  7522. token.matches[0].replace( runescape, funescape ),
  7523. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  7524. )) ) {
  7525. // If seed is empty or no tokens remain, we can return early
  7526. tokens.splice( i, 1 );
  7527. selector = seed.length && toSelector( tokens );
  7528. if ( !selector ) {
  7529. push.apply( results, seed );
  7530. return results;
  7531. }
  7532. break;
  7533. }
  7534. }
  7535. }
  7536. }
  7537. // Compile and execute a filtering function if one is not provided
  7538. // Provide `match` to avoid retokenization if we modified the selector above
  7539. ( compiled || compile( selector, match ) )(
  7540. seed,
  7541. context,
  7542. !documentIsHTML,
  7543. results,
  7544. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  7545. );
  7546. return results;
  7547. };
  7548. // One-time assignments
  7549. // Sort stability
  7550. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  7551. // Support: Chrome 14-35+
  7552. // Always assume duplicates if they aren't passed to the comparison function
  7553. support.detectDuplicates = !!hasDuplicate;
  7554. // Initialize against the default document
  7555. setDocument();
  7556. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  7557. // Detached nodes confoundingly follow *each other*
  7558. support.sortDetached = assert(function( el ) {
  7559. // Should return 1, but returns 4 (following)
  7560. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  7561. });
  7562. // Support: IE<8
  7563. // Prevent attribute/property "interpolation"
  7564. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  7565. if ( !assert(function( el ) {
  7566. el.innerHTML = "<a href='#'></a>";
  7567. return el.firstChild.getAttribute("href") === "#" ;
  7568. }) ) {
  7569. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  7570. if ( !isXML ) {
  7571. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  7572. }
  7573. });
  7574. }
  7575. // Support: IE<9
  7576. // Use defaultValue in place of getAttribute("value")
  7577. if ( !support.attributes || !assert(function( el ) {
  7578. el.innerHTML = "<input/>";
  7579. el.firstChild.setAttribute( "value", "" );
  7580. return el.firstChild.getAttribute( "value" ) === "";
  7581. }) ) {
  7582. addHandle( "value", function( elem, name, isXML ) {
  7583. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  7584. return elem.defaultValue;
  7585. }
  7586. });
  7587. }
  7588. // Support: IE<9
  7589. // Use getAttributeNode to fetch booleans when getAttribute lies
  7590. if ( !assert(function( el ) {
  7591. return el.getAttribute("disabled") == null;
  7592. }) ) {
  7593. addHandle( booleans, function( elem, name, isXML ) {
  7594. var val;
  7595. if ( !isXML ) {
  7596. return elem[ name ] === true ? name.toLowerCase() :
  7597. (val = elem.getAttributeNode( name )) && val.specified ?
  7598. val.value :
  7599. null;
  7600. }
  7601. });
  7602. }
  7603. return Sizzle;
  7604. })( window );
  7605. jQuery.find = Sizzle;
  7606. jQuery.expr = Sizzle.selectors;
  7607. // Deprecated
  7608. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  7609. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  7610. jQuery.text = Sizzle.getText;
  7611. jQuery.isXMLDoc = Sizzle.isXML;
  7612. jQuery.contains = Sizzle.contains;
  7613. jQuery.escapeSelector = Sizzle.escape;
  7614. var dir = function( elem, dir, until ) {
  7615. var matched = [],
  7616. truncate = until !== undefined;
  7617. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  7618. if ( elem.nodeType === 1 ) {
  7619. if ( truncate && jQuery( elem ).is( until ) ) {
  7620. break;
  7621. }
  7622. matched.push( elem );
  7623. }
  7624. }
  7625. return matched;
  7626. };
  7627. var siblings = function( n, elem ) {
  7628. var matched = [];
  7629. for ( ; n; n = n.nextSibling ) {
  7630. if ( n.nodeType === 1 && n !== elem ) {
  7631. matched.push( n );
  7632. }
  7633. }
  7634. return matched;
  7635. };
  7636. var rneedsContext = jQuery.expr.match.needsContext;
  7637. function nodeName( elem, name ) {
  7638. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  7639. };
  7640. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  7641. // Implement the identical functionality for filter and not
  7642. function winnow( elements, qualifier, not ) {
  7643. if ( isFunction( qualifier ) ) {
  7644. return jQuery.grep( elements, function( elem, i ) {
  7645. return !!qualifier.call( elem, i, elem ) !== not;
  7646. } );
  7647. }
  7648. // Single element
  7649. if ( qualifier.nodeType ) {
  7650. return jQuery.grep( elements, function( elem ) {
  7651. return ( elem === qualifier ) !== not;
  7652. } );
  7653. }
  7654. // Arraylike of elements (jQuery, arguments, Array)
  7655. if ( typeof qualifier !== "string" ) {
  7656. return jQuery.grep( elements, function( elem ) {
  7657. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  7658. } );
  7659. }
  7660. // Filtered directly for both simple and complex selectors
  7661. return jQuery.filter( qualifier, elements, not );
  7662. }
  7663. jQuery.filter = function( expr, elems, not ) {
  7664. var elem = elems[ 0 ];
  7665. if ( not ) {
  7666. expr = ":not(" + expr + ")";
  7667. }
  7668. if ( elems.length === 1 && elem.nodeType === 1 ) {
  7669. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  7670. }
  7671. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  7672. return elem.nodeType === 1;
  7673. } ) );
  7674. };
  7675. jQuery.fn.extend( {
  7676. find: function( selector ) {
  7677. var i, ret,
  7678. len = this.length,
  7679. self = this;
  7680. if ( typeof selector !== "string" ) {
  7681. return this.pushStack( jQuery( selector ).filter( function() {
  7682. for ( i = 0; i < len; i++ ) {
  7683. if ( jQuery.contains( self[ i ], this ) ) {
  7684. return true;
  7685. }
  7686. }
  7687. } ) );
  7688. }
  7689. ret = this.pushStack( [] );
  7690. for ( i = 0; i < len; i++ ) {
  7691. jQuery.find( selector, self[ i ], ret );
  7692. }
  7693. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  7694. },
  7695. filter: function( selector ) {
  7696. return this.pushStack( winnow( this, selector || [], false ) );
  7697. },
  7698. not: function( selector ) {
  7699. return this.pushStack( winnow( this, selector || [], true ) );
  7700. },
  7701. is: function( selector ) {
  7702. return !!winnow(
  7703. this,
  7704. // If this is a positional/relative selector, check membership in the returned set
  7705. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  7706. typeof selector === "string" && rneedsContext.test( selector ) ?
  7707. jQuery( selector ) :
  7708. selector || [],
  7709. false
  7710. ).length;
  7711. }
  7712. } );
  7713. // Initialize a jQuery object
  7714. // A central reference to the root jQuery(document)
  7715. var rootjQuery,
  7716. // A simple way to check for HTML strings
  7717. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  7718. // Strict HTML recognition (#11290: must start with <)
  7719. // Shortcut simple #id case for speed
  7720. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  7721. init = jQuery.fn.init = function( selector, context, root ) {
  7722. var match, elem;
  7723. // HANDLE: $(""), $(null), $(undefined), $(false)
  7724. if ( !selector ) {
  7725. return this;
  7726. }
  7727. // Method init() accepts an alternate rootjQuery
  7728. // so migrate can support jQuery.sub (gh-2101)
  7729. root = root || rootjQuery;
  7730. // Handle HTML strings
  7731. if ( typeof selector === "string" ) {
  7732. if ( selector[ 0 ] === "<" &&
  7733. selector[ selector.length - 1 ] === ">" &&
  7734. selector.length >= 3 ) {
  7735. // Assume that strings that start and end with <> are HTML and skip the regex check
  7736. match = [ null, selector, null ];
  7737. } else {
  7738. match = rquickExpr.exec( selector );
  7739. }
  7740. // Match html or make sure no context is specified for #id
  7741. if ( match && ( match[ 1 ] || !context ) ) {
  7742. // HANDLE: $(html) -> $(array)
  7743. if ( match[ 1 ] ) {
  7744. context = context instanceof jQuery ? context[ 0 ] : context;
  7745. // Option to run scripts is true for back-compat
  7746. // Intentionally let the error be thrown if parseHTML is not present
  7747. jQuery.merge( this, jQuery.parseHTML(
  7748. match[ 1 ],
  7749. context && context.nodeType ? context.ownerDocument || context : document,
  7750. true
  7751. ) );
  7752. // HANDLE: $(html, props)
  7753. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  7754. for ( match in context ) {
  7755. // Properties of context are called as methods if possible
  7756. if ( isFunction( this[ match ] ) ) {
  7757. this[ match ]( context[ match ] );
  7758. // ...and otherwise set as attributes
  7759. } else {
  7760. this.attr( match, context[ match ] );
  7761. }
  7762. }
  7763. }
  7764. return this;
  7765. // HANDLE: $(#id)
  7766. } else {
  7767. elem = document.getElementById( match[ 2 ] );
  7768. if ( elem ) {
  7769. // Inject the element directly into the jQuery object
  7770. this[ 0 ] = elem;
  7771. this.length = 1;
  7772. }
  7773. return this;
  7774. }
  7775. // HANDLE: $(expr, $(...))
  7776. } else if ( !context || context.jquery ) {
  7777. return ( context || root ).find( selector );
  7778. // HANDLE: $(expr, context)
  7779. // (which is just equivalent to: $(context).find(expr)
  7780. } else {
  7781. return this.constructor( context ).find( selector );
  7782. }
  7783. // HANDLE: $(DOMElement)
  7784. } else if ( selector.nodeType ) {
  7785. this[ 0 ] = selector;
  7786. this.length = 1;
  7787. return this;
  7788. // HANDLE: $(function)
  7789. // Shortcut for document ready
  7790. } else if ( isFunction( selector ) ) {
  7791. return root.ready !== undefined ?
  7792. root.ready( selector ) :
  7793. // Execute immediately if ready is not present
  7794. selector( jQuery );
  7795. }
  7796. return jQuery.makeArray( selector, this );
  7797. };
  7798. // Give the init function the jQuery prototype for later instantiation
  7799. init.prototype = jQuery.fn;
  7800. // Initialize central reference
  7801. rootjQuery = jQuery( document );
  7802. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  7803. // Methods guaranteed to produce a unique set when starting from a unique set
  7804. guaranteedUnique = {
  7805. children: true,
  7806. contents: true,
  7807. next: true,
  7808. prev: true
  7809. };
  7810. jQuery.fn.extend( {
  7811. has: function( target ) {
  7812. var targets = jQuery( target, this ),
  7813. l = targets.length;
  7814. return this.filter( function() {
  7815. var i = 0;
  7816. for ( ; i < l; i++ ) {
  7817. if ( jQuery.contains( this, targets[ i ] ) ) {
  7818. return true;
  7819. }
  7820. }
  7821. } );
  7822. },
  7823. closest: function( selectors, context ) {
  7824. var cur,
  7825. i = 0,
  7826. l = this.length,
  7827. matched = [],
  7828. targets = typeof selectors !== "string" && jQuery( selectors );
  7829. // Positional selectors never match, since there's no _selection_ context
  7830. if ( !rneedsContext.test( selectors ) ) {
  7831. for ( ; i < l; i++ ) {
  7832. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  7833. // Always skip document fragments
  7834. if ( cur.nodeType < 11 && ( targets ?
  7835. targets.index( cur ) > -1 :
  7836. // Don't pass non-elements to Sizzle
  7837. cur.nodeType === 1 &&
  7838. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  7839. matched.push( cur );
  7840. break;
  7841. }
  7842. }
  7843. }
  7844. }
  7845. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  7846. },
  7847. // Determine the position of an element within the set
  7848. index: function( elem ) {
  7849. // No argument, return index in parent
  7850. if ( !elem ) {
  7851. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  7852. }
  7853. // Index in selector
  7854. if ( typeof elem === "string" ) {
  7855. return indexOf.call( jQuery( elem ), this[ 0 ] );
  7856. }
  7857. // Locate the position of the desired element
  7858. return indexOf.call( this,
  7859. // If it receives a jQuery object, the first element is used
  7860. elem.jquery ? elem[ 0 ] : elem
  7861. );
  7862. },
  7863. add: function( selector, context ) {
  7864. return this.pushStack(
  7865. jQuery.uniqueSort(
  7866. jQuery.merge( this.get(), jQuery( selector, context ) )
  7867. )
  7868. );
  7869. },
  7870. addBack: function( selector ) {
  7871. return this.add( selector == null ?
  7872. this.prevObject : this.prevObject.filter( selector )
  7873. );
  7874. }
  7875. } );
  7876. function sibling( cur, dir ) {
  7877. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  7878. return cur;
  7879. }
  7880. jQuery.each( {
  7881. parent: function( elem ) {
  7882. var parent = elem.parentNode;
  7883. return parent && parent.nodeType !== 11 ? parent : null;
  7884. },
  7885. parents: function( elem ) {
  7886. return dir( elem, "parentNode" );
  7887. },
  7888. parentsUntil: function( elem, i, until ) {
  7889. return dir( elem, "parentNode", until );
  7890. },
  7891. next: function( elem ) {
  7892. return sibling( elem, "nextSibling" );
  7893. },
  7894. prev: function( elem ) {
  7895. return sibling( elem, "previousSibling" );
  7896. },
  7897. nextAll: function( elem ) {
  7898. return dir( elem, "nextSibling" );
  7899. },
  7900. prevAll: function( elem ) {
  7901. return dir( elem, "previousSibling" );
  7902. },
  7903. nextUntil: function( elem, i, until ) {
  7904. return dir( elem, "nextSibling", until );
  7905. },
  7906. prevUntil: function( elem, i, until ) {
  7907. return dir( elem, "previousSibling", until );
  7908. },
  7909. siblings: function( elem ) {
  7910. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  7911. },
  7912. children: function( elem ) {
  7913. return siblings( elem.firstChild );
  7914. },
  7915. contents: function( elem ) {
  7916. if ( typeof elem.contentDocument !== "undefined" ) {
  7917. return elem.contentDocument;
  7918. }
  7919. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  7920. // Treat the template element as a regular one in browsers that
  7921. // don't support it.
  7922. if ( nodeName( elem, "template" ) ) {
  7923. elem = elem.content || elem;
  7924. }
  7925. return jQuery.merge( [], elem.childNodes );
  7926. }
  7927. }, function( name, fn ) {
  7928. jQuery.fn[ name ] = function( until, selector ) {
  7929. var matched = jQuery.map( this, fn, until );
  7930. if ( name.slice( -5 ) !== "Until" ) {
  7931. selector = until;
  7932. }
  7933. if ( selector && typeof selector === "string" ) {
  7934. matched = jQuery.filter( selector, matched );
  7935. }
  7936. if ( this.length > 1 ) {
  7937. // Remove duplicates
  7938. if ( !guaranteedUnique[ name ] ) {
  7939. jQuery.uniqueSort( matched );
  7940. }
  7941. // Reverse order for parents* and prev-derivatives
  7942. if ( rparentsprev.test( name ) ) {
  7943. matched.reverse();
  7944. }
  7945. }
  7946. return this.pushStack( matched );
  7947. };
  7948. } );
  7949. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  7950. // Convert String-formatted options into Object-formatted ones
  7951. function createOptions( options ) {
  7952. var object = {};
  7953. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  7954. object[ flag ] = true;
  7955. } );
  7956. return object;
  7957. }
  7958. /*
  7959. * Create a callback list using the following parameters:
  7960. *
  7961. * options: an optional list of space-separated options that will change how
  7962. * the callback list behaves or a more traditional option object
  7963. *
  7964. * By default a callback list will act like an event callback list and can be
  7965. * "fired" multiple times.
  7966. *
  7967. * Possible options:
  7968. *
  7969. * once: will ensure the callback list can only be fired once (like a Deferred)
  7970. *
  7971. * memory: will keep track of previous values and will call any callback added
  7972. * after the list has been fired right away with the latest "memorized"
  7973. * values (like a Deferred)
  7974. *
  7975. * unique: will ensure a callback can only be added once (no duplicate in the list)
  7976. *
  7977. * stopOnFalse: interrupt callings when a callback returns false
  7978. *
  7979. */
  7980. jQuery.Callbacks = function( options ) {
  7981. // Convert options from String-formatted to Object-formatted if needed
  7982. // (we check in cache first)
  7983. options = typeof options === "string" ?
  7984. createOptions( options ) :
  7985. jQuery.extend( {}, options );
  7986. var // Flag to know if list is currently firing
  7987. firing,
  7988. // Last fire value for non-forgettable lists
  7989. memory,
  7990. // Flag to know if list was already fired
  7991. fired,
  7992. // Flag to prevent firing
  7993. locked,
  7994. // Actual callback list
  7995. list = [],
  7996. // Queue of execution data for repeatable lists
  7997. queue = [],
  7998. // Index of currently firing callback (modified by add/remove as needed)
  7999. firingIndex = -1,
  8000. // Fire callbacks
  8001. fire = function() {
  8002. // Enforce single-firing
  8003. locked = locked || options.once;
  8004. // Execute callbacks for all pending executions,
  8005. // respecting firingIndex overrides and runtime changes
  8006. fired = firing = true;
  8007. for ( ; queue.length; firingIndex = -1 ) {
  8008. memory = queue.shift();
  8009. while ( ++firingIndex < list.length ) {
  8010. // Run callback and check for early termination
  8011. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  8012. options.stopOnFalse ) {
  8013. // Jump to end and forget the data so .add doesn't re-fire
  8014. firingIndex = list.length;
  8015. memory = false;
  8016. }
  8017. }
  8018. }
  8019. // Forget the data if we're done with it
  8020. if ( !options.memory ) {
  8021. memory = false;
  8022. }
  8023. firing = false;
  8024. // Clean up if we're done firing for good
  8025. if ( locked ) {
  8026. // Keep an empty list if we have data for future add calls
  8027. if ( memory ) {
  8028. list = [];
  8029. // Otherwise, this object is spent
  8030. } else {
  8031. list = "";
  8032. }
  8033. }
  8034. },
  8035. // Actual Callbacks object
  8036. self = {
  8037. // Add a callback or a collection of callbacks to the list
  8038. add: function() {
  8039. if ( list ) {
  8040. // If we have memory from a past run, we should fire after adding
  8041. if ( memory && !firing ) {
  8042. firingIndex = list.length - 1;
  8043. queue.push( memory );
  8044. }
  8045. ( function add( args ) {
  8046. jQuery.each( args, function( _, arg ) {
  8047. if ( isFunction( arg ) ) {
  8048. if ( !options.unique || !self.has( arg ) ) {
  8049. list.push( arg );
  8050. }
  8051. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  8052. // Inspect recursively
  8053. add( arg );
  8054. }
  8055. } );
  8056. } )( arguments );
  8057. if ( memory && !firing ) {
  8058. fire();
  8059. }
  8060. }
  8061. return this;
  8062. },
  8063. // Remove a callback from the list
  8064. remove: function() {
  8065. jQuery.each( arguments, function( _, arg ) {
  8066. var index;
  8067. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  8068. list.splice( index, 1 );
  8069. // Handle firing indexes
  8070. if ( index <= firingIndex ) {
  8071. firingIndex--;
  8072. }
  8073. }
  8074. } );
  8075. return this;
  8076. },
  8077. // Check if a given callback is in the list.
  8078. // If no argument is given, return whether or not list has callbacks attached.
  8079. has: function( fn ) {
  8080. return fn ?
  8081. jQuery.inArray( fn, list ) > -1 :
  8082. list.length > 0;
  8083. },
  8084. // Remove all callbacks from the list
  8085. empty: function() {
  8086. if ( list ) {
  8087. list = [];
  8088. }
  8089. return this;
  8090. },
  8091. // Disable .fire and .add
  8092. // Abort any current/pending executions
  8093. // Clear all callbacks and values
  8094. disable: function() {
  8095. locked = queue = [];
  8096. list = memory = "";
  8097. return this;
  8098. },
  8099. disabled: function() {
  8100. return !list;
  8101. },
  8102. // Disable .fire
  8103. // Also disable .add unless we have memory (since it would have no effect)
  8104. // Abort any pending executions
  8105. lock: function() {
  8106. locked = queue = [];
  8107. if ( !memory && !firing ) {
  8108. list = memory = "";
  8109. }
  8110. return this;
  8111. },
  8112. locked: function() {
  8113. return !!locked;
  8114. },
  8115. // Call all callbacks with the given context and arguments
  8116. fireWith: function( context, args ) {
  8117. if ( !locked ) {
  8118. args = args || [];
  8119. args = [ context, args.slice ? args.slice() : args ];
  8120. queue.push( args );
  8121. if ( !firing ) {
  8122. fire();
  8123. }
  8124. }
  8125. return this;
  8126. },
  8127. // Call all the callbacks with the given arguments
  8128. fire: function() {
  8129. self.fireWith( this, arguments );
  8130. return this;
  8131. },
  8132. // To know if the callbacks have already been called at least once
  8133. fired: function() {
  8134. return !!fired;
  8135. }
  8136. };
  8137. return self;
  8138. };
  8139. function Identity( v ) {
  8140. return v;
  8141. }
  8142. function Thrower( ex ) {
  8143. throw ex;
  8144. }
  8145. function adoptValue( value, resolve, reject, noValue ) {
  8146. var method;
  8147. try {
  8148. // Check for promise aspect first to privilege synchronous behavior
  8149. if ( value && isFunction( ( method = value.promise ) ) ) {
  8150. method.call( value ).done( resolve ).fail( reject );
  8151. // Other thenables
  8152. } else if ( value && isFunction( ( method = value.then ) ) ) {
  8153. method.call( value, resolve, reject );
  8154. // Other non-thenables
  8155. } else {
  8156. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  8157. // * false: [ value ].slice( 0 ) => resolve( value )
  8158. // * true: [ value ].slice( 1 ) => resolve()
  8159. resolve.apply( undefined, [ value ].slice( noValue ) );
  8160. }
  8161. // For Promises/A+, convert exceptions into rejections
  8162. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  8163. // Deferred#then to conditionally suppress rejection.
  8164. } catch ( value ) {
  8165. // Support: Android 4.0 only
  8166. // Strict mode functions invoked without .call/.apply get global-object context
  8167. reject.apply( undefined, [ value ] );
  8168. }
  8169. }
  8170. jQuery.extend( {
  8171. Deferred: function( func ) {
  8172. var tuples = [
  8173. // action, add listener, callbacks,
  8174. // ... .then handlers, argument index, [final state]
  8175. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  8176. jQuery.Callbacks( "memory" ), 2 ],
  8177. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  8178. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  8179. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  8180. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  8181. ],
  8182. state = "pending",
  8183. promise = {
  8184. state: function() {
  8185. return state;
  8186. },
  8187. always: function() {
  8188. deferred.done( arguments ).fail( arguments );
  8189. return this;
  8190. },
  8191. "catch": function( fn ) {
  8192. return promise.then( null, fn );
  8193. },
  8194. // Keep pipe for back-compat
  8195. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  8196. var fns = arguments;
  8197. return jQuery.Deferred( function( newDefer ) {
  8198. jQuery.each( tuples, function( i, tuple ) {
  8199. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  8200. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  8201. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  8202. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  8203. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  8204. deferred[ tuple[ 1 ] ]( function() {
  8205. var returned = fn && fn.apply( this, arguments );
  8206. if ( returned && isFunction( returned.promise ) ) {
  8207. returned.promise()
  8208. .progress( newDefer.notify )
  8209. .done( newDefer.resolve )
  8210. .fail( newDefer.reject );
  8211. } else {
  8212. newDefer[ tuple[ 0 ] + "With" ](
  8213. this,
  8214. fn ? [ returned ] : arguments
  8215. );
  8216. }
  8217. } );
  8218. } );
  8219. fns = null;
  8220. } ).promise();
  8221. },
  8222. then: function( onFulfilled, onRejected, onProgress ) {
  8223. var maxDepth = 0;
  8224. function resolve( depth, deferred, handler, special ) {
  8225. return function() {
  8226. var that = this,
  8227. args = arguments,
  8228. mightThrow = function() {
  8229. var returned, then;
  8230. // Support: Promises/A+ section 2.3.3.3.3
  8231. // https://promisesaplus.com/#point-59
  8232. // Ignore double-resolution attempts
  8233. if ( depth < maxDepth ) {
  8234. return;
  8235. }
  8236. returned = handler.apply( that, args );
  8237. // Support: Promises/A+ section 2.3.1
  8238. // https://promisesaplus.com/#point-48
  8239. if ( returned === deferred.promise() ) {
  8240. throw new TypeError( "Thenable self-resolution" );
  8241. }
  8242. // Support: Promises/A+ sections 2.3.3.1, 3.5
  8243. // https://promisesaplus.com/#point-54
  8244. // https://promisesaplus.com/#point-75
  8245. // Retrieve `then` only once
  8246. then = returned &&
  8247. // Support: Promises/A+ section 2.3.4
  8248. // https://promisesaplus.com/#point-64
  8249. // Only check objects and functions for thenability
  8250. ( typeof returned === "object" ||
  8251. typeof returned === "function" ) &&
  8252. returned.then;
  8253. // Handle a returned thenable
  8254. if ( isFunction( then ) ) {
  8255. // Special processors (notify) just wait for resolution
  8256. if ( special ) {
  8257. then.call(
  8258. returned,
  8259. resolve( maxDepth, deferred, Identity, special ),
  8260. resolve( maxDepth, deferred, Thrower, special )
  8261. );
  8262. // Normal processors (resolve) also hook into progress
  8263. } else {
  8264. // ...and disregard older resolution values
  8265. maxDepth++;
  8266. then.call(
  8267. returned,
  8268. resolve( maxDepth, deferred, Identity, special ),
  8269. resolve( maxDepth, deferred, Thrower, special ),
  8270. resolve( maxDepth, deferred, Identity,
  8271. deferred.notifyWith )
  8272. );
  8273. }
  8274. // Handle all other returned values
  8275. } else {
  8276. // Only substitute handlers pass on context
  8277. // and multiple values (non-spec behavior)
  8278. if ( handler !== Identity ) {
  8279. that = undefined;
  8280. args = [ returned ];
  8281. }
  8282. // Process the value(s)
  8283. // Default process is resolve
  8284. ( special || deferred.resolveWith )( that, args );
  8285. }
  8286. },
  8287. // Only normal processors (resolve) catch and reject exceptions
  8288. process = special ?
  8289. mightThrow :
  8290. function() {
  8291. try {
  8292. mightThrow();
  8293. } catch ( e ) {
  8294. if ( jQuery.Deferred.exceptionHook ) {
  8295. jQuery.Deferred.exceptionHook( e,
  8296. process.stackTrace );
  8297. }
  8298. // Support: Promises/A+ section 2.3.3.3.4.1
  8299. // https://promisesaplus.com/#point-61
  8300. // Ignore post-resolution exceptions
  8301. if ( depth + 1 >= maxDepth ) {
  8302. // Only substitute handlers pass on context
  8303. // and multiple values (non-spec behavior)
  8304. if ( handler !== Thrower ) {
  8305. that = undefined;
  8306. args = [ e ];
  8307. }
  8308. deferred.rejectWith( that, args );
  8309. }
  8310. }
  8311. };
  8312. // Support: Promises/A+ section 2.3.3.3.1
  8313. // https://promisesaplus.com/#point-57
  8314. // Re-resolve promises immediately to dodge false rejection from
  8315. // subsequent errors
  8316. if ( depth ) {
  8317. process();
  8318. } else {
  8319. // Call an optional hook to record the stack, in case of exception
  8320. // since it's otherwise lost when execution goes async
  8321. if ( jQuery.Deferred.getStackHook ) {
  8322. process.stackTrace = jQuery.Deferred.getStackHook();
  8323. }
  8324. window.setTimeout( process );
  8325. }
  8326. };
  8327. }
  8328. return jQuery.Deferred( function( newDefer ) {
  8329. // progress_handlers.add( ... )
  8330. tuples[ 0 ][ 3 ].add(
  8331. resolve(
  8332. 0,
  8333. newDefer,
  8334. isFunction( onProgress ) ?
  8335. onProgress :
  8336. Identity,
  8337. newDefer.notifyWith
  8338. )
  8339. );
  8340. // fulfilled_handlers.add( ... )
  8341. tuples[ 1 ][ 3 ].add(
  8342. resolve(
  8343. 0,
  8344. newDefer,
  8345. isFunction( onFulfilled ) ?
  8346. onFulfilled :
  8347. Identity
  8348. )
  8349. );
  8350. // rejected_handlers.add( ... )
  8351. tuples[ 2 ][ 3 ].add(
  8352. resolve(
  8353. 0,
  8354. newDefer,
  8355. isFunction( onRejected ) ?
  8356. onRejected :
  8357. Thrower
  8358. )
  8359. );
  8360. } ).promise();
  8361. },
  8362. // Get a promise for this deferred
  8363. // If obj is provided, the promise aspect is added to the object
  8364. promise: function( obj ) {
  8365. return obj != null ? jQuery.extend( obj, promise ) : promise;
  8366. }
  8367. },
  8368. deferred = {};
  8369. // Add list-specific methods
  8370. jQuery.each( tuples, function( i, tuple ) {
  8371. var list = tuple[ 2 ],
  8372. stateString = tuple[ 5 ];
  8373. // promise.progress = list.add
  8374. // promise.done = list.add
  8375. // promise.fail = list.add
  8376. promise[ tuple[ 1 ] ] = list.add;
  8377. // Handle state
  8378. if ( stateString ) {
  8379. list.add(
  8380. function() {
  8381. // state = "resolved" (i.e., fulfilled)
  8382. // state = "rejected"
  8383. state = stateString;
  8384. },
  8385. // rejected_callbacks.disable
  8386. // fulfilled_callbacks.disable
  8387. tuples[ 3 - i ][ 2 ].disable,
  8388. // rejected_handlers.disable
  8389. // fulfilled_handlers.disable
  8390. tuples[ 3 - i ][ 3 ].disable,
  8391. // progress_callbacks.lock
  8392. tuples[ 0 ][ 2 ].lock,
  8393. // progress_handlers.lock
  8394. tuples[ 0 ][ 3 ].lock
  8395. );
  8396. }
  8397. // progress_handlers.fire
  8398. // fulfilled_handlers.fire
  8399. // rejected_handlers.fire
  8400. list.add( tuple[ 3 ].fire );
  8401. // deferred.notify = function() { deferred.notifyWith(...) }
  8402. // deferred.resolve = function() { deferred.resolveWith(...) }
  8403. // deferred.reject = function() { deferred.rejectWith(...) }
  8404. deferred[ tuple[ 0 ] ] = function() {
  8405. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  8406. return this;
  8407. };
  8408. // deferred.notifyWith = list.fireWith
  8409. // deferred.resolveWith = list.fireWith
  8410. // deferred.rejectWith = list.fireWith
  8411. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  8412. } );
  8413. // Make the deferred a promise
  8414. promise.promise( deferred );
  8415. // Call given func if any
  8416. if ( func ) {
  8417. func.call( deferred, deferred );
  8418. }
  8419. // All done!
  8420. return deferred;
  8421. },
  8422. // Deferred helper
  8423. when: function( singleValue ) {
  8424. var
  8425. // count of uncompleted subordinates
  8426. remaining = arguments.length,
  8427. // count of unprocessed arguments
  8428. i = remaining,
  8429. // subordinate fulfillment data
  8430. resolveContexts = Array( i ),
  8431. resolveValues = slice.call( arguments ),
  8432. // the master Deferred
  8433. master = jQuery.Deferred(),
  8434. // subordinate callback factory
  8435. updateFunc = function( i ) {
  8436. return function( value ) {
  8437. resolveContexts[ i ] = this;
  8438. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  8439. if ( !( --remaining ) ) {
  8440. master.resolveWith( resolveContexts, resolveValues );
  8441. }
  8442. };
  8443. };
  8444. // Single- and empty arguments are adopted like Promise.resolve
  8445. if ( remaining <= 1 ) {
  8446. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  8447. !remaining );
  8448. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  8449. if ( master.state() === "pending" ||
  8450. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  8451. return master.then();
  8452. }
  8453. }
  8454. // Multiple arguments are aggregated like Promise.all array elements
  8455. while ( i-- ) {
  8456. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  8457. }
  8458. return master.promise();
  8459. }
  8460. } );
  8461. // These usually indicate a programmer mistake during development,
  8462. // warn about them ASAP rather than swallowing them by default.
  8463. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  8464. jQuery.Deferred.exceptionHook = function( error, stack ) {
  8465. // Support: IE 8 - 9 only
  8466. // Console exists when dev tools are open, which can happen at any time
  8467. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  8468. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  8469. }
  8470. };
  8471. jQuery.readyException = function( error ) {
  8472. window.setTimeout( function() {
  8473. throw error;
  8474. } );
  8475. };
  8476. // The deferred used on DOM ready
  8477. var readyList = jQuery.Deferred();
  8478. jQuery.fn.ready = function( fn ) {
  8479. readyList
  8480. .then( fn )
  8481. // Wrap jQuery.readyException in a function so that the lookup
  8482. // happens at the time of error handling instead of callback
  8483. // registration.
  8484. .catch( function( error ) {
  8485. jQuery.readyException( error );
  8486. } );
  8487. return this;
  8488. };
  8489. jQuery.extend( {
  8490. // Is the DOM ready to be used? Set to true once it occurs.
  8491. isReady: false,
  8492. // A counter to track how many items to wait for before
  8493. // the ready event fires. See #6781
  8494. readyWait: 1,
  8495. // Handle when the DOM is ready
  8496. ready: function( wait ) {
  8497. // Abort if there are pending holds or we're already ready
  8498. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  8499. return;
  8500. }
  8501. // Remember that the DOM is ready
  8502. jQuery.isReady = true;
  8503. // If a normal DOM Ready event fired, decrement, and wait if need be
  8504. if ( wait !== true && --jQuery.readyWait > 0 ) {
  8505. return;
  8506. }
  8507. // If there are functions bound, to execute
  8508. readyList.resolveWith( document, [ jQuery ] );
  8509. }
  8510. } );
  8511. jQuery.ready.then = readyList.then;
  8512. // The ready event handler and self cleanup method
  8513. function completed() {
  8514. document.removeEventListener( "DOMContentLoaded", completed );
  8515. window.removeEventListener( "load", completed );
  8516. jQuery.ready();
  8517. }
  8518. // Catch cases where $(document).ready() is called
  8519. // after the browser event has already occurred.
  8520. // Support: IE <=9 - 10 only
  8521. // Older IE sometimes signals "interactive" too soon
  8522. if ( document.readyState === "complete" ||
  8523. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  8524. // Handle it asynchronously to allow scripts the opportunity to delay ready
  8525. window.setTimeout( jQuery.ready );
  8526. } else {
  8527. // Use the handy event callback
  8528. document.addEventListener( "DOMContentLoaded", completed );
  8529. // A fallback to window.onload, that will always work
  8530. window.addEventListener( "load", completed );
  8531. }
  8532. // Multifunctional method to get and set values of a collection
  8533. // The value/s can optionally be executed if it's a function
  8534. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  8535. var i = 0,
  8536. len = elems.length,
  8537. bulk = key == null;
  8538. // Sets many values
  8539. if ( toType( key ) === "object" ) {
  8540. chainable = true;
  8541. for ( i in key ) {
  8542. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  8543. }
  8544. // Sets one value
  8545. } else if ( value !== undefined ) {
  8546. chainable = true;
  8547. if ( !isFunction( value ) ) {
  8548. raw = true;
  8549. }
  8550. if ( bulk ) {
  8551. // Bulk operations run against the entire set
  8552. if ( raw ) {
  8553. fn.call( elems, value );
  8554. fn = null;
  8555. // ...except when executing function values
  8556. } else {
  8557. bulk = fn;
  8558. fn = function( elem, key, value ) {
  8559. return bulk.call( jQuery( elem ), value );
  8560. };
  8561. }
  8562. }
  8563. if ( fn ) {
  8564. for ( ; i < len; i++ ) {
  8565. fn(
  8566. elems[ i ], key, raw ?
  8567. value :
  8568. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  8569. );
  8570. }
  8571. }
  8572. }
  8573. if ( chainable ) {
  8574. return elems;
  8575. }
  8576. // Gets
  8577. if ( bulk ) {
  8578. return fn.call( elems );
  8579. }
  8580. return len ? fn( elems[ 0 ], key ) : emptyGet;
  8581. };
  8582. // Matches dashed string for camelizing
  8583. var rmsPrefix = /^-ms-/,
  8584. rdashAlpha = /-([a-z])/g;
  8585. // Used by camelCase as callback to replace()
  8586. function fcamelCase( all, letter ) {
  8587. return letter.toUpperCase();
  8588. }
  8589. // Convert dashed to camelCase; used by the css and data modules
  8590. // Support: IE <=9 - 11, Edge 12 - 15
  8591. // Microsoft forgot to hump their vendor prefix (#9572)
  8592. function camelCase( string ) {
  8593. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  8594. }
  8595. var acceptData = function( owner ) {
  8596. // Accepts only:
  8597. // - Node
  8598. // - Node.ELEMENT_NODE
  8599. // - Node.DOCUMENT_NODE
  8600. // - Object
  8601. // - Any
  8602. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  8603. };
  8604. function Data() {
  8605. this.expando = jQuery.expando + Data.uid++;
  8606. }
  8607. Data.uid = 1;
  8608. Data.prototype = {
  8609. cache: function( owner ) {
  8610. // Check if the owner object already has a cache
  8611. var value = owner[ this.expando ];
  8612. // If not, create one
  8613. if ( !value ) {
  8614. value = {};
  8615. // We can accept data for non-element nodes in modern browsers,
  8616. // but we should not, see #8335.
  8617. // Always return an empty object.
  8618. if ( acceptData( owner ) ) {
  8619. // If it is a node unlikely to be stringify-ed or looped over
  8620. // use plain assignment
  8621. if ( owner.nodeType ) {
  8622. owner[ this.expando ] = value;
  8623. // Otherwise secure it in a non-enumerable property
  8624. // configurable must be true to allow the property to be
  8625. // deleted when data is removed
  8626. } else {
  8627. Object.defineProperty( owner, this.expando, {
  8628. value: value,
  8629. configurable: true
  8630. } );
  8631. }
  8632. }
  8633. }
  8634. return value;
  8635. },
  8636. set: function( owner, data, value ) {
  8637. var prop,
  8638. cache = this.cache( owner );
  8639. // Handle: [ owner, key, value ] args
  8640. // Always use camelCase key (gh-2257)
  8641. if ( typeof data === "string" ) {
  8642. cache[ camelCase( data ) ] = value;
  8643. // Handle: [ owner, { properties } ] args
  8644. } else {
  8645. // Copy the properties one-by-one to the cache object
  8646. for ( prop in data ) {
  8647. cache[ camelCase( prop ) ] = data[ prop ];
  8648. }
  8649. }
  8650. return cache;
  8651. },
  8652. get: function( owner, key ) {
  8653. return key === undefined ?
  8654. this.cache( owner ) :
  8655. // Always use camelCase key (gh-2257)
  8656. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  8657. },
  8658. access: function( owner, key, value ) {
  8659. // In cases where either:
  8660. //
  8661. // 1. No key was specified
  8662. // 2. A string key was specified, but no value provided
  8663. //
  8664. // Take the "read" path and allow the get method to determine
  8665. // which value to return, respectively either:
  8666. //
  8667. // 1. The entire cache object
  8668. // 2. The data stored at the key
  8669. //
  8670. if ( key === undefined ||
  8671. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  8672. return this.get( owner, key );
  8673. }
  8674. // When the key is not a string, or both a key and value
  8675. // are specified, set or extend (existing objects) with either:
  8676. //
  8677. // 1. An object of properties
  8678. // 2. A key and value
  8679. //
  8680. this.set( owner, key, value );
  8681. // Since the "set" path can have two possible entry points
  8682. // return the expected data based on which path was taken[*]
  8683. return value !== undefined ? value : key;
  8684. },
  8685. remove: function( owner, key ) {
  8686. var i,
  8687. cache = owner[ this.expando ];
  8688. if ( cache === undefined ) {
  8689. return;
  8690. }
  8691. if ( key !== undefined ) {
  8692. // Support array or space separated string of keys
  8693. if ( Array.isArray( key ) ) {
  8694. // If key is an array of keys...
  8695. // We always set camelCase keys, so remove that.
  8696. key = key.map( camelCase );
  8697. } else {
  8698. key = camelCase( key );
  8699. // If a key with the spaces exists, use it.
  8700. // Otherwise, create an array by matching non-whitespace
  8701. key = key in cache ?
  8702. [ key ] :
  8703. ( key.match( rnothtmlwhite ) || [] );
  8704. }
  8705. i = key.length;
  8706. while ( i-- ) {
  8707. delete cache[ key[ i ] ];
  8708. }
  8709. }
  8710. // Remove the expando if there's no more data
  8711. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  8712. // Support: Chrome <=35 - 45
  8713. // Webkit & Blink performance suffers when deleting properties
  8714. // from DOM nodes, so set to undefined instead
  8715. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  8716. if ( owner.nodeType ) {
  8717. owner[ this.expando ] = undefined;
  8718. } else {
  8719. delete owner[ this.expando ];
  8720. }
  8721. }
  8722. },
  8723. hasData: function( owner ) {
  8724. var cache = owner[ this.expando ];
  8725. return cache !== undefined && !jQuery.isEmptyObject( cache );
  8726. }
  8727. };
  8728. var dataPriv = new Data();
  8729. var dataUser = new Data();
  8730. // Implementation Summary
  8731. //
  8732. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  8733. // 2. Improve the module's maintainability by reducing the storage
  8734. // paths to a single mechanism.
  8735. // 3. Use the same single mechanism to support "private" and "user" data.
  8736. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  8737. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  8738. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  8739. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  8740. rmultiDash = /[A-Z]/g;
  8741. function getData( data ) {
  8742. if ( data === "true" ) {
  8743. return true;
  8744. }
  8745. if ( data === "false" ) {
  8746. return false;
  8747. }
  8748. if ( data === "null" ) {
  8749. return null;
  8750. }
  8751. // Only convert to a number if it doesn't change the string
  8752. if ( data === +data + "" ) {
  8753. return +data;
  8754. }
  8755. if ( rbrace.test( data ) ) {
  8756. return JSON.parse( data );
  8757. }
  8758. return data;
  8759. }
  8760. function dataAttr( elem, key, data ) {
  8761. var name;
  8762. // If nothing was found internally, try to fetch any
  8763. // data from the HTML5 data-* attribute
  8764. if ( data === undefined && elem.nodeType === 1 ) {
  8765. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  8766. data = elem.getAttribute( name );
  8767. if ( typeof data === "string" ) {
  8768. try {
  8769. data = getData( data );
  8770. } catch ( e ) {}
  8771. // Make sure we set the data so it isn't changed later
  8772. dataUser.set( elem, key, data );
  8773. } else {
  8774. data = undefined;
  8775. }
  8776. }
  8777. return data;
  8778. }
  8779. jQuery.extend( {
  8780. hasData: function( elem ) {
  8781. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  8782. },
  8783. data: function( elem, name, data ) {
  8784. return dataUser.access( elem, name, data );
  8785. },
  8786. removeData: function( elem, name ) {
  8787. dataUser.remove( elem, name );
  8788. },
  8789. // TODO: Now that all calls to _data and _removeData have been replaced
  8790. // with direct calls to dataPriv methods, these can be deprecated.
  8791. _data: function( elem, name, data ) {
  8792. return dataPriv.access( elem, name, data );
  8793. },
  8794. _removeData: function( elem, name ) {
  8795. dataPriv.remove( elem, name );
  8796. }
  8797. } );
  8798. jQuery.fn.extend( {
  8799. data: function( key, value ) {
  8800. var i, name, data,
  8801. elem = this[ 0 ],
  8802. attrs = elem && elem.attributes;
  8803. // Gets all values
  8804. if ( key === undefined ) {
  8805. if ( this.length ) {
  8806. data = dataUser.get( elem );
  8807. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  8808. i = attrs.length;
  8809. while ( i-- ) {
  8810. // Support: IE 11 only
  8811. // The attrs elements can be null (#14894)
  8812. if ( attrs[ i ] ) {
  8813. name = attrs[ i ].name;
  8814. if ( name.indexOf( "data-" ) === 0 ) {
  8815. name = camelCase( name.slice( 5 ) );
  8816. dataAttr( elem, name, data[ name ] );
  8817. }
  8818. }
  8819. }
  8820. dataPriv.set( elem, "hasDataAttrs", true );
  8821. }
  8822. }
  8823. return data;
  8824. }
  8825. // Sets multiple values
  8826. if ( typeof key === "object" ) {
  8827. return this.each( function() {
  8828. dataUser.set( this, key );
  8829. } );
  8830. }
  8831. return access( this, function( value ) {
  8832. var data;
  8833. // The calling jQuery object (element matches) is not empty
  8834. // (and therefore has an element appears at this[ 0 ]) and the
  8835. // `value` parameter was not undefined. An empty jQuery object
  8836. // will result in `undefined` for elem = this[ 0 ] which will
  8837. // throw an exception if an attempt to read a data cache is made.
  8838. if ( elem && value === undefined ) {
  8839. // Attempt to get data from the cache
  8840. // The key will always be camelCased in Data
  8841. data = dataUser.get( elem, key );
  8842. if ( data !== undefined ) {
  8843. return data;
  8844. }
  8845. // Attempt to "discover" the data in
  8846. // HTML5 custom data-* attrs
  8847. data = dataAttr( elem, key );
  8848. if ( data !== undefined ) {
  8849. return data;
  8850. }
  8851. // We tried really hard, but the data doesn't exist.
  8852. return;
  8853. }
  8854. // Set the data...
  8855. this.each( function() {
  8856. // We always store the camelCased key
  8857. dataUser.set( this, key, value );
  8858. } );
  8859. }, null, value, arguments.length > 1, null, true );
  8860. },
  8861. removeData: function( key ) {
  8862. return this.each( function() {
  8863. dataUser.remove( this, key );
  8864. } );
  8865. }
  8866. } );
  8867. jQuery.extend( {
  8868. queue: function( elem, type, data ) {
  8869. var queue;
  8870. if ( elem ) {
  8871. type = ( type || "fx" ) + "queue";
  8872. queue = dataPriv.get( elem, type );
  8873. // Speed up dequeue by getting out quickly if this is just a lookup
  8874. if ( data ) {
  8875. if ( !queue || Array.isArray( data ) ) {
  8876. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  8877. } else {
  8878. queue.push( data );
  8879. }
  8880. }
  8881. return queue || [];
  8882. }
  8883. },
  8884. dequeue: function( elem, type ) {
  8885. type = type || "fx";
  8886. var queue = jQuery.queue( elem, type ),
  8887. startLength = queue.length,
  8888. fn = queue.shift(),
  8889. hooks = jQuery._queueHooks( elem, type ),
  8890. next = function() {
  8891. jQuery.dequeue( elem, type );
  8892. };
  8893. // If the fx queue is dequeued, always remove the progress sentinel
  8894. if ( fn === "inprogress" ) {
  8895. fn = queue.shift();
  8896. startLength--;
  8897. }
  8898. if ( fn ) {
  8899. // Add a progress sentinel to prevent the fx queue from being
  8900. // automatically dequeued
  8901. if ( type === "fx" ) {
  8902. queue.unshift( "inprogress" );
  8903. }
  8904. // Clear up the last queue stop function
  8905. delete hooks.stop;
  8906. fn.call( elem, next, hooks );
  8907. }
  8908. if ( !startLength && hooks ) {
  8909. hooks.empty.fire();
  8910. }
  8911. },
  8912. // Not public - generate a queueHooks object, or return the current one
  8913. _queueHooks: function( elem, type ) {
  8914. var key = type + "queueHooks";
  8915. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  8916. empty: jQuery.Callbacks( "once memory" ).add( function() {
  8917. dataPriv.remove( elem, [ type + "queue", key ] );
  8918. } )
  8919. } );
  8920. }
  8921. } );
  8922. jQuery.fn.extend( {
  8923. queue: function( type, data ) {
  8924. var setter = 2;
  8925. if ( typeof type !== "string" ) {
  8926. data = type;
  8927. type = "fx";
  8928. setter--;
  8929. }
  8930. if ( arguments.length < setter ) {
  8931. return jQuery.queue( this[ 0 ], type );
  8932. }
  8933. return data === undefined ?
  8934. this :
  8935. this.each( function() {
  8936. var queue = jQuery.queue( this, type, data );
  8937. // Ensure a hooks for this queue
  8938. jQuery._queueHooks( this, type );
  8939. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  8940. jQuery.dequeue( this, type );
  8941. }
  8942. } );
  8943. },
  8944. dequeue: function( type ) {
  8945. return this.each( function() {
  8946. jQuery.dequeue( this, type );
  8947. } );
  8948. },
  8949. clearQueue: function( type ) {
  8950. return this.queue( type || "fx", [] );
  8951. },
  8952. // Get a promise resolved when queues of a certain type
  8953. // are emptied (fx is the type by default)
  8954. promise: function( type, obj ) {
  8955. var tmp,
  8956. count = 1,
  8957. defer = jQuery.Deferred(),
  8958. elements = this,
  8959. i = this.length,
  8960. resolve = function() {
  8961. if ( !( --count ) ) {
  8962. defer.resolveWith( elements, [ elements ] );
  8963. }
  8964. };
  8965. if ( typeof type !== "string" ) {
  8966. obj = type;
  8967. type = undefined;
  8968. }
  8969. type = type || "fx";
  8970. while ( i-- ) {
  8971. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  8972. if ( tmp && tmp.empty ) {
  8973. count++;
  8974. tmp.empty.add( resolve );
  8975. }
  8976. }
  8977. resolve();
  8978. return defer.promise( obj );
  8979. }
  8980. } );
  8981. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  8982. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  8983. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  8984. var documentElement = document.documentElement;
  8985. var isAttached = function( elem ) {
  8986. return jQuery.contains( elem.ownerDocument, elem );
  8987. },
  8988. composed = { composed: true };
  8989. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  8990. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  8991. // Support: iOS 10.0-10.2 only
  8992. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  8993. // leading to errors. We need to check for `getRootNode`.
  8994. if ( documentElement.getRootNode ) {
  8995. isAttached = function( elem ) {
  8996. return jQuery.contains( elem.ownerDocument, elem ) ||
  8997. elem.getRootNode( composed ) === elem.ownerDocument;
  8998. };
  8999. }
  9000. var isHiddenWithinTree = function( elem, el ) {
  9001. // isHiddenWithinTree might be called from jQuery#filter function;
  9002. // in that case, element will be second argument
  9003. elem = el || elem;
  9004. // Inline style trumps all
  9005. return elem.style.display === "none" ||
  9006. elem.style.display === "" &&
  9007. // Otherwise, check computed style
  9008. // Support: Firefox <=43 - 45
  9009. // Disconnected elements can have computed display: none, so first confirm that elem is
  9010. // in the document.
  9011. isAttached( elem ) &&
  9012. jQuery.css( elem, "display" ) === "none";
  9013. };
  9014. var swap = function( elem, options, callback, args ) {
  9015. var ret, name,
  9016. old = {};
  9017. // Remember the old values, and insert the new ones
  9018. for ( name in options ) {
  9019. old[ name ] = elem.style[ name ];
  9020. elem.style[ name ] = options[ name ];
  9021. }
  9022. ret = callback.apply( elem, args || [] );
  9023. // Revert the old values
  9024. for ( name in options ) {
  9025. elem.style[ name ] = old[ name ];
  9026. }
  9027. return ret;
  9028. };
  9029. function adjustCSS( elem, prop, valueParts, tween ) {
  9030. var adjusted, scale,
  9031. maxIterations = 20,
  9032. currentValue = tween ?
  9033. function() {
  9034. return tween.cur();
  9035. } :
  9036. function() {
  9037. return jQuery.css( elem, prop, "" );
  9038. },
  9039. initial = currentValue(),
  9040. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  9041. // Starting value computation is required for potential unit mismatches
  9042. initialInUnit = elem.nodeType &&
  9043. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  9044. rcssNum.exec( jQuery.css( elem, prop ) );
  9045. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  9046. // Support: Firefox <=54
  9047. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  9048. initial = initial / 2;
  9049. // Trust units reported by jQuery.css
  9050. unit = unit || initialInUnit[ 3 ];
  9051. // Iteratively approximate from a nonzero starting point
  9052. initialInUnit = +initial || 1;
  9053. while ( maxIterations-- ) {
  9054. // Evaluate and update our best guess (doubling guesses that zero out).
  9055. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  9056. jQuery.style( elem, prop, initialInUnit + unit );
  9057. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  9058. maxIterations = 0;
  9059. }
  9060. initialInUnit = initialInUnit / scale;
  9061. }
  9062. initialInUnit = initialInUnit * 2;
  9063. jQuery.style( elem, prop, initialInUnit + unit );
  9064. // Make sure we update the tween properties later on
  9065. valueParts = valueParts || [];
  9066. }
  9067. if ( valueParts ) {
  9068. initialInUnit = +initialInUnit || +initial || 0;
  9069. // Apply relative offset (+=/-=) if specified
  9070. adjusted = valueParts[ 1 ] ?
  9071. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  9072. +valueParts[ 2 ];
  9073. if ( tween ) {
  9074. tween.unit = unit;
  9075. tween.start = initialInUnit;
  9076. tween.end = adjusted;
  9077. }
  9078. }
  9079. return adjusted;
  9080. }
  9081. var defaultDisplayMap = {};
  9082. function getDefaultDisplay( elem ) {
  9083. var temp,
  9084. doc = elem.ownerDocument,
  9085. nodeName = elem.nodeName,
  9086. display = defaultDisplayMap[ nodeName ];
  9087. if ( display ) {
  9088. return display;
  9089. }
  9090. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  9091. display = jQuery.css( temp, "display" );
  9092. temp.parentNode.removeChild( temp );
  9093. if ( display === "none" ) {
  9094. display = "block";
  9095. }
  9096. defaultDisplayMap[ nodeName ] = display;
  9097. return display;
  9098. }
  9099. function showHide( elements, show ) {
  9100. var display, elem,
  9101. values = [],
  9102. index = 0,
  9103. length = elements.length;
  9104. // Determine new display value for elements that need to change
  9105. for ( ; index < length; index++ ) {
  9106. elem = elements[ index ];
  9107. if ( !elem.style ) {
  9108. continue;
  9109. }
  9110. display = elem.style.display;
  9111. if ( show ) {
  9112. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  9113. // check is required in this first loop unless we have a nonempty display value (either
  9114. // inline or about-to-be-restored)
  9115. if ( display === "none" ) {
  9116. values[ index ] = dataPriv.get( elem, "display" ) || null;
  9117. if ( !values[ index ] ) {
  9118. elem.style.display = "";
  9119. }
  9120. }
  9121. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  9122. values[ index ] = getDefaultDisplay( elem );
  9123. }
  9124. } else {
  9125. if ( display !== "none" ) {
  9126. values[ index ] = "none";
  9127. // Remember what we're overwriting
  9128. dataPriv.set( elem, "display", display );
  9129. }
  9130. }
  9131. }
  9132. // Set the display of the elements in a second loop to avoid constant reflow
  9133. for ( index = 0; index < length; index++ ) {
  9134. if ( values[ index ] != null ) {
  9135. elements[ index ].style.display = values[ index ];
  9136. }
  9137. }
  9138. return elements;
  9139. }
  9140. jQuery.fn.extend( {
  9141. show: function() {
  9142. return showHide( this, true );
  9143. },
  9144. hide: function() {
  9145. return showHide( this );
  9146. },
  9147. toggle: function( state ) {
  9148. if ( typeof state === "boolean" ) {
  9149. return state ? this.show() : this.hide();
  9150. }
  9151. return this.each( function() {
  9152. if ( isHiddenWithinTree( this ) ) {
  9153. jQuery( this ).show();
  9154. } else {
  9155. jQuery( this ).hide();
  9156. }
  9157. } );
  9158. }
  9159. } );
  9160. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  9161. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  9162. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  9163. // We have to close these tags to support XHTML (#13200)
  9164. var wrapMap = {
  9165. // Support: IE <=9 only
  9166. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  9167. // XHTML parsers do not magically insert elements in the
  9168. // same way that tag soup parsers do. So we cannot shorten
  9169. // this by omitting <tbody> or other required elements.
  9170. thead: [ 1, "<table>", "</table>" ],
  9171. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  9172. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  9173. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  9174. _default: [ 0, "", "" ]
  9175. };
  9176. // Support: IE <=9 only
  9177. wrapMap.optgroup = wrapMap.option;
  9178. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  9179. wrapMap.th = wrapMap.td;
  9180. function getAll( context, tag ) {
  9181. // Support: IE <=9 - 11 only
  9182. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  9183. var ret;
  9184. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9185. ret = context.getElementsByTagName( tag || "*" );
  9186. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  9187. ret = context.querySelectorAll( tag || "*" );
  9188. } else {
  9189. ret = [];
  9190. }
  9191. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  9192. return jQuery.merge( [ context ], ret );
  9193. }
  9194. return ret;
  9195. }
  9196. // Mark scripts as having already been evaluated
  9197. function setGlobalEval( elems, refElements ) {
  9198. var i = 0,
  9199. l = elems.length;
  9200. for ( ; i < l; i++ ) {
  9201. dataPriv.set(
  9202. elems[ i ],
  9203. "globalEval",
  9204. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  9205. );
  9206. }
  9207. }
  9208. var rhtml = /<|&#?\w+;/;
  9209. function buildFragment( elems, context, scripts, selection, ignored ) {
  9210. var elem, tmp, tag, wrap, attached, j,
  9211. fragment = context.createDocumentFragment(),
  9212. nodes = [],
  9213. i = 0,
  9214. l = elems.length;
  9215. for ( ; i < l; i++ ) {
  9216. elem = elems[ i ];
  9217. if ( elem || elem === 0 ) {
  9218. // Add nodes directly
  9219. if ( toType( elem ) === "object" ) {
  9220. // Support: Android <=4.0 only, PhantomJS 1 only
  9221. // push.apply(_, arraylike) throws on ancient WebKit
  9222. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  9223. // Convert non-html into a text node
  9224. } else if ( !rhtml.test( elem ) ) {
  9225. nodes.push( context.createTextNode( elem ) );
  9226. // Convert html into DOM nodes
  9227. } else {
  9228. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  9229. // Deserialize a standard representation
  9230. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  9231. wrap = wrapMap[ tag ] || wrapMap._default;
  9232. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  9233. // Descend through wrappers to the right content
  9234. j = wrap[ 0 ];
  9235. while ( j-- ) {
  9236. tmp = tmp.lastChild;
  9237. }
  9238. // Support: Android <=4.0 only, PhantomJS 1 only
  9239. // push.apply(_, arraylike) throws on ancient WebKit
  9240. jQuery.merge( nodes, tmp.childNodes );
  9241. // Remember the top-level container
  9242. tmp = fragment.firstChild;
  9243. // Ensure the created nodes are orphaned (#12392)
  9244. tmp.textContent = "";
  9245. }
  9246. }
  9247. }
  9248. // Remove wrapper from fragment
  9249. fragment.textContent = "";
  9250. i = 0;
  9251. while ( ( elem = nodes[ i++ ] ) ) {
  9252. // Skip elements already in the context collection (trac-4087)
  9253. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  9254. if ( ignored ) {
  9255. ignored.push( elem );
  9256. }
  9257. continue;
  9258. }
  9259. attached = isAttached( elem );
  9260. // Append to fragment
  9261. tmp = getAll( fragment.appendChild( elem ), "script" );
  9262. // Preserve script evaluation history
  9263. if ( attached ) {
  9264. setGlobalEval( tmp );
  9265. }
  9266. // Capture executables
  9267. if ( scripts ) {
  9268. j = 0;
  9269. while ( ( elem = tmp[ j++ ] ) ) {
  9270. if ( rscriptType.test( elem.type || "" ) ) {
  9271. scripts.push( elem );
  9272. }
  9273. }
  9274. }
  9275. }
  9276. return fragment;
  9277. }
  9278. ( function() {
  9279. var fragment = document.createDocumentFragment(),
  9280. div = fragment.appendChild( document.createElement( "div" ) ),
  9281. input = document.createElement( "input" );
  9282. // Support: Android 4.0 - 4.3 only
  9283. // Check state lost if the name is set (#11217)
  9284. // Support: Windows Web Apps (WWA)
  9285. // `name` and `type` must use .setAttribute for WWA (#14901)
  9286. input.setAttribute( "type", "radio" );
  9287. input.setAttribute( "checked", "checked" );
  9288. input.setAttribute( "name", "t" );
  9289. div.appendChild( input );
  9290. // Support: Android <=4.1 only
  9291. // Older WebKit doesn't clone checked state correctly in fragments
  9292. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  9293. // Support: IE <=11 only
  9294. // Make sure textarea (and checkbox) defaultValue is properly cloned
  9295. div.innerHTML = "<textarea>x</textarea>";
  9296. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  9297. } )();
  9298. var
  9299. rkeyEvent = /^key/,
  9300. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  9301. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  9302. function returnTrue() {
  9303. return true;
  9304. }
  9305. function returnFalse() {
  9306. return false;
  9307. }
  9308. // Support: IE <=9 - 11+
  9309. // focus() and blur() are asynchronous, except when they are no-op.
  9310. // So expect focus to be synchronous when the element is already active,
  9311. // and blur to be synchronous when the element is not already active.
  9312. // (focus and blur are always synchronous in other supported browsers,
  9313. // this just defines when we can count on it).
  9314. function expectSync( elem, type ) {
  9315. return ( elem === safeActiveElement() ) === ( type === "focus" );
  9316. }
  9317. // Support: IE <=9 only
  9318. // Accessing document.activeElement can throw unexpectedly
  9319. // https://bugs.jquery.com/ticket/13393
  9320. function safeActiveElement() {
  9321. try {
  9322. return document.activeElement;
  9323. } catch ( err ) { }
  9324. }
  9325. function on( elem, types, selector, data, fn, one ) {
  9326. var origFn, type;
  9327. // Types can be a map of types/handlers
  9328. if ( typeof types === "object" ) {
  9329. // ( types-Object, selector, data )
  9330. if ( typeof selector !== "string" ) {
  9331. // ( types-Object, data )
  9332. data = data || selector;
  9333. selector = undefined;
  9334. }
  9335. for ( type in types ) {
  9336. on( elem, type, selector, data, types[ type ], one );
  9337. }
  9338. return elem;
  9339. }
  9340. if ( data == null && fn == null ) {
  9341. // ( types, fn )
  9342. fn = selector;
  9343. data = selector = undefined;
  9344. } else if ( fn == null ) {
  9345. if ( typeof selector === "string" ) {
  9346. // ( types, selector, fn )
  9347. fn = data;
  9348. data = undefined;
  9349. } else {
  9350. // ( types, data, fn )
  9351. fn = data;
  9352. data = selector;
  9353. selector = undefined;
  9354. }
  9355. }
  9356. if ( fn === false ) {
  9357. fn = returnFalse;
  9358. } else if ( !fn ) {
  9359. return elem;
  9360. }
  9361. if ( one === 1 ) {
  9362. origFn = fn;
  9363. fn = function( event ) {
  9364. // Can use an empty set, since event contains the info
  9365. jQuery().off( event );
  9366. return origFn.apply( this, arguments );
  9367. };
  9368. // Use same guid so caller can remove using origFn
  9369. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  9370. }
  9371. return elem.each( function() {
  9372. jQuery.event.add( this, types, fn, data, selector );
  9373. } );
  9374. }
  9375. /*
  9376. * Helper functions for managing events -- not part of the public interface.
  9377. * Props to Dean Edwards' addEvent library for many of the ideas.
  9378. */
  9379. jQuery.event = {
  9380. global: {},
  9381. add: function( elem, types, handler, data, selector ) {
  9382. var handleObjIn, eventHandle, tmp,
  9383. events, t, handleObj,
  9384. special, handlers, type, namespaces, origType,
  9385. elemData = dataPriv.get( elem );
  9386. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  9387. if ( !elemData ) {
  9388. return;
  9389. }
  9390. // Caller can pass in an object of custom data in lieu of the handler
  9391. if ( handler.handler ) {
  9392. handleObjIn = handler;
  9393. handler = handleObjIn.handler;
  9394. selector = handleObjIn.selector;
  9395. }
  9396. // Ensure that invalid selectors throw exceptions at attach time
  9397. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  9398. if ( selector ) {
  9399. jQuery.find.matchesSelector( documentElement, selector );
  9400. }
  9401. // Make sure that the handler has a unique ID, used to find/remove it later
  9402. if ( !handler.guid ) {
  9403. handler.guid = jQuery.guid++;
  9404. }
  9405. // Init the element's event structure and main handler, if this is the first
  9406. if ( !( events = elemData.events ) ) {
  9407. events = elemData.events = {};
  9408. }
  9409. if ( !( eventHandle = elemData.handle ) ) {
  9410. eventHandle = elemData.handle = function( e ) {
  9411. // Discard the second event of a jQuery.event.trigger() and
  9412. // when an event is called after a page has unloaded
  9413. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  9414. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  9415. };
  9416. }
  9417. // Handle multiple events separated by a space
  9418. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  9419. t = types.length;
  9420. while ( t-- ) {
  9421. tmp = rtypenamespace.exec( types[ t ] ) || [];
  9422. type = origType = tmp[ 1 ];
  9423. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  9424. // There *must* be a type, no attaching namespace-only handlers
  9425. if ( !type ) {
  9426. continue;
  9427. }
  9428. // If event changes its type, use the special event handlers for the changed type
  9429. special = jQuery.event.special[ type ] || {};
  9430. // If selector defined, determine special event api type, otherwise given type
  9431. type = ( selector ? special.delegateType : special.bindType ) || type;
  9432. // Update special based on newly reset type
  9433. special = jQuery.event.special[ type ] || {};
  9434. // handleObj is passed to all event handlers
  9435. handleObj = jQuery.extend( {
  9436. type: type,
  9437. origType: origType,
  9438. data: data,
  9439. handler: handler,
  9440. guid: handler.guid,
  9441. selector: selector,
  9442. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  9443. namespace: namespaces.join( "." )
  9444. }, handleObjIn );
  9445. // Init the event handler queue if we're the first
  9446. if ( !( handlers = events[ type ] ) ) {
  9447. handlers = events[ type ] = [];
  9448. handlers.delegateCount = 0;
  9449. // Only use addEventListener if the special events handler returns false
  9450. if ( !special.setup ||
  9451. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  9452. if ( elem.addEventListener ) {
  9453. elem.addEventListener( type, eventHandle );
  9454. }
  9455. }
  9456. }
  9457. if ( special.add ) {
  9458. special.add.call( elem, handleObj );
  9459. if ( !handleObj.handler.guid ) {
  9460. handleObj.handler.guid = handler.guid;
  9461. }
  9462. }
  9463. // Add to the element's handler list, delegates in front
  9464. if ( selector ) {
  9465. handlers.splice( handlers.delegateCount++, 0, handleObj );
  9466. } else {
  9467. handlers.push( handleObj );
  9468. }
  9469. // Keep track of which events have ever been used, for event optimization
  9470. jQuery.event.global[ type ] = true;
  9471. }
  9472. },
  9473. // Detach an event or set of events from an element
  9474. remove: function( elem, types, handler, selector, mappedTypes ) {
  9475. var j, origCount, tmp,
  9476. events, t, handleObj,
  9477. special, handlers, type, namespaces, origType,
  9478. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  9479. if ( !elemData || !( events = elemData.events ) ) {
  9480. return;
  9481. }
  9482. // Once for each type.namespace in types; type may be omitted
  9483. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  9484. t = types.length;
  9485. while ( t-- ) {
  9486. tmp = rtypenamespace.exec( types[ t ] ) || [];
  9487. type = origType = tmp[ 1 ];
  9488. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  9489. // Unbind all events (on this namespace, if provided) for the element
  9490. if ( !type ) {
  9491. for ( type in events ) {
  9492. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  9493. }
  9494. continue;
  9495. }
  9496. special = jQuery.event.special[ type ] || {};
  9497. type = ( selector ? special.delegateType : special.bindType ) || type;
  9498. handlers = events[ type ] || [];
  9499. tmp = tmp[ 2 ] &&
  9500. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  9501. // Remove matching events
  9502. origCount = j = handlers.length;
  9503. while ( j-- ) {
  9504. handleObj = handlers[ j ];
  9505. if ( ( mappedTypes || origType === handleObj.origType ) &&
  9506. ( !handler || handler.guid === handleObj.guid ) &&
  9507. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  9508. ( !selector || selector === handleObj.selector ||
  9509. selector === "**" && handleObj.selector ) ) {
  9510. handlers.splice( j, 1 );
  9511. if ( handleObj.selector ) {
  9512. handlers.delegateCount--;
  9513. }
  9514. if ( special.remove ) {
  9515. special.remove.call( elem, handleObj );
  9516. }
  9517. }
  9518. }
  9519. // Remove generic event handler if we removed something and no more handlers exist
  9520. // (avoids potential for endless recursion during removal of special event handlers)
  9521. if ( origCount && !handlers.length ) {
  9522. if ( !special.teardown ||
  9523. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  9524. jQuery.removeEvent( elem, type, elemData.handle );
  9525. }
  9526. delete events[ type ];
  9527. }
  9528. }
  9529. // Remove data and the expando if it's no longer used
  9530. if ( jQuery.isEmptyObject( events ) ) {
  9531. dataPriv.remove( elem, "handle events" );
  9532. }
  9533. },
  9534. dispatch: function( nativeEvent ) {
  9535. // Make a writable jQuery.Event from the native event object
  9536. var event = jQuery.event.fix( nativeEvent );
  9537. var i, j, ret, matched, handleObj, handlerQueue,
  9538. args = new Array( arguments.length ),
  9539. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  9540. special = jQuery.event.special[ event.type ] || {};
  9541. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  9542. args[ 0 ] = event;
  9543. for ( i = 1; i < arguments.length; i++ ) {
  9544. args[ i ] = arguments[ i ];
  9545. }
  9546. event.delegateTarget = this;
  9547. // Call the preDispatch hook for the mapped type, and let it bail if desired
  9548. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  9549. return;
  9550. }
  9551. // Determine handlers
  9552. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  9553. // Run delegates first; they may want to stop propagation beneath us
  9554. i = 0;
  9555. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  9556. event.currentTarget = matched.elem;
  9557. j = 0;
  9558. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  9559. !event.isImmediatePropagationStopped() ) {
  9560. // If the event is namespaced, then each handler is only invoked if it is
  9561. // specially universal or its namespaces are a superset of the event's.
  9562. if ( !event.rnamespace || handleObj.namespace === false ||
  9563. event.rnamespace.test( handleObj.namespace ) ) {
  9564. event.handleObj = handleObj;
  9565. event.data = handleObj.data;
  9566. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  9567. handleObj.handler ).apply( matched.elem, args );
  9568. if ( ret !== undefined ) {
  9569. if ( ( event.result = ret ) === false ) {
  9570. event.preventDefault();
  9571. event.stopPropagation();
  9572. }
  9573. }
  9574. }
  9575. }
  9576. }
  9577. // Call the postDispatch hook for the mapped type
  9578. if ( special.postDispatch ) {
  9579. special.postDispatch.call( this, event );
  9580. }
  9581. return event.result;
  9582. },
  9583. handlers: function( event, handlers ) {
  9584. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  9585. handlerQueue = [],
  9586. delegateCount = handlers.delegateCount,
  9587. cur = event.target;
  9588. // Find delegate handlers
  9589. if ( delegateCount &&
  9590. // Support: IE <=9
  9591. // Black-hole SVG <use> instance trees (trac-13180)
  9592. cur.nodeType &&
  9593. // Support: Firefox <=42
  9594. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  9595. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  9596. // Support: IE 11 only
  9597. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  9598. !( event.type === "click" && event.button >= 1 ) ) {
  9599. for ( ; cur !== this; cur = cur.parentNode || this ) {
  9600. // Don't check non-elements (#13208)
  9601. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  9602. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  9603. matchedHandlers = [];
  9604. matchedSelectors = {};
  9605. for ( i = 0; i < delegateCount; i++ ) {
  9606. handleObj = handlers[ i ];
  9607. // Don't conflict with Object.prototype properties (#13203)
  9608. sel = handleObj.selector + " ";
  9609. if ( matchedSelectors[ sel ] === undefined ) {
  9610. matchedSelectors[ sel ] = handleObj.needsContext ?
  9611. jQuery( sel, this ).index( cur ) > -1 :
  9612. jQuery.find( sel, this, null, [ cur ] ).length;
  9613. }
  9614. if ( matchedSelectors[ sel ] ) {
  9615. matchedHandlers.push( handleObj );
  9616. }
  9617. }
  9618. if ( matchedHandlers.length ) {
  9619. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  9620. }
  9621. }
  9622. }
  9623. }
  9624. // Add the remaining (directly-bound) handlers
  9625. cur = this;
  9626. if ( delegateCount < handlers.length ) {
  9627. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  9628. }
  9629. return handlerQueue;
  9630. },
  9631. addProp: function( name, hook ) {
  9632. Object.defineProperty( jQuery.Event.prototype, name, {
  9633. enumerable: true,
  9634. configurable: true,
  9635. get: isFunction( hook ) ?
  9636. function() {
  9637. if ( this.originalEvent ) {
  9638. return hook( this.originalEvent );
  9639. }
  9640. } :
  9641. function() {
  9642. if ( this.originalEvent ) {
  9643. return this.originalEvent[ name ];
  9644. }
  9645. },
  9646. set: function( value ) {
  9647. Object.defineProperty( this, name, {
  9648. enumerable: true,
  9649. configurable: true,
  9650. writable: true,
  9651. value: value
  9652. } );
  9653. }
  9654. } );
  9655. },
  9656. fix: function( originalEvent ) {
  9657. return originalEvent[ jQuery.expando ] ?
  9658. originalEvent :
  9659. new jQuery.Event( originalEvent );
  9660. },
  9661. special: {
  9662. load: {
  9663. // Prevent triggered image.load events from bubbling to window.load
  9664. noBubble: true
  9665. },
  9666. click: {
  9667. // Utilize native event to ensure correct state for checkable inputs
  9668. setup: function( data ) {
  9669. // For mutual compressibility with _default, replace `this` access with a local var.
  9670. // `|| data` is dead code meant only to preserve the variable through minification.
  9671. var el = this || data;
  9672. // Claim the first handler
  9673. if ( rcheckableType.test( el.type ) &&
  9674. el.click && nodeName( el, "input" ) ) {
  9675. // dataPriv.set( el, "click", ... )
  9676. leverageNative( el, "click", returnTrue );
  9677. }
  9678. // Return false to allow normal processing in the caller
  9679. return false;
  9680. },
  9681. trigger: function( data ) {
  9682. // For mutual compressibility with _default, replace `this` access with a local var.
  9683. // `|| data` is dead code meant only to preserve the variable through minification.
  9684. var el = this || data;
  9685. // Force setup before triggering a click
  9686. if ( rcheckableType.test( el.type ) &&
  9687. el.click && nodeName( el, "input" ) ) {
  9688. leverageNative( el, "click" );
  9689. }
  9690. // Return non-false to allow normal event-path propagation
  9691. return true;
  9692. },
  9693. // For cross-browser consistency, suppress native .click() on links
  9694. // Also prevent it if we're currently inside a leveraged native-event stack
  9695. _default: function( event ) {
  9696. var target = event.target;
  9697. return rcheckableType.test( target.type ) &&
  9698. target.click && nodeName( target, "input" ) &&
  9699. dataPriv.get( target, "click" ) ||
  9700. nodeName( target, "a" );
  9701. }
  9702. },
  9703. beforeunload: {
  9704. postDispatch: function( event ) {
  9705. // Support: Firefox 20+
  9706. // Firefox doesn't alert if the returnValue field is not set.
  9707. if ( event.result !== undefined && event.originalEvent ) {
  9708. event.originalEvent.returnValue = event.result;
  9709. }
  9710. }
  9711. }
  9712. }
  9713. };
  9714. // Ensure the presence of an event listener that handles manually-triggered
  9715. // synthetic events by interrupting progress until reinvoked in response to
  9716. // *native* events that it fires directly, ensuring that state changes have
  9717. // already occurred before other listeners are invoked.
  9718. function leverageNative( el, type, expectSync ) {
  9719. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  9720. if ( !expectSync ) {
  9721. if ( dataPriv.get( el, type ) === undefined ) {
  9722. jQuery.event.add( el, type, returnTrue );
  9723. }
  9724. return;
  9725. }
  9726. // Register the controller as a special universal handler for all event namespaces
  9727. dataPriv.set( el, type, false );
  9728. jQuery.event.add( el, type, {
  9729. namespace: false,
  9730. handler: function( event ) {
  9731. var notAsync, result,
  9732. saved = dataPriv.get( this, type );
  9733. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  9734. // Interrupt processing of the outer synthetic .trigger()ed event
  9735. // Saved data should be false in such cases, but might be a leftover capture object
  9736. // from an async native handler (gh-4350)
  9737. if ( !saved.length ) {
  9738. // Store arguments for use when handling the inner native event
  9739. // There will always be at least one argument (an event object), so this array
  9740. // will not be confused with a leftover capture object.
  9741. saved = slice.call( arguments );
  9742. dataPriv.set( this, type, saved );
  9743. // Trigger the native event and capture its result
  9744. // Support: IE <=9 - 11+
  9745. // focus() and blur() are asynchronous
  9746. notAsync = expectSync( this, type );
  9747. this[ type ]();
  9748. result = dataPriv.get( this, type );
  9749. if ( saved !== result || notAsync ) {
  9750. dataPriv.set( this, type, false );
  9751. } else {
  9752. result = {};
  9753. }
  9754. if ( saved !== result ) {
  9755. // Cancel the outer synthetic event
  9756. event.stopImmediatePropagation();
  9757. event.preventDefault();
  9758. return result.value;
  9759. }
  9760. // If this is an inner synthetic event for an event with a bubbling surrogate
  9761. // (focus or blur), assume that the surrogate already propagated from triggering the
  9762. // native event and prevent that from happening again here.
  9763. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  9764. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  9765. // less bad than duplication.
  9766. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  9767. event.stopPropagation();
  9768. }
  9769. // If this is a native event triggered above, everything is now in order
  9770. // Fire an inner synthetic event with the original arguments
  9771. } else if ( saved.length ) {
  9772. // ...and capture the result
  9773. dataPriv.set( this, type, {
  9774. value: jQuery.event.trigger(
  9775. // Support: IE <=9 - 11+
  9776. // Extend with the prototype to reset the above stopImmediatePropagation()
  9777. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  9778. saved.slice( 1 ),
  9779. this
  9780. )
  9781. } );
  9782. // Abort handling of the native event
  9783. event.stopImmediatePropagation();
  9784. }
  9785. }
  9786. } );
  9787. }
  9788. jQuery.removeEvent = function( elem, type, handle ) {
  9789. // This "if" is needed for plain objects
  9790. if ( elem.removeEventListener ) {
  9791. elem.removeEventListener( type, handle );
  9792. }
  9793. };
  9794. jQuery.Event = function( src, props ) {
  9795. // Allow instantiation without the 'new' keyword
  9796. if ( !( this instanceof jQuery.Event ) ) {
  9797. return new jQuery.Event( src, props );
  9798. }
  9799. // Event object
  9800. if ( src && src.type ) {
  9801. this.originalEvent = src;
  9802. this.type = src.type;
  9803. // Events bubbling up the document may have been marked as prevented
  9804. // by a handler lower down the tree; reflect the correct value.
  9805. this.isDefaultPrevented = src.defaultPrevented ||
  9806. src.defaultPrevented === undefined &&
  9807. // Support: Android <=2.3 only
  9808. src.returnValue === false ?
  9809. returnTrue :
  9810. returnFalse;
  9811. // Create target properties
  9812. // Support: Safari <=6 - 7 only
  9813. // Target should not be a text node (#504, #13143)
  9814. this.target = ( src.target && src.target.nodeType === 3 ) ?
  9815. src.target.parentNode :
  9816. src.target;
  9817. this.currentTarget = src.currentTarget;
  9818. this.relatedTarget = src.relatedTarget;
  9819. // Event type
  9820. } else {
  9821. this.type = src;
  9822. }
  9823. // Put explicitly provided properties onto the event object
  9824. if ( props ) {
  9825. jQuery.extend( this, props );
  9826. }
  9827. // Create a timestamp if incoming event doesn't have one
  9828. this.timeStamp = src && src.timeStamp || Date.now();
  9829. // Mark it as fixed
  9830. this[ jQuery.expando ] = true;
  9831. };
  9832. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  9833. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  9834. jQuery.Event.prototype = {
  9835. constructor: jQuery.Event,
  9836. isDefaultPrevented: returnFalse,
  9837. isPropagationStopped: returnFalse,
  9838. isImmediatePropagationStopped: returnFalse,
  9839. isSimulated: false,
  9840. preventDefault: function() {
  9841. var e = this.originalEvent;
  9842. this.isDefaultPrevented = returnTrue;
  9843. if ( e && !this.isSimulated ) {
  9844. e.preventDefault();
  9845. }
  9846. },
  9847. stopPropagation: function() {
  9848. var e = this.originalEvent;
  9849. this.isPropagationStopped = returnTrue;
  9850. if ( e && !this.isSimulated ) {
  9851. e.stopPropagation();
  9852. }
  9853. },
  9854. stopImmediatePropagation: function() {
  9855. var e = this.originalEvent;
  9856. this.isImmediatePropagationStopped = returnTrue;
  9857. if ( e && !this.isSimulated ) {
  9858. e.stopImmediatePropagation();
  9859. }
  9860. this.stopPropagation();
  9861. }
  9862. };
  9863. // Includes all common event props including KeyEvent and MouseEvent specific props
  9864. jQuery.each( {
  9865. altKey: true,
  9866. bubbles: true,
  9867. cancelable: true,
  9868. changedTouches: true,
  9869. ctrlKey: true,
  9870. detail: true,
  9871. eventPhase: true,
  9872. metaKey: true,
  9873. pageX: true,
  9874. pageY: true,
  9875. shiftKey: true,
  9876. view: true,
  9877. "char": true,
  9878. code: true,
  9879. charCode: true,
  9880. key: true,
  9881. keyCode: true,
  9882. button: true,
  9883. buttons: true,
  9884. clientX: true,
  9885. clientY: true,
  9886. offsetX: true,
  9887. offsetY: true,
  9888. pointerId: true,
  9889. pointerType: true,
  9890. screenX: true,
  9891. screenY: true,
  9892. targetTouches: true,
  9893. toElement: true,
  9894. touches: true,
  9895. which: function( event ) {
  9896. var button = event.button;
  9897. // Add which for key events
  9898. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  9899. return event.charCode != null ? event.charCode : event.keyCode;
  9900. }
  9901. // Add which for click: 1 === left; 2 === middle; 3 === right
  9902. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  9903. if ( button & 1 ) {
  9904. return 1;
  9905. }
  9906. if ( button & 2 ) {
  9907. return 3;
  9908. }
  9909. if ( button & 4 ) {
  9910. return 2;
  9911. }
  9912. return 0;
  9913. }
  9914. return event.which;
  9915. }
  9916. }, jQuery.event.addProp );
  9917. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  9918. jQuery.event.special[ type ] = {
  9919. // Utilize native event if possible so blur/focus sequence is correct
  9920. setup: function() {
  9921. // Claim the first handler
  9922. // dataPriv.set( this, "focus", ... )
  9923. // dataPriv.set( this, "blur", ... )
  9924. leverageNative( this, type, expectSync );
  9925. // Return false to allow normal processing in the caller
  9926. return false;
  9927. },
  9928. trigger: function() {
  9929. // Force setup before trigger
  9930. leverageNative( this, type );
  9931. // Return non-false to allow normal event-path propagation
  9932. return true;
  9933. },
  9934. delegateType: delegateType
  9935. };
  9936. } );
  9937. // Create mouseenter/leave events using mouseover/out and event-time checks
  9938. // so that event delegation works in jQuery.
  9939. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  9940. //
  9941. // Support: Safari 7 only
  9942. // Safari sends mouseenter too often; see:
  9943. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  9944. // for the description of the bug (it existed in older Chrome versions as well).
  9945. jQuery.each( {
  9946. mouseenter: "mouseover",
  9947. mouseleave: "mouseout",
  9948. pointerenter: "pointerover",
  9949. pointerleave: "pointerout"
  9950. }, function( orig, fix ) {
  9951. jQuery.event.special[ orig ] = {
  9952. delegateType: fix,
  9953. bindType: fix,
  9954. handle: function( event ) {
  9955. var ret,
  9956. target = this,
  9957. related = event.relatedTarget,
  9958. handleObj = event.handleObj;
  9959. // For mouseenter/leave call the handler if related is outside the target.
  9960. // NB: No relatedTarget if the mouse left/entered the browser window
  9961. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  9962. event.type = handleObj.origType;
  9963. ret = handleObj.handler.apply( this, arguments );
  9964. event.type = fix;
  9965. }
  9966. return ret;
  9967. }
  9968. };
  9969. } );
  9970. jQuery.fn.extend( {
  9971. on: function( types, selector, data, fn ) {
  9972. return on( this, types, selector, data, fn );
  9973. },
  9974. one: function( types, selector, data, fn ) {
  9975. return on( this, types, selector, data, fn, 1 );
  9976. },
  9977. off: function( types, selector, fn ) {
  9978. var handleObj, type;
  9979. if ( types && types.preventDefault && types.handleObj ) {
  9980. // ( event ) dispatched jQuery.Event
  9981. handleObj = types.handleObj;
  9982. jQuery( types.delegateTarget ).off(
  9983. handleObj.namespace ?
  9984. handleObj.origType + "." + handleObj.namespace :
  9985. handleObj.origType,
  9986. handleObj.selector,
  9987. handleObj.handler
  9988. );
  9989. return this;
  9990. }
  9991. if ( typeof types === "object" ) {
  9992. // ( types-object [, selector] )
  9993. for ( type in types ) {
  9994. this.off( type, selector, types[ type ] );
  9995. }
  9996. return this;
  9997. }
  9998. if ( selector === false || typeof selector === "function" ) {
  9999. // ( types [, fn] )
  10000. fn = selector;
  10001. selector = undefined;
  10002. }
  10003. if ( fn === false ) {
  10004. fn = returnFalse;
  10005. }
  10006. return this.each( function() {
  10007. jQuery.event.remove( this, types, fn, selector );
  10008. } );
  10009. }
  10010. } );
  10011. var
  10012. /* eslint-disable max-len */
  10013. // See https://github.com/eslint/eslint/issues/3229
  10014. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  10015. /* eslint-enable */
  10016. // Support: IE <=10 - 11, Edge 12 - 13 only
  10017. // In IE/Edge using regex groups here causes severe slowdowns.
  10018. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  10019. rnoInnerhtml = /<script|<style|<link/i,
  10020. // checked="checked" or checked
  10021. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  10022. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  10023. // Prefer a tbody over its parent table for containing new rows
  10024. function manipulationTarget( elem, content ) {
  10025. if ( nodeName( elem, "table" ) &&
  10026. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  10027. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  10028. }
  10029. return elem;
  10030. }
  10031. // Replace/restore the type attribute of script elements for safe DOM manipulation
  10032. function disableScript( elem ) {
  10033. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  10034. return elem;
  10035. }
  10036. function restoreScript( elem ) {
  10037. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  10038. elem.type = elem.type.slice( 5 );
  10039. } else {
  10040. elem.removeAttribute( "type" );
  10041. }
  10042. return elem;
  10043. }
  10044. function cloneCopyEvent( src, dest ) {
  10045. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  10046. if ( dest.nodeType !== 1 ) {
  10047. return;
  10048. }
  10049. // 1. Copy private data: events, handlers, etc.
  10050. if ( dataPriv.hasData( src ) ) {
  10051. pdataOld = dataPriv.access( src );
  10052. pdataCur = dataPriv.set( dest, pdataOld );
  10053. events = pdataOld.events;
  10054. if ( events ) {
  10055. delete pdataCur.handle;
  10056. pdataCur.events = {};
  10057. for ( type in events ) {
  10058. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  10059. jQuery.event.add( dest, type, events[ type ][ i ] );
  10060. }
  10061. }
  10062. }
  10063. }
  10064. // 2. Copy user data
  10065. if ( dataUser.hasData( src ) ) {
  10066. udataOld = dataUser.access( src );
  10067. udataCur = jQuery.extend( {}, udataOld );
  10068. dataUser.set( dest, udataCur );
  10069. }
  10070. }
  10071. // Fix IE bugs, see support tests
  10072. function fixInput( src, dest ) {
  10073. var nodeName = dest.nodeName.toLowerCase();
  10074. // Fails to persist the checked state of a cloned checkbox or radio button.
  10075. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  10076. dest.checked = src.checked;
  10077. // Fails to return the selected option to the default selected state when cloning options
  10078. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  10079. dest.defaultValue = src.defaultValue;
  10080. }
  10081. }
  10082. function domManip( collection, args, callback, ignored ) {
  10083. // Flatten any nested arrays
  10084. args = concat.apply( [], args );
  10085. var fragment, first, scripts, hasScripts, node, doc,
  10086. i = 0,
  10087. l = collection.length,
  10088. iNoClone = l - 1,
  10089. value = args[ 0 ],
  10090. valueIsFunction = isFunction( value );
  10091. // We can't cloneNode fragments that contain checked, in WebKit
  10092. if ( valueIsFunction ||
  10093. ( l > 1 && typeof value === "string" &&
  10094. !support.checkClone && rchecked.test( value ) ) ) {
  10095. return collection.each( function( index ) {
  10096. var self = collection.eq( index );
  10097. if ( valueIsFunction ) {
  10098. args[ 0 ] = value.call( this, index, self.html() );
  10099. }
  10100. domManip( self, args, callback, ignored );
  10101. } );
  10102. }
  10103. if ( l ) {
  10104. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  10105. first = fragment.firstChild;
  10106. if ( fragment.childNodes.length === 1 ) {
  10107. fragment = first;
  10108. }
  10109. // Require either new content or an interest in ignored elements to invoke the callback
  10110. if ( first || ignored ) {
  10111. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  10112. hasScripts = scripts.length;
  10113. // Use the original fragment for the last item
  10114. // instead of the first because it can end up
  10115. // being emptied incorrectly in certain situations (#8070).
  10116. for ( ; i < l; i++ ) {
  10117. node = fragment;
  10118. if ( i !== iNoClone ) {
  10119. node = jQuery.clone( node, true, true );
  10120. // Keep references to cloned scripts for later restoration
  10121. if ( hasScripts ) {
  10122. // Support: Android <=4.0 only, PhantomJS 1 only
  10123. // push.apply(_, arraylike) throws on ancient WebKit
  10124. jQuery.merge( scripts, getAll( node, "script" ) );
  10125. }
  10126. }
  10127. callback.call( collection[ i ], node, i );
  10128. }
  10129. if ( hasScripts ) {
  10130. doc = scripts[ scripts.length - 1 ].ownerDocument;
  10131. // Reenable scripts
  10132. jQuery.map( scripts, restoreScript );
  10133. // Evaluate executable scripts on first document insertion
  10134. for ( i = 0; i < hasScripts; i++ ) {
  10135. node = scripts[ i ];
  10136. if ( rscriptType.test( node.type || "" ) &&
  10137. !dataPriv.access( node, "globalEval" ) &&
  10138. jQuery.contains( doc, node ) ) {
  10139. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  10140. // Optional AJAX dependency, but won't run scripts if not present
  10141. if ( jQuery._evalUrl && !node.noModule ) {
  10142. jQuery._evalUrl( node.src, {
  10143. nonce: node.nonce || node.getAttribute( "nonce" )
  10144. } );
  10145. }
  10146. } else {
  10147. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  10148. }
  10149. }
  10150. }
  10151. }
  10152. }
  10153. }
  10154. return collection;
  10155. }
  10156. function remove( elem, selector, keepData ) {
  10157. var node,
  10158. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  10159. i = 0;
  10160. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  10161. if ( !keepData && node.nodeType === 1 ) {
  10162. jQuery.cleanData( getAll( node ) );
  10163. }
  10164. if ( node.parentNode ) {
  10165. if ( keepData && isAttached( node ) ) {
  10166. setGlobalEval( getAll( node, "script" ) );
  10167. }
  10168. node.parentNode.removeChild( node );
  10169. }
  10170. }
  10171. return elem;
  10172. }
  10173. jQuery.extend( {
  10174. htmlPrefilter: function( html ) {
  10175. return html.replace( rxhtmlTag, "<$1></$2>" );
  10176. },
  10177. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  10178. var i, l, srcElements, destElements,
  10179. clone = elem.cloneNode( true ),
  10180. inPage = isAttached( elem );
  10181. // Fix IE cloning issues
  10182. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  10183. !jQuery.isXMLDoc( elem ) ) {
  10184. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  10185. destElements = getAll( clone );
  10186. srcElements = getAll( elem );
  10187. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  10188. fixInput( srcElements[ i ], destElements[ i ] );
  10189. }
  10190. }
  10191. // Copy the events from the original to the clone
  10192. if ( dataAndEvents ) {
  10193. if ( deepDataAndEvents ) {
  10194. srcElements = srcElements || getAll( elem );
  10195. destElements = destElements || getAll( clone );
  10196. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  10197. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  10198. }
  10199. } else {
  10200. cloneCopyEvent( elem, clone );
  10201. }
  10202. }
  10203. // Preserve script evaluation history
  10204. destElements = getAll( clone, "script" );
  10205. if ( destElements.length > 0 ) {
  10206. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  10207. }
  10208. // Return the cloned set
  10209. return clone;
  10210. },
  10211. cleanData: function( elems ) {
  10212. var data, elem, type,
  10213. special = jQuery.event.special,
  10214. i = 0;
  10215. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  10216. if ( acceptData( elem ) ) {
  10217. if ( ( data = elem[ dataPriv.expando ] ) ) {
  10218. if ( data.events ) {
  10219. for ( type in data.events ) {
  10220. if ( special[ type ] ) {
  10221. jQuery.event.remove( elem, type );
  10222. // This is a shortcut to avoid jQuery.event.remove's overhead
  10223. } else {
  10224. jQuery.removeEvent( elem, type, data.handle );
  10225. }
  10226. }
  10227. }
  10228. // Support: Chrome <=35 - 45+
  10229. // Assign undefined instead of using delete, see Data#remove
  10230. elem[ dataPriv.expando ] = undefined;
  10231. }
  10232. if ( elem[ dataUser.expando ] ) {
  10233. // Support: Chrome <=35 - 45+
  10234. // Assign undefined instead of using delete, see Data#remove
  10235. elem[ dataUser.expando ] = undefined;
  10236. }
  10237. }
  10238. }
  10239. }
  10240. } );
  10241. jQuery.fn.extend( {
  10242. detach: function( selector ) {
  10243. return remove( this, selector, true );
  10244. },
  10245. remove: function( selector ) {
  10246. return remove( this, selector );
  10247. },
  10248. text: function( value ) {
  10249. return access( this, function( value ) {
  10250. return value === undefined ?
  10251. jQuery.text( this ) :
  10252. this.empty().each( function() {
  10253. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  10254. this.textContent = value;
  10255. }
  10256. } );
  10257. }, null, value, arguments.length );
  10258. },
  10259. append: function() {
  10260. return domManip( this, arguments, function( elem ) {
  10261. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  10262. var target = manipulationTarget( this, elem );
  10263. target.appendChild( elem );
  10264. }
  10265. } );
  10266. },
  10267. prepend: function() {
  10268. return domManip( this, arguments, function( elem ) {
  10269. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  10270. var target = manipulationTarget( this, elem );
  10271. target.insertBefore( elem, target.firstChild );
  10272. }
  10273. } );
  10274. },
  10275. before: function() {
  10276. return domManip( this, arguments, function( elem ) {
  10277. if ( this.parentNode ) {
  10278. this.parentNode.insertBefore( elem, this );
  10279. }
  10280. } );
  10281. },
  10282. after: function() {
  10283. return domManip( this, arguments, function( elem ) {
  10284. if ( this.parentNode ) {
  10285. this.parentNode.insertBefore( elem, this.nextSibling );
  10286. }
  10287. } );
  10288. },
  10289. empty: function() {
  10290. var elem,
  10291. i = 0;
  10292. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  10293. if ( elem.nodeType === 1 ) {
  10294. // Prevent memory leaks
  10295. jQuery.cleanData( getAll( elem, false ) );
  10296. // Remove any remaining nodes
  10297. elem.textContent = "";
  10298. }
  10299. }
  10300. return this;
  10301. },
  10302. clone: function( dataAndEvents, deepDataAndEvents ) {
  10303. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  10304. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  10305. return this.map( function() {
  10306. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  10307. } );
  10308. },
  10309. html: function( value ) {
  10310. return access( this, function( value ) {
  10311. var elem = this[ 0 ] || {},
  10312. i = 0,
  10313. l = this.length;
  10314. if ( value === undefined && elem.nodeType === 1 ) {
  10315. return elem.innerHTML;
  10316. }
  10317. // See if we can take a shortcut and just use innerHTML
  10318. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  10319. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  10320. value = jQuery.htmlPrefilter( value );
  10321. try {
  10322. for ( ; i < l; i++ ) {
  10323. elem = this[ i ] || {};
  10324. // Remove element nodes and prevent memory leaks
  10325. if ( elem.nodeType === 1 ) {
  10326. jQuery.cleanData( getAll( elem, false ) );
  10327. elem.innerHTML = value;
  10328. }
  10329. }
  10330. elem = 0;
  10331. // If using innerHTML throws an exception, use the fallback method
  10332. } catch ( e ) {}
  10333. }
  10334. if ( elem ) {
  10335. this.empty().append( value );
  10336. }
  10337. }, null, value, arguments.length );
  10338. },
  10339. replaceWith: function() {
  10340. var ignored = [];
  10341. // Make the changes, replacing each non-ignored context element with the new content
  10342. return domManip( this, arguments, function( elem ) {
  10343. var parent = this.parentNode;
  10344. if ( jQuery.inArray( this, ignored ) < 0 ) {
  10345. jQuery.cleanData( getAll( this ) );
  10346. if ( parent ) {
  10347. parent.replaceChild( elem, this );
  10348. }
  10349. }
  10350. // Force callback invocation
  10351. }, ignored );
  10352. }
  10353. } );
  10354. jQuery.each( {
  10355. appendTo: "append",
  10356. prependTo: "prepend",
  10357. insertBefore: "before",
  10358. insertAfter: "after",
  10359. replaceAll: "replaceWith"
  10360. }, function( name, original ) {
  10361. jQuery.fn[ name ] = function( selector ) {
  10362. var elems,
  10363. ret = [],
  10364. insert = jQuery( selector ),
  10365. last = insert.length - 1,
  10366. i = 0;
  10367. for ( ; i <= last; i++ ) {
  10368. elems = i === last ? this : this.clone( true );
  10369. jQuery( insert[ i ] )[ original ]( elems );
  10370. // Support: Android <=4.0 only, PhantomJS 1 only
  10371. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  10372. push.apply( ret, elems.get() );
  10373. }
  10374. return this.pushStack( ret );
  10375. };
  10376. } );
  10377. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  10378. var getStyles = function( elem ) {
  10379. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  10380. // IE throws on elements created in popups
  10381. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  10382. var view = elem.ownerDocument.defaultView;
  10383. if ( !view || !view.opener ) {
  10384. view = window;
  10385. }
  10386. return view.getComputedStyle( elem );
  10387. };
  10388. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  10389. ( function() {
  10390. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  10391. // so they're executed at the same time to save the second computation.
  10392. function computeStyleTests() {
  10393. // This is a singleton, we need to execute it only once
  10394. if ( !div ) {
  10395. return;
  10396. }
  10397. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  10398. "margin-top:1px;padding:0;border:0";
  10399. div.style.cssText =
  10400. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  10401. "margin:auto;border:1px;padding:1px;" +
  10402. "width:60%;top:1%";
  10403. documentElement.appendChild( container ).appendChild( div );
  10404. var divStyle = window.getComputedStyle( div );
  10405. pixelPositionVal = divStyle.top !== "1%";
  10406. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  10407. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  10408. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  10409. // Some styles come back with percentage values, even though they shouldn't
  10410. div.style.right = "60%";
  10411. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  10412. // Support: IE 9 - 11 only
  10413. // Detect misreporting of content dimensions for box-sizing:border-box elements
  10414. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  10415. // Support: IE 9 only
  10416. // Detect overflow:scroll screwiness (gh-3699)
  10417. // Support: Chrome <=64
  10418. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  10419. div.style.position = "absolute";
  10420. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  10421. documentElement.removeChild( container );
  10422. // Nullify the div so it wouldn't be stored in the memory and
  10423. // it will also be a sign that checks already performed
  10424. div = null;
  10425. }
  10426. function roundPixelMeasures( measure ) {
  10427. return Math.round( parseFloat( measure ) );
  10428. }
  10429. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  10430. reliableMarginLeftVal,
  10431. container = document.createElement( "div" ),
  10432. div = document.createElement( "div" );
  10433. // Finish early in limited (non-browser) environments
  10434. if ( !div.style ) {
  10435. return;
  10436. }
  10437. // Support: IE <=9 - 11 only
  10438. // Style of cloned element affects source element cloned (#8908)
  10439. div.style.backgroundClip = "content-box";
  10440. div.cloneNode( true ).style.backgroundClip = "";
  10441. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  10442. jQuery.extend( support, {
  10443. boxSizingReliable: function() {
  10444. computeStyleTests();
  10445. return boxSizingReliableVal;
  10446. },
  10447. pixelBoxStyles: function() {
  10448. computeStyleTests();
  10449. return pixelBoxStylesVal;
  10450. },
  10451. pixelPosition: function() {
  10452. computeStyleTests();
  10453. return pixelPositionVal;
  10454. },
  10455. reliableMarginLeft: function() {
  10456. computeStyleTests();
  10457. return reliableMarginLeftVal;
  10458. },
  10459. scrollboxSize: function() {
  10460. computeStyleTests();
  10461. return scrollboxSizeVal;
  10462. }
  10463. } );
  10464. } )();
  10465. function curCSS( elem, name, computed ) {
  10466. var width, minWidth, maxWidth, ret,
  10467. // Support: Firefox 51+
  10468. // Retrieving style before computed somehow
  10469. // fixes an issue with getting wrong values
  10470. // on detached elements
  10471. style = elem.style;
  10472. computed = computed || getStyles( elem );
  10473. // getPropertyValue is needed for:
  10474. // .css('filter') (IE 9 only, #12537)
  10475. // .css('--customProperty) (#3144)
  10476. if ( computed ) {
  10477. ret = computed.getPropertyValue( name ) || computed[ name ];
  10478. if ( ret === "" && !isAttached( elem ) ) {
  10479. ret = jQuery.style( elem, name );
  10480. }
  10481. // A tribute to the "awesome hack by Dean Edwards"
  10482. // Android Browser returns percentage for some values,
  10483. // but width seems to be reliably pixels.
  10484. // This is against the CSSOM draft spec:
  10485. // https://drafts.csswg.org/cssom/#resolved-values
  10486. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  10487. // Remember the original values
  10488. width = style.width;
  10489. minWidth = style.minWidth;
  10490. maxWidth = style.maxWidth;
  10491. // Put in the new values to get a computed value out
  10492. style.minWidth = style.maxWidth = style.width = ret;
  10493. ret = computed.width;
  10494. // Revert the changed values
  10495. style.width = width;
  10496. style.minWidth = minWidth;
  10497. style.maxWidth = maxWidth;
  10498. }
  10499. }
  10500. return ret !== undefined ?
  10501. // Support: IE <=9 - 11 only
  10502. // IE returns zIndex value as an integer.
  10503. ret + "" :
  10504. ret;
  10505. }
  10506. function addGetHookIf( conditionFn, hookFn ) {
  10507. // Define the hook, we'll check on the first run if it's really needed.
  10508. return {
  10509. get: function() {
  10510. if ( conditionFn() ) {
  10511. // Hook not needed (or it's not possible to use it due
  10512. // to missing dependency), remove it.
  10513. delete this.get;
  10514. return;
  10515. }
  10516. // Hook needed; redefine it so that the support test is not executed again.
  10517. return ( this.get = hookFn ).apply( this, arguments );
  10518. }
  10519. };
  10520. }
  10521. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  10522. emptyStyle = document.createElement( "div" ).style,
  10523. vendorProps = {};
  10524. // Return a vendor-prefixed property or undefined
  10525. function vendorPropName( name ) {
  10526. // Check for vendor prefixed names
  10527. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  10528. i = cssPrefixes.length;
  10529. while ( i-- ) {
  10530. name = cssPrefixes[ i ] + capName;
  10531. if ( name in emptyStyle ) {
  10532. return name;
  10533. }
  10534. }
  10535. }
  10536. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  10537. function finalPropName( name ) {
  10538. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  10539. if ( final ) {
  10540. return final;
  10541. }
  10542. if ( name in emptyStyle ) {
  10543. return name;
  10544. }
  10545. return vendorProps[ name ] = vendorPropName( name ) || name;
  10546. }
  10547. var
  10548. // Swappable if display is none or starts with table
  10549. // except "table", "table-cell", or "table-caption"
  10550. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  10551. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  10552. rcustomProp = /^--/,
  10553. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  10554. cssNormalTransform = {
  10555. letterSpacing: "0",
  10556. fontWeight: "400"
  10557. };
  10558. function setPositiveNumber( elem, value, subtract ) {
  10559. // Any relative (+/-) values have already been
  10560. // normalized at this point
  10561. var matches = rcssNum.exec( value );
  10562. return matches ?
  10563. // Guard against undefined "subtract", e.g., when used as in cssHooks
  10564. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  10565. value;
  10566. }
  10567. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  10568. var i = dimension === "width" ? 1 : 0,
  10569. extra = 0,
  10570. delta = 0;
  10571. // Adjustment may not be necessary
  10572. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  10573. return 0;
  10574. }
  10575. for ( ; i < 4; i += 2 ) {
  10576. // Both box models exclude margin
  10577. if ( box === "margin" ) {
  10578. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  10579. }
  10580. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  10581. if ( !isBorderBox ) {
  10582. // Add padding
  10583. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  10584. // For "border" or "margin", add border
  10585. if ( box !== "padding" ) {
  10586. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10587. // But still keep track of it otherwise
  10588. } else {
  10589. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10590. }
  10591. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  10592. // "padding" or "margin"
  10593. } else {
  10594. // For "content", subtract padding
  10595. if ( box === "content" ) {
  10596. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  10597. }
  10598. // For "content" or "padding", subtract border
  10599. if ( box !== "margin" ) {
  10600. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10601. }
  10602. }
  10603. }
  10604. // Account for positive content-box scroll gutter when requested by providing computedVal
  10605. if ( !isBorderBox && computedVal >= 0 ) {
  10606. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  10607. // Assuming integer scroll gutter, subtract the rest and round down
  10608. delta += Math.max( 0, Math.ceil(
  10609. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  10610. computedVal -
  10611. delta -
  10612. extra -
  10613. 0.5
  10614. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  10615. // Use an explicit zero to avoid NaN (gh-3964)
  10616. ) ) || 0;
  10617. }
  10618. return delta;
  10619. }
  10620. function getWidthOrHeight( elem, dimension, extra ) {
  10621. // Start with computed style
  10622. var styles = getStyles( elem ),
  10623. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  10624. // Fake content-box until we know it's needed to know the true value.
  10625. boxSizingNeeded = !support.boxSizingReliable() || extra,
  10626. isBorderBox = boxSizingNeeded &&
  10627. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  10628. valueIsBorderBox = isBorderBox,
  10629. val = curCSS( elem, dimension, styles ),
  10630. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  10631. // Support: Firefox <=54
  10632. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  10633. if ( rnumnonpx.test( val ) ) {
  10634. if ( !extra ) {
  10635. return val;
  10636. }
  10637. val = "auto";
  10638. }
  10639. // Fall back to offsetWidth/offsetHeight when value is "auto"
  10640. // This happens for inline elements with no explicit setting (gh-3571)
  10641. // Support: Android <=4.1 - 4.3 only
  10642. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  10643. // Support: IE 9-11 only
  10644. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  10645. // We use getClientRects() to check for hidden/disconnected.
  10646. // In those cases, the computed value can be trusted to be border-box
  10647. if ( ( !support.boxSizingReliable() && isBorderBox ||
  10648. val === "auto" ||
  10649. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  10650. elem.getClientRects().length ) {
  10651. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  10652. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  10653. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  10654. // retrieved value as a content box dimension.
  10655. valueIsBorderBox = offsetProp in elem;
  10656. if ( valueIsBorderBox ) {
  10657. val = elem[ offsetProp ];
  10658. }
  10659. }
  10660. // Normalize "" and auto
  10661. val = parseFloat( val ) || 0;
  10662. // Adjust for the element's box model
  10663. return ( val +
  10664. boxModelAdjustment(
  10665. elem,
  10666. dimension,
  10667. extra || ( isBorderBox ? "border" : "content" ),
  10668. valueIsBorderBox,
  10669. styles,
  10670. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  10671. val
  10672. )
  10673. ) + "px";
  10674. }
  10675. jQuery.extend( {
  10676. // Add in style property hooks for overriding the default
  10677. // behavior of getting and setting a style property
  10678. cssHooks: {
  10679. opacity: {
  10680. get: function( elem, computed ) {
  10681. if ( computed ) {
  10682. // We should always get a number back from opacity
  10683. var ret = curCSS( elem, "opacity" );
  10684. return ret === "" ? "1" : ret;
  10685. }
  10686. }
  10687. }
  10688. },
  10689. // Don't automatically add "px" to these possibly-unitless properties
  10690. cssNumber: {
  10691. "animationIterationCount": true,
  10692. "columnCount": true,
  10693. "fillOpacity": true,
  10694. "flexGrow": true,
  10695. "flexShrink": true,
  10696. "fontWeight": true,
  10697. "gridArea": true,
  10698. "gridColumn": true,
  10699. "gridColumnEnd": true,
  10700. "gridColumnStart": true,
  10701. "gridRow": true,
  10702. "gridRowEnd": true,
  10703. "gridRowStart": true,
  10704. "lineHeight": true,
  10705. "opacity": true,
  10706. "order": true,
  10707. "orphans": true,
  10708. "widows": true,
  10709. "zIndex": true,
  10710. "zoom": true
  10711. },
  10712. // Add in properties whose names you wish to fix before
  10713. // setting or getting the value
  10714. cssProps: {},
  10715. // Get and set the style property on a DOM Node
  10716. style: function( elem, name, value, extra ) {
  10717. // Don't set styles on text and comment nodes
  10718. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  10719. return;
  10720. }
  10721. // Make sure that we're working with the right name
  10722. var ret, type, hooks,
  10723. origName = camelCase( name ),
  10724. isCustomProp = rcustomProp.test( name ),
  10725. style = elem.style;
  10726. // Make sure that we're working with the right name. We don't
  10727. // want to query the value if it is a CSS custom property
  10728. // since they are user-defined.
  10729. if ( !isCustomProp ) {
  10730. name = finalPropName( origName );
  10731. }
  10732. // Gets hook for the prefixed version, then unprefixed version
  10733. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  10734. // Check if we're setting a value
  10735. if ( value !== undefined ) {
  10736. type = typeof value;
  10737. // Convert "+=" or "-=" to relative numbers (#7345)
  10738. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  10739. value = adjustCSS( elem, name, ret );
  10740. // Fixes bug #9237
  10741. type = "number";
  10742. }
  10743. // Make sure that null and NaN values aren't set (#7116)
  10744. if ( value == null || value !== value ) {
  10745. return;
  10746. }
  10747. // If a number was passed in, add the unit (except for certain CSS properties)
  10748. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  10749. // "px" to a few hardcoded values.
  10750. if ( type === "number" && !isCustomProp ) {
  10751. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  10752. }
  10753. // background-* props affect original clone's values
  10754. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  10755. style[ name ] = "inherit";
  10756. }
  10757. // If a hook was provided, use that value, otherwise just set the specified value
  10758. if ( !hooks || !( "set" in hooks ) ||
  10759. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  10760. if ( isCustomProp ) {
  10761. style.setProperty( name, value );
  10762. } else {
  10763. style[ name ] = value;
  10764. }
  10765. }
  10766. } else {
  10767. // If a hook was provided get the non-computed value from there
  10768. if ( hooks && "get" in hooks &&
  10769. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  10770. return ret;
  10771. }
  10772. // Otherwise just get the value from the style object
  10773. return style[ name ];
  10774. }
  10775. },
  10776. css: function( elem, name, extra, styles ) {
  10777. var val, num, hooks,
  10778. origName = camelCase( name ),
  10779. isCustomProp = rcustomProp.test( name );
  10780. // Make sure that we're working with the right name. We don't
  10781. // want to modify the value if it is a CSS custom property
  10782. // since they are user-defined.
  10783. if ( !isCustomProp ) {
  10784. name = finalPropName( origName );
  10785. }
  10786. // Try prefixed name followed by the unprefixed name
  10787. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  10788. // If a hook was provided get the computed value from there
  10789. if ( hooks && "get" in hooks ) {
  10790. val = hooks.get( elem, true, extra );
  10791. }
  10792. // Otherwise, if a way to get the computed value exists, use that
  10793. if ( val === undefined ) {
  10794. val = curCSS( elem, name, styles );
  10795. }
  10796. // Convert "normal" to computed value
  10797. if ( val === "normal" && name in cssNormalTransform ) {
  10798. val = cssNormalTransform[ name ];
  10799. }
  10800. // Make numeric if forced or a qualifier was provided and val looks numeric
  10801. if ( extra === "" || extra ) {
  10802. num = parseFloat( val );
  10803. return extra === true || isFinite( num ) ? num || 0 : val;
  10804. }
  10805. return val;
  10806. }
  10807. } );
  10808. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  10809. jQuery.cssHooks[ dimension ] = {
  10810. get: function( elem, computed, extra ) {
  10811. if ( computed ) {
  10812. // Certain elements can have dimension info if we invisibly show them
  10813. // but it must have a current display style that would benefit
  10814. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  10815. // Support: Safari 8+
  10816. // Table columns in Safari have non-zero offsetWidth & zero
  10817. // getBoundingClientRect().width unless display is changed.
  10818. // Support: IE <=11 only
  10819. // Running getBoundingClientRect on a disconnected node
  10820. // in IE throws an error.
  10821. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  10822. swap( elem, cssShow, function() {
  10823. return getWidthOrHeight( elem, dimension, extra );
  10824. } ) :
  10825. getWidthOrHeight( elem, dimension, extra );
  10826. }
  10827. },
  10828. set: function( elem, value, extra ) {
  10829. var matches,
  10830. styles = getStyles( elem ),
  10831. // Only read styles.position if the test has a chance to fail
  10832. // to avoid forcing a reflow.
  10833. scrollboxSizeBuggy = !support.scrollboxSize() &&
  10834. styles.position === "absolute",
  10835. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  10836. boxSizingNeeded = scrollboxSizeBuggy || extra,
  10837. isBorderBox = boxSizingNeeded &&
  10838. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  10839. subtract = extra ?
  10840. boxModelAdjustment(
  10841. elem,
  10842. dimension,
  10843. extra,
  10844. isBorderBox,
  10845. styles
  10846. ) :
  10847. 0;
  10848. // Account for unreliable border-box dimensions by comparing offset* to computed and
  10849. // faking a content-box to get border and padding (gh-3699)
  10850. if ( isBorderBox && scrollboxSizeBuggy ) {
  10851. subtract -= Math.ceil(
  10852. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  10853. parseFloat( styles[ dimension ] ) -
  10854. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  10855. 0.5
  10856. );
  10857. }
  10858. // Convert to pixels if value adjustment is needed
  10859. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  10860. ( matches[ 3 ] || "px" ) !== "px" ) {
  10861. elem.style[ dimension ] = value;
  10862. value = jQuery.css( elem, dimension );
  10863. }
  10864. return setPositiveNumber( elem, value, subtract );
  10865. }
  10866. };
  10867. } );
  10868. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  10869. function( elem, computed ) {
  10870. if ( computed ) {
  10871. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  10872. elem.getBoundingClientRect().left -
  10873. swap( elem, { marginLeft: 0 }, function() {
  10874. return elem.getBoundingClientRect().left;
  10875. } )
  10876. ) + "px";
  10877. }
  10878. }
  10879. );
  10880. // These hooks are used by animate to expand properties
  10881. jQuery.each( {
  10882. margin: "",
  10883. padding: "",
  10884. border: "Width"
  10885. }, function( prefix, suffix ) {
  10886. jQuery.cssHooks[ prefix + suffix ] = {
  10887. expand: function( value ) {
  10888. var i = 0,
  10889. expanded = {},
  10890. // Assumes a single number if not a string
  10891. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  10892. for ( ; i < 4; i++ ) {
  10893. expanded[ prefix + cssExpand[ i ] + suffix ] =
  10894. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  10895. }
  10896. return expanded;
  10897. }
  10898. };
  10899. if ( prefix !== "margin" ) {
  10900. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  10901. }
  10902. } );
  10903. jQuery.fn.extend( {
  10904. css: function( name, value ) {
  10905. return access( this, function( elem, name, value ) {
  10906. var styles, len,
  10907. map = {},
  10908. i = 0;
  10909. if ( Array.isArray( name ) ) {
  10910. styles = getStyles( elem );
  10911. len = name.length;
  10912. for ( ; i < len; i++ ) {
  10913. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  10914. }
  10915. return map;
  10916. }
  10917. return value !== undefined ?
  10918. jQuery.style( elem, name, value ) :
  10919. jQuery.css( elem, name );
  10920. }, name, value, arguments.length > 1 );
  10921. }
  10922. } );
  10923. function Tween( elem, options, prop, end, easing ) {
  10924. return new Tween.prototype.init( elem, options, prop, end, easing );
  10925. }
  10926. jQuery.Tween = Tween;
  10927. Tween.prototype = {
  10928. constructor: Tween,
  10929. init: function( elem, options, prop, end, easing, unit ) {
  10930. this.elem = elem;
  10931. this.prop = prop;
  10932. this.easing = easing || jQuery.easing._default;
  10933. this.options = options;
  10934. this.start = this.now = this.cur();
  10935. this.end = end;
  10936. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  10937. },
  10938. cur: function() {
  10939. var hooks = Tween.propHooks[ this.prop ];
  10940. return hooks && hooks.get ?
  10941. hooks.get( this ) :
  10942. Tween.propHooks._default.get( this );
  10943. },
  10944. run: function( percent ) {
  10945. var eased,
  10946. hooks = Tween.propHooks[ this.prop ];
  10947. if ( this.options.duration ) {
  10948. this.pos = eased = jQuery.easing[ this.easing ](
  10949. percent, this.options.duration * percent, 0, 1, this.options.duration
  10950. );
  10951. } else {
  10952. this.pos = eased = percent;
  10953. }
  10954. this.now = ( this.end - this.start ) * eased + this.start;
  10955. if ( this.options.step ) {
  10956. this.options.step.call( this.elem, this.now, this );
  10957. }
  10958. if ( hooks && hooks.set ) {
  10959. hooks.set( this );
  10960. } else {
  10961. Tween.propHooks._default.set( this );
  10962. }
  10963. return this;
  10964. }
  10965. };
  10966. Tween.prototype.init.prototype = Tween.prototype;
  10967. Tween.propHooks = {
  10968. _default: {
  10969. get: function( tween ) {
  10970. var result;
  10971. // Use a property on the element directly when it is not a DOM element,
  10972. // or when there is no matching style property that exists.
  10973. if ( tween.elem.nodeType !== 1 ||
  10974. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  10975. return tween.elem[ tween.prop ];
  10976. }
  10977. // Passing an empty string as a 3rd parameter to .css will automatically
  10978. // attempt a parseFloat and fallback to a string if the parse fails.
  10979. // Simple values such as "10px" are parsed to Float;
  10980. // complex values such as "rotate(1rad)" are returned as-is.
  10981. result = jQuery.css( tween.elem, tween.prop, "" );
  10982. // Empty strings, null, undefined and "auto" are converted to 0.
  10983. return !result || result === "auto" ? 0 : result;
  10984. },
  10985. set: function( tween ) {
  10986. // Use step hook for back compat.
  10987. // Use cssHook if its there.
  10988. // Use .style if available and use plain properties where available.
  10989. if ( jQuery.fx.step[ tween.prop ] ) {
  10990. jQuery.fx.step[ tween.prop ]( tween );
  10991. } else if ( tween.elem.nodeType === 1 && (
  10992. jQuery.cssHooks[ tween.prop ] ||
  10993. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  10994. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  10995. } else {
  10996. tween.elem[ tween.prop ] = tween.now;
  10997. }
  10998. }
  10999. }
  11000. };
  11001. // Support: IE <=9 only
  11002. // Panic based approach to setting things on disconnected nodes
  11003. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  11004. set: function( tween ) {
  11005. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  11006. tween.elem[ tween.prop ] = tween.now;
  11007. }
  11008. }
  11009. };
  11010. jQuery.easing = {
  11011. linear: function( p ) {
  11012. return p;
  11013. },
  11014. swing: function( p ) {
  11015. return 0.5 - Math.cos( p * Math.PI ) / 2;
  11016. },
  11017. _default: "swing"
  11018. };
  11019. jQuery.fx = Tween.prototype.init;
  11020. // Back compat <1.8 extension point
  11021. jQuery.fx.step = {};
  11022. var
  11023. fxNow, inProgress,
  11024. rfxtypes = /^(?:toggle|show|hide)$/,
  11025. rrun = /queueHooks$/;
  11026. function schedule() {
  11027. if ( inProgress ) {
  11028. if ( document.hidden === false && window.requestAnimationFrame ) {
  11029. window.requestAnimationFrame( schedule );
  11030. } else {
  11031. window.setTimeout( schedule, jQuery.fx.interval );
  11032. }
  11033. jQuery.fx.tick();
  11034. }
  11035. }
  11036. // Animations created synchronously will run synchronously
  11037. function createFxNow() {
  11038. window.setTimeout( function() {
  11039. fxNow = undefined;
  11040. } );
  11041. return ( fxNow = Date.now() );
  11042. }
  11043. // Generate parameters to create a standard animation
  11044. function genFx( type, includeWidth ) {
  11045. var which,
  11046. i = 0,
  11047. attrs = { height: type };
  11048. // If we include width, step value is 1 to do all cssExpand values,
  11049. // otherwise step value is 2 to skip over Left and Right
  11050. includeWidth = includeWidth ? 1 : 0;
  11051. for ( ; i < 4; i += 2 - includeWidth ) {
  11052. which = cssExpand[ i ];
  11053. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  11054. }
  11055. if ( includeWidth ) {
  11056. attrs.opacity = attrs.width = type;
  11057. }
  11058. return attrs;
  11059. }
  11060. function createTween( value, prop, animation ) {
  11061. var tween,
  11062. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  11063. index = 0,
  11064. length = collection.length;
  11065. for ( ; index < length; index++ ) {
  11066. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  11067. // We're done with this property
  11068. return tween;
  11069. }
  11070. }
  11071. }
  11072. function defaultPrefilter( elem, props, opts ) {
  11073. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  11074. isBox = "width" in props || "height" in props,
  11075. anim = this,
  11076. orig = {},
  11077. style = elem.style,
  11078. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  11079. dataShow = dataPriv.get( elem, "fxshow" );
  11080. // Queue-skipping animations hijack the fx hooks
  11081. if ( !opts.queue ) {
  11082. hooks = jQuery._queueHooks( elem, "fx" );
  11083. if ( hooks.unqueued == null ) {
  11084. hooks.unqueued = 0;
  11085. oldfire = hooks.empty.fire;
  11086. hooks.empty.fire = function() {
  11087. if ( !hooks.unqueued ) {
  11088. oldfire();
  11089. }
  11090. };
  11091. }
  11092. hooks.unqueued++;
  11093. anim.always( function() {
  11094. // Ensure the complete handler is called before this completes
  11095. anim.always( function() {
  11096. hooks.unqueued--;
  11097. if ( !jQuery.queue( elem, "fx" ).length ) {
  11098. hooks.empty.fire();
  11099. }
  11100. } );
  11101. } );
  11102. }
  11103. // Detect show/hide animations
  11104. for ( prop in props ) {
  11105. value = props[ prop ];
  11106. if ( rfxtypes.test( value ) ) {
  11107. delete props[ prop ];
  11108. toggle = toggle || value === "toggle";
  11109. if ( value === ( hidden ? "hide" : "show" ) ) {
  11110. // Pretend to be hidden if this is a "show" and
  11111. // there is still data from a stopped show/hide
  11112. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  11113. hidden = true;
  11114. // Ignore all other no-op show/hide data
  11115. } else {
  11116. continue;
  11117. }
  11118. }
  11119. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  11120. }
  11121. }
  11122. // Bail out if this is a no-op like .hide().hide()
  11123. propTween = !jQuery.isEmptyObject( props );
  11124. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  11125. return;
  11126. }
  11127. // Restrict "overflow" and "display" styles during box animations
  11128. if ( isBox && elem.nodeType === 1 ) {
  11129. // Support: IE <=9 - 11, Edge 12 - 15
  11130. // Record all 3 overflow attributes because IE does not infer the shorthand
  11131. // from identically-valued overflowX and overflowY and Edge just mirrors
  11132. // the overflowX value there.
  11133. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  11134. // Identify a display type, preferring old show/hide data over the CSS cascade
  11135. restoreDisplay = dataShow && dataShow.display;
  11136. if ( restoreDisplay == null ) {
  11137. restoreDisplay = dataPriv.get( elem, "display" );
  11138. }
  11139. display = jQuery.css( elem, "display" );
  11140. if ( display === "none" ) {
  11141. if ( restoreDisplay ) {
  11142. display = restoreDisplay;
  11143. } else {
  11144. // Get nonempty value(s) by temporarily forcing visibility
  11145. showHide( [ elem ], true );
  11146. restoreDisplay = elem.style.display || restoreDisplay;
  11147. display = jQuery.css( elem, "display" );
  11148. showHide( [ elem ] );
  11149. }
  11150. }
  11151. // Animate inline elements as inline-block
  11152. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  11153. if ( jQuery.css( elem, "float" ) === "none" ) {
  11154. // Restore the original display value at the end of pure show/hide animations
  11155. if ( !propTween ) {
  11156. anim.done( function() {
  11157. style.display = restoreDisplay;
  11158. } );
  11159. if ( restoreDisplay == null ) {
  11160. display = style.display;
  11161. restoreDisplay = display === "none" ? "" : display;
  11162. }
  11163. }
  11164. style.display = "inline-block";
  11165. }
  11166. }
  11167. }
  11168. if ( opts.overflow ) {
  11169. style.overflow = "hidden";
  11170. anim.always( function() {
  11171. style.overflow = opts.overflow[ 0 ];
  11172. style.overflowX = opts.overflow[ 1 ];
  11173. style.overflowY = opts.overflow[ 2 ];
  11174. } );
  11175. }
  11176. // Implement show/hide animations
  11177. propTween = false;
  11178. for ( prop in orig ) {
  11179. // General show/hide setup for this element animation
  11180. if ( !propTween ) {
  11181. if ( dataShow ) {
  11182. if ( "hidden" in dataShow ) {
  11183. hidden = dataShow.hidden;
  11184. }
  11185. } else {
  11186. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  11187. }
  11188. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  11189. if ( toggle ) {
  11190. dataShow.hidden = !hidden;
  11191. }
  11192. // Show elements before animating them
  11193. if ( hidden ) {
  11194. showHide( [ elem ], true );
  11195. }
  11196. /* eslint-disable no-loop-func */
  11197. anim.done( function() {
  11198. /* eslint-enable no-loop-func */
  11199. // The final step of a "hide" animation is actually hiding the element
  11200. if ( !hidden ) {
  11201. showHide( [ elem ] );
  11202. }
  11203. dataPriv.remove( elem, "fxshow" );
  11204. for ( prop in orig ) {
  11205. jQuery.style( elem, prop, orig[ prop ] );
  11206. }
  11207. } );
  11208. }
  11209. // Per-property setup
  11210. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  11211. if ( !( prop in dataShow ) ) {
  11212. dataShow[ prop ] = propTween.start;
  11213. if ( hidden ) {
  11214. propTween.end = propTween.start;
  11215. propTween.start = 0;
  11216. }
  11217. }
  11218. }
  11219. }
  11220. function propFilter( props, specialEasing ) {
  11221. var index, name, easing, value, hooks;
  11222. // camelCase, specialEasing and expand cssHook pass
  11223. for ( index in props ) {
  11224. name = camelCase( index );
  11225. easing = specialEasing[ name ];
  11226. value = props[ index ];
  11227. if ( Array.isArray( value ) ) {
  11228. easing = value[ 1 ];
  11229. value = props[ index ] = value[ 0 ];
  11230. }
  11231. if ( index !== name ) {
  11232. props[ name ] = value;
  11233. delete props[ index ];
  11234. }
  11235. hooks = jQuery.cssHooks[ name ];
  11236. if ( hooks && "expand" in hooks ) {
  11237. value = hooks.expand( value );
  11238. delete props[ name ];
  11239. // Not quite $.extend, this won't overwrite existing keys.
  11240. // Reusing 'index' because we have the correct "name"
  11241. for ( index in value ) {
  11242. if ( !( index in props ) ) {
  11243. props[ index ] = value[ index ];
  11244. specialEasing[ index ] = easing;
  11245. }
  11246. }
  11247. } else {
  11248. specialEasing[ name ] = easing;
  11249. }
  11250. }
  11251. }
  11252. function Animation( elem, properties, options ) {
  11253. var result,
  11254. stopped,
  11255. index = 0,
  11256. length = Animation.prefilters.length,
  11257. deferred = jQuery.Deferred().always( function() {
  11258. // Don't match elem in the :animated selector
  11259. delete tick.elem;
  11260. } ),
  11261. tick = function() {
  11262. if ( stopped ) {
  11263. return false;
  11264. }
  11265. var currentTime = fxNow || createFxNow(),
  11266. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  11267. // Support: Android 2.3 only
  11268. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  11269. temp = remaining / animation.duration || 0,
  11270. percent = 1 - temp,
  11271. index = 0,
  11272. length = animation.tweens.length;
  11273. for ( ; index < length; index++ ) {
  11274. animation.tweens[ index ].run( percent );
  11275. }
  11276. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  11277. // If there's more to do, yield
  11278. if ( percent < 1 && length ) {
  11279. return remaining;
  11280. }
  11281. // If this was an empty animation, synthesize a final progress notification
  11282. if ( !length ) {
  11283. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  11284. }
  11285. // Resolve the animation and report its conclusion
  11286. deferred.resolveWith( elem, [ animation ] );
  11287. return false;
  11288. },
  11289. animation = deferred.promise( {
  11290. elem: elem,
  11291. props: jQuery.extend( {}, properties ),
  11292. opts: jQuery.extend( true, {
  11293. specialEasing: {},
  11294. easing: jQuery.easing._default
  11295. }, options ),
  11296. originalProperties: properties,
  11297. originalOptions: options,
  11298. startTime: fxNow || createFxNow(),
  11299. duration: options.duration,
  11300. tweens: [],
  11301. createTween: function( prop, end ) {
  11302. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  11303. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  11304. animation.tweens.push( tween );
  11305. return tween;
  11306. },
  11307. stop: function( gotoEnd ) {
  11308. var index = 0,
  11309. // If we are going to the end, we want to run all the tweens
  11310. // otherwise we skip this part
  11311. length = gotoEnd ? animation.tweens.length : 0;
  11312. if ( stopped ) {
  11313. return this;
  11314. }
  11315. stopped = true;
  11316. for ( ; index < length; index++ ) {
  11317. animation.tweens[ index ].run( 1 );
  11318. }
  11319. // Resolve when we played the last frame; otherwise, reject
  11320. if ( gotoEnd ) {
  11321. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  11322. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  11323. } else {
  11324. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  11325. }
  11326. return this;
  11327. }
  11328. } ),
  11329. props = animation.props;
  11330. propFilter( props, animation.opts.specialEasing );
  11331. for ( ; index < length; index++ ) {
  11332. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  11333. if ( result ) {
  11334. if ( isFunction( result.stop ) ) {
  11335. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  11336. result.stop.bind( result );
  11337. }
  11338. return result;
  11339. }
  11340. }
  11341. jQuery.map( props, createTween, animation );
  11342. if ( isFunction( animation.opts.start ) ) {
  11343. animation.opts.start.call( elem, animation );
  11344. }
  11345. // Attach callbacks from options
  11346. animation
  11347. .progress( animation.opts.progress )
  11348. .done( animation.opts.done, animation.opts.complete )
  11349. .fail( animation.opts.fail )
  11350. .always( animation.opts.always );
  11351. jQuery.fx.timer(
  11352. jQuery.extend( tick, {
  11353. elem: elem,
  11354. anim: animation,
  11355. queue: animation.opts.queue
  11356. } )
  11357. );
  11358. return animation;
  11359. }
  11360. jQuery.Animation = jQuery.extend( Animation, {
  11361. tweeners: {
  11362. "*": [ function( prop, value ) {
  11363. var tween = this.createTween( prop, value );
  11364. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  11365. return tween;
  11366. } ]
  11367. },
  11368. tweener: function( props, callback ) {
  11369. if ( isFunction( props ) ) {
  11370. callback = props;
  11371. props = [ "*" ];
  11372. } else {
  11373. props = props.match( rnothtmlwhite );
  11374. }
  11375. var prop,
  11376. index = 0,
  11377. length = props.length;
  11378. for ( ; index < length; index++ ) {
  11379. prop = props[ index ];
  11380. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  11381. Animation.tweeners[ prop ].unshift( callback );
  11382. }
  11383. },
  11384. prefilters: [ defaultPrefilter ],
  11385. prefilter: function( callback, prepend ) {
  11386. if ( prepend ) {
  11387. Animation.prefilters.unshift( callback );
  11388. } else {
  11389. Animation.prefilters.push( callback );
  11390. }
  11391. }
  11392. } );
  11393. jQuery.speed = function( speed, easing, fn ) {
  11394. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  11395. complete: fn || !fn && easing ||
  11396. isFunction( speed ) && speed,
  11397. duration: speed,
  11398. easing: fn && easing || easing && !isFunction( easing ) && easing
  11399. };
  11400. // Go to the end state if fx are off
  11401. if ( jQuery.fx.off ) {
  11402. opt.duration = 0;
  11403. } else {
  11404. if ( typeof opt.duration !== "number" ) {
  11405. if ( opt.duration in jQuery.fx.speeds ) {
  11406. opt.duration = jQuery.fx.speeds[ opt.duration ];
  11407. } else {
  11408. opt.duration = jQuery.fx.speeds._default;
  11409. }
  11410. }
  11411. }
  11412. // Normalize opt.queue - true/undefined/null -> "fx"
  11413. if ( opt.queue == null || opt.queue === true ) {
  11414. opt.queue = "fx";
  11415. }
  11416. // Queueing
  11417. opt.old = opt.complete;
  11418. opt.complete = function() {
  11419. if ( isFunction( opt.old ) ) {
  11420. opt.old.call( this );
  11421. }
  11422. if ( opt.queue ) {
  11423. jQuery.dequeue( this, opt.queue );
  11424. }
  11425. };
  11426. return opt;
  11427. };
  11428. jQuery.fn.extend( {
  11429. fadeTo: function( speed, to, easing, callback ) {
  11430. // Show any hidden elements after setting opacity to 0
  11431. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  11432. // Animate to the value specified
  11433. .end().animate( { opacity: to }, speed, easing, callback );
  11434. },
  11435. animate: function( prop, speed, easing, callback ) {
  11436. var empty = jQuery.isEmptyObject( prop ),
  11437. optall = jQuery.speed( speed, easing, callback ),
  11438. doAnimation = function() {
  11439. // Operate on a copy of prop so per-property easing won't be lost
  11440. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  11441. // Empty animations, or finishing resolves immediately
  11442. if ( empty || dataPriv.get( this, "finish" ) ) {
  11443. anim.stop( true );
  11444. }
  11445. };
  11446. doAnimation.finish = doAnimation;
  11447. return empty || optall.queue === false ?
  11448. this.each( doAnimation ) :
  11449. this.queue( optall.queue, doAnimation );
  11450. },
  11451. stop: function( type, clearQueue, gotoEnd ) {
  11452. var stopQueue = function( hooks ) {
  11453. var stop = hooks.stop;
  11454. delete hooks.stop;
  11455. stop( gotoEnd );
  11456. };
  11457. if ( typeof type !== "string" ) {
  11458. gotoEnd = clearQueue;
  11459. clearQueue = type;
  11460. type = undefined;
  11461. }
  11462. if ( clearQueue && type !== false ) {
  11463. this.queue( type || "fx", [] );
  11464. }
  11465. return this.each( function() {
  11466. var dequeue = true,
  11467. index = type != null && type + "queueHooks",
  11468. timers = jQuery.timers,
  11469. data = dataPriv.get( this );
  11470. if ( index ) {
  11471. if ( data[ index ] && data[ index ].stop ) {
  11472. stopQueue( data[ index ] );
  11473. }
  11474. } else {
  11475. for ( index in data ) {
  11476. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  11477. stopQueue( data[ index ] );
  11478. }
  11479. }
  11480. }
  11481. for ( index = timers.length; index--; ) {
  11482. if ( timers[ index ].elem === this &&
  11483. ( type == null || timers[ index ].queue === type ) ) {
  11484. timers[ index ].anim.stop( gotoEnd );
  11485. dequeue = false;
  11486. timers.splice( index, 1 );
  11487. }
  11488. }
  11489. // Start the next in the queue if the last step wasn't forced.
  11490. // Timers currently will call their complete callbacks, which
  11491. // will dequeue but only if they were gotoEnd.
  11492. if ( dequeue || !gotoEnd ) {
  11493. jQuery.dequeue( this, type );
  11494. }
  11495. } );
  11496. },
  11497. finish: function( type ) {
  11498. if ( type !== false ) {
  11499. type = type || "fx";
  11500. }
  11501. return this.each( function() {
  11502. var index,
  11503. data = dataPriv.get( this ),
  11504. queue = data[ type + "queue" ],
  11505. hooks = data[ type + "queueHooks" ],
  11506. timers = jQuery.timers,
  11507. length = queue ? queue.length : 0;
  11508. // Enable finishing flag on private data
  11509. data.finish = true;
  11510. // Empty the queue first
  11511. jQuery.queue( this, type, [] );
  11512. if ( hooks && hooks.stop ) {
  11513. hooks.stop.call( this, true );
  11514. }
  11515. // Look for any active animations, and finish them
  11516. for ( index = timers.length; index--; ) {
  11517. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  11518. timers[ index ].anim.stop( true );
  11519. timers.splice( index, 1 );
  11520. }
  11521. }
  11522. // Look for any animations in the old queue and finish them
  11523. for ( index = 0; index < length; index++ ) {
  11524. if ( queue[ index ] && queue[ index ].finish ) {
  11525. queue[ index ].finish.call( this );
  11526. }
  11527. }
  11528. // Turn off finishing flag
  11529. delete data.finish;
  11530. } );
  11531. }
  11532. } );
  11533. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  11534. var cssFn = jQuery.fn[ name ];
  11535. jQuery.fn[ name ] = function( speed, easing, callback ) {
  11536. return speed == null || typeof speed === "boolean" ?
  11537. cssFn.apply( this, arguments ) :
  11538. this.animate( genFx( name, true ), speed, easing, callback );
  11539. };
  11540. } );
  11541. // Generate shortcuts for custom animations
  11542. jQuery.each( {
  11543. slideDown: genFx( "show" ),
  11544. slideUp: genFx( "hide" ),
  11545. slideToggle: genFx( "toggle" ),
  11546. fadeIn: { opacity: "show" },
  11547. fadeOut: { opacity: "hide" },
  11548. fadeToggle: { opacity: "toggle" }
  11549. }, function( name, props ) {
  11550. jQuery.fn[ name ] = function( speed, easing, callback ) {
  11551. return this.animate( props, speed, easing, callback );
  11552. };
  11553. } );
  11554. jQuery.timers = [];
  11555. jQuery.fx.tick = function() {
  11556. var timer,
  11557. i = 0,
  11558. timers = jQuery.timers;
  11559. fxNow = Date.now();
  11560. for ( ; i < timers.length; i++ ) {
  11561. timer = timers[ i ];
  11562. // Run the timer and safely remove it when done (allowing for external removal)
  11563. if ( !timer() && timers[ i ] === timer ) {
  11564. timers.splice( i--, 1 );
  11565. }
  11566. }
  11567. if ( !timers.length ) {
  11568. jQuery.fx.stop();
  11569. }
  11570. fxNow = undefined;
  11571. };
  11572. jQuery.fx.timer = function( timer ) {
  11573. jQuery.timers.push( timer );
  11574. jQuery.fx.start();
  11575. };
  11576. jQuery.fx.interval = 13;
  11577. jQuery.fx.start = function() {
  11578. if ( inProgress ) {
  11579. return;
  11580. }
  11581. inProgress = true;
  11582. schedule();
  11583. };
  11584. jQuery.fx.stop = function() {
  11585. inProgress = null;
  11586. };
  11587. jQuery.fx.speeds = {
  11588. slow: 600,
  11589. fast: 200,
  11590. // Default speed
  11591. _default: 400
  11592. };
  11593. // Based off of the plugin by Clint Helfers, with permission.
  11594. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  11595. jQuery.fn.delay = function( time, type ) {
  11596. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  11597. type = type || "fx";
  11598. return this.queue( type, function( next, hooks ) {
  11599. var timeout = window.setTimeout( next, time );
  11600. hooks.stop = function() {
  11601. window.clearTimeout( timeout );
  11602. };
  11603. } );
  11604. };
  11605. ( function() {
  11606. var input = document.createElement( "input" ),
  11607. select = document.createElement( "select" ),
  11608. opt = select.appendChild( document.createElement( "option" ) );
  11609. input.type = "checkbox";
  11610. // Support: Android <=4.3 only
  11611. // Default value for a checkbox should be "on"
  11612. support.checkOn = input.value !== "";
  11613. // Support: IE <=11 only
  11614. // Must access selectedIndex to make default options select
  11615. support.optSelected = opt.selected;
  11616. // Support: IE <=11 only
  11617. // An input loses its value after becoming a radio
  11618. input = document.createElement( "input" );
  11619. input.value = "t";
  11620. input.type = "radio";
  11621. support.radioValue = input.value === "t";
  11622. } )();
  11623. var boolHook,
  11624. attrHandle = jQuery.expr.attrHandle;
  11625. jQuery.fn.extend( {
  11626. attr: function( name, value ) {
  11627. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  11628. },
  11629. removeAttr: function( name ) {
  11630. return this.each( function() {
  11631. jQuery.removeAttr( this, name );
  11632. } );
  11633. }
  11634. } );
  11635. jQuery.extend( {
  11636. attr: function( elem, name, value ) {
  11637. var ret, hooks,
  11638. nType = elem.nodeType;
  11639. // Don't get/set attributes on text, comment and attribute nodes
  11640. if ( nType === 3 || nType === 8 || nType === 2 ) {
  11641. return;
  11642. }
  11643. // Fallback to prop when attributes are not supported
  11644. if ( typeof elem.getAttribute === "undefined" ) {
  11645. return jQuery.prop( elem, name, value );
  11646. }
  11647. // Attribute hooks are determined by the lowercase version
  11648. // Grab necessary hook if one is defined
  11649. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  11650. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  11651. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  11652. }
  11653. if ( value !== undefined ) {
  11654. if ( value === null ) {
  11655. jQuery.removeAttr( elem, name );
  11656. return;
  11657. }
  11658. if ( hooks && "set" in hooks &&
  11659. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  11660. return ret;
  11661. }
  11662. elem.setAttribute( name, value + "" );
  11663. return value;
  11664. }
  11665. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  11666. return ret;
  11667. }
  11668. ret = jQuery.find.attr( elem, name );
  11669. // Non-existent attributes return null, we normalize to undefined
  11670. return ret == null ? undefined : ret;
  11671. },
  11672. attrHooks: {
  11673. type: {
  11674. set: function( elem, value ) {
  11675. if ( !support.radioValue && value === "radio" &&
  11676. nodeName( elem, "input" ) ) {
  11677. var val = elem.value;
  11678. elem.setAttribute( "type", value );
  11679. if ( val ) {
  11680. elem.value = val;
  11681. }
  11682. return value;
  11683. }
  11684. }
  11685. }
  11686. },
  11687. removeAttr: function( elem, value ) {
  11688. var name,
  11689. i = 0,
  11690. // Attribute names can contain non-HTML whitespace characters
  11691. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  11692. attrNames = value && value.match( rnothtmlwhite );
  11693. if ( attrNames && elem.nodeType === 1 ) {
  11694. while ( ( name = attrNames[ i++ ] ) ) {
  11695. elem.removeAttribute( name );
  11696. }
  11697. }
  11698. }
  11699. } );
  11700. // Hooks for boolean attributes
  11701. boolHook = {
  11702. set: function( elem, value, name ) {
  11703. if ( value === false ) {
  11704. // Remove boolean attributes when set to false
  11705. jQuery.removeAttr( elem, name );
  11706. } else {
  11707. elem.setAttribute( name, name );
  11708. }
  11709. return name;
  11710. }
  11711. };
  11712. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  11713. var getter = attrHandle[ name ] || jQuery.find.attr;
  11714. attrHandle[ name ] = function( elem, name, isXML ) {
  11715. var ret, handle,
  11716. lowercaseName = name.toLowerCase();
  11717. if ( !isXML ) {
  11718. // Avoid an infinite loop by temporarily removing this function from the getter
  11719. handle = attrHandle[ lowercaseName ];
  11720. attrHandle[ lowercaseName ] = ret;
  11721. ret = getter( elem, name, isXML ) != null ?
  11722. lowercaseName :
  11723. null;
  11724. attrHandle[ lowercaseName ] = handle;
  11725. }
  11726. return ret;
  11727. };
  11728. } );
  11729. var rfocusable = /^(?:input|select|textarea|button)$/i,
  11730. rclickable = /^(?:a|area)$/i;
  11731. jQuery.fn.extend( {
  11732. prop: function( name, value ) {
  11733. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  11734. },
  11735. removeProp: function( name ) {
  11736. return this.each( function() {
  11737. delete this[ jQuery.propFix[ name ] || name ];
  11738. } );
  11739. }
  11740. } );
  11741. jQuery.extend( {
  11742. prop: function( elem, name, value ) {
  11743. var ret, hooks,
  11744. nType = elem.nodeType;
  11745. // Don't get/set properties on text, comment and attribute nodes
  11746. if ( nType === 3 || nType === 8 || nType === 2 ) {
  11747. return;
  11748. }
  11749. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  11750. // Fix name and attach hooks
  11751. name = jQuery.propFix[ name ] || name;
  11752. hooks = jQuery.propHooks[ name ];
  11753. }
  11754. if ( value !== undefined ) {
  11755. if ( hooks && "set" in hooks &&
  11756. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  11757. return ret;
  11758. }
  11759. return ( elem[ name ] = value );
  11760. }
  11761. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  11762. return ret;
  11763. }
  11764. return elem[ name ];
  11765. },
  11766. propHooks: {
  11767. tabIndex: {
  11768. get: function( elem ) {
  11769. // Support: IE <=9 - 11 only
  11770. // elem.tabIndex doesn't always return the
  11771. // correct value when it hasn't been explicitly set
  11772. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  11773. // Use proper attribute retrieval(#12072)
  11774. var tabindex = jQuery.find.attr( elem, "tabindex" );
  11775. if ( tabindex ) {
  11776. return parseInt( tabindex, 10 );
  11777. }
  11778. if (
  11779. rfocusable.test( elem.nodeName ) ||
  11780. rclickable.test( elem.nodeName ) &&
  11781. elem.href
  11782. ) {
  11783. return 0;
  11784. }
  11785. return -1;
  11786. }
  11787. }
  11788. },
  11789. propFix: {
  11790. "for": "htmlFor",
  11791. "class": "className"
  11792. }
  11793. } );
  11794. // Support: IE <=11 only
  11795. // Accessing the selectedIndex property
  11796. // forces the browser to respect setting selected
  11797. // on the option
  11798. // The getter ensures a default option is selected
  11799. // when in an optgroup
  11800. // eslint rule "no-unused-expressions" is disabled for this code
  11801. // since it considers such accessions noop
  11802. if ( !support.optSelected ) {
  11803. jQuery.propHooks.selected = {
  11804. get: function( elem ) {
  11805. /* eslint no-unused-expressions: "off" */
  11806. var parent = elem.parentNode;
  11807. if ( parent && parent.parentNode ) {
  11808. parent.parentNode.selectedIndex;
  11809. }
  11810. return null;
  11811. },
  11812. set: function( elem ) {
  11813. /* eslint no-unused-expressions: "off" */
  11814. var parent = elem.parentNode;
  11815. if ( parent ) {
  11816. parent.selectedIndex;
  11817. if ( parent.parentNode ) {
  11818. parent.parentNode.selectedIndex;
  11819. }
  11820. }
  11821. }
  11822. };
  11823. }
  11824. jQuery.each( [
  11825. "tabIndex",
  11826. "readOnly",
  11827. "maxLength",
  11828. "cellSpacing",
  11829. "cellPadding",
  11830. "rowSpan",
  11831. "colSpan",
  11832. "useMap",
  11833. "frameBorder",
  11834. "contentEditable"
  11835. ], function() {
  11836. jQuery.propFix[ this.toLowerCase() ] = this;
  11837. } );
  11838. // Strip and collapse whitespace according to HTML spec
  11839. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  11840. function stripAndCollapse( value ) {
  11841. var tokens = value.match( rnothtmlwhite ) || [];
  11842. return tokens.join( " " );
  11843. }
  11844. function getClass( elem ) {
  11845. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  11846. }
  11847. function classesToArray( value ) {
  11848. if ( Array.isArray( value ) ) {
  11849. return value;
  11850. }
  11851. if ( typeof value === "string" ) {
  11852. return value.match( rnothtmlwhite ) || [];
  11853. }
  11854. return [];
  11855. }
  11856. jQuery.fn.extend( {
  11857. addClass: function( value ) {
  11858. var classes, elem, cur, curValue, clazz, j, finalValue,
  11859. i = 0;
  11860. if ( isFunction( value ) ) {
  11861. return this.each( function( j ) {
  11862. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  11863. } );
  11864. }
  11865. classes = classesToArray( value );
  11866. if ( classes.length ) {
  11867. while ( ( elem = this[ i++ ] ) ) {
  11868. curValue = getClass( elem );
  11869. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  11870. if ( cur ) {
  11871. j = 0;
  11872. while ( ( clazz = classes[ j++ ] ) ) {
  11873. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  11874. cur += clazz + " ";
  11875. }
  11876. }
  11877. // Only assign if different to avoid unneeded rendering.
  11878. finalValue = stripAndCollapse( cur );
  11879. if ( curValue !== finalValue ) {
  11880. elem.setAttribute( "class", finalValue );
  11881. }
  11882. }
  11883. }
  11884. }
  11885. return this;
  11886. },
  11887. removeClass: function( value ) {
  11888. var classes, elem, cur, curValue, clazz, j, finalValue,
  11889. i = 0;
  11890. if ( isFunction( value ) ) {
  11891. return this.each( function( j ) {
  11892. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  11893. } );
  11894. }
  11895. if ( !arguments.length ) {
  11896. return this.attr( "class", "" );
  11897. }
  11898. classes = classesToArray( value );
  11899. if ( classes.length ) {
  11900. while ( ( elem = this[ i++ ] ) ) {
  11901. curValue = getClass( elem );
  11902. // This expression is here for better compressibility (see addClass)
  11903. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  11904. if ( cur ) {
  11905. j = 0;
  11906. while ( ( clazz = classes[ j++ ] ) ) {
  11907. // Remove *all* instances
  11908. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  11909. cur = cur.replace( " " + clazz + " ", " " );
  11910. }
  11911. }
  11912. // Only assign if different to avoid unneeded rendering.
  11913. finalValue = stripAndCollapse( cur );
  11914. if ( curValue !== finalValue ) {
  11915. elem.setAttribute( "class", finalValue );
  11916. }
  11917. }
  11918. }
  11919. }
  11920. return this;
  11921. },
  11922. toggleClass: function( value, stateVal ) {
  11923. var type = typeof value,
  11924. isValidValue = type === "string" || Array.isArray( value );
  11925. if ( typeof stateVal === "boolean" && isValidValue ) {
  11926. return stateVal ? this.addClass( value ) : this.removeClass( value );
  11927. }
  11928. if ( isFunction( value ) ) {
  11929. return this.each( function( i ) {
  11930. jQuery( this ).toggleClass(
  11931. value.call( this, i, getClass( this ), stateVal ),
  11932. stateVal
  11933. );
  11934. } );
  11935. }
  11936. return this.each( function() {
  11937. var className, i, self, classNames;
  11938. if ( isValidValue ) {
  11939. // Toggle individual class names
  11940. i = 0;
  11941. self = jQuery( this );
  11942. classNames = classesToArray( value );
  11943. while ( ( className = classNames[ i++ ] ) ) {
  11944. // Check each className given, space separated list
  11945. if ( self.hasClass( className ) ) {
  11946. self.removeClass( className );
  11947. } else {
  11948. self.addClass( className );
  11949. }
  11950. }
  11951. // Toggle whole class name
  11952. } else if ( value === undefined || type === "boolean" ) {
  11953. className = getClass( this );
  11954. if ( className ) {
  11955. // Store className if set
  11956. dataPriv.set( this, "__className__", className );
  11957. }
  11958. // If the element has a class name or if we're passed `false`,
  11959. // then remove the whole classname (if there was one, the above saved it).
  11960. // Otherwise bring back whatever was previously saved (if anything),
  11961. // falling back to the empty string if nothing was stored.
  11962. if ( this.setAttribute ) {
  11963. this.setAttribute( "class",
  11964. className || value === false ?
  11965. "" :
  11966. dataPriv.get( this, "__className__" ) || ""
  11967. );
  11968. }
  11969. }
  11970. } );
  11971. },
  11972. hasClass: function( selector ) {
  11973. var className, elem,
  11974. i = 0;
  11975. className = " " + selector + " ";
  11976. while ( ( elem = this[ i++ ] ) ) {
  11977. if ( elem.nodeType === 1 &&
  11978. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  11979. return true;
  11980. }
  11981. }
  11982. return false;
  11983. }
  11984. } );
  11985. var rreturn = /\r/g;
  11986. jQuery.fn.extend( {
  11987. val: function( value ) {
  11988. var hooks, ret, valueIsFunction,
  11989. elem = this[ 0 ];
  11990. if ( !arguments.length ) {
  11991. if ( elem ) {
  11992. hooks = jQuery.valHooks[ elem.type ] ||
  11993. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  11994. if ( hooks &&
  11995. "get" in hooks &&
  11996. ( ret = hooks.get( elem, "value" ) ) !== undefined
  11997. ) {
  11998. return ret;
  11999. }
  12000. ret = elem.value;
  12001. // Handle most common string cases
  12002. if ( typeof ret === "string" ) {
  12003. return ret.replace( rreturn, "" );
  12004. }
  12005. // Handle cases where value is null/undef or number
  12006. return ret == null ? "" : ret;
  12007. }
  12008. return;
  12009. }
  12010. valueIsFunction = isFunction( value );
  12011. return this.each( function( i ) {
  12012. var val;
  12013. if ( this.nodeType !== 1 ) {
  12014. return;
  12015. }
  12016. if ( valueIsFunction ) {
  12017. val = value.call( this, i, jQuery( this ).val() );
  12018. } else {
  12019. val = value;
  12020. }
  12021. // Treat null/undefined as ""; convert numbers to string
  12022. if ( val == null ) {
  12023. val = "";
  12024. } else if ( typeof val === "number" ) {
  12025. val += "";
  12026. } else if ( Array.isArray( val ) ) {
  12027. val = jQuery.map( val, function( value ) {
  12028. return value == null ? "" : value + "";
  12029. } );
  12030. }
  12031. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  12032. // If set returns undefined, fall back to normal setting
  12033. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  12034. this.value = val;
  12035. }
  12036. } );
  12037. }
  12038. } );
  12039. jQuery.extend( {
  12040. valHooks: {
  12041. option: {
  12042. get: function( elem ) {
  12043. var val = jQuery.find.attr( elem, "value" );
  12044. return val != null ?
  12045. val :
  12046. // Support: IE <=10 - 11 only
  12047. // option.text throws exceptions (#14686, #14858)
  12048. // Strip and collapse whitespace
  12049. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  12050. stripAndCollapse( jQuery.text( elem ) );
  12051. }
  12052. },
  12053. select: {
  12054. get: function( elem ) {
  12055. var value, option, i,
  12056. options = elem.options,
  12057. index = elem.selectedIndex,
  12058. one = elem.type === "select-one",
  12059. values = one ? null : [],
  12060. max = one ? index + 1 : options.length;
  12061. if ( index < 0 ) {
  12062. i = max;
  12063. } else {
  12064. i = one ? index : 0;
  12065. }
  12066. // Loop through all the selected options
  12067. for ( ; i < max; i++ ) {
  12068. option = options[ i ];
  12069. // Support: IE <=9 only
  12070. // IE8-9 doesn't update selected after form reset (#2551)
  12071. if ( ( option.selected || i === index ) &&
  12072. // Don't return options that are disabled or in a disabled optgroup
  12073. !option.disabled &&
  12074. ( !option.parentNode.disabled ||
  12075. !nodeName( option.parentNode, "optgroup" ) ) ) {
  12076. // Get the specific value for the option
  12077. value = jQuery( option ).val();
  12078. // We don't need an array for one selects
  12079. if ( one ) {
  12080. return value;
  12081. }
  12082. // Multi-Selects return an array
  12083. values.push( value );
  12084. }
  12085. }
  12086. return values;
  12087. },
  12088. set: function( elem, value ) {
  12089. var optionSet, option,
  12090. options = elem.options,
  12091. values = jQuery.makeArray( value ),
  12092. i = options.length;
  12093. while ( i-- ) {
  12094. option = options[ i ];
  12095. /* eslint-disable no-cond-assign */
  12096. if ( option.selected =
  12097. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  12098. ) {
  12099. optionSet = true;
  12100. }
  12101. /* eslint-enable no-cond-assign */
  12102. }
  12103. // Force browsers to behave consistently when non-matching value is set
  12104. if ( !optionSet ) {
  12105. elem.selectedIndex = -1;
  12106. }
  12107. return values;
  12108. }
  12109. }
  12110. }
  12111. } );
  12112. // Radios and checkboxes getter/setter
  12113. jQuery.each( [ "radio", "checkbox" ], function() {
  12114. jQuery.valHooks[ this ] = {
  12115. set: function( elem, value ) {
  12116. if ( Array.isArray( value ) ) {
  12117. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  12118. }
  12119. }
  12120. };
  12121. if ( !support.checkOn ) {
  12122. jQuery.valHooks[ this ].get = function( elem ) {
  12123. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  12124. };
  12125. }
  12126. } );
  12127. // Return jQuery for attributes-only inclusion
  12128. support.focusin = "onfocusin" in window;
  12129. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  12130. stopPropagationCallback = function( e ) {
  12131. e.stopPropagation();
  12132. };
  12133. jQuery.extend( jQuery.event, {
  12134. trigger: function( event, data, elem, onlyHandlers ) {
  12135. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  12136. eventPath = [ elem || document ],
  12137. type = hasOwn.call( event, "type" ) ? event.type : event,
  12138. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  12139. cur = lastElement = tmp = elem = elem || document;
  12140. // Don't do events on text and comment nodes
  12141. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  12142. return;
  12143. }
  12144. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  12145. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  12146. return;
  12147. }
  12148. if ( type.indexOf( "." ) > -1 ) {
  12149. // Namespaced trigger; create a regexp to match event type in handle()
  12150. namespaces = type.split( "." );
  12151. type = namespaces.shift();
  12152. namespaces.sort();
  12153. }
  12154. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  12155. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  12156. event = event[ jQuery.expando ] ?
  12157. event :
  12158. new jQuery.Event( type, typeof event === "object" && event );
  12159. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  12160. event.isTrigger = onlyHandlers ? 2 : 3;
  12161. event.namespace = namespaces.join( "." );
  12162. event.rnamespace = event.namespace ?
  12163. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  12164. null;
  12165. // Clean up the event in case it is being reused
  12166. event.result = undefined;
  12167. if ( !event.target ) {
  12168. event.target = elem;
  12169. }
  12170. // Clone any incoming data and prepend the event, creating the handler arg list
  12171. data = data == null ?
  12172. [ event ] :
  12173. jQuery.makeArray( data, [ event ] );
  12174. // Allow special events to draw outside the lines
  12175. special = jQuery.event.special[ type ] || {};
  12176. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  12177. return;
  12178. }
  12179. // Determine event propagation path in advance, per W3C events spec (#9951)
  12180. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  12181. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  12182. bubbleType = special.delegateType || type;
  12183. if ( !rfocusMorph.test( bubbleType + type ) ) {
  12184. cur = cur.parentNode;
  12185. }
  12186. for ( ; cur; cur = cur.parentNode ) {
  12187. eventPath.push( cur );
  12188. tmp = cur;
  12189. }
  12190. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  12191. if ( tmp === ( elem.ownerDocument || document ) ) {
  12192. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  12193. }
  12194. }
  12195. // Fire handlers on the event path
  12196. i = 0;
  12197. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  12198. lastElement = cur;
  12199. event.type = i > 1 ?
  12200. bubbleType :
  12201. special.bindType || type;
  12202. // jQuery handler
  12203. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  12204. dataPriv.get( cur, "handle" );
  12205. if ( handle ) {
  12206. handle.apply( cur, data );
  12207. }
  12208. // Native handler
  12209. handle = ontype && cur[ ontype ];
  12210. if ( handle && handle.apply && acceptData( cur ) ) {
  12211. event.result = handle.apply( cur, data );
  12212. if ( event.result === false ) {
  12213. event.preventDefault();
  12214. }
  12215. }
  12216. }
  12217. event.type = type;
  12218. // If nobody prevented the default action, do it now
  12219. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  12220. if ( ( !special._default ||
  12221. special._default.apply( eventPath.pop(), data ) === false ) &&
  12222. acceptData( elem ) ) {
  12223. // Call a native DOM method on the target with the same name as the event.
  12224. // Don't do default actions on window, that's where global variables be (#6170)
  12225. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  12226. // Don't re-trigger an onFOO event when we call its FOO() method
  12227. tmp = elem[ ontype ];
  12228. if ( tmp ) {
  12229. elem[ ontype ] = null;
  12230. }
  12231. // Prevent re-triggering of the same event, since we already bubbled it above
  12232. jQuery.event.triggered = type;
  12233. if ( event.isPropagationStopped() ) {
  12234. lastElement.addEventListener( type, stopPropagationCallback );
  12235. }
  12236. elem[ type ]();
  12237. if ( event.isPropagationStopped() ) {
  12238. lastElement.removeEventListener( type, stopPropagationCallback );
  12239. }
  12240. jQuery.event.triggered = undefined;
  12241. if ( tmp ) {
  12242. elem[ ontype ] = tmp;
  12243. }
  12244. }
  12245. }
  12246. }
  12247. return event.result;
  12248. },
  12249. // Piggyback on a donor event to simulate a different one
  12250. // Used only for `focus(in | out)` events
  12251. simulate: function( type, elem, event ) {
  12252. var e = jQuery.extend(
  12253. new jQuery.Event(),
  12254. event,
  12255. {
  12256. type: type,
  12257. isSimulated: true
  12258. }
  12259. );
  12260. jQuery.event.trigger( e, null, elem );
  12261. }
  12262. } );
  12263. jQuery.fn.extend( {
  12264. trigger: function( type, data ) {
  12265. return this.each( function() {
  12266. jQuery.event.trigger( type, data, this );
  12267. } );
  12268. },
  12269. triggerHandler: function( type, data ) {
  12270. var elem = this[ 0 ];
  12271. if ( elem ) {
  12272. return jQuery.event.trigger( type, data, elem, true );
  12273. }
  12274. }
  12275. } );
  12276. // Support: Firefox <=44
  12277. // Firefox doesn't have focus(in | out) events
  12278. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  12279. //
  12280. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  12281. // focus(in | out) events fire after focus & blur events,
  12282. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  12283. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  12284. if ( !support.focusin ) {
  12285. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  12286. // Attach a single capturing handler on the document while someone wants focusin/focusout
  12287. var handler = function( event ) {
  12288. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  12289. };
  12290. jQuery.event.special[ fix ] = {
  12291. setup: function() {
  12292. var doc = this.ownerDocument || this,
  12293. attaches = dataPriv.access( doc, fix );
  12294. if ( !attaches ) {
  12295. doc.addEventListener( orig, handler, true );
  12296. }
  12297. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  12298. },
  12299. teardown: function() {
  12300. var doc = this.ownerDocument || this,
  12301. attaches = dataPriv.access( doc, fix ) - 1;
  12302. if ( !attaches ) {
  12303. doc.removeEventListener( orig, handler, true );
  12304. dataPriv.remove( doc, fix );
  12305. } else {
  12306. dataPriv.access( doc, fix, attaches );
  12307. }
  12308. }
  12309. };
  12310. } );
  12311. }
  12312. var location = window.location;
  12313. var nonce = Date.now();
  12314. var rquery = ( /\?/ );
  12315. // Cross-browser xml parsing
  12316. jQuery.parseXML = function( data ) {
  12317. var xml;
  12318. if ( !data || typeof data !== "string" ) {
  12319. return null;
  12320. }
  12321. // Support: IE 9 - 11 only
  12322. // IE throws on parseFromString with invalid input.
  12323. try {
  12324. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  12325. } catch ( e ) {
  12326. xml = undefined;
  12327. }
  12328. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  12329. jQuery.error( "Invalid XML: " + data );
  12330. }
  12331. return xml;
  12332. };
  12333. var
  12334. rbracket = /\[\]$/,
  12335. rCRLF = /\r?\n/g,
  12336. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  12337. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  12338. function buildParams( prefix, obj, traditional, add ) {
  12339. var name;
  12340. if ( Array.isArray( obj ) ) {
  12341. // Serialize array item.
  12342. jQuery.each( obj, function( i, v ) {
  12343. if ( traditional || rbracket.test( prefix ) ) {
  12344. // Treat each array item as a scalar.
  12345. add( prefix, v );
  12346. } else {
  12347. // Item is non-scalar (array or object), encode its numeric index.
  12348. buildParams(
  12349. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  12350. v,
  12351. traditional,
  12352. add
  12353. );
  12354. }
  12355. } );
  12356. } else if ( !traditional && toType( obj ) === "object" ) {
  12357. // Serialize object item.
  12358. for ( name in obj ) {
  12359. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  12360. }
  12361. } else {
  12362. // Serialize scalar item.
  12363. add( prefix, obj );
  12364. }
  12365. }
  12366. // Serialize an array of form elements or a set of
  12367. // key/values into a query string
  12368. jQuery.param = function( a, traditional ) {
  12369. var prefix,
  12370. s = [],
  12371. add = function( key, valueOrFunction ) {
  12372. // If value is a function, invoke it and use its return value
  12373. var value = isFunction( valueOrFunction ) ?
  12374. valueOrFunction() :
  12375. valueOrFunction;
  12376. s[ s.length ] = encodeURIComponent( key ) + "=" +
  12377. encodeURIComponent( value == null ? "" : value );
  12378. };
  12379. if ( a == null ) {
  12380. return "";
  12381. }
  12382. // If an array was passed in, assume that it is an array of form elements.
  12383. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  12384. // Serialize the form elements
  12385. jQuery.each( a, function() {
  12386. add( this.name, this.value );
  12387. } );
  12388. } else {
  12389. // If traditional, encode the "old" way (the way 1.3.2 or older
  12390. // did it), otherwise encode params recursively.
  12391. for ( prefix in a ) {
  12392. buildParams( prefix, a[ prefix ], traditional, add );
  12393. }
  12394. }
  12395. // Return the resulting serialization
  12396. return s.join( "&" );
  12397. };
  12398. jQuery.fn.extend( {
  12399. serialize: function() {
  12400. return jQuery.param( this.serializeArray() );
  12401. },
  12402. serializeArray: function() {
  12403. return this.map( function() {
  12404. // Can add propHook for "elements" to filter or add form elements
  12405. var elements = jQuery.prop( this, "elements" );
  12406. return elements ? jQuery.makeArray( elements ) : this;
  12407. } )
  12408. .filter( function() {
  12409. var type = this.type;
  12410. // Use .is( ":disabled" ) so that fieldset[disabled] works
  12411. return this.name && !jQuery( this ).is( ":disabled" ) &&
  12412. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  12413. ( this.checked || !rcheckableType.test( type ) );
  12414. } )
  12415. .map( function( i, elem ) {
  12416. var val = jQuery( this ).val();
  12417. if ( val == null ) {
  12418. return null;
  12419. }
  12420. if ( Array.isArray( val ) ) {
  12421. return jQuery.map( val, function( val ) {
  12422. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  12423. } );
  12424. }
  12425. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  12426. } ).get();
  12427. }
  12428. } );
  12429. var
  12430. r20 = /%20/g,
  12431. rhash = /#.*$/,
  12432. rantiCache = /([?&])_=[^&]*/,
  12433. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  12434. // #7653, #8125, #8152: local protocol detection
  12435. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  12436. rnoContent = /^(?:GET|HEAD)$/,
  12437. rprotocol = /^\/\//,
  12438. /* Prefilters
  12439. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  12440. * 2) These are called:
  12441. * - BEFORE asking for a transport
  12442. * - AFTER param serialization (s.data is a string if s.processData is true)
  12443. * 3) key is the dataType
  12444. * 4) the catchall symbol "*" can be used
  12445. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  12446. */
  12447. prefilters = {},
  12448. /* Transports bindings
  12449. * 1) key is the dataType
  12450. * 2) the catchall symbol "*" can be used
  12451. * 3) selection will start with transport dataType and THEN go to "*" if needed
  12452. */
  12453. transports = {},
  12454. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  12455. allTypes = "*/".concat( "*" ),
  12456. // Anchor tag for parsing the document origin
  12457. originAnchor = document.createElement( "a" );
  12458. originAnchor.href = location.href;
  12459. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  12460. function addToPrefiltersOrTransports( structure ) {
  12461. // dataTypeExpression is optional and defaults to "*"
  12462. return function( dataTypeExpression, func ) {
  12463. if ( typeof dataTypeExpression !== "string" ) {
  12464. func = dataTypeExpression;
  12465. dataTypeExpression = "*";
  12466. }
  12467. var dataType,
  12468. i = 0,
  12469. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  12470. if ( isFunction( func ) ) {
  12471. // For each dataType in the dataTypeExpression
  12472. while ( ( dataType = dataTypes[ i++ ] ) ) {
  12473. // Prepend if requested
  12474. if ( dataType[ 0 ] === "+" ) {
  12475. dataType = dataType.slice( 1 ) || "*";
  12476. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  12477. // Otherwise append
  12478. } else {
  12479. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  12480. }
  12481. }
  12482. }
  12483. };
  12484. }
  12485. // Base inspection function for prefilters and transports
  12486. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  12487. var inspected = {},
  12488. seekingTransport = ( structure === transports );
  12489. function inspect( dataType ) {
  12490. var selected;
  12491. inspected[ dataType ] = true;
  12492. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  12493. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  12494. if ( typeof dataTypeOrTransport === "string" &&
  12495. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  12496. options.dataTypes.unshift( dataTypeOrTransport );
  12497. inspect( dataTypeOrTransport );
  12498. return false;
  12499. } else if ( seekingTransport ) {
  12500. return !( selected = dataTypeOrTransport );
  12501. }
  12502. } );
  12503. return selected;
  12504. }
  12505. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  12506. }
  12507. // A special extend for ajax options
  12508. // that takes "flat" options (not to be deep extended)
  12509. // Fixes #9887
  12510. function ajaxExtend( target, src ) {
  12511. var key, deep,
  12512. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  12513. for ( key in src ) {
  12514. if ( src[ key ] !== undefined ) {
  12515. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  12516. }
  12517. }
  12518. if ( deep ) {
  12519. jQuery.extend( true, target, deep );
  12520. }
  12521. return target;
  12522. }
  12523. /* Handles responses to an ajax request:
  12524. * - finds the right dataType (mediates between content-type and expected dataType)
  12525. * - returns the corresponding response
  12526. */
  12527. function ajaxHandleResponses( s, jqXHR, responses ) {
  12528. var ct, type, finalDataType, firstDataType,
  12529. contents = s.contents,
  12530. dataTypes = s.dataTypes;
  12531. // Remove auto dataType and get content-type in the process
  12532. while ( dataTypes[ 0 ] === "*" ) {
  12533. dataTypes.shift();
  12534. if ( ct === undefined ) {
  12535. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  12536. }
  12537. }
  12538. // Check if we're dealing with a known content-type
  12539. if ( ct ) {
  12540. for ( type in contents ) {
  12541. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  12542. dataTypes.unshift( type );
  12543. break;
  12544. }
  12545. }
  12546. }
  12547. // Check to see if we have a response for the expected dataType
  12548. if ( dataTypes[ 0 ] in responses ) {
  12549. finalDataType = dataTypes[ 0 ];
  12550. } else {
  12551. // Try convertible dataTypes
  12552. for ( type in responses ) {
  12553. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  12554. finalDataType = type;
  12555. break;
  12556. }
  12557. if ( !firstDataType ) {
  12558. firstDataType = type;
  12559. }
  12560. }
  12561. // Or just use first one
  12562. finalDataType = finalDataType || firstDataType;
  12563. }
  12564. // If we found a dataType
  12565. // We add the dataType to the list if needed
  12566. // and return the corresponding response
  12567. if ( finalDataType ) {
  12568. if ( finalDataType !== dataTypes[ 0 ] ) {
  12569. dataTypes.unshift( finalDataType );
  12570. }
  12571. return responses[ finalDataType ];
  12572. }
  12573. }
  12574. /* Chain conversions given the request and the original response
  12575. * Also sets the responseXXX fields on the jqXHR instance
  12576. */
  12577. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  12578. var conv2, current, conv, tmp, prev,
  12579. converters = {},
  12580. // Work with a copy of dataTypes in case we need to modify it for conversion
  12581. dataTypes = s.dataTypes.slice();
  12582. // Create converters map with lowercased keys
  12583. if ( dataTypes[ 1 ] ) {
  12584. for ( conv in s.converters ) {
  12585. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  12586. }
  12587. }
  12588. current = dataTypes.shift();
  12589. // Convert to each sequential dataType
  12590. while ( current ) {
  12591. if ( s.responseFields[ current ] ) {
  12592. jqXHR[ s.responseFields[ current ] ] = response;
  12593. }
  12594. // Apply the dataFilter if provided
  12595. if ( !prev && isSuccess && s.dataFilter ) {
  12596. response = s.dataFilter( response, s.dataType );
  12597. }
  12598. prev = current;
  12599. current = dataTypes.shift();
  12600. if ( current ) {
  12601. // There's only work to do if current dataType is non-auto
  12602. if ( current === "*" ) {
  12603. current = prev;
  12604. // Convert response if prev dataType is non-auto and differs from current
  12605. } else if ( prev !== "*" && prev !== current ) {
  12606. // Seek a direct converter
  12607. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  12608. // If none found, seek a pair
  12609. if ( !conv ) {
  12610. for ( conv2 in converters ) {
  12611. // If conv2 outputs current
  12612. tmp = conv2.split( " " );
  12613. if ( tmp[ 1 ] === current ) {
  12614. // If prev can be converted to accepted input
  12615. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  12616. converters[ "* " + tmp[ 0 ] ];
  12617. if ( conv ) {
  12618. // Condense equivalence converters
  12619. if ( conv === true ) {
  12620. conv = converters[ conv2 ];
  12621. // Otherwise, insert the intermediate dataType
  12622. } else if ( converters[ conv2 ] !== true ) {
  12623. current = tmp[ 0 ];
  12624. dataTypes.unshift( tmp[ 1 ] );
  12625. }
  12626. break;
  12627. }
  12628. }
  12629. }
  12630. }
  12631. // Apply converter (if not an equivalence)
  12632. if ( conv !== true ) {
  12633. // Unless errors are allowed to bubble, catch and return them
  12634. if ( conv && s.throws ) {
  12635. response = conv( response );
  12636. } else {
  12637. try {
  12638. response = conv( response );
  12639. } catch ( e ) {
  12640. return {
  12641. state: "parsererror",
  12642. error: conv ? e : "No conversion from " + prev + " to " + current
  12643. };
  12644. }
  12645. }
  12646. }
  12647. }
  12648. }
  12649. }
  12650. return { state: "success", data: response };
  12651. }
  12652. jQuery.extend( {
  12653. // Counter for holding the number of active queries
  12654. active: 0,
  12655. // Last-Modified header cache for next request
  12656. lastModified: {},
  12657. etag: {},
  12658. ajaxSettings: {
  12659. url: location.href,
  12660. type: "GET",
  12661. isLocal: rlocalProtocol.test( location.protocol ),
  12662. global: true,
  12663. processData: true,
  12664. async: true,
  12665. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  12666. /*
  12667. timeout: 0,
  12668. data: null,
  12669. dataType: null,
  12670. username: null,
  12671. password: null,
  12672. cache: null,
  12673. throws: false,
  12674. traditional: false,
  12675. headers: {},
  12676. */
  12677. accepts: {
  12678. "*": allTypes,
  12679. text: "text/plain",
  12680. html: "text/html",
  12681. xml: "application/xml, text/xml",
  12682. json: "application/json, text/javascript"
  12683. },
  12684. contents: {
  12685. xml: /\bxml\b/,
  12686. html: /\bhtml/,
  12687. json: /\bjson\b/
  12688. },
  12689. responseFields: {
  12690. xml: "responseXML",
  12691. text: "responseText",
  12692. json: "responseJSON"
  12693. },
  12694. // Data converters
  12695. // Keys separate source (or catchall "*") and destination types with a single space
  12696. converters: {
  12697. // Convert anything to text
  12698. "* text": String,
  12699. // Text to html (true = no transformation)
  12700. "text html": true,
  12701. // Evaluate text as a json expression
  12702. "text json": JSON.parse,
  12703. // Parse text as xml
  12704. "text xml": jQuery.parseXML
  12705. },
  12706. // For options that shouldn't be deep extended:
  12707. // you can add your own custom options here if
  12708. // and when you create one that shouldn't be
  12709. // deep extended (see ajaxExtend)
  12710. flatOptions: {
  12711. url: true,
  12712. context: true
  12713. }
  12714. },
  12715. // Creates a full fledged settings object into target
  12716. // with both ajaxSettings and settings fields.
  12717. // If target is omitted, writes into ajaxSettings.
  12718. ajaxSetup: function( target, settings ) {
  12719. return settings ?
  12720. // Building a settings object
  12721. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  12722. // Extending ajaxSettings
  12723. ajaxExtend( jQuery.ajaxSettings, target );
  12724. },
  12725. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  12726. ajaxTransport: addToPrefiltersOrTransports( transports ),
  12727. // Main method
  12728. ajax: function( url, options ) {
  12729. // If url is an object, simulate pre-1.5 signature
  12730. if ( typeof url === "object" ) {
  12731. options = url;
  12732. url = undefined;
  12733. }
  12734. // Force options to be an object
  12735. options = options || {};
  12736. var transport,
  12737. // URL without anti-cache param
  12738. cacheURL,
  12739. // Response headers
  12740. responseHeadersString,
  12741. responseHeaders,
  12742. // timeout handle
  12743. timeoutTimer,
  12744. // Url cleanup var
  12745. urlAnchor,
  12746. // Request state (becomes false upon send and true upon completion)
  12747. completed,
  12748. // To know if global events are to be dispatched
  12749. fireGlobals,
  12750. // Loop variable
  12751. i,
  12752. // uncached part of the url
  12753. uncached,
  12754. // Create the final options object
  12755. s = jQuery.ajaxSetup( {}, options ),
  12756. // Callbacks context
  12757. callbackContext = s.context || s,
  12758. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  12759. globalEventContext = s.context &&
  12760. ( callbackContext.nodeType || callbackContext.jquery ) ?
  12761. jQuery( callbackContext ) :
  12762. jQuery.event,
  12763. // Deferreds
  12764. deferred = jQuery.Deferred(),
  12765. completeDeferred = jQuery.Callbacks( "once memory" ),
  12766. // Status-dependent callbacks
  12767. statusCode = s.statusCode || {},
  12768. // Headers (they are sent all at once)
  12769. requestHeaders = {},
  12770. requestHeadersNames = {},
  12771. // Default abort message
  12772. strAbort = "canceled",
  12773. // Fake xhr
  12774. jqXHR = {
  12775. readyState: 0,
  12776. // Builds headers hashtable if needed
  12777. getResponseHeader: function( key ) {
  12778. var match;
  12779. if ( completed ) {
  12780. if ( !responseHeaders ) {
  12781. responseHeaders = {};
  12782. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  12783. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  12784. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  12785. .concat( match[ 2 ] );
  12786. }
  12787. }
  12788. match = responseHeaders[ key.toLowerCase() + " " ];
  12789. }
  12790. return match == null ? null : match.join( ", " );
  12791. },
  12792. // Raw string
  12793. getAllResponseHeaders: function() {
  12794. return completed ? responseHeadersString : null;
  12795. },
  12796. // Caches the header
  12797. setRequestHeader: function( name, value ) {
  12798. if ( completed == null ) {
  12799. name = requestHeadersNames[ name.toLowerCase() ] =
  12800. requestHeadersNames[ name.toLowerCase() ] || name;
  12801. requestHeaders[ name ] = value;
  12802. }
  12803. return this;
  12804. },
  12805. // Overrides response content-type header
  12806. overrideMimeType: function( type ) {
  12807. if ( completed == null ) {
  12808. s.mimeType = type;
  12809. }
  12810. return this;
  12811. },
  12812. // Status-dependent callbacks
  12813. statusCode: function( map ) {
  12814. var code;
  12815. if ( map ) {
  12816. if ( completed ) {
  12817. // Execute the appropriate callbacks
  12818. jqXHR.always( map[ jqXHR.status ] );
  12819. } else {
  12820. // Lazy-add the new callbacks in a way that preserves old ones
  12821. for ( code in map ) {
  12822. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  12823. }
  12824. }
  12825. }
  12826. return this;
  12827. },
  12828. // Cancel the request
  12829. abort: function( statusText ) {
  12830. var finalText = statusText || strAbort;
  12831. if ( transport ) {
  12832. transport.abort( finalText );
  12833. }
  12834. done( 0, finalText );
  12835. return this;
  12836. }
  12837. };
  12838. // Attach deferreds
  12839. deferred.promise( jqXHR );
  12840. // Add protocol if not provided (prefilters might expect it)
  12841. // Handle falsy url in the settings object (#10093: consistency with old signature)
  12842. // We also use the url parameter if available
  12843. s.url = ( ( url || s.url || location.href ) + "" )
  12844. .replace( rprotocol, location.protocol + "//" );
  12845. // Alias method option to type as per ticket #12004
  12846. s.type = options.method || options.type || s.method || s.type;
  12847. // Extract dataTypes list
  12848. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  12849. // A cross-domain request is in order when the origin doesn't match the current origin.
  12850. if ( s.crossDomain == null ) {
  12851. urlAnchor = document.createElement( "a" );
  12852. // Support: IE <=8 - 11, Edge 12 - 15
  12853. // IE throws exception on accessing the href property if url is malformed,
  12854. // e.g. http://example.com:80x/
  12855. try {
  12856. urlAnchor.href = s.url;
  12857. // Support: IE <=8 - 11 only
  12858. // Anchor's host property isn't correctly set when s.url is relative
  12859. urlAnchor.href = urlAnchor.href;
  12860. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  12861. urlAnchor.protocol + "//" + urlAnchor.host;
  12862. } catch ( e ) {
  12863. // If there is an error parsing the URL, assume it is crossDomain,
  12864. // it can be rejected by the transport if it is invalid
  12865. s.crossDomain = true;
  12866. }
  12867. }
  12868. // Convert data if not already a string
  12869. if ( s.data && s.processData && typeof s.data !== "string" ) {
  12870. s.data = jQuery.param( s.data, s.traditional );
  12871. }
  12872. // Apply prefilters
  12873. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  12874. // If request was aborted inside a prefilter, stop there
  12875. if ( completed ) {
  12876. return jqXHR;
  12877. }
  12878. // We can fire global events as of now if asked to
  12879. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  12880. fireGlobals = jQuery.event && s.global;
  12881. // Watch for a new set of requests
  12882. if ( fireGlobals && jQuery.active++ === 0 ) {
  12883. jQuery.event.trigger( "ajaxStart" );
  12884. }
  12885. // Uppercase the type
  12886. s.type = s.type.toUpperCase();
  12887. // Determine if request has content
  12888. s.hasContent = !rnoContent.test( s.type );
  12889. // Save the URL in case we're toying with the If-Modified-Since
  12890. // and/or If-None-Match header later on
  12891. // Remove hash to simplify url manipulation
  12892. cacheURL = s.url.replace( rhash, "" );
  12893. // More options handling for requests with no content
  12894. if ( !s.hasContent ) {
  12895. // Remember the hash so we can put it back
  12896. uncached = s.url.slice( cacheURL.length );
  12897. // If data is available and should be processed, append data to url
  12898. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  12899. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  12900. // #9682: remove data so that it's not used in an eventual retry
  12901. delete s.data;
  12902. }
  12903. // Add or update anti-cache param if needed
  12904. if ( s.cache === false ) {
  12905. cacheURL = cacheURL.replace( rantiCache, "$1" );
  12906. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  12907. }
  12908. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  12909. s.url = cacheURL + uncached;
  12910. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  12911. } else if ( s.data && s.processData &&
  12912. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  12913. s.data = s.data.replace( r20, "+" );
  12914. }
  12915. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  12916. if ( s.ifModified ) {
  12917. if ( jQuery.lastModified[ cacheURL ] ) {
  12918. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  12919. }
  12920. if ( jQuery.etag[ cacheURL ] ) {
  12921. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  12922. }
  12923. }
  12924. // Set the correct header, if data is being sent
  12925. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  12926. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  12927. }
  12928. // Set the Accepts header for the server, depending on the dataType
  12929. jqXHR.setRequestHeader(
  12930. "Accept",
  12931. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  12932. s.accepts[ s.dataTypes[ 0 ] ] +
  12933. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  12934. s.accepts[ "*" ]
  12935. );
  12936. // Check for headers option
  12937. for ( i in s.headers ) {
  12938. jqXHR.setRequestHeader( i, s.headers[ i ] );
  12939. }
  12940. // Allow custom headers/mimetypes and early abort
  12941. if ( s.beforeSend &&
  12942. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  12943. // Abort if not done already and return
  12944. return jqXHR.abort();
  12945. }
  12946. // Aborting is no longer a cancellation
  12947. strAbort = "abort";
  12948. // Install callbacks on deferreds
  12949. completeDeferred.add( s.complete );
  12950. jqXHR.done( s.success );
  12951. jqXHR.fail( s.error );
  12952. // Get transport
  12953. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  12954. // If no transport, we auto-abort
  12955. if ( !transport ) {
  12956. done( -1, "No Transport" );
  12957. } else {
  12958. jqXHR.readyState = 1;
  12959. // Send global event
  12960. if ( fireGlobals ) {
  12961. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  12962. }
  12963. // If request was aborted inside ajaxSend, stop there
  12964. if ( completed ) {
  12965. return jqXHR;
  12966. }
  12967. // Timeout
  12968. if ( s.async && s.timeout > 0 ) {
  12969. timeoutTimer = window.setTimeout( function() {
  12970. jqXHR.abort( "timeout" );
  12971. }, s.timeout );
  12972. }
  12973. try {
  12974. completed = false;
  12975. transport.send( requestHeaders, done );
  12976. } catch ( e ) {
  12977. // Rethrow post-completion exceptions
  12978. if ( completed ) {
  12979. throw e;
  12980. }
  12981. // Propagate others as results
  12982. done( -1, e );
  12983. }
  12984. }
  12985. // Callback for when everything is done
  12986. function done( status, nativeStatusText, responses, headers ) {
  12987. var isSuccess, success, error, response, modified,
  12988. statusText = nativeStatusText;
  12989. // Ignore repeat invocations
  12990. if ( completed ) {
  12991. return;
  12992. }
  12993. completed = true;
  12994. // Clear timeout if it exists
  12995. if ( timeoutTimer ) {
  12996. window.clearTimeout( timeoutTimer );
  12997. }
  12998. // Dereference transport for early garbage collection
  12999. // (no matter how long the jqXHR object will be used)
  13000. transport = undefined;
  13001. // Cache response headers
  13002. responseHeadersString = headers || "";
  13003. // Set readyState
  13004. jqXHR.readyState = status > 0 ? 4 : 0;
  13005. // Determine if successful
  13006. isSuccess = status >= 200 && status < 300 || status === 304;
  13007. // Get response data
  13008. if ( responses ) {
  13009. response = ajaxHandleResponses( s, jqXHR, responses );
  13010. }
  13011. // Convert no matter what (that way responseXXX fields are always set)
  13012. response = ajaxConvert( s, response, jqXHR, isSuccess );
  13013. // If successful, handle type chaining
  13014. if ( isSuccess ) {
  13015. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  13016. if ( s.ifModified ) {
  13017. modified = jqXHR.getResponseHeader( "Last-Modified" );
  13018. if ( modified ) {
  13019. jQuery.lastModified[ cacheURL ] = modified;
  13020. }
  13021. modified = jqXHR.getResponseHeader( "etag" );
  13022. if ( modified ) {
  13023. jQuery.etag[ cacheURL ] = modified;
  13024. }
  13025. }
  13026. // if no content
  13027. if ( status === 204 || s.type === "HEAD" ) {
  13028. statusText = "nocontent";
  13029. // if not modified
  13030. } else if ( status === 304 ) {
  13031. statusText = "notmodified";
  13032. // If we have data, let's convert it
  13033. } else {
  13034. statusText = response.state;
  13035. success = response.data;
  13036. error = response.error;
  13037. isSuccess = !error;
  13038. }
  13039. } else {
  13040. // Extract error from statusText and normalize for non-aborts
  13041. error = statusText;
  13042. if ( status || !statusText ) {
  13043. statusText = "error";
  13044. if ( status < 0 ) {
  13045. status = 0;
  13046. }
  13047. }
  13048. }
  13049. // Set data for the fake xhr object
  13050. jqXHR.status = status;
  13051. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  13052. // Success/Error
  13053. if ( isSuccess ) {
  13054. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  13055. } else {
  13056. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  13057. }
  13058. // Status-dependent callbacks
  13059. jqXHR.statusCode( statusCode );
  13060. statusCode = undefined;
  13061. if ( fireGlobals ) {
  13062. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  13063. [ jqXHR, s, isSuccess ? success : error ] );
  13064. }
  13065. // Complete
  13066. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  13067. if ( fireGlobals ) {
  13068. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  13069. // Handle the global AJAX counter
  13070. if ( !( --jQuery.active ) ) {
  13071. jQuery.event.trigger( "ajaxStop" );
  13072. }
  13073. }
  13074. }
  13075. return jqXHR;
  13076. },
  13077. getJSON: function( url, data, callback ) {
  13078. return jQuery.get( url, data, callback, "json" );
  13079. },
  13080. getScript: function( url, callback ) {
  13081. return jQuery.get( url, undefined, callback, "script" );
  13082. }
  13083. } );
  13084. jQuery.each( [ "get", "post" ], function( i, method ) {
  13085. jQuery[ method ] = function( url, data, callback, type ) {
  13086. // Shift arguments if data argument was omitted
  13087. if ( isFunction( data ) ) {
  13088. type = type || callback;
  13089. callback = data;
  13090. data = undefined;
  13091. }
  13092. // The url can be an options object (which then must have .url)
  13093. return jQuery.ajax( jQuery.extend( {
  13094. url: url,
  13095. type: method,
  13096. dataType: type,
  13097. data: data,
  13098. success: callback
  13099. }, jQuery.isPlainObject( url ) && url ) );
  13100. };
  13101. } );
  13102. jQuery._evalUrl = function( url, options ) {
  13103. return jQuery.ajax( {
  13104. url: url,
  13105. // Make this explicit, since user can override this through ajaxSetup (#11264)
  13106. type: "GET",
  13107. dataType: "script",
  13108. cache: true,
  13109. async: false,
  13110. global: false,
  13111. // Only evaluate the response if it is successful (gh-4126)
  13112. // dataFilter is not invoked for failure responses, so using it instead
  13113. // of the default converter is kludgy but it works.
  13114. converters: {
  13115. "text script": function() {}
  13116. },
  13117. dataFilter: function( response ) {
  13118. jQuery.globalEval( response, options );
  13119. }
  13120. } );
  13121. };
  13122. jQuery.fn.extend( {
  13123. wrapAll: function( html ) {
  13124. var wrap;
  13125. if ( this[ 0 ] ) {
  13126. if ( isFunction( html ) ) {
  13127. html = html.call( this[ 0 ] );
  13128. }
  13129. // The elements to wrap the target around
  13130. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  13131. if ( this[ 0 ].parentNode ) {
  13132. wrap.insertBefore( this[ 0 ] );
  13133. }
  13134. wrap.map( function() {
  13135. var elem = this;
  13136. while ( elem.firstElementChild ) {
  13137. elem = elem.firstElementChild;
  13138. }
  13139. return elem;
  13140. } ).append( this );
  13141. }
  13142. return this;
  13143. },
  13144. wrapInner: function( html ) {
  13145. if ( isFunction( html ) ) {
  13146. return this.each( function( i ) {
  13147. jQuery( this ).wrapInner( html.call( this, i ) );
  13148. } );
  13149. }
  13150. return this.each( function() {
  13151. var self = jQuery( this ),
  13152. contents = self.contents();
  13153. if ( contents.length ) {
  13154. contents.wrapAll( html );
  13155. } else {
  13156. self.append( html );
  13157. }
  13158. } );
  13159. },
  13160. wrap: function( html ) {
  13161. var htmlIsFunction = isFunction( html );
  13162. return this.each( function( i ) {
  13163. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  13164. } );
  13165. },
  13166. unwrap: function( selector ) {
  13167. this.parent( selector ).not( "body" ).each( function() {
  13168. jQuery( this ).replaceWith( this.childNodes );
  13169. } );
  13170. return this;
  13171. }
  13172. } );
  13173. jQuery.expr.pseudos.hidden = function( elem ) {
  13174. return !jQuery.expr.pseudos.visible( elem );
  13175. };
  13176. jQuery.expr.pseudos.visible = function( elem ) {
  13177. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  13178. };
  13179. jQuery.ajaxSettings.xhr = function() {
  13180. try {
  13181. return new window.XMLHttpRequest();
  13182. } catch ( e ) {}
  13183. };
  13184. var xhrSuccessStatus = {
  13185. // File protocol always yields status code 0, assume 200
  13186. 0: 200,
  13187. // Support: IE <=9 only
  13188. // #1450: sometimes IE returns 1223 when it should be 204
  13189. 1223: 204
  13190. },
  13191. xhrSupported = jQuery.ajaxSettings.xhr();
  13192. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  13193. support.ajax = xhrSupported = !!xhrSupported;
  13194. jQuery.ajaxTransport( function( options ) {
  13195. var callback, errorCallback;
  13196. // Cross domain only allowed if supported through XMLHttpRequest
  13197. if ( support.cors || xhrSupported && !options.crossDomain ) {
  13198. return {
  13199. send: function( headers, complete ) {
  13200. var i,
  13201. xhr = options.xhr();
  13202. xhr.open(
  13203. options.type,
  13204. options.url,
  13205. options.async,
  13206. options.username,
  13207. options.password
  13208. );
  13209. // Apply custom fields if provided
  13210. if ( options.xhrFields ) {
  13211. for ( i in options.xhrFields ) {
  13212. xhr[ i ] = options.xhrFields[ i ];
  13213. }
  13214. }
  13215. // Override mime type if needed
  13216. if ( options.mimeType && xhr.overrideMimeType ) {
  13217. xhr.overrideMimeType( options.mimeType );
  13218. }
  13219. // X-Requested-With header
  13220. // For cross-domain requests, seeing as conditions for a preflight are
  13221. // akin to a jigsaw puzzle, we simply never set it to be sure.
  13222. // (it can always be set on a per-request basis or even using ajaxSetup)
  13223. // For same-domain requests, won't change header if already provided.
  13224. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  13225. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  13226. }
  13227. // Set headers
  13228. for ( i in headers ) {
  13229. xhr.setRequestHeader( i, headers[ i ] );
  13230. }
  13231. // Callback
  13232. callback = function( type ) {
  13233. return function() {
  13234. if ( callback ) {
  13235. callback = errorCallback = xhr.onload =
  13236. xhr.onerror = xhr.onabort = xhr.ontimeout =
  13237. xhr.onreadystatechange = null;
  13238. if ( type === "abort" ) {
  13239. xhr.abort();
  13240. } else if ( type === "error" ) {
  13241. // Support: IE <=9 only
  13242. // On a manual native abort, IE9 throws
  13243. // errors on any property access that is not readyState
  13244. if ( typeof xhr.status !== "number" ) {
  13245. complete( 0, "error" );
  13246. } else {
  13247. complete(
  13248. // File: protocol always yields status 0; see #8605, #14207
  13249. xhr.status,
  13250. xhr.statusText
  13251. );
  13252. }
  13253. } else {
  13254. complete(
  13255. xhrSuccessStatus[ xhr.status ] || xhr.status,
  13256. xhr.statusText,
  13257. // Support: IE <=9 only
  13258. // IE9 has no XHR2 but throws on binary (trac-11426)
  13259. // For XHR2 non-text, let the caller handle it (gh-2498)
  13260. ( xhr.responseType || "text" ) !== "text" ||
  13261. typeof xhr.responseText !== "string" ?
  13262. { binary: xhr.response } :
  13263. { text: xhr.responseText },
  13264. xhr.getAllResponseHeaders()
  13265. );
  13266. }
  13267. }
  13268. };
  13269. };
  13270. // Listen to events
  13271. xhr.onload = callback();
  13272. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  13273. // Support: IE 9 only
  13274. // Use onreadystatechange to replace onabort
  13275. // to handle uncaught aborts
  13276. if ( xhr.onabort !== undefined ) {
  13277. xhr.onabort = errorCallback;
  13278. } else {
  13279. xhr.onreadystatechange = function() {
  13280. // Check readyState before timeout as it changes
  13281. if ( xhr.readyState === 4 ) {
  13282. // Allow onerror to be called first,
  13283. // but that will not handle a native abort
  13284. // Also, save errorCallback to a variable
  13285. // as xhr.onerror cannot be accessed
  13286. window.setTimeout( function() {
  13287. if ( callback ) {
  13288. errorCallback();
  13289. }
  13290. } );
  13291. }
  13292. };
  13293. }
  13294. // Create the abort callback
  13295. callback = callback( "abort" );
  13296. try {
  13297. // Do send the request (this may raise an exception)
  13298. xhr.send( options.hasContent && options.data || null );
  13299. } catch ( e ) {
  13300. // #14683: Only rethrow if this hasn't been notified as an error yet
  13301. if ( callback ) {
  13302. throw e;
  13303. }
  13304. }
  13305. },
  13306. abort: function() {
  13307. if ( callback ) {
  13308. callback();
  13309. }
  13310. }
  13311. };
  13312. }
  13313. } );
  13314. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  13315. jQuery.ajaxPrefilter( function( s ) {
  13316. if ( s.crossDomain ) {
  13317. s.contents.script = false;
  13318. }
  13319. } );
  13320. // Install script dataType
  13321. jQuery.ajaxSetup( {
  13322. accepts: {
  13323. script: "text/javascript, application/javascript, " +
  13324. "application/ecmascript, application/x-ecmascript"
  13325. },
  13326. contents: {
  13327. script: /\b(?:java|ecma)script\b/
  13328. },
  13329. converters: {
  13330. "text script": function( text ) {
  13331. jQuery.globalEval( text );
  13332. return text;
  13333. }
  13334. }
  13335. } );
  13336. // Handle cache's special case and crossDomain
  13337. jQuery.ajaxPrefilter( "script", function( s ) {
  13338. if ( s.cache === undefined ) {
  13339. s.cache = false;
  13340. }
  13341. if ( s.crossDomain ) {
  13342. s.type = "GET";
  13343. }
  13344. } );
  13345. // Bind script tag hack transport
  13346. jQuery.ajaxTransport( "script", function( s ) {
  13347. // This transport only deals with cross domain or forced-by-attrs requests
  13348. if ( s.crossDomain || s.scriptAttrs ) {
  13349. var script, callback;
  13350. return {
  13351. send: function( _, complete ) {
  13352. script = jQuery( "<script>" )
  13353. .attr( s.scriptAttrs || {} )
  13354. .prop( { charset: s.scriptCharset, src: s.url } )
  13355. .on( "load error", callback = function( evt ) {
  13356. script.remove();
  13357. callback = null;
  13358. if ( evt ) {
  13359. complete( evt.type === "error" ? 404 : 200, evt.type );
  13360. }
  13361. } );
  13362. // Use native DOM manipulation to avoid our domManip AJAX trickery
  13363. document.head.appendChild( script[ 0 ] );
  13364. },
  13365. abort: function() {
  13366. if ( callback ) {
  13367. callback();
  13368. }
  13369. }
  13370. };
  13371. }
  13372. } );
  13373. var oldCallbacks = [],
  13374. rjsonp = /(=)\?(?=&|$)|\?\?/;
  13375. // Default jsonp settings
  13376. jQuery.ajaxSetup( {
  13377. jsonp: "callback",
  13378. jsonpCallback: function() {
  13379. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  13380. this[ callback ] = true;
  13381. return callback;
  13382. }
  13383. } );
  13384. // Detect, normalize options and install callbacks for jsonp requests
  13385. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  13386. var callbackName, overwritten, responseContainer,
  13387. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  13388. "url" :
  13389. typeof s.data === "string" &&
  13390. ( s.contentType || "" )
  13391. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  13392. rjsonp.test( s.data ) && "data"
  13393. );
  13394. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  13395. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  13396. // Get callback name, remembering preexisting value associated with it
  13397. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  13398. s.jsonpCallback() :
  13399. s.jsonpCallback;
  13400. // Insert callback into url or form data
  13401. if ( jsonProp ) {
  13402. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  13403. } else if ( s.jsonp !== false ) {
  13404. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  13405. }
  13406. // Use data converter to retrieve json after script execution
  13407. s.converters[ "script json" ] = function() {
  13408. if ( !responseContainer ) {
  13409. jQuery.error( callbackName + " was not called" );
  13410. }
  13411. return responseContainer[ 0 ];
  13412. };
  13413. // Force json dataType
  13414. s.dataTypes[ 0 ] = "json";
  13415. // Install callback
  13416. overwritten = window[ callbackName ];
  13417. window[ callbackName ] = function() {
  13418. responseContainer = arguments;
  13419. };
  13420. // Clean-up function (fires after converters)
  13421. jqXHR.always( function() {
  13422. // If previous value didn't exist - remove it
  13423. if ( overwritten === undefined ) {
  13424. jQuery( window ).removeProp( callbackName );
  13425. // Otherwise restore preexisting value
  13426. } else {
  13427. window[ callbackName ] = overwritten;
  13428. }
  13429. // Save back as free
  13430. if ( s[ callbackName ] ) {
  13431. // Make sure that re-using the options doesn't screw things around
  13432. s.jsonpCallback = originalSettings.jsonpCallback;
  13433. // Save the callback name for future use
  13434. oldCallbacks.push( callbackName );
  13435. }
  13436. // Call if it was a function and we have a response
  13437. if ( responseContainer && isFunction( overwritten ) ) {
  13438. overwritten( responseContainer[ 0 ] );
  13439. }
  13440. responseContainer = overwritten = undefined;
  13441. } );
  13442. // Delegate to script
  13443. return "script";
  13444. }
  13445. } );
  13446. // Support: Safari 8 only
  13447. // In Safari 8 documents created via document.implementation.createHTMLDocument
  13448. // collapse sibling forms: the second one becomes a child of the first one.
  13449. // Because of that, this security measure has to be disabled in Safari 8.
  13450. // https://bugs.webkit.org/show_bug.cgi?id=137337
  13451. support.createHTMLDocument = ( function() {
  13452. var body = document.implementation.createHTMLDocument( "" ).body;
  13453. body.innerHTML = "<form></form><form></form>";
  13454. return body.childNodes.length === 2;
  13455. } )();
  13456. // Argument "data" should be string of html
  13457. // context (optional): If specified, the fragment will be created in this context,
  13458. // defaults to document
  13459. // keepScripts (optional): If true, will include scripts passed in the html string
  13460. jQuery.parseHTML = function( data, context, keepScripts ) {
  13461. if ( typeof data !== "string" ) {
  13462. return [];
  13463. }
  13464. if ( typeof context === "boolean" ) {
  13465. keepScripts = context;
  13466. context = false;
  13467. }
  13468. var base, parsed, scripts;
  13469. if ( !context ) {
  13470. // Stop scripts or inline event handlers from being executed immediately
  13471. // by using document.implementation
  13472. if ( support.createHTMLDocument ) {
  13473. context = document.implementation.createHTMLDocument( "" );
  13474. // Set the base href for the created document
  13475. // so any parsed elements with URLs
  13476. // are based on the document's URL (gh-2965)
  13477. base = context.createElement( "base" );
  13478. base.href = document.location.href;
  13479. context.head.appendChild( base );
  13480. } else {
  13481. context = document;
  13482. }
  13483. }
  13484. parsed = rsingleTag.exec( data );
  13485. scripts = !keepScripts && [];
  13486. // Single tag
  13487. if ( parsed ) {
  13488. return [ context.createElement( parsed[ 1 ] ) ];
  13489. }
  13490. parsed = buildFragment( [ data ], context, scripts );
  13491. if ( scripts && scripts.length ) {
  13492. jQuery( scripts ).remove();
  13493. }
  13494. return jQuery.merge( [], parsed.childNodes );
  13495. };
  13496. /**
  13497. * Load a url into a page
  13498. */
  13499. jQuery.fn.load = function( url, params, callback ) {
  13500. var selector, type, response,
  13501. self = this,
  13502. off = url.indexOf( " " );
  13503. if ( off > -1 ) {
  13504. selector = stripAndCollapse( url.slice( off ) );
  13505. url = url.slice( 0, off );
  13506. }
  13507. // If it's a function
  13508. if ( isFunction( params ) ) {
  13509. // We assume that it's the callback
  13510. callback = params;
  13511. params = undefined;
  13512. // Otherwise, build a param string
  13513. } else if ( params && typeof params === "object" ) {
  13514. type = "POST";
  13515. }
  13516. // If we have elements to modify, make the request
  13517. if ( self.length > 0 ) {
  13518. jQuery.ajax( {
  13519. url: url,
  13520. // If "type" variable is undefined, then "GET" method will be used.
  13521. // Make value of this field explicit since
  13522. // user can override it through ajaxSetup method
  13523. type: type || "GET",
  13524. dataType: "html",
  13525. data: params
  13526. } ).done( function( responseText ) {
  13527. // Save response for use in complete callback
  13528. response = arguments;
  13529. self.html( selector ?
  13530. // If a selector was specified, locate the right elements in a dummy div
  13531. // Exclude scripts to avoid IE 'Permission Denied' errors
  13532. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  13533. // Otherwise use the full result
  13534. responseText );
  13535. // If the request succeeds, this function gets "data", "status", "jqXHR"
  13536. // but they are ignored because response was set above.
  13537. // If it fails, this function gets "jqXHR", "status", "error"
  13538. } ).always( callback && function( jqXHR, status ) {
  13539. self.each( function() {
  13540. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  13541. } );
  13542. } );
  13543. }
  13544. return this;
  13545. };
  13546. // Attach a bunch of functions for handling common AJAX events
  13547. jQuery.each( [
  13548. "ajaxStart",
  13549. "ajaxStop",
  13550. "ajaxComplete",
  13551. "ajaxError",
  13552. "ajaxSuccess",
  13553. "ajaxSend"
  13554. ], function( i, type ) {
  13555. jQuery.fn[ type ] = function( fn ) {
  13556. return this.on( type, fn );
  13557. };
  13558. } );
  13559. jQuery.expr.pseudos.animated = function( elem ) {
  13560. return jQuery.grep( jQuery.timers, function( fn ) {
  13561. return elem === fn.elem;
  13562. } ).length;
  13563. };
  13564. jQuery.offset = {
  13565. setOffset: function( elem, options, i ) {
  13566. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  13567. position = jQuery.css( elem, "position" ),
  13568. curElem = jQuery( elem ),
  13569. props = {};
  13570. // Set position first, in-case top/left are set even on static elem
  13571. if ( position === "static" ) {
  13572. elem.style.position = "relative";
  13573. }
  13574. curOffset = curElem.offset();
  13575. curCSSTop = jQuery.css( elem, "top" );
  13576. curCSSLeft = jQuery.css( elem, "left" );
  13577. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  13578. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  13579. // Need to be able to calculate position if either
  13580. // top or left is auto and position is either absolute or fixed
  13581. if ( calculatePosition ) {
  13582. curPosition = curElem.position();
  13583. curTop = curPosition.top;
  13584. curLeft = curPosition.left;
  13585. } else {
  13586. curTop = parseFloat( curCSSTop ) || 0;
  13587. curLeft = parseFloat( curCSSLeft ) || 0;
  13588. }
  13589. if ( isFunction( options ) ) {
  13590. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  13591. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  13592. }
  13593. if ( options.top != null ) {
  13594. props.top = ( options.top - curOffset.top ) + curTop;
  13595. }
  13596. if ( options.left != null ) {
  13597. props.left = ( options.left - curOffset.left ) + curLeft;
  13598. }
  13599. if ( "using" in options ) {
  13600. options.using.call( elem, props );
  13601. } else {
  13602. curElem.css( props );
  13603. }
  13604. }
  13605. };
  13606. jQuery.fn.extend( {
  13607. // offset() relates an element's border box to the document origin
  13608. offset: function( options ) {
  13609. // Preserve chaining for setter
  13610. if ( arguments.length ) {
  13611. return options === undefined ?
  13612. this :
  13613. this.each( function( i ) {
  13614. jQuery.offset.setOffset( this, options, i );
  13615. } );
  13616. }
  13617. var rect, win,
  13618. elem = this[ 0 ];
  13619. if ( !elem ) {
  13620. return;
  13621. }
  13622. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  13623. // Support: IE <=11 only
  13624. // Running getBoundingClientRect on a
  13625. // disconnected node in IE throws an error
  13626. if ( !elem.getClientRects().length ) {
  13627. return { top: 0, left: 0 };
  13628. }
  13629. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  13630. rect = elem.getBoundingClientRect();
  13631. win = elem.ownerDocument.defaultView;
  13632. return {
  13633. top: rect.top + win.pageYOffset,
  13634. left: rect.left + win.pageXOffset
  13635. };
  13636. },
  13637. // position() relates an element's margin box to its offset parent's padding box
  13638. // This corresponds to the behavior of CSS absolute positioning
  13639. position: function() {
  13640. if ( !this[ 0 ] ) {
  13641. return;
  13642. }
  13643. var offsetParent, offset, doc,
  13644. elem = this[ 0 ],
  13645. parentOffset = { top: 0, left: 0 };
  13646. // position:fixed elements are offset from the viewport, which itself always has zero offset
  13647. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  13648. // Assume position:fixed implies availability of getBoundingClientRect
  13649. offset = elem.getBoundingClientRect();
  13650. } else {
  13651. offset = this.offset();
  13652. // Account for the *real* offset parent, which can be the document or its root element
  13653. // when a statically positioned element is identified
  13654. doc = elem.ownerDocument;
  13655. offsetParent = elem.offsetParent || doc.documentElement;
  13656. while ( offsetParent &&
  13657. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  13658. jQuery.css( offsetParent, "position" ) === "static" ) {
  13659. offsetParent = offsetParent.parentNode;
  13660. }
  13661. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  13662. // Incorporate borders into its offset, since they are outside its content origin
  13663. parentOffset = jQuery( offsetParent ).offset();
  13664. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  13665. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  13666. }
  13667. }
  13668. // Subtract parent offsets and element margins
  13669. return {
  13670. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  13671. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  13672. };
  13673. },
  13674. // This method will return documentElement in the following cases:
  13675. // 1) For the element inside the iframe without offsetParent, this method will return
  13676. // documentElement of the parent window
  13677. // 2) For the hidden or detached element
  13678. // 3) For body or html element, i.e. in case of the html node - it will return itself
  13679. //
  13680. // but those exceptions were never presented as a real life use-cases
  13681. // and might be considered as more preferable results.
  13682. //
  13683. // This logic, however, is not guaranteed and can change at any point in the future
  13684. offsetParent: function() {
  13685. return this.map( function() {
  13686. var offsetParent = this.offsetParent;
  13687. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  13688. offsetParent = offsetParent.offsetParent;
  13689. }
  13690. return offsetParent || documentElement;
  13691. } );
  13692. }
  13693. } );
  13694. // Create scrollLeft and scrollTop methods
  13695. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  13696. var top = "pageYOffset" === prop;
  13697. jQuery.fn[ method ] = function( val ) {
  13698. return access( this, function( elem, method, val ) {
  13699. // Coalesce documents and windows
  13700. var win;
  13701. if ( isWindow( elem ) ) {
  13702. win = elem;
  13703. } else if ( elem.nodeType === 9 ) {
  13704. win = elem.defaultView;
  13705. }
  13706. if ( val === undefined ) {
  13707. return win ? win[ prop ] : elem[ method ];
  13708. }
  13709. if ( win ) {
  13710. win.scrollTo(
  13711. !top ? val : win.pageXOffset,
  13712. top ? val : win.pageYOffset
  13713. );
  13714. } else {
  13715. elem[ method ] = val;
  13716. }
  13717. }, method, val, arguments.length );
  13718. };
  13719. } );
  13720. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  13721. // Add the top/left cssHooks using jQuery.fn.position
  13722. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  13723. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  13724. // getComputedStyle returns percent when specified for top/left/bottom/right;
  13725. // rather than make the css module depend on the offset module, just check for it here
  13726. jQuery.each( [ "top", "left" ], function( i, prop ) {
  13727. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  13728. function( elem, computed ) {
  13729. if ( computed ) {
  13730. computed = curCSS( elem, prop );
  13731. // If curCSS returns percentage, fallback to offset
  13732. return rnumnonpx.test( computed ) ?
  13733. jQuery( elem ).position()[ prop ] + "px" :
  13734. computed;
  13735. }
  13736. }
  13737. );
  13738. } );
  13739. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  13740. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  13741. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  13742. function( defaultExtra, funcName ) {
  13743. // Margin is only for outerHeight, outerWidth
  13744. jQuery.fn[ funcName ] = function( margin, value ) {
  13745. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  13746. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  13747. return access( this, function( elem, type, value ) {
  13748. var doc;
  13749. if ( isWindow( elem ) ) {
  13750. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  13751. return funcName.indexOf( "outer" ) === 0 ?
  13752. elem[ "inner" + name ] :
  13753. elem.document.documentElement[ "client" + name ];
  13754. }
  13755. // Get document width or height
  13756. if ( elem.nodeType === 9 ) {
  13757. doc = elem.documentElement;
  13758. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  13759. // whichever is greatest
  13760. return Math.max(
  13761. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  13762. elem.body[ "offset" + name ], doc[ "offset" + name ],
  13763. doc[ "client" + name ]
  13764. );
  13765. }
  13766. return value === undefined ?
  13767. // Get width or height on the element, requesting but not forcing parseFloat
  13768. jQuery.css( elem, type, extra ) :
  13769. // Set width or height on the element
  13770. jQuery.style( elem, type, value, extra );
  13771. }, type, chainable ? margin : undefined, chainable );
  13772. };
  13773. } );
  13774. } );
  13775. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  13776. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  13777. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  13778. function( i, name ) {
  13779. // Handle event binding
  13780. jQuery.fn[ name ] = function( data, fn ) {
  13781. return arguments.length > 0 ?
  13782. this.on( name, null, data, fn ) :
  13783. this.trigger( name );
  13784. };
  13785. } );
  13786. jQuery.fn.extend( {
  13787. hover: function( fnOver, fnOut ) {
  13788. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  13789. }
  13790. } );
  13791. jQuery.fn.extend( {
  13792. bind: function( types, data, fn ) {
  13793. return this.on( types, null, data, fn );
  13794. },
  13795. unbind: function( types, fn ) {
  13796. return this.off( types, null, fn );
  13797. },
  13798. delegate: function( selector, types, data, fn ) {
  13799. return this.on( types, selector, data, fn );
  13800. },
  13801. undelegate: function( selector, types, fn ) {
  13802. // ( namespace ) or ( selector, types [, fn] )
  13803. return arguments.length === 1 ?
  13804. this.off( selector, "**" ) :
  13805. this.off( types, selector || "**", fn );
  13806. }
  13807. } );
  13808. // Bind a function to a context, optionally partially applying any
  13809. // arguments.
  13810. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  13811. // However, it is not slated for removal any time soon
  13812. jQuery.proxy = function( fn, context ) {
  13813. var tmp, args, proxy;
  13814. if ( typeof context === "string" ) {
  13815. tmp = fn[ context ];
  13816. context = fn;
  13817. fn = tmp;
  13818. }
  13819. // Quick check to determine if target is callable, in the spec
  13820. // this throws a TypeError, but we will just return undefined.
  13821. if ( !isFunction( fn ) ) {
  13822. return undefined;
  13823. }
  13824. // Simulated bind
  13825. args = slice.call( arguments, 2 );
  13826. proxy = function() {
  13827. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  13828. };
  13829. // Set the guid of unique handler to the same of original handler, so it can be removed
  13830. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  13831. return proxy;
  13832. };
  13833. jQuery.holdReady = function( hold ) {
  13834. if ( hold ) {
  13835. jQuery.readyWait++;
  13836. } else {
  13837. jQuery.ready( true );
  13838. }
  13839. };
  13840. jQuery.isArray = Array.isArray;
  13841. jQuery.parseJSON = JSON.parse;
  13842. jQuery.nodeName = nodeName;
  13843. jQuery.isFunction = isFunction;
  13844. jQuery.isWindow = isWindow;
  13845. jQuery.camelCase = camelCase;
  13846. jQuery.type = toType;
  13847. jQuery.now = Date.now;
  13848. jQuery.isNumeric = function( obj ) {
  13849. // As of jQuery 3.0, isNumeric is limited to
  13850. // strings and numbers (primitives or objects)
  13851. // that can be coerced to finite numbers (gh-2662)
  13852. var type = jQuery.type( obj );
  13853. return ( type === "number" || type === "string" ) &&
  13854. // parseFloat NaNs numeric-cast false positives ("")
  13855. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  13856. // subtraction forces infinities to NaN
  13857. !isNaN( obj - parseFloat( obj ) );
  13858. };
  13859. // Register as a named AMD module, since jQuery can be concatenated with other
  13860. // files that may use define, but not via a proper concatenation script that
  13861. // understands anonymous AMD modules. A named AMD is safest and most robust
  13862. // way to register. Lowercase jquery is used because AMD module names are
  13863. // derived from file names, and jQuery is normally delivered in a lowercase
  13864. // file name. Do this after creating the global so that if an AMD module wants
  13865. // to call noConflict to hide this version of jQuery, it will work.
  13866. // Note that for maximum portability, libraries that are not jQuery should
  13867. // declare themselves as anonymous modules, and avoid setting a global if an
  13868. // AMD loader is present. jQuery is a special case. For more information, see
  13869. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  13870. if ( true ) {
  13871. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  13872. return jQuery;
  13873. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  13874. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  13875. }
  13876. var
  13877. // Map over jQuery in case of overwrite
  13878. _jQuery = window.jQuery,
  13879. // Map over the $ in case of overwrite
  13880. _$ = window.$;
  13881. jQuery.noConflict = function( deep ) {
  13882. if ( window.$ === jQuery ) {
  13883. window.$ = _$;
  13884. }
  13885. if ( deep && window.jQuery === jQuery ) {
  13886. window.jQuery = _jQuery;
  13887. }
  13888. return jQuery;
  13889. };
  13890. // Expose jQuery and $ identifiers, even in AMD
  13891. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  13892. // and CommonJS for browser emulators (#13566)
  13893. if ( !noGlobal ) {
  13894. window.jQuery = window.$ = jQuery;
  13895. }
  13896. return jQuery;
  13897. } );
  13898. /***/ }),
  13899. /***/ "./node_modules/lodash/lodash.js":
  13900. /*!***************************************!*\
  13901. !*** ./node_modules/lodash/lodash.js ***!
  13902. \***************************************/
  13903. /*! no static exports found */
  13904. /***/ (function(module, exports, __webpack_require__) {
  13905. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  13906. * @license
  13907. * Lodash <https://lodash.com/>
  13908. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  13909. * Released under MIT license <https://lodash.com/license>
  13910. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  13911. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  13912. */
  13913. ;(function() {
  13914. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  13915. var undefined;
  13916. /** Used as the semantic version number. */
  13917. var VERSION = '4.17.15';
  13918. /** Used as the size to enable large array optimizations. */
  13919. var LARGE_ARRAY_SIZE = 200;
  13920. /** Error message constants. */
  13921. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  13922. FUNC_ERROR_TEXT = 'Expected a function';
  13923. /** Used to stand-in for `undefined` hash values. */
  13924. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  13925. /** Used as the maximum memoize cache size. */
  13926. var MAX_MEMOIZE_SIZE = 500;
  13927. /** Used as the internal argument placeholder. */
  13928. var PLACEHOLDER = '__lodash_placeholder__';
  13929. /** Used to compose bitmasks for cloning. */
  13930. var CLONE_DEEP_FLAG = 1,
  13931. CLONE_FLAT_FLAG = 2,
  13932. CLONE_SYMBOLS_FLAG = 4;
  13933. /** Used to compose bitmasks for value comparisons. */
  13934. var COMPARE_PARTIAL_FLAG = 1,
  13935. COMPARE_UNORDERED_FLAG = 2;
  13936. /** Used to compose bitmasks for function metadata. */
  13937. var WRAP_BIND_FLAG = 1,
  13938. WRAP_BIND_KEY_FLAG = 2,
  13939. WRAP_CURRY_BOUND_FLAG = 4,
  13940. WRAP_CURRY_FLAG = 8,
  13941. WRAP_CURRY_RIGHT_FLAG = 16,
  13942. WRAP_PARTIAL_FLAG = 32,
  13943. WRAP_PARTIAL_RIGHT_FLAG = 64,
  13944. WRAP_ARY_FLAG = 128,
  13945. WRAP_REARG_FLAG = 256,
  13946. WRAP_FLIP_FLAG = 512;
  13947. /** Used as default options for `_.truncate`. */
  13948. var DEFAULT_TRUNC_LENGTH = 30,
  13949. DEFAULT_TRUNC_OMISSION = '...';
  13950. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  13951. var HOT_COUNT = 800,
  13952. HOT_SPAN = 16;
  13953. /** Used to indicate the type of lazy iteratees. */
  13954. var LAZY_FILTER_FLAG = 1,
  13955. LAZY_MAP_FLAG = 2,
  13956. LAZY_WHILE_FLAG = 3;
  13957. /** Used as references for various `Number` constants. */
  13958. var INFINITY = 1 / 0,
  13959. MAX_SAFE_INTEGER = 9007199254740991,
  13960. MAX_INTEGER = 1.7976931348623157e+308,
  13961. NAN = 0 / 0;
  13962. /** Used as references for the maximum length and index of an array. */
  13963. var MAX_ARRAY_LENGTH = 4294967295,
  13964. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  13965. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  13966. /** Used to associate wrap methods with their bit flags. */
  13967. var wrapFlags = [
  13968. ['ary', WRAP_ARY_FLAG],
  13969. ['bind', WRAP_BIND_FLAG],
  13970. ['bindKey', WRAP_BIND_KEY_FLAG],
  13971. ['curry', WRAP_CURRY_FLAG],
  13972. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  13973. ['flip', WRAP_FLIP_FLAG],
  13974. ['partial', WRAP_PARTIAL_FLAG],
  13975. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  13976. ['rearg', WRAP_REARG_FLAG]
  13977. ];
  13978. /** `Object#toString` result references. */
  13979. var argsTag = '[object Arguments]',
  13980. arrayTag = '[object Array]',
  13981. asyncTag = '[object AsyncFunction]',
  13982. boolTag = '[object Boolean]',
  13983. dateTag = '[object Date]',
  13984. domExcTag = '[object DOMException]',
  13985. errorTag = '[object Error]',
  13986. funcTag = '[object Function]',
  13987. genTag = '[object GeneratorFunction]',
  13988. mapTag = '[object Map]',
  13989. numberTag = '[object Number]',
  13990. nullTag = '[object Null]',
  13991. objectTag = '[object Object]',
  13992. promiseTag = '[object Promise]',
  13993. proxyTag = '[object Proxy]',
  13994. regexpTag = '[object RegExp]',
  13995. setTag = '[object Set]',
  13996. stringTag = '[object String]',
  13997. symbolTag = '[object Symbol]',
  13998. undefinedTag = '[object Undefined]',
  13999. weakMapTag = '[object WeakMap]',
  14000. weakSetTag = '[object WeakSet]';
  14001. var arrayBufferTag = '[object ArrayBuffer]',
  14002. dataViewTag = '[object DataView]',
  14003. float32Tag = '[object Float32Array]',
  14004. float64Tag = '[object Float64Array]',
  14005. int8Tag = '[object Int8Array]',
  14006. int16Tag = '[object Int16Array]',
  14007. int32Tag = '[object Int32Array]',
  14008. uint8Tag = '[object Uint8Array]',
  14009. uint8ClampedTag = '[object Uint8ClampedArray]',
  14010. uint16Tag = '[object Uint16Array]',
  14011. uint32Tag = '[object Uint32Array]';
  14012. /** Used to match empty string literals in compiled template source. */
  14013. var reEmptyStringLeading = /\b__p \+= '';/g,
  14014. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  14015. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  14016. /** Used to match HTML entities and HTML characters. */
  14017. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  14018. reUnescapedHtml = /[&<>"']/g,
  14019. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  14020. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  14021. /** Used to match template delimiters. */
  14022. var reEscape = /<%-([\s\S]+?)%>/g,
  14023. reEvaluate = /<%([\s\S]+?)%>/g,
  14024. reInterpolate = /<%=([\s\S]+?)%>/g;
  14025. /** Used to match property names within property paths. */
  14026. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  14027. reIsPlainProp = /^\w*$/,
  14028. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  14029. /**
  14030. * Used to match `RegExp`
  14031. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  14032. */
  14033. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  14034. reHasRegExpChar = RegExp(reRegExpChar.source);
  14035. /** Used to match leading and trailing whitespace. */
  14036. var reTrim = /^\s+|\s+$/g,
  14037. reTrimStart = /^\s+/,
  14038. reTrimEnd = /\s+$/;
  14039. /** Used to match wrap detail comments. */
  14040. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  14041. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  14042. reSplitDetails = /,? & /;
  14043. /** Used to match words composed of alphanumeric characters. */
  14044. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  14045. /** Used to match backslashes in property paths. */
  14046. var reEscapeChar = /\\(\\)?/g;
  14047. /**
  14048. * Used to match
  14049. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  14050. */
  14051. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  14052. /** Used to match `RegExp` flags from their coerced string values. */
  14053. var reFlags = /\w*$/;
  14054. /** Used to detect bad signed hexadecimal string values. */
  14055. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  14056. /** Used to detect binary string values. */
  14057. var reIsBinary = /^0b[01]+$/i;
  14058. /** Used to detect host constructors (Safari). */
  14059. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  14060. /** Used to detect octal string values. */
  14061. var reIsOctal = /^0o[0-7]+$/i;
  14062. /** Used to detect unsigned integer values. */
  14063. var reIsUint = /^(?:0|[1-9]\d*)$/;
  14064. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  14065. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  14066. /** Used to ensure capturing order of template delimiters. */
  14067. var reNoMatch = /($^)/;
  14068. /** Used to match unescaped characters in compiled string literals. */
  14069. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  14070. /** Used to compose unicode character classes. */
  14071. var rsAstralRange = '\\ud800-\\udfff',
  14072. rsComboMarksRange = '\\u0300-\\u036f',
  14073. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  14074. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  14075. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  14076. rsDingbatRange = '\\u2700-\\u27bf',
  14077. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  14078. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  14079. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  14080. rsPunctuationRange = '\\u2000-\\u206f',
  14081. 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',
  14082. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  14083. rsVarRange = '\\ufe0e\\ufe0f',
  14084. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  14085. /** Used to compose unicode capture groups. */
  14086. var rsApos = "['\u2019]",
  14087. rsAstral = '[' + rsAstralRange + ']',
  14088. rsBreak = '[' + rsBreakRange + ']',
  14089. rsCombo = '[' + rsComboRange + ']',
  14090. rsDigits = '\\d+',
  14091. rsDingbat = '[' + rsDingbatRange + ']',
  14092. rsLower = '[' + rsLowerRange + ']',
  14093. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  14094. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  14095. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  14096. rsNonAstral = '[^' + rsAstralRange + ']',
  14097. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  14098. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  14099. rsUpper = '[' + rsUpperRange + ']',
  14100. rsZWJ = '\\u200d';
  14101. /** Used to compose unicode regexes. */
  14102. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  14103. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  14104. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  14105. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  14106. reOptMod = rsModifier + '?',
  14107. rsOptVar = '[' + rsVarRange + ']?',
  14108. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  14109. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  14110. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  14111. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  14112. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  14113. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  14114. /** Used to match apostrophes. */
  14115. var reApos = RegExp(rsApos, 'g');
  14116. /**
  14117. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  14118. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  14119. */
  14120. var reComboMark = RegExp(rsCombo, 'g');
  14121. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  14122. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  14123. /** Used to match complex or compound words. */
  14124. var reUnicodeWord = RegExp([
  14125. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  14126. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  14127. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  14128. rsUpper + '+' + rsOptContrUpper,
  14129. rsOrdUpper,
  14130. rsOrdLower,
  14131. rsDigits,
  14132. rsEmoji
  14133. ].join('|'), 'g');
  14134. /** 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/). */
  14135. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  14136. /** Used to detect strings that need a more robust regexp to match words. */
  14137. 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 ]/;
  14138. /** Used to assign default `context` object properties. */
  14139. var contextProps = [
  14140. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  14141. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  14142. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  14143. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  14144. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  14145. ];
  14146. /** Used to make template sourceURLs easier to identify. */
  14147. var templateCounter = -1;
  14148. /** Used to identify `toStringTag` values of typed arrays. */
  14149. var typedArrayTags = {};
  14150. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  14151. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  14152. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  14153. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  14154. typedArrayTags[uint32Tag] = true;
  14155. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  14156. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  14157. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  14158. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  14159. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  14160. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  14161. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  14162. typedArrayTags[weakMapTag] = false;
  14163. /** Used to identify `toStringTag` values supported by `_.clone`. */
  14164. var cloneableTags = {};
  14165. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  14166. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  14167. cloneableTags[boolTag] = cloneableTags[dateTag] =
  14168. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  14169. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  14170. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  14171. cloneableTags[numberTag] = cloneableTags[objectTag] =
  14172. cloneableTags[regexpTag] = cloneableTags[setTag] =
  14173. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  14174. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  14175. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  14176. cloneableTags[errorTag] = cloneableTags[funcTag] =
  14177. cloneableTags[weakMapTag] = false;
  14178. /** Used to map Latin Unicode letters to basic Latin letters. */
  14179. var deburredLetters = {
  14180. // Latin-1 Supplement block.
  14181. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  14182. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  14183. '\xc7': 'C', '\xe7': 'c',
  14184. '\xd0': 'D', '\xf0': 'd',
  14185. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  14186. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  14187. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  14188. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  14189. '\xd1': 'N', '\xf1': 'n',
  14190. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  14191. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  14192. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  14193. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  14194. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  14195. '\xc6': 'Ae', '\xe6': 'ae',
  14196. '\xde': 'Th', '\xfe': 'th',
  14197. '\xdf': 'ss',
  14198. // Latin Extended-A block.
  14199. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  14200. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  14201. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  14202. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  14203. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  14204. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  14205. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  14206. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  14207. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  14208. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  14209. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  14210. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  14211. '\u0134': 'J', '\u0135': 'j',
  14212. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  14213. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  14214. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  14215. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  14216. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  14217. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  14218. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  14219. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  14220. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  14221. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  14222. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  14223. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  14224. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  14225. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  14226. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  14227. '\u0174': 'W', '\u0175': 'w',
  14228. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  14229. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  14230. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  14231. '\u0132': 'IJ', '\u0133': 'ij',
  14232. '\u0152': 'Oe', '\u0153': 'oe',
  14233. '\u0149': "'n", '\u017f': 's'
  14234. };
  14235. /** Used to map characters to HTML entities. */
  14236. var htmlEscapes = {
  14237. '&': '&amp;',
  14238. '<': '&lt;',
  14239. '>': '&gt;',
  14240. '"': '&quot;',
  14241. "'": '&#39;'
  14242. };
  14243. /** Used to map HTML entities to characters. */
  14244. var htmlUnescapes = {
  14245. '&amp;': '&',
  14246. '&lt;': '<',
  14247. '&gt;': '>',
  14248. '&quot;': '"',
  14249. '&#39;': "'"
  14250. };
  14251. /** Used to escape characters for inclusion in compiled string literals. */
  14252. var stringEscapes = {
  14253. '\\': '\\',
  14254. "'": "'",
  14255. '\n': 'n',
  14256. '\r': 'r',
  14257. '\u2028': 'u2028',
  14258. '\u2029': 'u2029'
  14259. };
  14260. /** Built-in method references without a dependency on `root`. */
  14261. var freeParseFloat = parseFloat,
  14262. freeParseInt = parseInt;
  14263. /** Detect free variable `global` from Node.js. */
  14264. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  14265. /** Detect free variable `self`. */
  14266. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  14267. /** Used as a reference to the global object. */
  14268. var root = freeGlobal || freeSelf || Function('return this')();
  14269. /** Detect free variable `exports`. */
  14270. var freeExports = true && exports && !exports.nodeType && exports;
  14271. /** Detect free variable `module`. */
  14272. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  14273. /** Detect the popular CommonJS extension `module.exports`. */
  14274. var moduleExports = freeModule && freeModule.exports === freeExports;
  14275. /** Detect free variable `process` from Node.js. */
  14276. var freeProcess = moduleExports && freeGlobal.process;
  14277. /** Used to access faster Node.js helpers. */
  14278. var nodeUtil = (function() {
  14279. try {
  14280. // Use `util.types` for Node.js 10+.
  14281. var types = freeModule && freeModule.require && freeModule.require('util').types;
  14282. if (types) {
  14283. return types;
  14284. }
  14285. // Legacy `process.binding('util')` for Node.js < 10.
  14286. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  14287. } catch (e) {}
  14288. }());
  14289. /* Node.js helper references. */
  14290. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  14291. nodeIsDate = nodeUtil && nodeUtil.isDate,
  14292. nodeIsMap = nodeUtil && nodeUtil.isMap,
  14293. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  14294. nodeIsSet = nodeUtil && nodeUtil.isSet,
  14295. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  14296. /*--------------------------------------------------------------------------*/
  14297. /**
  14298. * A faster alternative to `Function#apply`, this function invokes `func`
  14299. * with the `this` binding of `thisArg` and the arguments of `args`.
  14300. *
  14301. * @private
  14302. * @param {Function} func The function to invoke.
  14303. * @param {*} thisArg The `this` binding of `func`.
  14304. * @param {Array} args The arguments to invoke `func` with.
  14305. * @returns {*} Returns the result of `func`.
  14306. */
  14307. function apply(func, thisArg, args) {
  14308. switch (args.length) {
  14309. case 0: return func.call(thisArg);
  14310. case 1: return func.call(thisArg, args[0]);
  14311. case 2: return func.call(thisArg, args[0], args[1]);
  14312. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  14313. }
  14314. return func.apply(thisArg, args);
  14315. }
  14316. /**
  14317. * A specialized version of `baseAggregator` for arrays.
  14318. *
  14319. * @private
  14320. * @param {Array} [array] The array to iterate over.
  14321. * @param {Function} setter The function to set `accumulator` values.
  14322. * @param {Function} iteratee The iteratee to transform keys.
  14323. * @param {Object} accumulator The initial aggregated object.
  14324. * @returns {Function} Returns `accumulator`.
  14325. */
  14326. function arrayAggregator(array, setter, iteratee, accumulator) {
  14327. var index = -1,
  14328. length = array == null ? 0 : array.length;
  14329. while (++index < length) {
  14330. var value = array[index];
  14331. setter(accumulator, value, iteratee(value), array);
  14332. }
  14333. return accumulator;
  14334. }
  14335. /**
  14336. * A specialized version of `_.forEach` for arrays without support for
  14337. * iteratee shorthands.
  14338. *
  14339. * @private
  14340. * @param {Array} [array] The array to iterate over.
  14341. * @param {Function} iteratee The function invoked per iteration.
  14342. * @returns {Array} Returns `array`.
  14343. */
  14344. function arrayEach(array, iteratee) {
  14345. var index = -1,
  14346. length = array == null ? 0 : array.length;
  14347. while (++index < length) {
  14348. if (iteratee(array[index], index, array) === false) {
  14349. break;
  14350. }
  14351. }
  14352. return array;
  14353. }
  14354. /**
  14355. * A specialized version of `_.forEachRight` for arrays without support for
  14356. * iteratee shorthands.
  14357. *
  14358. * @private
  14359. * @param {Array} [array] The array to iterate over.
  14360. * @param {Function} iteratee The function invoked per iteration.
  14361. * @returns {Array} Returns `array`.
  14362. */
  14363. function arrayEachRight(array, iteratee) {
  14364. var length = array == null ? 0 : array.length;
  14365. while (length--) {
  14366. if (iteratee(array[length], length, array) === false) {
  14367. break;
  14368. }
  14369. }
  14370. return array;
  14371. }
  14372. /**
  14373. * A specialized version of `_.every` for arrays without support for
  14374. * iteratee shorthands.
  14375. *
  14376. * @private
  14377. * @param {Array} [array] The array to iterate over.
  14378. * @param {Function} predicate The function invoked per iteration.
  14379. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  14380. * else `false`.
  14381. */
  14382. function arrayEvery(array, predicate) {
  14383. var index = -1,
  14384. length = array == null ? 0 : array.length;
  14385. while (++index < length) {
  14386. if (!predicate(array[index], index, array)) {
  14387. return false;
  14388. }
  14389. }
  14390. return true;
  14391. }
  14392. /**
  14393. * A specialized version of `_.filter` for arrays without support for
  14394. * iteratee shorthands.
  14395. *
  14396. * @private
  14397. * @param {Array} [array] The array to iterate over.
  14398. * @param {Function} predicate The function invoked per iteration.
  14399. * @returns {Array} Returns the new filtered array.
  14400. */
  14401. function arrayFilter(array, predicate) {
  14402. var index = -1,
  14403. length = array == null ? 0 : array.length,
  14404. resIndex = 0,
  14405. result = [];
  14406. while (++index < length) {
  14407. var value = array[index];
  14408. if (predicate(value, index, array)) {
  14409. result[resIndex++] = value;
  14410. }
  14411. }
  14412. return result;
  14413. }
  14414. /**
  14415. * A specialized version of `_.includes` for arrays without support for
  14416. * specifying an index to search from.
  14417. *
  14418. * @private
  14419. * @param {Array} [array] The array to inspect.
  14420. * @param {*} target The value to search for.
  14421. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  14422. */
  14423. function arrayIncludes(array, value) {
  14424. var length = array == null ? 0 : array.length;
  14425. return !!length && baseIndexOf(array, value, 0) > -1;
  14426. }
  14427. /**
  14428. * This function is like `arrayIncludes` except that it accepts a comparator.
  14429. *
  14430. * @private
  14431. * @param {Array} [array] The array to inspect.
  14432. * @param {*} target The value to search for.
  14433. * @param {Function} comparator The comparator invoked per element.
  14434. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  14435. */
  14436. function arrayIncludesWith(array, value, comparator) {
  14437. var index = -1,
  14438. length = array == null ? 0 : array.length;
  14439. while (++index < length) {
  14440. if (comparator(value, array[index])) {
  14441. return true;
  14442. }
  14443. }
  14444. return false;
  14445. }
  14446. /**
  14447. * A specialized version of `_.map` for arrays without support for iteratee
  14448. * shorthands.
  14449. *
  14450. * @private
  14451. * @param {Array} [array] The array to iterate over.
  14452. * @param {Function} iteratee The function invoked per iteration.
  14453. * @returns {Array} Returns the new mapped array.
  14454. */
  14455. function arrayMap(array, iteratee) {
  14456. var index = -1,
  14457. length = array == null ? 0 : array.length,
  14458. result = Array(length);
  14459. while (++index < length) {
  14460. result[index] = iteratee(array[index], index, array);
  14461. }
  14462. return result;
  14463. }
  14464. /**
  14465. * Appends the elements of `values` to `array`.
  14466. *
  14467. * @private
  14468. * @param {Array} array The array to modify.
  14469. * @param {Array} values The values to append.
  14470. * @returns {Array} Returns `array`.
  14471. */
  14472. function arrayPush(array, values) {
  14473. var index = -1,
  14474. length = values.length,
  14475. offset = array.length;
  14476. while (++index < length) {
  14477. array[offset + index] = values[index];
  14478. }
  14479. return array;
  14480. }
  14481. /**
  14482. * A specialized version of `_.reduce` for arrays without support for
  14483. * iteratee shorthands.
  14484. *
  14485. * @private
  14486. * @param {Array} [array] The array to iterate over.
  14487. * @param {Function} iteratee The function invoked per iteration.
  14488. * @param {*} [accumulator] The initial value.
  14489. * @param {boolean} [initAccum] Specify using the first element of `array` as
  14490. * the initial value.
  14491. * @returns {*} Returns the accumulated value.
  14492. */
  14493. function arrayReduce(array, iteratee, accumulator, initAccum) {
  14494. var index = -1,
  14495. length = array == null ? 0 : array.length;
  14496. if (initAccum && length) {
  14497. accumulator = array[++index];
  14498. }
  14499. while (++index < length) {
  14500. accumulator = iteratee(accumulator, array[index], index, array);
  14501. }
  14502. return accumulator;
  14503. }
  14504. /**
  14505. * A specialized version of `_.reduceRight` for arrays without support for
  14506. * iteratee shorthands.
  14507. *
  14508. * @private
  14509. * @param {Array} [array] The array to iterate over.
  14510. * @param {Function} iteratee The function invoked per iteration.
  14511. * @param {*} [accumulator] The initial value.
  14512. * @param {boolean} [initAccum] Specify using the last element of `array` as
  14513. * the initial value.
  14514. * @returns {*} Returns the accumulated value.
  14515. */
  14516. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  14517. var length = array == null ? 0 : array.length;
  14518. if (initAccum && length) {
  14519. accumulator = array[--length];
  14520. }
  14521. while (length--) {
  14522. accumulator = iteratee(accumulator, array[length], length, array);
  14523. }
  14524. return accumulator;
  14525. }
  14526. /**
  14527. * A specialized version of `_.some` for arrays without support for iteratee
  14528. * shorthands.
  14529. *
  14530. * @private
  14531. * @param {Array} [array] The array to iterate over.
  14532. * @param {Function} predicate The function invoked per iteration.
  14533. * @returns {boolean} Returns `true` if any element passes the predicate check,
  14534. * else `false`.
  14535. */
  14536. function arraySome(array, predicate) {
  14537. var index = -1,
  14538. length = array == null ? 0 : array.length;
  14539. while (++index < length) {
  14540. if (predicate(array[index], index, array)) {
  14541. return true;
  14542. }
  14543. }
  14544. return false;
  14545. }
  14546. /**
  14547. * Gets the size of an ASCII `string`.
  14548. *
  14549. * @private
  14550. * @param {string} string The string inspect.
  14551. * @returns {number} Returns the string size.
  14552. */
  14553. var asciiSize = baseProperty('length');
  14554. /**
  14555. * Converts an ASCII `string` to an array.
  14556. *
  14557. * @private
  14558. * @param {string} string The string to convert.
  14559. * @returns {Array} Returns the converted array.
  14560. */
  14561. function asciiToArray(string) {
  14562. return string.split('');
  14563. }
  14564. /**
  14565. * Splits an ASCII `string` into an array of its words.
  14566. *
  14567. * @private
  14568. * @param {string} The string to inspect.
  14569. * @returns {Array} Returns the words of `string`.
  14570. */
  14571. function asciiWords(string) {
  14572. return string.match(reAsciiWord) || [];
  14573. }
  14574. /**
  14575. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  14576. * without support for iteratee shorthands, which iterates over `collection`
  14577. * using `eachFunc`.
  14578. *
  14579. * @private
  14580. * @param {Array|Object} collection The collection to inspect.
  14581. * @param {Function} predicate The function invoked per iteration.
  14582. * @param {Function} eachFunc The function to iterate over `collection`.
  14583. * @returns {*} Returns the found element or its key, else `undefined`.
  14584. */
  14585. function baseFindKey(collection, predicate, eachFunc) {
  14586. var result;
  14587. eachFunc(collection, function(value, key, collection) {
  14588. if (predicate(value, key, collection)) {
  14589. result = key;
  14590. return false;
  14591. }
  14592. });
  14593. return result;
  14594. }
  14595. /**
  14596. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  14597. * support for iteratee shorthands.
  14598. *
  14599. * @private
  14600. * @param {Array} array The array to inspect.
  14601. * @param {Function} predicate The function invoked per iteration.
  14602. * @param {number} fromIndex The index to search from.
  14603. * @param {boolean} [fromRight] Specify iterating from right to left.
  14604. * @returns {number} Returns the index of the matched value, else `-1`.
  14605. */
  14606. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  14607. var length = array.length,
  14608. index = fromIndex + (fromRight ? 1 : -1);
  14609. while ((fromRight ? index-- : ++index < length)) {
  14610. if (predicate(array[index], index, array)) {
  14611. return index;
  14612. }
  14613. }
  14614. return -1;
  14615. }
  14616. /**
  14617. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  14618. *
  14619. * @private
  14620. * @param {Array} array The array to inspect.
  14621. * @param {*} value The value to search for.
  14622. * @param {number} fromIndex The index to search from.
  14623. * @returns {number} Returns the index of the matched value, else `-1`.
  14624. */
  14625. function baseIndexOf(array, value, fromIndex) {
  14626. return value === value
  14627. ? strictIndexOf(array, value, fromIndex)
  14628. : baseFindIndex(array, baseIsNaN, fromIndex);
  14629. }
  14630. /**
  14631. * This function is like `baseIndexOf` except that it accepts a comparator.
  14632. *
  14633. * @private
  14634. * @param {Array} array The array to inspect.
  14635. * @param {*} value The value to search for.
  14636. * @param {number} fromIndex The index to search from.
  14637. * @param {Function} comparator The comparator invoked per element.
  14638. * @returns {number} Returns the index of the matched value, else `-1`.
  14639. */
  14640. function baseIndexOfWith(array, value, fromIndex, comparator) {
  14641. var index = fromIndex - 1,
  14642. length = array.length;
  14643. while (++index < length) {
  14644. if (comparator(array[index], value)) {
  14645. return index;
  14646. }
  14647. }
  14648. return -1;
  14649. }
  14650. /**
  14651. * The base implementation of `_.isNaN` without support for number objects.
  14652. *
  14653. * @private
  14654. * @param {*} value The value to check.
  14655. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  14656. */
  14657. function baseIsNaN(value) {
  14658. return value !== value;
  14659. }
  14660. /**
  14661. * The base implementation of `_.mean` and `_.meanBy` without support for
  14662. * iteratee shorthands.
  14663. *
  14664. * @private
  14665. * @param {Array} array The array to iterate over.
  14666. * @param {Function} iteratee The function invoked per iteration.
  14667. * @returns {number} Returns the mean.
  14668. */
  14669. function baseMean(array, iteratee) {
  14670. var length = array == null ? 0 : array.length;
  14671. return length ? (baseSum(array, iteratee) / length) : NAN;
  14672. }
  14673. /**
  14674. * The base implementation of `_.property` without support for deep paths.
  14675. *
  14676. * @private
  14677. * @param {string} key The key of the property to get.
  14678. * @returns {Function} Returns the new accessor function.
  14679. */
  14680. function baseProperty(key) {
  14681. return function(object) {
  14682. return object == null ? undefined : object[key];
  14683. };
  14684. }
  14685. /**
  14686. * The base implementation of `_.propertyOf` without support for deep paths.
  14687. *
  14688. * @private
  14689. * @param {Object} object The object to query.
  14690. * @returns {Function} Returns the new accessor function.
  14691. */
  14692. function basePropertyOf(object) {
  14693. return function(key) {
  14694. return object == null ? undefined : object[key];
  14695. };
  14696. }
  14697. /**
  14698. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  14699. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  14700. *
  14701. * @private
  14702. * @param {Array|Object} collection The collection to iterate over.
  14703. * @param {Function} iteratee The function invoked per iteration.
  14704. * @param {*} accumulator The initial value.
  14705. * @param {boolean} initAccum Specify using the first or last element of
  14706. * `collection` as the initial value.
  14707. * @param {Function} eachFunc The function to iterate over `collection`.
  14708. * @returns {*} Returns the accumulated value.
  14709. */
  14710. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  14711. eachFunc(collection, function(value, index, collection) {
  14712. accumulator = initAccum
  14713. ? (initAccum = false, value)
  14714. : iteratee(accumulator, value, index, collection);
  14715. });
  14716. return accumulator;
  14717. }
  14718. /**
  14719. * The base implementation of `_.sortBy` which uses `comparer` to define the
  14720. * sort order of `array` and replaces criteria objects with their corresponding
  14721. * values.
  14722. *
  14723. * @private
  14724. * @param {Array} array The array to sort.
  14725. * @param {Function} comparer The function to define sort order.
  14726. * @returns {Array} Returns `array`.
  14727. */
  14728. function baseSortBy(array, comparer) {
  14729. var length = array.length;
  14730. array.sort(comparer);
  14731. while (length--) {
  14732. array[length] = array[length].value;
  14733. }
  14734. return array;
  14735. }
  14736. /**
  14737. * The base implementation of `_.sum` and `_.sumBy` without support for
  14738. * iteratee shorthands.
  14739. *
  14740. * @private
  14741. * @param {Array} array The array to iterate over.
  14742. * @param {Function} iteratee The function invoked per iteration.
  14743. * @returns {number} Returns the sum.
  14744. */
  14745. function baseSum(array, iteratee) {
  14746. var result,
  14747. index = -1,
  14748. length = array.length;
  14749. while (++index < length) {
  14750. var current = iteratee(array[index]);
  14751. if (current !== undefined) {
  14752. result = result === undefined ? current : (result + current);
  14753. }
  14754. }
  14755. return result;
  14756. }
  14757. /**
  14758. * The base implementation of `_.times` without support for iteratee shorthands
  14759. * or max array length checks.
  14760. *
  14761. * @private
  14762. * @param {number} n The number of times to invoke `iteratee`.
  14763. * @param {Function} iteratee The function invoked per iteration.
  14764. * @returns {Array} Returns the array of results.
  14765. */
  14766. function baseTimes(n, iteratee) {
  14767. var index = -1,
  14768. result = Array(n);
  14769. while (++index < n) {
  14770. result[index] = iteratee(index);
  14771. }
  14772. return result;
  14773. }
  14774. /**
  14775. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  14776. * of key-value pairs for `object` corresponding to the property names of `props`.
  14777. *
  14778. * @private
  14779. * @param {Object} object The object to query.
  14780. * @param {Array} props The property names to get values for.
  14781. * @returns {Object} Returns the key-value pairs.
  14782. */
  14783. function baseToPairs(object, props) {
  14784. return arrayMap(props, function(key) {
  14785. return [key, object[key]];
  14786. });
  14787. }
  14788. /**
  14789. * The base implementation of `_.unary` without support for storing metadata.
  14790. *
  14791. * @private
  14792. * @param {Function} func The function to cap arguments for.
  14793. * @returns {Function} Returns the new capped function.
  14794. */
  14795. function baseUnary(func) {
  14796. return function(value) {
  14797. return func(value);
  14798. };
  14799. }
  14800. /**
  14801. * The base implementation of `_.values` and `_.valuesIn` which creates an
  14802. * array of `object` property values corresponding to the property names
  14803. * of `props`.
  14804. *
  14805. * @private
  14806. * @param {Object} object The object to query.
  14807. * @param {Array} props The property names to get values for.
  14808. * @returns {Object} Returns the array of property values.
  14809. */
  14810. function baseValues(object, props) {
  14811. return arrayMap(props, function(key) {
  14812. return object[key];
  14813. });
  14814. }
  14815. /**
  14816. * Checks if a `cache` value for `key` exists.
  14817. *
  14818. * @private
  14819. * @param {Object} cache The cache to query.
  14820. * @param {string} key The key of the entry to check.
  14821. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  14822. */
  14823. function cacheHas(cache, key) {
  14824. return cache.has(key);
  14825. }
  14826. /**
  14827. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  14828. * that is not found in the character symbols.
  14829. *
  14830. * @private
  14831. * @param {Array} strSymbols The string symbols to inspect.
  14832. * @param {Array} chrSymbols The character symbols to find.
  14833. * @returns {number} Returns the index of the first unmatched string symbol.
  14834. */
  14835. function charsStartIndex(strSymbols, chrSymbols) {
  14836. var index = -1,
  14837. length = strSymbols.length;
  14838. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  14839. return index;
  14840. }
  14841. /**
  14842. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  14843. * that is not found in the character symbols.
  14844. *
  14845. * @private
  14846. * @param {Array} strSymbols The string symbols to inspect.
  14847. * @param {Array} chrSymbols The character symbols to find.
  14848. * @returns {number} Returns the index of the last unmatched string symbol.
  14849. */
  14850. function charsEndIndex(strSymbols, chrSymbols) {
  14851. var index = strSymbols.length;
  14852. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  14853. return index;
  14854. }
  14855. /**
  14856. * Gets the number of `placeholder` occurrences in `array`.
  14857. *
  14858. * @private
  14859. * @param {Array} array The array to inspect.
  14860. * @param {*} placeholder The placeholder to search for.
  14861. * @returns {number} Returns the placeholder count.
  14862. */
  14863. function countHolders(array, placeholder) {
  14864. var length = array.length,
  14865. result = 0;
  14866. while (length--) {
  14867. if (array[length] === placeholder) {
  14868. ++result;
  14869. }
  14870. }
  14871. return result;
  14872. }
  14873. /**
  14874. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  14875. * letters to basic Latin letters.
  14876. *
  14877. * @private
  14878. * @param {string} letter The matched letter to deburr.
  14879. * @returns {string} Returns the deburred letter.
  14880. */
  14881. var deburrLetter = basePropertyOf(deburredLetters);
  14882. /**
  14883. * Used by `_.escape` to convert characters to HTML entities.
  14884. *
  14885. * @private
  14886. * @param {string} chr The matched character to escape.
  14887. * @returns {string} Returns the escaped character.
  14888. */
  14889. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  14890. /**
  14891. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  14892. *
  14893. * @private
  14894. * @param {string} chr The matched character to escape.
  14895. * @returns {string} Returns the escaped character.
  14896. */
  14897. function escapeStringChar(chr) {
  14898. return '\\' + stringEscapes[chr];
  14899. }
  14900. /**
  14901. * Gets the value at `key` of `object`.
  14902. *
  14903. * @private
  14904. * @param {Object} [object] The object to query.
  14905. * @param {string} key The key of the property to get.
  14906. * @returns {*} Returns the property value.
  14907. */
  14908. function getValue(object, key) {
  14909. return object == null ? undefined : object[key];
  14910. }
  14911. /**
  14912. * Checks if `string` contains Unicode symbols.
  14913. *
  14914. * @private
  14915. * @param {string} string The string to inspect.
  14916. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  14917. */
  14918. function hasUnicode(string) {
  14919. return reHasUnicode.test(string);
  14920. }
  14921. /**
  14922. * Checks if `string` contains a word composed of Unicode symbols.
  14923. *
  14924. * @private
  14925. * @param {string} string The string to inspect.
  14926. * @returns {boolean} Returns `true` if a word is found, else `false`.
  14927. */
  14928. function hasUnicodeWord(string) {
  14929. return reHasUnicodeWord.test(string);
  14930. }
  14931. /**
  14932. * Converts `iterator` to an array.
  14933. *
  14934. * @private
  14935. * @param {Object} iterator The iterator to convert.
  14936. * @returns {Array} Returns the converted array.
  14937. */
  14938. function iteratorToArray(iterator) {
  14939. var data,
  14940. result = [];
  14941. while (!(data = iterator.next()).done) {
  14942. result.push(data.value);
  14943. }
  14944. return result;
  14945. }
  14946. /**
  14947. * Converts `map` to its key-value pairs.
  14948. *
  14949. * @private
  14950. * @param {Object} map The map to convert.
  14951. * @returns {Array} Returns the key-value pairs.
  14952. */
  14953. function mapToArray(map) {
  14954. var index = -1,
  14955. result = Array(map.size);
  14956. map.forEach(function(value, key) {
  14957. result[++index] = [key, value];
  14958. });
  14959. return result;
  14960. }
  14961. /**
  14962. * Creates a unary function that invokes `func` with its argument transformed.
  14963. *
  14964. * @private
  14965. * @param {Function} func The function to wrap.
  14966. * @param {Function} transform The argument transform.
  14967. * @returns {Function} Returns the new function.
  14968. */
  14969. function overArg(func, transform) {
  14970. return function(arg) {
  14971. return func(transform(arg));
  14972. };
  14973. }
  14974. /**
  14975. * Replaces all `placeholder` elements in `array` with an internal placeholder
  14976. * and returns an array of their indexes.
  14977. *
  14978. * @private
  14979. * @param {Array} array The array to modify.
  14980. * @param {*} placeholder The placeholder to replace.
  14981. * @returns {Array} Returns the new array of placeholder indexes.
  14982. */
  14983. function replaceHolders(array, placeholder) {
  14984. var index = -1,
  14985. length = array.length,
  14986. resIndex = 0,
  14987. result = [];
  14988. while (++index < length) {
  14989. var value = array[index];
  14990. if (value === placeholder || value === PLACEHOLDER) {
  14991. array[index] = PLACEHOLDER;
  14992. result[resIndex++] = index;
  14993. }
  14994. }
  14995. return result;
  14996. }
  14997. /**
  14998. * Converts `set` to an array of its values.
  14999. *
  15000. * @private
  15001. * @param {Object} set The set to convert.
  15002. * @returns {Array} Returns the values.
  15003. */
  15004. function setToArray(set) {
  15005. var index = -1,
  15006. result = Array(set.size);
  15007. set.forEach(function(value) {
  15008. result[++index] = value;
  15009. });
  15010. return result;
  15011. }
  15012. /**
  15013. * Converts `set` to its value-value pairs.
  15014. *
  15015. * @private
  15016. * @param {Object} set The set to convert.
  15017. * @returns {Array} Returns the value-value pairs.
  15018. */
  15019. function setToPairs(set) {
  15020. var index = -1,
  15021. result = Array(set.size);
  15022. set.forEach(function(value) {
  15023. result[++index] = [value, value];
  15024. });
  15025. return result;
  15026. }
  15027. /**
  15028. * A specialized version of `_.indexOf` which performs strict equality
  15029. * comparisons of values, i.e. `===`.
  15030. *
  15031. * @private
  15032. * @param {Array} array The array to inspect.
  15033. * @param {*} value The value to search for.
  15034. * @param {number} fromIndex The index to search from.
  15035. * @returns {number} Returns the index of the matched value, else `-1`.
  15036. */
  15037. function strictIndexOf(array, value, fromIndex) {
  15038. var index = fromIndex - 1,
  15039. length = array.length;
  15040. while (++index < length) {
  15041. if (array[index] === value) {
  15042. return index;
  15043. }
  15044. }
  15045. return -1;
  15046. }
  15047. /**
  15048. * A specialized version of `_.lastIndexOf` which performs strict equality
  15049. * comparisons of values, i.e. `===`.
  15050. *
  15051. * @private
  15052. * @param {Array} array The array to inspect.
  15053. * @param {*} value The value to search for.
  15054. * @param {number} fromIndex The index to search from.
  15055. * @returns {number} Returns the index of the matched value, else `-1`.
  15056. */
  15057. function strictLastIndexOf(array, value, fromIndex) {
  15058. var index = fromIndex + 1;
  15059. while (index--) {
  15060. if (array[index] === value) {
  15061. return index;
  15062. }
  15063. }
  15064. return index;
  15065. }
  15066. /**
  15067. * Gets the number of symbols in `string`.
  15068. *
  15069. * @private
  15070. * @param {string} string The string to inspect.
  15071. * @returns {number} Returns the string size.
  15072. */
  15073. function stringSize(string) {
  15074. return hasUnicode(string)
  15075. ? unicodeSize(string)
  15076. : asciiSize(string);
  15077. }
  15078. /**
  15079. * Converts `string` to an array.
  15080. *
  15081. * @private
  15082. * @param {string} string The string to convert.
  15083. * @returns {Array} Returns the converted array.
  15084. */
  15085. function stringToArray(string) {
  15086. return hasUnicode(string)
  15087. ? unicodeToArray(string)
  15088. : asciiToArray(string);
  15089. }
  15090. /**
  15091. * Used by `_.unescape` to convert HTML entities to characters.
  15092. *
  15093. * @private
  15094. * @param {string} chr The matched character to unescape.
  15095. * @returns {string} Returns the unescaped character.
  15096. */
  15097. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  15098. /**
  15099. * Gets the size of a Unicode `string`.
  15100. *
  15101. * @private
  15102. * @param {string} string The string inspect.
  15103. * @returns {number} Returns the string size.
  15104. */
  15105. function unicodeSize(string) {
  15106. var result = reUnicode.lastIndex = 0;
  15107. while (reUnicode.test(string)) {
  15108. ++result;
  15109. }
  15110. return result;
  15111. }
  15112. /**
  15113. * Converts a Unicode `string` to an array.
  15114. *
  15115. * @private
  15116. * @param {string} string The string to convert.
  15117. * @returns {Array} Returns the converted array.
  15118. */
  15119. function unicodeToArray(string) {
  15120. return string.match(reUnicode) || [];
  15121. }
  15122. /**
  15123. * Splits a Unicode `string` into an array of its words.
  15124. *
  15125. * @private
  15126. * @param {string} The string to inspect.
  15127. * @returns {Array} Returns the words of `string`.
  15128. */
  15129. function unicodeWords(string) {
  15130. return string.match(reUnicodeWord) || [];
  15131. }
  15132. /*--------------------------------------------------------------------------*/
  15133. /**
  15134. * Create a new pristine `lodash` function using the `context` object.
  15135. *
  15136. * @static
  15137. * @memberOf _
  15138. * @since 1.1.0
  15139. * @category Util
  15140. * @param {Object} [context=root] The context object.
  15141. * @returns {Function} Returns a new `lodash` function.
  15142. * @example
  15143. *
  15144. * _.mixin({ 'foo': _.constant('foo') });
  15145. *
  15146. * var lodash = _.runInContext();
  15147. * lodash.mixin({ 'bar': lodash.constant('bar') });
  15148. *
  15149. * _.isFunction(_.foo);
  15150. * // => true
  15151. * _.isFunction(_.bar);
  15152. * // => false
  15153. *
  15154. * lodash.isFunction(lodash.foo);
  15155. * // => false
  15156. * lodash.isFunction(lodash.bar);
  15157. * // => true
  15158. *
  15159. * // Create a suped-up `defer` in Node.js.
  15160. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  15161. */
  15162. var runInContext = (function runInContext(context) {
  15163. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  15164. /** Built-in constructor references. */
  15165. var Array = context.Array,
  15166. Date = context.Date,
  15167. Error = context.Error,
  15168. Function = context.Function,
  15169. Math = context.Math,
  15170. Object = context.Object,
  15171. RegExp = context.RegExp,
  15172. String = context.String,
  15173. TypeError = context.TypeError;
  15174. /** Used for built-in method references. */
  15175. var arrayProto = Array.prototype,
  15176. funcProto = Function.prototype,
  15177. objectProto = Object.prototype;
  15178. /** Used to detect overreaching core-js shims. */
  15179. var coreJsData = context['__core-js_shared__'];
  15180. /** Used to resolve the decompiled source of functions. */
  15181. var funcToString = funcProto.toString;
  15182. /** Used to check objects for own properties. */
  15183. var hasOwnProperty = objectProto.hasOwnProperty;
  15184. /** Used to generate unique IDs. */
  15185. var idCounter = 0;
  15186. /** Used to detect methods masquerading as native. */
  15187. var maskSrcKey = (function() {
  15188. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  15189. return uid ? ('Symbol(src)_1.' + uid) : '';
  15190. }());
  15191. /**
  15192. * Used to resolve the
  15193. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  15194. * of values.
  15195. */
  15196. var nativeObjectToString = objectProto.toString;
  15197. /** Used to infer the `Object` constructor. */
  15198. var objectCtorString = funcToString.call(Object);
  15199. /** Used to restore the original `_` reference in `_.noConflict`. */
  15200. var oldDash = root._;
  15201. /** Used to detect if a method is native. */
  15202. var reIsNative = RegExp('^' +
  15203. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  15204. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  15205. );
  15206. /** Built-in value references. */
  15207. var Buffer = moduleExports ? context.Buffer : undefined,
  15208. Symbol = context.Symbol,
  15209. Uint8Array = context.Uint8Array,
  15210. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  15211. getPrototype = overArg(Object.getPrototypeOf, Object),
  15212. objectCreate = Object.create,
  15213. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  15214. splice = arrayProto.splice,
  15215. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  15216. symIterator = Symbol ? Symbol.iterator : undefined,
  15217. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  15218. var defineProperty = (function() {
  15219. try {
  15220. var func = getNative(Object, 'defineProperty');
  15221. func({}, '', {});
  15222. return func;
  15223. } catch (e) {}
  15224. }());
  15225. /** Mocked built-ins. */
  15226. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  15227. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  15228. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  15229. /* Built-in method references for those with the same name as other `lodash` methods. */
  15230. var nativeCeil = Math.ceil,
  15231. nativeFloor = Math.floor,
  15232. nativeGetSymbols = Object.getOwnPropertySymbols,
  15233. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  15234. nativeIsFinite = context.isFinite,
  15235. nativeJoin = arrayProto.join,
  15236. nativeKeys = overArg(Object.keys, Object),
  15237. nativeMax = Math.max,
  15238. nativeMin = Math.min,
  15239. nativeNow = Date.now,
  15240. nativeParseInt = context.parseInt,
  15241. nativeRandom = Math.random,
  15242. nativeReverse = arrayProto.reverse;
  15243. /* Built-in method references that are verified to be native. */
  15244. var DataView = getNative(context, 'DataView'),
  15245. Map = getNative(context, 'Map'),
  15246. Promise = getNative(context, 'Promise'),
  15247. Set = getNative(context, 'Set'),
  15248. WeakMap = getNative(context, 'WeakMap'),
  15249. nativeCreate = getNative(Object, 'create');
  15250. /** Used to store function metadata. */
  15251. var metaMap = WeakMap && new WeakMap;
  15252. /** Used to lookup unminified function names. */
  15253. var realNames = {};
  15254. /** Used to detect maps, sets, and weakmaps. */
  15255. var dataViewCtorString = toSource(DataView),
  15256. mapCtorString = toSource(Map),
  15257. promiseCtorString = toSource(Promise),
  15258. setCtorString = toSource(Set),
  15259. weakMapCtorString = toSource(WeakMap);
  15260. /** Used to convert symbols to primitives and strings. */
  15261. var symbolProto = Symbol ? Symbol.prototype : undefined,
  15262. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  15263. symbolToString = symbolProto ? symbolProto.toString : undefined;
  15264. /*------------------------------------------------------------------------*/
  15265. /**
  15266. * Creates a `lodash` object which wraps `value` to enable implicit method
  15267. * chain sequences. Methods that operate on and return arrays, collections,
  15268. * and functions can be chained together. Methods that retrieve a single value
  15269. * or may return a primitive value will automatically end the chain sequence
  15270. * and return the unwrapped value. Otherwise, the value must be unwrapped
  15271. * with `_#value`.
  15272. *
  15273. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  15274. * enabled using `_.chain`.
  15275. *
  15276. * The execution of chained methods is lazy, that is, it's deferred until
  15277. * `_#value` is implicitly or explicitly called.
  15278. *
  15279. * Lazy evaluation allows several methods to support shortcut fusion.
  15280. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  15281. * the creation of intermediate arrays and can greatly reduce the number of
  15282. * iteratee executions. Sections of a chain sequence qualify for shortcut
  15283. * fusion if the section is applied to an array and iteratees accept only
  15284. * one argument. The heuristic for whether a section qualifies for shortcut
  15285. * fusion is subject to change.
  15286. *
  15287. * Chaining is supported in custom builds as long as the `_#value` method is
  15288. * directly or indirectly included in the build.
  15289. *
  15290. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  15291. *
  15292. * The wrapper `Array` methods are:
  15293. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  15294. *
  15295. * The wrapper `String` methods are:
  15296. * `replace` and `split`
  15297. *
  15298. * The wrapper methods that support shortcut fusion are:
  15299. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  15300. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  15301. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  15302. *
  15303. * The chainable wrapper methods are:
  15304. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  15305. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  15306. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  15307. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  15308. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  15309. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  15310. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  15311. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  15312. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  15313. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  15314. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  15315. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  15316. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  15317. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  15318. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  15319. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  15320. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  15321. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  15322. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  15323. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  15324. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  15325. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  15326. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  15327. * `zipObject`, `zipObjectDeep`, and `zipWith`
  15328. *
  15329. * The wrapper methods that are **not** chainable by default are:
  15330. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  15331. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  15332. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  15333. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  15334. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  15335. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  15336. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  15337. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  15338. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  15339. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  15340. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  15341. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  15342. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  15343. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  15344. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  15345. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  15346. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  15347. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  15348. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  15349. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  15350. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  15351. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  15352. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  15353. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  15354. * `upperFirst`, `value`, and `words`
  15355. *
  15356. * @name _
  15357. * @constructor
  15358. * @category Seq
  15359. * @param {*} value The value to wrap in a `lodash` instance.
  15360. * @returns {Object} Returns the new `lodash` wrapper instance.
  15361. * @example
  15362. *
  15363. * function square(n) {
  15364. * return n * n;
  15365. * }
  15366. *
  15367. * var wrapped = _([1, 2, 3]);
  15368. *
  15369. * // Returns an unwrapped value.
  15370. * wrapped.reduce(_.add);
  15371. * // => 6
  15372. *
  15373. * // Returns a wrapped value.
  15374. * var squares = wrapped.map(square);
  15375. *
  15376. * _.isArray(squares);
  15377. * // => false
  15378. *
  15379. * _.isArray(squares.value());
  15380. * // => true
  15381. */
  15382. function lodash(value) {
  15383. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  15384. if (value instanceof LodashWrapper) {
  15385. return value;
  15386. }
  15387. if (hasOwnProperty.call(value, '__wrapped__')) {
  15388. return wrapperClone(value);
  15389. }
  15390. }
  15391. return new LodashWrapper(value);
  15392. }
  15393. /**
  15394. * The base implementation of `_.create` without support for assigning
  15395. * properties to the created object.
  15396. *
  15397. * @private
  15398. * @param {Object} proto The object to inherit from.
  15399. * @returns {Object} Returns the new object.
  15400. */
  15401. var baseCreate = (function() {
  15402. function object() {}
  15403. return function(proto) {
  15404. if (!isObject(proto)) {
  15405. return {};
  15406. }
  15407. if (objectCreate) {
  15408. return objectCreate(proto);
  15409. }
  15410. object.prototype = proto;
  15411. var result = new object;
  15412. object.prototype = undefined;
  15413. return result;
  15414. };
  15415. }());
  15416. /**
  15417. * The function whose prototype chain sequence wrappers inherit from.
  15418. *
  15419. * @private
  15420. */
  15421. function baseLodash() {
  15422. // No operation performed.
  15423. }
  15424. /**
  15425. * The base constructor for creating `lodash` wrapper objects.
  15426. *
  15427. * @private
  15428. * @param {*} value The value to wrap.
  15429. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  15430. */
  15431. function LodashWrapper(value, chainAll) {
  15432. this.__wrapped__ = value;
  15433. this.__actions__ = [];
  15434. this.__chain__ = !!chainAll;
  15435. this.__index__ = 0;
  15436. this.__values__ = undefined;
  15437. }
  15438. /**
  15439. * By default, the template delimiters used by lodash are like those in
  15440. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  15441. * following template settings to use alternative delimiters.
  15442. *
  15443. * @static
  15444. * @memberOf _
  15445. * @type {Object}
  15446. */
  15447. lodash.templateSettings = {
  15448. /**
  15449. * Used to detect `data` property values to be HTML-escaped.
  15450. *
  15451. * @memberOf _.templateSettings
  15452. * @type {RegExp}
  15453. */
  15454. 'escape': reEscape,
  15455. /**
  15456. * Used to detect code to be evaluated.
  15457. *
  15458. * @memberOf _.templateSettings
  15459. * @type {RegExp}
  15460. */
  15461. 'evaluate': reEvaluate,
  15462. /**
  15463. * Used to detect `data` property values to inject.
  15464. *
  15465. * @memberOf _.templateSettings
  15466. * @type {RegExp}
  15467. */
  15468. 'interpolate': reInterpolate,
  15469. /**
  15470. * Used to reference the data object in the template text.
  15471. *
  15472. * @memberOf _.templateSettings
  15473. * @type {string}
  15474. */
  15475. 'variable': '',
  15476. /**
  15477. * Used to import variables into the compiled template.
  15478. *
  15479. * @memberOf _.templateSettings
  15480. * @type {Object}
  15481. */
  15482. 'imports': {
  15483. /**
  15484. * A reference to the `lodash` function.
  15485. *
  15486. * @memberOf _.templateSettings.imports
  15487. * @type {Function}
  15488. */
  15489. '_': lodash
  15490. }
  15491. };
  15492. // Ensure wrappers are instances of `baseLodash`.
  15493. lodash.prototype = baseLodash.prototype;
  15494. lodash.prototype.constructor = lodash;
  15495. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  15496. LodashWrapper.prototype.constructor = LodashWrapper;
  15497. /*------------------------------------------------------------------------*/
  15498. /**
  15499. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  15500. *
  15501. * @private
  15502. * @constructor
  15503. * @param {*} value The value to wrap.
  15504. */
  15505. function LazyWrapper(value) {
  15506. this.__wrapped__ = value;
  15507. this.__actions__ = [];
  15508. this.__dir__ = 1;
  15509. this.__filtered__ = false;
  15510. this.__iteratees__ = [];
  15511. this.__takeCount__ = MAX_ARRAY_LENGTH;
  15512. this.__views__ = [];
  15513. }
  15514. /**
  15515. * Creates a clone of the lazy wrapper object.
  15516. *
  15517. * @private
  15518. * @name clone
  15519. * @memberOf LazyWrapper
  15520. * @returns {Object} Returns the cloned `LazyWrapper` object.
  15521. */
  15522. function lazyClone() {
  15523. var result = new LazyWrapper(this.__wrapped__);
  15524. result.__actions__ = copyArray(this.__actions__);
  15525. result.__dir__ = this.__dir__;
  15526. result.__filtered__ = this.__filtered__;
  15527. result.__iteratees__ = copyArray(this.__iteratees__);
  15528. result.__takeCount__ = this.__takeCount__;
  15529. result.__views__ = copyArray(this.__views__);
  15530. return result;
  15531. }
  15532. /**
  15533. * Reverses the direction of lazy iteration.
  15534. *
  15535. * @private
  15536. * @name reverse
  15537. * @memberOf LazyWrapper
  15538. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  15539. */
  15540. function lazyReverse() {
  15541. if (this.__filtered__) {
  15542. var result = new LazyWrapper(this);
  15543. result.__dir__ = -1;
  15544. result.__filtered__ = true;
  15545. } else {
  15546. result = this.clone();
  15547. result.__dir__ *= -1;
  15548. }
  15549. return result;
  15550. }
  15551. /**
  15552. * Extracts the unwrapped value from its lazy wrapper.
  15553. *
  15554. * @private
  15555. * @name value
  15556. * @memberOf LazyWrapper
  15557. * @returns {*} Returns the unwrapped value.
  15558. */
  15559. function lazyValue() {
  15560. var array = this.__wrapped__.value(),
  15561. dir = this.__dir__,
  15562. isArr = isArray(array),
  15563. isRight = dir < 0,
  15564. arrLength = isArr ? array.length : 0,
  15565. view = getView(0, arrLength, this.__views__),
  15566. start = view.start,
  15567. end = view.end,
  15568. length = end - start,
  15569. index = isRight ? end : (start - 1),
  15570. iteratees = this.__iteratees__,
  15571. iterLength = iteratees.length,
  15572. resIndex = 0,
  15573. takeCount = nativeMin(length, this.__takeCount__);
  15574. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  15575. return baseWrapperValue(array, this.__actions__);
  15576. }
  15577. var result = [];
  15578. outer:
  15579. while (length-- && resIndex < takeCount) {
  15580. index += dir;
  15581. var iterIndex = -1,
  15582. value = array[index];
  15583. while (++iterIndex < iterLength) {
  15584. var data = iteratees[iterIndex],
  15585. iteratee = data.iteratee,
  15586. type = data.type,
  15587. computed = iteratee(value);
  15588. if (type == LAZY_MAP_FLAG) {
  15589. value = computed;
  15590. } else if (!computed) {
  15591. if (type == LAZY_FILTER_FLAG) {
  15592. continue outer;
  15593. } else {
  15594. break outer;
  15595. }
  15596. }
  15597. }
  15598. result[resIndex++] = value;
  15599. }
  15600. return result;
  15601. }
  15602. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  15603. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  15604. LazyWrapper.prototype.constructor = LazyWrapper;
  15605. /*------------------------------------------------------------------------*/
  15606. /**
  15607. * Creates a hash object.
  15608. *
  15609. * @private
  15610. * @constructor
  15611. * @param {Array} [entries] The key-value pairs to cache.
  15612. */
  15613. function Hash(entries) {
  15614. var index = -1,
  15615. length = entries == null ? 0 : entries.length;
  15616. this.clear();
  15617. while (++index < length) {
  15618. var entry = entries[index];
  15619. this.set(entry[0], entry[1]);
  15620. }
  15621. }
  15622. /**
  15623. * Removes all key-value entries from the hash.
  15624. *
  15625. * @private
  15626. * @name clear
  15627. * @memberOf Hash
  15628. */
  15629. function hashClear() {
  15630. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  15631. this.size = 0;
  15632. }
  15633. /**
  15634. * Removes `key` and its value from the hash.
  15635. *
  15636. * @private
  15637. * @name delete
  15638. * @memberOf Hash
  15639. * @param {Object} hash The hash to modify.
  15640. * @param {string} key The key of the value to remove.
  15641. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15642. */
  15643. function hashDelete(key) {
  15644. var result = this.has(key) && delete this.__data__[key];
  15645. this.size -= result ? 1 : 0;
  15646. return result;
  15647. }
  15648. /**
  15649. * Gets the hash value for `key`.
  15650. *
  15651. * @private
  15652. * @name get
  15653. * @memberOf Hash
  15654. * @param {string} key The key of the value to get.
  15655. * @returns {*} Returns the entry value.
  15656. */
  15657. function hashGet(key) {
  15658. var data = this.__data__;
  15659. if (nativeCreate) {
  15660. var result = data[key];
  15661. return result === HASH_UNDEFINED ? undefined : result;
  15662. }
  15663. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  15664. }
  15665. /**
  15666. * Checks if a hash value for `key` exists.
  15667. *
  15668. * @private
  15669. * @name has
  15670. * @memberOf Hash
  15671. * @param {string} key The key of the entry to check.
  15672. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15673. */
  15674. function hashHas(key) {
  15675. var data = this.__data__;
  15676. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  15677. }
  15678. /**
  15679. * Sets the hash `key` to `value`.
  15680. *
  15681. * @private
  15682. * @name set
  15683. * @memberOf Hash
  15684. * @param {string} key The key of the value to set.
  15685. * @param {*} value The value to set.
  15686. * @returns {Object} Returns the hash instance.
  15687. */
  15688. function hashSet(key, value) {
  15689. var data = this.__data__;
  15690. this.size += this.has(key) ? 0 : 1;
  15691. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  15692. return this;
  15693. }
  15694. // Add methods to `Hash`.
  15695. Hash.prototype.clear = hashClear;
  15696. Hash.prototype['delete'] = hashDelete;
  15697. Hash.prototype.get = hashGet;
  15698. Hash.prototype.has = hashHas;
  15699. Hash.prototype.set = hashSet;
  15700. /*------------------------------------------------------------------------*/
  15701. /**
  15702. * Creates an list cache object.
  15703. *
  15704. * @private
  15705. * @constructor
  15706. * @param {Array} [entries] The key-value pairs to cache.
  15707. */
  15708. function ListCache(entries) {
  15709. var index = -1,
  15710. length = entries == null ? 0 : entries.length;
  15711. this.clear();
  15712. while (++index < length) {
  15713. var entry = entries[index];
  15714. this.set(entry[0], entry[1]);
  15715. }
  15716. }
  15717. /**
  15718. * Removes all key-value entries from the list cache.
  15719. *
  15720. * @private
  15721. * @name clear
  15722. * @memberOf ListCache
  15723. */
  15724. function listCacheClear() {
  15725. this.__data__ = [];
  15726. this.size = 0;
  15727. }
  15728. /**
  15729. * Removes `key` and its value from the list cache.
  15730. *
  15731. * @private
  15732. * @name delete
  15733. * @memberOf ListCache
  15734. * @param {string} key The key of the value to remove.
  15735. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15736. */
  15737. function listCacheDelete(key) {
  15738. var data = this.__data__,
  15739. index = assocIndexOf(data, key);
  15740. if (index < 0) {
  15741. return false;
  15742. }
  15743. var lastIndex = data.length - 1;
  15744. if (index == lastIndex) {
  15745. data.pop();
  15746. } else {
  15747. splice.call(data, index, 1);
  15748. }
  15749. --this.size;
  15750. return true;
  15751. }
  15752. /**
  15753. * Gets the list cache value for `key`.
  15754. *
  15755. * @private
  15756. * @name get
  15757. * @memberOf ListCache
  15758. * @param {string} key The key of the value to get.
  15759. * @returns {*} Returns the entry value.
  15760. */
  15761. function listCacheGet(key) {
  15762. var data = this.__data__,
  15763. index = assocIndexOf(data, key);
  15764. return index < 0 ? undefined : data[index][1];
  15765. }
  15766. /**
  15767. * Checks if a list cache value for `key` exists.
  15768. *
  15769. * @private
  15770. * @name has
  15771. * @memberOf ListCache
  15772. * @param {string} key The key of the entry to check.
  15773. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15774. */
  15775. function listCacheHas(key) {
  15776. return assocIndexOf(this.__data__, key) > -1;
  15777. }
  15778. /**
  15779. * Sets the list cache `key` to `value`.
  15780. *
  15781. * @private
  15782. * @name set
  15783. * @memberOf ListCache
  15784. * @param {string} key The key of the value to set.
  15785. * @param {*} value The value to set.
  15786. * @returns {Object} Returns the list cache instance.
  15787. */
  15788. function listCacheSet(key, value) {
  15789. var data = this.__data__,
  15790. index = assocIndexOf(data, key);
  15791. if (index < 0) {
  15792. ++this.size;
  15793. data.push([key, value]);
  15794. } else {
  15795. data[index][1] = value;
  15796. }
  15797. return this;
  15798. }
  15799. // Add methods to `ListCache`.
  15800. ListCache.prototype.clear = listCacheClear;
  15801. ListCache.prototype['delete'] = listCacheDelete;
  15802. ListCache.prototype.get = listCacheGet;
  15803. ListCache.prototype.has = listCacheHas;
  15804. ListCache.prototype.set = listCacheSet;
  15805. /*------------------------------------------------------------------------*/
  15806. /**
  15807. * Creates a map cache object to store key-value pairs.
  15808. *
  15809. * @private
  15810. * @constructor
  15811. * @param {Array} [entries] The key-value pairs to cache.
  15812. */
  15813. function MapCache(entries) {
  15814. var index = -1,
  15815. length = entries == null ? 0 : entries.length;
  15816. this.clear();
  15817. while (++index < length) {
  15818. var entry = entries[index];
  15819. this.set(entry[0], entry[1]);
  15820. }
  15821. }
  15822. /**
  15823. * Removes all key-value entries from the map.
  15824. *
  15825. * @private
  15826. * @name clear
  15827. * @memberOf MapCache
  15828. */
  15829. function mapCacheClear() {
  15830. this.size = 0;
  15831. this.__data__ = {
  15832. 'hash': new Hash,
  15833. 'map': new (Map || ListCache),
  15834. 'string': new Hash
  15835. };
  15836. }
  15837. /**
  15838. * Removes `key` and its value from the map.
  15839. *
  15840. * @private
  15841. * @name delete
  15842. * @memberOf MapCache
  15843. * @param {string} key The key of the value to remove.
  15844. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15845. */
  15846. function mapCacheDelete(key) {
  15847. var result = getMapData(this, key)['delete'](key);
  15848. this.size -= result ? 1 : 0;
  15849. return result;
  15850. }
  15851. /**
  15852. * Gets the map value for `key`.
  15853. *
  15854. * @private
  15855. * @name get
  15856. * @memberOf MapCache
  15857. * @param {string} key The key of the value to get.
  15858. * @returns {*} Returns the entry value.
  15859. */
  15860. function mapCacheGet(key) {
  15861. return getMapData(this, key).get(key);
  15862. }
  15863. /**
  15864. * Checks if a map value for `key` exists.
  15865. *
  15866. * @private
  15867. * @name has
  15868. * @memberOf MapCache
  15869. * @param {string} key The key of the entry to check.
  15870. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15871. */
  15872. function mapCacheHas(key) {
  15873. return getMapData(this, key).has(key);
  15874. }
  15875. /**
  15876. * Sets the map `key` to `value`.
  15877. *
  15878. * @private
  15879. * @name set
  15880. * @memberOf MapCache
  15881. * @param {string} key The key of the value to set.
  15882. * @param {*} value The value to set.
  15883. * @returns {Object} Returns the map cache instance.
  15884. */
  15885. function mapCacheSet(key, value) {
  15886. var data = getMapData(this, key),
  15887. size = data.size;
  15888. data.set(key, value);
  15889. this.size += data.size == size ? 0 : 1;
  15890. return this;
  15891. }
  15892. // Add methods to `MapCache`.
  15893. MapCache.prototype.clear = mapCacheClear;
  15894. MapCache.prototype['delete'] = mapCacheDelete;
  15895. MapCache.prototype.get = mapCacheGet;
  15896. MapCache.prototype.has = mapCacheHas;
  15897. MapCache.prototype.set = mapCacheSet;
  15898. /*------------------------------------------------------------------------*/
  15899. /**
  15900. *
  15901. * Creates an array cache object to store unique values.
  15902. *
  15903. * @private
  15904. * @constructor
  15905. * @param {Array} [values] The values to cache.
  15906. */
  15907. function SetCache(values) {
  15908. var index = -1,
  15909. length = values == null ? 0 : values.length;
  15910. this.__data__ = new MapCache;
  15911. while (++index < length) {
  15912. this.add(values[index]);
  15913. }
  15914. }
  15915. /**
  15916. * Adds `value` to the array cache.
  15917. *
  15918. * @private
  15919. * @name add
  15920. * @memberOf SetCache
  15921. * @alias push
  15922. * @param {*} value The value to cache.
  15923. * @returns {Object} Returns the cache instance.
  15924. */
  15925. function setCacheAdd(value) {
  15926. this.__data__.set(value, HASH_UNDEFINED);
  15927. return this;
  15928. }
  15929. /**
  15930. * Checks if `value` is in the array cache.
  15931. *
  15932. * @private
  15933. * @name has
  15934. * @memberOf SetCache
  15935. * @param {*} value The value to search for.
  15936. * @returns {number} Returns `true` if `value` is found, else `false`.
  15937. */
  15938. function setCacheHas(value) {
  15939. return this.__data__.has(value);
  15940. }
  15941. // Add methods to `SetCache`.
  15942. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  15943. SetCache.prototype.has = setCacheHas;
  15944. /*------------------------------------------------------------------------*/
  15945. /**
  15946. * Creates a stack cache object to store key-value pairs.
  15947. *
  15948. * @private
  15949. * @constructor
  15950. * @param {Array} [entries] The key-value pairs to cache.
  15951. */
  15952. function Stack(entries) {
  15953. var data = this.__data__ = new ListCache(entries);
  15954. this.size = data.size;
  15955. }
  15956. /**
  15957. * Removes all key-value entries from the stack.
  15958. *
  15959. * @private
  15960. * @name clear
  15961. * @memberOf Stack
  15962. */
  15963. function stackClear() {
  15964. this.__data__ = new ListCache;
  15965. this.size = 0;
  15966. }
  15967. /**
  15968. * Removes `key` and its value from the stack.
  15969. *
  15970. * @private
  15971. * @name delete
  15972. * @memberOf Stack
  15973. * @param {string} key The key of the value to remove.
  15974. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15975. */
  15976. function stackDelete(key) {
  15977. var data = this.__data__,
  15978. result = data['delete'](key);
  15979. this.size = data.size;
  15980. return result;
  15981. }
  15982. /**
  15983. * Gets the stack value for `key`.
  15984. *
  15985. * @private
  15986. * @name get
  15987. * @memberOf Stack
  15988. * @param {string} key The key of the value to get.
  15989. * @returns {*} Returns the entry value.
  15990. */
  15991. function stackGet(key) {
  15992. return this.__data__.get(key);
  15993. }
  15994. /**
  15995. * Checks if a stack value for `key` exists.
  15996. *
  15997. * @private
  15998. * @name has
  15999. * @memberOf Stack
  16000. * @param {string} key The key of the entry to check.
  16001. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  16002. */
  16003. function stackHas(key) {
  16004. return this.__data__.has(key);
  16005. }
  16006. /**
  16007. * Sets the stack `key` to `value`.
  16008. *
  16009. * @private
  16010. * @name set
  16011. * @memberOf Stack
  16012. * @param {string} key The key of the value to set.
  16013. * @param {*} value The value to set.
  16014. * @returns {Object} Returns the stack cache instance.
  16015. */
  16016. function stackSet(key, value) {
  16017. var data = this.__data__;
  16018. if (data instanceof ListCache) {
  16019. var pairs = data.__data__;
  16020. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  16021. pairs.push([key, value]);
  16022. this.size = ++data.size;
  16023. return this;
  16024. }
  16025. data = this.__data__ = new MapCache(pairs);
  16026. }
  16027. data.set(key, value);
  16028. this.size = data.size;
  16029. return this;
  16030. }
  16031. // Add methods to `Stack`.
  16032. Stack.prototype.clear = stackClear;
  16033. Stack.prototype['delete'] = stackDelete;
  16034. Stack.prototype.get = stackGet;
  16035. Stack.prototype.has = stackHas;
  16036. Stack.prototype.set = stackSet;
  16037. /*------------------------------------------------------------------------*/
  16038. /**
  16039. * Creates an array of the enumerable property names of the array-like `value`.
  16040. *
  16041. * @private
  16042. * @param {*} value The value to query.
  16043. * @param {boolean} inherited Specify returning inherited property names.
  16044. * @returns {Array} Returns the array of property names.
  16045. */
  16046. function arrayLikeKeys(value, inherited) {
  16047. var isArr = isArray(value),
  16048. isArg = !isArr && isArguments(value),
  16049. isBuff = !isArr && !isArg && isBuffer(value),
  16050. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  16051. skipIndexes = isArr || isArg || isBuff || isType,
  16052. result = skipIndexes ? baseTimes(value.length, String) : [],
  16053. length = result.length;
  16054. for (var key in value) {
  16055. if ((inherited || hasOwnProperty.call(value, key)) &&
  16056. !(skipIndexes && (
  16057. // Safari 9 has enumerable `arguments.length` in strict mode.
  16058. key == 'length' ||
  16059. // Node.js 0.10 has enumerable non-index properties on buffers.
  16060. (isBuff && (key == 'offset' || key == 'parent')) ||
  16061. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  16062. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  16063. // Skip index properties.
  16064. isIndex(key, length)
  16065. ))) {
  16066. result.push(key);
  16067. }
  16068. }
  16069. return result;
  16070. }
  16071. /**
  16072. * A specialized version of `_.sample` for arrays.
  16073. *
  16074. * @private
  16075. * @param {Array} array The array to sample.
  16076. * @returns {*} Returns the random element.
  16077. */
  16078. function arraySample(array) {
  16079. var length = array.length;
  16080. return length ? array[baseRandom(0, length - 1)] : undefined;
  16081. }
  16082. /**
  16083. * A specialized version of `_.sampleSize` for arrays.
  16084. *
  16085. * @private
  16086. * @param {Array} array The array to sample.
  16087. * @param {number} n The number of elements to sample.
  16088. * @returns {Array} Returns the random elements.
  16089. */
  16090. function arraySampleSize(array, n) {
  16091. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  16092. }
  16093. /**
  16094. * A specialized version of `_.shuffle` for arrays.
  16095. *
  16096. * @private
  16097. * @param {Array} array The array to shuffle.
  16098. * @returns {Array} Returns the new shuffled array.
  16099. */
  16100. function arrayShuffle(array) {
  16101. return shuffleSelf(copyArray(array));
  16102. }
  16103. /**
  16104. * This function is like `assignValue` except that it doesn't assign
  16105. * `undefined` values.
  16106. *
  16107. * @private
  16108. * @param {Object} object The object to modify.
  16109. * @param {string} key The key of the property to assign.
  16110. * @param {*} value The value to assign.
  16111. */
  16112. function assignMergeValue(object, key, value) {
  16113. if ((value !== undefined && !eq(object[key], value)) ||
  16114. (value === undefined && !(key in object))) {
  16115. baseAssignValue(object, key, value);
  16116. }
  16117. }
  16118. /**
  16119. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  16120. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  16121. * for equality comparisons.
  16122. *
  16123. * @private
  16124. * @param {Object} object The object to modify.
  16125. * @param {string} key The key of the property to assign.
  16126. * @param {*} value The value to assign.
  16127. */
  16128. function assignValue(object, key, value) {
  16129. var objValue = object[key];
  16130. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  16131. (value === undefined && !(key in object))) {
  16132. baseAssignValue(object, key, value);
  16133. }
  16134. }
  16135. /**
  16136. * Gets the index at which the `key` is found in `array` of key-value pairs.
  16137. *
  16138. * @private
  16139. * @param {Array} array The array to inspect.
  16140. * @param {*} key The key to search for.
  16141. * @returns {number} Returns the index of the matched value, else `-1`.
  16142. */
  16143. function assocIndexOf(array, key) {
  16144. var length = array.length;
  16145. while (length--) {
  16146. if (eq(array[length][0], key)) {
  16147. return length;
  16148. }
  16149. }
  16150. return -1;
  16151. }
  16152. /**
  16153. * Aggregates elements of `collection` on `accumulator` with keys transformed
  16154. * by `iteratee` and values set by `setter`.
  16155. *
  16156. * @private
  16157. * @param {Array|Object} collection The collection to iterate over.
  16158. * @param {Function} setter The function to set `accumulator` values.
  16159. * @param {Function} iteratee The iteratee to transform keys.
  16160. * @param {Object} accumulator The initial aggregated object.
  16161. * @returns {Function} Returns `accumulator`.
  16162. */
  16163. function baseAggregator(collection, setter, iteratee, accumulator) {
  16164. baseEach(collection, function(value, key, collection) {
  16165. setter(accumulator, value, iteratee(value), collection);
  16166. });
  16167. return accumulator;
  16168. }
  16169. /**
  16170. * The base implementation of `_.assign` without support for multiple sources
  16171. * or `customizer` functions.
  16172. *
  16173. * @private
  16174. * @param {Object} object The destination object.
  16175. * @param {Object} source The source object.
  16176. * @returns {Object} Returns `object`.
  16177. */
  16178. function baseAssign(object, source) {
  16179. return object && copyObject(source, keys(source), object);
  16180. }
  16181. /**
  16182. * The base implementation of `_.assignIn` without support for multiple sources
  16183. * or `customizer` functions.
  16184. *
  16185. * @private
  16186. * @param {Object} object The destination object.
  16187. * @param {Object} source The source object.
  16188. * @returns {Object} Returns `object`.
  16189. */
  16190. function baseAssignIn(object, source) {
  16191. return object && copyObject(source, keysIn(source), object);
  16192. }
  16193. /**
  16194. * The base implementation of `assignValue` and `assignMergeValue` without
  16195. * value checks.
  16196. *
  16197. * @private
  16198. * @param {Object} object The object to modify.
  16199. * @param {string} key The key of the property to assign.
  16200. * @param {*} value The value to assign.
  16201. */
  16202. function baseAssignValue(object, key, value) {
  16203. if (key == '__proto__' && defineProperty) {
  16204. defineProperty(object, key, {
  16205. 'configurable': true,
  16206. 'enumerable': true,
  16207. 'value': value,
  16208. 'writable': true
  16209. });
  16210. } else {
  16211. object[key] = value;
  16212. }
  16213. }
  16214. /**
  16215. * The base implementation of `_.at` without support for individual paths.
  16216. *
  16217. * @private
  16218. * @param {Object} object The object to iterate over.
  16219. * @param {string[]} paths The property paths to pick.
  16220. * @returns {Array} Returns the picked elements.
  16221. */
  16222. function baseAt(object, paths) {
  16223. var index = -1,
  16224. length = paths.length,
  16225. result = Array(length),
  16226. skip = object == null;
  16227. while (++index < length) {
  16228. result[index] = skip ? undefined : get(object, paths[index]);
  16229. }
  16230. return result;
  16231. }
  16232. /**
  16233. * The base implementation of `_.clamp` which doesn't coerce arguments.
  16234. *
  16235. * @private
  16236. * @param {number} number The number to clamp.
  16237. * @param {number} [lower] The lower bound.
  16238. * @param {number} upper The upper bound.
  16239. * @returns {number} Returns the clamped number.
  16240. */
  16241. function baseClamp(number, lower, upper) {
  16242. if (number === number) {
  16243. if (upper !== undefined) {
  16244. number = number <= upper ? number : upper;
  16245. }
  16246. if (lower !== undefined) {
  16247. number = number >= lower ? number : lower;
  16248. }
  16249. }
  16250. return number;
  16251. }
  16252. /**
  16253. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  16254. * traversed objects.
  16255. *
  16256. * @private
  16257. * @param {*} value The value to clone.
  16258. * @param {boolean} bitmask The bitmask flags.
  16259. * 1 - Deep clone
  16260. * 2 - Flatten inherited properties
  16261. * 4 - Clone symbols
  16262. * @param {Function} [customizer] The function to customize cloning.
  16263. * @param {string} [key] The key of `value`.
  16264. * @param {Object} [object] The parent object of `value`.
  16265. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  16266. * @returns {*} Returns the cloned value.
  16267. */
  16268. function baseClone(value, bitmask, customizer, key, object, stack) {
  16269. var result,
  16270. isDeep = bitmask & CLONE_DEEP_FLAG,
  16271. isFlat = bitmask & CLONE_FLAT_FLAG,
  16272. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  16273. if (customizer) {
  16274. result = object ? customizer(value, key, object, stack) : customizer(value);
  16275. }
  16276. if (result !== undefined) {
  16277. return result;
  16278. }
  16279. if (!isObject(value)) {
  16280. return value;
  16281. }
  16282. var isArr = isArray(value);
  16283. if (isArr) {
  16284. result = initCloneArray(value);
  16285. if (!isDeep) {
  16286. return copyArray(value, result);
  16287. }
  16288. } else {
  16289. var tag = getTag(value),
  16290. isFunc = tag == funcTag || tag == genTag;
  16291. if (isBuffer(value)) {
  16292. return cloneBuffer(value, isDeep);
  16293. }
  16294. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  16295. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  16296. if (!isDeep) {
  16297. return isFlat
  16298. ? copySymbolsIn(value, baseAssignIn(result, value))
  16299. : copySymbols(value, baseAssign(result, value));
  16300. }
  16301. } else {
  16302. if (!cloneableTags[tag]) {
  16303. return object ? value : {};
  16304. }
  16305. result = initCloneByTag(value, tag, isDeep);
  16306. }
  16307. }
  16308. // Check for circular references and return its corresponding clone.
  16309. stack || (stack = new Stack);
  16310. var stacked = stack.get(value);
  16311. if (stacked) {
  16312. return stacked;
  16313. }
  16314. stack.set(value, result);
  16315. if (isSet(value)) {
  16316. value.forEach(function(subValue) {
  16317. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  16318. });
  16319. } else if (isMap(value)) {
  16320. value.forEach(function(subValue, key) {
  16321. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  16322. });
  16323. }
  16324. var keysFunc = isFull
  16325. ? (isFlat ? getAllKeysIn : getAllKeys)
  16326. : (isFlat ? keysIn : keys);
  16327. var props = isArr ? undefined : keysFunc(value);
  16328. arrayEach(props || value, function(subValue, key) {
  16329. if (props) {
  16330. key = subValue;
  16331. subValue = value[key];
  16332. }
  16333. // Recursively populate clone (susceptible to call stack limits).
  16334. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  16335. });
  16336. return result;
  16337. }
  16338. /**
  16339. * The base implementation of `_.conforms` which doesn't clone `source`.
  16340. *
  16341. * @private
  16342. * @param {Object} source The object of property predicates to conform to.
  16343. * @returns {Function} Returns the new spec function.
  16344. */
  16345. function baseConforms(source) {
  16346. var props = keys(source);
  16347. return function(object) {
  16348. return baseConformsTo(object, source, props);
  16349. };
  16350. }
  16351. /**
  16352. * The base implementation of `_.conformsTo` which accepts `props` to check.
  16353. *
  16354. * @private
  16355. * @param {Object} object The object to inspect.
  16356. * @param {Object} source The object of property predicates to conform to.
  16357. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  16358. */
  16359. function baseConformsTo(object, source, props) {
  16360. var length = props.length;
  16361. if (object == null) {
  16362. return !length;
  16363. }
  16364. object = Object(object);
  16365. while (length--) {
  16366. var key = props[length],
  16367. predicate = source[key],
  16368. value = object[key];
  16369. if ((value === undefined && !(key in object)) || !predicate(value)) {
  16370. return false;
  16371. }
  16372. }
  16373. return true;
  16374. }
  16375. /**
  16376. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  16377. * to provide to `func`.
  16378. *
  16379. * @private
  16380. * @param {Function} func The function to delay.
  16381. * @param {number} wait The number of milliseconds to delay invocation.
  16382. * @param {Array} args The arguments to provide to `func`.
  16383. * @returns {number|Object} Returns the timer id or timeout object.
  16384. */
  16385. function baseDelay(func, wait, args) {
  16386. if (typeof func != 'function') {
  16387. throw new TypeError(FUNC_ERROR_TEXT);
  16388. }
  16389. return setTimeout(function() { func.apply(undefined, args); }, wait);
  16390. }
  16391. /**
  16392. * The base implementation of methods like `_.difference` without support
  16393. * for excluding multiple arrays or iteratee shorthands.
  16394. *
  16395. * @private
  16396. * @param {Array} array The array to inspect.
  16397. * @param {Array} values The values to exclude.
  16398. * @param {Function} [iteratee] The iteratee invoked per element.
  16399. * @param {Function} [comparator] The comparator invoked per element.
  16400. * @returns {Array} Returns the new array of filtered values.
  16401. */
  16402. function baseDifference(array, values, iteratee, comparator) {
  16403. var index = -1,
  16404. includes = arrayIncludes,
  16405. isCommon = true,
  16406. length = array.length,
  16407. result = [],
  16408. valuesLength = values.length;
  16409. if (!length) {
  16410. return result;
  16411. }
  16412. if (iteratee) {
  16413. values = arrayMap(values, baseUnary(iteratee));
  16414. }
  16415. if (comparator) {
  16416. includes = arrayIncludesWith;
  16417. isCommon = false;
  16418. }
  16419. else if (values.length >= LARGE_ARRAY_SIZE) {
  16420. includes = cacheHas;
  16421. isCommon = false;
  16422. values = new SetCache(values);
  16423. }
  16424. outer:
  16425. while (++index < length) {
  16426. var value = array[index],
  16427. computed = iteratee == null ? value : iteratee(value);
  16428. value = (comparator || value !== 0) ? value : 0;
  16429. if (isCommon && computed === computed) {
  16430. var valuesIndex = valuesLength;
  16431. while (valuesIndex--) {
  16432. if (values[valuesIndex] === computed) {
  16433. continue outer;
  16434. }
  16435. }
  16436. result.push(value);
  16437. }
  16438. else if (!includes(values, computed, comparator)) {
  16439. result.push(value);
  16440. }
  16441. }
  16442. return result;
  16443. }
  16444. /**
  16445. * The base implementation of `_.forEach` without support for iteratee shorthands.
  16446. *
  16447. * @private
  16448. * @param {Array|Object} collection The collection to iterate over.
  16449. * @param {Function} iteratee The function invoked per iteration.
  16450. * @returns {Array|Object} Returns `collection`.
  16451. */
  16452. var baseEach = createBaseEach(baseForOwn);
  16453. /**
  16454. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  16455. *
  16456. * @private
  16457. * @param {Array|Object} collection The collection to iterate over.
  16458. * @param {Function} iteratee The function invoked per iteration.
  16459. * @returns {Array|Object} Returns `collection`.
  16460. */
  16461. var baseEachRight = createBaseEach(baseForOwnRight, true);
  16462. /**
  16463. * The base implementation of `_.every` without support for iteratee shorthands.
  16464. *
  16465. * @private
  16466. * @param {Array|Object} collection The collection to iterate over.
  16467. * @param {Function} predicate The function invoked per iteration.
  16468. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  16469. * else `false`
  16470. */
  16471. function baseEvery(collection, predicate) {
  16472. var result = true;
  16473. baseEach(collection, function(value, index, collection) {
  16474. result = !!predicate(value, index, collection);
  16475. return result;
  16476. });
  16477. return result;
  16478. }
  16479. /**
  16480. * The base implementation of methods like `_.max` and `_.min` which accepts a
  16481. * `comparator` to determine the extremum value.
  16482. *
  16483. * @private
  16484. * @param {Array} array The array to iterate over.
  16485. * @param {Function} iteratee The iteratee invoked per iteration.
  16486. * @param {Function} comparator The comparator used to compare values.
  16487. * @returns {*} Returns the extremum value.
  16488. */
  16489. function baseExtremum(array, iteratee, comparator) {
  16490. var index = -1,
  16491. length = array.length;
  16492. while (++index < length) {
  16493. var value = array[index],
  16494. current = iteratee(value);
  16495. if (current != null && (computed === undefined
  16496. ? (current === current && !isSymbol(current))
  16497. : comparator(current, computed)
  16498. )) {
  16499. var computed = current,
  16500. result = value;
  16501. }
  16502. }
  16503. return result;
  16504. }
  16505. /**
  16506. * The base implementation of `_.fill` without an iteratee call guard.
  16507. *
  16508. * @private
  16509. * @param {Array} array The array to fill.
  16510. * @param {*} value The value to fill `array` with.
  16511. * @param {number} [start=0] The start position.
  16512. * @param {number} [end=array.length] The end position.
  16513. * @returns {Array} Returns `array`.
  16514. */
  16515. function baseFill(array, value, start, end) {
  16516. var length = array.length;
  16517. start = toInteger(start);
  16518. if (start < 0) {
  16519. start = -start > length ? 0 : (length + start);
  16520. }
  16521. end = (end === undefined || end > length) ? length : toInteger(end);
  16522. if (end < 0) {
  16523. end += length;
  16524. }
  16525. end = start > end ? 0 : toLength(end);
  16526. while (start < end) {
  16527. array[start++] = value;
  16528. }
  16529. return array;
  16530. }
  16531. /**
  16532. * The base implementation of `_.filter` without support for iteratee shorthands.
  16533. *
  16534. * @private
  16535. * @param {Array|Object} collection The collection to iterate over.
  16536. * @param {Function} predicate The function invoked per iteration.
  16537. * @returns {Array} Returns the new filtered array.
  16538. */
  16539. function baseFilter(collection, predicate) {
  16540. var result = [];
  16541. baseEach(collection, function(value, index, collection) {
  16542. if (predicate(value, index, collection)) {
  16543. result.push(value);
  16544. }
  16545. });
  16546. return result;
  16547. }
  16548. /**
  16549. * The base implementation of `_.flatten` with support for restricting flattening.
  16550. *
  16551. * @private
  16552. * @param {Array} array The array to flatten.
  16553. * @param {number} depth The maximum recursion depth.
  16554. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  16555. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  16556. * @param {Array} [result=[]] The initial result value.
  16557. * @returns {Array} Returns the new flattened array.
  16558. */
  16559. function baseFlatten(array, depth, predicate, isStrict, result) {
  16560. var index = -1,
  16561. length = array.length;
  16562. predicate || (predicate = isFlattenable);
  16563. result || (result = []);
  16564. while (++index < length) {
  16565. var value = array[index];
  16566. if (depth > 0 && predicate(value)) {
  16567. if (depth > 1) {
  16568. // Recursively flatten arrays (susceptible to call stack limits).
  16569. baseFlatten(value, depth - 1, predicate, isStrict, result);
  16570. } else {
  16571. arrayPush(result, value);
  16572. }
  16573. } else if (!isStrict) {
  16574. result[result.length] = value;
  16575. }
  16576. }
  16577. return result;
  16578. }
  16579. /**
  16580. * The base implementation of `baseForOwn` which iterates over `object`
  16581. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  16582. * Iteratee functions may exit iteration early by explicitly returning `false`.
  16583. *
  16584. * @private
  16585. * @param {Object} object The object to iterate over.
  16586. * @param {Function} iteratee The function invoked per iteration.
  16587. * @param {Function} keysFunc The function to get the keys of `object`.
  16588. * @returns {Object} Returns `object`.
  16589. */
  16590. var baseFor = createBaseFor();
  16591. /**
  16592. * This function is like `baseFor` except that it iterates over properties
  16593. * in the opposite order.
  16594. *
  16595. * @private
  16596. * @param {Object} object The object to iterate over.
  16597. * @param {Function} iteratee The function invoked per iteration.
  16598. * @param {Function} keysFunc The function to get the keys of `object`.
  16599. * @returns {Object} Returns `object`.
  16600. */
  16601. var baseForRight = createBaseFor(true);
  16602. /**
  16603. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  16604. *
  16605. * @private
  16606. * @param {Object} object The object to iterate over.
  16607. * @param {Function} iteratee The function invoked per iteration.
  16608. * @returns {Object} Returns `object`.
  16609. */
  16610. function baseForOwn(object, iteratee) {
  16611. return object && baseFor(object, iteratee, keys);
  16612. }
  16613. /**
  16614. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  16615. *
  16616. * @private
  16617. * @param {Object} object The object to iterate over.
  16618. * @param {Function} iteratee The function invoked per iteration.
  16619. * @returns {Object} Returns `object`.
  16620. */
  16621. function baseForOwnRight(object, iteratee) {
  16622. return object && baseForRight(object, iteratee, keys);
  16623. }
  16624. /**
  16625. * The base implementation of `_.functions` which creates an array of
  16626. * `object` function property names filtered from `props`.
  16627. *
  16628. * @private
  16629. * @param {Object} object The object to inspect.
  16630. * @param {Array} props The property names to filter.
  16631. * @returns {Array} Returns the function names.
  16632. */
  16633. function baseFunctions(object, props) {
  16634. return arrayFilter(props, function(key) {
  16635. return isFunction(object[key]);
  16636. });
  16637. }
  16638. /**
  16639. * The base implementation of `_.get` without support for default values.
  16640. *
  16641. * @private
  16642. * @param {Object} object The object to query.
  16643. * @param {Array|string} path The path of the property to get.
  16644. * @returns {*} Returns the resolved value.
  16645. */
  16646. function baseGet(object, path) {
  16647. path = castPath(path, object);
  16648. var index = 0,
  16649. length = path.length;
  16650. while (object != null && index < length) {
  16651. object = object[toKey(path[index++])];
  16652. }
  16653. return (index && index == length) ? object : undefined;
  16654. }
  16655. /**
  16656. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  16657. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  16658. * symbols of `object`.
  16659. *
  16660. * @private
  16661. * @param {Object} object The object to query.
  16662. * @param {Function} keysFunc The function to get the keys of `object`.
  16663. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  16664. * @returns {Array} Returns the array of property names and symbols.
  16665. */
  16666. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  16667. var result = keysFunc(object);
  16668. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  16669. }
  16670. /**
  16671. * The base implementation of `getTag` without fallbacks for buggy environments.
  16672. *
  16673. * @private
  16674. * @param {*} value The value to query.
  16675. * @returns {string} Returns the `toStringTag`.
  16676. */
  16677. function baseGetTag(value) {
  16678. if (value == null) {
  16679. return value === undefined ? undefinedTag : nullTag;
  16680. }
  16681. return (symToStringTag && symToStringTag in Object(value))
  16682. ? getRawTag(value)
  16683. : objectToString(value);
  16684. }
  16685. /**
  16686. * The base implementation of `_.gt` which doesn't coerce arguments.
  16687. *
  16688. * @private
  16689. * @param {*} value The value to compare.
  16690. * @param {*} other The other value to compare.
  16691. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  16692. * else `false`.
  16693. */
  16694. function baseGt(value, other) {
  16695. return value > other;
  16696. }
  16697. /**
  16698. * The base implementation of `_.has` without support for deep paths.
  16699. *
  16700. * @private
  16701. * @param {Object} [object] The object to query.
  16702. * @param {Array|string} key The key to check.
  16703. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  16704. */
  16705. function baseHas(object, key) {
  16706. return object != null && hasOwnProperty.call(object, key);
  16707. }
  16708. /**
  16709. * The base implementation of `_.hasIn` without support for deep paths.
  16710. *
  16711. * @private
  16712. * @param {Object} [object] The object to query.
  16713. * @param {Array|string} key The key to check.
  16714. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  16715. */
  16716. function baseHasIn(object, key) {
  16717. return object != null && key in Object(object);
  16718. }
  16719. /**
  16720. * The base implementation of `_.inRange` which doesn't coerce arguments.
  16721. *
  16722. * @private
  16723. * @param {number} number The number to check.
  16724. * @param {number} start The start of the range.
  16725. * @param {number} end The end of the range.
  16726. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  16727. */
  16728. function baseInRange(number, start, end) {
  16729. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  16730. }
  16731. /**
  16732. * The base implementation of methods like `_.intersection`, without support
  16733. * for iteratee shorthands, that accepts an array of arrays to inspect.
  16734. *
  16735. * @private
  16736. * @param {Array} arrays The arrays to inspect.
  16737. * @param {Function} [iteratee] The iteratee invoked per element.
  16738. * @param {Function} [comparator] The comparator invoked per element.
  16739. * @returns {Array} Returns the new array of shared values.
  16740. */
  16741. function baseIntersection(arrays, iteratee, comparator) {
  16742. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  16743. length = arrays[0].length,
  16744. othLength = arrays.length,
  16745. othIndex = othLength,
  16746. caches = Array(othLength),
  16747. maxLength = Infinity,
  16748. result = [];
  16749. while (othIndex--) {
  16750. var array = arrays[othIndex];
  16751. if (othIndex && iteratee) {
  16752. array = arrayMap(array, baseUnary(iteratee));
  16753. }
  16754. maxLength = nativeMin(array.length, maxLength);
  16755. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  16756. ? new SetCache(othIndex && array)
  16757. : undefined;
  16758. }
  16759. array = arrays[0];
  16760. var index = -1,
  16761. seen = caches[0];
  16762. outer:
  16763. while (++index < length && result.length < maxLength) {
  16764. var value = array[index],
  16765. computed = iteratee ? iteratee(value) : value;
  16766. value = (comparator || value !== 0) ? value : 0;
  16767. if (!(seen
  16768. ? cacheHas(seen, computed)
  16769. : includes(result, computed, comparator)
  16770. )) {
  16771. othIndex = othLength;
  16772. while (--othIndex) {
  16773. var cache = caches[othIndex];
  16774. if (!(cache
  16775. ? cacheHas(cache, computed)
  16776. : includes(arrays[othIndex], computed, comparator))
  16777. ) {
  16778. continue outer;
  16779. }
  16780. }
  16781. if (seen) {
  16782. seen.push(computed);
  16783. }
  16784. result.push(value);
  16785. }
  16786. }
  16787. return result;
  16788. }
  16789. /**
  16790. * The base implementation of `_.invert` and `_.invertBy` which inverts
  16791. * `object` with values transformed by `iteratee` and set by `setter`.
  16792. *
  16793. * @private
  16794. * @param {Object} object The object to iterate over.
  16795. * @param {Function} setter The function to set `accumulator` values.
  16796. * @param {Function} iteratee The iteratee to transform values.
  16797. * @param {Object} accumulator The initial inverted object.
  16798. * @returns {Function} Returns `accumulator`.
  16799. */
  16800. function baseInverter(object, setter, iteratee, accumulator) {
  16801. baseForOwn(object, function(value, key, object) {
  16802. setter(accumulator, iteratee(value), key, object);
  16803. });
  16804. return accumulator;
  16805. }
  16806. /**
  16807. * The base implementation of `_.invoke` without support for individual
  16808. * method arguments.
  16809. *
  16810. * @private
  16811. * @param {Object} object The object to query.
  16812. * @param {Array|string} path The path of the method to invoke.
  16813. * @param {Array} args The arguments to invoke the method with.
  16814. * @returns {*} Returns the result of the invoked method.
  16815. */
  16816. function baseInvoke(object, path, args) {
  16817. path = castPath(path, object);
  16818. object = parent(object, path);
  16819. var func = object == null ? object : object[toKey(last(path))];
  16820. return func == null ? undefined : apply(func, object, args);
  16821. }
  16822. /**
  16823. * The base implementation of `_.isArguments`.
  16824. *
  16825. * @private
  16826. * @param {*} value The value to check.
  16827. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  16828. */
  16829. function baseIsArguments(value) {
  16830. return isObjectLike(value) && baseGetTag(value) == argsTag;
  16831. }
  16832. /**
  16833. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  16834. *
  16835. * @private
  16836. * @param {*} value The value to check.
  16837. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  16838. */
  16839. function baseIsArrayBuffer(value) {
  16840. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  16841. }
  16842. /**
  16843. * The base implementation of `_.isDate` without Node.js optimizations.
  16844. *
  16845. * @private
  16846. * @param {*} value The value to check.
  16847. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  16848. */
  16849. function baseIsDate(value) {
  16850. return isObjectLike(value) && baseGetTag(value) == dateTag;
  16851. }
  16852. /**
  16853. * The base implementation of `_.isEqual` which supports partial comparisons
  16854. * and tracks traversed objects.
  16855. *
  16856. * @private
  16857. * @param {*} value The value to compare.
  16858. * @param {*} other The other value to compare.
  16859. * @param {boolean} bitmask The bitmask flags.
  16860. * 1 - Unordered comparison
  16861. * 2 - Partial comparison
  16862. * @param {Function} [customizer] The function to customize comparisons.
  16863. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  16864. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  16865. */
  16866. function baseIsEqual(value, other, bitmask, customizer, stack) {
  16867. if (value === other) {
  16868. return true;
  16869. }
  16870. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  16871. return value !== value && other !== other;
  16872. }
  16873. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  16874. }
  16875. /**
  16876. * A specialized version of `baseIsEqual` for arrays and objects which performs
  16877. * deep comparisons and tracks traversed objects enabling objects with circular
  16878. * references to be compared.
  16879. *
  16880. * @private
  16881. * @param {Object} object The object to compare.
  16882. * @param {Object} other The other object to compare.
  16883. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  16884. * @param {Function} customizer The function to customize comparisons.
  16885. * @param {Function} equalFunc The function to determine equivalents of values.
  16886. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  16887. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  16888. */
  16889. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  16890. var objIsArr = isArray(object),
  16891. othIsArr = isArray(other),
  16892. objTag = objIsArr ? arrayTag : getTag(object),
  16893. othTag = othIsArr ? arrayTag : getTag(other);
  16894. objTag = objTag == argsTag ? objectTag : objTag;
  16895. othTag = othTag == argsTag ? objectTag : othTag;
  16896. var objIsObj = objTag == objectTag,
  16897. othIsObj = othTag == objectTag,
  16898. isSameTag = objTag == othTag;
  16899. if (isSameTag && isBuffer(object)) {
  16900. if (!isBuffer(other)) {
  16901. return false;
  16902. }
  16903. objIsArr = true;
  16904. objIsObj = false;
  16905. }
  16906. if (isSameTag && !objIsObj) {
  16907. stack || (stack = new Stack);
  16908. return (objIsArr || isTypedArray(object))
  16909. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  16910. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  16911. }
  16912. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  16913. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  16914. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  16915. if (objIsWrapped || othIsWrapped) {
  16916. var objUnwrapped = objIsWrapped ? object.value() : object,
  16917. othUnwrapped = othIsWrapped ? other.value() : other;
  16918. stack || (stack = new Stack);
  16919. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  16920. }
  16921. }
  16922. if (!isSameTag) {
  16923. return false;
  16924. }
  16925. stack || (stack = new Stack);
  16926. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  16927. }
  16928. /**
  16929. * The base implementation of `_.isMap` without Node.js optimizations.
  16930. *
  16931. * @private
  16932. * @param {*} value The value to check.
  16933. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  16934. */
  16935. function baseIsMap(value) {
  16936. return isObjectLike(value) && getTag(value) == mapTag;
  16937. }
  16938. /**
  16939. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  16940. *
  16941. * @private
  16942. * @param {Object} object The object to inspect.
  16943. * @param {Object} source The object of property values to match.
  16944. * @param {Array} matchData The property names, values, and compare flags to match.
  16945. * @param {Function} [customizer] The function to customize comparisons.
  16946. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  16947. */
  16948. function baseIsMatch(object, source, matchData, customizer) {
  16949. var index = matchData.length,
  16950. length = index,
  16951. noCustomizer = !customizer;
  16952. if (object == null) {
  16953. return !length;
  16954. }
  16955. object = Object(object);
  16956. while (index--) {
  16957. var data = matchData[index];
  16958. if ((noCustomizer && data[2])
  16959. ? data[1] !== object[data[0]]
  16960. : !(data[0] in object)
  16961. ) {
  16962. return false;
  16963. }
  16964. }
  16965. while (++index < length) {
  16966. data = matchData[index];
  16967. var key = data[0],
  16968. objValue = object[key],
  16969. srcValue = data[1];
  16970. if (noCustomizer && data[2]) {
  16971. if (objValue === undefined && !(key in object)) {
  16972. return false;
  16973. }
  16974. } else {
  16975. var stack = new Stack;
  16976. if (customizer) {
  16977. var result = customizer(objValue, srcValue, key, object, source, stack);
  16978. }
  16979. if (!(result === undefined
  16980. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  16981. : result
  16982. )) {
  16983. return false;
  16984. }
  16985. }
  16986. }
  16987. return true;
  16988. }
  16989. /**
  16990. * The base implementation of `_.isNative` without bad shim checks.
  16991. *
  16992. * @private
  16993. * @param {*} value The value to check.
  16994. * @returns {boolean} Returns `true` if `value` is a native function,
  16995. * else `false`.
  16996. */
  16997. function baseIsNative(value) {
  16998. if (!isObject(value) || isMasked(value)) {
  16999. return false;
  17000. }
  17001. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  17002. return pattern.test(toSource(value));
  17003. }
  17004. /**
  17005. * The base implementation of `_.isRegExp` without Node.js optimizations.
  17006. *
  17007. * @private
  17008. * @param {*} value The value to check.
  17009. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  17010. */
  17011. function baseIsRegExp(value) {
  17012. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  17013. }
  17014. /**
  17015. * The base implementation of `_.isSet` without Node.js optimizations.
  17016. *
  17017. * @private
  17018. * @param {*} value The value to check.
  17019. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  17020. */
  17021. function baseIsSet(value) {
  17022. return isObjectLike(value) && getTag(value) == setTag;
  17023. }
  17024. /**
  17025. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  17026. *
  17027. * @private
  17028. * @param {*} value The value to check.
  17029. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  17030. */
  17031. function baseIsTypedArray(value) {
  17032. return isObjectLike(value) &&
  17033. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  17034. }
  17035. /**
  17036. * The base implementation of `_.iteratee`.
  17037. *
  17038. * @private
  17039. * @param {*} [value=_.identity] The value to convert to an iteratee.
  17040. * @returns {Function} Returns the iteratee.
  17041. */
  17042. function baseIteratee(value) {
  17043. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  17044. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  17045. if (typeof value == 'function') {
  17046. return value;
  17047. }
  17048. if (value == null) {
  17049. return identity;
  17050. }
  17051. if (typeof value == 'object') {
  17052. return isArray(value)
  17053. ? baseMatchesProperty(value[0], value[1])
  17054. : baseMatches(value);
  17055. }
  17056. return property(value);
  17057. }
  17058. /**
  17059. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  17060. *
  17061. * @private
  17062. * @param {Object} object The object to query.
  17063. * @returns {Array} Returns the array of property names.
  17064. */
  17065. function baseKeys(object) {
  17066. if (!isPrototype(object)) {
  17067. return nativeKeys(object);
  17068. }
  17069. var result = [];
  17070. for (var key in Object(object)) {
  17071. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  17072. result.push(key);
  17073. }
  17074. }
  17075. return result;
  17076. }
  17077. /**
  17078. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  17079. *
  17080. * @private
  17081. * @param {Object} object The object to query.
  17082. * @returns {Array} Returns the array of property names.
  17083. */
  17084. function baseKeysIn(object) {
  17085. if (!isObject(object)) {
  17086. return nativeKeysIn(object);
  17087. }
  17088. var isProto = isPrototype(object),
  17089. result = [];
  17090. for (var key in object) {
  17091. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  17092. result.push(key);
  17093. }
  17094. }
  17095. return result;
  17096. }
  17097. /**
  17098. * The base implementation of `_.lt` which doesn't coerce arguments.
  17099. *
  17100. * @private
  17101. * @param {*} value The value to compare.
  17102. * @param {*} other The other value to compare.
  17103. * @returns {boolean} Returns `true` if `value` is less than `other`,
  17104. * else `false`.
  17105. */
  17106. function baseLt(value, other) {
  17107. return value < other;
  17108. }
  17109. /**
  17110. * The base implementation of `_.map` without support for iteratee shorthands.
  17111. *
  17112. * @private
  17113. * @param {Array|Object} collection The collection to iterate over.
  17114. * @param {Function} iteratee The function invoked per iteration.
  17115. * @returns {Array} Returns the new mapped array.
  17116. */
  17117. function baseMap(collection, iteratee) {
  17118. var index = -1,
  17119. result = isArrayLike(collection) ? Array(collection.length) : [];
  17120. baseEach(collection, function(value, key, collection) {
  17121. result[++index] = iteratee(value, key, collection);
  17122. });
  17123. return result;
  17124. }
  17125. /**
  17126. * The base implementation of `_.matches` which doesn't clone `source`.
  17127. *
  17128. * @private
  17129. * @param {Object} source The object of property values to match.
  17130. * @returns {Function} Returns the new spec function.
  17131. */
  17132. function baseMatches(source) {
  17133. var matchData = getMatchData(source);
  17134. if (matchData.length == 1 && matchData[0][2]) {
  17135. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  17136. }
  17137. return function(object) {
  17138. return object === source || baseIsMatch(object, source, matchData);
  17139. };
  17140. }
  17141. /**
  17142. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  17143. *
  17144. * @private
  17145. * @param {string} path The path of the property to get.
  17146. * @param {*} srcValue The value to match.
  17147. * @returns {Function} Returns the new spec function.
  17148. */
  17149. function baseMatchesProperty(path, srcValue) {
  17150. if (isKey(path) && isStrictComparable(srcValue)) {
  17151. return matchesStrictComparable(toKey(path), srcValue);
  17152. }
  17153. return function(object) {
  17154. var objValue = get(object, path);
  17155. return (objValue === undefined && objValue === srcValue)
  17156. ? hasIn(object, path)
  17157. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  17158. };
  17159. }
  17160. /**
  17161. * The base implementation of `_.merge` without support for multiple sources.
  17162. *
  17163. * @private
  17164. * @param {Object} object The destination object.
  17165. * @param {Object} source The source object.
  17166. * @param {number} srcIndex The index of `source`.
  17167. * @param {Function} [customizer] The function to customize merged values.
  17168. * @param {Object} [stack] Tracks traversed source values and their merged
  17169. * counterparts.
  17170. */
  17171. function baseMerge(object, source, srcIndex, customizer, stack) {
  17172. if (object === source) {
  17173. return;
  17174. }
  17175. baseFor(source, function(srcValue, key) {
  17176. stack || (stack = new Stack);
  17177. if (isObject(srcValue)) {
  17178. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  17179. }
  17180. else {
  17181. var newValue = customizer
  17182. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  17183. : undefined;
  17184. if (newValue === undefined) {
  17185. newValue = srcValue;
  17186. }
  17187. assignMergeValue(object, key, newValue);
  17188. }
  17189. }, keysIn);
  17190. }
  17191. /**
  17192. * A specialized version of `baseMerge` for arrays and objects which performs
  17193. * deep merges and tracks traversed objects enabling objects with circular
  17194. * references to be merged.
  17195. *
  17196. * @private
  17197. * @param {Object} object The destination object.
  17198. * @param {Object} source The source object.
  17199. * @param {string} key The key of the value to merge.
  17200. * @param {number} srcIndex The index of `source`.
  17201. * @param {Function} mergeFunc The function to merge values.
  17202. * @param {Function} [customizer] The function to customize assigned values.
  17203. * @param {Object} [stack] Tracks traversed source values and their merged
  17204. * counterparts.
  17205. */
  17206. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  17207. var objValue = safeGet(object, key),
  17208. srcValue = safeGet(source, key),
  17209. stacked = stack.get(srcValue);
  17210. if (stacked) {
  17211. assignMergeValue(object, key, stacked);
  17212. return;
  17213. }
  17214. var newValue = customizer
  17215. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  17216. : undefined;
  17217. var isCommon = newValue === undefined;
  17218. if (isCommon) {
  17219. var isArr = isArray(srcValue),
  17220. isBuff = !isArr && isBuffer(srcValue),
  17221. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  17222. newValue = srcValue;
  17223. if (isArr || isBuff || isTyped) {
  17224. if (isArray(objValue)) {
  17225. newValue = objValue;
  17226. }
  17227. else if (isArrayLikeObject(objValue)) {
  17228. newValue = copyArray(objValue);
  17229. }
  17230. else if (isBuff) {
  17231. isCommon = false;
  17232. newValue = cloneBuffer(srcValue, true);
  17233. }
  17234. else if (isTyped) {
  17235. isCommon = false;
  17236. newValue = cloneTypedArray(srcValue, true);
  17237. }
  17238. else {
  17239. newValue = [];
  17240. }
  17241. }
  17242. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  17243. newValue = objValue;
  17244. if (isArguments(objValue)) {
  17245. newValue = toPlainObject(objValue);
  17246. }
  17247. else if (!isObject(objValue) || isFunction(objValue)) {
  17248. newValue = initCloneObject(srcValue);
  17249. }
  17250. }
  17251. else {
  17252. isCommon = false;
  17253. }
  17254. }
  17255. if (isCommon) {
  17256. // Recursively merge objects and arrays (susceptible to call stack limits).
  17257. stack.set(srcValue, newValue);
  17258. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  17259. stack['delete'](srcValue);
  17260. }
  17261. assignMergeValue(object, key, newValue);
  17262. }
  17263. /**
  17264. * The base implementation of `_.nth` which doesn't coerce arguments.
  17265. *
  17266. * @private
  17267. * @param {Array} array The array to query.
  17268. * @param {number} n The index of the element to return.
  17269. * @returns {*} Returns the nth element of `array`.
  17270. */
  17271. function baseNth(array, n) {
  17272. var length = array.length;
  17273. if (!length) {
  17274. return;
  17275. }
  17276. n += n < 0 ? length : 0;
  17277. return isIndex(n, length) ? array[n] : undefined;
  17278. }
  17279. /**
  17280. * The base implementation of `_.orderBy` without param guards.
  17281. *
  17282. * @private
  17283. * @param {Array|Object} collection The collection to iterate over.
  17284. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  17285. * @param {string[]} orders The sort orders of `iteratees`.
  17286. * @returns {Array} Returns the new sorted array.
  17287. */
  17288. function baseOrderBy(collection, iteratees, orders) {
  17289. var index = -1;
  17290. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  17291. var result = baseMap(collection, function(value, key, collection) {
  17292. var criteria = arrayMap(iteratees, function(iteratee) {
  17293. return iteratee(value);
  17294. });
  17295. return { 'criteria': criteria, 'index': ++index, 'value': value };
  17296. });
  17297. return baseSortBy(result, function(object, other) {
  17298. return compareMultiple(object, other, orders);
  17299. });
  17300. }
  17301. /**
  17302. * The base implementation of `_.pick` without support for individual
  17303. * property identifiers.
  17304. *
  17305. * @private
  17306. * @param {Object} object The source object.
  17307. * @param {string[]} paths The property paths to pick.
  17308. * @returns {Object} Returns the new object.
  17309. */
  17310. function basePick(object, paths) {
  17311. return basePickBy(object, paths, function(value, path) {
  17312. return hasIn(object, path);
  17313. });
  17314. }
  17315. /**
  17316. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  17317. *
  17318. * @private
  17319. * @param {Object} object The source object.
  17320. * @param {string[]} paths The property paths to pick.
  17321. * @param {Function} predicate The function invoked per property.
  17322. * @returns {Object} Returns the new object.
  17323. */
  17324. function basePickBy(object, paths, predicate) {
  17325. var index = -1,
  17326. length = paths.length,
  17327. result = {};
  17328. while (++index < length) {
  17329. var path = paths[index],
  17330. value = baseGet(object, path);
  17331. if (predicate(value, path)) {
  17332. baseSet(result, castPath(path, object), value);
  17333. }
  17334. }
  17335. return result;
  17336. }
  17337. /**
  17338. * A specialized version of `baseProperty` which supports deep paths.
  17339. *
  17340. * @private
  17341. * @param {Array|string} path The path of the property to get.
  17342. * @returns {Function} Returns the new accessor function.
  17343. */
  17344. function basePropertyDeep(path) {
  17345. return function(object) {
  17346. return baseGet(object, path);
  17347. };
  17348. }
  17349. /**
  17350. * The base implementation of `_.pullAllBy` without support for iteratee
  17351. * shorthands.
  17352. *
  17353. * @private
  17354. * @param {Array} array The array to modify.
  17355. * @param {Array} values The values to remove.
  17356. * @param {Function} [iteratee] The iteratee invoked per element.
  17357. * @param {Function} [comparator] The comparator invoked per element.
  17358. * @returns {Array} Returns `array`.
  17359. */
  17360. function basePullAll(array, values, iteratee, comparator) {
  17361. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  17362. index = -1,
  17363. length = values.length,
  17364. seen = array;
  17365. if (array === values) {
  17366. values = copyArray(values);
  17367. }
  17368. if (iteratee) {
  17369. seen = arrayMap(array, baseUnary(iteratee));
  17370. }
  17371. while (++index < length) {
  17372. var fromIndex = 0,
  17373. value = values[index],
  17374. computed = iteratee ? iteratee(value) : value;
  17375. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  17376. if (seen !== array) {
  17377. splice.call(seen, fromIndex, 1);
  17378. }
  17379. splice.call(array, fromIndex, 1);
  17380. }
  17381. }
  17382. return array;
  17383. }
  17384. /**
  17385. * The base implementation of `_.pullAt` without support for individual
  17386. * indexes or capturing the removed elements.
  17387. *
  17388. * @private
  17389. * @param {Array} array The array to modify.
  17390. * @param {number[]} indexes The indexes of elements to remove.
  17391. * @returns {Array} Returns `array`.
  17392. */
  17393. function basePullAt(array, indexes) {
  17394. var length = array ? indexes.length : 0,
  17395. lastIndex = length - 1;
  17396. while (length--) {
  17397. var index = indexes[length];
  17398. if (length == lastIndex || index !== previous) {
  17399. var previous = index;
  17400. if (isIndex(index)) {
  17401. splice.call(array, index, 1);
  17402. } else {
  17403. baseUnset(array, index);
  17404. }
  17405. }
  17406. }
  17407. return array;
  17408. }
  17409. /**
  17410. * The base implementation of `_.random` without support for returning
  17411. * floating-point numbers.
  17412. *
  17413. * @private
  17414. * @param {number} lower The lower bound.
  17415. * @param {number} upper The upper bound.
  17416. * @returns {number} Returns the random number.
  17417. */
  17418. function baseRandom(lower, upper) {
  17419. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  17420. }
  17421. /**
  17422. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  17423. * coerce arguments.
  17424. *
  17425. * @private
  17426. * @param {number} start The start of the range.
  17427. * @param {number} end The end of the range.
  17428. * @param {number} step The value to increment or decrement by.
  17429. * @param {boolean} [fromRight] Specify iterating from right to left.
  17430. * @returns {Array} Returns the range of numbers.
  17431. */
  17432. function baseRange(start, end, step, fromRight) {
  17433. var index = -1,
  17434. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  17435. result = Array(length);
  17436. while (length--) {
  17437. result[fromRight ? length : ++index] = start;
  17438. start += step;
  17439. }
  17440. return result;
  17441. }
  17442. /**
  17443. * The base implementation of `_.repeat` which doesn't coerce arguments.
  17444. *
  17445. * @private
  17446. * @param {string} string The string to repeat.
  17447. * @param {number} n The number of times to repeat the string.
  17448. * @returns {string} Returns the repeated string.
  17449. */
  17450. function baseRepeat(string, n) {
  17451. var result = '';
  17452. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  17453. return result;
  17454. }
  17455. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  17456. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  17457. do {
  17458. if (n % 2) {
  17459. result += string;
  17460. }
  17461. n = nativeFloor(n / 2);
  17462. if (n) {
  17463. string += string;
  17464. }
  17465. } while (n);
  17466. return result;
  17467. }
  17468. /**
  17469. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  17470. *
  17471. * @private
  17472. * @param {Function} func The function to apply a rest parameter to.
  17473. * @param {number} [start=func.length-1] The start position of the rest parameter.
  17474. * @returns {Function} Returns the new function.
  17475. */
  17476. function baseRest(func, start) {
  17477. return setToString(overRest(func, start, identity), func + '');
  17478. }
  17479. /**
  17480. * The base implementation of `_.sample`.
  17481. *
  17482. * @private
  17483. * @param {Array|Object} collection The collection to sample.
  17484. * @returns {*} Returns the random element.
  17485. */
  17486. function baseSample(collection) {
  17487. return arraySample(values(collection));
  17488. }
  17489. /**
  17490. * The base implementation of `_.sampleSize` without param guards.
  17491. *
  17492. * @private
  17493. * @param {Array|Object} collection The collection to sample.
  17494. * @param {number} n The number of elements to sample.
  17495. * @returns {Array} Returns the random elements.
  17496. */
  17497. function baseSampleSize(collection, n) {
  17498. var array = values(collection);
  17499. return shuffleSelf(array, baseClamp(n, 0, array.length));
  17500. }
  17501. /**
  17502. * The base implementation of `_.set`.
  17503. *
  17504. * @private
  17505. * @param {Object} object The object to modify.
  17506. * @param {Array|string} path The path of the property to set.
  17507. * @param {*} value The value to set.
  17508. * @param {Function} [customizer] The function to customize path creation.
  17509. * @returns {Object} Returns `object`.
  17510. */
  17511. function baseSet(object, path, value, customizer) {
  17512. if (!isObject(object)) {
  17513. return object;
  17514. }
  17515. path = castPath(path, object);
  17516. var index = -1,
  17517. length = path.length,
  17518. lastIndex = length - 1,
  17519. nested = object;
  17520. while (nested != null && ++index < length) {
  17521. var key = toKey(path[index]),
  17522. newValue = value;
  17523. if (index != lastIndex) {
  17524. var objValue = nested[key];
  17525. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  17526. if (newValue === undefined) {
  17527. newValue = isObject(objValue)
  17528. ? objValue
  17529. : (isIndex(path[index + 1]) ? [] : {});
  17530. }
  17531. }
  17532. assignValue(nested, key, newValue);
  17533. nested = nested[key];
  17534. }
  17535. return object;
  17536. }
  17537. /**
  17538. * The base implementation of `setData` without support for hot loop shorting.
  17539. *
  17540. * @private
  17541. * @param {Function} func The function to associate metadata with.
  17542. * @param {*} data The metadata.
  17543. * @returns {Function} Returns `func`.
  17544. */
  17545. var baseSetData = !metaMap ? identity : function(func, data) {
  17546. metaMap.set(func, data);
  17547. return func;
  17548. };
  17549. /**
  17550. * The base implementation of `setToString` without support for hot loop shorting.
  17551. *
  17552. * @private
  17553. * @param {Function} func The function to modify.
  17554. * @param {Function} string The `toString` result.
  17555. * @returns {Function} Returns `func`.
  17556. */
  17557. var baseSetToString = !defineProperty ? identity : function(func, string) {
  17558. return defineProperty(func, 'toString', {
  17559. 'configurable': true,
  17560. 'enumerable': false,
  17561. 'value': constant(string),
  17562. 'writable': true
  17563. });
  17564. };
  17565. /**
  17566. * The base implementation of `_.shuffle`.
  17567. *
  17568. * @private
  17569. * @param {Array|Object} collection The collection to shuffle.
  17570. * @returns {Array} Returns the new shuffled array.
  17571. */
  17572. function baseShuffle(collection) {
  17573. return shuffleSelf(values(collection));
  17574. }
  17575. /**
  17576. * The base implementation of `_.slice` without an iteratee call guard.
  17577. *
  17578. * @private
  17579. * @param {Array} array The array to slice.
  17580. * @param {number} [start=0] The start position.
  17581. * @param {number} [end=array.length] The end position.
  17582. * @returns {Array} Returns the slice of `array`.
  17583. */
  17584. function baseSlice(array, start, end) {
  17585. var index = -1,
  17586. length = array.length;
  17587. if (start < 0) {
  17588. start = -start > length ? 0 : (length + start);
  17589. }
  17590. end = end > length ? length : end;
  17591. if (end < 0) {
  17592. end += length;
  17593. }
  17594. length = start > end ? 0 : ((end - start) >>> 0);
  17595. start >>>= 0;
  17596. var result = Array(length);
  17597. while (++index < length) {
  17598. result[index] = array[index + start];
  17599. }
  17600. return result;
  17601. }
  17602. /**
  17603. * The base implementation of `_.some` without support for iteratee shorthands.
  17604. *
  17605. * @private
  17606. * @param {Array|Object} collection The collection to iterate over.
  17607. * @param {Function} predicate The function invoked per iteration.
  17608. * @returns {boolean} Returns `true` if any element passes the predicate check,
  17609. * else `false`.
  17610. */
  17611. function baseSome(collection, predicate) {
  17612. var result;
  17613. baseEach(collection, function(value, index, collection) {
  17614. result = predicate(value, index, collection);
  17615. return !result;
  17616. });
  17617. return !!result;
  17618. }
  17619. /**
  17620. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  17621. * performs a binary search of `array` to determine the index at which `value`
  17622. * should be inserted into `array` in order to maintain its sort order.
  17623. *
  17624. * @private
  17625. * @param {Array} array The sorted array to inspect.
  17626. * @param {*} value The value to evaluate.
  17627. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  17628. * @returns {number} Returns the index at which `value` should be inserted
  17629. * into `array`.
  17630. */
  17631. function baseSortedIndex(array, value, retHighest) {
  17632. var low = 0,
  17633. high = array == null ? low : array.length;
  17634. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  17635. while (low < high) {
  17636. var mid = (low + high) >>> 1,
  17637. computed = array[mid];
  17638. if (computed !== null && !isSymbol(computed) &&
  17639. (retHighest ? (computed <= value) : (computed < value))) {
  17640. low = mid + 1;
  17641. } else {
  17642. high = mid;
  17643. }
  17644. }
  17645. return high;
  17646. }
  17647. return baseSortedIndexBy(array, value, identity, retHighest);
  17648. }
  17649. /**
  17650. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  17651. * which invokes `iteratee` for `value` and each element of `array` to compute
  17652. * their sort ranking. The iteratee is invoked with one argument; (value).
  17653. *
  17654. * @private
  17655. * @param {Array} array The sorted array to inspect.
  17656. * @param {*} value The value to evaluate.
  17657. * @param {Function} iteratee The iteratee invoked per element.
  17658. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  17659. * @returns {number} Returns the index at which `value` should be inserted
  17660. * into `array`.
  17661. */
  17662. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  17663. value = iteratee(value);
  17664. var low = 0,
  17665. high = array == null ? 0 : array.length,
  17666. valIsNaN = value !== value,
  17667. valIsNull = value === null,
  17668. valIsSymbol = isSymbol(value),
  17669. valIsUndefined = value === undefined;
  17670. while (low < high) {
  17671. var mid = nativeFloor((low + high) / 2),
  17672. computed = iteratee(array[mid]),
  17673. othIsDefined = computed !== undefined,
  17674. othIsNull = computed === null,
  17675. othIsReflexive = computed === computed,
  17676. othIsSymbol = isSymbol(computed);
  17677. if (valIsNaN) {
  17678. var setLow = retHighest || othIsReflexive;
  17679. } else if (valIsUndefined) {
  17680. setLow = othIsReflexive && (retHighest || othIsDefined);
  17681. } else if (valIsNull) {
  17682. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  17683. } else if (valIsSymbol) {
  17684. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  17685. } else if (othIsNull || othIsSymbol) {
  17686. setLow = false;
  17687. } else {
  17688. setLow = retHighest ? (computed <= value) : (computed < value);
  17689. }
  17690. if (setLow) {
  17691. low = mid + 1;
  17692. } else {
  17693. high = mid;
  17694. }
  17695. }
  17696. return nativeMin(high, MAX_ARRAY_INDEX);
  17697. }
  17698. /**
  17699. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  17700. * support for iteratee shorthands.
  17701. *
  17702. * @private
  17703. * @param {Array} array The array to inspect.
  17704. * @param {Function} [iteratee] The iteratee invoked per element.
  17705. * @returns {Array} Returns the new duplicate free array.
  17706. */
  17707. function baseSortedUniq(array, iteratee) {
  17708. var index = -1,
  17709. length = array.length,
  17710. resIndex = 0,
  17711. result = [];
  17712. while (++index < length) {
  17713. var value = array[index],
  17714. computed = iteratee ? iteratee(value) : value;
  17715. if (!index || !eq(computed, seen)) {
  17716. var seen = computed;
  17717. result[resIndex++] = value === 0 ? 0 : value;
  17718. }
  17719. }
  17720. return result;
  17721. }
  17722. /**
  17723. * The base implementation of `_.toNumber` which doesn't ensure correct
  17724. * conversions of binary, hexadecimal, or octal string values.
  17725. *
  17726. * @private
  17727. * @param {*} value The value to process.
  17728. * @returns {number} Returns the number.
  17729. */
  17730. function baseToNumber(value) {
  17731. if (typeof value == 'number') {
  17732. return value;
  17733. }
  17734. if (isSymbol(value)) {
  17735. return NAN;
  17736. }
  17737. return +value;
  17738. }
  17739. /**
  17740. * The base implementation of `_.toString` which doesn't convert nullish
  17741. * values to empty strings.
  17742. *
  17743. * @private
  17744. * @param {*} value The value to process.
  17745. * @returns {string} Returns the string.
  17746. */
  17747. function baseToString(value) {
  17748. // Exit early for strings to avoid a performance hit in some environments.
  17749. if (typeof value == 'string') {
  17750. return value;
  17751. }
  17752. if (isArray(value)) {
  17753. // Recursively convert values (susceptible to call stack limits).
  17754. return arrayMap(value, baseToString) + '';
  17755. }
  17756. if (isSymbol(value)) {
  17757. return symbolToString ? symbolToString.call(value) : '';
  17758. }
  17759. var result = (value + '');
  17760. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  17761. }
  17762. /**
  17763. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  17764. *
  17765. * @private
  17766. * @param {Array} array The array to inspect.
  17767. * @param {Function} [iteratee] The iteratee invoked per element.
  17768. * @param {Function} [comparator] The comparator invoked per element.
  17769. * @returns {Array} Returns the new duplicate free array.
  17770. */
  17771. function baseUniq(array, iteratee, comparator) {
  17772. var index = -1,
  17773. includes = arrayIncludes,
  17774. length = array.length,
  17775. isCommon = true,
  17776. result = [],
  17777. seen = result;
  17778. if (comparator) {
  17779. isCommon = false;
  17780. includes = arrayIncludesWith;
  17781. }
  17782. else if (length >= LARGE_ARRAY_SIZE) {
  17783. var set = iteratee ? null : createSet(array);
  17784. if (set) {
  17785. return setToArray(set);
  17786. }
  17787. isCommon = false;
  17788. includes = cacheHas;
  17789. seen = new SetCache;
  17790. }
  17791. else {
  17792. seen = iteratee ? [] : result;
  17793. }
  17794. outer:
  17795. while (++index < length) {
  17796. var value = array[index],
  17797. computed = iteratee ? iteratee(value) : value;
  17798. value = (comparator || value !== 0) ? value : 0;
  17799. if (isCommon && computed === computed) {
  17800. var seenIndex = seen.length;
  17801. while (seenIndex--) {
  17802. if (seen[seenIndex] === computed) {
  17803. continue outer;
  17804. }
  17805. }
  17806. if (iteratee) {
  17807. seen.push(computed);
  17808. }
  17809. result.push(value);
  17810. }
  17811. else if (!includes(seen, computed, comparator)) {
  17812. if (seen !== result) {
  17813. seen.push(computed);
  17814. }
  17815. result.push(value);
  17816. }
  17817. }
  17818. return result;
  17819. }
  17820. /**
  17821. * The base implementation of `_.unset`.
  17822. *
  17823. * @private
  17824. * @param {Object} object The object to modify.
  17825. * @param {Array|string} path The property path to unset.
  17826. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  17827. */
  17828. function baseUnset(object, path) {
  17829. path = castPath(path, object);
  17830. object = parent(object, path);
  17831. return object == null || delete object[toKey(last(path))];
  17832. }
  17833. /**
  17834. * The base implementation of `_.update`.
  17835. *
  17836. * @private
  17837. * @param {Object} object The object to modify.
  17838. * @param {Array|string} path The path of the property to update.
  17839. * @param {Function} updater The function to produce the updated value.
  17840. * @param {Function} [customizer] The function to customize path creation.
  17841. * @returns {Object} Returns `object`.
  17842. */
  17843. function baseUpdate(object, path, updater, customizer) {
  17844. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  17845. }
  17846. /**
  17847. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  17848. * without support for iteratee shorthands.
  17849. *
  17850. * @private
  17851. * @param {Array} array The array to query.
  17852. * @param {Function} predicate The function invoked per iteration.
  17853. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  17854. * @param {boolean} [fromRight] Specify iterating from right to left.
  17855. * @returns {Array} Returns the slice of `array`.
  17856. */
  17857. function baseWhile(array, predicate, isDrop, fromRight) {
  17858. var length = array.length,
  17859. index = fromRight ? length : -1;
  17860. while ((fromRight ? index-- : ++index < length) &&
  17861. predicate(array[index], index, array)) {}
  17862. return isDrop
  17863. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  17864. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  17865. }
  17866. /**
  17867. * The base implementation of `wrapperValue` which returns the result of
  17868. * performing a sequence of actions on the unwrapped `value`, where each
  17869. * successive action is supplied the return value of the previous.
  17870. *
  17871. * @private
  17872. * @param {*} value The unwrapped value.
  17873. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  17874. * @returns {*} Returns the resolved value.
  17875. */
  17876. function baseWrapperValue(value, actions) {
  17877. var result = value;
  17878. if (result instanceof LazyWrapper) {
  17879. result = result.value();
  17880. }
  17881. return arrayReduce(actions, function(result, action) {
  17882. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  17883. }, result);
  17884. }
  17885. /**
  17886. * The base implementation of methods like `_.xor`, without support for
  17887. * iteratee shorthands, that accepts an array of arrays to inspect.
  17888. *
  17889. * @private
  17890. * @param {Array} arrays The arrays to inspect.
  17891. * @param {Function} [iteratee] The iteratee invoked per element.
  17892. * @param {Function} [comparator] The comparator invoked per element.
  17893. * @returns {Array} Returns the new array of values.
  17894. */
  17895. function baseXor(arrays, iteratee, comparator) {
  17896. var length = arrays.length;
  17897. if (length < 2) {
  17898. return length ? baseUniq(arrays[0]) : [];
  17899. }
  17900. var index = -1,
  17901. result = Array(length);
  17902. while (++index < length) {
  17903. var array = arrays[index],
  17904. othIndex = -1;
  17905. while (++othIndex < length) {
  17906. if (othIndex != index) {
  17907. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  17908. }
  17909. }
  17910. }
  17911. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  17912. }
  17913. /**
  17914. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  17915. *
  17916. * @private
  17917. * @param {Array} props The property identifiers.
  17918. * @param {Array} values The property values.
  17919. * @param {Function} assignFunc The function to assign values.
  17920. * @returns {Object} Returns the new object.
  17921. */
  17922. function baseZipObject(props, values, assignFunc) {
  17923. var index = -1,
  17924. length = props.length,
  17925. valsLength = values.length,
  17926. result = {};
  17927. while (++index < length) {
  17928. var value = index < valsLength ? values[index] : undefined;
  17929. assignFunc(result, props[index], value);
  17930. }
  17931. return result;
  17932. }
  17933. /**
  17934. * Casts `value` to an empty array if it's not an array like object.
  17935. *
  17936. * @private
  17937. * @param {*} value The value to inspect.
  17938. * @returns {Array|Object} Returns the cast array-like object.
  17939. */
  17940. function castArrayLikeObject(value) {
  17941. return isArrayLikeObject(value) ? value : [];
  17942. }
  17943. /**
  17944. * Casts `value` to `identity` if it's not a function.
  17945. *
  17946. * @private
  17947. * @param {*} value The value to inspect.
  17948. * @returns {Function} Returns cast function.
  17949. */
  17950. function castFunction(value) {
  17951. return typeof value == 'function' ? value : identity;
  17952. }
  17953. /**
  17954. * Casts `value` to a path array if it's not one.
  17955. *
  17956. * @private
  17957. * @param {*} value The value to inspect.
  17958. * @param {Object} [object] The object to query keys on.
  17959. * @returns {Array} Returns the cast property path array.
  17960. */
  17961. function castPath(value, object) {
  17962. if (isArray(value)) {
  17963. return value;
  17964. }
  17965. return isKey(value, object) ? [value] : stringToPath(toString(value));
  17966. }
  17967. /**
  17968. * A `baseRest` alias which can be replaced with `identity` by module
  17969. * replacement plugins.
  17970. *
  17971. * @private
  17972. * @type {Function}
  17973. * @param {Function} func The function to apply a rest parameter to.
  17974. * @returns {Function} Returns the new function.
  17975. */
  17976. var castRest = baseRest;
  17977. /**
  17978. * Casts `array` to a slice if it's needed.
  17979. *
  17980. * @private
  17981. * @param {Array} array The array to inspect.
  17982. * @param {number} start The start position.
  17983. * @param {number} [end=array.length] The end position.
  17984. * @returns {Array} Returns the cast slice.
  17985. */
  17986. function castSlice(array, start, end) {
  17987. var length = array.length;
  17988. end = end === undefined ? length : end;
  17989. return (!start && end >= length) ? array : baseSlice(array, start, end);
  17990. }
  17991. /**
  17992. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  17993. *
  17994. * @private
  17995. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  17996. */
  17997. var clearTimeout = ctxClearTimeout || function(id) {
  17998. return root.clearTimeout(id);
  17999. };
  18000. /**
  18001. * Creates a clone of `buffer`.
  18002. *
  18003. * @private
  18004. * @param {Buffer} buffer The buffer to clone.
  18005. * @param {boolean} [isDeep] Specify a deep clone.
  18006. * @returns {Buffer} Returns the cloned buffer.
  18007. */
  18008. function cloneBuffer(buffer, isDeep) {
  18009. if (isDeep) {
  18010. return buffer.slice();
  18011. }
  18012. var length = buffer.length,
  18013. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  18014. buffer.copy(result);
  18015. return result;
  18016. }
  18017. /**
  18018. * Creates a clone of `arrayBuffer`.
  18019. *
  18020. * @private
  18021. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  18022. * @returns {ArrayBuffer} Returns the cloned array buffer.
  18023. */
  18024. function cloneArrayBuffer(arrayBuffer) {
  18025. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  18026. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  18027. return result;
  18028. }
  18029. /**
  18030. * Creates a clone of `dataView`.
  18031. *
  18032. * @private
  18033. * @param {Object} dataView The data view to clone.
  18034. * @param {boolean} [isDeep] Specify a deep clone.
  18035. * @returns {Object} Returns the cloned data view.
  18036. */
  18037. function cloneDataView(dataView, isDeep) {
  18038. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  18039. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  18040. }
  18041. /**
  18042. * Creates a clone of `regexp`.
  18043. *
  18044. * @private
  18045. * @param {Object} regexp The regexp to clone.
  18046. * @returns {Object} Returns the cloned regexp.
  18047. */
  18048. function cloneRegExp(regexp) {
  18049. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  18050. result.lastIndex = regexp.lastIndex;
  18051. return result;
  18052. }
  18053. /**
  18054. * Creates a clone of the `symbol` object.
  18055. *
  18056. * @private
  18057. * @param {Object} symbol The symbol object to clone.
  18058. * @returns {Object} Returns the cloned symbol object.
  18059. */
  18060. function cloneSymbol(symbol) {
  18061. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  18062. }
  18063. /**
  18064. * Creates a clone of `typedArray`.
  18065. *
  18066. * @private
  18067. * @param {Object} typedArray The typed array to clone.
  18068. * @param {boolean} [isDeep] Specify a deep clone.
  18069. * @returns {Object} Returns the cloned typed array.
  18070. */
  18071. function cloneTypedArray(typedArray, isDeep) {
  18072. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  18073. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  18074. }
  18075. /**
  18076. * Compares values to sort them in ascending order.
  18077. *
  18078. * @private
  18079. * @param {*} value The value to compare.
  18080. * @param {*} other The other value to compare.
  18081. * @returns {number} Returns the sort order indicator for `value`.
  18082. */
  18083. function compareAscending(value, other) {
  18084. if (value !== other) {
  18085. var valIsDefined = value !== undefined,
  18086. valIsNull = value === null,
  18087. valIsReflexive = value === value,
  18088. valIsSymbol = isSymbol(value);
  18089. var othIsDefined = other !== undefined,
  18090. othIsNull = other === null,
  18091. othIsReflexive = other === other,
  18092. othIsSymbol = isSymbol(other);
  18093. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  18094. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  18095. (valIsNull && othIsDefined && othIsReflexive) ||
  18096. (!valIsDefined && othIsReflexive) ||
  18097. !valIsReflexive) {
  18098. return 1;
  18099. }
  18100. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  18101. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  18102. (othIsNull && valIsDefined && valIsReflexive) ||
  18103. (!othIsDefined && valIsReflexive) ||
  18104. !othIsReflexive) {
  18105. return -1;
  18106. }
  18107. }
  18108. return 0;
  18109. }
  18110. /**
  18111. * Used by `_.orderBy` to compare multiple properties of a value to another
  18112. * and stable sort them.
  18113. *
  18114. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  18115. * specify an order of "desc" for descending or "asc" for ascending sort order
  18116. * of corresponding values.
  18117. *
  18118. * @private
  18119. * @param {Object} object The object to compare.
  18120. * @param {Object} other The other object to compare.
  18121. * @param {boolean[]|string[]} orders The order to sort by for each property.
  18122. * @returns {number} Returns the sort order indicator for `object`.
  18123. */
  18124. function compareMultiple(object, other, orders) {
  18125. var index = -1,
  18126. objCriteria = object.criteria,
  18127. othCriteria = other.criteria,
  18128. length = objCriteria.length,
  18129. ordersLength = orders.length;
  18130. while (++index < length) {
  18131. var result = compareAscending(objCriteria[index], othCriteria[index]);
  18132. if (result) {
  18133. if (index >= ordersLength) {
  18134. return result;
  18135. }
  18136. var order = orders[index];
  18137. return result * (order == 'desc' ? -1 : 1);
  18138. }
  18139. }
  18140. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  18141. // that causes it, under certain circumstances, to provide the same value for
  18142. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  18143. // for more details.
  18144. //
  18145. // This also ensures a stable sort in V8 and other engines.
  18146. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  18147. return object.index - other.index;
  18148. }
  18149. /**
  18150. * Creates an array that is the composition of partially applied arguments,
  18151. * placeholders, and provided arguments into a single array of arguments.
  18152. *
  18153. * @private
  18154. * @param {Array} args The provided arguments.
  18155. * @param {Array} partials The arguments to prepend to those provided.
  18156. * @param {Array} holders The `partials` placeholder indexes.
  18157. * @params {boolean} [isCurried] Specify composing for a curried function.
  18158. * @returns {Array} Returns the new array of composed arguments.
  18159. */
  18160. function composeArgs(args, partials, holders, isCurried) {
  18161. var argsIndex = -1,
  18162. argsLength = args.length,
  18163. holdersLength = holders.length,
  18164. leftIndex = -1,
  18165. leftLength = partials.length,
  18166. rangeLength = nativeMax(argsLength - holdersLength, 0),
  18167. result = Array(leftLength + rangeLength),
  18168. isUncurried = !isCurried;
  18169. while (++leftIndex < leftLength) {
  18170. result[leftIndex] = partials[leftIndex];
  18171. }
  18172. while (++argsIndex < holdersLength) {
  18173. if (isUncurried || argsIndex < argsLength) {
  18174. result[holders[argsIndex]] = args[argsIndex];
  18175. }
  18176. }
  18177. while (rangeLength--) {
  18178. result[leftIndex++] = args[argsIndex++];
  18179. }
  18180. return result;
  18181. }
  18182. /**
  18183. * This function is like `composeArgs` except that the arguments composition
  18184. * is tailored for `_.partialRight`.
  18185. *
  18186. * @private
  18187. * @param {Array} args The provided arguments.
  18188. * @param {Array} partials The arguments to append to those provided.
  18189. * @param {Array} holders The `partials` placeholder indexes.
  18190. * @params {boolean} [isCurried] Specify composing for a curried function.
  18191. * @returns {Array} Returns the new array of composed arguments.
  18192. */
  18193. function composeArgsRight(args, partials, holders, isCurried) {
  18194. var argsIndex = -1,
  18195. argsLength = args.length,
  18196. holdersIndex = -1,
  18197. holdersLength = holders.length,
  18198. rightIndex = -1,
  18199. rightLength = partials.length,
  18200. rangeLength = nativeMax(argsLength - holdersLength, 0),
  18201. result = Array(rangeLength + rightLength),
  18202. isUncurried = !isCurried;
  18203. while (++argsIndex < rangeLength) {
  18204. result[argsIndex] = args[argsIndex];
  18205. }
  18206. var offset = argsIndex;
  18207. while (++rightIndex < rightLength) {
  18208. result[offset + rightIndex] = partials[rightIndex];
  18209. }
  18210. while (++holdersIndex < holdersLength) {
  18211. if (isUncurried || argsIndex < argsLength) {
  18212. result[offset + holders[holdersIndex]] = args[argsIndex++];
  18213. }
  18214. }
  18215. return result;
  18216. }
  18217. /**
  18218. * Copies the values of `source` to `array`.
  18219. *
  18220. * @private
  18221. * @param {Array} source The array to copy values from.
  18222. * @param {Array} [array=[]] The array to copy values to.
  18223. * @returns {Array} Returns `array`.
  18224. */
  18225. function copyArray(source, array) {
  18226. var index = -1,
  18227. length = source.length;
  18228. array || (array = Array(length));
  18229. while (++index < length) {
  18230. array[index] = source[index];
  18231. }
  18232. return array;
  18233. }
  18234. /**
  18235. * Copies properties of `source` to `object`.
  18236. *
  18237. * @private
  18238. * @param {Object} source The object to copy properties from.
  18239. * @param {Array} props The property identifiers to copy.
  18240. * @param {Object} [object={}] The object to copy properties to.
  18241. * @param {Function} [customizer] The function to customize copied values.
  18242. * @returns {Object} Returns `object`.
  18243. */
  18244. function copyObject(source, props, object, customizer) {
  18245. var isNew = !object;
  18246. object || (object = {});
  18247. var index = -1,
  18248. length = props.length;
  18249. while (++index < length) {
  18250. var key = props[index];
  18251. var newValue = customizer
  18252. ? customizer(object[key], source[key], key, object, source)
  18253. : undefined;
  18254. if (newValue === undefined) {
  18255. newValue = source[key];
  18256. }
  18257. if (isNew) {
  18258. baseAssignValue(object, key, newValue);
  18259. } else {
  18260. assignValue(object, key, newValue);
  18261. }
  18262. }
  18263. return object;
  18264. }
  18265. /**
  18266. * Copies own symbols of `source` to `object`.
  18267. *
  18268. * @private
  18269. * @param {Object} source The object to copy symbols from.
  18270. * @param {Object} [object={}] The object to copy symbols to.
  18271. * @returns {Object} Returns `object`.
  18272. */
  18273. function copySymbols(source, object) {
  18274. return copyObject(source, getSymbols(source), object);
  18275. }
  18276. /**
  18277. * Copies own and inherited symbols of `source` to `object`.
  18278. *
  18279. * @private
  18280. * @param {Object} source The object to copy symbols from.
  18281. * @param {Object} [object={}] The object to copy symbols to.
  18282. * @returns {Object} Returns `object`.
  18283. */
  18284. function copySymbolsIn(source, object) {
  18285. return copyObject(source, getSymbolsIn(source), object);
  18286. }
  18287. /**
  18288. * Creates a function like `_.groupBy`.
  18289. *
  18290. * @private
  18291. * @param {Function} setter The function to set accumulator values.
  18292. * @param {Function} [initializer] The accumulator object initializer.
  18293. * @returns {Function} Returns the new aggregator function.
  18294. */
  18295. function createAggregator(setter, initializer) {
  18296. return function(collection, iteratee) {
  18297. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  18298. accumulator = initializer ? initializer() : {};
  18299. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  18300. };
  18301. }
  18302. /**
  18303. * Creates a function like `_.assign`.
  18304. *
  18305. * @private
  18306. * @param {Function} assigner The function to assign values.
  18307. * @returns {Function} Returns the new assigner function.
  18308. */
  18309. function createAssigner(assigner) {
  18310. return baseRest(function(object, sources) {
  18311. var index = -1,
  18312. length = sources.length,
  18313. customizer = length > 1 ? sources[length - 1] : undefined,
  18314. guard = length > 2 ? sources[2] : undefined;
  18315. customizer = (assigner.length > 3 && typeof customizer == 'function')
  18316. ? (length--, customizer)
  18317. : undefined;
  18318. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  18319. customizer = length < 3 ? undefined : customizer;
  18320. length = 1;
  18321. }
  18322. object = Object(object);
  18323. while (++index < length) {
  18324. var source = sources[index];
  18325. if (source) {
  18326. assigner(object, source, index, customizer);
  18327. }
  18328. }
  18329. return object;
  18330. });
  18331. }
  18332. /**
  18333. * Creates a `baseEach` or `baseEachRight` function.
  18334. *
  18335. * @private
  18336. * @param {Function} eachFunc The function to iterate over a collection.
  18337. * @param {boolean} [fromRight] Specify iterating from right to left.
  18338. * @returns {Function} Returns the new base function.
  18339. */
  18340. function createBaseEach(eachFunc, fromRight) {
  18341. return function(collection, iteratee) {
  18342. if (collection == null) {
  18343. return collection;
  18344. }
  18345. if (!isArrayLike(collection)) {
  18346. return eachFunc(collection, iteratee);
  18347. }
  18348. var length = collection.length,
  18349. index = fromRight ? length : -1,
  18350. iterable = Object(collection);
  18351. while ((fromRight ? index-- : ++index < length)) {
  18352. if (iteratee(iterable[index], index, iterable) === false) {
  18353. break;
  18354. }
  18355. }
  18356. return collection;
  18357. };
  18358. }
  18359. /**
  18360. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  18361. *
  18362. * @private
  18363. * @param {boolean} [fromRight] Specify iterating from right to left.
  18364. * @returns {Function} Returns the new base function.
  18365. */
  18366. function createBaseFor(fromRight) {
  18367. return function(object, iteratee, keysFunc) {
  18368. var index = -1,
  18369. iterable = Object(object),
  18370. props = keysFunc(object),
  18371. length = props.length;
  18372. while (length--) {
  18373. var key = props[fromRight ? length : ++index];
  18374. if (iteratee(iterable[key], key, iterable) === false) {
  18375. break;
  18376. }
  18377. }
  18378. return object;
  18379. };
  18380. }
  18381. /**
  18382. * Creates a function that wraps `func` to invoke it with the optional `this`
  18383. * binding of `thisArg`.
  18384. *
  18385. * @private
  18386. * @param {Function} func The function to wrap.
  18387. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18388. * @param {*} [thisArg] The `this` binding of `func`.
  18389. * @returns {Function} Returns the new wrapped function.
  18390. */
  18391. function createBind(func, bitmask, thisArg) {
  18392. var isBind = bitmask & WRAP_BIND_FLAG,
  18393. Ctor = createCtor(func);
  18394. function wrapper() {
  18395. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  18396. return fn.apply(isBind ? thisArg : this, arguments);
  18397. }
  18398. return wrapper;
  18399. }
  18400. /**
  18401. * Creates a function like `_.lowerFirst`.
  18402. *
  18403. * @private
  18404. * @param {string} methodName The name of the `String` case method to use.
  18405. * @returns {Function} Returns the new case function.
  18406. */
  18407. function createCaseFirst(methodName) {
  18408. return function(string) {
  18409. string = toString(string);
  18410. var strSymbols = hasUnicode(string)
  18411. ? stringToArray(string)
  18412. : undefined;
  18413. var chr = strSymbols
  18414. ? strSymbols[0]
  18415. : string.charAt(0);
  18416. var trailing = strSymbols
  18417. ? castSlice(strSymbols, 1).join('')
  18418. : string.slice(1);
  18419. return chr[methodName]() + trailing;
  18420. };
  18421. }
  18422. /**
  18423. * Creates a function like `_.camelCase`.
  18424. *
  18425. * @private
  18426. * @param {Function} callback The function to combine each word.
  18427. * @returns {Function} Returns the new compounder function.
  18428. */
  18429. function createCompounder(callback) {
  18430. return function(string) {
  18431. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  18432. };
  18433. }
  18434. /**
  18435. * Creates a function that produces an instance of `Ctor` regardless of
  18436. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  18437. *
  18438. * @private
  18439. * @param {Function} Ctor The constructor to wrap.
  18440. * @returns {Function} Returns the new wrapped function.
  18441. */
  18442. function createCtor(Ctor) {
  18443. return function() {
  18444. // Use a `switch` statement to work with class constructors. See
  18445. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  18446. // for more details.
  18447. var args = arguments;
  18448. switch (args.length) {
  18449. case 0: return new Ctor;
  18450. case 1: return new Ctor(args[0]);
  18451. case 2: return new Ctor(args[0], args[1]);
  18452. case 3: return new Ctor(args[0], args[1], args[2]);
  18453. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  18454. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  18455. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  18456. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  18457. }
  18458. var thisBinding = baseCreate(Ctor.prototype),
  18459. result = Ctor.apply(thisBinding, args);
  18460. // Mimic the constructor's `return` behavior.
  18461. // See https://es5.github.io/#x13.2.2 for more details.
  18462. return isObject(result) ? result : thisBinding;
  18463. };
  18464. }
  18465. /**
  18466. * Creates a function that wraps `func` to enable currying.
  18467. *
  18468. * @private
  18469. * @param {Function} func The function to wrap.
  18470. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18471. * @param {number} arity The arity of `func`.
  18472. * @returns {Function} Returns the new wrapped function.
  18473. */
  18474. function createCurry(func, bitmask, arity) {
  18475. var Ctor = createCtor(func);
  18476. function wrapper() {
  18477. var length = arguments.length,
  18478. args = Array(length),
  18479. index = length,
  18480. placeholder = getHolder(wrapper);
  18481. while (index--) {
  18482. args[index] = arguments[index];
  18483. }
  18484. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  18485. ? []
  18486. : replaceHolders(args, placeholder);
  18487. length -= holders.length;
  18488. if (length < arity) {
  18489. return createRecurry(
  18490. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  18491. args, holders, undefined, undefined, arity - length);
  18492. }
  18493. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  18494. return apply(fn, this, args);
  18495. }
  18496. return wrapper;
  18497. }
  18498. /**
  18499. * Creates a `_.find` or `_.findLast` function.
  18500. *
  18501. * @private
  18502. * @param {Function} findIndexFunc The function to find the collection index.
  18503. * @returns {Function} Returns the new find function.
  18504. */
  18505. function createFind(findIndexFunc) {
  18506. return function(collection, predicate, fromIndex) {
  18507. var iterable = Object(collection);
  18508. if (!isArrayLike(collection)) {
  18509. var iteratee = getIteratee(predicate, 3);
  18510. collection = keys(collection);
  18511. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  18512. }
  18513. var index = findIndexFunc(collection, predicate, fromIndex);
  18514. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  18515. };
  18516. }
  18517. /**
  18518. * Creates a `_.flow` or `_.flowRight` function.
  18519. *
  18520. * @private
  18521. * @param {boolean} [fromRight] Specify iterating from right to left.
  18522. * @returns {Function} Returns the new flow function.
  18523. */
  18524. function createFlow(fromRight) {
  18525. return flatRest(function(funcs) {
  18526. var length = funcs.length,
  18527. index = length,
  18528. prereq = LodashWrapper.prototype.thru;
  18529. if (fromRight) {
  18530. funcs.reverse();
  18531. }
  18532. while (index--) {
  18533. var func = funcs[index];
  18534. if (typeof func != 'function') {
  18535. throw new TypeError(FUNC_ERROR_TEXT);
  18536. }
  18537. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  18538. var wrapper = new LodashWrapper([], true);
  18539. }
  18540. }
  18541. index = wrapper ? index : length;
  18542. while (++index < length) {
  18543. func = funcs[index];
  18544. var funcName = getFuncName(func),
  18545. data = funcName == 'wrapper' ? getData(func) : undefined;
  18546. if (data && isLaziable(data[0]) &&
  18547. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  18548. !data[4].length && data[9] == 1
  18549. ) {
  18550. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  18551. } else {
  18552. wrapper = (func.length == 1 && isLaziable(func))
  18553. ? wrapper[funcName]()
  18554. : wrapper.thru(func);
  18555. }
  18556. }
  18557. return function() {
  18558. var args = arguments,
  18559. value = args[0];
  18560. if (wrapper && args.length == 1 && isArray(value)) {
  18561. return wrapper.plant(value).value();
  18562. }
  18563. var index = 0,
  18564. result = length ? funcs[index].apply(this, args) : value;
  18565. while (++index < length) {
  18566. result = funcs[index].call(this, result);
  18567. }
  18568. return result;
  18569. };
  18570. });
  18571. }
  18572. /**
  18573. * Creates a function that wraps `func` to invoke it with optional `this`
  18574. * binding of `thisArg`, partial application, and currying.
  18575. *
  18576. * @private
  18577. * @param {Function|string} func The function or method name to wrap.
  18578. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18579. * @param {*} [thisArg] The `this` binding of `func`.
  18580. * @param {Array} [partials] The arguments to prepend to those provided to
  18581. * the new function.
  18582. * @param {Array} [holders] The `partials` placeholder indexes.
  18583. * @param {Array} [partialsRight] The arguments to append to those provided
  18584. * to the new function.
  18585. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  18586. * @param {Array} [argPos] The argument positions of the new function.
  18587. * @param {number} [ary] The arity cap of `func`.
  18588. * @param {number} [arity] The arity of `func`.
  18589. * @returns {Function} Returns the new wrapped function.
  18590. */
  18591. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  18592. var isAry = bitmask & WRAP_ARY_FLAG,
  18593. isBind = bitmask & WRAP_BIND_FLAG,
  18594. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  18595. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  18596. isFlip = bitmask & WRAP_FLIP_FLAG,
  18597. Ctor = isBindKey ? undefined : createCtor(func);
  18598. function wrapper() {
  18599. var length = arguments.length,
  18600. args = Array(length),
  18601. index = length;
  18602. while (index--) {
  18603. args[index] = arguments[index];
  18604. }
  18605. if (isCurried) {
  18606. var placeholder = getHolder(wrapper),
  18607. holdersCount = countHolders(args, placeholder);
  18608. }
  18609. if (partials) {
  18610. args = composeArgs(args, partials, holders, isCurried);
  18611. }
  18612. if (partialsRight) {
  18613. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  18614. }
  18615. length -= holdersCount;
  18616. if (isCurried && length < arity) {
  18617. var newHolders = replaceHolders(args, placeholder);
  18618. return createRecurry(
  18619. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  18620. args, newHolders, argPos, ary, arity - length
  18621. );
  18622. }
  18623. var thisBinding = isBind ? thisArg : this,
  18624. fn = isBindKey ? thisBinding[func] : func;
  18625. length = args.length;
  18626. if (argPos) {
  18627. args = reorder(args, argPos);
  18628. } else if (isFlip && length > 1) {
  18629. args.reverse();
  18630. }
  18631. if (isAry && ary < length) {
  18632. args.length = ary;
  18633. }
  18634. if (this && this !== root && this instanceof wrapper) {
  18635. fn = Ctor || createCtor(fn);
  18636. }
  18637. return fn.apply(thisBinding, args);
  18638. }
  18639. return wrapper;
  18640. }
  18641. /**
  18642. * Creates a function like `_.invertBy`.
  18643. *
  18644. * @private
  18645. * @param {Function} setter The function to set accumulator values.
  18646. * @param {Function} toIteratee The function to resolve iteratees.
  18647. * @returns {Function} Returns the new inverter function.
  18648. */
  18649. function createInverter(setter, toIteratee) {
  18650. return function(object, iteratee) {
  18651. return baseInverter(object, setter, toIteratee(iteratee), {});
  18652. };
  18653. }
  18654. /**
  18655. * Creates a function that performs a mathematical operation on two values.
  18656. *
  18657. * @private
  18658. * @param {Function} operator The function to perform the operation.
  18659. * @param {number} [defaultValue] The value used for `undefined` arguments.
  18660. * @returns {Function} Returns the new mathematical operation function.
  18661. */
  18662. function createMathOperation(operator, defaultValue) {
  18663. return function(value, other) {
  18664. var result;
  18665. if (value === undefined && other === undefined) {
  18666. return defaultValue;
  18667. }
  18668. if (value !== undefined) {
  18669. result = value;
  18670. }
  18671. if (other !== undefined) {
  18672. if (result === undefined) {
  18673. return other;
  18674. }
  18675. if (typeof value == 'string' || typeof other == 'string') {
  18676. value = baseToString(value);
  18677. other = baseToString(other);
  18678. } else {
  18679. value = baseToNumber(value);
  18680. other = baseToNumber(other);
  18681. }
  18682. result = operator(value, other);
  18683. }
  18684. return result;
  18685. };
  18686. }
  18687. /**
  18688. * Creates a function like `_.over`.
  18689. *
  18690. * @private
  18691. * @param {Function} arrayFunc The function to iterate over iteratees.
  18692. * @returns {Function} Returns the new over function.
  18693. */
  18694. function createOver(arrayFunc) {
  18695. return flatRest(function(iteratees) {
  18696. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  18697. return baseRest(function(args) {
  18698. var thisArg = this;
  18699. return arrayFunc(iteratees, function(iteratee) {
  18700. return apply(iteratee, thisArg, args);
  18701. });
  18702. });
  18703. });
  18704. }
  18705. /**
  18706. * Creates the padding for `string` based on `length`. The `chars` string
  18707. * is truncated if the number of characters exceeds `length`.
  18708. *
  18709. * @private
  18710. * @param {number} length The padding length.
  18711. * @param {string} [chars=' '] The string used as padding.
  18712. * @returns {string} Returns the padding for `string`.
  18713. */
  18714. function createPadding(length, chars) {
  18715. chars = chars === undefined ? ' ' : baseToString(chars);
  18716. var charsLength = chars.length;
  18717. if (charsLength < 2) {
  18718. return charsLength ? baseRepeat(chars, length) : chars;
  18719. }
  18720. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  18721. return hasUnicode(chars)
  18722. ? castSlice(stringToArray(result), 0, length).join('')
  18723. : result.slice(0, length);
  18724. }
  18725. /**
  18726. * Creates a function that wraps `func` to invoke it with the `this` binding
  18727. * of `thisArg` and `partials` prepended to the arguments it receives.
  18728. *
  18729. * @private
  18730. * @param {Function} func The function to wrap.
  18731. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18732. * @param {*} thisArg The `this` binding of `func`.
  18733. * @param {Array} partials The arguments to prepend to those provided to
  18734. * the new function.
  18735. * @returns {Function} Returns the new wrapped function.
  18736. */
  18737. function createPartial(func, bitmask, thisArg, partials) {
  18738. var isBind = bitmask & WRAP_BIND_FLAG,
  18739. Ctor = createCtor(func);
  18740. function wrapper() {
  18741. var argsIndex = -1,
  18742. argsLength = arguments.length,
  18743. leftIndex = -1,
  18744. leftLength = partials.length,
  18745. args = Array(leftLength + argsLength),
  18746. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  18747. while (++leftIndex < leftLength) {
  18748. args[leftIndex] = partials[leftIndex];
  18749. }
  18750. while (argsLength--) {
  18751. args[leftIndex++] = arguments[++argsIndex];
  18752. }
  18753. return apply(fn, isBind ? thisArg : this, args);
  18754. }
  18755. return wrapper;
  18756. }
  18757. /**
  18758. * Creates a `_.range` or `_.rangeRight` function.
  18759. *
  18760. * @private
  18761. * @param {boolean} [fromRight] Specify iterating from right to left.
  18762. * @returns {Function} Returns the new range function.
  18763. */
  18764. function createRange(fromRight) {
  18765. return function(start, end, step) {
  18766. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  18767. end = step = undefined;
  18768. }
  18769. // Ensure the sign of `-0` is preserved.
  18770. start = toFinite(start);
  18771. if (end === undefined) {
  18772. end = start;
  18773. start = 0;
  18774. } else {
  18775. end = toFinite(end);
  18776. }
  18777. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  18778. return baseRange(start, end, step, fromRight);
  18779. };
  18780. }
  18781. /**
  18782. * Creates a function that performs a relational operation on two values.
  18783. *
  18784. * @private
  18785. * @param {Function} operator The function to perform the operation.
  18786. * @returns {Function} Returns the new relational operation function.
  18787. */
  18788. function createRelationalOperation(operator) {
  18789. return function(value, other) {
  18790. if (!(typeof value == 'string' && typeof other == 'string')) {
  18791. value = toNumber(value);
  18792. other = toNumber(other);
  18793. }
  18794. return operator(value, other);
  18795. };
  18796. }
  18797. /**
  18798. * Creates a function that wraps `func` to continue currying.
  18799. *
  18800. * @private
  18801. * @param {Function} func The function to wrap.
  18802. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18803. * @param {Function} wrapFunc The function to create the `func` wrapper.
  18804. * @param {*} placeholder The placeholder value.
  18805. * @param {*} [thisArg] The `this` binding of `func`.
  18806. * @param {Array} [partials] The arguments to prepend to those provided to
  18807. * the new function.
  18808. * @param {Array} [holders] The `partials` placeholder indexes.
  18809. * @param {Array} [argPos] The argument positions of the new function.
  18810. * @param {number} [ary] The arity cap of `func`.
  18811. * @param {number} [arity] The arity of `func`.
  18812. * @returns {Function} Returns the new wrapped function.
  18813. */
  18814. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  18815. var isCurry = bitmask & WRAP_CURRY_FLAG,
  18816. newHolders = isCurry ? holders : undefined,
  18817. newHoldersRight = isCurry ? undefined : holders,
  18818. newPartials = isCurry ? partials : undefined,
  18819. newPartialsRight = isCurry ? undefined : partials;
  18820. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  18821. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  18822. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  18823. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  18824. }
  18825. var newData = [
  18826. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  18827. newHoldersRight, argPos, ary, arity
  18828. ];
  18829. var result = wrapFunc.apply(undefined, newData);
  18830. if (isLaziable(func)) {
  18831. setData(result, newData);
  18832. }
  18833. result.placeholder = placeholder;
  18834. return setWrapToString(result, func, bitmask);
  18835. }
  18836. /**
  18837. * Creates a function like `_.round`.
  18838. *
  18839. * @private
  18840. * @param {string} methodName The name of the `Math` method to use when rounding.
  18841. * @returns {Function} Returns the new round function.
  18842. */
  18843. function createRound(methodName) {
  18844. var func = Math[methodName];
  18845. return function(number, precision) {
  18846. number = toNumber(number);
  18847. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  18848. if (precision && nativeIsFinite(number)) {
  18849. // Shift with exponential notation to avoid floating-point issues.
  18850. // See [MDN](https://mdn.io/round#Examples) for more details.
  18851. var pair = (toString(number) + 'e').split('e'),
  18852. value = func(pair[0] + 'e' + (+pair[1] + precision));
  18853. pair = (toString(value) + 'e').split('e');
  18854. return +(pair[0] + 'e' + (+pair[1] - precision));
  18855. }
  18856. return func(number);
  18857. };
  18858. }
  18859. /**
  18860. * Creates a set object of `values`.
  18861. *
  18862. * @private
  18863. * @param {Array} values The values to add to the set.
  18864. * @returns {Object} Returns the new set.
  18865. */
  18866. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  18867. return new Set(values);
  18868. };
  18869. /**
  18870. * Creates a `_.toPairs` or `_.toPairsIn` function.
  18871. *
  18872. * @private
  18873. * @param {Function} keysFunc The function to get the keys of a given object.
  18874. * @returns {Function} Returns the new pairs function.
  18875. */
  18876. function createToPairs(keysFunc) {
  18877. return function(object) {
  18878. var tag = getTag(object);
  18879. if (tag == mapTag) {
  18880. return mapToArray(object);
  18881. }
  18882. if (tag == setTag) {
  18883. return setToPairs(object);
  18884. }
  18885. return baseToPairs(object, keysFunc(object));
  18886. };
  18887. }
  18888. /**
  18889. * Creates a function that either curries or invokes `func` with optional
  18890. * `this` binding and partially applied arguments.
  18891. *
  18892. * @private
  18893. * @param {Function|string} func The function or method name to wrap.
  18894. * @param {number} bitmask The bitmask flags.
  18895. * 1 - `_.bind`
  18896. * 2 - `_.bindKey`
  18897. * 4 - `_.curry` or `_.curryRight` of a bound function
  18898. * 8 - `_.curry`
  18899. * 16 - `_.curryRight`
  18900. * 32 - `_.partial`
  18901. * 64 - `_.partialRight`
  18902. * 128 - `_.rearg`
  18903. * 256 - `_.ary`
  18904. * 512 - `_.flip`
  18905. * @param {*} [thisArg] The `this` binding of `func`.
  18906. * @param {Array} [partials] The arguments to be partially applied.
  18907. * @param {Array} [holders] The `partials` placeholder indexes.
  18908. * @param {Array} [argPos] The argument positions of the new function.
  18909. * @param {number} [ary] The arity cap of `func`.
  18910. * @param {number} [arity] The arity of `func`.
  18911. * @returns {Function} Returns the new wrapped function.
  18912. */
  18913. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  18914. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  18915. if (!isBindKey && typeof func != 'function') {
  18916. throw new TypeError(FUNC_ERROR_TEXT);
  18917. }
  18918. var length = partials ? partials.length : 0;
  18919. if (!length) {
  18920. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  18921. partials = holders = undefined;
  18922. }
  18923. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  18924. arity = arity === undefined ? arity : toInteger(arity);
  18925. length -= holders ? holders.length : 0;
  18926. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  18927. var partialsRight = partials,
  18928. holdersRight = holders;
  18929. partials = holders = undefined;
  18930. }
  18931. var data = isBindKey ? undefined : getData(func);
  18932. var newData = [
  18933. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  18934. argPos, ary, arity
  18935. ];
  18936. if (data) {
  18937. mergeData(newData, data);
  18938. }
  18939. func = newData[0];
  18940. bitmask = newData[1];
  18941. thisArg = newData[2];
  18942. partials = newData[3];
  18943. holders = newData[4];
  18944. arity = newData[9] = newData[9] === undefined
  18945. ? (isBindKey ? 0 : func.length)
  18946. : nativeMax(newData[9] - length, 0);
  18947. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  18948. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  18949. }
  18950. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  18951. var result = createBind(func, bitmask, thisArg);
  18952. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  18953. result = createCurry(func, bitmask, arity);
  18954. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  18955. result = createPartial(func, bitmask, thisArg, partials);
  18956. } else {
  18957. result = createHybrid.apply(undefined, newData);
  18958. }
  18959. var setter = data ? baseSetData : setData;
  18960. return setWrapToString(setter(result, newData), func, bitmask);
  18961. }
  18962. /**
  18963. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  18964. * of source objects to the destination object for all destination properties
  18965. * that resolve to `undefined`.
  18966. *
  18967. * @private
  18968. * @param {*} objValue The destination value.
  18969. * @param {*} srcValue The source value.
  18970. * @param {string} key The key of the property to assign.
  18971. * @param {Object} object The parent object of `objValue`.
  18972. * @returns {*} Returns the value to assign.
  18973. */
  18974. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  18975. if (objValue === undefined ||
  18976. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  18977. return srcValue;
  18978. }
  18979. return objValue;
  18980. }
  18981. /**
  18982. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  18983. * objects into destination objects that are passed thru.
  18984. *
  18985. * @private
  18986. * @param {*} objValue The destination value.
  18987. * @param {*} srcValue The source value.
  18988. * @param {string} key The key of the property to merge.
  18989. * @param {Object} object The parent object of `objValue`.
  18990. * @param {Object} source The parent object of `srcValue`.
  18991. * @param {Object} [stack] Tracks traversed source values and their merged
  18992. * counterparts.
  18993. * @returns {*} Returns the value to assign.
  18994. */
  18995. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  18996. if (isObject(objValue) && isObject(srcValue)) {
  18997. // Recursively merge objects and arrays (susceptible to call stack limits).
  18998. stack.set(srcValue, objValue);
  18999. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  19000. stack['delete'](srcValue);
  19001. }
  19002. return objValue;
  19003. }
  19004. /**
  19005. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  19006. * objects.
  19007. *
  19008. * @private
  19009. * @param {*} value The value to inspect.
  19010. * @param {string} key The key of the property to inspect.
  19011. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  19012. */
  19013. function customOmitClone(value) {
  19014. return isPlainObject(value) ? undefined : value;
  19015. }
  19016. /**
  19017. * A specialized version of `baseIsEqualDeep` for arrays with support for
  19018. * partial deep comparisons.
  19019. *
  19020. * @private
  19021. * @param {Array} array The array to compare.
  19022. * @param {Array} other The other array to compare.
  19023. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19024. * @param {Function} customizer The function to customize comparisons.
  19025. * @param {Function} equalFunc The function to determine equivalents of values.
  19026. * @param {Object} stack Tracks traversed `array` and `other` objects.
  19027. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  19028. */
  19029. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  19030. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  19031. arrLength = array.length,
  19032. othLength = other.length;
  19033. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  19034. return false;
  19035. }
  19036. // Assume cyclic values are equal.
  19037. var stacked = stack.get(array);
  19038. if (stacked && stack.get(other)) {
  19039. return stacked == other;
  19040. }
  19041. var index = -1,
  19042. result = true,
  19043. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  19044. stack.set(array, other);
  19045. stack.set(other, array);
  19046. // Ignore non-index properties.
  19047. while (++index < arrLength) {
  19048. var arrValue = array[index],
  19049. othValue = other[index];
  19050. if (customizer) {
  19051. var compared = isPartial
  19052. ? customizer(othValue, arrValue, index, other, array, stack)
  19053. : customizer(arrValue, othValue, index, array, other, stack);
  19054. }
  19055. if (compared !== undefined) {
  19056. if (compared) {
  19057. continue;
  19058. }
  19059. result = false;
  19060. break;
  19061. }
  19062. // Recursively compare arrays (susceptible to call stack limits).
  19063. if (seen) {
  19064. if (!arraySome(other, function(othValue, othIndex) {
  19065. if (!cacheHas(seen, othIndex) &&
  19066. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  19067. return seen.push(othIndex);
  19068. }
  19069. })) {
  19070. result = false;
  19071. break;
  19072. }
  19073. } else if (!(
  19074. arrValue === othValue ||
  19075. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  19076. )) {
  19077. result = false;
  19078. break;
  19079. }
  19080. }
  19081. stack['delete'](array);
  19082. stack['delete'](other);
  19083. return result;
  19084. }
  19085. /**
  19086. * A specialized version of `baseIsEqualDeep` for comparing objects of
  19087. * the same `toStringTag`.
  19088. *
  19089. * **Note:** This function only supports comparing values with tags of
  19090. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  19091. *
  19092. * @private
  19093. * @param {Object} object The object to compare.
  19094. * @param {Object} other The other object to compare.
  19095. * @param {string} tag The `toStringTag` of the objects to compare.
  19096. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19097. * @param {Function} customizer The function to customize comparisons.
  19098. * @param {Function} equalFunc The function to determine equivalents of values.
  19099. * @param {Object} stack Tracks traversed `object` and `other` objects.
  19100. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  19101. */
  19102. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  19103. switch (tag) {
  19104. case dataViewTag:
  19105. if ((object.byteLength != other.byteLength) ||
  19106. (object.byteOffset != other.byteOffset)) {
  19107. return false;
  19108. }
  19109. object = object.buffer;
  19110. other = other.buffer;
  19111. case arrayBufferTag:
  19112. if ((object.byteLength != other.byteLength) ||
  19113. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  19114. return false;
  19115. }
  19116. return true;
  19117. case boolTag:
  19118. case dateTag:
  19119. case numberTag:
  19120. // Coerce booleans to `1` or `0` and dates to milliseconds.
  19121. // Invalid dates are coerced to `NaN`.
  19122. return eq(+object, +other);
  19123. case errorTag:
  19124. return object.name == other.name && object.message == other.message;
  19125. case regexpTag:
  19126. case stringTag:
  19127. // Coerce regexes to strings and treat strings, primitives and objects,
  19128. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  19129. // for more details.
  19130. return object == (other + '');
  19131. case mapTag:
  19132. var convert = mapToArray;
  19133. case setTag:
  19134. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  19135. convert || (convert = setToArray);
  19136. if (object.size != other.size && !isPartial) {
  19137. return false;
  19138. }
  19139. // Assume cyclic values are equal.
  19140. var stacked = stack.get(object);
  19141. if (stacked) {
  19142. return stacked == other;
  19143. }
  19144. bitmask |= COMPARE_UNORDERED_FLAG;
  19145. // Recursively compare objects (susceptible to call stack limits).
  19146. stack.set(object, other);
  19147. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  19148. stack['delete'](object);
  19149. return result;
  19150. case symbolTag:
  19151. if (symbolValueOf) {
  19152. return symbolValueOf.call(object) == symbolValueOf.call(other);
  19153. }
  19154. }
  19155. return false;
  19156. }
  19157. /**
  19158. * A specialized version of `baseIsEqualDeep` for objects with support for
  19159. * partial deep comparisons.
  19160. *
  19161. * @private
  19162. * @param {Object} object The object to compare.
  19163. * @param {Object} other The other object to compare.
  19164. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19165. * @param {Function} customizer The function to customize comparisons.
  19166. * @param {Function} equalFunc The function to determine equivalents of values.
  19167. * @param {Object} stack Tracks traversed `object` and `other` objects.
  19168. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  19169. */
  19170. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  19171. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  19172. objProps = getAllKeys(object),
  19173. objLength = objProps.length,
  19174. othProps = getAllKeys(other),
  19175. othLength = othProps.length;
  19176. if (objLength != othLength && !isPartial) {
  19177. return false;
  19178. }
  19179. var index = objLength;
  19180. while (index--) {
  19181. var key = objProps[index];
  19182. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  19183. return false;
  19184. }
  19185. }
  19186. // Assume cyclic values are equal.
  19187. var stacked = stack.get(object);
  19188. if (stacked && stack.get(other)) {
  19189. return stacked == other;
  19190. }
  19191. var result = true;
  19192. stack.set(object, other);
  19193. stack.set(other, object);
  19194. var skipCtor = isPartial;
  19195. while (++index < objLength) {
  19196. key = objProps[index];
  19197. var objValue = object[key],
  19198. othValue = other[key];
  19199. if (customizer) {
  19200. var compared = isPartial
  19201. ? customizer(othValue, objValue, key, other, object, stack)
  19202. : customizer(objValue, othValue, key, object, other, stack);
  19203. }
  19204. // Recursively compare objects (susceptible to call stack limits).
  19205. if (!(compared === undefined
  19206. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  19207. : compared
  19208. )) {
  19209. result = false;
  19210. break;
  19211. }
  19212. skipCtor || (skipCtor = key == 'constructor');
  19213. }
  19214. if (result && !skipCtor) {
  19215. var objCtor = object.constructor,
  19216. othCtor = other.constructor;
  19217. // Non `Object` object instances with different constructors are not equal.
  19218. if (objCtor != othCtor &&
  19219. ('constructor' in object && 'constructor' in other) &&
  19220. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  19221. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  19222. result = false;
  19223. }
  19224. }
  19225. stack['delete'](object);
  19226. stack['delete'](other);
  19227. return result;
  19228. }
  19229. /**
  19230. * A specialized version of `baseRest` which flattens the rest array.
  19231. *
  19232. * @private
  19233. * @param {Function} func The function to apply a rest parameter to.
  19234. * @returns {Function} Returns the new function.
  19235. */
  19236. function flatRest(func) {
  19237. return setToString(overRest(func, undefined, flatten), func + '');
  19238. }
  19239. /**
  19240. * Creates an array of own enumerable property names and symbols of `object`.
  19241. *
  19242. * @private
  19243. * @param {Object} object The object to query.
  19244. * @returns {Array} Returns the array of property names and symbols.
  19245. */
  19246. function getAllKeys(object) {
  19247. return baseGetAllKeys(object, keys, getSymbols);
  19248. }
  19249. /**
  19250. * Creates an array of own and inherited enumerable property names and
  19251. * symbols of `object`.
  19252. *
  19253. * @private
  19254. * @param {Object} object The object to query.
  19255. * @returns {Array} Returns the array of property names and symbols.
  19256. */
  19257. function getAllKeysIn(object) {
  19258. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  19259. }
  19260. /**
  19261. * Gets metadata for `func`.
  19262. *
  19263. * @private
  19264. * @param {Function} func The function to query.
  19265. * @returns {*} Returns the metadata for `func`.
  19266. */
  19267. var getData = !metaMap ? noop : function(func) {
  19268. return metaMap.get(func);
  19269. };
  19270. /**
  19271. * Gets the name of `func`.
  19272. *
  19273. * @private
  19274. * @param {Function} func The function to query.
  19275. * @returns {string} Returns the function name.
  19276. */
  19277. function getFuncName(func) {
  19278. var result = (func.name + ''),
  19279. array = realNames[result],
  19280. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  19281. while (length--) {
  19282. var data = array[length],
  19283. otherFunc = data.func;
  19284. if (otherFunc == null || otherFunc == func) {
  19285. return data.name;
  19286. }
  19287. }
  19288. return result;
  19289. }
  19290. /**
  19291. * Gets the argument placeholder value for `func`.
  19292. *
  19293. * @private
  19294. * @param {Function} func The function to inspect.
  19295. * @returns {*} Returns the placeholder value.
  19296. */
  19297. function getHolder(func) {
  19298. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  19299. return object.placeholder;
  19300. }
  19301. /**
  19302. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  19303. * this function returns the custom method, otherwise it returns `baseIteratee`.
  19304. * If arguments are provided, the chosen function is invoked with them and
  19305. * its result is returned.
  19306. *
  19307. * @private
  19308. * @param {*} [value] The value to convert to an iteratee.
  19309. * @param {number} [arity] The arity of the created iteratee.
  19310. * @returns {Function} Returns the chosen function or its result.
  19311. */
  19312. function getIteratee() {
  19313. var result = lodash.iteratee || iteratee;
  19314. result = result === iteratee ? baseIteratee : result;
  19315. return arguments.length ? result(arguments[0], arguments[1]) : result;
  19316. }
  19317. /**
  19318. * Gets the data for `map`.
  19319. *
  19320. * @private
  19321. * @param {Object} map The map to query.
  19322. * @param {string} key The reference key.
  19323. * @returns {*} Returns the map data.
  19324. */
  19325. function getMapData(map, key) {
  19326. var data = map.__data__;
  19327. return isKeyable(key)
  19328. ? data[typeof key == 'string' ? 'string' : 'hash']
  19329. : data.map;
  19330. }
  19331. /**
  19332. * Gets the property names, values, and compare flags of `object`.
  19333. *
  19334. * @private
  19335. * @param {Object} object The object to query.
  19336. * @returns {Array} Returns the match data of `object`.
  19337. */
  19338. function getMatchData(object) {
  19339. var result = keys(object),
  19340. length = result.length;
  19341. while (length--) {
  19342. var key = result[length],
  19343. value = object[key];
  19344. result[length] = [key, value, isStrictComparable(value)];
  19345. }
  19346. return result;
  19347. }
  19348. /**
  19349. * Gets the native function at `key` of `object`.
  19350. *
  19351. * @private
  19352. * @param {Object} object The object to query.
  19353. * @param {string} key The key of the method to get.
  19354. * @returns {*} Returns the function if it's native, else `undefined`.
  19355. */
  19356. function getNative(object, key) {
  19357. var value = getValue(object, key);
  19358. return baseIsNative(value) ? value : undefined;
  19359. }
  19360. /**
  19361. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  19362. *
  19363. * @private
  19364. * @param {*} value The value to query.
  19365. * @returns {string} Returns the raw `toStringTag`.
  19366. */
  19367. function getRawTag(value) {
  19368. var isOwn = hasOwnProperty.call(value, symToStringTag),
  19369. tag = value[symToStringTag];
  19370. try {
  19371. value[symToStringTag] = undefined;
  19372. var unmasked = true;
  19373. } catch (e) {}
  19374. var result = nativeObjectToString.call(value);
  19375. if (unmasked) {
  19376. if (isOwn) {
  19377. value[symToStringTag] = tag;
  19378. } else {
  19379. delete value[symToStringTag];
  19380. }
  19381. }
  19382. return result;
  19383. }
  19384. /**
  19385. * Creates an array of the own enumerable symbols of `object`.
  19386. *
  19387. * @private
  19388. * @param {Object} object The object to query.
  19389. * @returns {Array} Returns the array of symbols.
  19390. */
  19391. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  19392. if (object == null) {
  19393. return [];
  19394. }
  19395. object = Object(object);
  19396. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  19397. return propertyIsEnumerable.call(object, symbol);
  19398. });
  19399. };
  19400. /**
  19401. * Creates an array of the own and inherited enumerable symbols of `object`.
  19402. *
  19403. * @private
  19404. * @param {Object} object The object to query.
  19405. * @returns {Array} Returns the array of symbols.
  19406. */
  19407. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  19408. var result = [];
  19409. while (object) {
  19410. arrayPush(result, getSymbols(object));
  19411. object = getPrototype(object);
  19412. }
  19413. return result;
  19414. };
  19415. /**
  19416. * Gets the `toStringTag` of `value`.
  19417. *
  19418. * @private
  19419. * @param {*} value The value to query.
  19420. * @returns {string} Returns the `toStringTag`.
  19421. */
  19422. var getTag = baseGetTag;
  19423. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  19424. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  19425. (Map && getTag(new Map) != mapTag) ||
  19426. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  19427. (Set && getTag(new Set) != setTag) ||
  19428. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  19429. getTag = function(value) {
  19430. var result = baseGetTag(value),
  19431. Ctor = result == objectTag ? value.constructor : undefined,
  19432. ctorString = Ctor ? toSource(Ctor) : '';
  19433. if (ctorString) {
  19434. switch (ctorString) {
  19435. case dataViewCtorString: return dataViewTag;
  19436. case mapCtorString: return mapTag;
  19437. case promiseCtorString: return promiseTag;
  19438. case setCtorString: return setTag;
  19439. case weakMapCtorString: return weakMapTag;
  19440. }
  19441. }
  19442. return result;
  19443. };
  19444. }
  19445. /**
  19446. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  19447. *
  19448. * @private
  19449. * @param {number} start The start of the view.
  19450. * @param {number} end The end of the view.
  19451. * @param {Array} transforms The transformations to apply to the view.
  19452. * @returns {Object} Returns an object containing the `start` and `end`
  19453. * positions of the view.
  19454. */
  19455. function getView(start, end, transforms) {
  19456. var index = -1,
  19457. length = transforms.length;
  19458. while (++index < length) {
  19459. var data = transforms[index],
  19460. size = data.size;
  19461. switch (data.type) {
  19462. case 'drop': start += size; break;
  19463. case 'dropRight': end -= size; break;
  19464. case 'take': end = nativeMin(end, start + size); break;
  19465. case 'takeRight': start = nativeMax(start, end - size); break;
  19466. }
  19467. }
  19468. return { 'start': start, 'end': end };
  19469. }
  19470. /**
  19471. * Extracts wrapper details from the `source` body comment.
  19472. *
  19473. * @private
  19474. * @param {string} source The source to inspect.
  19475. * @returns {Array} Returns the wrapper details.
  19476. */
  19477. function getWrapDetails(source) {
  19478. var match = source.match(reWrapDetails);
  19479. return match ? match[1].split(reSplitDetails) : [];
  19480. }
  19481. /**
  19482. * Checks if `path` exists on `object`.
  19483. *
  19484. * @private
  19485. * @param {Object} object The object to query.
  19486. * @param {Array|string} path The path to check.
  19487. * @param {Function} hasFunc The function to check properties.
  19488. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  19489. */
  19490. function hasPath(object, path, hasFunc) {
  19491. path = castPath(path, object);
  19492. var index = -1,
  19493. length = path.length,
  19494. result = false;
  19495. while (++index < length) {
  19496. var key = toKey(path[index]);
  19497. if (!(result = object != null && hasFunc(object, key))) {
  19498. break;
  19499. }
  19500. object = object[key];
  19501. }
  19502. if (result || ++index != length) {
  19503. return result;
  19504. }
  19505. length = object == null ? 0 : object.length;
  19506. return !!length && isLength(length) && isIndex(key, length) &&
  19507. (isArray(object) || isArguments(object));
  19508. }
  19509. /**
  19510. * Initializes an array clone.
  19511. *
  19512. * @private
  19513. * @param {Array} array The array to clone.
  19514. * @returns {Array} Returns the initialized clone.
  19515. */
  19516. function initCloneArray(array) {
  19517. var length = array.length,
  19518. result = new array.constructor(length);
  19519. // Add properties assigned by `RegExp#exec`.
  19520. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  19521. result.index = array.index;
  19522. result.input = array.input;
  19523. }
  19524. return result;
  19525. }
  19526. /**
  19527. * Initializes an object clone.
  19528. *
  19529. * @private
  19530. * @param {Object} object The object to clone.
  19531. * @returns {Object} Returns the initialized clone.
  19532. */
  19533. function initCloneObject(object) {
  19534. return (typeof object.constructor == 'function' && !isPrototype(object))
  19535. ? baseCreate(getPrototype(object))
  19536. : {};
  19537. }
  19538. /**
  19539. * Initializes an object clone based on its `toStringTag`.
  19540. *
  19541. * **Note:** This function only supports cloning values with tags of
  19542. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  19543. *
  19544. * @private
  19545. * @param {Object} object The object to clone.
  19546. * @param {string} tag The `toStringTag` of the object to clone.
  19547. * @param {boolean} [isDeep] Specify a deep clone.
  19548. * @returns {Object} Returns the initialized clone.
  19549. */
  19550. function initCloneByTag(object, tag, isDeep) {
  19551. var Ctor = object.constructor;
  19552. switch (tag) {
  19553. case arrayBufferTag:
  19554. return cloneArrayBuffer(object);
  19555. case boolTag:
  19556. case dateTag:
  19557. return new Ctor(+object);
  19558. case dataViewTag:
  19559. return cloneDataView(object, isDeep);
  19560. case float32Tag: case float64Tag:
  19561. case int8Tag: case int16Tag: case int32Tag:
  19562. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  19563. return cloneTypedArray(object, isDeep);
  19564. case mapTag:
  19565. return new Ctor;
  19566. case numberTag:
  19567. case stringTag:
  19568. return new Ctor(object);
  19569. case regexpTag:
  19570. return cloneRegExp(object);
  19571. case setTag:
  19572. return new Ctor;
  19573. case symbolTag:
  19574. return cloneSymbol(object);
  19575. }
  19576. }
  19577. /**
  19578. * Inserts wrapper `details` in a comment at the top of the `source` body.
  19579. *
  19580. * @private
  19581. * @param {string} source The source to modify.
  19582. * @returns {Array} details The details to insert.
  19583. * @returns {string} Returns the modified source.
  19584. */
  19585. function insertWrapDetails(source, details) {
  19586. var length = details.length;
  19587. if (!length) {
  19588. return source;
  19589. }
  19590. var lastIndex = length - 1;
  19591. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  19592. details = details.join(length > 2 ? ', ' : ' ');
  19593. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  19594. }
  19595. /**
  19596. * Checks if `value` is a flattenable `arguments` object or array.
  19597. *
  19598. * @private
  19599. * @param {*} value The value to check.
  19600. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  19601. */
  19602. function isFlattenable(value) {
  19603. return isArray(value) || isArguments(value) ||
  19604. !!(spreadableSymbol && value && value[spreadableSymbol]);
  19605. }
  19606. /**
  19607. * Checks if `value` is a valid array-like index.
  19608. *
  19609. * @private
  19610. * @param {*} value The value to check.
  19611. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  19612. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  19613. */
  19614. function isIndex(value, length) {
  19615. var type = typeof value;
  19616. length = length == null ? MAX_SAFE_INTEGER : length;
  19617. return !!length &&
  19618. (type == 'number' ||
  19619. (type != 'symbol' && reIsUint.test(value))) &&
  19620. (value > -1 && value % 1 == 0 && value < length);
  19621. }
  19622. /**
  19623. * Checks if the given arguments are from an iteratee call.
  19624. *
  19625. * @private
  19626. * @param {*} value The potential iteratee value argument.
  19627. * @param {*} index The potential iteratee index or key argument.
  19628. * @param {*} object The potential iteratee object argument.
  19629. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  19630. * else `false`.
  19631. */
  19632. function isIterateeCall(value, index, object) {
  19633. if (!isObject(object)) {
  19634. return false;
  19635. }
  19636. var type = typeof index;
  19637. if (type == 'number'
  19638. ? (isArrayLike(object) && isIndex(index, object.length))
  19639. : (type == 'string' && index in object)
  19640. ) {
  19641. return eq(object[index], value);
  19642. }
  19643. return false;
  19644. }
  19645. /**
  19646. * Checks if `value` is a property name and not a property path.
  19647. *
  19648. * @private
  19649. * @param {*} value The value to check.
  19650. * @param {Object} [object] The object to query keys on.
  19651. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  19652. */
  19653. function isKey(value, object) {
  19654. if (isArray(value)) {
  19655. return false;
  19656. }
  19657. var type = typeof value;
  19658. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  19659. value == null || isSymbol(value)) {
  19660. return true;
  19661. }
  19662. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  19663. (object != null && value in Object(object));
  19664. }
  19665. /**
  19666. * Checks if `value` is suitable for use as unique object key.
  19667. *
  19668. * @private
  19669. * @param {*} value The value to check.
  19670. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  19671. */
  19672. function isKeyable(value) {
  19673. var type = typeof value;
  19674. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  19675. ? (value !== '__proto__')
  19676. : (value === null);
  19677. }
  19678. /**
  19679. * Checks if `func` has a lazy counterpart.
  19680. *
  19681. * @private
  19682. * @param {Function} func The function to check.
  19683. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  19684. * else `false`.
  19685. */
  19686. function isLaziable(func) {
  19687. var funcName = getFuncName(func),
  19688. other = lodash[funcName];
  19689. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  19690. return false;
  19691. }
  19692. if (func === other) {
  19693. return true;
  19694. }
  19695. var data = getData(other);
  19696. return !!data && func === data[0];
  19697. }
  19698. /**
  19699. * Checks if `func` has its source masked.
  19700. *
  19701. * @private
  19702. * @param {Function} func The function to check.
  19703. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  19704. */
  19705. function isMasked(func) {
  19706. return !!maskSrcKey && (maskSrcKey in func);
  19707. }
  19708. /**
  19709. * Checks if `func` is capable of being masked.
  19710. *
  19711. * @private
  19712. * @param {*} value The value to check.
  19713. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  19714. */
  19715. var isMaskable = coreJsData ? isFunction : stubFalse;
  19716. /**
  19717. * Checks if `value` is likely a prototype object.
  19718. *
  19719. * @private
  19720. * @param {*} value The value to check.
  19721. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  19722. */
  19723. function isPrototype(value) {
  19724. var Ctor = value && value.constructor,
  19725. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  19726. return value === proto;
  19727. }
  19728. /**
  19729. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  19730. *
  19731. * @private
  19732. * @param {*} value The value to check.
  19733. * @returns {boolean} Returns `true` if `value` if suitable for strict
  19734. * equality comparisons, else `false`.
  19735. */
  19736. function isStrictComparable(value) {
  19737. return value === value && !isObject(value);
  19738. }
  19739. /**
  19740. * A specialized version of `matchesProperty` for source values suitable
  19741. * for strict equality comparisons, i.e. `===`.
  19742. *
  19743. * @private
  19744. * @param {string} key The key of the property to get.
  19745. * @param {*} srcValue The value to match.
  19746. * @returns {Function} Returns the new spec function.
  19747. */
  19748. function matchesStrictComparable(key, srcValue) {
  19749. return function(object) {
  19750. if (object == null) {
  19751. return false;
  19752. }
  19753. return object[key] === srcValue &&
  19754. (srcValue !== undefined || (key in Object(object)));
  19755. };
  19756. }
  19757. /**
  19758. * A specialized version of `_.memoize` which clears the memoized function's
  19759. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  19760. *
  19761. * @private
  19762. * @param {Function} func The function to have its output memoized.
  19763. * @returns {Function} Returns the new memoized function.
  19764. */
  19765. function memoizeCapped(func) {
  19766. var result = memoize(func, function(key) {
  19767. if (cache.size === MAX_MEMOIZE_SIZE) {
  19768. cache.clear();
  19769. }
  19770. return key;
  19771. });
  19772. var cache = result.cache;
  19773. return result;
  19774. }
  19775. /**
  19776. * Merges the function metadata of `source` into `data`.
  19777. *
  19778. * Merging metadata reduces the number of wrappers used to invoke a function.
  19779. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  19780. * may be applied regardless of execution order. Methods like `_.ary` and
  19781. * `_.rearg` modify function arguments, making the order in which they are
  19782. * executed important, preventing the merging of metadata. However, we make
  19783. * an exception for a safe combined case where curried functions have `_.ary`
  19784. * and or `_.rearg` applied.
  19785. *
  19786. * @private
  19787. * @param {Array} data The destination metadata.
  19788. * @param {Array} source The source metadata.
  19789. * @returns {Array} Returns `data`.
  19790. */
  19791. function mergeData(data, source) {
  19792. var bitmask = data[1],
  19793. srcBitmask = source[1],
  19794. newBitmask = bitmask | srcBitmask,
  19795. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  19796. var isCombo =
  19797. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  19798. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  19799. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  19800. // Exit early if metadata can't be merged.
  19801. if (!(isCommon || isCombo)) {
  19802. return data;
  19803. }
  19804. // Use source `thisArg` if available.
  19805. if (srcBitmask & WRAP_BIND_FLAG) {
  19806. data[2] = source[2];
  19807. // Set when currying a bound function.
  19808. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  19809. }
  19810. // Compose partial arguments.
  19811. var value = source[3];
  19812. if (value) {
  19813. var partials = data[3];
  19814. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  19815. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  19816. }
  19817. // Compose partial right arguments.
  19818. value = source[5];
  19819. if (value) {
  19820. partials = data[5];
  19821. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  19822. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  19823. }
  19824. // Use source `argPos` if available.
  19825. value = source[7];
  19826. if (value) {
  19827. data[7] = value;
  19828. }
  19829. // Use source `ary` if it's smaller.
  19830. if (srcBitmask & WRAP_ARY_FLAG) {
  19831. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  19832. }
  19833. // Use source `arity` if one is not provided.
  19834. if (data[9] == null) {
  19835. data[9] = source[9];
  19836. }
  19837. // Use source `func` and merge bitmasks.
  19838. data[0] = source[0];
  19839. data[1] = newBitmask;
  19840. return data;
  19841. }
  19842. /**
  19843. * This function is like
  19844. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  19845. * except that it includes inherited enumerable properties.
  19846. *
  19847. * @private
  19848. * @param {Object} object The object to query.
  19849. * @returns {Array} Returns the array of property names.
  19850. */
  19851. function nativeKeysIn(object) {
  19852. var result = [];
  19853. if (object != null) {
  19854. for (var key in Object(object)) {
  19855. result.push(key);
  19856. }
  19857. }
  19858. return result;
  19859. }
  19860. /**
  19861. * Converts `value` to a string using `Object.prototype.toString`.
  19862. *
  19863. * @private
  19864. * @param {*} value The value to convert.
  19865. * @returns {string} Returns the converted string.
  19866. */
  19867. function objectToString(value) {
  19868. return nativeObjectToString.call(value);
  19869. }
  19870. /**
  19871. * A specialized version of `baseRest` which transforms the rest array.
  19872. *
  19873. * @private
  19874. * @param {Function} func The function to apply a rest parameter to.
  19875. * @param {number} [start=func.length-1] The start position of the rest parameter.
  19876. * @param {Function} transform The rest array transform.
  19877. * @returns {Function} Returns the new function.
  19878. */
  19879. function overRest(func, start, transform) {
  19880. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  19881. return function() {
  19882. var args = arguments,
  19883. index = -1,
  19884. length = nativeMax(args.length - start, 0),
  19885. array = Array(length);
  19886. while (++index < length) {
  19887. array[index] = args[start + index];
  19888. }
  19889. index = -1;
  19890. var otherArgs = Array(start + 1);
  19891. while (++index < start) {
  19892. otherArgs[index] = args[index];
  19893. }
  19894. otherArgs[start] = transform(array);
  19895. return apply(func, this, otherArgs);
  19896. };
  19897. }
  19898. /**
  19899. * Gets the parent value at `path` of `object`.
  19900. *
  19901. * @private
  19902. * @param {Object} object The object to query.
  19903. * @param {Array} path The path to get the parent value of.
  19904. * @returns {*} Returns the parent value.
  19905. */
  19906. function parent(object, path) {
  19907. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  19908. }
  19909. /**
  19910. * Reorder `array` according to the specified indexes where the element at
  19911. * the first index is assigned as the first element, the element at
  19912. * the second index is assigned as the second element, and so on.
  19913. *
  19914. * @private
  19915. * @param {Array} array The array to reorder.
  19916. * @param {Array} indexes The arranged array indexes.
  19917. * @returns {Array} Returns `array`.
  19918. */
  19919. function reorder(array, indexes) {
  19920. var arrLength = array.length,
  19921. length = nativeMin(indexes.length, arrLength),
  19922. oldArray = copyArray(array);
  19923. while (length--) {
  19924. var index = indexes[length];
  19925. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  19926. }
  19927. return array;
  19928. }
  19929. /**
  19930. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  19931. *
  19932. * @private
  19933. * @param {Object} object The object to query.
  19934. * @param {string} key The key of the property to get.
  19935. * @returns {*} Returns the property value.
  19936. */
  19937. function safeGet(object, key) {
  19938. if (key === 'constructor' && typeof object[key] === 'function') {
  19939. return;
  19940. }
  19941. if (key == '__proto__') {
  19942. return;
  19943. }
  19944. return object[key];
  19945. }
  19946. /**
  19947. * Sets metadata for `func`.
  19948. *
  19949. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  19950. * period of time, it will trip its breaker and transition to an identity
  19951. * function to avoid garbage collection pauses in V8. See
  19952. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  19953. * for more details.
  19954. *
  19955. * @private
  19956. * @param {Function} func The function to associate metadata with.
  19957. * @param {*} data The metadata.
  19958. * @returns {Function} Returns `func`.
  19959. */
  19960. var setData = shortOut(baseSetData);
  19961. /**
  19962. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  19963. *
  19964. * @private
  19965. * @param {Function} func The function to delay.
  19966. * @param {number} wait The number of milliseconds to delay invocation.
  19967. * @returns {number|Object} Returns the timer id or timeout object.
  19968. */
  19969. var setTimeout = ctxSetTimeout || function(func, wait) {
  19970. return root.setTimeout(func, wait);
  19971. };
  19972. /**
  19973. * Sets the `toString` method of `func` to return `string`.
  19974. *
  19975. * @private
  19976. * @param {Function} func The function to modify.
  19977. * @param {Function} string The `toString` result.
  19978. * @returns {Function} Returns `func`.
  19979. */
  19980. var setToString = shortOut(baseSetToString);
  19981. /**
  19982. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  19983. * with wrapper details in a comment at the top of the source body.
  19984. *
  19985. * @private
  19986. * @param {Function} wrapper The function to modify.
  19987. * @param {Function} reference The reference function.
  19988. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  19989. * @returns {Function} Returns `wrapper`.
  19990. */
  19991. function setWrapToString(wrapper, reference, bitmask) {
  19992. var source = (reference + '');
  19993. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  19994. }
  19995. /**
  19996. * Creates a function that'll short out and invoke `identity` instead
  19997. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  19998. * milliseconds.
  19999. *
  20000. * @private
  20001. * @param {Function} func The function to restrict.
  20002. * @returns {Function} Returns the new shortable function.
  20003. */
  20004. function shortOut(func) {
  20005. var count = 0,
  20006. lastCalled = 0;
  20007. return function() {
  20008. var stamp = nativeNow(),
  20009. remaining = HOT_SPAN - (stamp - lastCalled);
  20010. lastCalled = stamp;
  20011. if (remaining > 0) {
  20012. if (++count >= HOT_COUNT) {
  20013. return arguments[0];
  20014. }
  20015. } else {
  20016. count = 0;
  20017. }
  20018. return func.apply(undefined, arguments);
  20019. };
  20020. }
  20021. /**
  20022. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  20023. *
  20024. * @private
  20025. * @param {Array} array The array to shuffle.
  20026. * @param {number} [size=array.length] The size of `array`.
  20027. * @returns {Array} Returns `array`.
  20028. */
  20029. function shuffleSelf(array, size) {
  20030. var index = -1,
  20031. length = array.length,
  20032. lastIndex = length - 1;
  20033. size = size === undefined ? length : size;
  20034. while (++index < size) {
  20035. var rand = baseRandom(index, lastIndex),
  20036. value = array[rand];
  20037. array[rand] = array[index];
  20038. array[index] = value;
  20039. }
  20040. array.length = size;
  20041. return array;
  20042. }
  20043. /**
  20044. * Converts `string` to a property path array.
  20045. *
  20046. * @private
  20047. * @param {string} string The string to convert.
  20048. * @returns {Array} Returns the property path array.
  20049. */
  20050. var stringToPath = memoizeCapped(function(string) {
  20051. var result = [];
  20052. if (string.charCodeAt(0) === 46 /* . */) {
  20053. result.push('');
  20054. }
  20055. string.replace(rePropName, function(match, number, quote, subString) {
  20056. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  20057. });
  20058. return result;
  20059. });
  20060. /**
  20061. * Converts `value` to a string key if it's not a string or symbol.
  20062. *
  20063. * @private
  20064. * @param {*} value The value to inspect.
  20065. * @returns {string|symbol} Returns the key.
  20066. */
  20067. function toKey(value) {
  20068. if (typeof value == 'string' || isSymbol(value)) {
  20069. return value;
  20070. }
  20071. var result = (value + '');
  20072. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  20073. }
  20074. /**
  20075. * Converts `func` to its source code.
  20076. *
  20077. * @private
  20078. * @param {Function} func The function to convert.
  20079. * @returns {string} Returns the source code.
  20080. */
  20081. function toSource(func) {
  20082. if (func != null) {
  20083. try {
  20084. return funcToString.call(func);
  20085. } catch (e) {}
  20086. try {
  20087. return (func + '');
  20088. } catch (e) {}
  20089. }
  20090. return '';
  20091. }
  20092. /**
  20093. * Updates wrapper `details` based on `bitmask` flags.
  20094. *
  20095. * @private
  20096. * @returns {Array} details The details to modify.
  20097. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  20098. * @returns {Array} Returns `details`.
  20099. */
  20100. function updateWrapDetails(details, bitmask) {
  20101. arrayEach(wrapFlags, function(pair) {
  20102. var value = '_.' + pair[0];
  20103. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  20104. details.push(value);
  20105. }
  20106. });
  20107. return details.sort();
  20108. }
  20109. /**
  20110. * Creates a clone of `wrapper`.
  20111. *
  20112. * @private
  20113. * @param {Object} wrapper The wrapper to clone.
  20114. * @returns {Object} Returns the cloned wrapper.
  20115. */
  20116. function wrapperClone(wrapper) {
  20117. if (wrapper instanceof LazyWrapper) {
  20118. return wrapper.clone();
  20119. }
  20120. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  20121. result.__actions__ = copyArray(wrapper.__actions__);
  20122. result.__index__ = wrapper.__index__;
  20123. result.__values__ = wrapper.__values__;
  20124. return result;
  20125. }
  20126. /*------------------------------------------------------------------------*/
  20127. /**
  20128. * Creates an array of elements split into groups the length of `size`.
  20129. * If `array` can't be split evenly, the final chunk will be the remaining
  20130. * elements.
  20131. *
  20132. * @static
  20133. * @memberOf _
  20134. * @since 3.0.0
  20135. * @category Array
  20136. * @param {Array} array The array to process.
  20137. * @param {number} [size=1] The length of each chunk
  20138. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20139. * @returns {Array} Returns the new array of chunks.
  20140. * @example
  20141. *
  20142. * _.chunk(['a', 'b', 'c', 'd'], 2);
  20143. * // => [['a', 'b'], ['c', 'd']]
  20144. *
  20145. * _.chunk(['a', 'b', 'c', 'd'], 3);
  20146. * // => [['a', 'b', 'c'], ['d']]
  20147. */
  20148. function chunk(array, size, guard) {
  20149. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  20150. size = 1;
  20151. } else {
  20152. size = nativeMax(toInteger(size), 0);
  20153. }
  20154. var length = array == null ? 0 : array.length;
  20155. if (!length || size < 1) {
  20156. return [];
  20157. }
  20158. var index = 0,
  20159. resIndex = 0,
  20160. result = Array(nativeCeil(length / size));
  20161. while (index < length) {
  20162. result[resIndex++] = baseSlice(array, index, (index += size));
  20163. }
  20164. return result;
  20165. }
  20166. /**
  20167. * Creates an array with all falsey values removed. The values `false`, `null`,
  20168. * `0`, `""`, `undefined`, and `NaN` are falsey.
  20169. *
  20170. * @static
  20171. * @memberOf _
  20172. * @since 0.1.0
  20173. * @category Array
  20174. * @param {Array} array The array to compact.
  20175. * @returns {Array} Returns the new array of filtered values.
  20176. * @example
  20177. *
  20178. * _.compact([0, 1, false, 2, '', 3]);
  20179. * // => [1, 2, 3]
  20180. */
  20181. function compact(array) {
  20182. var index = -1,
  20183. length = array == null ? 0 : array.length,
  20184. resIndex = 0,
  20185. result = [];
  20186. while (++index < length) {
  20187. var value = array[index];
  20188. if (value) {
  20189. result[resIndex++] = value;
  20190. }
  20191. }
  20192. return result;
  20193. }
  20194. /**
  20195. * Creates a new array concatenating `array` with any additional arrays
  20196. * and/or values.
  20197. *
  20198. * @static
  20199. * @memberOf _
  20200. * @since 4.0.0
  20201. * @category Array
  20202. * @param {Array} array The array to concatenate.
  20203. * @param {...*} [values] The values to concatenate.
  20204. * @returns {Array} Returns the new concatenated array.
  20205. * @example
  20206. *
  20207. * var array = [1];
  20208. * var other = _.concat(array, 2, [3], [[4]]);
  20209. *
  20210. * console.log(other);
  20211. * // => [1, 2, 3, [4]]
  20212. *
  20213. * console.log(array);
  20214. * // => [1]
  20215. */
  20216. function concat() {
  20217. var length = arguments.length;
  20218. if (!length) {
  20219. return [];
  20220. }
  20221. var args = Array(length - 1),
  20222. array = arguments[0],
  20223. index = length;
  20224. while (index--) {
  20225. args[index - 1] = arguments[index];
  20226. }
  20227. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  20228. }
  20229. /**
  20230. * Creates an array of `array` values not included in the other given arrays
  20231. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20232. * for equality comparisons. The order and references of result values are
  20233. * determined by the first array.
  20234. *
  20235. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  20236. *
  20237. * @static
  20238. * @memberOf _
  20239. * @since 0.1.0
  20240. * @category Array
  20241. * @param {Array} array The array to inspect.
  20242. * @param {...Array} [values] The values to exclude.
  20243. * @returns {Array} Returns the new array of filtered values.
  20244. * @see _.without, _.xor
  20245. * @example
  20246. *
  20247. * _.difference([2, 1], [2, 3]);
  20248. * // => [1]
  20249. */
  20250. var difference = baseRest(function(array, values) {
  20251. return isArrayLikeObject(array)
  20252. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  20253. : [];
  20254. });
  20255. /**
  20256. * This method is like `_.difference` except that it accepts `iteratee` which
  20257. * is invoked for each element of `array` and `values` to generate the criterion
  20258. * by which they're compared. The order and references of result values are
  20259. * determined by the first array. The iteratee is invoked with one argument:
  20260. * (value).
  20261. *
  20262. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  20263. *
  20264. * @static
  20265. * @memberOf _
  20266. * @since 4.0.0
  20267. * @category Array
  20268. * @param {Array} array The array to inspect.
  20269. * @param {...Array} [values] The values to exclude.
  20270. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  20271. * @returns {Array} Returns the new array of filtered values.
  20272. * @example
  20273. *
  20274. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  20275. * // => [1.2]
  20276. *
  20277. * // The `_.property` iteratee shorthand.
  20278. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  20279. * // => [{ 'x': 2 }]
  20280. */
  20281. var differenceBy = baseRest(function(array, values) {
  20282. var iteratee = last(values);
  20283. if (isArrayLikeObject(iteratee)) {
  20284. iteratee = undefined;
  20285. }
  20286. return isArrayLikeObject(array)
  20287. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  20288. : [];
  20289. });
  20290. /**
  20291. * This method is like `_.difference` except that it accepts `comparator`
  20292. * which is invoked to compare elements of `array` to `values`. The order and
  20293. * references of result values are determined by the first array. The comparator
  20294. * is invoked with two arguments: (arrVal, othVal).
  20295. *
  20296. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  20297. *
  20298. * @static
  20299. * @memberOf _
  20300. * @since 4.0.0
  20301. * @category Array
  20302. * @param {Array} array The array to inspect.
  20303. * @param {...Array} [values] The values to exclude.
  20304. * @param {Function} [comparator] The comparator invoked per element.
  20305. * @returns {Array} Returns the new array of filtered values.
  20306. * @example
  20307. *
  20308. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  20309. *
  20310. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  20311. * // => [{ 'x': 2, 'y': 1 }]
  20312. */
  20313. var differenceWith = baseRest(function(array, values) {
  20314. var comparator = last(values);
  20315. if (isArrayLikeObject(comparator)) {
  20316. comparator = undefined;
  20317. }
  20318. return isArrayLikeObject(array)
  20319. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  20320. : [];
  20321. });
  20322. /**
  20323. * Creates a slice of `array` with `n` elements dropped from the beginning.
  20324. *
  20325. * @static
  20326. * @memberOf _
  20327. * @since 0.5.0
  20328. * @category Array
  20329. * @param {Array} array The array to query.
  20330. * @param {number} [n=1] The number of elements to drop.
  20331. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20332. * @returns {Array} Returns the slice of `array`.
  20333. * @example
  20334. *
  20335. * _.drop([1, 2, 3]);
  20336. * // => [2, 3]
  20337. *
  20338. * _.drop([1, 2, 3], 2);
  20339. * // => [3]
  20340. *
  20341. * _.drop([1, 2, 3], 5);
  20342. * // => []
  20343. *
  20344. * _.drop([1, 2, 3], 0);
  20345. * // => [1, 2, 3]
  20346. */
  20347. function drop(array, n, guard) {
  20348. var length = array == null ? 0 : array.length;
  20349. if (!length) {
  20350. return [];
  20351. }
  20352. n = (guard || n === undefined) ? 1 : toInteger(n);
  20353. return baseSlice(array, n < 0 ? 0 : n, length);
  20354. }
  20355. /**
  20356. * Creates a slice of `array` with `n` elements dropped from the end.
  20357. *
  20358. * @static
  20359. * @memberOf _
  20360. * @since 3.0.0
  20361. * @category Array
  20362. * @param {Array} array The array to query.
  20363. * @param {number} [n=1] The number of elements to drop.
  20364. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20365. * @returns {Array} Returns the slice of `array`.
  20366. * @example
  20367. *
  20368. * _.dropRight([1, 2, 3]);
  20369. * // => [1, 2]
  20370. *
  20371. * _.dropRight([1, 2, 3], 2);
  20372. * // => [1]
  20373. *
  20374. * _.dropRight([1, 2, 3], 5);
  20375. * // => []
  20376. *
  20377. * _.dropRight([1, 2, 3], 0);
  20378. * // => [1, 2, 3]
  20379. */
  20380. function dropRight(array, n, guard) {
  20381. var length = array == null ? 0 : array.length;
  20382. if (!length) {
  20383. return [];
  20384. }
  20385. n = (guard || n === undefined) ? 1 : toInteger(n);
  20386. n = length - n;
  20387. return baseSlice(array, 0, n < 0 ? 0 : n);
  20388. }
  20389. /**
  20390. * Creates a slice of `array` excluding elements dropped from the end.
  20391. * Elements are dropped until `predicate` returns falsey. The predicate is
  20392. * invoked with three arguments: (value, index, array).
  20393. *
  20394. * @static
  20395. * @memberOf _
  20396. * @since 3.0.0
  20397. * @category Array
  20398. * @param {Array} array The array to query.
  20399. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20400. * @returns {Array} Returns the slice of `array`.
  20401. * @example
  20402. *
  20403. * var users = [
  20404. * { 'user': 'barney', 'active': true },
  20405. * { 'user': 'fred', 'active': false },
  20406. * { 'user': 'pebbles', 'active': false }
  20407. * ];
  20408. *
  20409. * _.dropRightWhile(users, function(o) { return !o.active; });
  20410. * // => objects for ['barney']
  20411. *
  20412. * // The `_.matches` iteratee shorthand.
  20413. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  20414. * // => objects for ['barney', 'fred']
  20415. *
  20416. * // The `_.matchesProperty` iteratee shorthand.
  20417. * _.dropRightWhile(users, ['active', false]);
  20418. * // => objects for ['barney']
  20419. *
  20420. * // The `_.property` iteratee shorthand.
  20421. * _.dropRightWhile(users, 'active');
  20422. * // => objects for ['barney', 'fred', 'pebbles']
  20423. */
  20424. function dropRightWhile(array, predicate) {
  20425. return (array && array.length)
  20426. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  20427. : [];
  20428. }
  20429. /**
  20430. * Creates a slice of `array` excluding elements dropped from the beginning.
  20431. * Elements are dropped until `predicate` returns falsey. The predicate is
  20432. * invoked with three arguments: (value, index, array).
  20433. *
  20434. * @static
  20435. * @memberOf _
  20436. * @since 3.0.0
  20437. * @category Array
  20438. * @param {Array} array The array to query.
  20439. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20440. * @returns {Array} Returns the slice of `array`.
  20441. * @example
  20442. *
  20443. * var users = [
  20444. * { 'user': 'barney', 'active': false },
  20445. * { 'user': 'fred', 'active': false },
  20446. * { 'user': 'pebbles', 'active': true }
  20447. * ];
  20448. *
  20449. * _.dropWhile(users, function(o) { return !o.active; });
  20450. * // => objects for ['pebbles']
  20451. *
  20452. * // The `_.matches` iteratee shorthand.
  20453. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  20454. * // => objects for ['fred', 'pebbles']
  20455. *
  20456. * // The `_.matchesProperty` iteratee shorthand.
  20457. * _.dropWhile(users, ['active', false]);
  20458. * // => objects for ['pebbles']
  20459. *
  20460. * // The `_.property` iteratee shorthand.
  20461. * _.dropWhile(users, 'active');
  20462. * // => objects for ['barney', 'fred', 'pebbles']
  20463. */
  20464. function dropWhile(array, predicate) {
  20465. return (array && array.length)
  20466. ? baseWhile(array, getIteratee(predicate, 3), true)
  20467. : [];
  20468. }
  20469. /**
  20470. * Fills elements of `array` with `value` from `start` up to, but not
  20471. * including, `end`.
  20472. *
  20473. * **Note:** This method mutates `array`.
  20474. *
  20475. * @static
  20476. * @memberOf _
  20477. * @since 3.2.0
  20478. * @category Array
  20479. * @param {Array} array The array to fill.
  20480. * @param {*} value The value to fill `array` with.
  20481. * @param {number} [start=0] The start position.
  20482. * @param {number} [end=array.length] The end position.
  20483. * @returns {Array} Returns `array`.
  20484. * @example
  20485. *
  20486. * var array = [1, 2, 3];
  20487. *
  20488. * _.fill(array, 'a');
  20489. * console.log(array);
  20490. * // => ['a', 'a', 'a']
  20491. *
  20492. * _.fill(Array(3), 2);
  20493. * // => [2, 2, 2]
  20494. *
  20495. * _.fill([4, 6, 8, 10], '*', 1, 3);
  20496. * // => [4, '*', '*', 10]
  20497. */
  20498. function fill(array, value, start, end) {
  20499. var length = array == null ? 0 : array.length;
  20500. if (!length) {
  20501. return [];
  20502. }
  20503. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  20504. start = 0;
  20505. end = length;
  20506. }
  20507. return baseFill(array, value, start, end);
  20508. }
  20509. /**
  20510. * This method is like `_.find` except that it returns the index of the first
  20511. * element `predicate` returns truthy for instead of the element itself.
  20512. *
  20513. * @static
  20514. * @memberOf _
  20515. * @since 1.1.0
  20516. * @category Array
  20517. * @param {Array} array The array to inspect.
  20518. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20519. * @param {number} [fromIndex=0] The index to search from.
  20520. * @returns {number} Returns the index of the found element, else `-1`.
  20521. * @example
  20522. *
  20523. * var users = [
  20524. * { 'user': 'barney', 'active': false },
  20525. * { 'user': 'fred', 'active': false },
  20526. * { 'user': 'pebbles', 'active': true }
  20527. * ];
  20528. *
  20529. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  20530. * // => 0
  20531. *
  20532. * // The `_.matches` iteratee shorthand.
  20533. * _.findIndex(users, { 'user': 'fred', 'active': false });
  20534. * // => 1
  20535. *
  20536. * // The `_.matchesProperty` iteratee shorthand.
  20537. * _.findIndex(users, ['active', false]);
  20538. * // => 0
  20539. *
  20540. * // The `_.property` iteratee shorthand.
  20541. * _.findIndex(users, 'active');
  20542. * // => 2
  20543. */
  20544. function findIndex(array, predicate, fromIndex) {
  20545. var length = array == null ? 0 : array.length;
  20546. if (!length) {
  20547. return -1;
  20548. }
  20549. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  20550. if (index < 0) {
  20551. index = nativeMax(length + index, 0);
  20552. }
  20553. return baseFindIndex(array, getIteratee(predicate, 3), index);
  20554. }
  20555. /**
  20556. * This method is like `_.findIndex` except that it iterates over elements
  20557. * of `collection` from right to left.
  20558. *
  20559. * @static
  20560. * @memberOf _
  20561. * @since 2.0.0
  20562. * @category Array
  20563. * @param {Array} array The array to inspect.
  20564. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20565. * @param {number} [fromIndex=array.length-1] The index to search from.
  20566. * @returns {number} Returns the index of the found element, else `-1`.
  20567. * @example
  20568. *
  20569. * var users = [
  20570. * { 'user': 'barney', 'active': true },
  20571. * { 'user': 'fred', 'active': false },
  20572. * { 'user': 'pebbles', 'active': false }
  20573. * ];
  20574. *
  20575. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  20576. * // => 2
  20577. *
  20578. * // The `_.matches` iteratee shorthand.
  20579. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  20580. * // => 0
  20581. *
  20582. * // The `_.matchesProperty` iteratee shorthand.
  20583. * _.findLastIndex(users, ['active', false]);
  20584. * // => 2
  20585. *
  20586. * // The `_.property` iteratee shorthand.
  20587. * _.findLastIndex(users, 'active');
  20588. * // => 0
  20589. */
  20590. function findLastIndex(array, predicate, fromIndex) {
  20591. var length = array == null ? 0 : array.length;
  20592. if (!length) {
  20593. return -1;
  20594. }
  20595. var index = length - 1;
  20596. if (fromIndex !== undefined) {
  20597. index = toInteger(fromIndex);
  20598. index = fromIndex < 0
  20599. ? nativeMax(length + index, 0)
  20600. : nativeMin(index, length - 1);
  20601. }
  20602. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  20603. }
  20604. /**
  20605. * Flattens `array` a single level deep.
  20606. *
  20607. * @static
  20608. * @memberOf _
  20609. * @since 0.1.0
  20610. * @category Array
  20611. * @param {Array} array The array to flatten.
  20612. * @returns {Array} Returns the new flattened array.
  20613. * @example
  20614. *
  20615. * _.flatten([1, [2, [3, [4]], 5]]);
  20616. * // => [1, 2, [3, [4]], 5]
  20617. */
  20618. function flatten(array) {
  20619. var length = array == null ? 0 : array.length;
  20620. return length ? baseFlatten(array, 1) : [];
  20621. }
  20622. /**
  20623. * Recursively flattens `array`.
  20624. *
  20625. * @static
  20626. * @memberOf _
  20627. * @since 3.0.0
  20628. * @category Array
  20629. * @param {Array} array The array to flatten.
  20630. * @returns {Array} Returns the new flattened array.
  20631. * @example
  20632. *
  20633. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  20634. * // => [1, 2, 3, 4, 5]
  20635. */
  20636. function flattenDeep(array) {
  20637. var length = array == null ? 0 : array.length;
  20638. return length ? baseFlatten(array, INFINITY) : [];
  20639. }
  20640. /**
  20641. * Recursively flatten `array` up to `depth` times.
  20642. *
  20643. * @static
  20644. * @memberOf _
  20645. * @since 4.4.0
  20646. * @category Array
  20647. * @param {Array} array The array to flatten.
  20648. * @param {number} [depth=1] The maximum recursion depth.
  20649. * @returns {Array} Returns the new flattened array.
  20650. * @example
  20651. *
  20652. * var array = [1, [2, [3, [4]], 5]];
  20653. *
  20654. * _.flattenDepth(array, 1);
  20655. * // => [1, 2, [3, [4]], 5]
  20656. *
  20657. * _.flattenDepth(array, 2);
  20658. * // => [1, 2, 3, [4], 5]
  20659. */
  20660. function flattenDepth(array, depth) {
  20661. var length = array == null ? 0 : array.length;
  20662. if (!length) {
  20663. return [];
  20664. }
  20665. depth = depth === undefined ? 1 : toInteger(depth);
  20666. return baseFlatten(array, depth);
  20667. }
  20668. /**
  20669. * The inverse of `_.toPairs`; this method returns an object composed
  20670. * from key-value `pairs`.
  20671. *
  20672. * @static
  20673. * @memberOf _
  20674. * @since 4.0.0
  20675. * @category Array
  20676. * @param {Array} pairs The key-value pairs.
  20677. * @returns {Object} Returns the new object.
  20678. * @example
  20679. *
  20680. * _.fromPairs([['a', 1], ['b', 2]]);
  20681. * // => { 'a': 1, 'b': 2 }
  20682. */
  20683. function fromPairs(pairs) {
  20684. var index = -1,
  20685. length = pairs == null ? 0 : pairs.length,
  20686. result = {};
  20687. while (++index < length) {
  20688. var pair = pairs[index];
  20689. result[pair[0]] = pair[1];
  20690. }
  20691. return result;
  20692. }
  20693. /**
  20694. * Gets the first element of `array`.
  20695. *
  20696. * @static
  20697. * @memberOf _
  20698. * @since 0.1.0
  20699. * @alias first
  20700. * @category Array
  20701. * @param {Array} array The array to query.
  20702. * @returns {*} Returns the first element of `array`.
  20703. * @example
  20704. *
  20705. * _.head([1, 2, 3]);
  20706. * // => 1
  20707. *
  20708. * _.head([]);
  20709. * // => undefined
  20710. */
  20711. function head(array) {
  20712. return (array && array.length) ? array[0] : undefined;
  20713. }
  20714. /**
  20715. * Gets the index at which the first occurrence of `value` is found in `array`
  20716. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20717. * for equality comparisons. If `fromIndex` is negative, it's used as the
  20718. * offset from the end of `array`.
  20719. *
  20720. * @static
  20721. * @memberOf _
  20722. * @since 0.1.0
  20723. * @category Array
  20724. * @param {Array} array The array to inspect.
  20725. * @param {*} value The value to search for.
  20726. * @param {number} [fromIndex=0] The index to search from.
  20727. * @returns {number} Returns the index of the matched value, else `-1`.
  20728. * @example
  20729. *
  20730. * _.indexOf([1, 2, 1, 2], 2);
  20731. * // => 1
  20732. *
  20733. * // Search from the `fromIndex`.
  20734. * _.indexOf([1, 2, 1, 2], 2, 2);
  20735. * // => 3
  20736. */
  20737. function indexOf(array, value, fromIndex) {
  20738. var length = array == null ? 0 : array.length;
  20739. if (!length) {
  20740. return -1;
  20741. }
  20742. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  20743. if (index < 0) {
  20744. index = nativeMax(length + index, 0);
  20745. }
  20746. return baseIndexOf(array, value, index);
  20747. }
  20748. /**
  20749. * Gets all but the last element of `array`.
  20750. *
  20751. * @static
  20752. * @memberOf _
  20753. * @since 0.1.0
  20754. * @category Array
  20755. * @param {Array} array The array to query.
  20756. * @returns {Array} Returns the slice of `array`.
  20757. * @example
  20758. *
  20759. * _.initial([1, 2, 3]);
  20760. * // => [1, 2]
  20761. */
  20762. function initial(array) {
  20763. var length = array == null ? 0 : array.length;
  20764. return length ? baseSlice(array, 0, -1) : [];
  20765. }
  20766. /**
  20767. * Creates an array of unique values that are included in all given arrays
  20768. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20769. * for equality comparisons. The order and references of result values are
  20770. * determined by the first array.
  20771. *
  20772. * @static
  20773. * @memberOf _
  20774. * @since 0.1.0
  20775. * @category Array
  20776. * @param {...Array} [arrays] The arrays to inspect.
  20777. * @returns {Array} Returns the new array of intersecting values.
  20778. * @example
  20779. *
  20780. * _.intersection([2, 1], [2, 3]);
  20781. * // => [2]
  20782. */
  20783. var intersection = baseRest(function(arrays) {
  20784. var mapped = arrayMap(arrays, castArrayLikeObject);
  20785. return (mapped.length && mapped[0] === arrays[0])
  20786. ? baseIntersection(mapped)
  20787. : [];
  20788. });
  20789. /**
  20790. * This method is like `_.intersection` except that it accepts `iteratee`
  20791. * which is invoked for each element of each `arrays` to generate the criterion
  20792. * by which they're compared. The order and references of result values are
  20793. * determined by the first array. The iteratee is invoked with one argument:
  20794. * (value).
  20795. *
  20796. * @static
  20797. * @memberOf _
  20798. * @since 4.0.0
  20799. * @category Array
  20800. * @param {...Array} [arrays] The arrays to inspect.
  20801. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  20802. * @returns {Array} Returns the new array of intersecting values.
  20803. * @example
  20804. *
  20805. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  20806. * // => [2.1]
  20807. *
  20808. * // The `_.property` iteratee shorthand.
  20809. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  20810. * // => [{ 'x': 1 }]
  20811. */
  20812. var intersectionBy = baseRest(function(arrays) {
  20813. var iteratee = last(arrays),
  20814. mapped = arrayMap(arrays, castArrayLikeObject);
  20815. if (iteratee === last(mapped)) {
  20816. iteratee = undefined;
  20817. } else {
  20818. mapped.pop();
  20819. }
  20820. return (mapped.length && mapped[0] === arrays[0])
  20821. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  20822. : [];
  20823. });
  20824. /**
  20825. * This method is like `_.intersection` except that it accepts `comparator`
  20826. * which is invoked to compare elements of `arrays`. The order and references
  20827. * of result values are determined by the first array. The comparator is
  20828. * invoked with two arguments: (arrVal, othVal).
  20829. *
  20830. * @static
  20831. * @memberOf _
  20832. * @since 4.0.0
  20833. * @category Array
  20834. * @param {...Array} [arrays] The arrays to inspect.
  20835. * @param {Function} [comparator] The comparator invoked per element.
  20836. * @returns {Array} Returns the new array of intersecting values.
  20837. * @example
  20838. *
  20839. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  20840. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  20841. *
  20842. * _.intersectionWith(objects, others, _.isEqual);
  20843. * // => [{ 'x': 1, 'y': 2 }]
  20844. */
  20845. var intersectionWith = baseRest(function(arrays) {
  20846. var comparator = last(arrays),
  20847. mapped = arrayMap(arrays, castArrayLikeObject);
  20848. comparator = typeof comparator == 'function' ? comparator : undefined;
  20849. if (comparator) {
  20850. mapped.pop();
  20851. }
  20852. return (mapped.length && mapped[0] === arrays[0])
  20853. ? baseIntersection(mapped, undefined, comparator)
  20854. : [];
  20855. });
  20856. /**
  20857. * Converts all elements in `array` into a string separated by `separator`.
  20858. *
  20859. * @static
  20860. * @memberOf _
  20861. * @since 4.0.0
  20862. * @category Array
  20863. * @param {Array} array The array to convert.
  20864. * @param {string} [separator=','] The element separator.
  20865. * @returns {string} Returns the joined string.
  20866. * @example
  20867. *
  20868. * _.join(['a', 'b', 'c'], '~');
  20869. * // => 'a~b~c'
  20870. */
  20871. function join(array, separator) {
  20872. return array == null ? '' : nativeJoin.call(array, separator);
  20873. }
  20874. /**
  20875. * Gets the last element of `array`.
  20876. *
  20877. * @static
  20878. * @memberOf _
  20879. * @since 0.1.0
  20880. * @category Array
  20881. * @param {Array} array The array to query.
  20882. * @returns {*} Returns the last element of `array`.
  20883. * @example
  20884. *
  20885. * _.last([1, 2, 3]);
  20886. * // => 3
  20887. */
  20888. function last(array) {
  20889. var length = array == null ? 0 : array.length;
  20890. return length ? array[length - 1] : undefined;
  20891. }
  20892. /**
  20893. * This method is like `_.indexOf` except that it iterates over elements of
  20894. * `array` from right to left.
  20895. *
  20896. * @static
  20897. * @memberOf _
  20898. * @since 0.1.0
  20899. * @category Array
  20900. * @param {Array} array The array to inspect.
  20901. * @param {*} value The value to search for.
  20902. * @param {number} [fromIndex=array.length-1] The index to search from.
  20903. * @returns {number} Returns the index of the matched value, else `-1`.
  20904. * @example
  20905. *
  20906. * _.lastIndexOf([1, 2, 1, 2], 2);
  20907. * // => 3
  20908. *
  20909. * // Search from the `fromIndex`.
  20910. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  20911. * // => 1
  20912. */
  20913. function lastIndexOf(array, value, fromIndex) {
  20914. var length = array == null ? 0 : array.length;
  20915. if (!length) {
  20916. return -1;
  20917. }
  20918. var index = length;
  20919. if (fromIndex !== undefined) {
  20920. index = toInteger(fromIndex);
  20921. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  20922. }
  20923. return value === value
  20924. ? strictLastIndexOf(array, value, index)
  20925. : baseFindIndex(array, baseIsNaN, index, true);
  20926. }
  20927. /**
  20928. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  20929. * element from the end is returned.
  20930. *
  20931. * @static
  20932. * @memberOf _
  20933. * @since 4.11.0
  20934. * @category Array
  20935. * @param {Array} array The array to query.
  20936. * @param {number} [n=0] The index of the element to return.
  20937. * @returns {*} Returns the nth element of `array`.
  20938. * @example
  20939. *
  20940. * var array = ['a', 'b', 'c', 'd'];
  20941. *
  20942. * _.nth(array, 1);
  20943. * // => 'b'
  20944. *
  20945. * _.nth(array, -2);
  20946. * // => 'c';
  20947. */
  20948. function nth(array, n) {
  20949. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  20950. }
  20951. /**
  20952. * Removes all given values from `array` using
  20953. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20954. * for equality comparisons.
  20955. *
  20956. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  20957. * to remove elements from an array by predicate.
  20958. *
  20959. * @static
  20960. * @memberOf _
  20961. * @since 2.0.0
  20962. * @category Array
  20963. * @param {Array} array The array to modify.
  20964. * @param {...*} [values] The values to remove.
  20965. * @returns {Array} Returns `array`.
  20966. * @example
  20967. *
  20968. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  20969. *
  20970. * _.pull(array, 'a', 'c');
  20971. * console.log(array);
  20972. * // => ['b', 'b']
  20973. */
  20974. var pull = baseRest(pullAll);
  20975. /**
  20976. * This method is like `_.pull` except that it accepts an array of values to remove.
  20977. *
  20978. * **Note:** Unlike `_.difference`, this method mutates `array`.
  20979. *
  20980. * @static
  20981. * @memberOf _
  20982. * @since 4.0.0
  20983. * @category Array
  20984. * @param {Array} array The array to modify.
  20985. * @param {Array} values The values to remove.
  20986. * @returns {Array} Returns `array`.
  20987. * @example
  20988. *
  20989. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  20990. *
  20991. * _.pullAll(array, ['a', 'c']);
  20992. * console.log(array);
  20993. * // => ['b', 'b']
  20994. */
  20995. function pullAll(array, values) {
  20996. return (array && array.length && values && values.length)
  20997. ? basePullAll(array, values)
  20998. : array;
  20999. }
  21000. /**
  21001. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  21002. * invoked for each element of `array` and `values` to generate the criterion
  21003. * by which they're compared. The iteratee is invoked with one argument: (value).
  21004. *
  21005. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  21006. *
  21007. * @static
  21008. * @memberOf _
  21009. * @since 4.0.0
  21010. * @category Array
  21011. * @param {Array} array The array to modify.
  21012. * @param {Array} values The values to remove.
  21013. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21014. * @returns {Array} Returns `array`.
  21015. * @example
  21016. *
  21017. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  21018. *
  21019. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  21020. * console.log(array);
  21021. * // => [{ 'x': 2 }]
  21022. */
  21023. function pullAllBy(array, values, iteratee) {
  21024. return (array && array.length && values && values.length)
  21025. ? basePullAll(array, values, getIteratee(iteratee, 2))
  21026. : array;
  21027. }
  21028. /**
  21029. * This method is like `_.pullAll` except that it accepts `comparator` which
  21030. * is invoked to compare elements of `array` to `values`. The comparator is
  21031. * invoked with two arguments: (arrVal, othVal).
  21032. *
  21033. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  21034. *
  21035. * @static
  21036. * @memberOf _
  21037. * @since 4.6.0
  21038. * @category Array
  21039. * @param {Array} array The array to modify.
  21040. * @param {Array} values The values to remove.
  21041. * @param {Function} [comparator] The comparator invoked per element.
  21042. * @returns {Array} Returns `array`.
  21043. * @example
  21044. *
  21045. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  21046. *
  21047. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  21048. * console.log(array);
  21049. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  21050. */
  21051. function pullAllWith(array, values, comparator) {
  21052. return (array && array.length && values && values.length)
  21053. ? basePullAll(array, values, undefined, comparator)
  21054. : array;
  21055. }
  21056. /**
  21057. * Removes elements from `array` corresponding to `indexes` and returns an
  21058. * array of removed elements.
  21059. *
  21060. * **Note:** Unlike `_.at`, this method mutates `array`.
  21061. *
  21062. * @static
  21063. * @memberOf _
  21064. * @since 3.0.0
  21065. * @category Array
  21066. * @param {Array} array The array to modify.
  21067. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  21068. * @returns {Array} Returns the new array of removed elements.
  21069. * @example
  21070. *
  21071. * var array = ['a', 'b', 'c', 'd'];
  21072. * var pulled = _.pullAt(array, [1, 3]);
  21073. *
  21074. * console.log(array);
  21075. * // => ['a', 'c']
  21076. *
  21077. * console.log(pulled);
  21078. * // => ['b', 'd']
  21079. */
  21080. var pullAt = flatRest(function(array, indexes) {
  21081. var length = array == null ? 0 : array.length,
  21082. result = baseAt(array, indexes);
  21083. basePullAt(array, arrayMap(indexes, function(index) {
  21084. return isIndex(index, length) ? +index : index;
  21085. }).sort(compareAscending));
  21086. return result;
  21087. });
  21088. /**
  21089. * Removes all elements from `array` that `predicate` returns truthy for
  21090. * and returns an array of the removed elements. The predicate is invoked
  21091. * with three arguments: (value, index, array).
  21092. *
  21093. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  21094. * to pull elements from an array by value.
  21095. *
  21096. * @static
  21097. * @memberOf _
  21098. * @since 2.0.0
  21099. * @category Array
  21100. * @param {Array} array The array to modify.
  21101. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21102. * @returns {Array} Returns the new array of removed elements.
  21103. * @example
  21104. *
  21105. * var array = [1, 2, 3, 4];
  21106. * var evens = _.remove(array, function(n) {
  21107. * return n % 2 == 0;
  21108. * });
  21109. *
  21110. * console.log(array);
  21111. * // => [1, 3]
  21112. *
  21113. * console.log(evens);
  21114. * // => [2, 4]
  21115. */
  21116. function remove(array, predicate) {
  21117. var result = [];
  21118. if (!(array && array.length)) {
  21119. return result;
  21120. }
  21121. var index = -1,
  21122. indexes = [],
  21123. length = array.length;
  21124. predicate = getIteratee(predicate, 3);
  21125. while (++index < length) {
  21126. var value = array[index];
  21127. if (predicate(value, index, array)) {
  21128. result.push(value);
  21129. indexes.push(index);
  21130. }
  21131. }
  21132. basePullAt(array, indexes);
  21133. return result;
  21134. }
  21135. /**
  21136. * Reverses `array` so that the first element becomes the last, the second
  21137. * element becomes the second to last, and so on.
  21138. *
  21139. * **Note:** This method mutates `array` and is based on
  21140. * [`Array#reverse`](https://mdn.io/Array/reverse).
  21141. *
  21142. * @static
  21143. * @memberOf _
  21144. * @since 4.0.0
  21145. * @category Array
  21146. * @param {Array} array The array to modify.
  21147. * @returns {Array} Returns `array`.
  21148. * @example
  21149. *
  21150. * var array = [1, 2, 3];
  21151. *
  21152. * _.reverse(array);
  21153. * // => [3, 2, 1]
  21154. *
  21155. * console.log(array);
  21156. * // => [3, 2, 1]
  21157. */
  21158. function reverse(array) {
  21159. return array == null ? array : nativeReverse.call(array);
  21160. }
  21161. /**
  21162. * Creates a slice of `array` from `start` up to, but not including, `end`.
  21163. *
  21164. * **Note:** This method is used instead of
  21165. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  21166. * returned.
  21167. *
  21168. * @static
  21169. * @memberOf _
  21170. * @since 3.0.0
  21171. * @category Array
  21172. * @param {Array} array The array to slice.
  21173. * @param {number} [start=0] The start position.
  21174. * @param {number} [end=array.length] The end position.
  21175. * @returns {Array} Returns the slice of `array`.
  21176. */
  21177. function slice(array, start, end) {
  21178. var length = array == null ? 0 : array.length;
  21179. if (!length) {
  21180. return [];
  21181. }
  21182. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  21183. start = 0;
  21184. end = length;
  21185. }
  21186. else {
  21187. start = start == null ? 0 : toInteger(start);
  21188. end = end === undefined ? length : toInteger(end);
  21189. }
  21190. return baseSlice(array, start, end);
  21191. }
  21192. /**
  21193. * Uses a binary search to determine the lowest index at which `value`
  21194. * should be inserted into `array` in order to maintain its sort order.
  21195. *
  21196. * @static
  21197. * @memberOf _
  21198. * @since 0.1.0
  21199. * @category Array
  21200. * @param {Array} array The sorted array to inspect.
  21201. * @param {*} value The value to evaluate.
  21202. * @returns {number} Returns the index at which `value` should be inserted
  21203. * into `array`.
  21204. * @example
  21205. *
  21206. * _.sortedIndex([30, 50], 40);
  21207. * // => 1
  21208. */
  21209. function sortedIndex(array, value) {
  21210. return baseSortedIndex(array, value);
  21211. }
  21212. /**
  21213. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  21214. * which is invoked for `value` and each element of `array` to compute their
  21215. * sort ranking. The iteratee is invoked with one argument: (value).
  21216. *
  21217. * @static
  21218. * @memberOf _
  21219. * @since 4.0.0
  21220. * @category Array
  21221. * @param {Array} array The sorted array to inspect.
  21222. * @param {*} value The value to evaluate.
  21223. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21224. * @returns {number} Returns the index at which `value` should be inserted
  21225. * into `array`.
  21226. * @example
  21227. *
  21228. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  21229. *
  21230. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  21231. * // => 0
  21232. *
  21233. * // The `_.property` iteratee shorthand.
  21234. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  21235. * // => 0
  21236. */
  21237. function sortedIndexBy(array, value, iteratee) {
  21238. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  21239. }
  21240. /**
  21241. * This method is like `_.indexOf` except that it performs a binary
  21242. * search on a sorted `array`.
  21243. *
  21244. * @static
  21245. * @memberOf _
  21246. * @since 4.0.0
  21247. * @category Array
  21248. * @param {Array} array The array to inspect.
  21249. * @param {*} value The value to search for.
  21250. * @returns {number} Returns the index of the matched value, else `-1`.
  21251. * @example
  21252. *
  21253. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  21254. * // => 1
  21255. */
  21256. function sortedIndexOf(array, value) {
  21257. var length = array == null ? 0 : array.length;
  21258. if (length) {
  21259. var index = baseSortedIndex(array, value);
  21260. if (index < length && eq(array[index], value)) {
  21261. return index;
  21262. }
  21263. }
  21264. return -1;
  21265. }
  21266. /**
  21267. * This method is like `_.sortedIndex` except that it returns the highest
  21268. * index at which `value` should be inserted into `array` in order to
  21269. * maintain its sort order.
  21270. *
  21271. * @static
  21272. * @memberOf _
  21273. * @since 3.0.0
  21274. * @category Array
  21275. * @param {Array} array The sorted array to inspect.
  21276. * @param {*} value The value to evaluate.
  21277. * @returns {number} Returns the index at which `value` should be inserted
  21278. * into `array`.
  21279. * @example
  21280. *
  21281. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  21282. * // => 4
  21283. */
  21284. function sortedLastIndex(array, value) {
  21285. return baseSortedIndex(array, value, true);
  21286. }
  21287. /**
  21288. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  21289. * which is invoked for `value` and each element of `array` to compute their
  21290. * sort ranking. The iteratee is invoked with one argument: (value).
  21291. *
  21292. * @static
  21293. * @memberOf _
  21294. * @since 4.0.0
  21295. * @category Array
  21296. * @param {Array} array The sorted array to inspect.
  21297. * @param {*} value The value to evaluate.
  21298. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21299. * @returns {number} Returns the index at which `value` should be inserted
  21300. * into `array`.
  21301. * @example
  21302. *
  21303. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  21304. *
  21305. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  21306. * // => 1
  21307. *
  21308. * // The `_.property` iteratee shorthand.
  21309. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  21310. * // => 1
  21311. */
  21312. function sortedLastIndexBy(array, value, iteratee) {
  21313. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  21314. }
  21315. /**
  21316. * This method is like `_.lastIndexOf` except that it performs a binary
  21317. * search on a sorted `array`.
  21318. *
  21319. * @static
  21320. * @memberOf _
  21321. * @since 4.0.0
  21322. * @category Array
  21323. * @param {Array} array The array to inspect.
  21324. * @param {*} value The value to search for.
  21325. * @returns {number} Returns the index of the matched value, else `-1`.
  21326. * @example
  21327. *
  21328. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  21329. * // => 3
  21330. */
  21331. function sortedLastIndexOf(array, value) {
  21332. var length = array == null ? 0 : array.length;
  21333. if (length) {
  21334. var index = baseSortedIndex(array, value, true) - 1;
  21335. if (eq(array[index], value)) {
  21336. return index;
  21337. }
  21338. }
  21339. return -1;
  21340. }
  21341. /**
  21342. * This method is like `_.uniq` except that it's designed and optimized
  21343. * for sorted arrays.
  21344. *
  21345. * @static
  21346. * @memberOf _
  21347. * @since 4.0.0
  21348. * @category Array
  21349. * @param {Array} array The array to inspect.
  21350. * @returns {Array} Returns the new duplicate free array.
  21351. * @example
  21352. *
  21353. * _.sortedUniq([1, 1, 2]);
  21354. * // => [1, 2]
  21355. */
  21356. function sortedUniq(array) {
  21357. return (array && array.length)
  21358. ? baseSortedUniq(array)
  21359. : [];
  21360. }
  21361. /**
  21362. * This method is like `_.uniqBy` except that it's designed and optimized
  21363. * for sorted arrays.
  21364. *
  21365. * @static
  21366. * @memberOf _
  21367. * @since 4.0.0
  21368. * @category Array
  21369. * @param {Array} array The array to inspect.
  21370. * @param {Function} [iteratee] The iteratee invoked per element.
  21371. * @returns {Array} Returns the new duplicate free array.
  21372. * @example
  21373. *
  21374. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  21375. * // => [1.1, 2.3]
  21376. */
  21377. function sortedUniqBy(array, iteratee) {
  21378. return (array && array.length)
  21379. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  21380. : [];
  21381. }
  21382. /**
  21383. * Gets all but the first element of `array`.
  21384. *
  21385. * @static
  21386. * @memberOf _
  21387. * @since 4.0.0
  21388. * @category Array
  21389. * @param {Array} array The array to query.
  21390. * @returns {Array} Returns the slice of `array`.
  21391. * @example
  21392. *
  21393. * _.tail([1, 2, 3]);
  21394. * // => [2, 3]
  21395. */
  21396. function tail(array) {
  21397. var length = array == null ? 0 : array.length;
  21398. return length ? baseSlice(array, 1, length) : [];
  21399. }
  21400. /**
  21401. * Creates a slice of `array` with `n` elements taken from the beginning.
  21402. *
  21403. * @static
  21404. * @memberOf _
  21405. * @since 0.1.0
  21406. * @category Array
  21407. * @param {Array} array The array to query.
  21408. * @param {number} [n=1] The number of elements to take.
  21409. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21410. * @returns {Array} Returns the slice of `array`.
  21411. * @example
  21412. *
  21413. * _.take([1, 2, 3]);
  21414. * // => [1]
  21415. *
  21416. * _.take([1, 2, 3], 2);
  21417. * // => [1, 2]
  21418. *
  21419. * _.take([1, 2, 3], 5);
  21420. * // => [1, 2, 3]
  21421. *
  21422. * _.take([1, 2, 3], 0);
  21423. * // => []
  21424. */
  21425. function take(array, n, guard) {
  21426. if (!(array && array.length)) {
  21427. return [];
  21428. }
  21429. n = (guard || n === undefined) ? 1 : toInteger(n);
  21430. return baseSlice(array, 0, n < 0 ? 0 : n);
  21431. }
  21432. /**
  21433. * Creates a slice of `array` with `n` elements taken from the end.
  21434. *
  21435. * @static
  21436. * @memberOf _
  21437. * @since 3.0.0
  21438. * @category Array
  21439. * @param {Array} array The array to query.
  21440. * @param {number} [n=1] The number of elements to take.
  21441. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21442. * @returns {Array} Returns the slice of `array`.
  21443. * @example
  21444. *
  21445. * _.takeRight([1, 2, 3]);
  21446. * // => [3]
  21447. *
  21448. * _.takeRight([1, 2, 3], 2);
  21449. * // => [2, 3]
  21450. *
  21451. * _.takeRight([1, 2, 3], 5);
  21452. * // => [1, 2, 3]
  21453. *
  21454. * _.takeRight([1, 2, 3], 0);
  21455. * // => []
  21456. */
  21457. function takeRight(array, n, guard) {
  21458. var length = array == null ? 0 : array.length;
  21459. if (!length) {
  21460. return [];
  21461. }
  21462. n = (guard || n === undefined) ? 1 : toInteger(n);
  21463. n = length - n;
  21464. return baseSlice(array, n < 0 ? 0 : n, length);
  21465. }
  21466. /**
  21467. * Creates a slice of `array` with elements taken from the end. Elements are
  21468. * taken until `predicate` returns falsey. The predicate is invoked with
  21469. * three arguments: (value, index, array).
  21470. *
  21471. * @static
  21472. * @memberOf _
  21473. * @since 3.0.0
  21474. * @category Array
  21475. * @param {Array} array The array to query.
  21476. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21477. * @returns {Array} Returns the slice of `array`.
  21478. * @example
  21479. *
  21480. * var users = [
  21481. * { 'user': 'barney', 'active': true },
  21482. * { 'user': 'fred', 'active': false },
  21483. * { 'user': 'pebbles', 'active': false }
  21484. * ];
  21485. *
  21486. * _.takeRightWhile(users, function(o) { return !o.active; });
  21487. * // => objects for ['fred', 'pebbles']
  21488. *
  21489. * // The `_.matches` iteratee shorthand.
  21490. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  21491. * // => objects for ['pebbles']
  21492. *
  21493. * // The `_.matchesProperty` iteratee shorthand.
  21494. * _.takeRightWhile(users, ['active', false]);
  21495. * // => objects for ['fred', 'pebbles']
  21496. *
  21497. * // The `_.property` iteratee shorthand.
  21498. * _.takeRightWhile(users, 'active');
  21499. * // => []
  21500. */
  21501. function takeRightWhile(array, predicate) {
  21502. return (array && array.length)
  21503. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  21504. : [];
  21505. }
  21506. /**
  21507. * Creates a slice of `array` with elements taken from the beginning. Elements
  21508. * are taken until `predicate` returns falsey. The predicate is invoked with
  21509. * three arguments: (value, index, array).
  21510. *
  21511. * @static
  21512. * @memberOf _
  21513. * @since 3.0.0
  21514. * @category Array
  21515. * @param {Array} array The array to query.
  21516. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21517. * @returns {Array} Returns the slice of `array`.
  21518. * @example
  21519. *
  21520. * var users = [
  21521. * { 'user': 'barney', 'active': false },
  21522. * { 'user': 'fred', 'active': false },
  21523. * { 'user': 'pebbles', 'active': true }
  21524. * ];
  21525. *
  21526. * _.takeWhile(users, function(o) { return !o.active; });
  21527. * // => objects for ['barney', 'fred']
  21528. *
  21529. * // The `_.matches` iteratee shorthand.
  21530. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  21531. * // => objects for ['barney']
  21532. *
  21533. * // The `_.matchesProperty` iteratee shorthand.
  21534. * _.takeWhile(users, ['active', false]);
  21535. * // => objects for ['barney', 'fred']
  21536. *
  21537. * // The `_.property` iteratee shorthand.
  21538. * _.takeWhile(users, 'active');
  21539. * // => []
  21540. */
  21541. function takeWhile(array, predicate) {
  21542. return (array && array.length)
  21543. ? baseWhile(array, getIteratee(predicate, 3))
  21544. : [];
  21545. }
  21546. /**
  21547. * Creates an array of unique values, in order, from all given arrays using
  21548. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21549. * for equality comparisons.
  21550. *
  21551. * @static
  21552. * @memberOf _
  21553. * @since 0.1.0
  21554. * @category Array
  21555. * @param {...Array} [arrays] The arrays to inspect.
  21556. * @returns {Array} Returns the new array of combined values.
  21557. * @example
  21558. *
  21559. * _.union([2], [1, 2]);
  21560. * // => [2, 1]
  21561. */
  21562. var union = baseRest(function(arrays) {
  21563. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  21564. });
  21565. /**
  21566. * This method is like `_.union` except that it accepts `iteratee` which is
  21567. * invoked for each element of each `arrays` to generate the criterion by
  21568. * which uniqueness is computed. Result values are chosen from the first
  21569. * array in which the value occurs. The iteratee is invoked with one argument:
  21570. * (value).
  21571. *
  21572. * @static
  21573. * @memberOf _
  21574. * @since 4.0.0
  21575. * @category Array
  21576. * @param {...Array} [arrays] The arrays to inspect.
  21577. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21578. * @returns {Array} Returns the new array of combined values.
  21579. * @example
  21580. *
  21581. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  21582. * // => [2.1, 1.2]
  21583. *
  21584. * // The `_.property` iteratee shorthand.
  21585. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  21586. * // => [{ 'x': 1 }, { 'x': 2 }]
  21587. */
  21588. var unionBy = baseRest(function(arrays) {
  21589. var iteratee = last(arrays);
  21590. if (isArrayLikeObject(iteratee)) {
  21591. iteratee = undefined;
  21592. }
  21593. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  21594. });
  21595. /**
  21596. * This method is like `_.union` except that it accepts `comparator` which
  21597. * is invoked to compare elements of `arrays`. Result values are chosen from
  21598. * the first array in which the value occurs. The comparator is invoked
  21599. * with two arguments: (arrVal, othVal).
  21600. *
  21601. * @static
  21602. * @memberOf _
  21603. * @since 4.0.0
  21604. * @category Array
  21605. * @param {...Array} [arrays] The arrays to inspect.
  21606. * @param {Function} [comparator] The comparator invoked per element.
  21607. * @returns {Array} Returns the new array of combined values.
  21608. * @example
  21609. *
  21610. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  21611. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21612. *
  21613. * _.unionWith(objects, others, _.isEqual);
  21614. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  21615. */
  21616. var unionWith = baseRest(function(arrays) {
  21617. var comparator = last(arrays);
  21618. comparator = typeof comparator == 'function' ? comparator : undefined;
  21619. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  21620. });
  21621. /**
  21622. * Creates a duplicate-free version of an array, using
  21623. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21624. * for equality comparisons, in which only the first occurrence of each element
  21625. * is kept. The order of result values is determined by the order they occur
  21626. * in the array.
  21627. *
  21628. * @static
  21629. * @memberOf _
  21630. * @since 0.1.0
  21631. * @category Array
  21632. * @param {Array} array The array to inspect.
  21633. * @returns {Array} Returns the new duplicate free array.
  21634. * @example
  21635. *
  21636. * _.uniq([2, 1, 2]);
  21637. * // => [2, 1]
  21638. */
  21639. function uniq(array) {
  21640. return (array && array.length) ? baseUniq(array) : [];
  21641. }
  21642. /**
  21643. * This method is like `_.uniq` except that it accepts `iteratee` which is
  21644. * invoked for each element in `array` to generate the criterion by which
  21645. * uniqueness is computed. The order of result values is determined by the
  21646. * order they occur in the array. The iteratee is invoked with one argument:
  21647. * (value).
  21648. *
  21649. * @static
  21650. * @memberOf _
  21651. * @since 4.0.0
  21652. * @category Array
  21653. * @param {Array} array The array to inspect.
  21654. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21655. * @returns {Array} Returns the new duplicate free array.
  21656. * @example
  21657. *
  21658. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  21659. * // => [2.1, 1.2]
  21660. *
  21661. * // The `_.property` iteratee shorthand.
  21662. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  21663. * // => [{ 'x': 1 }, { 'x': 2 }]
  21664. */
  21665. function uniqBy(array, iteratee) {
  21666. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  21667. }
  21668. /**
  21669. * This method is like `_.uniq` except that it accepts `comparator` which
  21670. * is invoked to compare elements of `array`. The order of result values is
  21671. * determined by the order they occur in the array.The comparator is invoked
  21672. * with two arguments: (arrVal, othVal).
  21673. *
  21674. * @static
  21675. * @memberOf _
  21676. * @since 4.0.0
  21677. * @category Array
  21678. * @param {Array} array The array to inspect.
  21679. * @param {Function} [comparator] The comparator invoked per element.
  21680. * @returns {Array} Returns the new duplicate free array.
  21681. * @example
  21682. *
  21683. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21684. *
  21685. * _.uniqWith(objects, _.isEqual);
  21686. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  21687. */
  21688. function uniqWith(array, comparator) {
  21689. comparator = typeof comparator == 'function' ? comparator : undefined;
  21690. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  21691. }
  21692. /**
  21693. * This method is like `_.zip` except that it accepts an array of grouped
  21694. * elements and creates an array regrouping the elements to their pre-zip
  21695. * configuration.
  21696. *
  21697. * @static
  21698. * @memberOf _
  21699. * @since 1.2.0
  21700. * @category Array
  21701. * @param {Array} array The array of grouped elements to process.
  21702. * @returns {Array} Returns the new array of regrouped elements.
  21703. * @example
  21704. *
  21705. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  21706. * // => [['a', 1, true], ['b', 2, false]]
  21707. *
  21708. * _.unzip(zipped);
  21709. * // => [['a', 'b'], [1, 2], [true, false]]
  21710. */
  21711. function unzip(array) {
  21712. if (!(array && array.length)) {
  21713. return [];
  21714. }
  21715. var length = 0;
  21716. array = arrayFilter(array, function(group) {
  21717. if (isArrayLikeObject(group)) {
  21718. length = nativeMax(group.length, length);
  21719. return true;
  21720. }
  21721. });
  21722. return baseTimes(length, function(index) {
  21723. return arrayMap(array, baseProperty(index));
  21724. });
  21725. }
  21726. /**
  21727. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  21728. * how regrouped values should be combined. The iteratee is invoked with the
  21729. * elements of each group: (...group).
  21730. *
  21731. * @static
  21732. * @memberOf _
  21733. * @since 3.8.0
  21734. * @category Array
  21735. * @param {Array} array The array of grouped elements to process.
  21736. * @param {Function} [iteratee=_.identity] The function to combine
  21737. * regrouped values.
  21738. * @returns {Array} Returns the new array of regrouped elements.
  21739. * @example
  21740. *
  21741. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  21742. * // => [[1, 10, 100], [2, 20, 200]]
  21743. *
  21744. * _.unzipWith(zipped, _.add);
  21745. * // => [3, 30, 300]
  21746. */
  21747. function unzipWith(array, iteratee) {
  21748. if (!(array && array.length)) {
  21749. return [];
  21750. }
  21751. var result = unzip(array);
  21752. if (iteratee == null) {
  21753. return result;
  21754. }
  21755. return arrayMap(result, function(group) {
  21756. return apply(iteratee, undefined, group);
  21757. });
  21758. }
  21759. /**
  21760. * Creates an array excluding all given values using
  21761. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21762. * for equality comparisons.
  21763. *
  21764. * **Note:** Unlike `_.pull`, this method returns a new array.
  21765. *
  21766. * @static
  21767. * @memberOf _
  21768. * @since 0.1.0
  21769. * @category Array
  21770. * @param {Array} array The array to inspect.
  21771. * @param {...*} [values] The values to exclude.
  21772. * @returns {Array} Returns the new array of filtered values.
  21773. * @see _.difference, _.xor
  21774. * @example
  21775. *
  21776. * _.without([2, 1, 2, 3], 1, 2);
  21777. * // => [3]
  21778. */
  21779. var without = baseRest(function(array, values) {
  21780. return isArrayLikeObject(array)
  21781. ? baseDifference(array, values)
  21782. : [];
  21783. });
  21784. /**
  21785. * Creates an array of unique values that is the
  21786. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  21787. * of the given arrays. The order of result values is determined by the order
  21788. * they occur in the arrays.
  21789. *
  21790. * @static
  21791. * @memberOf _
  21792. * @since 2.4.0
  21793. * @category Array
  21794. * @param {...Array} [arrays] The arrays to inspect.
  21795. * @returns {Array} Returns the new array of filtered values.
  21796. * @see _.difference, _.without
  21797. * @example
  21798. *
  21799. * _.xor([2, 1], [2, 3]);
  21800. * // => [1, 3]
  21801. */
  21802. var xor = baseRest(function(arrays) {
  21803. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  21804. });
  21805. /**
  21806. * This method is like `_.xor` except that it accepts `iteratee` which is
  21807. * invoked for each element of each `arrays` to generate the criterion by
  21808. * which by which they're compared. The order of result values is determined
  21809. * by the order they occur in the arrays. The iteratee is invoked with one
  21810. * argument: (value).
  21811. *
  21812. * @static
  21813. * @memberOf _
  21814. * @since 4.0.0
  21815. * @category Array
  21816. * @param {...Array} [arrays] The arrays to inspect.
  21817. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21818. * @returns {Array} Returns the new array of filtered values.
  21819. * @example
  21820. *
  21821. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  21822. * // => [1.2, 3.4]
  21823. *
  21824. * // The `_.property` iteratee shorthand.
  21825. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  21826. * // => [{ 'x': 2 }]
  21827. */
  21828. var xorBy = baseRest(function(arrays) {
  21829. var iteratee = last(arrays);
  21830. if (isArrayLikeObject(iteratee)) {
  21831. iteratee = undefined;
  21832. }
  21833. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  21834. });
  21835. /**
  21836. * This method is like `_.xor` except that it accepts `comparator` which is
  21837. * invoked to compare elements of `arrays`. The order of result values is
  21838. * determined by the order they occur in the arrays. The comparator is invoked
  21839. * with two arguments: (arrVal, othVal).
  21840. *
  21841. * @static
  21842. * @memberOf _
  21843. * @since 4.0.0
  21844. * @category Array
  21845. * @param {...Array} [arrays] The arrays to inspect.
  21846. * @param {Function} [comparator] The comparator invoked per element.
  21847. * @returns {Array} Returns the new array of filtered values.
  21848. * @example
  21849. *
  21850. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  21851. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21852. *
  21853. * _.xorWith(objects, others, _.isEqual);
  21854. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  21855. */
  21856. var xorWith = baseRest(function(arrays) {
  21857. var comparator = last(arrays);
  21858. comparator = typeof comparator == 'function' ? comparator : undefined;
  21859. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  21860. });
  21861. /**
  21862. * Creates an array of grouped elements, the first of which contains the
  21863. * first elements of the given arrays, the second of which contains the
  21864. * second elements of the given arrays, and so on.
  21865. *
  21866. * @static
  21867. * @memberOf _
  21868. * @since 0.1.0
  21869. * @category Array
  21870. * @param {...Array} [arrays] The arrays to process.
  21871. * @returns {Array} Returns the new array of grouped elements.
  21872. * @example
  21873. *
  21874. * _.zip(['a', 'b'], [1, 2], [true, false]);
  21875. * // => [['a', 1, true], ['b', 2, false]]
  21876. */
  21877. var zip = baseRest(unzip);
  21878. /**
  21879. * This method is like `_.fromPairs` except that it accepts two arrays,
  21880. * one of property identifiers and one of corresponding values.
  21881. *
  21882. * @static
  21883. * @memberOf _
  21884. * @since 0.4.0
  21885. * @category Array
  21886. * @param {Array} [props=[]] The property identifiers.
  21887. * @param {Array} [values=[]] The property values.
  21888. * @returns {Object} Returns the new object.
  21889. * @example
  21890. *
  21891. * _.zipObject(['a', 'b'], [1, 2]);
  21892. * // => { 'a': 1, 'b': 2 }
  21893. */
  21894. function zipObject(props, values) {
  21895. return baseZipObject(props || [], values || [], assignValue);
  21896. }
  21897. /**
  21898. * This method is like `_.zipObject` except that it supports property paths.
  21899. *
  21900. * @static
  21901. * @memberOf _
  21902. * @since 4.1.0
  21903. * @category Array
  21904. * @param {Array} [props=[]] The property identifiers.
  21905. * @param {Array} [values=[]] The property values.
  21906. * @returns {Object} Returns the new object.
  21907. * @example
  21908. *
  21909. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  21910. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  21911. */
  21912. function zipObjectDeep(props, values) {
  21913. return baseZipObject(props || [], values || [], baseSet);
  21914. }
  21915. /**
  21916. * This method is like `_.zip` except that it accepts `iteratee` to specify
  21917. * how grouped values should be combined. The iteratee is invoked with the
  21918. * elements of each group: (...group).
  21919. *
  21920. * @static
  21921. * @memberOf _
  21922. * @since 3.8.0
  21923. * @category Array
  21924. * @param {...Array} [arrays] The arrays to process.
  21925. * @param {Function} [iteratee=_.identity] The function to combine
  21926. * grouped values.
  21927. * @returns {Array} Returns the new array of grouped elements.
  21928. * @example
  21929. *
  21930. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  21931. * return a + b + c;
  21932. * });
  21933. * // => [111, 222]
  21934. */
  21935. var zipWith = baseRest(function(arrays) {
  21936. var length = arrays.length,
  21937. iteratee = length > 1 ? arrays[length - 1] : undefined;
  21938. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  21939. return unzipWith(arrays, iteratee);
  21940. });
  21941. /*------------------------------------------------------------------------*/
  21942. /**
  21943. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  21944. * chain sequences enabled. The result of such sequences must be unwrapped
  21945. * with `_#value`.
  21946. *
  21947. * @static
  21948. * @memberOf _
  21949. * @since 1.3.0
  21950. * @category Seq
  21951. * @param {*} value The value to wrap.
  21952. * @returns {Object} Returns the new `lodash` wrapper instance.
  21953. * @example
  21954. *
  21955. * var users = [
  21956. * { 'user': 'barney', 'age': 36 },
  21957. * { 'user': 'fred', 'age': 40 },
  21958. * { 'user': 'pebbles', 'age': 1 }
  21959. * ];
  21960. *
  21961. * var youngest = _
  21962. * .chain(users)
  21963. * .sortBy('age')
  21964. * .map(function(o) {
  21965. * return o.user + ' is ' + o.age;
  21966. * })
  21967. * .head()
  21968. * .value();
  21969. * // => 'pebbles is 1'
  21970. */
  21971. function chain(value) {
  21972. var result = lodash(value);
  21973. result.__chain__ = true;
  21974. return result;
  21975. }
  21976. /**
  21977. * This method invokes `interceptor` and returns `value`. The interceptor
  21978. * is invoked with one argument; (value). The purpose of this method is to
  21979. * "tap into" a method chain sequence in order to modify intermediate results.
  21980. *
  21981. * @static
  21982. * @memberOf _
  21983. * @since 0.1.0
  21984. * @category Seq
  21985. * @param {*} value The value to provide to `interceptor`.
  21986. * @param {Function} interceptor The function to invoke.
  21987. * @returns {*} Returns `value`.
  21988. * @example
  21989. *
  21990. * _([1, 2, 3])
  21991. * .tap(function(array) {
  21992. * // Mutate input array.
  21993. * array.pop();
  21994. * })
  21995. * .reverse()
  21996. * .value();
  21997. * // => [2, 1]
  21998. */
  21999. function tap(value, interceptor) {
  22000. interceptor(value);
  22001. return value;
  22002. }
  22003. /**
  22004. * This method is like `_.tap` except that it returns the result of `interceptor`.
  22005. * The purpose of this method is to "pass thru" values replacing intermediate
  22006. * results in a method chain sequence.
  22007. *
  22008. * @static
  22009. * @memberOf _
  22010. * @since 3.0.0
  22011. * @category Seq
  22012. * @param {*} value The value to provide to `interceptor`.
  22013. * @param {Function} interceptor The function to invoke.
  22014. * @returns {*} Returns the result of `interceptor`.
  22015. * @example
  22016. *
  22017. * _(' abc ')
  22018. * .chain()
  22019. * .trim()
  22020. * .thru(function(value) {
  22021. * return [value];
  22022. * })
  22023. * .value();
  22024. * // => ['abc']
  22025. */
  22026. function thru(value, interceptor) {
  22027. return interceptor(value);
  22028. }
  22029. /**
  22030. * This method is the wrapper version of `_.at`.
  22031. *
  22032. * @name at
  22033. * @memberOf _
  22034. * @since 1.0.0
  22035. * @category Seq
  22036. * @param {...(string|string[])} [paths] The property paths to pick.
  22037. * @returns {Object} Returns the new `lodash` wrapper instance.
  22038. * @example
  22039. *
  22040. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  22041. *
  22042. * _(object).at(['a[0].b.c', 'a[1]']).value();
  22043. * // => [3, 4]
  22044. */
  22045. var wrapperAt = flatRest(function(paths) {
  22046. var length = paths.length,
  22047. start = length ? paths[0] : 0,
  22048. value = this.__wrapped__,
  22049. interceptor = function(object) { return baseAt(object, paths); };
  22050. if (length > 1 || this.__actions__.length ||
  22051. !(value instanceof LazyWrapper) || !isIndex(start)) {
  22052. return this.thru(interceptor);
  22053. }
  22054. value = value.slice(start, +start + (length ? 1 : 0));
  22055. value.__actions__.push({
  22056. 'func': thru,
  22057. 'args': [interceptor],
  22058. 'thisArg': undefined
  22059. });
  22060. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  22061. if (length && !array.length) {
  22062. array.push(undefined);
  22063. }
  22064. return array;
  22065. });
  22066. });
  22067. /**
  22068. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  22069. *
  22070. * @name chain
  22071. * @memberOf _
  22072. * @since 0.1.0
  22073. * @category Seq
  22074. * @returns {Object} Returns the new `lodash` wrapper instance.
  22075. * @example
  22076. *
  22077. * var users = [
  22078. * { 'user': 'barney', 'age': 36 },
  22079. * { 'user': 'fred', 'age': 40 }
  22080. * ];
  22081. *
  22082. * // A sequence without explicit chaining.
  22083. * _(users).head();
  22084. * // => { 'user': 'barney', 'age': 36 }
  22085. *
  22086. * // A sequence with explicit chaining.
  22087. * _(users)
  22088. * .chain()
  22089. * .head()
  22090. * .pick('user')
  22091. * .value();
  22092. * // => { 'user': 'barney' }
  22093. */
  22094. function wrapperChain() {
  22095. return chain(this);
  22096. }
  22097. /**
  22098. * Executes the chain sequence and returns the wrapped result.
  22099. *
  22100. * @name commit
  22101. * @memberOf _
  22102. * @since 3.2.0
  22103. * @category Seq
  22104. * @returns {Object} Returns the new `lodash` wrapper instance.
  22105. * @example
  22106. *
  22107. * var array = [1, 2];
  22108. * var wrapped = _(array).push(3);
  22109. *
  22110. * console.log(array);
  22111. * // => [1, 2]
  22112. *
  22113. * wrapped = wrapped.commit();
  22114. * console.log(array);
  22115. * // => [1, 2, 3]
  22116. *
  22117. * wrapped.last();
  22118. * // => 3
  22119. *
  22120. * console.log(array);
  22121. * // => [1, 2, 3]
  22122. */
  22123. function wrapperCommit() {
  22124. return new LodashWrapper(this.value(), this.__chain__);
  22125. }
  22126. /**
  22127. * Gets the next value on a wrapped object following the
  22128. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  22129. *
  22130. * @name next
  22131. * @memberOf _
  22132. * @since 4.0.0
  22133. * @category Seq
  22134. * @returns {Object} Returns the next iterator value.
  22135. * @example
  22136. *
  22137. * var wrapped = _([1, 2]);
  22138. *
  22139. * wrapped.next();
  22140. * // => { 'done': false, 'value': 1 }
  22141. *
  22142. * wrapped.next();
  22143. * // => { 'done': false, 'value': 2 }
  22144. *
  22145. * wrapped.next();
  22146. * // => { 'done': true, 'value': undefined }
  22147. */
  22148. function wrapperNext() {
  22149. if (this.__values__ === undefined) {
  22150. this.__values__ = toArray(this.value());
  22151. }
  22152. var done = this.__index__ >= this.__values__.length,
  22153. value = done ? undefined : this.__values__[this.__index__++];
  22154. return { 'done': done, 'value': value };
  22155. }
  22156. /**
  22157. * Enables the wrapper to be iterable.
  22158. *
  22159. * @name Symbol.iterator
  22160. * @memberOf _
  22161. * @since 4.0.0
  22162. * @category Seq
  22163. * @returns {Object} Returns the wrapper object.
  22164. * @example
  22165. *
  22166. * var wrapped = _([1, 2]);
  22167. *
  22168. * wrapped[Symbol.iterator]() === wrapped;
  22169. * // => true
  22170. *
  22171. * Array.from(wrapped);
  22172. * // => [1, 2]
  22173. */
  22174. function wrapperToIterator() {
  22175. return this;
  22176. }
  22177. /**
  22178. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  22179. *
  22180. * @name plant
  22181. * @memberOf _
  22182. * @since 3.2.0
  22183. * @category Seq
  22184. * @param {*} value The value to plant.
  22185. * @returns {Object} Returns the new `lodash` wrapper instance.
  22186. * @example
  22187. *
  22188. * function square(n) {
  22189. * return n * n;
  22190. * }
  22191. *
  22192. * var wrapped = _([1, 2]).map(square);
  22193. * var other = wrapped.plant([3, 4]);
  22194. *
  22195. * other.value();
  22196. * // => [9, 16]
  22197. *
  22198. * wrapped.value();
  22199. * // => [1, 4]
  22200. */
  22201. function wrapperPlant(value) {
  22202. var result,
  22203. parent = this;
  22204. while (parent instanceof baseLodash) {
  22205. var clone = wrapperClone(parent);
  22206. clone.__index__ = 0;
  22207. clone.__values__ = undefined;
  22208. if (result) {
  22209. previous.__wrapped__ = clone;
  22210. } else {
  22211. result = clone;
  22212. }
  22213. var previous = clone;
  22214. parent = parent.__wrapped__;
  22215. }
  22216. previous.__wrapped__ = value;
  22217. return result;
  22218. }
  22219. /**
  22220. * This method is the wrapper version of `_.reverse`.
  22221. *
  22222. * **Note:** This method mutates the wrapped array.
  22223. *
  22224. * @name reverse
  22225. * @memberOf _
  22226. * @since 0.1.0
  22227. * @category Seq
  22228. * @returns {Object} Returns the new `lodash` wrapper instance.
  22229. * @example
  22230. *
  22231. * var array = [1, 2, 3];
  22232. *
  22233. * _(array).reverse().value()
  22234. * // => [3, 2, 1]
  22235. *
  22236. * console.log(array);
  22237. * // => [3, 2, 1]
  22238. */
  22239. function wrapperReverse() {
  22240. var value = this.__wrapped__;
  22241. if (value instanceof LazyWrapper) {
  22242. var wrapped = value;
  22243. if (this.__actions__.length) {
  22244. wrapped = new LazyWrapper(this);
  22245. }
  22246. wrapped = wrapped.reverse();
  22247. wrapped.__actions__.push({
  22248. 'func': thru,
  22249. 'args': [reverse],
  22250. 'thisArg': undefined
  22251. });
  22252. return new LodashWrapper(wrapped, this.__chain__);
  22253. }
  22254. return this.thru(reverse);
  22255. }
  22256. /**
  22257. * Executes the chain sequence to resolve the unwrapped value.
  22258. *
  22259. * @name value
  22260. * @memberOf _
  22261. * @since 0.1.0
  22262. * @alias toJSON, valueOf
  22263. * @category Seq
  22264. * @returns {*} Returns the resolved unwrapped value.
  22265. * @example
  22266. *
  22267. * _([1, 2, 3]).value();
  22268. * // => [1, 2, 3]
  22269. */
  22270. function wrapperValue() {
  22271. return baseWrapperValue(this.__wrapped__, this.__actions__);
  22272. }
  22273. /*------------------------------------------------------------------------*/
  22274. /**
  22275. * Creates an object composed of keys generated from the results of running
  22276. * each element of `collection` thru `iteratee`. The corresponding value of
  22277. * each key is the number of times the key was returned by `iteratee`. The
  22278. * iteratee is invoked with one argument: (value).
  22279. *
  22280. * @static
  22281. * @memberOf _
  22282. * @since 0.5.0
  22283. * @category Collection
  22284. * @param {Array|Object} collection The collection to iterate over.
  22285. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  22286. * @returns {Object} Returns the composed aggregate object.
  22287. * @example
  22288. *
  22289. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  22290. * // => { '4': 1, '6': 2 }
  22291. *
  22292. * // The `_.property` iteratee shorthand.
  22293. * _.countBy(['one', 'two', 'three'], 'length');
  22294. * // => { '3': 2, '5': 1 }
  22295. */
  22296. var countBy = createAggregator(function(result, value, key) {
  22297. if (hasOwnProperty.call(result, key)) {
  22298. ++result[key];
  22299. } else {
  22300. baseAssignValue(result, key, 1);
  22301. }
  22302. });
  22303. /**
  22304. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  22305. * Iteration is stopped once `predicate` returns falsey. The predicate is
  22306. * invoked with three arguments: (value, index|key, collection).
  22307. *
  22308. * **Note:** This method returns `true` for
  22309. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  22310. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  22311. * elements of empty collections.
  22312. *
  22313. * @static
  22314. * @memberOf _
  22315. * @since 0.1.0
  22316. * @category Collection
  22317. * @param {Array|Object} collection The collection to iterate over.
  22318. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22319. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22320. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  22321. * else `false`.
  22322. * @example
  22323. *
  22324. * _.every([true, 1, null, 'yes'], Boolean);
  22325. * // => false
  22326. *
  22327. * var users = [
  22328. * { 'user': 'barney', 'age': 36, 'active': false },
  22329. * { 'user': 'fred', 'age': 40, 'active': false }
  22330. * ];
  22331. *
  22332. * // The `_.matches` iteratee shorthand.
  22333. * _.every(users, { 'user': 'barney', 'active': false });
  22334. * // => false
  22335. *
  22336. * // The `_.matchesProperty` iteratee shorthand.
  22337. * _.every(users, ['active', false]);
  22338. * // => true
  22339. *
  22340. * // The `_.property` iteratee shorthand.
  22341. * _.every(users, 'active');
  22342. * // => false
  22343. */
  22344. function every(collection, predicate, guard) {
  22345. var func = isArray(collection) ? arrayEvery : baseEvery;
  22346. if (guard && isIterateeCall(collection, predicate, guard)) {
  22347. predicate = undefined;
  22348. }
  22349. return func(collection, getIteratee(predicate, 3));
  22350. }
  22351. /**
  22352. * Iterates over elements of `collection`, returning an array of all elements
  22353. * `predicate` returns truthy for. The predicate is invoked with three
  22354. * arguments: (value, index|key, collection).
  22355. *
  22356. * **Note:** Unlike `_.remove`, this method returns a new array.
  22357. *
  22358. * @static
  22359. * @memberOf _
  22360. * @since 0.1.0
  22361. * @category Collection
  22362. * @param {Array|Object} collection The collection to iterate over.
  22363. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22364. * @returns {Array} Returns the new filtered array.
  22365. * @see _.reject
  22366. * @example
  22367. *
  22368. * var users = [
  22369. * { 'user': 'barney', 'age': 36, 'active': true },
  22370. * { 'user': 'fred', 'age': 40, 'active': false }
  22371. * ];
  22372. *
  22373. * _.filter(users, function(o) { return !o.active; });
  22374. * // => objects for ['fred']
  22375. *
  22376. * // The `_.matches` iteratee shorthand.
  22377. * _.filter(users, { 'age': 36, 'active': true });
  22378. * // => objects for ['barney']
  22379. *
  22380. * // The `_.matchesProperty` iteratee shorthand.
  22381. * _.filter(users, ['active', false]);
  22382. * // => objects for ['fred']
  22383. *
  22384. * // The `_.property` iteratee shorthand.
  22385. * _.filter(users, 'active');
  22386. * // => objects for ['barney']
  22387. */
  22388. function filter(collection, predicate) {
  22389. var func = isArray(collection) ? arrayFilter : baseFilter;
  22390. return func(collection, getIteratee(predicate, 3));
  22391. }
  22392. /**
  22393. * Iterates over elements of `collection`, returning the first element
  22394. * `predicate` returns truthy for. The predicate is invoked with three
  22395. * arguments: (value, index|key, collection).
  22396. *
  22397. * @static
  22398. * @memberOf _
  22399. * @since 0.1.0
  22400. * @category Collection
  22401. * @param {Array|Object} collection The collection to inspect.
  22402. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22403. * @param {number} [fromIndex=0] The index to search from.
  22404. * @returns {*} Returns the matched element, else `undefined`.
  22405. * @example
  22406. *
  22407. * var users = [
  22408. * { 'user': 'barney', 'age': 36, 'active': true },
  22409. * { 'user': 'fred', 'age': 40, 'active': false },
  22410. * { 'user': 'pebbles', 'age': 1, 'active': true }
  22411. * ];
  22412. *
  22413. * _.find(users, function(o) { return o.age < 40; });
  22414. * // => object for 'barney'
  22415. *
  22416. * // The `_.matches` iteratee shorthand.
  22417. * _.find(users, { 'age': 1, 'active': true });
  22418. * // => object for 'pebbles'
  22419. *
  22420. * // The `_.matchesProperty` iteratee shorthand.
  22421. * _.find(users, ['active', false]);
  22422. * // => object for 'fred'
  22423. *
  22424. * // The `_.property` iteratee shorthand.
  22425. * _.find(users, 'active');
  22426. * // => object for 'barney'
  22427. */
  22428. var find = createFind(findIndex);
  22429. /**
  22430. * This method is like `_.find` except that it iterates over elements of
  22431. * `collection` from right to left.
  22432. *
  22433. * @static
  22434. * @memberOf _
  22435. * @since 2.0.0
  22436. * @category Collection
  22437. * @param {Array|Object} collection The collection to inspect.
  22438. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22439. * @param {number} [fromIndex=collection.length-1] The index to search from.
  22440. * @returns {*} Returns the matched element, else `undefined`.
  22441. * @example
  22442. *
  22443. * _.findLast([1, 2, 3, 4], function(n) {
  22444. * return n % 2 == 1;
  22445. * });
  22446. * // => 3
  22447. */
  22448. var findLast = createFind(findLastIndex);
  22449. /**
  22450. * Creates a flattened array of values by running each element in `collection`
  22451. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  22452. * with three arguments: (value, index|key, collection).
  22453. *
  22454. * @static
  22455. * @memberOf _
  22456. * @since 4.0.0
  22457. * @category Collection
  22458. * @param {Array|Object} collection The collection to iterate over.
  22459. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22460. * @returns {Array} Returns the new flattened array.
  22461. * @example
  22462. *
  22463. * function duplicate(n) {
  22464. * return [n, n];
  22465. * }
  22466. *
  22467. * _.flatMap([1, 2], duplicate);
  22468. * // => [1, 1, 2, 2]
  22469. */
  22470. function flatMap(collection, iteratee) {
  22471. return baseFlatten(map(collection, iteratee), 1);
  22472. }
  22473. /**
  22474. * This method is like `_.flatMap` except that it recursively flattens the
  22475. * mapped results.
  22476. *
  22477. * @static
  22478. * @memberOf _
  22479. * @since 4.7.0
  22480. * @category Collection
  22481. * @param {Array|Object} collection The collection to iterate over.
  22482. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22483. * @returns {Array} Returns the new flattened array.
  22484. * @example
  22485. *
  22486. * function duplicate(n) {
  22487. * return [[[n, n]]];
  22488. * }
  22489. *
  22490. * _.flatMapDeep([1, 2], duplicate);
  22491. * // => [1, 1, 2, 2]
  22492. */
  22493. function flatMapDeep(collection, iteratee) {
  22494. return baseFlatten(map(collection, iteratee), INFINITY);
  22495. }
  22496. /**
  22497. * This method is like `_.flatMap` except that it recursively flattens the
  22498. * mapped results up to `depth` times.
  22499. *
  22500. * @static
  22501. * @memberOf _
  22502. * @since 4.7.0
  22503. * @category Collection
  22504. * @param {Array|Object} collection The collection to iterate over.
  22505. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22506. * @param {number} [depth=1] The maximum recursion depth.
  22507. * @returns {Array} Returns the new flattened array.
  22508. * @example
  22509. *
  22510. * function duplicate(n) {
  22511. * return [[[n, n]]];
  22512. * }
  22513. *
  22514. * _.flatMapDepth([1, 2], duplicate, 2);
  22515. * // => [[1, 1], [2, 2]]
  22516. */
  22517. function flatMapDepth(collection, iteratee, depth) {
  22518. depth = depth === undefined ? 1 : toInteger(depth);
  22519. return baseFlatten(map(collection, iteratee), depth);
  22520. }
  22521. /**
  22522. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  22523. * The iteratee is invoked with three arguments: (value, index|key, collection).
  22524. * Iteratee functions may exit iteration early by explicitly returning `false`.
  22525. *
  22526. * **Note:** As with other "Collections" methods, objects with a "length"
  22527. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  22528. * or `_.forOwn` for object iteration.
  22529. *
  22530. * @static
  22531. * @memberOf _
  22532. * @since 0.1.0
  22533. * @alias each
  22534. * @category Collection
  22535. * @param {Array|Object} collection The collection to iterate over.
  22536. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22537. * @returns {Array|Object} Returns `collection`.
  22538. * @see _.forEachRight
  22539. * @example
  22540. *
  22541. * _.forEach([1, 2], function(value) {
  22542. * console.log(value);
  22543. * });
  22544. * // => Logs `1` then `2`.
  22545. *
  22546. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  22547. * console.log(key);
  22548. * });
  22549. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  22550. */
  22551. function forEach(collection, iteratee) {
  22552. var func = isArray(collection) ? arrayEach : baseEach;
  22553. return func(collection, getIteratee(iteratee, 3));
  22554. }
  22555. /**
  22556. * This method is like `_.forEach` except that it iterates over elements of
  22557. * `collection` from right to left.
  22558. *
  22559. * @static
  22560. * @memberOf _
  22561. * @since 2.0.0
  22562. * @alias eachRight
  22563. * @category Collection
  22564. * @param {Array|Object} collection The collection to iterate over.
  22565. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22566. * @returns {Array|Object} Returns `collection`.
  22567. * @see _.forEach
  22568. * @example
  22569. *
  22570. * _.forEachRight([1, 2], function(value) {
  22571. * console.log(value);
  22572. * });
  22573. * // => Logs `2` then `1`.
  22574. */
  22575. function forEachRight(collection, iteratee) {
  22576. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  22577. return func(collection, getIteratee(iteratee, 3));
  22578. }
  22579. /**
  22580. * Creates an object composed of keys generated from the results of running
  22581. * each element of `collection` thru `iteratee`. The order of grouped values
  22582. * is determined by the order they occur in `collection`. The corresponding
  22583. * value of each key is an array of elements responsible for generating the
  22584. * key. The iteratee is invoked with one argument: (value).
  22585. *
  22586. * @static
  22587. * @memberOf _
  22588. * @since 0.1.0
  22589. * @category Collection
  22590. * @param {Array|Object} collection The collection to iterate over.
  22591. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  22592. * @returns {Object} Returns the composed aggregate object.
  22593. * @example
  22594. *
  22595. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  22596. * // => { '4': [4.2], '6': [6.1, 6.3] }
  22597. *
  22598. * // The `_.property` iteratee shorthand.
  22599. * _.groupBy(['one', 'two', 'three'], 'length');
  22600. * // => { '3': ['one', 'two'], '5': ['three'] }
  22601. */
  22602. var groupBy = createAggregator(function(result, value, key) {
  22603. if (hasOwnProperty.call(result, key)) {
  22604. result[key].push(value);
  22605. } else {
  22606. baseAssignValue(result, key, [value]);
  22607. }
  22608. });
  22609. /**
  22610. * Checks if `value` is in `collection`. If `collection` is a string, it's
  22611. * checked for a substring of `value`, otherwise
  22612. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  22613. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  22614. * the offset from the end of `collection`.
  22615. *
  22616. * @static
  22617. * @memberOf _
  22618. * @since 0.1.0
  22619. * @category Collection
  22620. * @param {Array|Object|string} collection The collection to inspect.
  22621. * @param {*} value The value to search for.
  22622. * @param {number} [fromIndex=0] The index to search from.
  22623. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  22624. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  22625. * @example
  22626. *
  22627. * _.includes([1, 2, 3], 1);
  22628. * // => true
  22629. *
  22630. * _.includes([1, 2, 3], 1, 2);
  22631. * // => false
  22632. *
  22633. * _.includes({ 'a': 1, 'b': 2 }, 1);
  22634. * // => true
  22635. *
  22636. * _.includes('abcd', 'bc');
  22637. * // => true
  22638. */
  22639. function includes(collection, value, fromIndex, guard) {
  22640. collection = isArrayLike(collection) ? collection : values(collection);
  22641. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  22642. var length = collection.length;
  22643. if (fromIndex < 0) {
  22644. fromIndex = nativeMax(length + fromIndex, 0);
  22645. }
  22646. return isString(collection)
  22647. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  22648. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  22649. }
  22650. /**
  22651. * Invokes the method at `path` of each element in `collection`, returning
  22652. * an array of the results of each invoked method. Any additional arguments
  22653. * are provided to each invoked method. If `path` is a function, it's invoked
  22654. * for, and `this` bound to, each element in `collection`.
  22655. *
  22656. * @static
  22657. * @memberOf _
  22658. * @since 4.0.0
  22659. * @category Collection
  22660. * @param {Array|Object} collection The collection to iterate over.
  22661. * @param {Array|Function|string} path The path of the method to invoke or
  22662. * the function invoked per iteration.
  22663. * @param {...*} [args] The arguments to invoke each method with.
  22664. * @returns {Array} Returns the array of results.
  22665. * @example
  22666. *
  22667. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  22668. * // => [[1, 5, 7], [1, 2, 3]]
  22669. *
  22670. * _.invokeMap([123, 456], String.prototype.split, '');
  22671. * // => [['1', '2', '3'], ['4', '5', '6']]
  22672. */
  22673. var invokeMap = baseRest(function(collection, path, args) {
  22674. var index = -1,
  22675. isFunc = typeof path == 'function',
  22676. result = isArrayLike(collection) ? Array(collection.length) : [];
  22677. baseEach(collection, function(value) {
  22678. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  22679. });
  22680. return result;
  22681. });
  22682. /**
  22683. * Creates an object composed of keys generated from the results of running
  22684. * each element of `collection` thru `iteratee`. The corresponding value of
  22685. * each key is the last element responsible for generating the key. The
  22686. * iteratee is invoked with one argument: (value).
  22687. *
  22688. * @static
  22689. * @memberOf _
  22690. * @since 4.0.0
  22691. * @category Collection
  22692. * @param {Array|Object} collection The collection to iterate over.
  22693. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  22694. * @returns {Object} Returns the composed aggregate object.
  22695. * @example
  22696. *
  22697. * var array = [
  22698. * { 'dir': 'left', 'code': 97 },
  22699. * { 'dir': 'right', 'code': 100 }
  22700. * ];
  22701. *
  22702. * _.keyBy(array, function(o) {
  22703. * return String.fromCharCode(o.code);
  22704. * });
  22705. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  22706. *
  22707. * _.keyBy(array, 'dir');
  22708. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  22709. */
  22710. var keyBy = createAggregator(function(result, value, key) {
  22711. baseAssignValue(result, key, value);
  22712. });
  22713. /**
  22714. * Creates an array of values by running each element in `collection` thru
  22715. * `iteratee`. The iteratee is invoked with three arguments:
  22716. * (value, index|key, collection).
  22717. *
  22718. * Many lodash methods are guarded to work as iteratees for methods like
  22719. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  22720. *
  22721. * The guarded methods are:
  22722. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  22723. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  22724. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  22725. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  22726. *
  22727. * @static
  22728. * @memberOf _
  22729. * @since 0.1.0
  22730. * @category Collection
  22731. * @param {Array|Object} collection The collection to iterate over.
  22732. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22733. * @returns {Array} Returns the new mapped array.
  22734. * @example
  22735. *
  22736. * function square(n) {
  22737. * return n * n;
  22738. * }
  22739. *
  22740. * _.map([4, 8], square);
  22741. * // => [16, 64]
  22742. *
  22743. * _.map({ 'a': 4, 'b': 8 }, square);
  22744. * // => [16, 64] (iteration order is not guaranteed)
  22745. *
  22746. * var users = [
  22747. * { 'user': 'barney' },
  22748. * { 'user': 'fred' }
  22749. * ];
  22750. *
  22751. * // The `_.property` iteratee shorthand.
  22752. * _.map(users, 'user');
  22753. * // => ['barney', 'fred']
  22754. */
  22755. function map(collection, iteratee) {
  22756. var func = isArray(collection) ? arrayMap : baseMap;
  22757. return func(collection, getIteratee(iteratee, 3));
  22758. }
  22759. /**
  22760. * This method is like `_.sortBy` except that it allows specifying the sort
  22761. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  22762. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  22763. * descending or "asc" for ascending sort order of corresponding values.
  22764. *
  22765. * @static
  22766. * @memberOf _
  22767. * @since 4.0.0
  22768. * @category Collection
  22769. * @param {Array|Object} collection The collection to iterate over.
  22770. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  22771. * The iteratees to sort by.
  22772. * @param {string[]} [orders] The sort orders of `iteratees`.
  22773. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  22774. * @returns {Array} Returns the new sorted array.
  22775. * @example
  22776. *
  22777. * var users = [
  22778. * { 'user': 'fred', 'age': 48 },
  22779. * { 'user': 'barney', 'age': 34 },
  22780. * { 'user': 'fred', 'age': 40 },
  22781. * { 'user': 'barney', 'age': 36 }
  22782. * ];
  22783. *
  22784. * // Sort by `user` in ascending order and by `age` in descending order.
  22785. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  22786. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  22787. */
  22788. function orderBy(collection, iteratees, orders, guard) {
  22789. if (collection == null) {
  22790. return [];
  22791. }
  22792. if (!isArray(iteratees)) {
  22793. iteratees = iteratees == null ? [] : [iteratees];
  22794. }
  22795. orders = guard ? undefined : orders;
  22796. if (!isArray(orders)) {
  22797. orders = orders == null ? [] : [orders];
  22798. }
  22799. return baseOrderBy(collection, iteratees, orders);
  22800. }
  22801. /**
  22802. * Creates an array of elements split into two groups, the first of which
  22803. * contains elements `predicate` returns truthy for, the second of which
  22804. * contains elements `predicate` returns falsey for. The predicate is
  22805. * invoked with one argument: (value).
  22806. *
  22807. * @static
  22808. * @memberOf _
  22809. * @since 3.0.0
  22810. * @category Collection
  22811. * @param {Array|Object} collection The collection to iterate over.
  22812. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22813. * @returns {Array} Returns the array of grouped elements.
  22814. * @example
  22815. *
  22816. * var users = [
  22817. * { 'user': 'barney', 'age': 36, 'active': false },
  22818. * { 'user': 'fred', 'age': 40, 'active': true },
  22819. * { 'user': 'pebbles', 'age': 1, 'active': false }
  22820. * ];
  22821. *
  22822. * _.partition(users, function(o) { return o.active; });
  22823. * // => objects for [['fred'], ['barney', 'pebbles']]
  22824. *
  22825. * // The `_.matches` iteratee shorthand.
  22826. * _.partition(users, { 'age': 1, 'active': false });
  22827. * // => objects for [['pebbles'], ['barney', 'fred']]
  22828. *
  22829. * // The `_.matchesProperty` iteratee shorthand.
  22830. * _.partition(users, ['active', false]);
  22831. * // => objects for [['barney', 'pebbles'], ['fred']]
  22832. *
  22833. * // The `_.property` iteratee shorthand.
  22834. * _.partition(users, 'active');
  22835. * // => objects for [['fred'], ['barney', 'pebbles']]
  22836. */
  22837. var partition = createAggregator(function(result, value, key) {
  22838. result[key ? 0 : 1].push(value);
  22839. }, function() { return [[], []]; });
  22840. /**
  22841. * Reduces `collection` to a value which is the accumulated result of running
  22842. * each element in `collection` thru `iteratee`, where each successive
  22843. * invocation is supplied the return value of the previous. If `accumulator`
  22844. * is not given, the first element of `collection` is used as the initial
  22845. * value. The iteratee is invoked with four arguments:
  22846. * (accumulator, value, index|key, collection).
  22847. *
  22848. * Many lodash methods are guarded to work as iteratees for methods like
  22849. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  22850. *
  22851. * The guarded methods are:
  22852. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  22853. * and `sortBy`
  22854. *
  22855. * @static
  22856. * @memberOf _
  22857. * @since 0.1.0
  22858. * @category Collection
  22859. * @param {Array|Object} collection The collection to iterate over.
  22860. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22861. * @param {*} [accumulator] The initial value.
  22862. * @returns {*} Returns the accumulated value.
  22863. * @see _.reduceRight
  22864. * @example
  22865. *
  22866. * _.reduce([1, 2], function(sum, n) {
  22867. * return sum + n;
  22868. * }, 0);
  22869. * // => 3
  22870. *
  22871. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  22872. * (result[value] || (result[value] = [])).push(key);
  22873. * return result;
  22874. * }, {});
  22875. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  22876. */
  22877. function reduce(collection, iteratee, accumulator) {
  22878. var func = isArray(collection) ? arrayReduce : baseReduce,
  22879. initAccum = arguments.length < 3;
  22880. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  22881. }
  22882. /**
  22883. * This method is like `_.reduce` except that it iterates over elements of
  22884. * `collection` from right to left.
  22885. *
  22886. * @static
  22887. * @memberOf _
  22888. * @since 0.1.0
  22889. * @category Collection
  22890. * @param {Array|Object} collection The collection to iterate over.
  22891. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22892. * @param {*} [accumulator] The initial value.
  22893. * @returns {*} Returns the accumulated value.
  22894. * @see _.reduce
  22895. * @example
  22896. *
  22897. * var array = [[0, 1], [2, 3], [4, 5]];
  22898. *
  22899. * _.reduceRight(array, function(flattened, other) {
  22900. * return flattened.concat(other);
  22901. * }, []);
  22902. * // => [4, 5, 2, 3, 0, 1]
  22903. */
  22904. function reduceRight(collection, iteratee, accumulator) {
  22905. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  22906. initAccum = arguments.length < 3;
  22907. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  22908. }
  22909. /**
  22910. * The opposite of `_.filter`; this method returns the elements of `collection`
  22911. * that `predicate` does **not** return truthy for.
  22912. *
  22913. * @static
  22914. * @memberOf _
  22915. * @since 0.1.0
  22916. * @category Collection
  22917. * @param {Array|Object} collection The collection to iterate over.
  22918. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22919. * @returns {Array} Returns the new filtered array.
  22920. * @see _.filter
  22921. * @example
  22922. *
  22923. * var users = [
  22924. * { 'user': 'barney', 'age': 36, 'active': false },
  22925. * { 'user': 'fred', 'age': 40, 'active': true }
  22926. * ];
  22927. *
  22928. * _.reject(users, function(o) { return !o.active; });
  22929. * // => objects for ['fred']
  22930. *
  22931. * // The `_.matches` iteratee shorthand.
  22932. * _.reject(users, { 'age': 40, 'active': true });
  22933. * // => objects for ['barney']
  22934. *
  22935. * // The `_.matchesProperty` iteratee shorthand.
  22936. * _.reject(users, ['active', false]);
  22937. * // => objects for ['fred']
  22938. *
  22939. * // The `_.property` iteratee shorthand.
  22940. * _.reject(users, 'active');
  22941. * // => objects for ['barney']
  22942. */
  22943. function reject(collection, predicate) {
  22944. var func = isArray(collection) ? arrayFilter : baseFilter;
  22945. return func(collection, negate(getIteratee(predicate, 3)));
  22946. }
  22947. /**
  22948. * Gets a random element from `collection`.
  22949. *
  22950. * @static
  22951. * @memberOf _
  22952. * @since 2.0.0
  22953. * @category Collection
  22954. * @param {Array|Object} collection The collection to sample.
  22955. * @returns {*} Returns the random element.
  22956. * @example
  22957. *
  22958. * _.sample([1, 2, 3, 4]);
  22959. * // => 2
  22960. */
  22961. function sample(collection) {
  22962. var func = isArray(collection) ? arraySample : baseSample;
  22963. return func(collection);
  22964. }
  22965. /**
  22966. * Gets `n` random elements at unique keys from `collection` up to the
  22967. * size of `collection`.
  22968. *
  22969. * @static
  22970. * @memberOf _
  22971. * @since 4.0.0
  22972. * @category Collection
  22973. * @param {Array|Object} collection The collection to sample.
  22974. * @param {number} [n=1] The number of elements to sample.
  22975. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22976. * @returns {Array} Returns the random elements.
  22977. * @example
  22978. *
  22979. * _.sampleSize([1, 2, 3], 2);
  22980. * // => [3, 1]
  22981. *
  22982. * _.sampleSize([1, 2, 3], 4);
  22983. * // => [2, 3, 1]
  22984. */
  22985. function sampleSize(collection, n, guard) {
  22986. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  22987. n = 1;
  22988. } else {
  22989. n = toInteger(n);
  22990. }
  22991. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  22992. return func(collection, n);
  22993. }
  22994. /**
  22995. * Creates an array of shuffled values, using a version of the
  22996. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  22997. *
  22998. * @static
  22999. * @memberOf _
  23000. * @since 0.1.0
  23001. * @category Collection
  23002. * @param {Array|Object} collection The collection to shuffle.
  23003. * @returns {Array} Returns the new shuffled array.
  23004. * @example
  23005. *
  23006. * _.shuffle([1, 2, 3, 4]);
  23007. * // => [4, 1, 3, 2]
  23008. */
  23009. function shuffle(collection) {
  23010. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  23011. return func(collection);
  23012. }
  23013. /**
  23014. * Gets the size of `collection` by returning its length for array-like
  23015. * values or the number of own enumerable string keyed properties for objects.
  23016. *
  23017. * @static
  23018. * @memberOf _
  23019. * @since 0.1.0
  23020. * @category Collection
  23021. * @param {Array|Object|string} collection The collection to inspect.
  23022. * @returns {number} Returns the collection size.
  23023. * @example
  23024. *
  23025. * _.size([1, 2, 3]);
  23026. * // => 3
  23027. *
  23028. * _.size({ 'a': 1, 'b': 2 });
  23029. * // => 2
  23030. *
  23031. * _.size('pebbles');
  23032. * // => 7
  23033. */
  23034. function size(collection) {
  23035. if (collection == null) {
  23036. return 0;
  23037. }
  23038. if (isArrayLike(collection)) {
  23039. return isString(collection) ? stringSize(collection) : collection.length;
  23040. }
  23041. var tag = getTag(collection);
  23042. if (tag == mapTag || tag == setTag) {
  23043. return collection.size;
  23044. }
  23045. return baseKeys(collection).length;
  23046. }
  23047. /**
  23048. * Checks if `predicate` returns truthy for **any** element of `collection`.
  23049. * Iteration is stopped once `predicate` returns truthy. The predicate is
  23050. * invoked with three arguments: (value, index|key, collection).
  23051. *
  23052. * @static
  23053. * @memberOf _
  23054. * @since 0.1.0
  23055. * @category Collection
  23056. * @param {Array|Object} collection The collection to iterate over.
  23057. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  23058. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23059. * @returns {boolean} Returns `true` if any element passes the predicate check,
  23060. * else `false`.
  23061. * @example
  23062. *
  23063. * _.some([null, 0, 'yes', false], Boolean);
  23064. * // => true
  23065. *
  23066. * var users = [
  23067. * { 'user': 'barney', 'active': true },
  23068. * { 'user': 'fred', 'active': false }
  23069. * ];
  23070. *
  23071. * // The `_.matches` iteratee shorthand.
  23072. * _.some(users, { 'user': 'barney', 'active': false });
  23073. * // => false
  23074. *
  23075. * // The `_.matchesProperty` iteratee shorthand.
  23076. * _.some(users, ['active', false]);
  23077. * // => true
  23078. *
  23079. * // The `_.property` iteratee shorthand.
  23080. * _.some(users, 'active');
  23081. * // => true
  23082. */
  23083. function some(collection, predicate, guard) {
  23084. var func = isArray(collection) ? arraySome : baseSome;
  23085. if (guard && isIterateeCall(collection, predicate, guard)) {
  23086. predicate = undefined;
  23087. }
  23088. return func(collection, getIteratee(predicate, 3));
  23089. }
  23090. /**
  23091. * Creates an array of elements, sorted in ascending order by the results of
  23092. * running each element in a collection thru each iteratee. This method
  23093. * performs a stable sort, that is, it preserves the original sort order of
  23094. * equal elements. The iteratees are invoked with one argument: (value).
  23095. *
  23096. * @static
  23097. * @memberOf _
  23098. * @since 0.1.0
  23099. * @category Collection
  23100. * @param {Array|Object} collection The collection to iterate over.
  23101. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  23102. * The iteratees to sort by.
  23103. * @returns {Array} Returns the new sorted array.
  23104. * @example
  23105. *
  23106. * var users = [
  23107. * { 'user': 'fred', 'age': 48 },
  23108. * { 'user': 'barney', 'age': 36 },
  23109. * { 'user': 'fred', 'age': 40 },
  23110. * { 'user': 'barney', 'age': 34 }
  23111. * ];
  23112. *
  23113. * _.sortBy(users, [function(o) { return o.user; }]);
  23114. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  23115. *
  23116. * _.sortBy(users, ['user', 'age']);
  23117. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  23118. */
  23119. var sortBy = baseRest(function(collection, iteratees) {
  23120. if (collection == null) {
  23121. return [];
  23122. }
  23123. var length = iteratees.length;
  23124. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  23125. iteratees = [];
  23126. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  23127. iteratees = [iteratees[0]];
  23128. }
  23129. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  23130. });
  23131. /*------------------------------------------------------------------------*/
  23132. /**
  23133. * Gets the timestamp of the number of milliseconds that have elapsed since
  23134. * the Unix epoch (1 January 1970 00:00:00 UTC).
  23135. *
  23136. * @static
  23137. * @memberOf _
  23138. * @since 2.4.0
  23139. * @category Date
  23140. * @returns {number} Returns the timestamp.
  23141. * @example
  23142. *
  23143. * _.defer(function(stamp) {
  23144. * console.log(_.now() - stamp);
  23145. * }, _.now());
  23146. * // => Logs the number of milliseconds it took for the deferred invocation.
  23147. */
  23148. var now = ctxNow || function() {
  23149. return root.Date.now();
  23150. };
  23151. /*------------------------------------------------------------------------*/
  23152. /**
  23153. * The opposite of `_.before`; this method creates a function that invokes
  23154. * `func` once it's called `n` or more times.
  23155. *
  23156. * @static
  23157. * @memberOf _
  23158. * @since 0.1.0
  23159. * @category Function
  23160. * @param {number} n The number of calls before `func` is invoked.
  23161. * @param {Function} func The function to restrict.
  23162. * @returns {Function} Returns the new restricted function.
  23163. * @example
  23164. *
  23165. * var saves = ['profile', 'settings'];
  23166. *
  23167. * var done = _.after(saves.length, function() {
  23168. * console.log('done saving!');
  23169. * });
  23170. *
  23171. * _.forEach(saves, function(type) {
  23172. * asyncSave({ 'type': type, 'complete': done });
  23173. * });
  23174. * // => Logs 'done saving!' after the two async saves have completed.
  23175. */
  23176. function after(n, func) {
  23177. if (typeof func != 'function') {
  23178. throw new TypeError(FUNC_ERROR_TEXT);
  23179. }
  23180. n = toInteger(n);
  23181. return function() {
  23182. if (--n < 1) {
  23183. return func.apply(this, arguments);
  23184. }
  23185. };
  23186. }
  23187. /**
  23188. * Creates a function that invokes `func`, with up to `n` arguments,
  23189. * ignoring any additional arguments.
  23190. *
  23191. * @static
  23192. * @memberOf _
  23193. * @since 3.0.0
  23194. * @category Function
  23195. * @param {Function} func The function to cap arguments for.
  23196. * @param {number} [n=func.length] The arity cap.
  23197. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23198. * @returns {Function} Returns the new capped function.
  23199. * @example
  23200. *
  23201. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  23202. * // => [6, 8, 10]
  23203. */
  23204. function ary(func, n, guard) {
  23205. n = guard ? undefined : n;
  23206. n = (func && n == null) ? func.length : n;
  23207. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  23208. }
  23209. /**
  23210. * Creates a function that invokes `func`, with the `this` binding and arguments
  23211. * of the created function, while it's called less than `n` times. Subsequent
  23212. * calls to the created function return the result of the last `func` invocation.
  23213. *
  23214. * @static
  23215. * @memberOf _
  23216. * @since 3.0.0
  23217. * @category Function
  23218. * @param {number} n The number of calls at which `func` is no longer invoked.
  23219. * @param {Function} func The function to restrict.
  23220. * @returns {Function} Returns the new restricted function.
  23221. * @example
  23222. *
  23223. * jQuery(element).on('click', _.before(5, addContactToList));
  23224. * // => Allows adding up to 4 contacts to the list.
  23225. */
  23226. function before(n, func) {
  23227. var result;
  23228. if (typeof func != 'function') {
  23229. throw new TypeError(FUNC_ERROR_TEXT);
  23230. }
  23231. n = toInteger(n);
  23232. return function() {
  23233. if (--n > 0) {
  23234. result = func.apply(this, arguments);
  23235. }
  23236. if (n <= 1) {
  23237. func = undefined;
  23238. }
  23239. return result;
  23240. };
  23241. }
  23242. /**
  23243. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  23244. * and `partials` prepended to the arguments it receives.
  23245. *
  23246. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  23247. * may be used as a placeholder for partially applied arguments.
  23248. *
  23249. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  23250. * property of bound functions.
  23251. *
  23252. * @static
  23253. * @memberOf _
  23254. * @since 0.1.0
  23255. * @category Function
  23256. * @param {Function} func The function to bind.
  23257. * @param {*} thisArg The `this` binding of `func`.
  23258. * @param {...*} [partials] The arguments to be partially applied.
  23259. * @returns {Function} Returns the new bound function.
  23260. * @example
  23261. *
  23262. * function greet(greeting, punctuation) {
  23263. * return greeting + ' ' + this.user + punctuation;
  23264. * }
  23265. *
  23266. * var object = { 'user': 'fred' };
  23267. *
  23268. * var bound = _.bind(greet, object, 'hi');
  23269. * bound('!');
  23270. * // => 'hi fred!'
  23271. *
  23272. * // Bound with placeholders.
  23273. * var bound = _.bind(greet, object, _, '!');
  23274. * bound('hi');
  23275. * // => 'hi fred!'
  23276. */
  23277. var bind = baseRest(function(func, thisArg, partials) {
  23278. var bitmask = WRAP_BIND_FLAG;
  23279. if (partials.length) {
  23280. var holders = replaceHolders(partials, getHolder(bind));
  23281. bitmask |= WRAP_PARTIAL_FLAG;
  23282. }
  23283. return createWrap(func, bitmask, thisArg, partials, holders);
  23284. });
  23285. /**
  23286. * Creates a function that invokes the method at `object[key]` with `partials`
  23287. * prepended to the arguments it receives.
  23288. *
  23289. * This method differs from `_.bind` by allowing bound functions to reference
  23290. * methods that may be redefined or don't yet exist. See
  23291. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  23292. * for more details.
  23293. *
  23294. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  23295. * builds, may be used as a placeholder for partially applied arguments.
  23296. *
  23297. * @static
  23298. * @memberOf _
  23299. * @since 0.10.0
  23300. * @category Function
  23301. * @param {Object} object The object to invoke the method on.
  23302. * @param {string} key The key of the method.
  23303. * @param {...*} [partials] The arguments to be partially applied.
  23304. * @returns {Function} Returns the new bound function.
  23305. * @example
  23306. *
  23307. * var object = {
  23308. * 'user': 'fred',
  23309. * 'greet': function(greeting, punctuation) {
  23310. * return greeting + ' ' + this.user + punctuation;
  23311. * }
  23312. * };
  23313. *
  23314. * var bound = _.bindKey(object, 'greet', 'hi');
  23315. * bound('!');
  23316. * // => 'hi fred!'
  23317. *
  23318. * object.greet = function(greeting, punctuation) {
  23319. * return greeting + 'ya ' + this.user + punctuation;
  23320. * };
  23321. *
  23322. * bound('!');
  23323. * // => 'hiya fred!'
  23324. *
  23325. * // Bound with placeholders.
  23326. * var bound = _.bindKey(object, 'greet', _, '!');
  23327. * bound('hi');
  23328. * // => 'hiya fred!'
  23329. */
  23330. var bindKey = baseRest(function(object, key, partials) {
  23331. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  23332. if (partials.length) {
  23333. var holders = replaceHolders(partials, getHolder(bindKey));
  23334. bitmask |= WRAP_PARTIAL_FLAG;
  23335. }
  23336. return createWrap(key, bitmask, object, partials, holders);
  23337. });
  23338. /**
  23339. * Creates a function that accepts arguments of `func` and either invokes
  23340. * `func` returning its result, if at least `arity` number of arguments have
  23341. * been provided, or returns a function that accepts the remaining `func`
  23342. * arguments, and so on. The arity of `func` may be specified if `func.length`
  23343. * is not sufficient.
  23344. *
  23345. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  23346. * may be used as a placeholder for provided arguments.
  23347. *
  23348. * **Note:** This method doesn't set the "length" property of curried functions.
  23349. *
  23350. * @static
  23351. * @memberOf _
  23352. * @since 2.0.0
  23353. * @category Function
  23354. * @param {Function} func The function to curry.
  23355. * @param {number} [arity=func.length] The arity of `func`.
  23356. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23357. * @returns {Function} Returns the new curried function.
  23358. * @example
  23359. *
  23360. * var abc = function(a, b, c) {
  23361. * return [a, b, c];
  23362. * };
  23363. *
  23364. * var curried = _.curry(abc);
  23365. *
  23366. * curried(1)(2)(3);
  23367. * // => [1, 2, 3]
  23368. *
  23369. * curried(1, 2)(3);
  23370. * // => [1, 2, 3]
  23371. *
  23372. * curried(1, 2, 3);
  23373. * // => [1, 2, 3]
  23374. *
  23375. * // Curried with placeholders.
  23376. * curried(1)(_, 3)(2);
  23377. * // => [1, 2, 3]
  23378. */
  23379. function curry(func, arity, guard) {
  23380. arity = guard ? undefined : arity;
  23381. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  23382. result.placeholder = curry.placeholder;
  23383. return result;
  23384. }
  23385. /**
  23386. * This method is like `_.curry` except that arguments are applied to `func`
  23387. * in the manner of `_.partialRight` instead of `_.partial`.
  23388. *
  23389. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  23390. * builds, may be used as a placeholder for provided arguments.
  23391. *
  23392. * **Note:** This method doesn't set the "length" property of curried functions.
  23393. *
  23394. * @static
  23395. * @memberOf _
  23396. * @since 3.0.0
  23397. * @category Function
  23398. * @param {Function} func The function to curry.
  23399. * @param {number} [arity=func.length] The arity of `func`.
  23400. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23401. * @returns {Function} Returns the new curried function.
  23402. * @example
  23403. *
  23404. * var abc = function(a, b, c) {
  23405. * return [a, b, c];
  23406. * };
  23407. *
  23408. * var curried = _.curryRight(abc);
  23409. *
  23410. * curried(3)(2)(1);
  23411. * // => [1, 2, 3]
  23412. *
  23413. * curried(2, 3)(1);
  23414. * // => [1, 2, 3]
  23415. *
  23416. * curried(1, 2, 3);
  23417. * // => [1, 2, 3]
  23418. *
  23419. * // Curried with placeholders.
  23420. * curried(3)(1, _)(2);
  23421. * // => [1, 2, 3]
  23422. */
  23423. function curryRight(func, arity, guard) {
  23424. arity = guard ? undefined : arity;
  23425. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  23426. result.placeholder = curryRight.placeholder;
  23427. return result;
  23428. }
  23429. /**
  23430. * Creates a debounced function that delays invoking `func` until after `wait`
  23431. * milliseconds have elapsed since the last time the debounced function was
  23432. * invoked. The debounced function comes with a `cancel` method to cancel
  23433. * delayed `func` invocations and a `flush` method to immediately invoke them.
  23434. * Provide `options` to indicate whether `func` should be invoked on the
  23435. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  23436. * with the last arguments provided to the debounced function. Subsequent
  23437. * calls to the debounced function return the result of the last `func`
  23438. * invocation.
  23439. *
  23440. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  23441. * invoked on the trailing edge of the timeout only if the debounced function
  23442. * is invoked more than once during the `wait` timeout.
  23443. *
  23444. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  23445. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  23446. *
  23447. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  23448. * for details over the differences between `_.debounce` and `_.throttle`.
  23449. *
  23450. * @static
  23451. * @memberOf _
  23452. * @since 0.1.0
  23453. * @category Function
  23454. * @param {Function} func The function to debounce.
  23455. * @param {number} [wait=0] The number of milliseconds to delay.
  23456. * @param {Object} [options={}] The options object.
  23457. * @param {boolean} [options.leading=false]
  23458. * Specify invoking on the leading edge of the timeout.
  23459. * @param {number} [options.maxWait]
  23460. * The maximum time `func` is allowed to be delayed before it's invoked.
  23461. * @param {boolean} [options.trailing=true]
  23462. * Specify invoking on the trailing edge of the timeout.
  23463. * @returns {Function} Returns the new debounced function.
  23464. * @example
  23465. *
  23466. * // Avoid costly calculations while the window size is in flux.
  23467. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  23468. *
  23469. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  23470. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  23471. * 'leading': true,
  23472. * 'trailing': false
  23473. * }));
  23474. *
  23475. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  23476. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  23477. * var source = new EventSource('/stream');
  23478. * jQuery(source).on('message', debounced);
  23479. *
  23480. * // Cancel the trailing debounced invocation.
  23481. * jQuery(window).on('popstate', debounced.cancel);
  23482. */
  23483. function debounce(func, wait, options) {
  23484. var lastArgs,
  23485. lastThis,
  23486. maxWait,
  23487. result,
  23488. timerId,
  23489. lastCallTime,
  23490. lastInvokeTime = 0,
  23491. leading = false,
  23492. maxing = false,
  23493. trailing = true;
  23494. if (typeof func != 'function') {
  23495. throw new TypeError(FUNC_ERROR_TEXT);
  23496. }
  23497. wait = toNumber(wait) || 0;
  23498. if (isObject(options)) {
  23499. leading = !!options.leading;
  23500. maxing = 'maxWait' in options;
  23501. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  23502. trailing = 'trailing' in options ? !!options.trailing : trailing;
  23503. }
  23504. function invokeFunc(time) {
  23505. var args = lastArgs,
  23506. thisArg = lastThis;
  23507. lastArgs = lastThis = undefined;
  23508. lastInvokeTime = time;
  23509. result = func.apply(thisArg, args);
  23510. return result;
  23511. }
  23512. function leadingEdge(time) {
  23513. // Reset any `maxWait` timer.
  23514. lastInvokeTime = time;
  23515. // Start the timer for the trailing edge.
  23516. timerId = setTimeout(timerExpired, wait);
  23517. // Invoke the leading edge.
  23518. return leading ? invokeFunc(time) : result;
  23519. }
  23520. function remainingWait(time) {
  23521. var timeSinceLastCall = time - lastCallTime,
  23522. timeSinceLastInvoke = time - lastInvokeTime,
  23523. timeWaiting = wait - timeSinceLastCall;
  23524. return maxing
  23525. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  23526. : timeWaiting;
  23527. }
  23528. function shouldInvoke(time) {
  23529. var timeSinceLastCall = time - lastCallTime,
  23530. timeSinceLastInvoke = time - lastInvokeTime;
  23531. // Either this is the first call, activity has stopped and we're at the
  23532. // trailing edge, the system time has gone backwards and we're treating
  23533. // it as the trailing edge, or we've hit the `maxWait` limit.
  23534. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  23535. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  23536. }
  23537. function timerExpired() {
  23538. var time = now();
  23539. if (shouldInvoke(time)) {
  23540. return trailingEdge(time);
  23541. }
  23542. // Restart the timer.
  23543. timerId = setTimeout(timerExpired, remainingWait(time));
  23544. }
  23545. function trailingEdge(time) {
  23546. timerId = undefined;
  23547. // Only invoke if we have `lastArgs` which means `func` has been
  23548. // debounced at least once.
  23549. if (trailing && lastArgs) {
  23550. return invokeFunc(time);
  23551. }
  23552. lastArgs = lastThis = undefined;
  23553. return result;
  23554. }
  23555. function cancel() {
  23556. if (timerId !== undefined) {
  23557. clearTimeout(timerId);
  23558. }
  23559. lastInvokeTime = 0;
  23560. lastArgs = lastCallTime = lastThis = timerId = undefined;
  23561. }
  23562. function flush() {
  23563. return timerId === undefined ? result : trailingEdge(now());
  23564. }
  23565. function debounced() {
  23566. var time = now(),
  23567. isInvoking = shouldInvoke(time);
  23568. lastArgs = arguments;
  23569. lastThis = this;
  23570. lastCallTime = time;
  23571. if (isInvoking) {
  23572. if (timerId === undefined) {
  23573. return leadingEdge(lastCallTime);
  23574. }
  23575. if (maxing) {
  23576. // Handle invocations in a tight loop.
  23577. clearTimeout(timerId);
  23578. timerId = setTimeout(timerExpired, wait);
  23579. return invokeFunc(lastCallTime);
  23580. }
  23581. }
  23582. if (timerId === undefined) {
  23583. timerId = setTimeout(timerExpired, wait);
  23584. }
  23585. return result;
  23586. }
  23587. debounced.cancel = cancel;
  23588. debounced.flush = flush;
  23589. return debounced;
  23590. }
  23591. /**
  23592. * Defers invoking the `func` until the current call stack has cleared. Any
  23593. * additional arguments are provided to `func` when it's invoked.
  23594. *
  23595. * @static
  23596. * @memberOf _
  23597. * @since 0.1.0
  23598. * @category Function
  23599. * @param {Function} func The function to defer.
  23600. * @param {...*} [args] The arguments to invoke `func` with.
  23601. * @returns {number} Returns the timer id.
  23602. * @example
  23603. *
  23604. * _.defer(function(text) {
  23605. * console.log(text);
  23606. * }, 'deferred');
  23607. * // => Logs 'deferred' after one millisecond.
  23608. */
  23609. var defer = baseRest(function(func, args) {
  23610. return baseDelay(func, 1, args);
  23611. });
  23612. /**
  23613. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  23614. * provided to `func` when it's invoked.
  23615. *
  23616. * @static
  23617. * @memberOf _
  23618. * @since 0.1.0
  23619. * @category Function
  23620. * @param {Function} func The function to delay.
  23621. * @param {number} wait The number of milliseconds to delay invocation.
  23622. * @param {...*} [args] The arguments to invoke `func` with.
  23623. * @returns {number} Returns the timer id.
  23624. * @example
  23625. *
  23626. * _.delay(function(text) {
  23627. * console.log(text);
  23628. * }, 1000, 'later');
  23629. * // => Logs 'later' after one second.
  23630. */
  23631. var delay = baseRest(function(func, wait, args) {
  23632. return baseDelay(func, toNumber(wait) || 0, args);
  23633. });
  23634. /**
  23635. * Creates a function that invokes `func` with arguments reversed.
  23636. *
  23637. * @static
  23638. * @memberOf _
  23639. * @since 4.0.0
  23640. * @category Function
  23641. * @param {Function} func The function to flip arguments for.
  23642. * @returns {Function} Returns the new flipped function.
  23643. * @example
  23644. *
  23645. * var flipped = _.flip(function() {
  23646. * return _.toArray(arguments);
  23647. * });
  23648. *
  23649. * flipped('a', 'b', 'c', 'd');
  23650. * // => ['d', 'c', 'b', 'a']
  23651. */
  23652. function flip(func) {
  23653. return createWrap(func, WRAP_FLIP_FLAG);
  23654. }
  23655. /**
  23656. * Creates a function that memoizes the result of `func`. If `resolver` is
  23657. * provided, it determines the cache key for storing the result based on the
  23658. * arguments provided to the memoized function. By default, the first argument
  23659. * provided to the memoized function is used as the map cache key. The `func`
  23660. * is invoked with the `this` binding of the memoized function.
  23661. *
  23662. * **Note:** The cache is exposed as the `cache` property on the memoized
  23663. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  23664. * constructor with one whose instances implement the
  23665. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  23666. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  23667. *
  23668. * @static
  23669. * @memberOf _
  23670. * @since 0.1.0
  23671. * @category Function
  23672. * @param {Function} func The function to have its output memoized.
  23673. * @param {Function} [resolver] The function to resolve the cache key.
  23674. * @returns {Function} Returns the new memoized function.
  23675. * @example
  23676. *
  23677. * var object = { 'a': 1, 'b': 2 };
  23678. * var other = { 'c': 3, 'd': 4 };
  23679. *
  23680. * var values = _.memoize(_.values);
  23681. * values(object);
  23682. * // => [1, 2]
  23683. *
  23684. * values(other);
  23685. * // => [3, 4]
  23686. *
  23687. * object.a = 2;
  23688. * values(object);
  23689. * // => [1, 2]
  23690. *
  23691. * // Modify the result cache.
  23692. * values.cache.set(object, ['a', 'b']);
  23693. * values(object);
  23694. * // => ['a', 'b']
  23695. *
  23696. * // Replace `_.memoize.Cache`.
  23697. * _.memoize.Cache = WeakMap;
  23698. */
  23699. function memoize(func, resolver) {
  23700. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  23701. throw new TypeError(FUNC_ERROR_TEXT);
  23702. }
  23703. var memoized = function() {
  23704. var args = arguments,
  23705. key = resolver ? resolver.apply(this, args) : args[0],
  23706. cache = memoized.cache;
  23707. if (cache.has(key)) {
  23708. return cache.get(key);
  23709. }
  23710. var result = func.apply(this, args);
  23711. memoized.cache = cache.set(key, result) || cache;
  23712. return result;
  23713. };
  23714. memoized.cache = new (memoize.Cache || MapCache);
  23715. return memoized;
  23716. }
  23717. // Expose `MapCache`.
  23718. memoize.Cache = MapCache;
  23719. /**
  23720. * Creates a function that negates the result of the predicate `func`. The
  23721. * `func` predicate is invoked with the `this` binding and arguments of the
  23722. * created function.
  23723. *
  23724. * @static
  23725. * @memberOf _
  23726. * @since 3.0.0
  23727. * @category Function
  23728. * @param {Function} predicate The predicate to negate.
  23729. * @returns {Function} Returns the new negated function.
  23730. * @example
  23731. *
  23732. * function isEven(n) {
  23733. * return n % 2 == 0;
  23734. * }
  23735. *
  23736. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  23737. * // => [1, 3, 5]
  23738. */
  23739. function negate(predicate) {
  23740. if (typeof predicate != 'function') {
  23741. throw new TypeError(FUNC_ERROR_TEXT);
  23742. }
  23743. return function() {
  23744. var args = arguments;
  23745. switch (args.length) {
  23746. case 0: return !predicate.call(this);
  23747. case 1: return !predicate.call(this, args[0]);
  23748. case 2: return !predicate.call(this, args[0], args[1]);
  23749. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  23750. }
  23751. return !predicate.apply(this, args);
  23752. };
  23753. }
  23754. /**
  23755. * Creates a function that is restricted to invoking `func` once. Repeat calls
  23756. * to the function return the value of the first invocation. The `func` is
  23757. * invoked with the `this` binding and arguments of the created function.
  23758. *
  23759. * @static
  23760. * @memberOf _
  23761. * @since 0.1.0
  23762. * @category Function
  23763. * @param {Function} func The function to restrict.
  23764. * @returns {Function} Returns the new restricted function.
  23765. * @example
  23766. *
  23767. * var initialize = _.once(createApplication);
  23768. * initialize();
  23769. * initialize();
  23770. * // => `createApplication` is invoked once
  23771. */
  23772. function once(func) {
  23773. return before(2, func);
  23774. }
  23775. /**
  23776. * Creates a function that invokes `func` with its arguments transformed.
  23777. *
  23778. * @static
  23779. * @since 4.0.0
  23780. * @memberOf _
  23781. * @category Function
  23782. * @param {Function} func The function to wrap.
  23783. * @param {...(Function|Function[])} [transforms=[_.identity]]
  23784. * The argument transforms.
  23785. * @returns {Function} Returns the new function.
  23786. * @example
  23787. *
  23788. * function doubled(n) {
  23789. * return n * 2;
  23790. * }
  23791. *
  23792. * function square(n) {
  23793. * return n * n;
  23794. * }
  23795. *
  23796. * var func = _.overArgs(function(x, y) {
  23797. * return [x, y];
  23798. * }, [square, doubled]);
  23799. *
  23800. * func(9, 3);
  23801. * // => [81, 6]
  23802. *
  23803. * func(10, 5);
  23804. * // => [100, 10]
  23805. */
  23806. var overArgs = castRest(function(func, transforms) {
  23807. transforms = (transforms.length == 1 && isArray(transforms[0]))
  23808. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  23809. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  23810. var funcsLength = transforms.length;
  23811. return baseRest(function(args) {
  23812. var index = -1,
  23813. length = nativeMin(args.length, funcsLength);
  23814. while (++index < length) {
  23815. args[index] = transforms[index].call(this, args[index]);
  23816. }
  23817. return apply(func, this, args);
  23818. });
  23819. });
  23820. /**
  23821. * Creates a function that invokes `func` with `partials` prepended to the
  23822. * arguments it receives. This method is like `_.bind` except it does **not**
  23823. * alter the `this` binding.
  23824. *
  23825. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  23826. * builds, may be used as a placeholder for partially applied arguments.
  23827. *
  23828. * **Note:** This method doesn't set the "length" property of partially
  23829. * applied functions.
  23830. *
  23831. * @static
  23832. * @memberOf _
  23833. * @since 0.2.0
  23834. * @category Function
  23835. * @param {Function} func The function to partially apply arguments to.
  23836. * @param {...*} [partials] The arguments to be partially applied.
  23837. * @returns {Function} Returns the new partially applied function.
  23838. * @example
  23839. *
  23840. * function greet(greeting, name) {
  23841. * return greeting + ' ' + name;
  23842. * }
  23843. *
  23844. * var sayHelloTo = _.partial(greet, 'hello');
  23845. * sayHelloTo('fred');
  23846. * // => 'hello fred'
  23847. *
  23848. * // Partially applied with placeholders.
  23849. * var greetFred = _.partial(greet, _, 'fred');
  23850. * greetFred('hi');
  23851. * // => 'hi fred'
  23852. */
  23853. var partial = baseRest(function(func, partials) {
  23854. var holders = replaceHolders(partials, getHolder(partial));
  23855. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  23856. });
  23857. /**
  23858. * This method is like `_.partial` except that partially applied arguments
  23859. * are appended to the arguments it receives.
  23860. *
  23861. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  23862. * builds, may be used as a placeholder for partially applied arguments.
  23863. *
  23864. * **Note:** This method doesn't set the "length" property of partially
  23865. * applied functions.
  23866. *
  23867. * @static
  23868. * @memberOf _
  23869. * @since 1.0.0
  23870. * @category Function
  23871. * @param {Function} func The function to partially apply arguments to.
  23872. * @param {...*} [partials] The arguments to be partially applied.
  23873. * @returns {Function} Returns the new partially applied function.
  23874. * @example
  23875. *
  23876. * function greet(greeting, name) {
  23877. * return greeting + ' ' + name;
  23878. * }
  23879. *
  23880. * var greetFred = _.partialRight(greet, 'fred');
  23881. * greetFred('hi');
  23882. * // => 'hi fred'
  23883. *
  23884. * // Partially applied with placeholders.
  23885. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  23886. * sayHelloTo('fred');
  23887. * // => 'hello fred'
  23888. */
  23889. var partialRight = baseRest(function(func, partials) {
  23890. var holders = replaceHolders(partials, getHolder(partialRight));
  23891. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  23892. });
  23893. /**
  23894. * Creates a function that invokes `func` with arguments arranged according
  23895. * to the specified `indexes` where the argument value at the first index is
  23896. * provided as the first argument, the argument value at the second index is
  23897. * provided as the second argument, and so on.
  23898. *
  23899. * @static
  23900. * @memberOf _
  23901. * @since 3.0.0
  23902. * @category Function
  23903. * @param {Function} func The function to rearrange arguments for.
  23904. * @param {...(number|number[])} indexes The arranged argument indexes.
  23905. * @returns {Function} Returns the new function.
  23906. * @example
  23907. *
  23908. * var rearged = _.rearg(function(a, b, c) {
  23909. * return [a, b, c];
  23910. * }, [2, 0, 1]);
  23911. *
  23912. * rearged('b', 'c', 'a')
  23913. * // => ['a', 'b', 'c']
  23914. */
  23915. var rearg = flatRest(function(func, indexes) {
  23916. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  23917. });
  23918. /**
  23919. * Creates a function that invokes `func` with the `this` binding of the
  23920. * created function and arguments from `start` and beyond provided as
  23921. * an array.
  23922. *
  23923. * **Note:** This method is based on the
  23924. * [rest parameter](https://mdn.io/rest_parameters).
  23925. *
  23926. * @static
  23927. * @memberOf _
  23928. * @since 4.0.0
  23929. * @category Function
  23930. * @param {Function} func The function to apply a rest parameter to.
  23931. * @param {number} [start=func.length-1] The start position of the rest parameter.
  23932. * @returns {Function} Returns the new function.
  23933. * @example
  23934. *
  23935. * var say = _.rest(function(what, names) {
  23936. * return what + ' ' + _.initial(names).join(', ') +
  23937. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  23938. * });
  23939. *
  23940. * say('hello', 'fred', 'barney', 'pebbles');
  23941. * // => 'hello fred, barney, & pebbles'
  23942. */
  23943. function rest(func, start) {
  23944. if (typeof func != 'function') {
  23945. throw new TypeError(FUNC_ERROR_TEXT);
  23946. }
  23947. start = start === undefined ? start : toInteger(start);
  23948. return baseRest(func, start);
  23949. }
  23950. /**
  23951. * Creates a function that invokes `func` with the `this` binding of the
  23952. * create function and an array of arguments much like
  23953. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  23954. *
  23955. * **Note:** This method is based on the
  23956. * [spread operator](https://mdn.io/spread_operator).
  23957. *
  23958. * @static
  23959. * @memberOf _
  23960. * @since 3.2.0
  23961. * @category Function
  23962. * @param {Function} func The function to spread arguments over.
  23963. * @param {number} [start=0] The start position of the spread.
  23964. * @returns {Function} Returns the new function.
  23965. * @example
  23966. *
  23967. * var say = _.spread(function(who, what) {
  23968. * return who + ' says ' + what;
  23969. * });
  23970. *
  23971. * say(['fred', 'hello']);
  23972. * // => 'fred says hello'
  23973. *
  23974. * var numbers = Promise.all([
  23975. * Promise.resolve(40),
  23976. * Promise.resolve(36)
  23977. * ]);
  23978. *
  23979. * numbers.then(_.spread(function(x, y) {
  23980. * return x + y;
  23981. * }));
  23982. * // => a Promise of 76
  23983. */
  23984. function spread(func, start) {
  23985. if (typeof func != 'function') {
  23986. throw new TypeError(FUNC_ERROR_TEXT);
  23987. }
  23988. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  23989. return baseRest(function(args) {
  23990. var array = args[start],
  23991. otherArgs = castSlice(args, 0, start);
  23992. if (array) {
  23993. arrayPush(otherArgs, array);
  23994. }
  23995. return apply(func, this, otherArgs);
  23996. });
  23997. }
  23998. /**
  23999. * Creates a throttled function that only invokes `func` at most once per
  24000. * every `wait` milliseconds. The throttled function comes with a `cancel`
  24001. * method to cancel delayed `func` invocations and a `flush` method to
  24002. * immediately invoke them. Provide `options` to indicate whether `func`
  24003. * should be invoked on the leading and/or trailing edge of the `wait`
  24004. * timeout. The `func` is invoked with the last arguments provided to the
  24005. * throttled function. Subsequent calls to the throttled function return the
  24006. * result of the last `func` invocation.
  24007. *
  24008. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  24009. * invoked on the trailing edge of the timeout only if the throttled function
  24010. * is invoked more than once during the `wait` timeout.
  24011. *
  24012. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  24013. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  24014. *
  24015. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  24016. * for details over the differences between `_.throttle` and `_.debounce`.
  24017. *
  24018. * @static
  24019. * @memberOf _
  24020. * @since 0.1.0
  24021. * @category Function
  24022. * @param {Function} func The function to throttle.
  24023. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  24024. * @param {Object} [options={}] The options object.
  24025. * @param {boolean} [options.leading=true]
  24026. * Specify invoking on the leading edge of the timeout.
  24027. * @param {boolean} [options.trailing=true]
  24028. * Specify invoking on the trailing edge of the timeout.
  24029. * @returns {Function} Returns the new throttled function.
  24030. * @example
  24031. *
  24032. * // Avoid excessively updating the position while scrolling.
  24033. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  24034. *
  24035. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  24036. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  24037. * jQuery(element).on('click', throttled);
  24038. *
  24039. * // Cancel the trailing throttled invocation.
  24040. * jQuery(window).on('popstate', throttled.cancel);
  24041. */
  24042. function throttle(func, wait, options) {
  24043. var leading = true,
  24044. trailing = true;
  24045. if (typeof func != 'function') {
  24046. throw new TypeError(FUNC_ERROR_TEXT);
  24047. }
  24048. if (isObject(options)) {
  24049. leading = 'leading' in options ? !!options.leading : leading;
  24050. trailing = 'trailing' in options ? !!options.trailing : trailing;
  24051. }
  24052. return debounce(func, wait, {
  24053. 'leading': leading,
  24054. 'maxWait': wait,
  24055. 'trailing': trailing
  24056. });
  24057. }
  24058. /**
  24059. * Creates a function that accepts up to one argument, ignoring any
  24060. * additional arguments.
  24061. *
  24062. * @static
  24063. * @memberOf _
  24064. * @since 4.0.0
  24065. * @category Function
  24066. * @param {Function} func The function to cap arguments for.
  24067. * @returns {Function} Returns the new capped function.
  24068. * @example
  24069. *
  24070. * _.map(['6', '8', '10'], _.unary(parseInt));
  24071. * // => [6, 8, 10]
  24072. */
  24073. function unary(func) {
  24074. return ary(func, 1);
  24075. }
  24076. /**
  24077. * Creates a function that provides `value` to `wrapper` as its first
  24078. * argument. Any additional arguments provided to the function are appended
  24079. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  24080. * binding of the created function.
  24081. *
  24082. * @static
  24083. * @memberOf _
  24084. * @since 0.1.0
  24085. * @category Function
  24086. * @param {*} value The value to wrap.
  24087. * @param {Function} [wrapper=identity] The wrapper function.
  24088. * @returns {Function} Returns the new function.
  24089. * @example
  24090. *
  24091. * var p = _.wrap(_.escape, function(func, text) {
  24092. * return '<p>' + func(text) + '</p>';
  24093. * });
  24094. *
  24095. * p('fred, barney, & pebbles');
  24096. * // => '<p>fred, barney, &amp; pebbles</p>'
  24097. */
  24098. function wrap(value, wrapper) {
  24099. return partial(castFunction(wrapper), value);
  24100. }
  24101. /*------------------------------------------------------------------------*/
  24102. /**
  24103. * Casts `value` as an array if it's not one.
  24104. *
  24105. * @static
  24106. * @memberOf _
  24107. * @since 4.4.0
  24108. * @category Lang
  24109. * @param {*} value The value to inspect.
  24110. * @returns {Array} Returns the cast array.
  24111. * @example
  24112. *
  24113. * _.castArray(1);
  24114. * // => [1]
  24115. *
  24116. * _.castArray({ 'a': 1 });
  24117. * // => [{ 'a': 1 }]
  24118. *
  24119. * _.castArray('abc');
  24120. * // => ['abc']
  24121. *
  24122. * _.castArray(null);
  24123. * // => [null]
  24124. *
  24125. * _.castArray(undefined);
  24126. * // => [undefined]
  24127. *
  24128. * _.castArray();
  24129. * // => []
  24130. *
  24131. * var array = [1, 2, 3];
  24132. * console.log(_.castArray(array) === array);
  24133. * // => true
  24134. */
  24135. function castArray() {
  24136. if (!arguments.length) {
  24137. return [];
  24138. }
  24139. var value = arguments[0];
  24140. return isArray(value) ? value : [value];
  24141. }
  24142. /**
  24143. * Creates a shallow clone of `value`.
  24144. *
  24145. * **Note:** This method is loosely based on the
  24146. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  24147. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  24148. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  24149. * arrays. The own enumerable properties of `arguments` objects are cloned
  24150. * as plain objects. An empty object is returned for uncloneable values such
  24151. * as error objects, functions, DOM nodes, and WeakMaps.
  24152. *
  24153. * @static
  24154. * @memberOf _
  24155. * @since 0.1.0
  24156. * @category Lang
  24157. * @param {*} value The value to clone.
  24158. * @returns {*} Returns the cloned value.
  24159. * @see _.cloneDeep
  24160. * @example
  24161. *
  24162. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  24163. *
  24164. * var shallow = _.clone(objects);
  24165. * console.log(shallow[0] === objects[0]);
  24166. * // => true
  24167. */
  24168. function clone(value) {
  24169. return baseClone(value, CLONE_SYMBOLS_FLAG);
  24170. }
  24171. /**
  24172. * This method is like `_.clone` except that it accepts `customizer` which
  24173. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  24174. * cloning is handled by the method instead. The `customizer` is invoked with
  24175. * up to four arguments; (value [, index|key, object, stack]).
  24176. *
  24177. * @static
  24178. * @memberOf _
  24179. * @since 4.0.0
  24180. * @category Lang
  24181. * @param {*} value The value to clone.
  24182. * @param {Function} [customizer] The function to customize cloning.
  24183. * @returns {*} Returns the cloned value.
  24184. * @see _.cloneDeepWith
  24185. * @example
  24186. *
  24187. * function customizer(value) {
  24188. * if (_.isElement(value)) {
  24189. * return value.cloneNode(false);
  24190. * }
  24191. * }
  24192. *
  24193. * var el = _.cloneWith(document.body, customizer);
  24194. *
  24195. * console.log(el === document.body);
  24196. * // => false
  24197. * console.log(el.nodeName);
  24198. * // => 'BODY'
  24199. * console.log(el.childNodes.length);
  24200. * // => 0
  24201. */
  24202. function cloneWith(value, customizer) {
  24203. customizer = typeof customizer == 'function' ? customizer : undefined;
  24204. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  24205. }
  24206. /**
  24207. * This method is like `_.clone` except that it recursively clones `value`.
  24208. *
  24209. * @static
  24210. * @memberOf _
  24211. * @since 1.0.0
  24212. * @category Lang
  24213. * @param {*} value The value to recursively clone.
  24214. * @returns {*} Returns the deep cloned value.
  24215. * @see _.clone
  24216. * @example
  24217. *
  24218. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  24219. *
  24220. * var deep = _.cloneDeep(objects);
  24221. * console.log(deep[0] === objects[0]);
  24222. * // => false
  24223. */
  24224. function cloneDeep(value) {
  24225. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  24226. }
  24227. /**
  24228. * This method is like `_.cloneWith` except that it recursively clones `value`.
  24229. *
  24230. * @static
  24231. * @memberOf _
  24232. * @since 4.0.0
  24233. * @category Lang
  24234. * @param {*} value The value to recursively clone.
  24235. * @param {Function} [customizer] The function to customize cloning.
  24236. * @returns {*} Returns the deep cloned value.
  24237. * @see _.cloneWith
  24238. * @example
  24239. *
  24240. * function customizer(value) {
  24241. * if (_.isElement(value)) {
  24242. * return value.cloneNode(true);
  24243. * }
  24244. * }
  24245. *
  24246. * var el = _.cloneDeepWith(document.body, customizer);
  24247. *
  24248. * console.log(el === document.body);
  24249. * // => false
  24250. * console.log(el.nodeName);
  24251. * // => 'BODY'
  24252. * console.log(el.childNodes.length);
  24253. * // => 20
  24254. */
  24255. function cloneDeepWith(value, customizer) {
  24256. customizer = typeof customizer == 'function' ? customizer : undefined;
  24257. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  24258. }
  24259. /**
  24260. * Checks if `object` conforms to `source` by invoking the predicate
  24261. * properties of `source` with the corresponding property values of `object`.
  24262. *
  24263. * **Note:** This method is equivalent to `_.conforms` when `source` is
  24264. * partially applied.
  24265. *
  24266. * @static
  24267. * @memberOf _
  24268. * @since 4.14.0
  24269. * @category Lang
  24270. * @param {Object} object The object to inspect.
  24271. * @param {Object} source The object of property predicates to conform to.
  24272. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  24273. * @example
  24274. *
  24275. * var object = { 'a': 1, 'b': 2 };
  24276. *
  24277. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  24278. * // => true
  24279. *
  24280. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  24281. * // => false
  24282. */
  24283. function conformsTo(object, source) {
  24284. return source == null || baseConformsTo(object, source, keys(source));
  24285. }
  24286. /**
  24287. * Performs a
  24288. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24289. * comparison between two values to determine if they are equivalent.
  24290. *
  24291. * @static
  24292. * @memberOf _
  24293. * @since 4.0.0
  24294. * @category Lang
  24295. * @param {*} value The value to compare.
  24296. * @param {*} other The other value to compare.
  24297. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24298. * @example
  24299. *
  24300. * var object = { 'a': 1 };
  24301. * var other = { 'a': 1 };
  24302. *
  24303. * _.eq(object, object);
  24304. * // => true
  24305. *
  24306. * _.eq(object, other);
  24307. * // => false
  24308. *
  24309. * _.eq('a', 'a');
  24310. * // => true
  24311. *
  24312. * _.eq('a', Object('a'));
  24313. * // => false
  24314. *
  24315. * _.eq(NaN, NaN);
  24316. * // => true
  24317. */
  24318. function eq(value, other) {
  24319. return value === other || (value !== value && other !== other);
  24320. }
  24321. /**
  24322. * Checks if `value` is greater than `other`.
  24323. *
  24324. * @static
  24325. * @memberOf _
  24326. * @since 3.9.0
  24327. * @category Lang
  24328. * @param {*} value The value to compare.
  24329. * @param {*} other The other value to compare.
  24330. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  24331. * else `false`.
  24332. * @see _.lt
  24333. * @example
  24334. *
  24335. * _.gt(3, 1);
  24336. * // => true
  24337. *
  24338. * _.gt(3, 3);
  24339. * // => false
  24340. *
  24341. * _.gt(1, 3);
  24342. * // => false
  24343. */
  24344. var gt = createRelationalOperation(baseGt);
  24345. /**
  24346. * Checks if `value` is greater than or equal to `other`.
  24347. *
  24348. * @static
  24349. * @memberOf _
  24350. * @since 3.9.0
  24351. * @category Lang
  24352. * @param {*} value The value to compare.
  24353. * @param {*} other The other value to compare.
  24354. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  24355. * `other`, else `false`.
  24356. * @see _.lte
  24357. * @example
  24358. *
  24359. * _.gte(3, 1);
  24360. * // => true
  24361. *
  24362. * _.gte(3, 3);
  24363. * // => true
  24364. *
  24365. * _.gte(1, 3);
  24366. * // => false
  24367. */
  24368. var gte = createRelationalOperation(function(value, other) {
  24369. return value >= other;
  24370. });
  24371. /**
  24372. * Checks if `value` is likely an `arguments` object.
  24373. *
  24374. * @static
  24375. * @memberOf _
  24376. * @since 0.1.0
  24377. * @category Lang
  24378. * @param {*} value The value to check.
  24379. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  24380. * else `false`.
  24381. * @example
  24382. *
  24383. * _.isArguments(function() { return arguments; }());
  24384. * // => true
  24385. *
  24386. * _.isArguments([1, 2, 3]);
  24387. * // => false
  24388. */
  24389. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  24390. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  24391. !propertyIsEnumerable.call(value, 'callee');
  24392. };
  24393. /**
  24394. * Checks if `value` is classified as an `Array` object.
  24395. *
  24396. * @static
  24397. * @memberOf _
  24398. * @since 0.1.0
  24399. * @category Lang
  24400. * @param {*} value The value to check.
  24401. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  24402. * @example
  24403. *
  24404. * _.isArray([1, 2, 3]);
  24405. * // => true
  24406. *
  24407. * _.isArray(document.body.children);
  24408. * // => false
  24409. *
  24410. * _.isArray('abc');
  24411. * // => false
  24412. *
  24413. * _.isArray(_.noop);
  24414. * // => false
  24415. */
  24416. var isArray = Array.isArray;
  24417. /**
  24418. * Checks if `value` is classified as an `ArrayBuffer` object.
  24419. *
  24420. * @static
  24421. * @memberOf _
  24422. * @since 4.3.0
  24423. * @category Lang
  24424. * @param {*} value The value to check.
  24425. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  24426. * @example
  24427. *
  24428. * _.isArrayBuffer(new ArrayBuffer(2));
  24429. * // => true
  24430. *
  24431. * _.isArrayBuffer(new Array(2));
  24432. * // => false
  24433. */
  24434. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  24435. /**
  24436. * Checks if `value` is array-like. A value is considered array-like if it's
  24437. * not a function and has a `value.length` that's an integer greater than or
  24438. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  24439. *
  24440. * @static
  24441. * @memberOf _
  24442. * @since 4.0.0
  24443. * @category Lang
  24444. * @param {*} value The value to check.
  24445. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  24446. * @example
  24447. *
  24448. * _.isArrayLike([1, 2, 3]);
  24449. * // => true
  24450. *
  24451. * _.isArrayLike(document.body.children);
  24452. * // => true
  24453. *
  24454. * _.isArrayLike('abc');
  24455. * // => true
  24456. *
  24457. * _.isArrayLike(_.noop);
  24458. * // => false
  24459. */
  24460. function isArrayLike(value) {
  24461. return value != null && isLength(value.length) && !isFunction(value);
  24462. }
  24463. /**
  24464. * This method is like `_.isArrayLike` except that it also checks if `value`
  24465. * is an object.
  24466. *
  24467. * @static
  24468. * @memberOf _
  24469. * @since 4.0.0
  24470. * @category Lang
  24471. * @param {*} value The value to check.
  24472. * @returns {boolean} Returns `true` if `value` is an array-like object,
  24473. * else `false`.
  24474. * @example
  24475. *
  24476. * _.isArrayLikeObject([1, 2, 3]);
  24477. * // => true
  24478. *
  24479. * _.isArrayLikeObject(document.body.children);
  24480. * // => true
  24481. *
  24482. * _.isArrayLikeObject('abc');
  24483. * // => false
  24484. *
  24485. * _.isArrayLikeObject(_.noop);
  24486. * // => false
  24487. */
  24488. function isArrayLikeObject(value) {
  24489. return isObjectLike(value) && isArrayLike(value);
  24490. }
  24491. /**
  24492. * Checks if `value` is classified as a boolean primitive or object.
  24493. *
  24494. * @static
  24495. * @memberOf _
  24496. * @since 0.1.0
  24497. * @category Lang
  24498. * @param {*} value The value to check.
  24499. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  24500. * @example
  24501. *
  24502. * _.isBoolean(false);
  24503. * // => true
  24504. *
  24505. * _.isBoolean(null);
  24506. * // => false
  24507. */
  24508. function isBoolean(value) {
  24509. return value === true || value === false ||
  24510. (isObjectLike(value) && baseGetTag(value) == boolTag);
  24511. }
  24512. /**
  24513. * Checks if `value` is a buffer.
  24514. *
  24515. * @static
  24516. * @memberOf _
  24517. * @since 4.3.0
  24518. * @category Lang
  24519. * @param {*} value The value to check.
  24520. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  24521. * @example
  24522. *
  24523. * _.isBuffer(new Buffer(2));
  24524. * // => true
  24525. *
  24526. * _.isBuffer(new Uint8Array(2));
  24527. * // => false
  24528. */
  24529. var isBuffer = nativeIsBuffer || stubFalse;
  24530. /**
  24531. * Checks if `value` is classified as a `Date` object.
  24532. *
  24533. * @static
  24534. * @memberOf _
  24535. * @since 0.1.0
  24536. * @category Lang
  24537. * @param {*} value The value to check.
  24538. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  24539. * @example
  24540. *
  24541. * _.isDate(new Date);
  24542. * // => true
  24543. *
  24544. * _.isDate('Mon April 23 2012');
  24545. * // => false
  24546. */
  24547. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  24548. /**
  24549. * Checks if `value` is likely a DOM element.
  24550. *
  24551. * @static
  24552. * @memberOf _
  24553. * @since 0.1.0
  24554. * @category Lang
  24555. * @param {*} value The value to check.
  24556. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  24557. * @example
  24558. *
  24559. * _.isElement(document.body);
  24560. * // => true
  24561. *
  24562. * _.isElement('<body>');
  24563. * // => false
  24564. */
  24565. function isElement(value) {
  24566. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  24567. }
  24568. /**
  24569. * Checks if `value` is an empty object, collection, map, or set.
  24570. *
  24571. * Objects are considered empty if they have no own enumerable string keyed
  24572. * properties.
  24573. *
  24574. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  24575. * jQuery-like collections are considered empty if they have a `length` of `0`.
  24576. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  24577. *
  24578. * @static
  24579. * @memberOf _
  24580. * @since 0.1.0
  24581. * @category Lang
  24582. * @param {*} value The value to check.
  24583. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  24584. * @example
  24585. *
  24586. * _.isEmpty(null);
  24587. * // => true
  24588. *
  24589. * _.isEmpty(true);
  24590. * // => true
  24591. *
  24592. * _.isEmpty(1);
  24593. * // => true
  24594. *
  24595. * _.isEmpty([1, 2, 3]);
  24596. * // => false
  24597. *
  24598. * _.isEmpty({ 'a': 1 });
  24599. * // => false
  24600. */
  24601. function isEmpty(value) {
  24602. if (value == null) {
  24603. return true;
  24604. }
  24605. if (isArrayLike(value) &&
  24606. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  24607. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  24608. return !value.length;
  24609. }
  24610. var tag = getTag(value);
  24611. if (tag == mapTag || tag == setTag) {
  24612. return !value.size;
  24613. }
  24614. if (isPrototype(value)) {
  24615. return !baseKeys(value).length;
  24616. }
  24617. for (var key in value) {
  24618. if (hasOwnProperty.call(value, key)) {
  24619. return false;
  24620. }
  24621. }
  24622. return true;
  24623. }
  24624. /**
  24625. * Performs a deep comparison between two values to determine if they are
  24626. * equivalent.
  24627. *
  24628. * **Note:** This method supports comparing arrays, array buffers, booleans,
  24629. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  24630. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  24631. * by their own, not inherited, enumerable properties. Functions and DOM
  24632. * nodes are compared by strict equality, i.e. `===`.
  24633. *
  24634. * @static
  24635. * @memberOf _
  24636. * @since 0.1.0
  24637. * @category Lang
  24638. * @param {*} value The value to compare.
  24639. * @param {*} other The other value to compare.
  24640. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24641. * @example
  24642. *
  24643. * var object = { 'a': 1 };
  24644. * var other = { 'a': 1 };
  24645. *
  24646. * _.isEqual(object, other);
  24647. * // => true
  24648. *
  24649. * object === other;
  24650. * // => false
  24651. */
  24652. function isEqual(value, other) {
  24653. return baseIsEqual(value, other);
  24654. }
  24655. /**
  24656. * This method is like `_.isEqual` except that it accepts `customizer` which
  24657. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  24658. * are handled by the method instead. The `customizer` is invoked with up to
  24659. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  24660. *
  24661. * @static
  24662. * @memberOf _
  24663. * @since 4.0.0
  24664. * @category Lang
  24665. * @param {*} value The value to compare.
  24666. * @param {*} other The other value to compare.
  24667. * @param {Function} [customizer] The function to customize comparisons.
  24668. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24669. * @example
  24670. *
  24671. * function isGreeting(value) {
  24672. * return /^h(?:i|ello)$/.test(value);
  24673. * }
  24674. *
  24675. * function customizer(objValue, othValue) {
  24676. * if (isGreeting(objValue) && isGreeting(othValue)) {
  24677. * return true;
  24678. * }
  24679. * }
  24680. *
  24681. * var array = ['hello', 'goodbye'];
  24682. * var other = ['hi', 'goodbye'];
  24683. *
  24684. * _.isEqualWith(array, other, customizer);
  24685. * // => true
  24686. */
  24687. function isEqualWith(value, other, customizer) {
  24688. customizer = typeof customizer == 'function' ? customizer : undefined;
  24689. var result = customizer ? customizer(value, other) : undefined;
  24690. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  24691. }
  24692. /**
  24693. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  24694. * `SyntaxError`, `TypeError`, or `URIError` object.
  24695. *
  24696. * @static
  24697. * @memberOf _
  24698. * @since 3.0.0
  24699. * @category Lang
  24700. * @param {*} value The value to check.
  24701. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  24702. * @example
  24703. *
  24704. * _.isError(new Error);
  24705. * // => true
  24706. *
  24707. * _.isError(Error);
  24708. * // => false
  24709. */
  24710. function isError(value) {
  24711. if (!isObjectLike(value)) {
  24712. return false;
  24713. }
  24714. var tag = baseGetTag(value);
  24715. return tag == errorTag || tag == domExcTag ||
  24716. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  24717. }
  24718. /**
  24719. * Checks if `value` is a finite primitive number.
  24720. *
  24721. * **Note:** This method is based on
  24722. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  24723. *
  24724. * @static
  24725. * @memberOf _
  24726. * @since 0.1.0
  24727. * @category Lang
  24728. * @param {*} value The value to check.
  24729. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  24730. * @example
  24731. *
  24732. * _.isFinite(3);
  24733. * // => true
  24734. *
  24735. * _.isFinite(Number.MIN_VALUE);
  24736. * // => true
  24737. *
  24738. * _.isFinite(Infinity);
  24739. * // => false
  24740. *
  24741. * _.isFinite('3');
  24742. * // => false
  24743. */
  24744. function isFinite(value) {
  24745. return typeof value == 'number' && nativeIsFinite(value);
  24746. }
  24747. /**
  24748. * Checks if `value` is classified as a `Function` object.
  24749. *
  24750. * @static
  24751. * @memberOf _
  24752. * @since 0.1.0
  24753. * @category Lang
  24754. * @param {*} value The value to check.
  24755. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  24756. * @example
  24757. *
  24758. * _.isFunction(_);
  24759. * // => true
  24760. *
  24761. * _.isFunction(/abc/);
  24762. * // => false
  24763. */
  24764. function isFunction(value) {
  24765. if (!isObject(value)) {
  24766. return false;
  24767. }
  24768. // The use of `Object#toString` avoids issues with the `typeof` operator
  24769. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  24770. var tag = baseGetTag(value);
  24771. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  24772. }
  24773. /**
  24774. * Checks if `value` is an integer.
  24775. *
  24776. * **Note:** This method is based on
  24777. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  24778. *
  24779. * @static
  24780. * @memberOf _
  24781. * @since 4.0.0
  24782. * @category Lang
  24783. * @param {*} value The value to check.
  24784. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  24785. * @example
  24786. *
  24787. * _.isInteger(3);
  24788. * // => true
  24789. *
  24790. * _.isInteger(Number.MIN_VALUE);
  24791. * // => false
  24792. *
  24793. * _.isInteger(Infinity);
  24794. * // => false
  24795. *
  24796. * _.isInteger('3');
  24797. * // => false
  24798. */
  24799. function isInteger(value) {
  24800. return typeof value == 'number' && value == toInteger(value);
  24801. }
  24802. /**
  24803. * Checks if `value` is a valid array-like length.
  24804. *
  24805. * **Note:** This method is loosely based on
  24806. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  24807. *
  24808. * @static
  24809. * @memberOf _
  24810. * @since 4.0.0
  24811. * @category Lang
  24812. * @param {*} value The value to check.
  24813. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  24814. * @example
  24815. *
  24816. * _.isLength(3);
  24817. * // => true
  24818. *
  24819. * _.isLength(Number.MIN_VALUE);
  24820. * // => false
  24821. *
  24822. * _.isLength(Infinity);
  24823. * // => false
  24824. *
  24825. * _.isLength('3');
  24826. * // => false
  24827. */
  24828. function isLength(value) {
  24829. return typeof value == 'number' &&
  24830. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  24831. }
  24832. /**
  24833. * Checks if `value` is the
  24834. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  24835. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  24836. *
  24837. * @static
  24838. * @memberOf _
  24839. * @since 0.1.0
  24840. * @category Lang
  24841. * @param {*} value The value to check.
  24842. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  24843. * @example
  24844. *
  24845. * _.isObject({});
  24846. * // => true
  24847. *
  24848. * _.isObject([1, 2, 3]);
  24849. * // => true
  24850. *
  24851. * _.isObject(_.noop);
  24852. * // => true
  24853. *
  24854. * _.isObject(null);
  24855. * // => false
  24856. */
  24857. function isObject(value) {
  24858. var type = typeof value;
  24859. return value != null && (type == 'object' || type == 'function');
  24860. }
  24861. /**
  24862. * Checks if `value` is object-like. A value is object-like if it's not `null`
  24863. * and has a `typeof` result of "object".
  24864. *
  24865. * @static
  24866. * @memberOf _
  24867. * @since 4.0.0
  24868. * @category Lang
  24869. * @param {*} value The value to check.
  24870. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  24871. * @example
  24872. *
  24873. * _.isObjectLike({});
  24874. * // => true
  24875. *
  24876. * _.isObjectLike([1, 2, 3]);
  24877. * // => true
  24878. *
  24879. * _.isObjectLike(_.noop);
  24880. * // => false
  24881. *
  24882. * _.isObjectLike(null);
  24883. * // => false
  24884. */
  24885. function isObjectLike(value) {
  24886. return value != null && typeof value == 'object';
  24887. }
  24888. /**
  24889. * Checks if `value` is classified as a `Map` object.
  24890. *
  24891. * @static
  24892. * @memberOf _
  24893. * @since 4.3.0
  24894. * @category Lang
  24895. * @param {*} value The value to check.
  24896. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  24897. * @example
  24898. *
  24899. * _.isMap(new Map);
  24900. * // => true
  24901. *
  24902. * _.isMap(new WeakMap);
  24903. * // => false
  24904. */
  24905. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  24906. /**
  24907. * Performs a partial deep comparison between `object` and `source` to
  24908. * determine if `object` contains equivalent property values.
  24909. *
  24910. * **Note:** This method is equivalent to `_.matches` when `source` is
  24911. * partially applied.
  24912. *
  24913. * Partial comparisons will match empty array and empty object `source`
  24914. * values against any array or object value, respectively. See `_.isEqual`
  24915. * for a list of supported value comparisons.
  24916. *
  24917. * @static
  24918. * @memberOf _
  24919. * @since 3.0.0
  24920. * @category Lang
  24921. * @param {Object} object The object to inspect.
  24922. * @param {Object} source The object of property values to match.
  24923. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  24924. * @example
  24925. *
  24926. * var object = { 'a': 1, 'b': 2 };
  24927. *
  24928. * _.isMatch(object, { 'b': 2 });
  24929. * // => true
  24930. *
  24931. * _.isMatch(object, { 'b': 1 });
  24932. * // => false
  24933. */
  24934. function isMatch(object, source) {
  24935. return object === source || baseIsMatch(object, source, getMatchData(source));
  24936. }
  24937. /**
  24938. * This method is like `_.isMatch` except that it accepts `customizer` which
  24939. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  24940. * are handled by the method instead. The `customizer` is invoked with five
  24941. * arguments: (objValue, srcValue, index|key, object, source).
  24942. *
  24943. * @static
  24944. * @memberOf _
  24945. * @since 4.0.0
  24946. * @category Lang
  24947. * @param {Object} object The object to inspect.
  24948. * @param {Object} source The object of property values to match.
  24949. * @param {Function} [customizer] The function to customize comparisons.
  24950. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  24951. * @example
  24952. *
  24953. * function isGreeting(value) {
  24954. * return /^h(?:i|ello)$/.test(value);
  24955. * }
  24956. *
  24957. * function customizer(objValue, srcValue) {
  24958. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  24959. * return true;
  24960. * }
  24961. * }
  24962. *
  24963. * var object = { 'greeting': 'hello' };
  24964. * var source = { 'greeting': 'hi' };
  24965. *
  24966. * _.isMatchWith(object, source, customizer);
  24967. * // => true
  24968. */
  24969. function isMatchWith(object, source, customizer) {
  24970. customizer = typeof customizer == 'function' ? customizer : undefined;
  24971. return baseIsMatch(object, source, getMatchData(source), customizer);
  24972. }
  24973. /**
  24974. * Checks if `value` is `NaN`.
  24975. *
  24976. * **Note:** This method is based on
  24977. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  24978. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  24979. * `undefined` and other non-number values.
  24980. *
  24981. * @static
  24982. * @memberOf _
  24983. * @since 0.1.0
  24984. * @category Lang
  24985. * @param {*} value The value to check.
  24986. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  24987. * @example
  24988. *
  24989. * _.isNaN(NaN);
  24990. * // => true
  24991. *
  24992. * _.isNaN(new Number(NaN));
  24993. * // => true
  24994. *
  24995. * isNaN(undefined);
  24996. * // => true
  24997. *
  24998. * _.isNaN(undefined);
  24999. * // => false
  25000. */
  25001. function isNaN(value) {
  25002. // An `NaN` primitive is the only value that is not equal to itself.
  25003. // Perform the `toStringTag` check first to avoid errors with some
  25004. // ActiveX objects in IE.
  25005. return isNumber(value) && value != +value;
  25006. }
  25007. /**
  25008. * Checks if `value` is a pristine native function.
  25009. *
  25010. * **Note:** This method can't reliably detect native functions in the presence
  25011. * of the core-js package because core-js circumvents this kind of detection.
  25012. * Despite multiple requests, the core-js maintainer has made it clear: any
  25013. * attempt to fix the detection will be obstructed. As a result, we're left
  25014. * with little choice but to throw an error. Unfortunately, this also affects
  25015. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  25016. * which rely on core-js.
  25017. *
  25018. * @static
  25019. * @memberOf _
  25020. * @since 3.0.0
  25021. * @category Lang
  25022. * @param {*} value The value to check.
  25023. * @returns {boolean} Returns `true` if `value` is a native function,
  25024. * else `false`.
  25025. * @example
  25026. *
  25027. * _.isNative(Array.prototype.push);
  25028. * // => true
  25029. *
  25030. * _.isNative(_);
  25031. * // => false
  25032. */
  25033. function isNative(value) {
  25034. if (isMaskable(value)) {
  25035. throw new Error(CORE_ERROR_TEXT);
  25036. }
  25037. return baseIsNative(value);
  25038. }
  25039. /**
  25040. * Checks if `value` is `null`.
  25041. *
  25042. * @static
  25043. * @memberOf _
  25044. * @since 0.1.0
  25045. * @category Lang
  25046. * @param {*} value The value to check.
  25047. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  25048. * @example
  25049. *
  25050. * _.isNull(null);
  25051. * // => true
  25052. *
  25053. * _.isNull(void 0);
  25054. * // => false
  25055. */
  25056. function isNull(value) {
  25057. return value === null;
  25058. }
  25059. /**
  25060. * Checks if `value` is `null` or `undefined`.
  25061. *
  25062. * @static
  25063. * @memberOf _
  25064. * @since 4.0.0
  25065. * @category Lang
  25066. * @param {*} value The value to check.
  25067. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  25068. * @example
  25069. *
  25070. * _.isNil(null);
  25071. * // => true
  25072. *
  25073. * _.isNil(void 0);
  25074. * // => true
  25075. *
  25076. * _.isNil(NaN);
  25077. * // => false
  25078. */
  25079. function isNil(value) {
  25080. return value == null;
  25081. }
  25082. /**
  25083. * Checks if `value` is classified as a `Number` primitive or object.
  25084. *
  25085. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  25086. * classified as numbers, use the `_.isFinite` method.
  25087. *
  25088. * @static
  25089. * @memberOf _
  25090. * @since 0.1.0
  25091. * @category Lang
  25092. * @param {*} value The value to check.
  25093. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  25094. * @example
  25095. *
  25096. * _.isNumber(3);
  25097. * // => true
  25098. *
  25099. * _.isNumber(Number.MIN_VALUE);
  25100. * // => true
  25101. *
  25102. * _.isNumber(Infinity);
  25103. * // => true
  25104. *
  25105. * _.isNumber('3');
  25106. * // => false
  25107. */
  25108. function isNumber(value) {
  25109. return typeof value == 'number' ||
  25110. (isObjectLike(value) && baseGetTag(value) == numberTag);
  25111. }
  25112. /**
  25113. * Checks if `value` is a plain object, that is, an object created by the
  25114. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  25115. *
  25116. * @static
  25117. * @memberOf _
  25118. * @since 0.8.0
  25119. * @category Lang
  25120. * @param {*} value The value to check.
  25121. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  25122. * @example
  25123. *
  25124. * function Foo() {
  25125. * this.a = 1;
  25126. * }
  25127. *
  25128. * _.isPlainObject(new Foo);
  25129. * // => false
  25130. *
  25131. * _.isPlainObject([1, 2, 3]);
  25132. * // => false
  25133. *
  25134. * _.isPlainObject({ 'x': 0, 'y': 0 });
  25135. * // => true
  25136. *
  25137. * _.isPlainObject(Object.create(null));
  25138. * // => true
  25139. */
  25140. function isPlainObject(value) {
  25141. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  25142. return false;
  25143. }
  25144. var proto = getPrototype(value);
  25145. if (proto === null) {
  25146. return true;
  25147. }
  25148. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  25149. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  25150. funcToString.call(Ctor) == objectCtorString;
  25151. }
  25152. /**
  25153. * Checks if `value` is classified as a `RegExp` object.
  25154. *
  25155. * @static
  25156. * @memberOf _
  25157. * @since 0.1.0
  25158. * @category Lang
  25159. * @param {*} value The value to check.
  25160. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  25161. * @example
  25162. *
  25163. * _.isRegExp(/abc/);
  25164. * // => true
  25165. *
  25166. * _.isRegExp('/abc/');
  25167. * // => false
  25168. */
  25169. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  25170. /**
  25171. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  25172. * double precision number which isn't the result of a rounded unsafe integer.
  25173. *
  25174. * **Note:** This method is based on
  25175. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  25176. *
  25177. * @static
  25178. * @memberOf _
  25179. * @since 4.0.0
  25180. * @category Lang
  25181. * @param {*} value The value to check.
  25182. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  25183. * @example
  25184. *
  25185. * _.isSafeInteger(3);
  25186. * // => true
  25187. *
  25188. * _.isSafeInteger(Number.MIN_VALUE);
  25189. * // => false
  25190. *
  25191. * _.isSafeInteger(Infinity);
  25192. * // => false
  25193. *
  25194. * _.isSafeInteger('3');
  25195. * // => false
  25196. */
  25197. function isSafeInteger(value) {
  25198. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  25199. }
  25200. /**
  25201. * Checks if `value` is classified as a `Set` object.
  25202. *
  25203. * @static
  25204. * @memberOf _
  25205. * @since 4.3.0
  25206. * @category Lang
  25207. * @param {*} value The value to check.
  25208. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  25209. * @example
  25210. *
  25211. * _.isSet(new Set);
  25212. * // => true
  25213. *
  25214. * _.isSet(new WeakSet);
  25215. * // => false
  25216. */
  25217. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  25218. /**
  25219. * Checks if `value` is classified as a `String` primitive or object.
  25220. *
  25221. * @static
  25222. * @since 0.1.0
  25223. * @memberOf _
  25224. * @category Lang
  25225. * @param {*} value The value to check.
  25226. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  25227. * @example
  25228. *
  25229. * _.isString('abc');
  25230. * // => true
  25231. *
  25232. * _.isString(1);
  25233. * // => false
  25234. */
  25235. function isString(value) {
  25236. return typeof value == 'string' ||
  25237. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  25238. }
  25239. /**
  25240. * Checks if `value` is classified as a `Symbol` primitive or object.
  25241. *
  25242. * @static
  25243. * @memberOf _
  25244. * @since 4.0.0
  25245. * @category Lang
  25246. * @param {*} value The value to check.
  25247. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  25248. * @example
  25249. *
  25250. * _.isSymbol(Symbol.iterator);
  25251. * // => true
  25252. *
  25253. * _.isSymbol('abc');
  25254. * // => false
  25255. */
  25256. function isSymbol(value) {
  25257. return typeof value == 'symbol' ||
  25258. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  25259. }
  25260. /**
  25261. * Checks if `value` is classified as a typed array.
  25262. *
  25263. * @static
  25264. * @memberOf _
  25265. * @since 3.0.0
  25266. * @category Lang
  25267. * @param {*} value The value to check.
  25268. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  25269. * @example
  25270. *
  25271. * _.isTypedArray(new Uint8Array);
  25272. * // => true
  25273. *
  25274. * _.isTypedArray([]);
  25275. * // => false
  25276. */
  25277. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  25278. /**
  25279. * Checks if `value` is `undefined`.
  25280. *
  25281. * @static
  25282. * @since 0.1.0
  25283. * @memberOf _
  25284. * @category Lang
  25285. * @param {*} value The value to check.
  25286. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  25287. * @example
  25288. *
  25289. * _.isUndefined(void 0);
  25290. * // => true
  25291. *
  25292. * _.isUndefined(null);
  25293. * // => false
  25294. */
  25295. function isUndefined(value) {
  25296. return value === undefined;
  25297. }
  25298. /**
  25299. * Checks if `value` is classified as a `WeakMap` object.
  25300. *
  25301. * @static
  25302. * @memberOf _
  25303. * @since 4.3.0
  25304. * @category Lang
  25305. * @param {*} value The value to check.
  25306. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  25307. * @example
  25308. *
  25309. * _.isWeakMap(new WeakMap);
  25310. * // => true
  25311. *
  25312. * _.isWeakMap(new Map);
  25313. * // => false
  25314. */
  25315. function isWeakMap(value) {
  25316. return isObjectLike(value) && getTag(value) == weakMapTag;
  25317. }
  25318. /**
  25319. * Checks if `value` is classified as a `WeakSet` object.
  25320. *
  25321. * @static
  25322. * @memberOf _
  25323. * @since 4.3.0
  25324. * @category Lang
  25325. * @param {*} value The value to check.
  25326. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  25327. * @example
  25328. *
  25329. * _.isWeakSet(new WeakSet);
  25330. * // => true
  25331. *
  25332. * _.isWeakSet(new Set);
  25333. * // => false
  25334. */
  25335. function isWeakSet(value) {
  25336. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  25337. }
  25338. /**
  25339. * Checks if `value` is less than `other`.
  25340. *
  25341. * @static
  25342. * @memberOf _
  25343. * @since 3.9.0
  25344. * @category Lang
  25345. * @param {*} value The value to compare.
  25346. * @param {*} other The other value to compare.
  25347. * @returns {boolean} Returns `true` if `value` is less than `other`,
  25348. * else `false`.
  25349. * @see _.gt
  25350. * @example
  25351. *
  25352. * _.lt(1, 3);
  25353. * // => true
  25354. *
  25355. * _.lt(3, 3);
  25356. * // => false
  25357. *
  25358. * _.lt(3, 1);
  25359. * // => false
  25360. */
  25361. var lt = createRelationalOperation(baseLt);
  25362. /**
  25363. * Checks if `value` is less than or equal to `other`.
  25364. *
  25365. * @static
  25366. * @memberOf _
  25367. * @since 3.9.0
  25368. * @category Lang
  25369. * @param {*} value The value to compare.
  25370. * @param {*} other The other value to compare.
  25371. * @returns {boolean} Returns `true` if `value` is less than or equal to
  25372. * `other`, else `false`.
  25373. * @see _.gte
  25374. * @example
  25375. *
  25376. * _.lte(1, 3);
  25377. * // => true
  25378. *
  25379. * _.lte(3, 3);
  25380. * // => true
  25381. *
  25382. * _.lte(3, 1);
  25383. * // => false
  25384. */
  25385. var lte = createRelationalOperation(function(value, other) {
  25386. return value <= other;
  25387. });
  25388. /**
  25389. * Converts `value` to an array.
  25390. *
  25391. * @static
  25392. * @since 0.1.0
  25393. * @memberOf _
  25394. * @category Lang
  25395. * @param {*} value The value to convert.
  25396. * @returns {Array} Returns the converted array.
  25397. * @example
  25398. *
  25399. * _.toArray({ 'a': 1, 'b': 2 });
  25400. * // => [1, 2]
  25401. *
  25402. * _.toArray('abc');
  25403. * // => ['a', 'b', 'c']
  25404. *
  25405. * _.toArray(1);
  25406. * // => []
  25407. *
  25408. * _.toArray(null);
  25409. * // => []
  25410. */
  25411. function toArray(value) {
  25412. if (!value) {
  25413. return [];
  25414. }
  25415. if (isArrayLike(value)) {
  25416. return isString(value) ? stringToArray(value) : copyArray(value);
  25417. }
  25418. if (symIterator && value[symIterator]) {
  25419. return iteratorToArray(value[symIterator]());
  25420. }
  25421. var tag = getTag(value),
  25422. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  25423. return func(value);
  25424. }
  25425. /**
  25426. * Converts `value` to a finite number.
  25427. *
  25428. * @static
  25429. * @memberOf _
  25430. * @since 4.12.0
  25431. * @category Lang
  25432. * @param {*} value The value to convert.
  25433. * @returns {number} Returns the converted number.
  25434. * @example
  25435. *
  25436. * _.toFinite(3.2);
  25437. * // => 3.2
  25438. *
  25439. * _.toFinite(Number.MIN_VALUE);
  25440. * // => 5e-324
  25441. *
  25442. * _.toFinite(Infinity);
  25443. * // => 1.7976931348623157e+308
  25444. *
  25445. * _.toFinite('3.2');
  25446. * // => 3.2
  25447. */
  25448. function toFinite(value) {
  25449. if (!value) {
  25450. return value === 0 ? value : 0;
  25451. }
  25452. value = toNumber(value);
  25453. if (value === INFINITY || value === -INFINITY) {
  25454. var sign = (value < 0 ? -1 : 1);
  25455. return sign * MAX_INTEGER;
  25456. }
  25457. return value === value ? value : 0;
  25458. }
  25459. /**
  25460. * Converts `value` to an integer.
  25461. *
  25462. * **Note:** This method is loosely based on
  25463. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  25464. *
  25465. * @static
  25466. * @memberOf _
  25467. * @since 4.0.0
  25468. * @category Lang
  25469. * @param {*} value The value to convert.
  25470. * @returns {number} Returns the converted integer.
  25471. * @example
  25472. *
  25473. * _.toInteger(3.2);
  25474. * // => 3
  25475. *
  25476. * _.toInteger(Number.MIN_VALUE);
  25477. * // => 0
  25478. *
  25479. * _.toInteger(Infinity);
  25480. * // => 1.7976931348623157e+308
  25481. *
  25482. * _.toInteger('3.2');
  25483. * // => 3
  25484. */
  25485. function toInteger(value) {
  25486. var result = toFinite(value),
  25487. remainder = result % 1;
  25488. return result === result ? (remainder ? result - remainder : result) : 0;
  25489. }
  25490. /**
  25491. * Converts `value` to an integer suitable for use as the length of an
  25492. * array-like object.
  25493. *
  25494. * **Note:** This method is based on
  25495. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  25496. *
  25497. * @static
  25498. * @memberOf _
  25499. * @since 4.0.0
  25500. * @category Lang
  25501. * @param {*} value The value to convert.
  25502. * @returns {number} Returns the converted integer.
  25503. * @example
  25504. *
  25505. * _.toLength(3.2);
  25506. * // => 3
  25507. *
  25508. * _.toLength(Number.MIN_VALUE);
  25509. * // => 0
  25510. *
  25511. * _.toLength(Infinity);
  25512. * // => 4294967295
  25513. *
  25514. * _.toLength('3.2');
  25515. * // => 3
  25516. */
  25517. function toLength(value) {
  25518. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  25519. }
  25520. /**
  25521. * Converts `value` to a number.
  25522. *
  25523. * @static
  25524. * @memberOf _
  25525. * @since 4.0.0
  25526. * @category Lang
  25527. * @param {*} value The value to process.
  25528. * @returns {number} Returns the number.
  25529. * @example
  25530. *
  25531. * _.toNumber(3.2);
  25532. * // => 3.2
  25533. *
  25534. * _.toNumber(Number.MIN_VALUE);
  25535. * // => 5e-324
  25536. *
  25537. * _.toNumber(Infinity);
  25538. * // => Infinity
  25539. *
  25540. * _.toNumber('3.2');
  25541. * // => 3.2
  25542. */
  25543. function toNumber(value) {
  25544. if (typeof value == 'number') {
  25545. return value;
  25546. }
  25547. if (isSymbol(value)) {
  25548. return NAN;
  25549. }
  25550. if (isObject(value)) {
  25551. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  25552. value = isObject(other) ? (other + '') : other;
  25553. }
  25554. if (typeof value != 'string') {
  25555. return value === 0 ? value : +value;
  25556. }
  25557. value = value.replace(reTrim, '');
  25558. var isBinary = reIsBinary.test(value);
  25559. return (isBinary || reIsOctal.test(value))
  25560. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  25561. : (reIsBadHex.test(value) ? NAN : +value);
  25562. }
  25563. /**
  25564. * Converts `value` to a plain object flattening inherited enumerable string
  25565. * keyed properties of `value` to own properties of the plain object.
  25566. *
  25567. * @static
  25568. * @memberOf _
  25569. * @since 3.0.0
  25570. * @category Lang
  25571. * @param {*} value The value to convert.
  25572. * @returns {Object} Returns the converted plain object.
  25573. * @example
  25574. *
  25575. * function Foo() {
  25576. * this.b = 2;
  25577. * }
  25578. *
  25579. * Foo.prototype.c = 3;
  25580. *
  25581. * _.assign({ 'a': 1 }, new Foo);
  25582. * // => { 'a': 1, 'b': 2 }
  25583. *
  25584. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  25585. * // => { 'a': 1, 'b': 2, 'c': 3 }
  25586. */
  25587. function toPlainObject(value) {
  25588. return copyObject(value, keysIn(value));
  25589. }
  25590. /**
  25591. * Converts `value` to a safe integer. A safe integer can be compared and
  25592. * represented correctly.
  25593. *
  25594. * @static
  25595. * @memberOf _
  25596. * @since 4.0.0
  25597. * @category Lang
  25598. * @param {*} value The value to convert.
  25599. * @returns {number} Returns the converted integer.
  25600. * @example
  25601. *
  25602. * _.toSafeInteger(3.2);
  25603. * // => 3
  25604. *
  25605. * _.toSafeInteger(Number.MIN_VALUE);
  25606. * // => 0
  25607. *
  25608. * _.toSafeInteger(Infinity);
  25609. * // => 9007199254740991
  25610. *
  25611. * _.toSafeInteger('3.2');
  25612. * // => 3
  25613. */
  25614. function toSafeInteger(value) {
  25615. return value
  25616. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  25617. : (value === 0 ? value : 0);
  25618. }
  25619. /**
  25620. * Converts `value` to a string. An empty string is returned for `null`
  25621. * and `undefined` values. The sign of `-0` is preserved.
  25622. *
  25623. * @static
  25624. * @memberOf _
  25625. * @since 4.0.0
  25626. * @category Lang
  25627. * @param {*} value The value to convert.
  25628. * @returns {string} Returns the converted string.
  25629. * @example
  25630. *
  25631. * _.toString(null);
  25632. * // => ''
  25633. *
  25634. * _.toString(-0);
  25635. * // => '-0'
  25636. *
  25637. * _.toString([1, 2, 3]);
  25638. * // => '1,2,3'
  25639. */
  25640. function toString(value) {
  25641. return value == null ? '' : baseToString(value);
  25642. }
  25643. /*------------------------------------------------------------------------*/
  25644. /**
  25645. * Assigns own enumerable string keyed properties of source objects to the
  25646. * destination object. Source objects are applied from left to right.
  25647. * Subsequent sources overwrite property assignments of previous sources.
  25648. *
  25649. * **Note:** This method mutates `object` and is loosely based on
  25650. * [`Object.assign`](https://mdn.io/Object/assign).
  25651. *
  25652. * @static
  25653. * @memberOf _
  25654. * @since 0.10.0
  25655. * @category Object
  25656. * @param {Object} object The destination object.
  25657. * @param {...Object} [sources] The source objects.
  25658. * @returns {Object} Returns `object`.
  25659. * @see _.assignIn
  25660. * @example
  25661. *
  25662. * function Foo() {
  25663. * this.a = 1;
  25664. * }
  25665. *
  25666. * function Bar() {
  25667. * this.c = 3;
  25668. * }
  25669. *
  25670. * Foo.prototype.b = 2;
  25671. * Bar.prototype.d = 4;
  25672. *
  25673. * _.assign({ 'a': 0 }, new Foo, new Bar);
  25674. * // => { 'a': 1, 'c': 3 }
  25675. */
  25676. var assign = createAssigner(function(object, source) {
  25677. if (isPrototype(source) || isArrayLike(source)) {
  25678. copyObject(source, keys(source), object);
  25679. return;
  25680. }
  25681. for (var key in source) {
  25682. if (hasOwnProperty.call(source, key)) {
  25683. assignValue(object, key, source[key]);
  25684. }
  25685. }
  25686. });
  25687. /**
  25688. * This method is like `_.assign` except that it iterates over own and
  25689. * inherited source properties.
  25690. *
  25691. * **Note:** This method mutates `object`.
  25692. *
  25693. * @static
  25694. * @memberOf _
  25695. * @since 4.0.0
  25696. * @alias extend
  25697. * @category Object
  25698. * @param {Object} object The destination object.
  25699. * @param {...Object} [sources] The source objects.
  25700. * @returns {Object} Returns `object`.
  25701. * @see _.assign
  25702. * @example
  25703. *
  25704. * function Foo() {
  25705. * this.a = 1;
  25706. * }
  25707. *
  25708. * function Bar() {
  25709. * this.c = 3;
  25710. * }
  25711. *
  25712. * Foo.prototype.b = 2;
  25713. * Bar.prototype.d = 4;
  25714. *
  25715. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  25716. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  25717. */
  25718. var assignIn = createAssigner(function(object, source) {
  25719. copyObject(source, keysIn(source), object);
  25720. });
  25721. /**
  25722. * This method is like `_.assignIn` except that it accepts `customizer`
  25723. * which is invoked to produce the assigned values. If `customizer` returns
  25724. * `undefined`, assignment is handled by the method instead. The `customizer`
  25725. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  25726. *
  25727. * **Note:** This method mutates `object`.
  25728. *
  25729. * @static
  25730. * @memberOf _
  25731. * @since 4.0.0
  25732. * @alias extendWith
  25733. * @category Object
  25734. * @param {Object} object The destination object.
  25735. * @param {...Object} sources The source objects.
  25736. * @param {Function} [customizer] The function to customize assigned values.
  25737. * @returns {Object} Returns `object`.
  25738. * @see _.assignWith
  25739. * @example
  25740. *
  25741. * function customizer(objValue, srcValue) {
  25742. * return _.isUndefined(objValue) ? srcValue : objValue;
  25743. * }
  25744. *
  25745. * var defaults = _.partialRight(_.assignInWith, customizer);
  25746. *
  25747. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25748. * // => { 'a': 1, 'b': 2 }
  25749. */
  25750. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  25751. copyObject(source, keysIn(source), object, customizer);
  25752. });
  25753. /**
  25754. * This method is like `_.assign` except that it accepts `customizer`
  25755. * which is invoked to produce the assigned values. If `customizer` returns
  25756. * `undefined`, assignment is handled by the method instead. The `customizer`
  25757. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  25758. *
  25759. * **Note:** This method mutates `object`.
  25760. *
  25761. * @static
  25762. * @memberOf _
  25763. * @since 4.0.0
  25764. * @category Object
  25765. * @param {Object} object The destination object.
  25766. * @param {...Object} sources The source objects.
  25767. * @param {Function} [customizer] The function to customize assigned values.
  25768. * @returns {Object} Returns `object`.
  25769. * @see _.assignInWith
  25770. * @example
  25771. *
  25772. * function customizer(objValue, srcValue) {
  25773. * return _.isUndefined(objValue) ? srcValue : objValue;
  25774. * }
  25775. *
  25776. * var defaults = _.partialRight(_.assignWith, customizer);
  25777. *
  25778. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25779. * // => { 'a': 1, 'b': 2 }
  25780. */
  25781. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  25782. copyObject(source, keys(source), object, customizer);
  25783. });
  25784. /**
  25785. * Creates an array of values corresponding to `paths` of `object`.
  25786. *
  25787. * @static
  25788. * @memberOf _
  25789. * @since 1.0.0
  25790. * @category Object
  25791. * @param {Object} object The object to iterate over.
  25792. * @param {...(string|string[])} [paths] The property paths to pick.
  25793. * @returns {Array} Returns the picked values.
  25794. * @example
  25795. *
  25796. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  25797. *
  25798. * _.at(object, ['a[0].b.c', 'a[1]']);
  25799. * // => [3, 4]
  25800. */
  25801. var at = flatRest(baseAt);
  25802. /**
  25803. * Creates an object that inherits from the `prototype` object. If a
  25804. * `properties` object is given, its own enumerable string keyed properties
  25805. * are assigned to the created object.
  25806. *
  25807. * @static
  25808. * @memberOf _
  25809. * @since 2.3.0
  25810. * @category Object
  25811. * @param {Object} prototype The object to inherit from.
  25812. * @param {Object} [properties] The properties to assign to the object.
  25813. * @returns {Object} Returns the new object.
  25814. * @example
  25815. *
  25816. * function Shape() {
  25817. * this.x = 0;
  25818. * this.y = 0;
  25819. * }
  25820. *
  25821. * function Circle() {
  25822. * Shape.call(this);
  25823. * }
  25824. *
  25825. * Circle.prototype = _.create(Shape.prototype, {
  25826. * 'constructor': Circle
  25827. * });
  25828. *
  25829. * var circle = new Circle;
  25830. * circle instanceof Circle;
  25831. * // => true
  25832. *
  25833. * circle instanceof Shape;
  25834. * // => true
  25835. */
  25836. function create(prototype, properties) {
  25837. var result = baseCreate(prototype);
  25838. return properties == null ? result : baseAssign(result, properties);
  25839. }
  25840. /**
  25841. * Assigns own and inherited enumerable string keyed properties of source
  25842. * objects to the destination object for all destination properties that
  25843. * resolve to `undefined`. Source objects are applied from left to right.
  25844. * Once a property is set, additional values of the same property are ignored.
  25845. *
  25846. * **Note:** This method mutates `object`.
  25847. *
  25848. * @static
  25849. * @since 0.1.0
  25850. * @memberOf _
  25851. * @category Object
  25852. * @param {Object} object The destination object.
  25853. * @param {...Object} [sources] The source objects.
  25854. * @returns {Object} Returns `object`.
  25855. * @see _.defaultsDeep
  25856. * @example
  25857. *
  25858. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25859. * // => { 'a': 1, 'b': 2 }
  25860. */
  25861. var defaults = baseRest(function(object, sources) {
  25862. object = Object(object);
  25863. var index = -1;
  25864. var length = sources.length;
  25865. var guard = length > 2 ? sources[2] : undefined;
  25866. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  25867. length = 1;
  25868. }
  25869. while (++index < length) {
  25870. var source = sources[index];
  25871. var props = keysIn(source);
  25872. var propsIndex = -1;
  25873. var propsLength = props.length;
  25874. while (++propsIndex < propsLength) {
  25875. var key = props[propsIndex];
  25876. var value = object[key];
  25877. if (value === undefined ||
  25878. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  25879. object[key] = source[key];
  25880. }
  25881. }
  25882. }
  25883. return object;
  25884. });
  25885. /**
  25886. * This method is like `_.defaults` except that it recursively assigns
  25887. * default properties.
  25888. *
  25889. * **Note:** This method mutates `object`.
  25890. *
  25891. * @static
  25892. * @memberOf _
  25893. * @since 3.10.0
  25894. * @category Object
  25895. * @param {Object} object The destination object.
  25896. * @param {...Object} [sources] The source objects.
  25897. * @returns {Object} Returns `object`.
  25898. * @see _.defaults
  25899. * @example
  25900. *
  25901. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  25902. * // => { 'a': { 'b': 2, 'c': 3 } }
  25903. */
  25904. var defaultsDeep = baseRest(function(args) {
  25905. args.push(undefined, customDefaultsMerge);
  25906. return apply(mergeWith, undefined, args);
  25907. });
  25908. /**
  25909. * This method is like `_.find` except that it returns the key of the first
  25910. * element `predicate` returns truthy for instead of the element itself.
  25911. *
  25912. * @static
  25913. * @memberOf _
  25914. * @since 1.1.0
  25915. * @category Object
  25916. * @param {Object} object The object to inspect.
  25917. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25918. * @returns {string|undefined} Returns the key of the matched element,
  25919. * else `undefined`.
  25920. * @example
  25921. *
  25922. * var users = {
  25923. * 'barney': { 'age': 36, 'active': true },
  25924. * 'fred': { 'age': 40, 'active': false },
  25925. * 'pebbles': { 'age': 1, 'active': true }
  25926. * };
  25927. *
  25928. * _.findKey(users, function(o) { return o.age < 40; });
  25929. * // => 'barney' (iteration order is not guaranteed)
  25930. *
  25931. * // The `_.matches` iteratee shorthand.
  25932. * _.findKey(users, { 'age': 1, 'active': true });
  25933. * // => 'pebbles'
  25934. *
  25935. * // The `_.matchesProperty` iteratee shorthand.
  25936. * _.findKey(users, ['active', false]);
  25937. * // => 'fred'
  25938. *
  25939. * // The `_.property` iteratee shorthand.
  25940. * _.findKey(users, 'active');
  25941. * // => 'barney'
  25942. */
  25943. function findKey(object, predicate) {
  25944. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  25945. }
  25946. /**
  25947. * This method is like `_.findKey` except that it iterates over elements of
  25948. * a collection in the opposite order.
  25949. *
  25950. * @static
  25951. * @memberOf _
  25952. * @since 2.0.0
  25953. * @category Object
  25954. * @param {Object} object The object to inspect.
  25955. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25956. * @returns {string|undefined} Returns the key of the matched element,
  25957. * else `undefined`.
  25958. * @example
  25959. *
  25960. * var users = {
  25961. * 'barney': { 'age': 36, 'active': true },
  25962. * 'fred': { 'age': 40, 'active': false },
  25963. * 'pebbles': { 'age': 1, 'active': true }
  25964. * };
  25965. *
  25966. * _.findLastKey(users, function(o) { return o.age < 40; });
  25967. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  25968. *
  25969. * // The `_.matches` iteratee shorthand.
  25970. * _.findLastKey(users, { 'age': 36, 'active': true });
  25971. * // => 'barney'
  25972. *
  25973. * // The `_.matchesProperty` iteratee shorthand.
  25974. * _.findLastKey(users, ['active', false]);
  25975. * // => 'fred'
  25976. *
  25977. * // The `_.property` iteratee shorthand.
  25978. * _.findLastKey(users, 'active');
  25979. * // => 'pebbles'
  25980. */
  25981. function findLastKey(object, predicate) {
  25982. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  25983. }
  25984. /**
  25985. * Iterates over own and inherited enumerable string keyed properties of an
  25986. * object and invokes `iteratee` for each property. The iteratee is invoked
  25987. * with three arguments: (value, key, object). Iteratee functions may exit
  25988. * iteration early by explicitly returning `false`.
  25989. *
  25990. * @static
  25991. * @memberOf _
  25992. * @since 0.3.0
  25993. * @category Object
  25994. * @param {Object} object The object to iterate over.
  25995. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  25996. * @returns {Object} Returns `object`.
  25997. * @see _.forInRight
  25998. * @example
  25999. *
  26000. * function Foo() {
  26001. * this.a = 1;
  26002. * this.b = 2;
  26003. * }
  26004. *
  26005. * Foo.prototype.c = 3;
  26006. *
  26007. * _.forIn(new Foo, function(value, key) {
  26008. * console.log(key);
  26009. * });
  26010. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  26011. */
  26012. function forIn(object, iteratee) {
  26013. return object == null
  26014. ? object
  26015. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  26016. }
  26017. /**
  26018. * This method is like `_.forIn` except that it iterates over properties of
  26019. * `object` in the opposite order.
  26020. *
  26021. * @static
  26022. * @memberOf _
  26023. * @since 2.0.0
  26024. * @category Object
  26025. * @param {Object} object The object to iterate over.
  26026. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26027. * @returns {Object} Returns `object`.
  26028. * @see _.forIn
  26029. * @example
  26030. *
  26031. * function Foo() {
  26032. * this.a = 1;
  26033. * this.b = 2;
  26034. * }
  26035. *
  26036. * Foo.prototype.c = 3;
  26037. *
  26038. * _.forInRight(new Foo, function(value, key) {
  26039. * console.log(key);
  26040. * });
  26041. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  26042. */
  26043. function forInRight(object, iteratee) {
  26044. return object == null
  26045. ? object
  26046. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  26047. }
  26048. /**
  26049. * Iterates over own enumerable string keyed properties of an object and
  26050. * invokes `iteratee` for each property. The iteratee is invoked with three
  26051. * arguments: (value, key, object). Iteratee functions may exit iteration
  26052. * early by explicitly returning `false`.
  26053. *
  26054. * @static
  26055. * @memberOf _
  26056. * @since 0.3.0
  26057. * @category Object
  26058. * @param {Object} object The object to iterate over.
  26059. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26060. * @returns {Object} Returns `object`.
  26061. * @see _.forOwnRight
  26062. * @example
  26063. *
  26064. * function Foo() {
  26065. * this.a = 1;
  26066. * this.b = 2;
  26067. * }
  26068. *
  26069. * Foo.prototype.c = 3;
  26070. *
  26071. * _.forOwn(new Foo, function(value, key) {
  26072. * console.log(key);
  26073. * });
  26074. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26075. */
  26076. function forOwn(object, iteratee) {
  26077. return object && baseForOwn(object, getIteratee(iteratee, 3));
  26078. }
  26079. /**
  26080. * This method is like `_.forOwn` except that it iterates over properties of
  26081. * `object` in the opposite order.
  26082. *
  26083. * @static
  26084. * @memberOf _
  26085. * @since 2.0.0
  26086. * @category Object
  26087. * @param {Object} object The object to iterate over.
  26088. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26089. * @returns {Object} Returns `object`.
  26090. * @see _.forOwn
  26091. * @example
  26092. *
  26093. * function Foo() {
  26094. * this.a = 1;
  26095. * this.b = 2;
  26096. * }
  26097. *
  26098. * Foo.prototype.c = 3;
  26099. *
  26100. * _.forOwnRight(new Foo, function(value, key) {
  26101. * console.log(key);
  26102. * });
  26103. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  26104. */
  26105. function forOwnRight(object, iteratee) {
  26106. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  26107. }
  26108. /**
  26109. * Creates an array of function property names from own enumerable properties
  26110. * of `object`.
  26111. *
  26112. * @static
  26113. * @since 0.1.0
  26114. * @memberOf _
  26115. * @category Object
  26116. * @param {Object} object The object to inspect.
  26117. * @returns {Array} Returns the function names.
  26118. * @see _.functionsIn
  26119. * @example
  26120. *
  26121. * function Foo() {
  26122. * this.a = _.constant('a');
  26123. * this.b = _.constant('b');
  26124. * }
  26125. *
  26126. * Foo.prototype.c = _.constant('c');
  26127. *
  26128. * _.functions(new Foo);
  26129. * // => ['a', 'b']
  26130. */
  26131. function functions(object) {
  26132. return object == null ? [] : baseFunctions(object, keys(object));
  26133. }
  26134. /**
  26135. * Creates an array of function property names from own and inherited
  26136. * enumerable properties of `object`.
  26137. *
  26138. * @static
  26139. * @memberOf _
  26140. * @since 4.0.0
  26141. * @category Object
  26142. * @param {Object} object The object to inspect.
  26143. * @returns {Array} Returns the function names.
  26144. * @see _.functions
  26145. * @example
  26146. *
  26147. * function Foo() {
  26148. * this.a = _.constant('a');
  26149. * this.b = _.constant('b');
  26150. * }
  26151. *
  26152. * Foo.prototype.c = _.constant('c');
  26153. *
  26154. * _.functionsIn(new Foo);
  26155. * // => ['a', 'b', 'c']
  26156. */
  26157. function functionsIn(object) {
  26158. return object == null ? [] : baseFunctions(object, keysIn(object));
  26159. }
  26160. /**
  26161. * Gets the value at `path` of `object`. If the resolved value is
  26162. * `undefined`, the `defaultValue` is returned in its place.
  26163. *
  26164. * @static
  26165. * @memberOf _
  26166. * @since 3.7.0
  26167. * @category Object
  26168. * @param {Object} object The object to query.
  26169. * @param {Array|string} path The path of the property to get.
  26170. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  26171. * @returns {*} Returns the resolved value.
  26172. * @example
  26173. *
  26174. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  26175. *
  26176. * _.get(object, 'a[0].b.c');
  26177. * // => 3
  26178. *
  26179. * _.get(object, ['a', '0', 'b', 'c']);
  26180. * // => 3
  26181. *
  26182. * _.get(object, 'a.b.c', 'default');
  26183. * // => 'default'
  26184. */
  26185. function get(object, path, defaultValue) {
  26186. var result = object == null ? undefined : baseGet(object, path);
  26187. return result === undefined ? defaultValue : result;
  26188. }
  26189. /**
  26190. * Checks if `path` is a direct property of `object`.
  26191. *
  26192. * @static
  26193. * @since 0.1.0
  26194. * @memberOf _
  26195. * @category Object
  26196. * @param {Object} object The object to query.
  26197. * @param {Array|string} path The path to check.
  26198. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  26199. * @example
  26200. *
  26201. * var object = { 'a': { 'b': 2 } };
  26202. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  26203. *
  26204. * _.has(object, 'a');
  26205. * // => true
  26206. *
  26207. * _.has(object, 'a.b');
  26208. * // => true
  26209. *
  26210. * _.has(object, ['a', 'b']);
  26211. * // => true
  26212. *
  26213. * _.has(other, 'a');
  26214. * // => false
  26215. */
  26216. function has(object, path) {
  26217. return object != null && hasPath(object, path, baseHas);
  26218. }
  26219. /**
  26220. * Checks if `path` is a direct or inherited property of `object`.
  26221. *
  26222. * @static
  26223. * @memberOf _
  26224. * @since 4.0.0
  26225. * @category Object
  26226. * @param {Object} object The object to query.
  26227. * @param {Array|string} path The path to check.
  26228. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  26229. * @example
  26230. *
  26231. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  26232. *
  26233. * _.hasIn(object, 'a');
  26234. * // => true
  26235. *
  26236. * _.hasIn(object, 'a.b');
  26237. * // => true
  26238. *
  26239. * _.hasIn(object, ['a', 'b']);
  26240. * // => true
  26241. *
  26242. * _.hasIn(object, 'b');
  26243. * // => false
  26244. */
  26245. function hasIn(object, path) {
  26246. return object != null && hasPath(object, path, baseHasIn);
  26247. }
  26248. /**
  26249. * Creates an object composed of the inverted keys and values of `object`.
  26250. * If `object` contains duplicate values, subsequent values overwrite
  26251. * property assignments of previous values.
  26252. *
  26253. * @static
  26254. * @memberOf _
  26255. * @since 0.7.0
  26256. * @category Object
  26257. * @param {Object} object The object to invert.
  26258. * @returns {Object} Returns the new inverted object.
  26259. * @example
  26260. *
  26261. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  26262. *
  26263. * _.invert(object);
  26264. * // => { '1': 'c', '2': 'b' }
  26265. */
  26266. var invert = createInverter(function(result, value, key) {
  26267. if (value != null &&
  26268. typeof value.toString != 'function') {
  26269. value = nativeObjectToString.call(value);
  26270. }
  26271. result[value] = key;
  26272. }, constant(identity));
  26273. /**
  26274. * This method is like `_.invert` except that the inverted object is generated
  26275. * from the results of running each element of `object` thru `iteratee`. The
  26276. * corresponding inverted value of each inverted key is an array of keys
  26277. * responsible for generating the inverted value. The iteratee is invoked
  26278. * with one argument: (value).
  26279. *
  26280. * @static
  26281. * @memberOf _
  26282. * @since 4.1.0
  26283. * @category Object
  26284. * @param {Object} object The object to invert.
  26285. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26286. * @returns {Object} Returns the new inverted object.
  26287. * @example
  26288. *
  26289. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  26290. *
  26291. * _.invertBy(object);
  26292. * // => { '1': ['a', 'c'], '2': ['b'] }
  26293. *
  26294. * _.invertBy(object, function(value) {
  26295. * return 'group' + value;
  26296. * });
  26297. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  26298. */
  26299. var invertBy = createInverter(function(result, value, key) {
  26300. if (value != null &&
  26301. typeof value.toString != 'function') {
  26302. value = nativeObjectToString.call(value);
  26303. }
  26304. if (hasOwnProperty.call(result, value)) {
  26305. result[value].push(key);
  26306. } else {
  26307. result[value] = [key];
  26308. }
  26309. }, getIteratee);
  26310. /**
  26311. * Invokes the method at `path` of `object`.
  26312. *
  26313. * @static
  26314. * @memberOf _
  26315. * @since 4.0.0
  26316. * @category Object
  26317. * @param {Object} object The object to query.
  26318. * @param {Array|string} path The path of the method to invoke.
  26319. * @param {...*} [args] The arguments to invoke the method with.
  26320. * @returns {*} Returns the result of the invoked method.
  26321. * @example
  26322. *
  26323. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  26324. *
  26325. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  26326. * // => [2, 3]
  26327. */
  26328. var invoke = baseRest(baseInvoke);
  26329. /**
  26330. * Creates an array of the own enumerable property names of `object`.
  26331. *
  26332. * **Note:** Non-object values are coerced to objects. See the
  26333. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  26334. * for more details.
  26335. *
  26336. * @static
  26337. * @since 0.1.0
  26338. * @memberOf _
  26339. * @category Object
  26340. * @param {Object} object The object to query.
  26341. * @returns {Array} Returns the array of property names.
  26342. * @example
  26343. *
  26344. * function Foo() {
  26345. * this.a = 1;
  26346. * this.b = 2;
  26347. * }
  26348. *
  26349. * Foo.prototype.c = 3;
  26350. *
  26351. * _.keys(new Foo);
  26352. * // => ['a', 'b'] (iteration order is not guaranteed)
  26353. *
  26354. * _.keys('hi');
  26355. * // => ['0', '1']
  26356. */
  26357. function keys(object) {
  26358. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  26359. }
  26360. /**
  26361. * Creates an array of the own and inherited enumerable property names of `object`.
  26362. *
  26363. * **Note:** Non-object values are coerced to objects.
  26364. *
  26365. * @static
  26366. * @memberOf _
  26367. * @since 3.0.0
  26368. * @category Object
  26369. * @param {Object} object The object to query.
  26370. * @returns {Array} Returns the array of property names.
  26371. * @example
  26372. *
  26373. * function Foo() {
  26374. * this.a = 1;
  26375. * this.b = 2;
  26376. * }
  26377. *
  26378. * Foo.prototype.c = 3;
  26379. *
  26380. * _.keysIn(new Foo);
  26381. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  26382. */
  26383. function keysIn(object) {
  26384. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  26385. }
  26386. /**
  26387. * The opposite of `_.mapValues`; this method creates an object with the
  26388. * same values as `object` and keys generated by running each own enumerable
  26389. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  26390. * with three arguments: (value, key, object).
  26391. *
  26392. * @static
  26393. * @memberOf _
  26394. * @since 3.8.0
  26395. * @category Object
  26396. * @param {Object} object The object to iterate over.
  26397. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26398. * @returns {Object} Returns the new mapped object.
  26399. * @see _.mapValues
  26400. * @example
  26401. *
  26402. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  26403. * return key + value;
  26404. * });
  26405. * // => { 'a1': 1, 'b2': 2 }
  26406. */
  26407. function mapKeys(object, iteratee) {
  26408. var result = {};
  26409. iteratee = getIteratee(iteratee, 3);
  26410. baseForOwn(object, function(value, key, object) {
  26411. baseAssignValue(result, iteratee(value, key, object), value);
  26412. });
  26413. return result;
  26414. }
  26415. /**
  26416. * Creates an object with the same keys as `object` and values generated
  26417. * by running each own enumerable string keyed property of `object` thru
  26418. * `iteratee`. The iteratee is invoked with three arguments:
  26419. * (value, key, object).
  26420. *
  26421. * @static
  26422. * @memberOf _
  26423. * @since 2.4.0
  26424. * @category Object
  26425. * @param {Object} object The object to iterate over.
  26426. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26427. * @returns {Object} Returns the new mapped object.
  26428. * @see _.mapKeys
  26429. * @example
  26430. *
  26431. * var users = {
  26432. * 'fred': { 'user': 'fred', 'age': 40 },
  26433. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  26434. * };
  26435. *
  26436. * _.mapValues(users, function(o) { return o.age; });
  26437. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  26438. *
  26439. * // The `_.property` iteratee shorthand.
  26440. * _.mapValues(users, 'age');
  26441. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  26442. */
  26443. function mapValues(object, iteratee) {
  26444. var result = {};
  26445. iteratee = getIteratee(iteratee, 3);
  26446. baseForOwn(object, function(value, key, object) {
  26447. baseAssignValue(result, key, iteratee(value, key, object));
  26448. });
  26449. return result;
  26450. }
  26451. /**
  26452. * This method is like `_.assign` except that it recursively merges own and
  26453. * inherited enumerable string keyed properties of source objects into the
  26454. * destination object. Source properties that resolve to `undefined` are
  26455. * skipped if a destination value exists. Array and plain object properties
  26456. * are merged recursively. Other objects and value types are overridden by
  26457. * assignment. Source objects are applied from left to right. Subsequent
  26458. * sources overwrite property assignments of previous sources.
  26459. *
  26460. * **Note:** This method mutates `object`.
  26461. *
  26462. * @static
  26463. * @memberOf _
  26464. * @since 0.5.0
  26465. * @category Object
  26466. * @param {Object} object The destination object.
  26467. * @param {...Object} [sources] The source objects.
  26468. * @returns {Object} Returns `object`.
  26469. * @example
  26470. *
  26471. * var object = {
  26472. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  26473. * };
  26474. *
  26475. * var other = {
  26476. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  26477. * };
  26478. *
  26479. * _.merge(object, other);
  26480. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  26481. */
  26482. var merge = createAssigner(function(object, source, srcIndex) {
  26483. baseMerge(object, source, srcIndex);
  26484. });
  26485. /**
  26486. * This method is like `_.merge` except that it accepts `customizer` which
  26487. * is invoked to produce the merged values of the destination and source
  26488. * properties. If `customizer` returns `undefined`, merging is handled by the
  26489. * method instead. The `customizer` is invoked with six arguments:
  26490. * (objValue, srcValue, key, object, source, stack).
  26491. *
  26492. * **Note:** This method mutates `object`.
  26493. *
  26494. * @static
  26495. * @memberOf _
  26496. * @since 4.0.0
  26497. * @category Object
  26498. * @param {Object} object The destination object.
  26499. * @param {...Object} sources The source objects.
  26500. * @param {Function} customizer The function to customize assigned values.
  26501. * @returns {Object} Returns `object`.
  26502. * @example
  26503. *
  26504. * function customizer(objValue, srcValue) {
  26505. * if (_.isArray(objValue)) {
  26506. * return objValue.concat(srcValue);
  26507. * }
  26508. * }
  26509. *
  26510. * var object = { 'a': [1], 'b': [2] };
  26511. * var other = { 'a': [3], 'b': [4] };
  26512. *
  26513. * _.mergeWith(object, other, customizer);
  26514. * // => { 'a': [1, 3], 'b': [2, 4] }
  26515. */
  26516. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  26517. baseMerge(object, source, srcIndex, customizer);
  26518. });
  26519. /**
  26520. * The opposite of `_.pick`; this method creates an object composed of the
  26521. * own and inherited enumerable property paths of `object` that are not omitted.
  26522. *
  26523. * **Note:** This method is considerably slower than `_.pick`.
  26524. *
  26525. * @static
  26526. * @since 0.1.0
  26527. * @memberOf _
  26528. * @category Object
  26529. * @param {Object} object The source object.
  26530. * @param {...(string|string[])} [paths] The property paths to omit.
  26531. * @returns {Object} Returns the new object.
  26532. * @example
  26533. *
  26534. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26535. *
  26536. * _.omit(object, ['a', 'c']);
  26537. * // => { 'b': '2' }
  26538. */
  26539. var omit = flatRest(function(object, paths) {
  26540. var result = {};
  26541. if (object == null) {
  26542. return result;
  26543. }
  26544. var isDeep = false;
  26545. paths = arrayMap(paths, function(path) {
  26546. path = castPath(path, object);
  26547. isDeep || (isDeep = path.length > 1);
  26548. return path;
  26549. });
  26550. copyObject(object, getAllKeysIn(object), result);
  26551. if (isDeep) {
  26552. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  26553. }
  26554. var length = paths.length;
  26555. while (length--) {
  26556. baseUnset(result, paths[length]);
  26557. }
  26558. return result;
  26559. });
  26560. /**
  26561. * The opposite of `_.pickBy`; this method creates an object composed of
  26562. * the own and inherited enumerable string keyed properties of `object` that
  26563. * `predicate` doesn't return truthy for. The predicate is invoked with two
  26564. * arguments: (value, key).
  26565. *
  26566. * @static
  26567. * @memberOf _
  26568. * @since 4.0.0
  26569. * @category Object
  26570. * @param {Object} object The source object.
  26571. * @param {Function} [predicate=_.identity] The function invoked per property.
  26572. * @returns {Object} Returns the new object.
  26573. * @example
  26574. *
  26575. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26576. *
  26577. * _.omitBy(object, _.isNumber);
  26578. * // => { 'b': '2' }
  26579. */
  26580. function omitBy(object, predicate) {
  26581. return pickBy(object, negate(getIteratee(predicate)));
  26582. }
  26583. /**
  26584. * Creates an object composed of the picked `object` properties.
  26585. *
  26586. * @static
  26587. * @since 0.1.0
  26588. * @memberOf _
  26589. * @category Object
  26590. * @param {Object} object The source object.
  26591. * @param {...(string|string[])} [paths] The property paths to pick.
  26592. * @returns {Object} Returns the new object.
  26593. * @example
  26594. *
  26595. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26596. *
  26597. * _.pick(object, ['a', 'c']);
  26598. * // => { 'a': 1, 'c': 3 }
  26599. */
  26600. var pick = flatRest(function(object, paths) {
  26601. return object == null ? {} : basePick(object, paths);
  26602. });
  26603. /**
  26604. * Creates an object composed of the `object` properties `predicate` returns
  26605. * truthy for. The predicate is invoked with two arguments: (value, key).
  26606. *
  26607. * @static
  26608. * @memberOf _
  26609. * @since 4.0.0
  26610. * @category Object
  26611. * @param {Object} object The source object.
  26612. * @param {Function} [predicate=_.identity] The function invoked per property.
  26613. * @returns {Object} Returns the new object.
  26614. * @example
  26615. *
  26616. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26617. *
  26618. * _.pickBy(object, _.isNumber);
  26619. * // => { 'a': 1, 'c': 3 }
  26620. */
  26621. function pickBy(object, predicate) {
  26622. if (object == null) {
  26623. return {};
  26624. }
  26625. var props = arrayMap(getAllKeysIn(object), function(prop) {
  26626. return [prop];
  26627. });
  26628. predicate = getIteratee(predicate);
  26629. return basePickBy(object, props, function(value, path) {
  26630. return predicate(value, path[0]);
  26631. });
  26632. }
  26633. /**
  26634. * This method is like `_.get` except that if the resolved value is a
  26635. * function it's invoked with the `this` binding of its parent object and
  26636. * its result is returned.
  26637. *
  26638. * @static
  26639. * @since 0.1.0
  26640. * @memberOf _
  26641. * @category Object
  26642. * @param {Object} object The object to query.
  26643. * @param {Array|string} path The path of the property to resolve.
  26644. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  26645. * @returns {*} Returns the resolved value.
  26646. * @example
  26647. *
  26648. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  26649. *
  26650. * _.result(object, 'a[0].b.c1');
  26651. * // => 3
  26652. *
  26653. * _.result(object, 'a[0].b.c2');
  26654. * // => 4
  26655. *
  26656. * _.result(object, 'a[0].b.c3', 'default');
  26657. * // => 'default'
  26658. *
  26659. * _.result(object, 'a[0].b.c3', _.constant('default'));
  26660. * // => 'default'
  26661. */
  26662. function result(object, path, defaultValue) {
  26663. path = castPath(path, object);
  26664. var index = -1,
  26665. length = path.length;
  26666. // Ensure the loop is entered when path is empty.
  26667. if (!length) {
  26668. length = 1;
  26669. object = undefined;
  26670. }
  26671. while (++index < length) {
  26672. var value = object == null ? undefined : object[toKey(path[index])];
  26673. if (value === undefined) {
  26674. index = length;
  26675. value = defaultValue;
  26676. }
  26677. object = isFunction(value) ? value.call(object) : value;
  26678. }
  26679. return object;
  26680. }
  26681. /**
  26682. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  26683. * it's created. Arrays are created for missing index properties while objects
  26684. * are created for all other missing properties. Use `_.setWith` to customize
  26685. * `path` creation.
  26686. *
  26687. * **Note:** This method mutates `object`.
  26688. *
  26689. * @static
  26690. * @memberOf _
  26691. * @since 3.7.0
  26692. * @category Object
  26693. * @param {Object} object The object to modify.
  26694. * @param {Array|string} path The path of the property to set.
  26695. * @param {*} value The value to set.
  26696. * @returns {Object} Returns `object`.
  26697. * @example
  26698. *
  26699. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  26700. *
  26701. * _.set(object, 'a[0].b.c', 4);
  26702. * console.log(object.a[0].b.c);
  26703. * // => 4
  26704. *
  26705. * _.set(object, ['x', '0', 'y', 'z'], 5);
  26706. * console.log(object.x[0].y.z);
  26707. * // => 5
  26708. */
  26709. function set(object, path, value) {
  26710. return object == null ? object : baseSet(object, path, value);
  26711. }
  26712. /**
  26713. * This method is like `_.set` except that it accepts `customizer` which is
  26714. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  26715. * path creation is handled by the method instead. The `customizer` is invoked
  26716. * with three arguments: (nsValue, key, nsObject).
  26717. *
  26718. * **Note:** This method mutates `object`.
  26719. *
  26720. * @static
  26721. * @memberOf _
  26722. * @since 4.0.0
  26723. * @category Object
  26724. * @param {Object} object The object to modify.
  26725. * @param {Array|string} path The path of the property to set.
  26726. * @param {*} value The value to set.
  26727. * @param {Function} [customizer] The function to customize assigned values.
  26728. * @returns {Object} Returns `object`.
  26729. * @example
  26730. *
  26731. * var object = {};
  26732. *
  26733. * _.setWith(object, '[0][1]', 'a', Object);
  26734. * // => { '0': { '1': 'a' } }
  26735. */
  26736. function setWith(object, path, value, customizer) {
  26737. customizer = typeof customizer == 'function' ? customizer : undefined;
  26738. return object == null ? object : baseSet(object, path, value, customizer);
  26739. }
  26740. /**
  26741. * Creates an array of own enumerable string keyed-value pairs for `object`
  26742. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  26743. * entries are returned.
  26744. *
  26745. * @static
  26746. * @memberOf _
  26747. * @since 4.0.0
  26748. * @alias entries
  26749. * @category Object
  26750. * @param {Object} object The object to query.
  26751. * @returns {Array} Returns the key-value pairs.
  26752. * @example
  26753. *
  26754. * function Foo() {
  26755. * this.a = 1;
  26756. * this.b = 2;
  26757. * }
  26758. *
  26759. * Foo.prototype.c = 3;
  26760. *
  26761. * _.toPairs(new Foo);
  26762. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  26763. */
  26764. var toPairs = createToPairs(keys);
  26765. /**
  26766. * Creates an array of own and inherited enumerable string keyed-value pairs
  26767. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  26768. * or set, its entries are returned.
  26769. *
  26770. * @static
  26771. * @memberOf _
  26772. * @since 4.0.0
  26773. * @alias entriesIn
  26774. * @category Object
  26775. * @param {Object} object The object to query.
  26776. * @returns {Array} Returns the key-value pairs.
  26777. * @example
  26778. *
  26779. * function Foo() {
  26780. * this.a = 1;
  26781. * this.b = 2;
  26782. * }
  26783. *
  26784. * Foo.prototype.c = 3;
  26785. *
  26786. * _.toPairsIn(new Foo);
  26787. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  26788. */
  26789. var toPairsIn = createToPairs(keysIn);
  26790. /**
  26791. * An alternative to `_.reduce`; this method transforms `object` to a new
  26792. * `accumulator` object which is the result of running each of its own
  26793. * enumerable string keyed properties thru `iteratee`, with each invocation
  26794. * potentially mutating the `accumulator` object. If `accumulator` is not
  26795. * provided, a new object with the same `[[Prototype]]` will be used. The
  26796. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  26797. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26798. *
  26799. * @static
  26800. * @memberOf _
  26801. * @since 1.3.0
  26802. * @category Object
  26803. * @param {Object} object The object to iterate over.
  26804. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26805. * @param {*} [accumulator] The custom accumulator value.
  26806. * @returns {*} Returns the accumulated value.
  26807. * @example
  26808. *
  26809. * _.transform([2, 3, 4], function(result, n) {
  26810. * result.push(n *= n);
  26811. * return n % 2 == 0;
  26812. * }, []);
  26813. * // => [4, 9]
  26814. *
  26815. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  26816. * (result[value] || (result[value] = [])).push(key);
  26817. * }, {});
  26818. * // => { '1': ['a', 'c'], '2': ['b'] }
  26819. */
  26820. function transform(object, iteratee, accumulator) {
  26821. var isArr = isArray(object),
  26822. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  26823. iteratee = getIteratee(iteratee, 4);
  26824. if (accumulator == null) {
  26825. var Ctor = object && object.constructor;
  26826. if (isArrLike) {
  26827. accumulator = isArr ? new Ctor : [];
  26828. }
  26829. else if (isObject(object)) {
  26830. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  26831. }
  26832. else {
  26833. accumulator = {};
  26834. }
  26835. }
  26836. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  26837. return iteratee(accumulator, value, index, object);
  26838. });
  26839. return accumulator;
  26840. }
  26841. /**
  26842. * Removes the property at `path` of `object`.
  26843. *
  26844. * **Note:** This method mutates `object`.
  26845. *
  26846. * @static
  26847. * @memberOf _
  26848. * @since 4.0.0
  26849. * @category Object
  26850. * @param {Object} object The object to modify.
  26851. * @param {Array|string} path The path of the property to unset.
  26852. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  26853. * @example
  26854. *
  26855. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  26856. * _.unset(object, 'a[0].b.c');
  26857. * // => true
  26858. *
  26859. * console.log(object);
  26860. * // => { 'a': [{ 'b': {} }] };
  26861. *
  26862. * _.unset(object, ['a', '0', 'b', 'c']);
  26863. * // => true
  26864. *
  26865. * console.log(object);
  26866. * // => { 'a': [{ 'b': {} }] };
  26867. */
  26868. function unset(object, path) {
  26869. return object == null ? true : baseUnset(object, path);
  26870. }
  26871. /**
  26872. * This method is like `_.set` except that accepts `updater` to produce the
  26873. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  26874. * is invoked with one argument: (value).
  26875. *
  26876. * **Note:** This method mutates `object`.
  26877. *
  26878. * @static
  26879. * @memberOf _
  26880. * @since 4.6.0
  26881. * @category Object
  26882. * @param {Object} object The object to modify.
  26883. * @param {Array|string} path The path of the property to set.
  26884. * @param {Function} updater The function to produce the updated value.
  26885. * @returns {Object} Returns `object`.
  26886. * @example
  26887. *
  26888. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  26889. *
  26890. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  26891. * console.log(object.a[0].b.c);
  26892. * // => 9
  26893. *
  26894. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  26895. * console.log(object.x[0].y.z);
  26896. * // => 0
  26897. */
  26898. function update(object, path, updater) {
  26899. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  26900. }
  26901. /**
  26902. * This method is like `_.update` except that it accepts `customizer` which is
  26903. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  26904. * path creation is handled by the method instead. The `customizer` is invoked
  26905. * with three arguments: (nsValue, key, nsObject).
  26906. *
  26907. * **Note:** This method mutates `object`.
  26908. *
  26909. * @static
  26910. * @memberOf _
  26911. * @since 4.6.0
  26912. * @category Object
  26913. * @param {Object} object The object to modify.
  26914. * @param {Array|string} path The path of the property to set.
  26915. * @param {Function} updater The function to produce the updated value.
  26916. * @param {Function} [customizer] The function to customize assigned values.
  26917. * @returns {Object} Returns `object`.
  26918. * @example
  26919. *
  26920. * var object = {};
  26921. *
  26922. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  26923. * // => { '0': { '1': 'a' } }
  26924. */
  26925. function updateWith(object, path, updater, customizer) {
  26926. customizer = typeof customizer == 'function' ? customizer : undefined;
  26927. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  26928. }
  26929. /**
  26930. * Creates an array of the own enumerable string keyed property values of `object`.
  26931. *
  26932. * **Note:** Non-object values are coerced to objects.
  26933. *
  26934. * @static
  26935. * @since 0.1.0
  26936. * @memberOf _
  26937. * @category Object
  26938. * @param {Object} object The object to query.
  26939. * @returns {Array} Returns the array of property values.
  26940. * @example
  26941. *
  26942. * function Foo() {
  26943. * this.a = 1;
  26944. * this.b = 2;
  26945. * }
  26946. *
  26947. * Foo.prototype.c = 3;
  26948. *
  26949. * _.values(new Foo);
  26950. * // => [1, 2] (iteration order is not guaranteed)
  26951. *
  26952. * _.values('hi');
  26953. * // => ['h', 'i']
  26954. */
  26955. function values(object) {
  26956. return object == null ? [] : baseValues(object, keys(object));
  26957. }
  26958. /**
  26959. * Creates an array of the own and inherited enumerable string keyed property
  26960. * values of `object`.
  26961. *
  26962. * **Note:** Non-object values are coerced to objects.
  26963. *
  26964. * @static
  26965. * @memberOf _
  26966. * @since 3.0.0
  26967. * @category Object
  26968. * @param {Object} object The object to query.
  26969. * @returns {Array} Returns the array of property values.
  26970. * @example
  26971. *
  26972. * function Foo() {
  26973. * this.a = 1;
  26974. * this.b = 2;
  26975. * }
  26976. *
  26977. * Foo.prototype.c = 3;
  26978. *
  26979. * _.valuesIn(new Foo);
  26980. * // => [1, 2, 3] (iteration order is not guaranteed)
  26981. */
  26982. function valuesIn(object) {
  26983. return object == null ? [] : baseValues(object, keysIn(object));
  26984. }
  26985. /*------------------------------------------------------------------------*/
  26986. /**
  26987. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  26988. *
  26989. * @static
  26990. * @memberOf _
  26991. * @since 4.0.0
  26992. * @category Number
  26993. * @param {number} number The number to clamp.
  26994. * @param {number} [lower] The lower bound.
  26995. * @param {number} upper The upper bound.
  26996. * @returns {number} Returns the clamped number.
  26997. * @example
  26998. *
  26999. * _.clamp(-10, -5, 5);
  27000. * // => -5
  27001. *
  27002. * _.clamp(10, -5, 5);
  27003. * // => 5
  27004. */
  27005. function clamp(number, lower, upper) {
  27006. if (upper === undefined) {
  27007. upper = lower;
  27008. lower = undefined;
  27009. }
  27010. if (upper !== undefined) {
  27011. upper = toNumber(upper);
  27012. upper = upper === upper ? upper : 0;
  27013. }
  27014. if (lower !== undefined) {
  27015. lower = toNumber(lower);
  27016. lower = lower === lower ? lower : 0;
  27017. }
  27018. return baseClamp(toNumber(number), lower, upper);
  27019. }
  27020. /**
  27021. * Checks if `n` is between `start` and up to, but not including, `end`. If
  27022. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  27023. * If `start` is greater than `end` the params are swapped to support
  27024. * negative ranges.
  27025. *
  27026. * @static
  27027. * @memberOf _
  27028. * @since 3.3.0
  27029. * @category Number
  27030. * @param {number} number The number to check.
  27031. * @param {number} [start=0] The start of the range.
  27032. * @param {number} end The end of the range.
  27033. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  27034. * @see _.range, _.rangeRight
  27035. * @example
  27036. *
  27037. * _.inRange(3, 2, 4);
  27038. * // => true
  27039. *
  27040. * _.inRange(4, 8);
  27041. * // => true
  27042. *
  27043. * _.inRange(4, 2);
  27044. * // => false
  27045. *
  27046. * _.inRange(2, 2);
  27047. * // => false
  27048. *
  27049. * _.inRange(1.2, 2);
  27050. * // => true
  27051. *
  27052. * _.inRange(5.2, 4);
  27053. * // => false
  27054. *
  27055. * _.inRange(-3, -2, -6);
  27056. * // => true
  27057. */
  27058. function inRange(number, start, end) {
  27059. start = toFinite(start);
  27060. if (end === undefined) {
  27061. end = start;
  27062. start = 0;
  27063. } else {
  27064. end = toFinite(end);
  27065. }
  27066. number = toNumber(number);
  27067. return baseInRange(number, start, end);
  27068. }
  27069. /**
  27070. * Produces a random number between the inclusive `lower` and `upper` bounds.
  27071. * If only one argument is provided a number between `0` and the given number
  27072. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  27073. * floats, a floating-point number is returned instead of an integer.
  27074. *
  27075. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  27076. * floating-point values which can produce unexpected results.
  27077. *
  27078. * @static
  27079. * @memberOf _
  27080. * @since 0.7.0
  27081. * @category Number
  27082. * @param {number} [lower=0] The lower bound.
  27083. * @param {number} [upper=1] The upper bound.
  27084. * @param {boolean} [floating] Specify returning a floating-point number.
  27085. * @returns {number} Returns the random number.
  27086. * @example
  27087. *
  27088. * _.random(0, 5);
  27089. * // => an integer between 0 and 5
  27090. *
  27091. * _.random(5);
  27092. * // => also an integer between 0 and 5
  27093. *
  27094. * _.random(5, true);
  27095. * // => a floating-point number between 0 and 5
  27096. *
  27097. * _.random(1.2, 5.2);
  27098. * // => a floating-point number between 1.2 and 5.2
  27099. */
  27100. function random(lower, upper, floating) {
  27101. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  27102. upper = floating = undefined;
  27103. }
  27104. if (floating === undefined) {
  27105. if (typeof upper == 'boolean') {
  27106. floating = upper;
  27107. upper = undefined;
  27108. }
  27109. else if (typeof lower == 'boolean') {
  27110. floating = lower;
  27111. lower = undefined;
  27112. }
  27113. }
  27114. if (lower === undefined && upper === undefined) {
  27115. lower = 0;
  27116. upper = 1;
  27117. }
  27118. else {
  27119. lower = toFinite(lower);
  27120. if (upper === undefined) {
  27121. upper = lower;
  27122. lower = 0;
  27123. } else {
  27124. upper = toFinite(upper);
  27125. }
  27126. }
  27127. if (lower > upper) {
  27128. var temp = lower;
  27129. lower = upper;
  27130. upper = temp;
  27131. }
  27132. if (floating || lower % 1 || upper % 1) {
  27133. var rand = nativeRandom();
  27134. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  27135. }
  27136. return baseRandom(lower, upper);
  27137. }
  27138. /*------------------------------------------------------------------------*/
  27139. /**
  27140. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  27141. *
  27142. * @static
  27143. * @memberOf _
  27144. * @since 3.0.0
  27145. * @category String
  27146. * @param {string} [string=''] The string to convert.
  27147. * @returns {string} Returns the camel cased string.
  27148. * @example
  27149. *
  27150. * _.camelCase('Foo Bar');
  27151. * // => 'fooBar'
  27152. *
  27153. * _.camelCase('--foo-bar--');
  27154. * // => 'fooBar'
  27155. *
  27156. * _.camelCase('__FOO_BAR__');
  27157. * // => 'fooBar'
  27158. */
  27159. var camelCase = createCompounder(function(result, word, index) {
  27160. word = word.toLowerCase();
  27161. return result + (index ? capitalize(word) : word);
  27162. });
  27163. /**
  27164. * Converts the first character of `string` to upper case and the remaining
  27165. * to lower case.
  27166. *
  27167. * @static
  27168. * @memberOf _
  27169. * @since 3.0.0
  27170. * @category String
  27171. * @param {string} [string=''] The string to capitalize.
  27172. * @returns {string} Returns the capitalized string.
  27173. * @example
  27174. *
  27175. * _.capitalize('FRED');
  27176. * // => 'Fred'
  27177. */
  27178. function capitalize(string) {
  27179. return upperFirst(toString(string).toLowerCase());
  27180. }
  27181. /**
  27182. * Deburrs `string` by converting
  27183. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  27184. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  27185. * letters to basic Latin letters and removing
  27186. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  27187. *
  27188. * @static
  27189. * @memberOf _
  27190. * @since 3.0.0
  27191. * @category String
  27192. * @param {string} [string=''] The string to deburr.
  27193. * @returns {string} Returns the deburred string.
  27194. * @example
  27195. *
  27196. * _.deburr('déjà vu');
  27197. * // => 'deja vu'
  27198. */
  27199. function deburr(string) {
  27200. string = toString(string);
  27201. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  27202. }
  27203. /**
  27204. * Checks if `string` ends with the given target string.
  27205. *
  27206. * @static
  27207. * @memberOf _
  27208. * @since 3.0.0
  27209. * @category String
  27210. * @param {string} [string=''] The string to inspect.
  27211. * @param {string} [target] The string to search for.
  27212. * @param {number} [position=string.length] The position to search up to.
  27213. * @returns {boolean} Returns `true` if `string` ends with `target`,
  27214. * else `false`.
  27215. * @example
  27216. *
  27217. * _.endsWith('abc', 'c');
  27218. * // => true
  27219. *
  27220. * _.endsWith('abc', 'b');
  27221. * // => false
  27222. *
  27223. * _.endsWith('abc', 'b', 2);
  27224. * // => true
  27225. */
  27226. function endsWith(string, target, position) {
  27227. string = toString(string);
  27228. target = baseToString(target);
  27229. var length = string.length;
  27230. position = position === undefined
  27231. ? length
  27232. : baseClamp(toInteger(position), 0, length);
  27233. var end = position;
  27234. position -= target.length;
  27235. return position >= 0 && string.slice(position, end) == target;
  27236. }
  27237. /**
  27238. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  27239. * corresponding HTML entities.
  27240. *
  27241. * **Note:** No other characters are escaped. To escape additional
  27242. * characters use a third-party library like [_he_](https://mths.be/he).
  27243. *
  27244. * Though the ">" character is escaped for symmetry, characters like
  27245. * ">" and "/" don't need escaping in HTML and have no special meaning
  27246. * unless they're part of a tag or unquoted attribute value. See
  27247. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  27248. * (under "semi-related fun fact") for more details.
  27249. *
  27250. * When working with HTML you should always
  27251. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  27252. * XSS vectors.
  27253. *
  27254. * @static
  27255. * @since 0.1.0
  27256. * @memberOf _
  27257. * @category String
  27258. * @param {string} [string=''] The string to escape.
  27259. * @returns {string} Returns the escaped string.
  27260. * @example
  27261. *
  27262. * _.escape('fred, barney, & pebbles');
  27263. * // => 'fred, barney, &amp; pebbles'
  27264. */
  27265. function escape(string) {
  27266. string = toString(string);
  27267. return (string && reHasUnescapedHtml.test(string))
  27268. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  27269. : string;
  27270. }
  27271. /**
  27272. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  27273. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  27274. *
  27275. * @static
  27276. * @memberOf _
  27277. * @since 3.0.0
  27278. * @category String
  27279. * @param {string} [string=''] The string to escape.
  27280. * @returns {string} Returns the escaped string.
  27281. * @example
  27282. *
  27283. * _.escapeRegExp('[lodash](https://lodash.com/)');
  27284. * // => '\[lodash\]\(https://lodash\.com/\)'
  27285. */
  27286. function escapeRegExp(string) {
  27287. string = toString(string);
  27288. return (string && reHasRegExpChar.test(string))
  27289. ? string.replace(reRegExpChar, '\\$&')
  27290. : string;
  27291. }
  27292. /**
  27293. * Converts `string` to
  27294. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  27295. *
  27296. * @static
  27297. * @memberOf _
  27298. * @since 3.0.0
  27299. * @category String
  27300. * @param {string} [string=''] The string to convert.
  27301. * @returns {string} Returns the kebab cased string.
  27302. * @example
  27303. *
  27304. * _.kebabCase('Foo Bar');
  27305. * // => 'foo-bar'
  27306. *
  27307. * _.kebabCase('fooBar');
  27308. * // => 'foo-bar'
  27309. *
  27310. * _.kebabCase('__FOO_BAR__');
  27311. * // => 'foo-bar'
  27312. */
  27313. var kebabCase = createCompounder(function(result, word, index) {
  27314. return result + (index ? '-' : '') + word.toLowerCase();
  27315. });
  27316. /**
  27317. * Converts `string`, as space separated words, to lower case.
  27318. *
  27319. * @static
  27320. * @memberOf _
  27321. * @since 4.0.0
  27322. * @category String
  27323. * @param {string} [string=''] The string to convert.
  27324. * @returns {string} Returns the lower cased string.
  27325. * @example
  27326. *
  27327. * _.lowerCase('--Foo-Bar--');
  27328. * // => 'foo bar'
  27329. *
  27330. * _.lowerCase('fooBar');
  27331. * // => 'foo bar'
  27332. *
  27333. * _.lowerCase('__FOO_BAR__');
  27334. * // => 'foo bar'
  27335. */
  27336. var lowerCase = createCompounder(function(result, word, index) {
  27337. return result + (index ? ' ' : '') + word.toLowerCase();
  27338. });
  27339. /**
  27340. * Converts the first character of `string` to lower case.
  27341. *
  27342. * @static
  27343. * @memberOf _
  27344. * @since 4.0.0
  27345. * @category String
  27346. * @param {string} [string=''] The string to convert.
  27347. * @returns {string} Returns the converted string.
  27348. * @example
  27349. *
  27350. * _.lowerFirst('Fred');
  27351. * // => 'fred'
  27352. *
  27353. * _.lowerFirst('FRED');
  27354. * // => 'fRED'
  27355. */
  27356. var lowerFirst = createCaseFirst('toLowerCase');
  27357. /**
  27358. * Pads `string` on the left and right sides if it's shorter than `length`.
  27359. * Padding characters are truncated if they can't be evenly divided by `length`.
  27360. *
  27361. * @static
  27362. * @memberOf _
  27363. * @since 3.0.0
  27364. * @category String
  27365. * @param {string} [string=''] The string to pad.
  27366. * @param {number} [length=0] The padding length.
  27367. * @param {string} [chars=' '] The string used as padding.
  27368. * @returns {string} Returns the padded string.
  27369. * @example
  27370. *
  27371. * _.pad('abc', 8);
  27372. * // => ' abc '
  27373. *
  27374. * _.pad('abc', 8, '_-');
  27375. * // => '_-abc_-_'
  27376. *
  27377. * _.pad('abc', 3);
  27378. * // => 'abc'
  27379. */
  27380. function pad(string, length, chars) {
  27381. string = toString(string);
  27382. length = toInteger(length);
  27383. var strLength = length ? stringSize(string) : 0;
  27384. if (!length || strLength >= length) {
  27385. return string;
  27386. }
  27387. var mid = (length - strLength) / 2;
  27388. return (
  27389. createPadding(nativeFloor(mid), chars) +
  27390. string +
  27391. createPadding(nativeCeil(mid), chars)
  27392. );
  27393. }
  27394. /**
  27395. * Pads `string` on the right side if it's shorter than `length`. Padding
  27396. * characters are truncated if they exceed `length`.
  27397. *
  27398. * @static
  27399. * @memberOf _
  27400. * @since 4.0.0
  27401. * @category String
  27402. * @param {string} [string=''] The string to pad.
  27403. * @param {number} [length=0] The padding length.
  27404. * @param {string} [chars=' '] The string used as padding.
  27405. * @returns {string} Returns the padded string.
  27406. * @example
  27407. *
  27408. * _.padEnd('abc', 6);
  27409. * // => 'abc '
  27410. *
  27411. * _.padEnd('abc', 6, '_-');
  27412. * // => 'abc_-_'
  27413. *
  27414. * _.padEnd('abc', 3);
  27415. * // => 'abc'
  27416. */
  27417. function padEnd(string, length, chars) {
  27418. string = toString(string);
  27419. length = toInteger(length);
  27420. var strLength = length ? stringSize(string) : 0;
  27421. return (length && strLength < length)
  27422. ? (string + createPadding(length - strLength, chars))
  27423. : string;
  27424. }
  27425. /**
  27426. * Pads `string` on the left side if it's shorter than `length`. Padding
  27427. * characters are truncated if they exceed `length`.
  27428. *
  27429. * @static
  27430. * @memberOf _
  27431. * @since 4.0.0
  27432. * @category String
  27433. * @param {string} [string=''] The string to pad.
  27434. * @param {number} [length=0] The padding length.
  27435. * @param {string} [chars=' '] The string used as padding.
  27436. * @returns {string} Returns the padded string.
  27437. * @example
  27438. *
  27439. * _.padStart('abc', 6);
  27440. * // => ' abc'
  27441. *
  27442. * _.padStart('abc', 6, '_-');
  27443. * // => '_-_abc'
  27444. *
  27445. * _.padStart('abc', 3);
  27446. * // => 'abc'
  27447. */
  27448. function padStart(string, length, chars) {
  27449. string = toString(string);
  27450. length = toInteger(length);
  27451. var strLength = length ? stringSize(string) : 0;
  27452. return (length && strLength < length)
  27453. ? (createPadding(length - strLength, chars) + string)
  27454. : string;
  27455. }
  27456. /**
  27457. * Converts `string` to an integer of the specified radix. If `radix` is
  27458. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  27459. * hexadecimal, in which case a `radix` of `16` is used.
  27460. *
  27461. * **Note:** This method aligns with the
  27462. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  27463. *
  27464. * @static
  27465. * @memberOf _
  27466. * @since 1.1.0
  27467. * @category String
  27468. * @param {string} string The string to convert.
  27469. * @param {number} [radix=10] The radix to interpret `value` by.
  27470. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27471. * @returns {number} Returns the converted integer.
  27472. * @example
  27473. *
  27474. * _.parseInt('08');
  27475. * // => 8
  27476. *
  27477. * _.map(['6', '08', '10'], _.parseInt);
  27478. * // => [6, 8, 10]
  27479. */
  27480. function parseInt(string, radix, guard) {
  27481. if (guard || radix == null) {
  27482. radix = 0;
  27483. } else if (radix) {
  27484. radix = +radix;
  27485. }
  27486. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  27487. }
  27488. /**
  27489. * Repeats the given string `n` times.
  27490. *
  27491. * @static
  27492. * @memberOf _
  27493. * @since 3.0.0
  27494. * @category String
  27495. * @param {string} [string=''] The string to repeat.
  27496. * @param {number} [n=1] The number of times to repeat the string.
  27497. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27498. * @returns {string} Returns the repeated string.
  27499. * @example
  27500. *
  27501. * _.repeat('*', 3);
  27502. * // => '***'
  27503. *
  27504. * _.repeat('abc', 2);
  27505. * // => 'abcabc'
  27506. *
  27507. * _.repeat('abc', 0);
  27508. * // => ''
  27509. */
  27510. function repeat(string, n, guard) {
  27511. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  27512. n = 1;
  27513. } else {
  27514. n = toInteger(n);
  27515. }
  27516. return baseRepeat(toString(string), n);
  27517. }
  27518. /**
  27519. * Replaces matches for `pattern` in `string` with `replacement`.
  27520. *
  27521. * **Note:** This method is based on
  27522. * [`String#replace`](https://mdn.io/String/replace).
  27523. *
  27524. * @static
  27525. * @memberOf _
  27526. * @since 4.0.0
  27527. * @category String
  27528. * @param {string} [string=''] The string to modify.
  27529. * @param {RegExp|string} pattern The pattern to replace.
  27530. * @param {Function|string} replacement The match replacement.
  27531. * @returns {string} Returns the modified string.
  27532. * @example
  27533. *
  27534. * _.replace('Hi Fred', 'Fred', 'Barney');
  27535. * // => 'Hi Barney'
  27536. */
  27537. function replace() {
  27538. var args = arguments,
  27539. string = toString(args[0]);
  27540. return args.length < 3 ? string : string.replace(args[1], args[2]);
  27541. }
  27542. /**
  27543. * Converts `string` to
  27544. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  27545. *
  27546. * @static
  27547. * @memberOf _
  27548. * @since 3.0.0
  27549. * @category String
  27550. * @param {string} [string=''] The string to convert.
  27551. * @returns {string} Returns the snake cased string.
  27552. * @example
  27553. *
  27554. * _.snakeCase('Foo Bar');
  27555. * // => 'foo_bar'
  27556. *
  27557. * _.snakeCase('fooBar');
  27558. * // => 'foo_bar'
  27559. *
  27560. * _.snakeCase('--FOO-BAR--');
  27561. * // => 'foo_bar'
  27562. */
  27563. var snakeCase = createCompounder(function(result, word, index) {
  27564. return result + (index ? '_' : '') + word.toLowerCase();
  27565. });
  27566. /**
  27567. * Splits `string` by `separator`.
  27568. *
  27569. * **Note:** This method is based on
  27570. * [`String#split`](https://mdn.io/String/split).
  27571. *
  27572. * @static
  27573. * @memberOf _
  27574. * @since 4.0.0
  27575. * @category String
  27576. * @param {string} [string=''] The string to split.
  27577. * @param {RegExp|string} separator The separator pattern to split by.
  27578. * @param {number} [limit] The length to truncate results to.
  27579. * @returns {Array} Returns the string segments.
  27580. * @example
  27581. *
  27582. * _.split('a-b-c', '-', 2);
  27583. * // => ['a', 'b']
  27584. */
  27585. function split(string, separator, limit) {
  27586. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  27587. separator = limit = undefined;
  27588. }
  27589. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  27590. if (!limit) {
  27591. return [];
  27592. }
  27593. string = toString(string);
  27594. if (string && (
  27595. typeof separator == 'string' ||
  27596. (separator != null && !isRegExp(separator))
  27597. )) {
  27598. separator = baseToString(separator);
  27599. if (!separator && hasUnicode(string)) {
  27600. return castSlice(stringToArray(string), 0, limit);
  27601. }
  27602. }
  27603. return string.split(separator, limit);
  27604. }
  27605. /**
  27606. * Converts `string` to
  27607. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  27608. *
  27609. * @static
  27610. * @memberOf _
  27611. * @since 3.1.0
  27612. * @category String
  27613. * @param {string} [string=''] The string to convert.
  27614. * @returns {string} Returns the start cased string.
  27615. * @example
  27616. *
  27617. * _.startCase('--foo-bar--');
  27618. * // => 'Foo Bar'
  27619. *
  27620. * _.startCase('fooBar');
  27621. * // => 'Foo Bar'
  27622. *
  27623. * _.startCase('__FOO_BAR__');
  27624. * // => 'FOO BAR'
  27625. */
  27626. var startCase = createCompounder(function(result, word, index) {
  27627. return result + (index ? ' ' : '') + upperFirst(word);
  27628. });
  27629. /**
  27630. * Checks if `string` starts with the given target string.
  27631. *
  27632. * @static
  27633. * @memberOf _
  27634. * @since 3.0.0
  27635. * @category String
  27636. * @param {string} [string=''] The string to inspect.
  27637. * @param {string} [target] The string to search for.
  27638. * @param {number} [position=0] The position to search from.
  27639. * @returns {boolean} Returns `true` if `string` starts with `target`,
  27640. * else `false`.
  27641. * @example
  27642. *
  27643. * _.startsWith('abc', 'a');
  27644. * // => true
  27645. *
  27646. * _.startsWith('abc', 'b');
  27647. * // => false
  27648. *
  27649. * _.startsWith('abc', 'b', 1);
  27650. * // => true
  27651. */
  27652. function startsWith(string, target, position) {
  27653. string = toString(string);
  27654. position = position == null
  27655. ? 0
  27656. : baseClamp(toInteger(position), 0, string.length);
  27657. target = baseToString(target);
  27658. return string.slice(position, position + target.length) == target;
  27659. }
  27660. /**
  27661. * Creates a compiled template function that can interpolate data properties
  27662. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  27663. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  27664. * properties may be accessed as free variables in the template. If a setting
  27665. * object is given, it takes precedence over `_.templateSettings` values.
  27666. *
  27667. * **Note:** In the development build `_.template` utilizes
  27668. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  27669. * for easier debugging.
  27670. *
  27671. * For more information on precompiling templates see
  27672. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  27673. *
  27674. * For more information on Chrome extension sandboxes see
  27675. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  27676. *
  27677. * @static
  27678. * @since 0.1.0
  27679. * @memberOf _
  27680. * @category String
  27681. * @param {string} [string=''] The template string.
  27682. * @param {Object} [options={}] The options object.
  27683. * @param {RegExp} [options.escape=_.templateSettings.escape]
  27684. * The HTML "escape" delimiter.
  27685. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  27686. * The "evaluate" delimiter.
  27687. * @param {Object} [options.imports=_.templateSettings.imports]
  27688. * An object to import into the template as free variables.
  27689. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  27690. * The "interpolate" delimiter.
  27691. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  27692. * The sourceURL of the compiled template.
  27693. * @param {string} [options.variable='obj']
  27694. * The data object variable name.
  27695. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27696. * @returns {Function} Returns the compiled template function.
  27697. * @example
  27698. *
  27699. * // Use the "interpolate" delimiter to create a compiled template.
  27700. * var compiled = _.template('hello <%= user %>!');
  27701. * compiled({ 'user': 'fred' });
  27702. * // => 'hello fred!'
  27703. *
  27704. * // Use the HTML "escape" delimiter to escape data property values.
  27705. * var compiled = _.template('<b><%- value %></b>');
  27706. * compiled({ 'value': '<script>' });
  27707. * // => '<b>&lt;script&gt;</b>'
  27708. *
  27709. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  27710. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  27711. * compiled({ 'users': ['fred', 'barney'] });
  27712. * // => '<li>fred</li><li>barney</li>'
  27713. *
  27714. * // Use the internal `print` function in "evaluate" delimiters.
  27715. * var compiled = _.template('<% print("hello " + user); %>!');
  27716. * compiled({ 'user': 'barney' });
  27717. * // => 'hello barney!'
  27718. *
  27719. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  27720. * // Disable support by replacing the "interpolate" delimiter.
  27721. * var compiled = _.template('hello ${ user }!');
  27722. * compiled({ 'user': 'pebbles' });
  27723. * // => 'hello pebbles!'
  27724. *
  27725. * // Use backslashes to treat delimiters as plain text.
  27726. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  27727. * compiled({ 'value': 'ignored' });
  27728. * // => '<%- value %>'
  27729. *
  27730. * // Use the `imports` option to import `jQuery` as `jq`.
  27731. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  27732. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  27733. * compiled({ 'users': ['fred', 'barney'] });
  27734. * // => '<li>fred</li><li>barney</li>'
  27735. *
  27736. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  27737. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  27738. * compiled(data);
  27739. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  27740. *
  27741. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  27742. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  27743. * compiled.source;
  27744. * // => function(data) {
  27745. * // var __t, __p = '';
  27746. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  27747. * // return __p;
  27748. * // }
  27749. *
  27750. * // Use custom template delimiters.
  27751. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  27752. * var compiled = _.template('hello {{ user }}!');
  27753. * compiled({ 'user': 'mustache' });
  27754. * // => 'hello mustache!'
  27755. *
  27756. * // Use the `source` property to inline compiled templates for meaningful
  27757. * // line numbers in error messages and stack traces.
  27758. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  27759. * var JST = {\
  27760. * "main": ' + _.template(mainText).source + '\
  27761. * };\
  27762. * ');
  27763. */
  27764. function template(string, options, guard) {
  27765. // Based on John Resig's `tmpl` implementation
  27766. // (http://ejohn.org/blog/javascript-micro-templating/)
  27767. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  27768. var settings = lodash.templateSettings;
  27769. if (guard && isIterateeCall(string, options, guard)) {
  27770. options = undefined;
  27771. }
  27772. string = toString(string);
  27773. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  27774. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  27775. importsKeys = keys(imports),
  27776. importsValues = baseValues(imports, importsKeys);
  27777. var isEscaping,
  27778. isEvaluating,
  27779. index = 0,
  27780. interpolate = options.interpolate || reNoMatch,
  27781. source = "__p += '";
  27782. // Compile the regexp to match each delimiter.
  27783. var reDelimiters = RegExp(
  27784. (options.escape || reNoMatch).source + '|' +
  27785. interpolate.source + '|' +
  27786. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  27787. (options.evaluate || reNoMatch).source + '|$'
  27788. , 'g');
  27789. // Use a sourceURL for easier debugging.
  27790. // The sourceURL gets injected into the source that's eval-ed, so be careful
  27791. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  27792. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  27793. var sourceURL = '//# sourceURL=' +
  27794. (hasOwnProperty.call(options, 'sourceURL')
  27795. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  27796. : ('lodash.templateSources[' + (++templateCounter) + ']')
  27797. ) + '\n';
  27798. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  27799. interpolateValue || (interpolateValue = esTemplateValue);
  27800. // Escape characters that can't be included in string literals.
  27801. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  27802. // Replace delimiters with snippets.
  27803. if (escapeValue) {
  27804. isEscaping = true;
  27805. source += "' +\n__e(" + escapeValue + ") +\n'";
  27806. }
  27807. if (evaluateValue) {
  27808. isEvaluating = true;
  27809. source += "';\n" + evaluateValue + ";\n__p += '";
  27810. }
  27811. if (interpolateValue) {
  27812. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  27813. }
  27814. index = offset + match.length;
  27815. // The JS engine embedded in Adobe products needs `match` returned in
  27816. // order to produce the correct `offset` value.
  27817. return match;
  27818. });
  27819. source += "';\n";
  27820. // If `variable` is not specified wrap a with-statement around the generated
  27821. // code to add the data object to the top of the scope chain.
  27822. // Like with sourceURL, we take care to not check the option's prototype,
  27823. // as this configuration is a code injection vector.
  27824. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  27825. if (!variable) {
  27826. source = 'with (obj) {\n' + source + '\n}\n';
  27827. }
  27828. // Cleanup code by stripping empty strings.
  27829. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  27830. .replace(reEmptyStringMiddle, '$1')
  27831. .replace(reEmptyStringTrailing, '$1;');
  27832. // Frame code as the function body.
  27833. source = 'function(' + (variable || 'obj') + ') {\n' +
  27834. (variable
  27835. ? ''
  27836. : 'obj || (obj = {});\n'
  27837. ) +
  27838. "var __t, __p = ''" +
  27839. (isEscaping
  27840. ? ', __e = _.escape'
  27841. : ''
  27842. ) +
  27843. (isEvaluating
  27844. ? ', __j = Array.prototype.join;\n' +
  27845. "function print() { __p += __j.call(arguments, '') }\n"
  27846. : ';\n'
  27847. ) +
  27848. source +
  27849. 'return __p\n}';
  27850. var result = attempt(function() {
  27851. return Function(importsKeys, sourceURL + 'return ' + source)
  27852. .apply(undefined, importsValues);
  27853. });
  27854. // Provide the compiled function's source by its `toString` method or
  27855. // the `source` property as a convenience for inlining compiled templates.
  27856. result.source = source;
  27857. if (isError(result)) {
  27858. throw result;
  27859. }
  27860. return result;
  27861. }
  27862. /**
  27863. * Converts `string`, as a whole, to lower case just like
  27864. * [String#toLowerCase](https://mdn.io/toLowerCase).
  27865. *
  27866. * @static
  27867. * @memberOf _
  27868. * @since 4.0.0
  27869. * @category String
  27870. * @param {string} [string=''] The string to convert.
  27871. * @returns {string} Returns the lower cased string.
  27872. * @example
  27873. *
  27874. * _.toLower('--Foo-Bar--');
  27875. * // => '--foo-bar--'
  27876. *
  27877. * _.toLower('fooBar');
  27878. * // => 'foobar'
  27879. *
  27880. * _.toLower('__FOO_BAR__');
  27881. * // => '__foo_bar__'
  27882. */
  27883. function toLower(value) {
  27884. return toString(value).toLowerCase();
  27885. }
  27886. /**
  27887. * Converts `string`, as a whole, to upper case just like
  27888. * [String#toUpperCase](https://mdn.io/toUpperCase).
  27889. *
  27890. * @static
  27891. * @memberOf _
  27892. * @since 4.0.0
  27893. * @category String
  27894. * @param {string} [string=''] The string to convert.
  27895. * @returns {string} Returns the upper cased string.
  27896. * @example
  27897. *
  27898. * _.toUpper('--foo-bar--');
  27899. * // => '--FOO-BAR--'
  27900. *
  27901. * _.toUpper('fooBar');
  27902. * // => 'FOOBAR'
  27903. *
  27904. * _.toUpper('__foo_bar__');
  27905. * // => '__FOO_BAR__'
  27906. */
  27907. function toUpper(value) {
  27908. return toString(value).toUpperCase();
  27909. }
  27910. /**
  27911. * Removes leading and trailing whitespace or specified characters from `string`.
  27912. *
  27913. * @static
  27914. * @memberOf _
  27915. * @since 3.0.0
  27916. * @category String
  27917. * @param {string} [string=''] The string to trim.
  27918. * @param {string} [chars=whitespace] The characters to trim.
  27919. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27920. * @returns {string} Returns the trimmed string.
  27921. * @example
  27922. *
  27923. * _.trim(' abc ');
  27924. * // => 'abc'
  27925. *
  27926. * _.trim('-_-abc-_-', '_-');
  27927. * // => 'abc'
  27928. *
  27929. * _.map([' foo ', ' bar '], _.trim);
  27930. * // => ['foo', 'bar']
  27931. */
  27932. function trim(string, chars, guard) {
  27933. string = toString(string);
  27934. if (string && (guard || chars === undefined)) {
  27935. return string.replace(reTrim, '');
  27936. }
  27937. if (!string || !(chars = baseToString(chars))) {
  27938. return string;
  27939. }
  27940. var strSymbols = stringToArray(string),
  27941. chrSymbols = stringToArray(chars),
  27942. start = charsStartIndex(strSymbols, chrSymbols),
  27943. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  27944. return castSlice(strSymbols, start, end).join('');
  27945. }
  27946. /**
  27947. * Removes trailing whitespace or specified characters from `string`.
  27948. *
  27949. * @static
  27950. * @memberOf _
  27951. * @since 4.0.0
  27952. * @category String
  27953. * @param {string} [string=''] The string to trim.
  27954. * @param {string} [chars=whitespace] The characters to trim.
  27955. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27956. * @returns {string} Returns the trimmed string.
  27957. * @example
  27958. *
  27959. * _.trimEnd(' abc ');
  27960. * // => ' abc'
  27961. *
  27962. * _.trimEnd('-_-abc-_-', '_-');
  27963. * // => '-_-abc'
  27964. */
  27965. function trimEnd(string, chars, guard) {
  27966. string = toString(string);
  27967. if (string && (guard || chars === undefined)) {
  27968. return string.replace(reTrimEnd, '');
  27969. }
  27970. if (!string || !(chars = baseToString(chars))) {
  27971. return string;
  27972. }
  27973. var strSymbols = stringToArray(string),
  27974. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  27975. return castSlice(strSymbols, 0, end).join('');
  27976. }
  27977. /**
  27978. * Removes leading whitespace or specified characters from `string`.
  27979. *
  27980. * @static
  27981. * @memberOf _
  27982. * @since 4.0.0
  27983. * @category String
  27984. * @param {string} [string=''] The string to trim.
  27985. * @param {string} [chars=whitespace] The characters to trim.
  27986. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27987. * @returns {string} Returns the trimmed string.
  27988. * @example
  27989. *
  27990. * _.trimStart(' abc ');
  27991. * // => 'abc '
  27992. *
  27993. * _.trimStart('-_-abc-_-', '_-');
  27994. * // => 'abc-_-'
  27995. */
  27996. function trimStart(string, chars, guard) {
  27997. string = toString(string);
  27998. if (string && (guard || chars === undefined)) {
  27999. return string.replace(reTrimStart, '');
  28000. }
  28001. if (!string || !(chars = baseToString(chars))) {
  28002. return string;
  28003. }
  28004. var strSymbols = stringToArray(string),
  28005. start = charsStartIndex(strSymbols, stringToArray(chars));
  28006. return castSlice(strSymbols, start).join('');
  28007. }
  28008. /**
  28009. * Truncates `string` if it's longer than the given maximum string length.
  28010. * The last characters of the truncated string are replaced with the omission
  28011. * string which defaults to "...".
  28012. *
  28013. * @static
  28014. * @memberOf _
  28015. * @since 4.0.0
  28016. * @category String
  28017. * @param {string} [string=''] The string to truncate.
  28018. * @param {Object} [options={}] The options object.
  28019. * @param {number} [options.length=30] The maximum string length.
  28020. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  28021. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  28022. * @returns {string} Returns the truncated string.
  28023. * @example
  28024. *
  28025. * _.truncate('hi-diddly-ho there, neighborino');
  28026. * // => 'hi-diddly-ho there, neighbo...'
  28027. *
  28028. * _.truncate('hi-diddly-ho there, neighborino', {
  28029. * 'length': 24,
  28030. * 'separator': ' '
  28031. * });
  28032. * // => 'hi-diddly-ho there,...'
  28033. *
  28034. * _.truncate('hi-diddly-ho there, neighborino', {
  28035. * 'length': 24,
  28036. * 'separator': /,? +/
  28037. * });
  28038. * // => 'hi-diddly-ho there...'
  28039. *
  28040. * _.truncate('hi-diddly-ho there, neighborino', {
  28041. * 'omission': ' [...]'
  28042. * });
  28043. * // => 'hi-diddly-ho there, neig [...]'
  28044. */
  28045. function truncate(string, options) {
  28046. var length = DEFAULT_TRUNC_LENGTH,
  28047. omission = DEFAULT_TRUNC_OMISSION;
  28048. if (isObject(options)) {
  28049. var separator = 'separator' in options ? options.separator : separator;
  28050. length = 'length' in options ? toInteger(options.length) : length;
  28051. omission = 'omission' in options ? baseToString(options.omission) : omission;
  28052. }
  28053. string = toString(string);
  28054. var strLength = string.length;
  28055. if (hasUnicode(string)) {
  28056. var strSymbols = stringToArray(string);
  28057. strLength = strSymbols.length;
  28058. }
  28059. if (length >= strLength) {
  28060. return string;
  28061. }
  28062. var end = length - stringSize(omission);
  28063. if (end < 1) {
  28064. return omission;
  28065. }
  28066. var result = strSymbols
  28067. ? castSlice(strSymbols, 0, end).join('')
  28068. : string.slice(0, end);
  28069. if (separator === undefined) {
  28070. return result + omission;
  28071. }
  28072. if (strSymbols) {
  28073. end += (result.length - end);
  28074. }
  28075. if (isRegExp(separator)) {
  28076. if (string.slice(end).search(separator)) {
  28077. var match,
  28078. substring = result;
  28079. if (!separator.global) {
  28080. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  28081. }
  28082. separator.lastIndex = 0;
  28083. while ((match = separator.exec(substring))) {
  28084. var newEnd = match.index;
  28085. }
  28086. result = result.slice(0, newEnd === undefined ? end : newEnd);
  28087. }
  28088. } else if (string.indexOf(baseToString(separator), end) != end) {
  28089. var index = result.lastIndexOf(separator);
  28090. if (index > -1) {
  28091. result = result.slice(0, index);
  28092. }
  28093. }
  28094. return result + omission;
  28095. }
  28096. /**
  28097. * The inverse of `_.escape`; this method converts the HTML entities
  28098. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  28099. * their corresponding characters.
  28100. *
  28101. * **Note:** No other HTML entities are unescaped. To unescape additional
  28102. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  28103. *
  28104. * @static
  28105. * @memberOf _
  28106. * @since 0.6.0
  28107. * @category String
  28108. * @param {string} [string=''] The string to unescape.
  28109. * @returns {string} Returns the unescaped string.
  28110. * @example
  28111. *
  28112. * _.unescape('fred, barney, &amp; pebbles');
  28113. * // => 'fred, barney, & pebbles'
  28114. */
  28115. function unescape(string) {
  28116. string = toString(string);
  28117. return (string && reHasEscapedHtml.test(string))
  28118. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  28119. : string;
  28120. }
  28121. /**
  28122. * Converts `string`, as space separated words, to upper case.
  28123. *
  28124. * @static
  28125. * @memberOf _
  28126. * @since 4.0.0
  28127. * @category String
  28128. * @param {string} [string=''] The string to convert.
  28129. * @returns {string} Returns the upper cased string.
  28130. * @example
  28131. *
  28132. * _.upperCase('--foo-bar');
  28133. * // => 'FOO BAR'
  28134. *
  28135. * _.upperCase('fooBar');
  28136. * // => 'FOO BAR'
  28137. *
  28138. * _.upperCase('__foo_bar__');
  28139. * // => 'FOO BAR'
  28140. */
  28141. var upperCase = createCompounder(function(result, word, index) {
  28142. return result + (index ? ' ' : '') + word.toUpperCase();
  28143. });
  28144. /**
  28145. * Converts the first character of `string` to upper case.
  28146. *
  28147. * @static
  28148. * @memberOf _
  28149. * @since 4.0.0
  28150. * @category String
  28151. * @param {string} [string=''] The string to convert.
  28152. * @returns {string} Returns the converted string.
  28153. * @example
  28154. *
  28155. * _.upperFirst('fred');
  28156. * // => 'Fred'
  28157. *
  28158. * _.upperFirst('FRED');
  28159. * // => 'FRED'
  28160. */
  28161. var upperFirst = createCaseFirst('toUpperCase');
  28162. /**
  28163. * Splits `string` into an array of its words.
  28164. *
  28165. * @static
  28166. * @memberOf _
  28167. * @since 3.0.0
  28168. * @category String
  28169. * @param {string} [string=''] The string to inspect.
  28170. * @param {RegExp|string} [pattern] The pattern to match words.
  28171. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28172. * @returns {Array} Returns the words of `string`.
  28173. * @example
  28174. *
  28175. * _.words('fred, barney, & pebbles');
  28176. * // => ['fred', 'barney', 'pebbles']
  28177. *
  28178. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  28179. * // => ['fred', 'barney', '&', 'pebbles']
  28180. */
  28181. function words(string, pattern, guard) {
  28182. string = toString(string);
  28183. pattern = guard ? undefined : pattern;
  28184. if (pattern === undefined) {
  28185. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  28186. }
  28187. return string.match(pattern) || [];
  28188. }
  28189. /*------------------------------------------------------------------------*/
  28190. /**
  28191. * Attempts to invoke `func`, returning either the result or the caught error
  28192. * object. Any additional arguments are provided to `func` when it's invoked.
  28193. *
  28194. * @static
  28195. * @memberOf _
  28196. * @since 3.0.0
  28197. * @category Util
  28198. * @param {Function} func The function to attempt.
  28199. * @param {...*} [args] The arguments to invoke `func` with.
  28200. * @returns {*} Returns the `func` result or error object.
  28201. * @example
  28202. *
  28203. * // Avoid throwing errors for invalid selectors.
  28204. * var elements = _.attempt(function(selector) {
  28205. * return document.querySelectorAll(selector);
  28206. * }, '>_>');
  28207. *
  28208. * if (_.isError(elements)) {
  28209. * elements = [];
  28210. * }
  28211. */
  28212. var attempt = baseRest(function(func, args) {
  28213. try {
  28214. return apply(func, undefined, args);
  28215. } catch (e) {
  28216. return isError(e) ? e : new Error(e);
  28217. }
  28218. });
  28219. /**
  28220. * Binds methods of an object to the object itself, overwriting the existing
  28221. * method.
  28222. *
  28223. * **Note:** This method doesn't set the "length" property of bound functions.
  28224. *
  28225. * @static
  28226. * @since 0.1.0
  28227. * @memberOf _
  28228. * @category Util
  28229. * @param {Object} object The object to bind and assign the bound methods to.
  28230. * @param {...(string|string[])} methodNames The object method names to bind.
  28231. * @returns {Object} Returns `object`.
  28232. * @example
  28233. *
  28234. * var view = {
  28235. * 'label': 'docs',
  28236. * 'click': function() {
  28237. * console.log('clicked ' + this.label);
  28238. * }
  28239. * };
  28240. *
  28241. * _.bindAll(view, ['click']);
  28242. * jQuery(element).on('click', view.click);
  28243. * // => Logs 'clicked docs' when clicked.
  28244. */
  28245. var bindAll = flatRest(function(object, methodNames) {
  28246. arrayEach(methodNames, function(key) {
  28247. key = toKey(key);
  28248. baseAssignValue(object, key, bind(object[key], object));
  28249. });
  28250. return object;
  28251. });
  28252. /**
  28253. * Creates a function that iterates over `pairs` and invokes the corresponding
  28254. * function of the first predicate to return truthy. The predicate-function
  28255. * pairs are invoked with the `this` binding and arguments of the created
  28256. * function.
  28257. *
  28258. * @static
  28259. * @memberOf _
  28260. * @since 4.0.0
  28261. * @category Util
  28262. * @param {Array} pairs The predicate-function pairs.
  28263. * @returns {Function} Returns the new composite function.
  28264. * @example
  28265. *
  28266. * var func = _.cond([
  28267. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  28268. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  28269. * [_.stubTrue, _.constant('no match')]
  28270. * ]);
  28271. *
  28272. * func({ 'a': 1, 'b': 2 });
  28273. * // => 'matches A'
  28274. *
  28275. * func({ 'a': 0, 'b': 1 });
  28276. * // => 'matches B'
  28277. *
  28278. * func({ 'a': '1', 'b': '2' });
  28279. * // => 'no match'
  28280. */
  28281. function cond(pairs) {
  28282. var length = pairs == null ? 0 : pairs.length,
  28283. toIteratee = getIteratee();
  28284. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  28285. if (typeof pair[1] != 'function') {
  28286. throw new TypeError(FUNC_ERROR_TEXT);
  28287. }
  28288. return [toIteratee(pair[0]), pair[1]];
  28289. });
  28290. return baseRest(function(args) {
  28291. var index = -1;
  28292. while (++index < length) {
  28293. var pair = pairs[index];
  28294. if (apply(pair[0], this, args)) {
  28295. return apply(pair[1], this, args);
  28296. }
  28297. }
  28298. });
  28299. }
  28300. /**
  28301. * Creates a function that invokes the predicate properties of `source` with
  28302. * the corresponding property values of a given object, returning `true` if
  28303. * all predicates return truthy, else `false`.
  28304. *
  28305. * **Note:** The created function is equivalent to `_.conformsTo` with
  28306. * `source` partially applied.
  28307. *
  28308. * @static
  28309. * @memberOf _
  28310. * @since 4.0.0
  28311. * @category Util
  28312. * @param {Object} source The object of property predicates to conform to.
  28313. * @returns {Function} Returns the new spec function.
  28314. * @example
  28315. *
  28316. * var objects = [
  28317. * { 'a': 2, 'b': 1 },
  28318. * { 'a': 1, 'b': 2 }
  28319. * ];
  28320. *
  28321. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  28322. * // => [{ 'a': 1, 'b': 2 }]
  28323. */
  28324. function conforms(source) {
  28325. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  28326. }
  28327. /**
  28328. * Creates a function that returns `value`.
  28329. *
  28330. * @static
  28331. * @memberOf _
  28332. * @since 2.4.0
  28333. * @category Util
  28334. * @param {*} value The value to return from the new function.
  28335. * @returns {Function} Returns the new constant function.
  28336. * @example
  28337. *
  28338. * var objects = _.times(2, _.constant({ 'a': 1 }));
  28339. *
  28340. * console.log(objects);
  28341. * // => [{ 'a': 1 }, { 'a': 1 }]
  28342. *
  28343. * console.log(objects[0] === objects[1]);
  28344. * // => true
  28345. */
  28346. function constant(value) {
  28347. return function() {
  28348. return value;
  28349. };
  28350. }
  28351. /**
  28352. * Checks `value` to determine whether a default value should be returned in
  28353. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  28354. * or `undefined`.
  28355. *
  28356. * @static
  28357. * @memberOf _
  28358. * @since 4.14.0
  28359. * @category Util
  28360. * @param {*} value The value to check.
  28361. * @param {*} defaultValue The default value.
  28362. * @returns {*} Returns the resolved value.
  28363. * @example
  28364. *
  28365. * _.defaultTo(1, 10);
  28366. * // => 1
  28367. *
  28368. * _.defaultTo(undefined, 10);
  28369. * // => 10
  28370. */
  28371. function defaultTo(value, defaultValue) {
  28372. return (value == null || value !== value) ? defaultValue : value;
  28373. }
  28374. /**
  28375. * Creates a function that returns the result of invoking the given functions
  28376. * with the `this` binding of the created function, where each successive
  28377. * invocation is supplied the return value of the previous.
  28378. *
  28379. * @static
  28380. * @memberOf _
  28381. * @since 3.0.0
  28382. * @category Util
  28383. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  28384. * @returns {Function} Returns the new composite function.
  28385. * @see _.flowRight
  28386. * @example
  28387. *
  28388. * function square(n) {
  28389. * return n * n;
  28390. * }
  28391. *
  28392. * var addSquare = _.flow([_.add, square]);
  28393. * addSquare(1, 2);
  28394. * // => 9
  28395. */
  28396. var flow = createFlow();
  28397. /**
  28398. * This method is like `_.flow` except that it creates a function that
  28399. * invokes the given functions from right to left.
  28400. *
  28401. * @static
  28402. * @since 3.0.0
  28403. * @memberOf _
  28404. * @category Util
  28405. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  28406. * @returns {Function} Returns the new composite function.
  28407. * @see _.flow
  28408. * @example
  28409. *
  28410. * function square(n) {
  28411. * return n * n;
  28412. * }
  28413. *
  28414. * var addSquare = _.flowRight([square, _.add]);
  28415. * addSquare(1, 2);
  28416. * // => 9
  28417. */
  28418. var flowRight = createFlow(true);
  28419. /**
  28420. * This method returns the first argument it receives.
  28421. *
  28422. * @static
  28423. * @since 0.1.0
  28424. * @memberOf _
  28425. * @category Util
  28426. * @param {*} value Any value.
  28427. * @returns {*} Returns `value`.
  28428. * @example
  28429. *
  28430. * var object = { 'a': 1 };
  28431. *
  28432. * console.log(_.identity(object) === object);
  28433. * // => true
  28434. */
  28435. function identity(value) {
  28436. return value;
  28437. }
  28438. /**
  28439. * Creates a function that invokes `func` with the arguments of the created
  28440. * function. If `func` is a property name, the created function returns the
  28441. * property value for a given element. If `func` is an array or object, the
  28442. * created function returns `true` for elements that contain the equivalent
  28443. * source properties, otherwise it returns `false`.
  28444. *
  28445. * @static
  28446. * @since 4.0.0
  28447. * @memberOf _
  28448. * @category Util
  28449. * @param {*} [func=_.identity] The value to convert to a callback.
  28450. * @returns {Function} Returns the callback.
  28451. * @example
  28452. *
  28453. * var users = [
  28454. * { 'user': 'barney', 'age': 36, 'active': true },
  28455. * { 'user': 'fred', 'age': 40, 'active': false }
  28456. * ];
  28457. *
  28458. * // The `_.matches` iteratee shorthand.
  28459. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  28460. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  28461. *
  28462. * // The `_.matchesProperty` iteratee shorthand.
  28463. * _.filter(users, _.iteratee(['user', 'fred']));
  28464. * // => [{ 'user': 'fred', 'age': 40 }]
  28465. *
  28466. * // The `_.property` iteratee shorthand.
  28467. * _.map(users, _.iteratee('user'));
  28468. * // => ['barney', 'fred']
  28469. *
  28470. * // Create custom iteratee shorthands.
  28471. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  28472. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  28473. * return func.test(string);
  28474. * };
  28475. * });
  28476. *
  28477. * _.filter(['abc', 'def'], /ef/);
  28478. * // => ['def']
  28479. */
  28480. function iteratee(func) {
  28481. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  28482. }
  28483. /**
  28484. * Creates a function that performs a partial deep comparison between a given
  28485. * object and `source`, returning `true` if the given object has equivalent
  28486. * property values, else `false`.
  28487. *
  28488. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  28489. * partially applied.
  28490. *
  28491. * Partial comparisons will match empty array and empty object `source`
  28492. * values against any array or object value, respectively. See `_.isEqual`
  28493. * for a list of supported value comparisons.
  28494. *
  28495. * @static
  28496. * @memberOf _
  28497. * @since 3.0.0
  28498. * @category Util
  28499. * @param {Object} source The object of property values to match.
  28500. * @returns {Function} Returns the new spec function.
  28501. * @example
  28502. *
  28503. * var objects = [
  28504. * { 'a': 1, 'b': 2, 'c': 3 },
  28505. * { 'a': 4, 'b': 5, 'c': 6 }
  28506. * ];
  28507. *
  28508. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  28509. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  28510. */
  28511. function matches(source) {
  28512. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  28513. }
  28514. /**
  28515. * Creates a function that performs a partial deep comparison between the
  28516. * value at `path` of a given object to `srcValue`, returning `true` if the
  28517. * object value is equivalent, else `false`.
  28518. *
  28519. * **Note:** Partial comparisons will match empty array and empty object
  28520. * `srcValue` values against any array or object value, respectively. See
  28521. * `_.isEqual` for a list of supported value comparisons.
  28522. *
  28523. * @static
  28524. * @memberOf _
  28525. * @since 3.2.0
  28526. * @category Util
  28527. * @param {Array|string} path The path of the property to get.
  28528. * @param {*} srcValue The value to match.
  28529. * @returns {Function} Returns the new spec function.
  28530. * @example
  28531. *
  28532. * var objects = [
  28533. * { 'a': 1, 'b': 2, 'c': 3 },
  28534. * { 'a': 4, 'b': 5, 'c': 6 }
  28535. * ];
  28536. *
  28537. * _.find(objects, _.matchesProperty('a', 4));
  28538. * // => { 'a': 4, 'b': 5, 'c': 6 }
  28539. */
  28540. function matchesProperty(path, srcValue) {
  28541. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  28542. }
  28543. /**
  28544. * Creates a function that invokes the method at `path` of a given object.
  28545. * Any additional arguments are provided to the invoked method.
  28546. *
  28547. * @static
  28548. * @memberOf _
  28549. * @since 3.7.0
  28550. * @category Util
  28551. * @param {Array|string} path The path of the method to invoke.
  28552. * @param {...*} [args] The arguments to invoke the method with.
  28553. * @returns {Function} Returns the new invoker function.
  28554. * @example
  28555. *
  28556. * var objects = [
  28557. * { 'a': { 'b': _.constant(2) } },
  28558. * { 'a': { 'b': _.constant(1) } }
  28559. * ];
  28560. *
  28561. * _.map(objects, _.method('a.b'));
  28562. * // => [2, 1]
  28563. *
  28564. * _.map(objects, _.method(['a', 'b']));
  28565. * // => [2, 1]
  28566. */
  28567. var method = baseRest(function(path, args) {
  28568. return function(object) {
  28569. return baseInvoke(object, path, args);
  28570. };
  28571. });
  28572. /**
  28573. * The opposite of `_.method`; this method creates a function that invokes
  28574. * the method at a given path of `object`. Any additional arguments are
  28575. * provided to the invoked method.
  28576. *
  28577. * @static
  28578. * @memberOf _
  28579. * @since 3.7.0
  28580. * @category Util
  28581. * @param {Object} object The object to query.
  28582. * @param {...*} [args] The arguments to invoke the method with.
  28583. * @returns {Function} Returns the new invoker function.
  28584. * @example
  28585. *
  28586. * var array = _.times(3, _.constant),
  28587. * object = { 'a': array, 'b': array, 'c': array };
  28588. *
  28589. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  28590. * // => [2, 0]
  28591. *
  28592. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  28593. * // => [2, 0]
  28594. */
  28595. var methodOf = baseRest(function(object, args) {
  28596. return function(path) {
  28597. return baseInvoke(object, path, args);
  28598. };
  28599. });
  28600. /**
  28601. * Adds all own enumerable string keyed function properties of a source
  28602. * object to the destination object. If `object` is a function, then methods
  28603. * are added to its prototype as well.
  28604. *
  28605. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  28606. * avoid conflicts caused by modifying the original.
  28607. *
  28608. * @static
  28609. * @since 0.1.0
  28610. * @memberOf _
  28611. * @category Util
  28612. * @param {Function|Object} [object=lodash] The destination object.
  28613. * @param {Object} source The object of functions to add.
  28614. * @param {Object} [options={}] The options object.
  28615. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  28616. * @returns {Function|Object} Returns `object`.
  28617. * @example
  28618. *
  28619. * function vowels(string) {
  28620. * return _.filter(string, function(v) {
  28621. * return /[aeiou]/i.test(v);
  28622. * });
  28623. * }
  28624. *
  28625. * _.mixin({ 'vowels': vowels });
  28626. * _.vowels('fred');
  28627. * // => ['e']
  28628. *
  28629. * _('fred').vowels().value();
  28630. * // => ['e']
  28631. *
  28632. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  28633. * _('fred').vowels();
  28634. * // => ['e']
  28635. */
  28636. function mixin(object, source, options) {
  28637. var props = keys(source),
  28638. methodNames = baseFunctions(source, props);
  28639. if (options == null &&
  28640. !(isObject(source) && (methodNames.length || !props.length))) {
  28641. options = source;
  28642. source = object;
  28643. object = this;
  28644. methodNames = baseFunctions(source, keys(source));
  28645. }
  28646. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  28647. isFunc = isFunction(object);
  28648. arrayEach(methodNames, function(methodName) {
  28649. var func = source[methodName];
  28650. object[methodName] = func;
  28651. if (isFunc) {
  28652. object.prototype[methodName] = function() {
  28653. var chainAll = this.__chain__;
  28654. if (chain || chainAll) {
  28655. var result = object(this.__wrapped__),
  28656. actions = result.__actions__ = copyArray(this.__actions__);
  28657. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  28658. result.__chain__ = chainAll;
  28659. return result;
  28660. }
  28661. return func.apply(object, arrayPush([this.value()], arguments));
  28662. };
  28663. }
  28664. });
  28665. return object;
  28666. }
  28667. /**
  28668. * Reverts the `_` variable to its previous value and returns a reference to
  28669. * the `lodash` function.
  28670. *
  28671. * @static
  28672. * @since 0.1.0
  28673. * @memberOf _
  28674. * @category Util
  28675. * @returns {Function} Returns the `lodash` function.
  28676. * @example
  28677. *
  28678. * var lodash = _.noConflict();
  28679. */
  28680. function noConflict() {
  28681. if (root._ === this) {
  28682. root._ = oldDash;
  28683. }
  28684. return this;
  28685. }
  28686. /**
  28687. * This method returns `undefined`.
  28688. *
  28689. * @static
  28690. * @memberOf _
  28691. * @since 2.3.0
  28692. * @category Util
  28693. * @example
  28694. *
  28695. * _.times(2, _.noop);
  28696. * // => [undefined, undefined]
  28697. */
  28698. function noop() {
  28699. // No operation performed.
  28700. }
  28701. /**
  28702. * Creates a function that gets the argument at index `n`. If `n` is negative,
  28703. * the nth argument from the end is returned.
  28704. *
  28705. * @static
  28706. * @memberOf _
  28707. * @since 4.0.0
  28708. * @category Util
  28709. * @param {number} [n=0] The index of the argument to return.
  28710. * @returns {Function} Returns the new pass-thru function.
  28711. * @example
  28712. *
  28713. * var func = _.nthArg(1);
  28714. * func('a', 'b', 'c', 'd');
  28715. * // => 'b'
  28716. *
  28717. * var func = _.nthArg(-2);
  28718. * func('a', 'b', 'c', 'd');
  28719. * // => 'c'
  28720. */
  28721. function nthArg(n) {
  28722. n = toInteger(n);
  28723. return baseRest(function(args) {
  28724. return baseNth(args, n);
  28725. });
  28726. }
  28727. /**
  28728. * Creates a function that invokes `iteratees` with the arguments it receives
  28729. * and returns their results.
  28730. *
  28731. * @static
  28732. * @memberOf _
  28733. * @since 4.0.0
  28734. * @category Util
  28735. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  28736. * The iteratees to invoke.
  28737. * @returns {Function} Returns the new function.
  28738. * @example
  28739. *
  28740. * var func = _.over([Math.max, Math.min]);
  28741. *
  28742. * func(1, 2, 3, 4);
  28743. * // => [4, 1]
  28744. */
  28745. var over = createOver(arrayMap);
  28746. /**
  28747. * Creates a function that checks if **all** of the `predicates` return
  28748. * truthy when invoked with the arguments it receives.
  28749. *
  28750. * @static
  28751. * @memberOf _
  28752. * @since 4.0.0
  28753. * @category Util
  28754. * @param {...(Function|Function[])} [predicates=[_.identity]]
  28755. * The predicates to check.
  28756. * @returns {Function} Returns the new function.
  28757. * @example
  28758. *
  28759. * var func = _.overEvery([Boolean, isFinite]);
  28760. *
  28761. * func('1');
  28762. * // => true
  28763. *
  28764. * func(null);
  28765. * // => false
  28766. *
  28767. * func(NaN);
  28768. * // => false
  28769. */
  28770. var overEvery = createOver(arrayEvery);
  28771. /**
  28772. * Creates a function that checks if **any** of the `predicates` return
  28773. * truthy when invoked with the arguments it receives.
  28774. *
  28775. * @static
  28776. * @memberOf _
  28777. * @since 4.0.0
  28778. * @category Util
  28779. * @param {...(Function|Function[])} [predicates=[_.identity]]
  28780. * The predicates to check.
  28781. * @returns {Function} Returns the new function.
  28782. * @example
  28783. *
  28784. * var func = _.overSome([Boolean, isFinite]);
  28785. *
  28786. * func('1');
  28787. * // => true
  28788. *
  28789. * func(null);
  28790. * // => true
  28791. *
  28792. * func(NaN);
  28793. * // => false
  28794. */
  28795. var overSome = createOver(arraySome);
  28796. /**
  28797. * Creates a function that returns the value at `path` of a given object.
  28798. *
  28799. * @static
  28800. * @memberOf _
  28801. * @since 2.4.0
  28802. * @category Util
  28803. * @param {Array|string} path The path of the property to get.
  28804. * @returns {Function} Returns the new accessor function.
  28805. * @example
  28806. *
  28807. * var objects = [
  28808. * { 'a': { 'b': 2 } },
  28809. * { 'a': { 'b': 1 } }
  28810. * ];
  28811. *
  28812. * _.map(objects, _.property('a.b'));
  28813. * // => [2, 1]
  28814. *
  28815. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  28816. * // => [1, 2]
  28817. */
  28818. function property(path) {
  28819. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  28820. }
  28821. /**
  28822. * The opposite of `_.property`; this method creates a function that returns
  28823. * the value at a given path of `object`.
  28824. *
  28825. * @static
  28826. * @memberOf _
  28827. * @since 3.0.0
  28828. * @category Util
  28829. * @param {Object} object The object to query.
  28830. * @returns {Function} Returns the new accessor function.
  28831. * @example
  28832. *
  28833. * var array = [0, 1, 2],
  28834. * object = { 'a': array, 'b': array, 'c': array };
  28835. *
  28836. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  28837. * // => [2, 0]
  28838. *
  28839. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  28840. * // => [2, 0]
  28841. */
  28842. function propertyOf(object) {
  28843. return function(path) {
  28844. return object == null ? undefined : baseGet(object, path);
  28845. };
  28846. }
  28847. /**
  28848. * Creates an array of numbers (positive and/or negative) progressing from
  28849. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  28850. * `start` is specified without an `end` or `step`. If `end` is not specified,
  28851. * it's set to `start` with `start` then set to `0`.
  28852. *
  28853. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  28854. * floating-point values which can produce unexpected results.
  28855. *
  28856. * @static
  28857. * @since 0.1.0
  28858. * @memberOf _
  28859. * @category Util
  28860. * @param {number} [start=0] The start of the range.
  28861. * @param {number} end The end of the range.
  28862. * @param {number} [step=1] The value to increment or decrement by.
  28863. * @returns {Array} Returns the range of numbers.
  28864. * @see _.inRange, _.rangeRight
  28865. * @example
  28866. *
  28867. * _.range(4);
  28868. * // => [0, 1, 2, 3]
  28869. *
  28870. * _.range(-4);
  28871. * // => [0, -1, -2, -3]
  28872. *
  28873. * _.range(1, 5);
  28874. * // => [1, 2, 3, 4]
  28875. *
  28876. * _.range(0, 20, 5);
  28877. * // => [0, 5, 10, 15]
  28878. *
  28879. * _.range(0, -4, -1);
  28880. * // => [0, -1, -2, -3]
  28881. *
  28882. * _.range(1, 4, 0);
  28883. * // => [1, 1, 1]
  28884. *
  28885. * _.range(0);
  28886. * // => []
  28887. */
  28888. var range = createRange();
  28889. /**
  28890. * This method is like `_.range` except that it populates values in
  28891. * descending order.
  28892. *
  28893. * @static
  28894. * @memberOf _
  28895. * @since 4.0.0
  28896. * @category Util
  28897. * @param {number} [start=0] The start of the range.
  28898. * @param {number} end The end of the range.
  28899. * @param {number} [step=1] The value to increment or decrement by.
  28900. * @returns {Array} Returns the range of numbers.
  28901. * @see _.inRange, _.range
  28902. * @example
  28903. *
  28904. * _.rangeRight(4);
  28905. * // => [3, 2, 1, 0]
  28906. *
  28907. * _.rangeRight(-4);
  28908. * // => [-3, -2, -1, 0]
  28909. *
  28910. * _.rangeRight(1, 5);
  28911. * // => [4, 3, 2, 1]
  28912. *
  28913. * _.rangeRight(0, 20, 5);
  28914. * // => [15, 10, 5, 0]
  28915. *
  28916. * _.rangeRight(0, -4, -1);
  28917. * // => [-3, -2, -1, 0]
  28918. *
  28919. * _.rangeRight(1, 4, 0);
  28920. * // => [1, 1, 1]
  28921. *
  28922. * _.rangeRight(0);
  28923. * // => []
  28924. */
  28925. var rangeRight = createRange(true);
  28926. /**
  28927. * This method returns a new empty array.
  28928. *
  28929. * @static
  28930. * @memberOf _
  28931. * @since 4.13.0
  28932. * @category Util
  28933. * @returns {Array} Returns the new empty array.
  28934. * @example
  28935. *
  28936. * var arrays = _.times(2, _.stubArray);
  28937. *
  28938. * console.log(arrays);
  28939. * // => [[], []]
  28940. *
  28941. * console.log(arrays[0] === arrays[1]);
  28942. * // => false
  28943. */
  28944. function stubArray() {
  28945. return [];
  28946. }
  28947. /**
  28948. * This method returns `false`.
  28949. *
  28950. * @static
  28951. * @memberOf _
  28952. * @since 4.13.0
  28953. * @category Util
  28954. * @returns {boolean} Returns `false`.
  28955. * @example
  28956. *
  28957. * _.times(2, _.stubFalse);
  28958. * // => [false, false]
  28959. */
  28960. function stubFalse() {
  28961. return false;
  28962. }
  28963. /**
  28964. * This method returns a new empty object.
  28965. *
  28966. * @static
  28967. * @memberOf _
  28968. * @since 4.13.0
  28969. * @category Util
  28970. * @returns {Object} Returns the new empty object.
  28971. * @example
  28972. *
  28973. * var objects = _.times(2, _.stubObject);
  28974. *
  28975. * console.log(objects);
  28976. * // => [{}, {}]
  28977. *
  28978. * console.log(objects[0] === objects[1]);
  28979. * // => false
  28980. */
  28981. function stubObject() {
  28982. return {};
  28983. }
  28984. /**
  28985. * This method returns an empty string.
  28986. *
  28987. * @static
  28988. * @memberOf _
  28989. * @since 4.13.0
  28990. * @category Util
  28991. * @returns {string} Returns the empty string.
  28992. * @example
  28993. *
  28994. * _.times(2, _.stubString);
  28995. * // => ['', '']
  28996. */
  28997. function stubString() {
  28998. return '';
  28999. }
  29000. /**
  29001. * This method returns `true`.
  29002. *
  29003. * @static
  29004. * @memberOf _
  29005. * @since 4.13.0
  29006. * @category Util
  29007. * @returns {boolean} Returns `true`.
  29008. * @example
  29009. *
  29010. * _.times(2, _.stubTrue);
  29011. * // => [true, true]
  29012. */
  29013. function stubTrue() {
  29014. return true;
  29015. }
  29016. /**
  29017. * Invokes the iteratee `n` times, returning an array of the results of
  29018. * each invocation. The iteratee is invoked with one argument; (index).
  29019. *
  29020. * @static
  29021. * @since 0.1.0
  29022. * @memberOf _
  29023. * @category Util
  29024. * @param {number} n The number of times to invoke `iteratee`.
  29025. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29026. * @returns {Array} Returns the array of results.
  29027. * @example
  29028. *
  29029. * _.times(3, String);
  29030. * // => ['0', '1', '2']
  29031. *
  29032. * _.times(4, _.constant(0));
  29033. * // => [0, 0, 0, 0]
  29034. */
  29035. function times(n, iteratee) {
  29036. n = toInteger(n);
  29037. if (n < 1 || n > MAX_SAFE_INTEGER) {
  29038. return [];
  29039. }
  29040. var index = MAX_ARRAY_LENGTH,
  29041. length = nativeMin(n, MAX_ARRAY_LENGTH);
  29042. iteratee = getIteratee(iteratee);
  29043. n -= MAX_ARRAY_LENGTH;
  29044. var result = baseTimes(length, iteratee);
  29045. while (++index < n) {
  29046. iteratee(index);
  29047. }
  29048. return result;
  29049. }
  29050. /**
  29051. * Converts `value` to a property path array.
  29052. *
  29053. * @static
  29054. * @memberOf _
  29055. * @since 4.0.0
  29056. * @category Util
  29057. * @param {*} value The value to convert.
  29058. * @returns {Array} Returns the new property path array.
  29059. * @example
  29060. *
  29061. * _.toPath('a.b.c');
  29062. * // => ['a', 'b', 'c']
  29063. *
  29064. * _.toPath('a[0].b.c');
  29065. * // => ['a', '0', 'b', 'c']
  29066. */
  29067. function toPath(value) {
  29068. if (isArray(value)) {
  29069. return arrayMap(value, toKey);
  29070. }
  29071. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  29072. }
  29073. /**
  29074. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  29075. *
  29076. * @static
  29077. * @since 0.1.0
  29078. * @memberOf _
  29079. * @category Util
  29080. * @param {string} [prefix=''] The value to prefix the ID with.
  29081. * @returns {string} Returns the unique ID.
  29082. * @example
  29083. *
  29084. * _.uniqueId('contact_');
  29085. * // => 'contact_104'
  29086. *
  29087. * _.uniqueId();
  29088. * // => '105'
  29089. */
  29090. function uniqueId(prefix) {
  29091. var id = ++idCounter;
  29092. return toString(prefix) + id;
  29093. }
  29094. /*------------------------------------------------------------------------*/
  29095. /**
  29096. * Adds two numbers.
  29097. *
  29098. * @static
  29099. * @memberOf _
  29100. * @since 3.4.0
  29101. * @category Math
  29102. * @param {number} augend The first number in an addition.
  29103. * @param {number} addend The second number in an addition.
  29104. * @returns {number} Returns the total.
  29105. * @example
  29106. *
  29107. * _.add(6, 4);
  29108. * // => 10
  29109. */
  29110. var add = createMathOperation(function(augend, addend) {
  29111. return augend + addend;
  29112. }, 0);
  29113. /**
  29114. * Computes `number` rounded up to `precision`.
  29115. *
  29116. * @static
  29117. * @memberOf _
  29118. * @since 3.10.0
  29119. * @category Math
  29120. * @param {number} number The number to round up.
  29121. * @param {number} [precision=0] The precision to round up to.
  29122. * @returns {number} Returns the rounded up number.
  29123. * @example
  29124. *
  29125. * _.ceil(4.006);
  29126. * // => 5
  29127. *
  29128. * _.ceil(6.004, 2);
  29129. * // => 6.01
  29130. *
  29131. * _.ceil(6040, -2);
  29132. * // => 6100
  29133. */
  29134. var ceil = createRound('ceil');
  29135. /**
  29136. * Divide two numbers.
  29137. *
  29138. * @static
  29139. * @memberOf _
  29140. * @since 4.7.0
  29141. * @category Math
  29142. * @param {number} dividend The first number in a division.
  29143. * @param {number} divisor The second number in a division.
  29144. * @returns {number} Returns the quotient.
  29145. * @example
  29146. *
  29147. * _.divide(6, 4);
  29148. * // => 1.5
  29149. */
  29150. var divide = createMathOperation(function(dividend, divisor) {
  29151. return dividend / divisor;
  29152. }, 1);
  29153. /**
  29154. * Computes `number` rounded down to `precision`.
  29155. *
  29156. * @static
  29157. * @memberOf _
  29158. * @since 3.10.0
  29159. * @category Math
  29160. * @param {number} number The number to round down.
  29161. * @param {number} [precision=0] The precision to round down to.
  29162. * @returns {number} Returns the rounded down number.
  29163. * @example
  29164. *
  29165. * _.floor(4.006);
  29166. * // => 4
  29167. *
  29168. * _.floor(0.046, 2);
  29169. * // => 0.04
  29170. *
  29171. * _.floor(4060, -2);
  29172. * // => 4000
  29173. */
  29174. var floor = createRound('floor');
  29175. /**
  29176. * Computes the maximum value of `array`. If `array` is empty or falsey,
  29177. * `undefined` is returned.
  29178. *
  29179. * @static
  29180. * @since 0.1.0
  29181. * @memberOf _
  29182. * @category Math
  29183. * @param {Array} array The array to iterate over.
  29184. * @returns {*} Returns the maximum value.
  29185. * @example
  29186. *
  29187. * _.max([4, 2, 8, 6]);
  29188. * // => 8
  29189. *
  29190. * _.max([]);
  29191. * // => undefined
  29192. */
  29193. function max(array) {
  29194. return (array && array.length)
  29195. ? baseExtremum(array, identity, baseGt)
  29196. : undefined;
  29197. }
  29198. /**
  29199. * This method is like `_.max` except that it accepts `iteratee` which is
  29200. * invoked for each element in `array` to generate the criterion by which
  29201. * the value is ranked. The iteratee is invoked with one argument: (value).
  29202. *
  29203. * @static
  29204. * @memberOf _
  29205. * @since 4.0.0
  29206. * @category Math
  29207. * @param {Array} array The array to iterate over.
  29208. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29209. * @returns {*} Returns the maximum value.
  29210. * @example
  29211. *
  29212. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  29213. *
  29214. * _.maxBy(objects, function(o) { return o.n; });
  29215. * // => { 'n': 2 }
  29216. *
  29217. * // The `_.property` iteratee shorthand.
  29218. * _.maxBy(objects, 'n');
  29219. * // => { 'n': 2 }
  29220. */
  29221. function maxBy(array, iteratee) {
  29222. return (array && array.length)
  29223. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  29224. : undefined;
  29225. }
  29226. /**
  29227. * Computes the mean of the values in `array`.
  29228. *
  29229. * @static
  29230. * @memberOf _
  29231. * @since 4.0.0
  29232. * @category Math
  29233. * @param {Array} array The array to iterate over.
  29234. * @returns {number} Returns the mean.
  29235. * @example
  29236. *
  29237. * _.mean([4, 2, 8, 6]);
  29238. * // => 5
  29239. */
  29240. function mean(array) {
  29241. return baseMean(array, identity);
  29242. }
  29243. /**
  29244. * This method is like `_.mean` except that it accepts `iteratee` which is
  29245. * invoked for each element in `array` to generate the value to be averaged.
  29246. * The iteratee is invoked with one argument: (value).
  29247. *
  29248. * @static
  29249. * @memberOf _
  29250. * @since 4.7.0
  29251. * @category Math
  29252. * @param {Array} array The array to iterate over.
  29253. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29254. * @returns {number} Returns the mean.
  29255. * @example
  29256. *
  29257. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  29258. *
  29259. * _.meanBy(objects, function(o) { return o.n; });
  29260. * // => 5
  29261. *
  29262. * // The `_.property` iteratee shorthand.
  29263. * _.meanBy(objects, 'n');
  29264. * // => 5
  29265. */
  29266. function meanBy(array, iteratee) {
  29267. return baseMean(array, getIteratee(iteratee, 2));
  29268. }
  29269. /**
  29270. * Computes the minimum value of `array`. If `array` is empty or falsey,
  29271. * `undefined` is returned.
  29272. *
  29273. * @static
  29274. * @since 0.1.0
  29275. * @memberOf _
  29276. * @category Math
  29277. * @param {Array} array The array to iterate over.
  29278. * @returns {*} Returns the minimum value.
  29279. * @example
  29280. *
  29281. * _.min([4, 2, 8, 6]);
  29282. * // => 2
  29283. *
  29284. * _.min([]);
  29285. * // => undefined
  29286. */
  29287. function min(array) {
  29288. return (array && array.length)
  29289. ? baseExtremum(array, identity, baseLt)
  29290. : undefined;
  29291. }
  29292. /**
  29293. * This method is like `_.min` except that it accepts `iteratee` which is
  29294. * invoked for each element in `array` to generate the criterion by which
  29295. * the value is ranked. The iteratee is invoked with one argument: (value).
  29296. *
  29297. * @static
  29298. * @memberOf _
  29299. * @since 4.0.0
  29300. * @category Math
  29301. * @param {Array} array The array to iterate over.
  29302. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29303. * @returns {*} Returns the minimum value.
  29304. * @example
  29305. *
  29306. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  29307. *
  29308. * _.minBy(objects, function(o) { return o.n; });
  29309. * // => { 'n': 1 }
  29310. *
  29311. * // The `_.property` iteratee shorthand.
  29312. * _.minBy(objects, 'n');
  29313. * // => { 'n': 1 }
  29314. */
  29315. function minBy(array, iteratee) {
  29316. return (array && array.length)
  29317. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  29318. : undefined;
  29319. }
  29320. /**
  29321. * Multiply two numbers.
  29322. *
  29323. * @static
  29324. * @memberOf _
  29325. * @since 4.7.0
  29326. * @category Math
  29327. * @param {number} multiplier The first number in a multiplication.
  29328. * @param {number} multiplicand The second number in a multiplication.
  29329. * @returns {number} Returns the product.
  29330. * @example
  29331. *
  29332. * _.multiply(6, 4);
  29333. * // => 24
  29334. */
  29335. var multiply = createMathOperation(function(multiplier, multiplicand) {
  29336. return multiplier * multiplicand;
  29337. }, 1);
  29338. /**
  29339. * Computes `number` rounded to `precision`.
  29340. *
  29341. * @static
  29342. * @memberOf _
  29343. * @since 3.10.0
  29344. * @category Math
  29345. * @param {number} number The number to round.
  29346. * @param {number} [precision=0] The precision to round to.
  29347. * @returns {number} Returns the rounded number.
  29348. * @example
  29349. *
  29350. * _.round(4.006);
  29351. * // => 4
  29352. *
  29353. * _.round(4.006, 2);
  29354. * // => 4.01
  29355. *
  29356. * _.round(4060, -2);
  29357. * // => 4100
  29358. */
  29359. var round = createRound('round');
  29360. /**
  29361. * Subtract two numbers.
  29362. *
  29363. * @static
  29364. * @memberOf _
  29365. * @since 4.0.0
  29366. * @category Math
  29367. * @param {number} minuend The first number in a subtraction.
  29368. * @param {number} subtrahend The second number in a subtraction.
  29369. * @returns {number} Returns the difference.
  29370. * @example
  29371. *
  29372. * _.subtract(6, 4);
  29373. * // => 2
  29374. */
  29375. var subtract = createMathOperation(function(minuend, subtrahend) {
  29376. return minuend - subtrahend;
  29377. }, 0);
  29378. /**
  29379. * Computes the sum of the values in `array`.
  29380. *
  29381. * @static
  29382. * @memberOf _
  29383. * @since 3.4.0
  29384. * @category Math
  29385. * @param {Array} array The array to iterate over.
  29386. * @returns {number} Returns the sum.
  29387. * @example
  29388. *
  29389. * _.sum([4, 2, 8, 6]);
  29390. * // => 20
  29391. */
  29392. function sum(array) {
  29393. return (array && array.length)
  29394. ? baseSum(array, identity)
  29395. : 0;
  29396. }
  29397. /**
  29398. * This method is like `_.sum` except that it accepts `iteratee` which is
  29399. * invoked for each element in `array` to generate the value to be summed.
  29400. * The iteratee is invoked with one argument: (value).
  29401. *
  29402. * @static
  29403. * @memberOf _
  29404. * @since 4.0.0
  29405. * @category Math
  29406. * @param {Array} array The array to iterate over.
  29407. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  29408. * @returns {number} Returns the sum.
  29409. * @example
  29410. *
  29411. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  29412. *
  29413. * _.sumBy(objects, function(o) { return o.n; });
  29414. * // => 20
  29415. *
  29416. * // The `_.property` iteratee shorthand.
  29417. * _.sumBy(objects, 'n');
  29418. * // => 20
  29419. */
  29420. function sumBy(array, iteratee) {
  29421. return (array && array.length)
  29422. ? baseSum(array, getIteratee(iteratee, 2))
  29423. : 0;
  29424. }
  29425. /*------------------------------------------------------------------------*/
  29426. // Add methods that return wrapped values in chain sequences.
  29427. lodash.after = after;
  29428. lodash.ary = ary;
  29429. lodash.assign = assign;
  29430. lodash.assignIn = assignIn;
  29431. lodash.assignInWith = assignInWith;
  29432. lodash.assignWith = assignWith;
  29433. lodash.at = at;
  29434. lodash.before = before;
  29435. lodash.bind = bind;
  29436. lodash.bindAll = bindAll;
  29437. lodash.bindKey = bindKey;
  29438. lodash.castArray = castArray;
  29439. lodash.chain = chain;
  29440. lodash.chunk = chunk;
  29441. lodash.compact = compact;
  29442. lodash.concat = concat;
  29443. lodash.cond = cond;
  29444. lodash.conforms = conforms;
  29445. lodash.constant = constant;
  29446. lodash.countBy = countBy;
  29447. lodash.create = create;
  29448. lodash.curry = curry;
  29449. lodash.curryRight = curryRight;
  29450. lodash.debounce = debounce;
  29451. lodash.defaults = defaults;
  29452. lodash.defaultsDeep = defaultsDeep;
  29453. lodash.defer = defer;
  29454. lodash.delay = delay;
  29455. lodash.difference = difference;
  29456. lodash.differenceBy = differenceBy;
  29457. lodash.differenceWith = differenceWith;
  29458. lodash.drop = drop;
  29459. lodash.dropRight = dropRight;
  29460. lodash.dropRightWhile = dropRightWhile;
  29461. lodash.dropWhile = dropWhile;
  29462. lodash.fill = fill;
  29463. lodash.filter = filter;
  29464. lodash.flatMap = flatMap;
  29465. lodash.flatMapDeep = flatMapDeep;
  29466. lodash.flatMapDepth = flatMapDepth;
  29467. lodash.flatten = flatten;
  29468. lodash.flattenDeep = flattenDeep;
  29469. lodash.flattenDepth = flattenDepth;
  29470. lodash.flip = flip;
  29471. lodash.flow = flow;
  29472. lodash.flowRight = flowRight;
  29473. lodash.fromPairs = fromPairs;
  29474. lodash.functions = functions;
  29475. lodash.functionsIn = functionsIn;
  29476. lodash.groupBy = groupBy;
  29477. lodash.initial = initial;
  29478. lodash.intersection = intersection;
  29479. lodash.intersectionBy = intersectionBy;
  29480. lodash.intersectionWith = intersectionWith;
  29481. lodash.invert = invert;
  29482. lodash.invertBy = invertBy;
  29483. lodash.invokeMap = invokeMap;
  29484. lodash.iteratee = iteratee;
  29485. lodash.keyBy = keyBy;
  29486. lodash.keys = keys;
  29487. lodash.keysIn = keysIn;
  29488. lodash.map = map;
  29489. lodash.mapKeys = mapKeys;
  29490. lodash.mapValues = mapValues;
  29491. lodash.matches = matches;
  29492. lodash.matchesProperty = matchesProperty;
  29493. lodash.memoize = memoize;
  29494. lodash.merge = merge;
  29495. lodash.mergeWith = mergeWith;
  29496. lodash.method = method;
  29497. lodash.methodOf = methodOf;
  29498. lodash.mixin = mixin;
  29499. lodash.negate = negate;
  29500. lodash.nthArg = nthArg;
  29501. lodash.omit = omit;
  29502. lodash.omitBy = omitBy;
  29503. lodash.once = once;
  29504. lodash.orderBy = orderBy;
  29505. lodash.over = over;
  29506. lodash.overArgs = overArgs;
  29507. lodash.overEvery = overEvery;
  29508. lodash.overSome = overSome;
  29509. lodash.partial = partial;
  29510. lodash.partialRight = partialRight;
  29511. lodash.partition = partition;
  29512. lodash.pick = pick;
  29513. lodash.pickBy = pickBy;
  29514. lodash.property = property;
  29515. lodash.propertyOf = propertyOf;
  29516. lodash.pull = pull;
  29517. lodash.pullAll = pullAll;
  29518. lodash.pullAllBy = pullAllBy;
  29519. lodash.pullAllWith = pullAllWith;
  29520. lodash.pullAt = pullAt;
  29521. lodash.range = range;
  29522. lodash.rangeRight = rangeRight;
  29523. lodash.rearg = rearg;
  29524. lodash.reject = reject;
  29525. lodash.remove = remove;
  29526. lodash.rest = rest;
  29527. lodash.reverse = reverse;
  29528. lodash.sampleSize = sampleSize;
  29529. lodash.set = set;
  29530. lodash.setWith = setWith;
  29531. lodash.shuffle = shuffle;
  29532. lodash.slice = slice;
  29533. lodash.sortBy = sortBy;
  29534. lodash.sortedUniq = sortedUniq;
  29535. lodash.sortedUniqBy = sortedUniqBy;
  29536. lodash.split = split;
  29537. lodash.spread = spread;
  29538. lodash.tail = tail;
  29539. lodash.take = take;
  29540. lodash.takeRight = takeRight;
  29541. lodash.takeRightWhile = takeRightWhile;
  29542. lodash.takeWhile = takeWhile;
  29543. lodash.tap = tap;
  29544. lodash.throttle = throttle;
  29545. lodash.thru = thru;
  29546. lodash.toArray = toArray;
  29547. lodash.toPairs = toPairs;
  29548. lodash.toPairsIn = toPairsIn;
  29549. lodash.toPath = toPath;
  29550. lodash.toPlainObject = toPlainObject;
  29551. lodash.transform = transform;
  29552. lodash.unary = unary;
  29553. lodash.union = union;
  29554. lodash.unionBy = unionBy;
  29555. lodash.unionWith = unionWith;
  29556. lodash.uniq = uniq;
  29557. lodash.uniqBy = uniqBy;
  29558. lodash.uniqWith = uniqWith;
  29559. lodash.unset = unset;
  29560. lodash.unzip = unzip;
  29561. lodash.unzipWith = unzipWith;
  29562. lodash.update = update;
  29563. lodash.updateWith = updateWith;
  29564. lodash.values = values;
  29565. lodash.valuesIn = valuesIn;
  29566. lodash.without = without;
  29567. lodash.words = words;
  29568. lodash.wrap = wrap;
  29569. lodash.xor = xor;
  29570. lodash.xorBy = xorBy;
  29571. lodash.xorWith = xorWith;
  29572. lodash.zip = zip;
  29573. lodash.zipObject = zipObject;
  29574. lodash.zipObjectDeep = zipObjectDeep;
  29575. lodash.zipWith = zipWith;
  29576. // Add aliases.
  29577. lodash.entries = toPairs;
  29578. lodash.entriesIn = toPairsIn;
  29579. lodash.extend = assignIn;
  29580. lodash.extendWith = assignInWith;
  29581. // Add methods to `lodash.prototype`.
  29582. mixin(lodash, lodash);
  29583. /*------------------------------------------------------------------------*/
  29584. // Add methods that return unwrapped values in chain sequences.
  29585. lodash.add = add;
  29586. lodash.attempt = attempt;
  29587. lodash.camelCase = camelCase;
  29588. lodash.capitalize = capitalize;
  29589. lodash.ceil = ceil;
  29590. lodash.clamp = clamp;
  29591. lodash.clone = clone;
  29592. lodash.cloneDeep = cloneDeep;
  29593. lodash.cloneDeepWith = cloneDeepWith;
  29594. lodash.cloneWith = cloneWith;
  29595. lodash.conformsTo = conformsTo;
  29596. lodash.deburr = deburr;
  29597. lodash.defaultTo = defaultTo;
  29598. lodash.divide = divide;
  29599. lodash.endsWith = endsWith;
  29600. lodash.eq = eq;
  29601. lodash.escape = escape;
  29602. lodash.escapeRegExp = escapeRegExp;
  29603. lodash.every = every;
  29604. lodash.find = find;
  29605. lodash.findIndex = findIndex;
  29606. lodash.findKey = findKey;
  29607. lodash.findLast = findLast;
  29608. lodash.findLastIndex = findLastIndex;
  29609. lodash.findLastKey = findLastKey;
  29610. lodash.floor = floor;
  29611. lodash.forEach = forEach;
  29612. lodash.forEachRight = forEachRight;
  29613. lodash.forIn = forIn;
  29614. lodash.forInRight = forInRight;
  29615. lodash.forOwn = forOwn;
  29616. lodash.forOwnRight = forOwnRight;
  29617. lodash.get = get;
  29618. lodash.gt = gt;
  29619. lodash.gte = gte;
  29620. lodash.has = has;
  29621. lodash.hasIn = hasIn;
  29622. lodash.head = head;
  29623. lodash.identity = identity;
  29624. lodash.includes = includes;
  29625. lodash.indexOf = indexOf;
  29626. lodash.inRange = inRange;
  29627. lodash.invoke = invoke;
  29628. lodash.isArguments = isArguments;
  29629. lodash.isArray = isArray;
  29630. lodash.isArrayBuffer = isArrayBuffer;
  29631. lodash.isArrayLike = isArrayLike;
  29632. lodash.isArrayLikeObject = isArrayLikeObject;
  29633. lodash.isBoolean = isBoolean;
  29634. lodash.isBuffer = isBuffer;
  29635. lodash.isDate = isDate;
  29636. lodash.isElement = isElement;
  29637. lodash.isEmpty = isEmpty;
  29638. lodash.isEqual = isEqual;
  29639. lodash.isEqualWith = isEqualWith;
  29640. lodash.isError = isError;
  29641. lodash.isFinite = isFinite;
  29642. lodash.isFunction = isFunction;
  29643. lodash.isInteger = isInteger;
  29644. lodash.isLength = isLength;
  29645. lodash.isMap = isMap;
  29646. lodash.isMatch = isMatch;
  29647. lodash.isMatchWith = isMatchWith;
  29648. lodash.isNaN = isNaN;
  29649. lodash.isNative = isNative;
  29650. lodash.isNil = isNil;
  29651. lodash.isNull = isNull;
  29652. lodash.isNumber = isNumber;
  29653. lodash.isObject = isObject;
  29654. lodash.isObjectLike = isObjectLike;
  29655. lodash.isPlainObject = isPlainObject;
  29656. lodash.isRegExp = isRegExp;
  29657. lodash.isSafeInteger = isSafeInteger;
  29658. lodash.isSet = isSet;
  29659. lodash.isString = isString;
  29660. lodash.isSymbol = isSymbol;
  29661. lodash.isTypedArray = isTypedArray;
  29662. lodash.isUndefined = isUndefined;
  29663. lodash.isWeakMap = isWeakMap;
  29664. lodash.isWeakSet = isWeakSet;
  29665. lodash.join = join;
  29666. lodash.kebabCase = kebabCase;
  29667. lodash.last = last;
  29668. lodash.lastIndexOf = lastIndexOf;
  29669. lodash.lowerCase = lowerCase;
  29670. lodash.lowerFirst = lowerFirst;
  29671. lodash.lt = lt;
  29672. lodash.lte = lte;
  29673. lodash.max = max;
  29674. lodash.maxBy = maxBy;
  29675. lodash.mean = mean;
  29676. lodash.meanBy = meanBy;
  29677. lodash.min = min;
  29678. lodash.minBy = minBy;
  29679. lodash.stubArray = stubArray;
  29680. lodash.stubFalse = stubFalse;
  29681. lodash.stubObject = stubObject;
  29682. lodash.stubString = stubString;
  29683. lodash.stubTrue = stubTrue;
  29684. lodash.multiply = multiply;
  29685. lodash.nth = nth;
  29686. lodash.noConflict = noConflict;
  29687. lodash.noop = noop;
  29688. lodash.now = now;
  29689. lodash.pad = pad;
  29690. lodash.padEnd = padEnd;
  29691. lodash.padStart = padStart;
  29692. lodash.parseInt = parseInt;
  29693. lodash.random = random;
  29694. lodash.reduce = reduce;
  29695. lodash.reduceRight = reduceRight;
  29696. lodash.repeat = repeat;
  29697. lodash.replace = replace;
  29698. lodash.result = result;
  29699. lodash.round = round;
  29700. lodash.runInContext = runInContext;
  29701. lodash.sample = sample;
  29702. lodash.size = size;
  29703. lodash.snakeCase = snakeCase;
  29704. lodash.some = some;
  29705. lodash.sortedIndex = sortedIndex;
  29706. lodash.sortedIndexBy = sortedIndexBy;
  29707. lodash.sortedIndexOf = sortedIndexOf;
  29708. lodash.sortedLastIndex = sortedLastIndex;
  29709. lodash.sortedLastIndexBy = sortedLastIndexBy;
  29710. lodash.sortedLastIndexOf = sortedLastIndexOf;
  29711. lodash.startCase = startCase;
  29712. lodash.startsWith = startsWith;
  29713. lodash.subtract = subtract;
  29714. lodash.sum = sum;
  29715. lodash.sumBy = sumBy;
  29716. lodash.template = template;
  29717. lodash.times = times;
  29718. lodash.toFinite = toFinite;
  29719. lodash.toInteger = toInteger;
  29720. lodash.toLength = toLength;
  29721. lodash.toLower = toLower;
  29722. lodash.toNumber = toNumber;
  29723. lodash.toSafeInteger = toSafeInteger;
  29724. lodash.toString = toString;
  29725. lodash.toUpper = toUpper;
  29726. lodash.trim = trim;
  29727. lodash.trimEnd = trimEnd;
  29728. lodash.trimStart = trimStart;
  29729. lodash.truncate = truncate;
  29730. lodash.unescape = unescape;
  29731. lodash.uniqueId = uniqueId;
  29732. lodash.upperCase = upperCase;
  29733. lodash.upperFirst = upperFirst;
  29734. // Add aliases.
  29735. lodash.each = forEach;
  29736. lodash.eachRight = forEachRight;
  29737. lodash.first = head;
  29738. mixin(lodash, (function() {
  29739. var source = {};
  29740. baseForOwn(lodash, function(func, methodName) {
  29741. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  29742. source[methodName] = func;
  29743. }
  29744. });
  29745. return source;
  29746. }()), { 'chain': false });
  29747. /*------------------------------------------------------------------------*/
  29748. /**
  29749. * The semantic version number.
  29750. *
  29751. * @static
  29752. * @memberOf _
  29753. * @type {string}
  29754. */
  29755. lodash.VERSION = VERSION;
  29756. // Assign default placeholders.
  29757. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  29758. lodash[methodName].placeholder = lodash;
  29759. });
  29760. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  29761. arrayEach(['drop', 'take'], function(methodName, index) {
  29762. LazyWrapper.prototype[methodName] = function(n) {
  29763. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  29764. var result = (this.__filtered__ && !index)
  29765. ? new LazyWrapper(this)
  29766. : this.clone();
  29767. if (result.__filtered__) {
  29768. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  29769. } else {
  29770. result.__views__.push({
  29771. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  29772. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  29773. });
  29774. }
  29775. return result;
  29776. };
  29777. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  29778. return this.reverse()[methodName](n).reverse();
  29779. };
  29780. });
  29781. // Add `LazyWrapper` methods that accept an `iteratee` value.
  29782. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  29783. var type = index + 1,
  29784. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  29785. LazyWrapper.prototype[methodName] = function(iteratee) {
  29786. var result = this.clone();
  29787. result.__iteratees__.push({
  29788. 'iteratee': getIteratee(iteratee, 3),
  29789. 'type': type
  29790. });
  29791. result.__filtered__ = result.__filtered__ || isFilter;
  29792. return result;
  29793. };
  29794. });
  29795. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  29796. arrayEach(['head', 'last'], function(methodName, index) {
  29797. var takeName = 'take' + (index ? 'Right' : '');
  29798. LazyWrapper.prototype[methodName] = function() {
  29799. return this[takeName](1).value()[0];
  29800. };
  29801. });
  29802. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  29803. arrayEach(['initial', 'tail'], function(methodName, index) {
  29804. var dropName = 'drop' + (index ? '' : 'Right');
  29805. LazyWrapper.prototype[methodName] = function() {
  29806. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  29807. };
  29808. });
  29809. LazyWrapper.prototype.compact = function() {
  29810. return this.filter(identity);
  29811. };
  29812. LazyWrapper.prototype.find = function(predicate) {
  29813. return this.filter(predicate).head();
  29814. };
  29815. LazyWrapper.prototype.findLast = function(predicate) {
  29816. return this.reverse().find(predicate);
  29817. };
  29818. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  29819. if (typeof path == 'function') {
  29820. return new LazyWrapper(this);
  29821. }
  29822. return this.map(function(value) {
  29823. return baseInvoke(value, path, args);
  29824. });
  29825. });
  29826. LazyWrapper.prototype.reject = function(predicate) {
  29827. return this.filter(negate(getIteratee(predicate)));
  29828. };
  29829. LazyWrapper.prototype.slice = function(start, end) {
  29830. start = toInteger(start);
  29831. var result = this;
  29832. if (result.__filtered__ && (start > 0 || end < 0)) {
  29833. return new LazyWrapper(result);
  29834. }
  29835. if (start < 0) {
  29836. result = result.takeRight(-start);
  29837. } else if (start) {
  29838. result = result.drop(start);
  29839. }
  29840. if (end !== undefined) {
  29841. end = toInteger(end);
  29842. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  29843. }
  29844. return result;
  29845. };
  29846. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  29847. return this.reverse().takeWhile(predicate).reverse();
  29848. };
  29849. LazyWrapper.prototype.toArray = function() {
  29850. return this.take(MAX_ARRAY_LENGTH);
  29851. };
  29852. // Add `LazyWrapper` methods to `lodash.prototype`.
  29853. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  29854. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  29855. isTaker = /^(?:head|last)$/.test(methodName),
  29856. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  29857. retUnwrapped = isTaker || /^find/.test(methodName);
  29858. if (!lodashFunc) {
  29859. return;
  29860. }
  29861. lodash.prototype[methodName] = function() {
  29862. var value = this.__wrapped__,
  29863. args = isTaker ? [1] : arguments,
  29864. isLazy = value instanceof LazyWrapper,
  29865. iteratee = args[0],
  29866. useLazy = isLazy || isArray(value);
  29867. var interceptor = function(value) {
  29868. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  29869. return (isTaker && chainAll) ? result[0] : result;
  29870. };
  29871. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  29872. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  29873. isLazy = useLazy = false;
  29874. }
  29875. var chainAll = this.__chain__,
  29876. isHybrid = !!this.__actions__.length,
  29877. isUnwrapped = retUnwrapped && !chainAll,
  29878. onlyLazy = isLazy && !isHybrid;
  29879. if (!retUnwrapped && useLazy) {
  29880. value = onlyLazy ? value : new LazyWrapper(this);
  29881. var result = func.apply(value, args);
  29882. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  29883. return new LodashWrapper(result, chainAll);
  29884. }
  29885. if (isUnwrapped && onlyLazy) {
  29886. return func.apply(this, args);
  29887. }
  29888. result = this.thru(interceptor);
  29889. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  29890. };
  29891. });
  29892. // Add `Array` methods to `lodash.prototype`.
  29893. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  29894. var func = arrayProto[methodName],
  29895. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  29896. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  29897. lodash.prototype[methodName] = function() {
  29898. var args = arguments;
  29899. if (retUnwrapped && !this.__chain__) {
  29900. var value = this.value();
  29901. return func.apply(isArray(value) ? value : [], args);
  29902. }
  29903. return this[chainName](function(value) {
  29904. return func.apply(isArray(value) ? value : [], args);
  29905. });
  29906. };
  29907. });
  29908. // Map minified method names to their real names.
  29909. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  29910. var lodashFunc = lodash[methodName];
  29911. if (lodashFunc) {
  29912. var key = lodashFunc.name + '';
  29913. if (!hasOwnProperty.call(realNames, key)) {
  29914. realNames[key] = [];
  29915. }
  29916. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  29917. }
  29918. });
  29919. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  29920. 'name': 'wrapper',
  29921. 'func': undefined
  29922. }];
  29923. // Add methods to `LazyWrapper`.
  29924. LazyWrapper.prototype.clone = lazyClone;
  29925. LazyWrapper.prototype.reverse = lazyReverse;
  29926. LazyWrapper.prototype.value = lazyValue;
  29927. // Add chain sequence methods to the `lodash` wrapper.
  29928. lodash.prototype.at = wrapperAt;
  29929. lodash.prototype.chain = wrapperChain;
  29930. lodash.prototype.commit = wrapperCommit;
  29931. lodash.prototype.next = wrapperNext;
  29932. lodash.prototype.plant = wrapperPlant;
  29933. lodash.prototype.reverse = wrapperReverse;
  29934. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  29935. // Add lazy aliases.
  29936. lodash.prototype.first = lodash.prototype.head;
  29937. if (symIterator) {
  29938. lodash.prototype[symIterator] = wrapperToIterator;
  29939. }
  29940. return lodash;
  29941. });
  29942. /*--------------------------------------------------------------------------*/
  29943. // Export lodash.
  29944. var _ = runInContext();
  29945. // Some AMD build optimizers, like r.js, check for condition patterns like:
  29946. if (true) {
  29947. // Expose Lodash on the global object to prevent errors when Lodash is
  29948. // loaded by a script tag in the presence of an AMD loader.
  29949. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  29950. // Use `_.noConflict` to remove Lodash from the global object.
  29951. root._ = _;
  29952. // Define as an anonymous module so, through path mapping, it can be
  29953. // referenced as the "underscore" module.
  29954. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  29955. return _;
  29956. }).call(exports, __webpack_require__, exports, module),
  29957. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  29958. }
  29959. // Check for `exports` after `define` in case a build optimizer adds it.
  29960. else {}
  29961. }.call(this));
  29962. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
  29963. /***/ }),
  29964. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  29965. /*!***************************************************!*\
  29966. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  29967. \***************************************************/
  29968. /*! exports provided: default */
  29969. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  29970. "use strict";
  29971. __webpack_require__.r(__webpack_exports__);
  29972. /* WEBPACK VAR INJECTION */(function(global) {/**!
  29973. * @fileOverview Kickass library to create and place poppers near their reference elements.
  29974. * @version 1.16.1
  29975. * @license
  29976. * Copyright (c) 2016 Federico Zivolo and contributors
  29977. *
  29978. * Permission is hereby granted, free of charge, to any person obtaining a copy
  29979. * of this software and associated documentation files (the "Software"), to deal
  29980. * in the Software without restriction, including without limitation the rights
  29981. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  29982. * copies of the Software, and to permit persons to whom the Software is
  29983. * furnished to do so, subject to the following conditions:
  29984. *
  29985. * The above copyright notice and this permission notice shall be included in all
  29986. * copies or substantial portions of the Software.
  29987. *
  29988. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  29989. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  29990. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  29991. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  29992. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  29993. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  29994. * SOFTWARE.
  29995. */
  29996. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  29997. var timeoutDuration = function () {
  29998. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  29999. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  30000. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  30001. return 1;
  30002. }
  30003. }
  30004. return 0;
  30005. }();
  30006. function microtaskDebounce(fn) {
  30007. var called = false;
  30008. return function () {
  30009. if (called) {
  30010. return;
  30011. }
  30012. called = true;
  30013. window.Promise.resolve().then(function () {
  30014. called = false;
  30015. fn();
  30016. });
  30017. };
  30018. }
  30019. function taskDebounce(fn) {
  30020. var scheduled = false;
  30021. return function () {
  30022. if (!scheduled) {
  30023. scheduled = true;
  30024. setTimeout(function () {
  30025. scheduled = false;
  30026. fn();
  30027. }, timeoutDuration);
  30028. }
  30029. };
  30030. }
  30031. var supportsMicroTasks = isBrowser && window.Promise;
  30032. /**
  30033. * Create a debounced version of a method, that's asynchronously deferred
  30034. * but called in the minimum time possible.
  30035. *
  30036. * @method
  30037. * @memberof Popper.Utils
  30038. * @argument {Function} fn
  30039. * @returns {Function}
  30040. */
  30041. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  30042. /**
  30043. * Check if the given variable is a function
  30044. * @method
  30045. * @memberof Popper.Utils
  30046. * @argument {Any} functionToCheck - variable to check
  30047. * @returns {Boolean} answer to: is a function?
  30048. */
  30049. function isFunction(functionToCheck) {
  30050. var getType = {};
  30051. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  30052. }
  30053. /**
  30054. * Get CSS computed property of the given element
  30055. * @method
  30056. * @memberof Popper.Utils
  30057. * @argument {Eement} element
  30058. * @argument {String} property
  30059. */
  30060. function getStyleComputedProperty(element, property) {
  30061. if (element.nodeType !== 1) {
  30062. return [];
  30063. }
  30064. // NOTE: 1 DOM access here
  30065. var window = element.ownerDocument.defaultView;
  30066. var css = window.getComputedStyle(element, null);
  30067. return property ? css[property] : css;
  30068. }
  30069. /**
  30070. * Returns the parentNode or the host of the element
  30071. * @method
  30072. * @memberof Popper.Utils
  30073. * @argument {Element} element
  30074. * @returns {Element} parent
  30075. */
  30076. function getParentNode(element) {
  30077. if (element.nodeName === 'HTML') {
  30078. return element;
  30079. }
  30080. return element.parentNode || element.host;
  30081. }
  30082. /**
  30083. * Returns the scrolling parent of the given element
  30084. * @method
  30085. * @memberof Popper.Utils
  30086. * @argument {Element} element
  30087. * @returns {Element} scroll parent
  30088. */
  30089. function getScrollParent(element) {
  30090. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  30091. if (!element) {
  30092. return document.body;
  30093. }
  30094. switch (element.nodeName) {
  30095. case 'HTML':
  30096. case 'BODY':
  30097. return element.ownerDocument.body;
  30098. case '#document':
  30099. return element.body;
  30100. }
  30101. // Firefox want us to check `-x` and `-y` variations as well
  30102. var _getStyleComputedProp = getStyleComputedProperty(element),
  30103. overflow = _getStyleComputedProp.overflow,
  30104. overflowX = _getStyleComputedProp.overflowX,
  30105. overflowY = _getStyleComputedProp.overflowY;
  30106. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  30107. return element;
  30108. }
  30109. return getScrollParent(getParentNode(element));
  30110. }
  30111. /**
  30112. * Returns the reference node of the reference object, or the reference object itself.
  30113. * @method
  30114. * @memberof Popper.Utils
  30115. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  30116. * @returns {Element} parent
  30117. */
  30118. function getReferenceNode(reference) {
  30119. return reference && reference.referenceNode ? reference.referenceNode : reference;
  30120. }
  30121. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  30122. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  30123. /**
  30124. * Determines if the browser is Internet Explorer
  30125. * @method
  30126. * @memberof Popper.Utils
  30127. * @param {Number} version to check
  30128. * @returns {Boolean} isIE
  30129. */
  30130. function isIE(version) {
  30131. if (version === 11) {
  30132. return isIE11;
  30133. }
  30134. if (version === 10) {
  30135. return isIE10;
  30136. }
  30137. return isIE11 || isIE10;
  30138. }
  30139. /**
  30140. * Returns the offset parent of the given element
  30141. * @method
  30142. * @memberof Popper.Utils
  30143. * @argument {Element} element
  30144. * @returns {Element} offset parent
  30145. */
  30146. function getOffsetParent(element) {
  30147. if (!element) {
  30148. return document.documentElement;
  30149. }
  30150. var noOffsetParent = isIE(10) ? document.body : null;
  30151. // NOTE: 1 DOM access here
  30152. var offsetParent = element.offsetParent || null;
  30153. // Skip hidden elements which don't have an offsetParent
  30154. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  30155. offsetParent = (element = element.nextElementSibling).offsetParent;
  30156. }
  30157. var nodeName = offsetParent && offsetParent.nodeName;
  30158. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  30159. return element ? element.ownerDocument.documentElement : document.documentElement;
  30160. }
  30161. // .offsetParent will return the closest TH, TD or TABLE in case
  30162. // no offsetParent is present, I hate this job...
  30163. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  30164. return getOffsetParent(offsetParent);
  30165. }
  30166. return offsetParent;
  30167. }
  30168. function isOffsetContainer(element) {
  30169. var nodeName = element.nodeName;
  30170. if (nodeName === 'BODY') {
  30171. return false;
  30172. }
  30173. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  30174. }
  30175. /**
  30176. * Finds the root node (document, shadowDOM root) of the given element
  30177. * @method
  30178. * @memberof Popper.Utils
  30179. * @argument {Element} node
  30180. * @returns {Element} root node
  30181. */
  30182. function getRoot(node) {
  30183. if (node.parentNode !== null) {
  30184. return getRoot(node.parentNode);
  30185. }
  30186. return node;
  30187. }
  30188. /**
  30189. * Finds the offset parent common to the two provided nodes
  30190. * @method
  30191. * @memberof Popper.Utils
  30192. * @argument {Element} element1
  30193. * @argument {Element} element2
  30194. * @returns {Element} common offset parent
  30195. */
  30196. function findCommonOffsetParent(element1, element2) {
  30197. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  30198. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  30199. return document.documentElement;
  30200. }
  30201. // Here we make sure to give as "start" the element that comes first in the DOM
  30202. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  30203. var start = order ? element1 : element2;
  30204. var end = order ? element2 : element1;
  30205. // Get common ancestor container
  30206. var range = document.createRange();
  30207. range.setStart(start, 0);
  30208. range.setEnd(end, 0);
  30209. var commonAncestorContainer = range.commonAncestorContainer;
  30210. // Both nodes are inside #document
  30211. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  30212. if (isOffsetContainer(commonAncestorContainer)) {
  30213. return commonAncestorContainer;
  30214. }
  30215. return getOffsetParent(commonAncestorContainer);
  30216. }
  30217. // one of the nodes is inside shadowDOM, find which one
  30218. var element1root = getRoot(element1);
  30219. if (element1root.host) {
  30220. return findCommonOffsetParent(element1root.host, element2);
  30221. } else {
  30222. return findCommonOffsetParent(element1, getRoot(element2).host);
  30223. }
  30224. }
  30225. /**
  30226. * Gets the scroll value of the given element in the given side (top and left)
  30227. * @method
  30228. * @memberof Popper.Utils
  30229. * @argument {Element} element
  30230. * @argument {String} side `top` or `left`
  30231. * @returns {number} amount of scrolled pixels
  30232. */
  30233. function getScroll(element) {
  30234. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  30235. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  30236. var nodeName = element.nodeName;
  30237. if (nodeName === 'BODY' || nodeName === 'HTML') {
  30238. var html = element.ownerDocument.documentElement;
  30239. var scrollingElement = element.ownerDocument.scrollingElement || html;
  30240. return scrollingElement[upperSide];
  30241. }
  30242. return element[upperSide];
  30243. }
  30244. /*
  30245. * Sum or subtract the element scroll values (left and top) from a given rect object
  30246. * @method
  30247. * @memberof Popper.Utils
  30248. * @param {Object} rect - Rect object you want to change
  30249. * @param {HTMLElement} element - The element from the function reads the scroll values
  30250. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  30251. * @return {Object} rect - The modifier rect object
  30252. */
  30253. function includeScroll(rect, element) {
  30254. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  30255. var scrollTop = getScroll(element, 'top');
  30256. var scrollLeft = getScroll(element, 'left');
  30257. var modifier = subtract ? -1 : 1;
  30258. rect.top += scrollTop * modifier;
  30259. rect.bottom += scrollTop * modifier;
  30260. rect.left += scrollLeft * modifier;
  30261. rect.right += scrollLeft * modifier;
  30262. return rect;
  30263. }
  30264. /*
  30265. * Helper to detect borders of a given element
  30266. * @method
  30267. * @memberof Popper.Utils
  30268. * @param {CSSStyleDeclaration} styles
  30269. * Result of `getStyleComputedProperty` on the given element
  30270. * @param {String} axis - `x` or `y`
  30271. * @return {number} borders - The borders size of the given axis
  30272. */
  30273. function getBordersSize(styles, axis) {
  30274. var sideA = axis === 'x' ? 'Left' : 'Top';
  30275. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  30276. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  30277. }
  30278. function getSize(axis, body, html, computedStyle) {
  30279. return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
  30280. }
  30281. function getWindowSizes(document) {
  30282. var body = document.body;
  30283. var html = document.documentElement;
  30284. var computedStyle = isIE(10) && getComputedStyle(html);
  30285. return {
  30286. height: getSize('Height', body, html, computedStyle),
  30287. width: getSize('Width', body, html, computedStyle)
  30288. };
  30289. }
  30290. var classCallCheck = function (instance, Constructor) {
  30291. if (!(instance instanceof Constructor)) {
  30292. throw new TypeError("Cannot call a class as a function");
  30293. }
  30294. };
  30295. var createClass = function () {
  30296. function defineProperties(target, props) {
  30297. for (var i = 0; i < props.length; i++) {
  30298. var descriptor = props[i];
  30299. descriptor.enumerable = descriptor.enumerable || false;
  30300. descriptor.configurable = true;
  30301. if ("value" in descriptor) descriptor.writable = true;
  30302. Object.defineProperty(target, descriptor.key, descriptor);
  30303. }
  30304. }
  30305. return function (Constructor, protoProps, staticProps) {
  30306. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  30307. if (staticProps) defineProperties(Constructor, staticProps);
  30308. return Constructor;
  30309. };
  30310. }();
  30311. var defineProperty = function (obj, key, value) {
  30312. if (key in obj) {
  30313. Object.defineProperty(obj, key, {
  30314. value: value,
  30315. enumerable: true,
  30316. configurable: true,
  30317. writable: true
  30318. });
  30319. } else {
  30320. obj[key] = value;
  30321. }
  30322. return obj;
  30323. };
  30324. var _extends = Object.assign || function (target) {
  30325. for (var i = 1; i < arguments.length; i++) {
  30326. var source = arguments[i];
  30327. for (var key in source) {
  30328. if (Object.prototype.hasOwnProperty.call(source, key)) {
  30329. target[key] = source[key];
  30330. }
  30331. }
  30332. }
  30333. return target;
  30334. };
  30335. /**
  30336. * Given element offsets, generate an output similar to getBoundingClientRect
  30337. * @method
  30338. * @memberof Popper.Utils
  30339. * @argument {Object} offsets
  30340. * @returns {Object} ClientRect like output
  30341. */
  30342. function getClientRect(offsets) {
  30343. return _extends({}, offsets, {
  30344. right: offsets.left + offsets.width,
  30345. bottom: offsets.top + offsets.height
  30346. });
  30347. }
  30348. /**
  30349. * Get bounding client rect of given element
  30350. * @method
  30351. * @memberof Popper.Utils
  30352. * @param {HTMLElement} element
  30353. * @return {Object} client rect
  30354. */
  30355. function getBoundingClientRect(element) {
  30356. var rect = {};
  30357. // IE10 10 FIX: Please, don't ask, the element isn't
  30358. // considered in DOM in some circumstances...
  30359. // This isn't reproducible in IE10 compatibility mode of IE11
  30360. try {
  30361. if (isIE(10)) {
  30362. rect = element.getBoundingClientRect();
  30363. var scrollTop = getScroll(element, 'top');
  30364. var scrollLeft = getScroll(element, 'left');
  30365. rect.top += scrollTop;
  30366. rect.left += scrollLeft;
  30367. rect.bottom += scrollTop;
  30368. rect.right += scrollLeft;
  30369. } else {
  30370. rect = element.getBoundingClientRect();
  30371. }
  30372. } catch (e) {}
  30373. var result = {
  30374. left: rect.left,
  30375. top: rect.top,
  30376. width: rect.right - rect.left,
  30377. height: rect.bottom - rect.top
  30378. };
  30379. // subtract scrollbar size from sizes
  30380. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  30381. var width = sizes.width || element.clientWidth || result.width;
  30382. var height = sizes.height || element.clientHeight || result.height;
  30383. var horizScrollbar = element.offsetWidth - width;
  30384. var vertScrollbar = element.offsetHeight - height;
  30385. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  30386. // we make this check conditional for performance reasons
  30387. if (horizScrollbar || vertScrollbar) {
  30388. var styles = getStyleComputedProperty(element);
  30389. horizScrollbar -= getBordersSize(styles, 'x');
  30390. vertScrollbar -= getBordersSize(styles, 'y');
  30391. result.width -= horizScrollbar;
  30392. result.height -= vertScrollbar;
  30393. }
  30394. return getClientRect(result);
  30395. }
  30396. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  30397. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  30398. var isIE10 = isIE(10);
  30399. var isHTML = parent.nodeName === 'HTML';
  30400. var childrenRect = getBoundingClientRect(children);
  30401. var parentRect = getBoundingClientRect(parent);
  30402. var scrollParent = getScrollParent(children);
  30403. var styles = getStyleComputedProperty(parent);
  30404. var borderTopWidth = parseFloat(styles.borderTopWidth);
  30405. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  30406. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  30407. if (fixedPosition && isHTML) {
  30408. parentRect.top = Math.max(parentRect.top, 0);
  30409. parentRect.left = Math.max(parentRect.left, 0);
  30410. }
  30411. var offsets = getClientRect({
  30412. top: childrenRect.top - parentRect.top - borderTopWidth,
  30413. left: childrenRect.left - parentRect.left - borderLeftWidth,
  30414. width: childrenRect.width,
  30415. height: childrenRect.height
  30416. });
  30417. offsets.marginTop = 0;
  30418. offsets.marginLeft = 0;
  30419. // Subtract margins of documentElement in case it's being used as parent
  30420. // we do this only on HTML because it's the only element that behaves
  30421. // differently when margins are applied to it. The margins are included in
  30422. // the box of the documentElement, in the other cases not.
  30423. if (!isIE10 && isHTML) {
  30424. var marginTop = parseFloat(styles.marginTop);
  30425. var marginLeft = parseFloat(styles.marginLeft);
  30426. offsets.top -= borderTopWidth - marginTop;
  30427. offsets.bottom -= borderTopWidth - marginTop;
  30428. offsets.left -= borderLeftWidth - marginLeft;
  30429. offsets.right -= borderLeftWidth - marginLeft;
  30430. // Attach marginTop and marginLeft because in some circumstances we may need them
  30431. offsets.marginTop = marginTop;
  30432. offsets.marginLeft = marginLeft;
  30433. }
  30434. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  30435. offsets = includeScroll(offsets, parent);
  30436. }
  30437. return offsets;
  30438. }
  30439. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  30440. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  30441. var html = element.ownerDocument.documentElement;
  30442. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  30443. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  30444. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  30445. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  30446. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  30447. var offset = {
  30448. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  30449. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  30450. width: width,
  30451. height: height
  30452. };
  30453. return getClientRect(offset);
  30454. }
  30455. /**
  30456. * Check if the given element is fixed or is inside a fixed parent
  30457. * @method
  30458. * @memberof Popper.Utils
  30459. * @argument {Element} element
  30460. * @argument {Element} customContainer
  30461. * @returns {Boolean} answer to "isFixed?"
  30462. */
  30463. function isFixed(element) {
  30464. var nodeName = element.nodeName;
  30465. if (nodeName === 'BODY' || nodeName === 'HTML') {
  30466. return false;
  30467. }
  30468. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  30469. return true;
  30470. }
  30471. var parentNode = getParentNode(element);
  30472. if (!parentNode) {
  30473. return false;
  30474. }
  30475. return isFixed(parentNode);
  30476. }
  30477. /**
  30478. * Finds the first parent of an element that has a transformed property defined
  30479. * @method
  30480. * @memberof Popper.Utils
  30481. * @argument {Element} element
  30482. * @returns {Element} first transformed parent or documentElement
  30483. */
  30484. function getFixedPositionOffsetParent(element) {
  30485. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  30486. if (!element || !element.parentElement || isIE()) {
  30487. return document.documentElement;
  30488. }
  30489. var el = element.parentElement;
  30490. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  30491. el = el.parentElement;
  30492. }
  30493. return el || document.documentElement;
  30494. }
  30495. /**
  30496. * Computed the boundaries limits and return them
  30497. * @method
  30498. * @memberof Popper.Utils
  30499. * @param {HTMLElement} popper
  30500. * @param {HTMLElement} reference
  30501. * @param {number} padding
  30502. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  30503. * @param {Boolean} fixedPosition - Is in fixed position mode
  30504. * @returns {Object} Coordinates of the boundaries
  30505. */
  30506. function getBoundaries(popper, reference, padding, boundariesElement) {
  30507. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  30508. // NOTE: 1 DOM access here
  30509. var boundaries = { top: 0, left: 0 };
  30510. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  30511. // Handle viewport case
  30512. if (boundariesElement === 'viewport') {
  30513. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  30514. } else {
  30515. // Handle other cases based on DOM element used as boundaries
  30516. var boundariesNode = void 0;
  30517. if (boundariesElement === 'scrollParent') {
  30518. boundariesNode = getScrollParent(getParentNode(reference));
  30519. if (boundariesNode.nodeName === 'BODY') {
  30520. boundariesNode = popper.ownerDocument.documentElement;
  30521. }
  30522. } else if (boundariesElement === 'window') {
  30523. boundariesNode = popper.ownerDocument.documentElement;
  30524. } else {
  30525. boundariesNode = boundariesElement;
  30526. }
  30527. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  30528. // In case of HTML, we need a different computation
  30529. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  30530. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  30531. height = _getWindowSizes.height,
  30532. width = _getWindowSizes.width;
  30533. boundaries.top += offsets.top - offsets.marginTop;
  30534. boundaries.bottom = height + offsets.top;
  30535. boundaries.left += offsets.left - offsets.marginLeft;
  30536. boundaries.right = width + offsets.left;
  30537. } else {
  30538. // for all the other DOM elements, this one is good
  30539. boundaries = offsets;
  30540. }
  30541. }
  30542. // Add paddings
  30543. padding = padding || 0;
  30544. var isPaddingNumber = typeof padding === 'number';
  30545. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  30546. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  30547. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  30548. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  30549. return boundaries;
  30550. }
  30551. function getArea(_ref) {
  30552. var width = _ref.width,
  30553. height = _ref.height;
  30554. return width * height;
  30555. }
  30556. /**
  30557. * Utility used to transform the `auto` placement to the placement with more
  30558. * available space.
  30559. * @method
  30560. * @memberof Popper.Utils
  30561. * @argument {Object} data - The data object generated by update method
  30562. * @argument {Object} options - Modifiers configuration and options
  30563. * @returns {Object} The data object, properly modified
  30564. */
  30565. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  30566. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  30567. if (placement.indexOf('auto') === -1) {
  30568. return placement;
  30569. }
  30570. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  30571. var rects = {
  30572. top: {
  30573. width: boundaries.width,
  30574. height: refRect.top - boundaries.top
  30575. },
  30576. right: {
  30577. width: boundaries.right - refRect.right,
  30578. height: boundaries.height
  30579. },
  30580. bottom: {
  30581. width: boundaries.width,
  30582. height: boundaries.bottom - refRect.bottom
  30583. },
  30584. left: {
  30585. width: refRect.left - boundaries.left,
  30586. height: boundaries.height
  30587. }
  30588. };
  30589. var sortedAreas = Object.keys(rects).map(function (key) {
  30590. return _extends({
  30591. key: key
  30592. }, rects[key], {
  30593. area: getArea(rects[key])
  30594. });
  30595. }).sort(function (a, b) {
  30596. return b.area - a.area;
  30597. });
  30598. var filteredAreas = sortedAreas.filter(function (_ref2) {
  30599. var width = _ref2.width,
  30600. height = _ref2.height;
  30601. return width >= popper.clientWidth && height >= popper.clientHeight;
  30602. });
  30603. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  30604. var variation = placement.split('-')[1];
  30605. return computedPlacement + (variation ? '-' + variation : '');
  30606. }
  30607. /**
  30608. * Get offsets to the reference element
  30609. * @method
  30610. * @memberof Popper.Utils
  30611. * @param {Object} state
  30612. * @param {Element} popper - the popper element
  30613. * @param {Element} reference - the reference element (the popper will be relative to this)
  30614. * @param {Element} fixedPosition - is in fixed position mode
  30615. * @returns {Object} An object containing the offsets which will be applied to the popper
  30616. */
  30617. function getReferenceOffsets(state, popper, reference) {
  30618. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  30619. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  30620. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  30621. }
  30622. /**
  30623. * Get the outer sizes of the given element (offset size + margins)
  30624. * @method
  30625. * @memberof Popper.Utils
  30626. * @argument {Element} element
  30627. * @returns {Object} object containing width and height properties
  30628. */
  30629. function getOuterSizes(element) {
  30630. var window = element.ownerDocument.defaultView;
  30631. var styles = window.getComputedStyle(element);
  30632. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  30633. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  30634. var result = {
  30635. width: element.offsetWidth + y,
  30636. height: element.offsetHeight + x
  30637. };
  30638. return result;
  30639. }
  30640. /**
  30641. * Get the opposite placement of the given one
  30642. * @method
  30643. * @memberof Popper.Utils
  30644. * @argument {String} placement
  30645. * @returns {String} flipped placement
  30646. */
  30647. function getOppositePlacement(placement) {
  30648. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  30649. return placement.replace(/left|right|bottom|top/g, function (matched) {
  30650. return hash[matched];
  30651. });
  30652. }
  30653. /**
  30654. * Get offsets to the popper
  30655. * @method
  30656. * @memberof Popper.Utils
  30657. * @param {Object} position - CSS position the Popper will get applied
  30658. * @param {HTMLElement} popper - the popper element
  30659. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  30660. * @param {String} placement - one of the valid placement options
  30661. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  30662. */
  30663. function getPopperOffsets(popper, referenceOffsets, placement) {
  30664. placement = placement.split('-')[0];
  30665. // Get popper node sizes
  30666. var popperRect = getOuterSizes(popper);
  30667. // Add position, width and height to our offsets object
  30668. var popperOffsets = {
  30669. width: popperRect.width,
  30670. height: popperRect.height
  30671. };
  30672. // depending by the popper placement we have to compute its offsets slightly differently
  30673. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  30674. var mainSide = isHoriz ? 'top' : 'left';
  30675. var secondarySide = isHoriz ? 'left' : 'top';
  30676. var measurement = isHoriz ? 'height' : 'width';
  30677. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  30678. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  30679. if (placement === secondarySide) {
  30680. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  30681. } else {
  30682. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  30683. }
  30684. return popperOffsets;
  30685. }
  30686. /**
  30687. * Mimics the `find` method of Array
  30688. * @method
  30689. * @memberof Popper.Utils
  30690. * @argument {Array} arr
  30691. * @argument prop
  30692. * @argument value
  30693. * @returns index or -1
  30694. */
  30695. function find(arr, check) {
  30696. // use native find if supported
  30697. if (Array.prototype.find) {
  30698. return arr.find(check);
  30699. }
  30700. // use `filter` to obtain the same behavior of `find`
  30701. return arr.filter(check)[0];
  30702. }
  30703. /**
  30704. * Return the index of the matching object
  30705. * @method
  30706. * @memberof Popper.Utils
  30707. * @argument {Array} arr
  30708. * @argument prop
  30709. * @argument value
  30710. * @returns index or -1
  30711. */
  30712. function findIndex(arr, prop, value) {
  30713. // use native findIndex if supported
  30714. if (Array.prototype.findIndex) {
  30715. return arr.findIndex(function (cur) {
  30716. return cur[prop] === value;
  30717. });
  30718. }
  30719. // use `find` + `indexOf` if `findIndex` isn't supported
  30720. var match = find(arr, function (obj) {
  30721. return obj[prop] === value;
  30722. });
  30723. return arr.indexOf(match);
  30724. }
  30725. /**
  30726. * Loop trough the list of modifiers and run them in order,
  30727. * each of them will then edit the data object.
  30728. * @method
  30729. * @memberof Popper.Utils
  30730. * @param {dataObject} data
  30731. * @param {Array} modifiers
  30732. * @param {String} ends - Optional modifier name used as stopper
  30733. * @returns {dataObject}
  30734. */
  30735. function runModifiers(modifiers, data, ends) {
  30736. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  30737. modifiersToRun.forEach(function (modifier) {
  30738. if (modifier['function']) {
  30739. // eslint-disable-line dot-notation
  30740. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  30741. }
  30742. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  30743. if (modifier.enabled && isFunction(fn)) {
  30744. // Add properties to offsets to make them a complete clientRect object
  30745. // we do this before each modifier to make sure the previous one doesn't
  30746. // mess with these values
  30747. data.offsets.popper = getClientRect(data.offsets.popper);
  30748. data.offsets.reference = getClientRect(data.offsets.reference);
  30749. data = fn(data, modifier);
  30750. }
  30751. });
  30752. return data;
  30753. }
  30754. /**
  30755. * Updates the position of the popper, computing the new offsets and applying
  30756. * the new style.<br />
  30757. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  30758. * @method
  30759. * @memberof Popper
  30760. */
  30761. function update() {
  30762. // if popper is destroyed, don't perform any further update
  30763. if (this.state.isDestroyed) {
  30764. return;
  30765. }
  30766. var data = {
  30767. instance: this,
  30768. styles: {},
  30769. arrowStyles: {},
  30770. attributes: {},
  30771. flipped: false,
  30772. offsets: {}
  30773. };
  30774. // compute reference element offsets
  30775. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  30776. // compute auto placement, store placement inside the data object,
  30777. // modifiers will be able to edit `placement` if needed
  30778. // and refer to originalPlacement to know the original value
  30779. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  30780. // store the computed placement inside `originalPlacement`
  30781. data.originalPlacement = data.placement;
  30782. data.positionFixed = this.options.positionFixed;
  30783. // compute the popper offsets
  30784. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  30785. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  30786. // run the modifiers
  30787. data = runModifiers(this.modifiers, data);
  30788. // the first `update` will call `onCreate` callback
  30789. // the other ones will call `onUpdate` callback
  30790. if (!this.state.isCreated) {
  30791. this.state.isCreated = true;
  30792. this.options.onCreate(data);
  30793. } else {
  30794. this.options.onUpdate(data);
  30795. }
  30796. }
  30797. /**
  30798. * Helper used to know if the given modifier is enabled.
  30799. * @method
  30800. * @memberof Popper.Utils
  30801. * @returns {Boolean}
  30802. */
  30803. function isModifierEnabled(modifiers, modifierName) {
  30804. return modifiers.some(function (_ref) {
  30805. var name = _ref.name,
  30806. enabled = _ref.enabled;
  30807. return enabled && name === modifierName;
  30808. });
  30809. }
  30810. /**
  30811. * Get the prefixed supported property name
  30812. * @method
  30813. * @memberof Popper.Utils
  30814. * @argument {String} property (camelCase)
  30815. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  30816. */
  30817. function getSupportedPropertyName(property) {
  30818. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  30819. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  30820. for (var i = 0; i < prefixes.length; i++) {
  30821. var prefix = prefixes[i];
  30822. var toCheck = prefix ? '' + prefix + upperProp : property;
  30823. if (typeof document.body.style[toCheck] !== 'undefined') {
  30824. return toCheck;
  30825. }
  30826. }
  30827. return null;
  30828. }
  30829. /**
  30830. * Destroys the popper.
  30831. * @method
  30832. * @memberof Popper
  30833. */
  30834. function destroy() {
  30835. this.state.isDestroyed = true;
  30836. // touch DOM only if `applyStyle` modifier is enabled
  30837. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  30838. this.popper.removeAttribute('x-placement');
  30839. this.popper.style.position = '';
  30840. this.popper.style.top = '';
  30841. this.popper.style.left = '';
  30842. this.popper.style.right = '';
  30843. this.popper.style.bottom = '';
  30844. this.popper.style.willChange = '';
  30845. this.popper.style[getSupportedPropertyName('transform')] = '';
  30846. }
  30847. this.disableEventListeners();
  30848. // remove the popper if user explicitly asked for the deletion on destroy
  30849. // do not use `remove` because IE11 doesn't support it
  30850. if (this.options.removeOnDestroy) {
  30851. this.popper.parentNode.removeChild(this.popper);
  30852. }
  30853. return this;
  30854. }
  30855. /**
  30856. * Get the window associated with the element
  30857. * @argument {Element} element
  30858. * @returns {Window}
  30859. */
  30860. function getWindow(element) {
  30861. var ownerDocument = element.ownerDocument;
  30862. return ownerDocument ? ownerDocument.defaultView : window;
  30863. }
  30864. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  30865. var isBody = scrollParent.nodeName === 'BODY';
  30866. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  30867. target.addEventListener(event, callback, { passive: true });
  30868. if (!isBody) {
  30869. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  30870. }
  30871. scrollParents.push(target);
  30872. }
  30873. /**
  30874. * Setup needed event listeners used to update the popper position
  30875. * @method
  30876. * @memberof Popper.Utils
  30877. * @private
  30878. */
  30879. function setupEventListeners(reference, options, state, updateBound) {
  30880. // Resize event listener on window
  30881. state.updateBound = updateBound;
  30882. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  30883. // Scroll event listener on scroll parents
  30884. var scrollElement = getScrollParent(reference);
  30885. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  30886. state.scrollElement = scrollElement;
  30887. state.eventsEnabled = true;
  30888. return state;
  30889. }
  30890. /**
  30891. * It will add resize/scroll events and start recalculating
  30892. * position of the popper element when they are triggered.
  30893. * @method
  30894. * @memberof Popper
  30895. */
  30896. function enableEventListeners() {
  30897. if (!this.state.eventsEnabled) {
  30898. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  30899. }
  30900. }
  30901. /**
  30902. * Remove event listeners used to update the popper position
  30903. * @method
  30904. * @memberof Popper.Utils
  30905. * @private
  30906. */
  30907. function removeEventListeners(reference, state) {
  30908. // Remove resize event listener on window
  30909. getWindow(reference).removeEventListener('resize', state.updateBound);
  30910. // Remove scroll event listener on scroll parents
  30911. state.scrollParents.forEach(function (target) {
  30912. target.removeEventListener('scroll', state.updateBound);
  30913. });
  30914. // Reset state
  30915. state.updateBound = null;
  30916. state.scrollParents = [];
  30917. state.scrollElement = null;
  30918. state.eventsEnabled = false;
  30919. return state;
  30920. }
  30921. /**
  30922. * It will remove resize/scroll events and won't recalculate popper position
  30923. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  30924. * unless you call `update` method manually.
  30925. * @method
  30926. * @memberof Popper
  30927. */
  30928. function disableEventListeners() {
  30929. if (this.state.eventsEnabled) {
  30930. cancelAnimationFrame(this.scheduleUpdate);
  30931. this.state = removeEventListeners(this.reference, this.state);
  30932. }
  30933. }
  30934. /**
  30935. * Tells if a given input is a number
  30936. * @method
  30937. * @memberof Popper.Utils
  30938. * @param {*} input to check
  30939. * @return {Boolean}
  30940. */
  30941. function isNumeric(n) {
  30942. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  30943. }
  30944. /**
  30945. * Set the style to the given popper
  30946. * @method
  30947. * @memberof Popper.Utils
  30948. * @argument {Element} element - Element to apply the style to
  30949. * @argument {Object} styles
  30950. * Object with a list of properties and values which will be applied to the element
  30951. */
  30952. function setStyles(element, styles) {
  30953. Object.keys(styles).forEach(function (prop) {
  30954. var unit = '';
  30955. // add unit if the value is numeric and is one of the following
  30956. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  30957. unit = 'px';
  30958. }
  30959. element.style[prop] = styles[prop] + unit;
  30960. });
  30961. }
  30962. /**
  30963. * Set the attributes to the given popper
  30964. * @method
  30965. * @memberof Popper.Utils
  30966. * @argument {Element} element - Element to apply the attributes to
  30967. * @argument {Object} styles
  30968. * Object with a list of properties and values which will be applied to the element
  30969. */
  30970. function setAttributes(element, attributes) {
  30971. Object.keys(attributes).forEach(function (prop) {
  30972. var value = attributes[prop];
  30973. if (value !== false) {
  30974. element.setAttribute(prop, attributes[prop]);
  30975. } else {
  30976. element.removeAttribute(prop);
  30977. }
  30978. });
  30979. }
  30980. /**
  30981. * @function
  30982. * @memberof Modifiers
  30983. * @argument {Object} data - The data object generated by `update` method
  30984. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  30985. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  30986. * @argument {Object} options - Modifiers configuration and options
  30987. * @returns {Object} The same data object
  30988. */
  30989. function applyStyle(data) {
  30990. // any property present in `data.styles` will be applied to the popper,
  30991. // in this way we can make the 3rd party modifiers add custom styles to it
  30992. // Be aware, modifiers could override the properties defined in the previous
  30993. // lines of this modifier!
  30994. setStyles(data.instance.popper, data.styles);
  30995. // any property present in `data.attributes` will be applied to the popper,
  30996. // they will be set as HTML attributes of the element
  30997. setAttributes(data.instance.popper, data.attributes);
  30998. // if arrowElement is defined and arrowStyles has some properties
  30999. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  31000. setStyles(data.arrowElement, data.arrowStyles);
  31001. }
  31002. return data;
  31003. }
  31004. /**
  31005. * Set the x-placement attribute before everything else because it could be used
  31006. * to add margins to the popper margins needs to be calculated to get the
  31007. * correct popper offsets.
  31008. * @method
  31009. * @memberof Popper.modifiers
  31010. * @param {HTMLElement} reference - The reference element used to position the popper
  31011. * @param {HTMLElement} popper - The HTML element used as popper
  31012. * @param {Object} options - Popper.js options
  31013. */
  31014. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  31015. // compute reference element offsets
  31016. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  31017. // compute auto placement, store placement inside the data object,
  31018. // modifiers will be able to edit `placement` if needed
  31019. // and refer to originalPlacement to know the original value
  31020. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  31021. popper.setAttribute('x-placement', placement);
  31022. // Apply `position` to popper before anything else because
  31023. // without the position applied we can't guarantee correct computations
  31024. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  31025. return options;
  31026. }
  31027. /**
  31028. * @function
  31029. * @memberof Popper.Utils
  31030. * @argument {Object} data - The data object generated by `update` method
  31031. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  31032. * @returns {Object} The popper's position offsets rounded
  31033. *
  31034. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  31035. * good as it can be within reason.
  31036. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  31037. *
  31038. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  31039. * as well on High DPI screens).
  31040. *
  31041. * Firefox prefers no rounding for positioning and does not have blurriness on
  31042. * high DPI screens.
  31043. *
  31044. * Only horizontal placement and left/right values need to be considered.
  31045. */
  31046. function getRoundedOffsets(data, shouldRound) {
  31047. var _data$offsets = data.offsets,
  31048. popper = _data$offsets.popper,
  31049. reference = _data$offsets.reference;
  31050. var round = Math.round,
  31051. floor = Math.floor;
  31052. var noRound = function noRound(v) {
  31053. return v;
  31054. };
  31055. var referenceWidth = round(reference.width);
  31056. var popperWidth = round(popper.width);
  31057. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  31058. var isVariation = data.placement.indexOf('-') !== -1;
  31059. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  31060. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  31061. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  31062. var verticalToInteger = !shouldRound ? noRound : round;
  31063. return {
  31064. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  31065. top: verticalToInteger(popper.top),
  31066. bottom: verticalToInteger(popper.bottom),
  31067. right: horizontalToInteger(popper.right)
  31068. };
  31069. }
  31070. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  31071. /**
  31072. * @function
  31073. * @memberof Modifiers
  31074. * @argument {Object} data - The data object generated by `update` method
  31075. * @argument {Object} options - Modifiers configuration and options
  31076. * @returns {Object} The data object, properly modified
  31077. */
  31078. function computeStyle(data, options) {
  31079. var x = options.x,
  31080. y = options.y;
  31081. var popper = data.offsets.popper;
  31082. // Remove this legacy support in Popper.js v2
  31083. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  31084. return modifier.name === 'applyStyle';
  31085. }).gpuAcceleration;
  31086. if (legacyGpuAccelerationOption !== undefined) {
  31087. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  31088. }
  31089. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  31090. var offsetParent = getOffsetParent(data.instance.popper);
  31091. var offsetParentRect = getBoundingClientRect(offsetParent);
  31092. // Styles
  31093. var styles = {
  31094. position: popper.position
  31095. };
  31096. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  31097. var sideA = x === 'bottom' ? 'top' : 'bottom';
  31098. var sideB = y === 'right' ? 'left' : 'right';
  31099. // if gpuAcceleration is set to `true` and transform is supported,
  31100. // we use `translate3d` to apply the position to the popper we
  31101. // automatically use the supported prefixed version if needed
  31102. var prefixedProperty = getSupportedPropertyName('transform');
  31103. // now, let's make a step back and look at this code closely (wtf?)
  31104. // If the content of the popper grows once it's been positioned, it
  31105. // may happen that the popper gets misplaced because of the new content
  31106. // overflowing its reference element
  31107. // To avoid this problem, we provide two options (x and y), which allow
  31108. // the consumer to define the offset origin.
  31109. // If we position a popper on top of a reference element, we can set
  31110. // `x` to `top` to make the popper grow towards its top instead of
  31111. // its bottom.
  31112. var left = void 0,
  31113. top = void 0;
  31114. if (sideA === 'bottom') {
  31115. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  31116. // and not the bottom of the html element
  31117. if (offsetParent.nodeName === 'HTML') {
  31118. top = -offsetParent.clientHeight + offsets.bottom;
  31119. } else {
  31120. top = -offsetParentRect.height + offsets.bottom;
  31121. }
  31122. } else {
  31123. top = offsets.top;
  31124. }
  31125. if (sideB === 'right') {
  31126. if (offsetParent.nodeName === 'HTML') {
  31127. left = -offsetParent.clientWidth + offsets.right;
  31128. } else {
  31129. left = -offsetParentRect.width + offsets.right;
  31130. }
  31131. } else {
  31132. left = offsets.left;
  31133. }
  31134. if (gpuAcceleration && prefixedProperty) {
  31135. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  31136. styles[sideA] = 0;
  31137. styles[sideB] = 0;
  31138. styles.willChange = 'transform';
  31139. } else {
  31140. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  31141. var invertTop = sideA === 'bottom' ? -1 : 1;
  31142. var invertLeft = sideB === 'right' ? -1 : 1;
  31143. styles[sideA] = top * invertTop;
  31144. styles[sideB] = left * invertLeft;
  31145. styles.willChange = sideA + ', ' + sideB;
  31146. }
  31147. // Attributes
  31148. var attributes = {
  31149. 'x-placement': data.placement
  31150. };
  31151. // Update `data` attributes, styles and arrowStyles
  31152. data.attributes = _extends({}, attributes, data.attributes);
  31153. data.styles = _extends({}, styles, data.styles);
  31154. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  31155. return data;
  31156. }
  31157. /**
  31158. * Helper used to know if the given modifier depends from another one.<br />
  31159. * It checks if the needed modifier is listed and enabled.
  31160. * @method
  31161. * @memberof Popper.Utils
  31162. * @param {Array} modifiers - list of modifiers
  31163. * @param {String} requestingName - name of requesting modifier
  31164. * @param {String} requestedName - name of requested modifier
  31165. * @returns {Boolean}
  31166. */
  31167. function isModifierRequired(modifiers, requestingName, requestedName) {
  31168. var requesting = find(modifiers, function (_ref) {
  31169. var name = _ref.name;
  31170. return name === requestingName;
  31171. });
  31172. var isRequired = !!requesting && modifiers.some(function (modifier) {
  31173. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  31174. });
  31175. if (!isRequired) {
  31176. var _requesting = '`' + requestingName + '`';
  31177. var requested = '`' + requestedName + '`';
  31178. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  31179. }
  31180. return isRequired;
  31181. }
  31182. /**
  31183. * @function
  31184. * @memberof Modifiers
  31185. * @argument {Object} data - The data object generated by update method
  31186. * @argument {Object} options - Modifiers configuration and options
  31187. * @returns {Object} The data object, properly modified
  31188. */
  31189. function arrow(data, options) {
  31190. var _data$offsets$arrow;
  31191. // arrow depends on keepTogether in order to work
  31192. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  31193. return data;
  31194. }
  31195. var arrowElement = options.element;
  31196. // if arrowElement is a string, suppose it's a CSS selector
  31197. if (typeof arrowElement === 'string') {
  31198. arrowElement = data.instance.popper.querySelector(arrowElement);
  31199. // if arrowElement is not found, don't run the modifier
  31200. if (!arrowElement) {
  31201. return data;
  31202. }
  31203. } else {
  31204. // if the arrowElement isn't a query selector we must check that the
  31205. // provided DOM node is child of its popper node
  31206. if (!data.instance.popper.contains(arrowElement)) {
  31207. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  31208. return data;
  31209. }
  31210. }
  31211. var placement = data.placement.split('-')[0];
  31212. var _data$offsets = data.offsets,
  31213. popper = _data$offsets.popper,
  31214. reference = _data$offsets.reference;
  31215. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  31216. var len = isVertical ? 'height' : 'width';
  31217. var sideCapitalized = isVertical ? 'Top' : 'Left';
  31218. var side = sideCapitalized.toLowerCase();
  31219. var altSide = isVertical ? 'left' : 'top';
  31220. var opSide = isVertical ? 'bottom' : 'right';
  31221. var arrowElementSize = getOuterSizes(arrowElement)[len];
  31222. //
  31223. // extends keepTogether behavior making sure the popper and its
  31224. // reference have enough pixels in conjunction
  31225. //
  31226. // top/left side
  31227. if (reference[opSide] - arrowElementSize < popper[side]) {
  31228. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  31229. }
  31230. // bottom/right side
  31231. if (reference[side] + arrowElementSize > popper[opSide]) {
  31232. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  31233. }
  31234. data.offsets.popper = getClientRect(data.offsets.popper);
  31235. // compute center of the popper
  31236. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  31237. // Compute the sideValue using the updated popper offsets
  31238. // take popper margin in account because we don't have this info available
  31239. var css = getStyleComputedProperty(data.instance.popper);
  31240. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  31241. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  31242. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  31243. // prevent arrowElement from being placed not contiguously to its popper
  31244. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  31245. data.arrowElement = arrowElement;
  31246. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  31247. return data;
  31248. }
  31249. /**
  31250. * Get the opposite placement variation of the given one
  31251. * @method
  31252. * @memberof Popper.Utils
  31253. * @argument {String} placement variation
  31254. * @returns {String} flipped placement variation
  31255. */
  31256. function getOppositeVariation(variation) {
  31257. if (variation === 'end') {
  31258. return 'start';
  31259. } else if (variation === 'start') {
  31260. return 'end';
  31261. }
  31262. return variation;
  31263. }
  31264. /**
  31265. * List of accepted placements to use as values of the `placement` option.<br />
  31266. * Valid placements are:
  31267. * - `auto`
  31268. * - `top`
  31269. * - `right`
  31270. * - `bottom`
  31271. * - `left`
  31272. *
  31273. * Each placement can have a variation from this list:
  31274. * - `-start`
  31275. * - `-end`
  31276. *
  31277. * Variations are interpreted easily if you think of them as the left to right
  31278. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  31279. * is right.<br />
  31280. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  31281. *
  31282. * Some valid examples are:
  31283. * - `top-end` (on top of reference, right aligned)
  31284. * - `right-start` (on right of reference, top aligned)
  31285. * - `bottom` (on bottom, centered)
  31286. * - `auto-end` (on the side with more space available, alignment depends by placement)
  31287. *
  31288. * @static
  31289. * @type {Array}
  31290. * @enum {String}
  31291. * @readonly
  31292. * @method placements
  31293. * @memberof Popper
  31294. */
  31295. var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
  31296. // Get rid of `auto` `auto-start` and `auto-end`
  31297. var validPlacements = placements.slice(3);
  31298. /**
  31299. * Given an initial placement, returns all the subsequent placements
  31300. * clockwise (or counter-clockwise).
  31301. *
  31302. * @method
  31303. * @memberof Popper.Utils
  31304. * @argument {String} placement - A valid placement (it accepts variations)
  31305. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  31306. * @returns {Array} placements including their variations
  31307. */
  31308. function clockwise(placement) {
  31309. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  31310. var index = validPlacements.indexOf(placement);
  31311. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  31312. return counter ? arr.reverse() : arr;
  31313. }
  31314. var BEHAVIORS = {
  31315. FLIP: 'flip',
  31316. CLOCKWISE: 'clockwise',
  31317. COUNTERCLOCKWISE: 'counterclockwise'
  31318. };
  31319. /**
  31320. * @function
  31321. * @memberof Modifiers
  31322. * @argument {Object} data - The data object generated by update method
  31323. * @argument {Object} options - Modifiers configuration and options
  31324. * @returns {Object} The data object, properly modified
  31325. */
  31326. function flip(data, options) {
  31327. // if `inner` modifier is enabled, we can't use the `flip` modifier
  31328. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  31329. return data;
  31330. }
  31331. if (data.flipped && data.placement === data.originalPlacement) {
  31332. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  31333. return data;
  31334. }
  31335. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  31336. var placement = data.placement.split('-')[0];
  31337. var placementOpposite = getOppositePlacement(placement);
  31338. var variation = data.placement.split('-')[1] || '';
  31339. var flipOrder = [];
  31340. switch (options.behavior) {
  31341. case BEHAVIORS.FLIP:
  31342. flipOrder = [placement, placementOpposite];
  31343. break;
  31344. case BEHAVIORS.CLOCKWISE:
  31345. flipOrder = clockwise(placement);
  31346. break;
  31347. case BEHAVIORS.COUNTERCLOCKWISE:
  31348. flipOrder = clockwise(placement, true);
  31349. break;
  31350. default:
  31351. flipOrder = options.behavior;
  31352. }
  31353. flipOrder.forEach(function (step, index) {
  31354. if (placement !== step || flipOrder.length === index + 1) {
  31355. return data;
  31356. }
  31357. placement = data.placement.split('-')[0];
  31358. placementOpposite = getOppositePlacement(placement);
  31359. var popperOffsets = data.offsets.popper;
  31360. var refOffsets = data.offsets.reference;
  31361. // using floor because the reference offsets may contain decimals we are not going to consider here
  31362. var floor = Math.floor;
  31363. var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
  31364. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  31365. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  31366. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  31367. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  31368. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  31369. // flip the variation if required
  31370. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  31371. // flips variation if reference element overflows boundaries
  31372. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  31373. // flips variation if popper content overflows boundaries
  31374. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  31375. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  31376. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  31377. // this boolean to detect any flip loop
  31378. data.flipped = true;
  31379. if (overlapsRef || overflowsBoundaries) {
  31380. placement = flipOrder[index + 1];
  31381. }
  31382. if (flippedVariation) {
  31383. variation = getOppositeVariation(variation);
  31384. }
  31385. data.placement = placement + (variation ? '-' + variation : '');
  31386. // this object contains `position`, we want to preserve it along with
  31387. // any additional property we may add in the future
  31388. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  31389. data = runModifiers(data.instance.modifiers, data, 'flip');
  31390. }
  31391. });
  31392. return data;
  31393. }
  31394. /**
  31395. * @function
  31396. * @memberof Modifiers
  31397. * @argument {Object} data - The data object generated by update method
  31398. * @argument {Object} options - Modifiers configuration and options
  31399. * @returns {Object} The data object, properly modified
  31400. */
  31401. function keepTogether(data) {
  31402. var _data$offsets = data.offsets,
  31403. popper = _data$offsets.popper,
  31404. reference = _data$offsets.reference;
  31405. var placement = data.placement.split('-')[0];
  31406. var floor = Math.floor;
  31407. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  31408. var side = isVertical ? 'right' : 'bottom';
  31409. var opSide = isVertical ? 'left' : 'top';
  31410. var measurement = isVertical ? 'width' : 'height';
  31411. if (popper[side] < floor(reference[opSide])) {
  31412. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  31413. }
  31414. if (popper[opSide] > floor(reference[side])) {
  31415. data.offsets.popper[opSide] = floor(reference[side]);
  31416. }
  31417. return data;
  31418. }
  31419. /**
  31420. * Converts a string containing value + unit into a px value number
  31421. * @function
  31422. * @memberof {modifiers~offset}
  31423. * @private
  31424. * @argument {String} str - Value + unit string
  31425. * @argument {String} measurement - `height` or `width`
  31426. * @argument {Object} popperOffsets
  31427. * @argument {Object} referenceOffsets
  31428. * @returns {Number|String}
  31429. * Value in pixels, or original string if no values were extracted
  31430. */
  31431. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  31432. // separate value from unit
  31433. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  31434. var value = +split[1];
  31435. var unit = split[2];
  31436. // If it's not a number it's an operator, I guess
  31437. if (!value) {
  31438. return str;
  31439. }
  31440. if (unit.indexOf('%') === 0) {
  31441. var element = void 0;
  31442. switch (unit) {
  31443. case '%p':
  31444. element = popperOffsets;
  31445. break;
  31446. case '%':
  31447. case '%r':
  31448. default:
  31449. element = referenceOffsets;
  31450. }
  31451. var rect = getClientRect(element);
  31452. return rect[measurement] / 100 * value;
  31453. } else if (unit === 'vh' || unit === 'vw') {
  31454. // if is a vh or vw, we calculate the size based on the viewport
  31455. var size = void 0;
  31456. if (unit === 'vh') {
  31457. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  31458. } else {
  31459. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  31460. }
  31461. return size / 100 * value;
  31462. } else {
  31463. // if is an explicit pixel unit, we get rid of the unit and keep the value
  31464. // if is an implicit unit, it's px, and we return just the value
  31465. return value;
  31466. }
  31467. }
  31468. /**
  31469. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  31470. * @function
  31471. * @memberof {modifiers~offset}
  31472. * @private
  31473. * @argument {String} offset
  31474. * @argument {Object} popperOffsets
  31475. * @argument {Object} referenceOffsets
  31476. * @argument {String} basePlacement
  31477. * @returns {Array} a two cells array with x and y offsets in numbers
  31478. */
  31479. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  31480. var offsets = [0, 0];
  31481. // Use height if placement is left or right and index is 0 otherwise use width
  31482. // in this way the first offset will use an axis and the second one
  31483. // will use the other one
  31484. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  31485. // Split the offset string to obtain a list of values and operands
  31486. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  31487. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  31488. return frag.trim();
  31489. });
  31490. // Detect if the offset string contains a pair of values or a single one
  31491. // they could be separated by comma or space
  31492. var divider = fragments.indexOf(find(fragments, function (frag) {
  31493. return frag.search(/,|\s/) !== -1;
  31494. }));
  31495. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  31496. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  31497. }
  31498. // If divider is found, we divide the list of values and operands to divide
  31499. // them by ofset X and Y.
  31500. var splitRegex = /\s*,\s*|\s+/;
  31501. var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
  31502. // Convert the values with units to absolute pixels to allow our computations
  31503. ops = ops.map(function (op, index) {
  31504. // Most of the units rely on the orientation of the popper
  31505. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  31506. var mergeWithPrevious = false;
  31507. return op
  31508. // This aggregates any `+` or `-` sign that aren't considered operators
  31509. // e.g.: 10 + +5 => [10, +, +5]
  31510. .reduce(function (a, b) {
  31511. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  31512. a[a.length - 1] = b;
  31513. mergeWithPrevious = true;
  31514. return a;
  31515. } else if (mergeWithPrevious) {
  31516. a[a.length - 1] += b;
  31517. mergeWithPrevious = false;
  31518. return a;
  31519. } else {
  31520. return a.concat(b);
  31521. }
  31522. }, [])
  31523. // Here we convert the string values into number values (in px)
  31524. .map(function (str) {
  31525. return toValue(str, measurement, popperOffsets, referenceOffsets);
  31526. });
  31527. });
  31528. // Loop trough the offsets arrays and execute the operations
  31529. ops.forEach(function (op, index) {
  31530. op.forEach(function (frag, index2) {
  31531. if (isNumeric(frag)) {
  31532. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  31533. }
  31534. });
  31535. });
  31536. return offsets;
  31537. }
  31538. /**
  31539. * @function
  31540. * @memberof Modifiers
  31541. * @argument {Object} data - The data object generated by update method
  31542. * @argument {Object} options - Modifiers configuration and options
  31543. * @argument {Number|String} options.offset=0
  31544. * The offset value as described in the modifier description
  31545. * @returns {Object} The data object, properly modified
  31546. */
  31547. function offset(data, _ref) {
  31548. var offset = _ref.offset;
  31549. var placement = data.placement,
  31550. _data$offsets = data.offsets,
  31551. popper = _data$offsets.popper,
  31552. reference = _data$offsets.reference;
  31553. var basePlacement = placement.split('-')[0];
  31554. var offsets = void 0;
  31555. if (isNumeric(+offset)) {
  31556. offsets = [+offset, 0];
  31557. } else {
  31558. offsets = parseOffset(offset, popper, reference, basePlacement);
  31559. }
  31560. if (basePlacement === 'left') {
  31561. popper.top += offsets[0];
  31562. popper.left -= offsets[1];
  31563. } else if (basePlacement === 'right') {
  31564. popper.top += offsets[0];
  31565. popper.left += offsets[1];
  31566. } else if (basePlacement === 'top') {
  31567. popper.left += offsets[0];
  31568. popper.top -= offsets[1];
  31569. } else if (basePlacement === 'bottom') {
  31570. popper.left += offsets[0];
  31571. popper.top += offsets[1];
  31572. }
  31573. data.popper = popper;
  31574. return data;
  31575. }
  31576. /**
  31577. * @function
  31578. * @memberof Modifiers
  31579. * @argument {Object} data - The data object generated by `update` method
  31580. * @argument {Object} options - Modifiers configuration and options
  31581. * @returns {Object} The data object, properly modified
  31582. */
  31583. function preventOverflow(data, options) {
  31584. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  31585. // If offsetParent is the reference element, we really want to
  31586. // go one step up and use the next offsetParent as reference to
  31587. // avoid to make this modifier completely useless and look like broken
  31588. if (data.instance.reference === boundariesElement) {
  31589. boundariesElement = getOffsetParent(boundariesElement);
  31590. }
  31591. // NOTE: DOM access here
  31592. // resets the popper's position so that the document size can be calculated excluding
  31593. // the size of the popper element itself
  31594. var transformProp = getSupportedPropertyName('transform');
  31595. var popperStyles = data.instance.popper.style; // assignment to help minification
  31596. var top = popperStyles.top,
  31597. left = popperStyles.left,
  31598. transform = popperStyles[transformProp];
  31599. popperStyles.top = '';
  31600. popperStyles.left = '';
  31601. popperStyles[transformProp] = '';
  31602. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  31603. // NOTE: DOM access here
  31604. // restores the original style properties after the offsets have been computed
  31605. popperStyles.top = top;
  31606. popperStyles.left = left;
  31607. popperStyles[transformProp] = transform;
  31608. options.boundaries = boundaries;
  31609. var order = options.priority;
  31610. var popper = data.offsets.popper;
  31611. var check = {
  31612. primary: function primary(placement) {
  31613. var value = popper[placement];
  31614. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  31615. value = Math.max(popper[placement], boundaries[placement]);
  31616. }
  31617. return defineProperty({}, placement, value);
  31618. },
  31619. secondary: function secondary(placement) {
  31620. var mainSide = placement === 'right' ? 'left' : 'top';
  31621. var value = popper[mainSide];
  31622. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  31623. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  31624. }
  31625. return defineProperty({}, mainSide, value);
  31626. }
  31627. };
  31628. order.forEach(function (placement) {
  31629. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  31630. popper = _extends({}, popper, check[side](placement));
  31631. });
  31632. data.offsets.popper = popper;
  31633. return data;
  31634. }
  31635. /**
  31636. * @function
  31637. * @memberof Modifiers
  31638. * @argument {Object} data - The data object generated by `update` method
  31639. * @argument {Object} options - Modifiers configuration and options
  31640. * @returns {Object} The data object, properly modified
  31641. */
  31642. function shift(data) {
  31643. var placement = data.placement;
  31644. var basePlacement = placement.split('-')[0];
  31645. var shiftvariation = placement.split('-')[1];
  31646. // if shift shiftvariation is specified, run the modifier
  31647. if (shiftvariation) {
  31648. var _data$offsets = data.offsets,
  31649. reference = _data$offsets.reference,
  31650. popper = _data$offsets.popper;
  31651. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  31652. var side = isVertical ? 'left' : 'top';
  31653. var measurement = isVertical ? 'width' : 'height';
  31654. var shiftOffsets = {
  31655. start: defineProperty({}, side, reference[side]),
  31656. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  31657. };
  31658. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  31659. }
  31660. return data;
  31661. }
  31662. /**
  31663. * @function
  31664. * @memberof Modifiers
  31665. * @argument {Object} data - The data object generated by update method
  31666. * @argument {Object} options - Modifiers configuration and options
  31667. * @returns {Object} The data object, properly modified
  31668. */
  31669. function hide(data) {
  31670. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  31671. return data;
  31672. }
  31673. var refRect = data.offsets.reference;
  31674. var bound = find(data.instance.modifiers, function (modifier) {
  31675. return modifier.name === 'preventOverflow';
  31676. }).boundaries;
  31677. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  31678. // Avoid unnecessary DOM access if visibility hasn't changed
  31679. if (data.hide === true) {
  31680. return data;
  31681. }
  31682. data.hide = true;
  31683. data.attributes['x-out-of-boundaries'] = '';
  31684. } else {
  31685. // Avoid unnecessary DOM access if visibility hasn't changed
  31686. if (data.hide === false) {
  31687. return data;
  31688. }
  31689. data.hide = false;
  31690. data.attributes['x-out-of-boundaries'] = false;
  31691. }
  31692. return data;
  31693. }
  31694. /**
  31695. * @function
  31696. * @memberof Modifiers
  31697. * @argument {Object} data - The data object generated by `update` method
  31698. * @argument {Object} options - Modifiers configuration and options
  31699. * @returns {Object} The data object, properly modified
  31700. */
  31701. function inner(data) {
  31702. var placement = data.placement;
  31703. var basePlacement = placement.split('-')[0];
  31704. var _data$offsets = data.offsets,
  31705. popper = _data$offsets.popper,
  31706. reference = _data$offsets.reference;
  31707. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  31708. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  31709. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  31710. data.placement = getOppositePlacement(placement);
  31711. data.offsets.popper = getClientRect(popper);
  31712. return data;
  31713. }
  31714. /**
  31715. * Modifier function, each modifier can have a function of this type assigned
  31716. * to its `fn` property.<br />
  31717. * These functions will be called on each update, this means that you must
  31718. * make sure they are performant enough to avoid performance bottlenecks.
  31719. *
  31720. * @function ModifierFn
  31721. * @argument {dataObject} data - The data object generated by `update` method
  31722. * @argument {Object} options - Modifiers configuration and options
  31723. * @returns {dataObject} The data object, properly modified
  31724. */
  31725. /**
  31726. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  31727. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  31728. * needed by the library.
  31729. *
  31730. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  31731. * All the other properties are configurations that could be tweaked.
  31732. * @namespace modifiers
  31733. */
  31734. var modifiers = {
  31735. /**
  31736. * Modifier used to shift the popper on the start or end of its reference
  31737. * element.<br />
  31738. * It will read the variation of the `placement` property.<br />
  31739. * It can be one either `-end` or `-start`.
  31740. * @memberof modifiers
  31741. * @inner
  31742. */
  31743. shift: {
  31744. /** @prop {number} order=100 - Index used to define the order of execution */
  31745. order: 100,
  31746. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31747. enabled: true,
  31748. /** @prop {ModifierFn} */
  31749. fn: shift
  31750. },
  31751. /**
  31752. * The `offset` modifier can shift your popper on both its axis.
  31753. *
  31754. * It accepts the following units:
  31755. * - `px` or unit-less, interpreted as pixels
  31756. * - `%` or `%r`, percentage relative to the length of the reference element
  31757. * - `%p`, percentage relative to the length of the popper element
  31758. * - `vw`, CSS viewport width unit
  31759. * - `vh`, CSS viewport height unit
  31760. *
  31761. * For length is intended the main axis relative to the placement of the popper.<br />
  31762. * This means that if the placement is `top` or `bottom`, the length will be the
  31763. * `width`. In case of `left` or `right`, it will be the `height`.
  31764. *
  31765. * You can provide a single value (as `Number` or `String`), or a pair of values
  31766. * as `String` divided by a comma or one (or more) white spaces.<br />
  31767. * The latter is a deprecated method because it leads to confusion and will be
  31768. * removed in v2.<br />
  31769. * Additionally, it accepts additions and subtractions between different units.
  31770. * Note that multiplications and divisions aren't supported.
  31771. *
  31772. * Valid examples are:
  31773. * ```
  31774. * 10
  31775. * '10%'
  31776. * '10, 10'
  31777. * '10%, 10'
  31778. * '10 + 10%'
  31779. * '10 - 5vh + 3%'
  31780. * '-10px + 5vh, 5px - 6%'
  31781. * ```
  31782. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  31783. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  31784. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  31785. *
  31786. * @memberof modifiers
  31787. * @inner
  31788. */
  31789. offset: {
  31790. /** @prop {number} order=200 - Index used to define the order of execution */
  31791. order: 200,
  31792. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31793. enabled: true,
  31794. /** @prop {ModifierFn} */
  31795. fn: offset,
  31796. /** @prop {Number|String} offset=0
  31797. * The offset value as described in the modifier description
  31798. */
  31799. offset: 0
  31800. },
  31801. /**
  31802. * Modifier used to prevent the popper from being positioned outside the boundary.
  31803. *
  31804. * A scenario exists where the reference itself is not within the boundaries.<br />
  31805. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  31806. * In this case we need to decide whether the popper should either:
  31807. *
  31808. * - detach from the reference and remain "trapped" in the boundaries, or
  31809. * - if it should ignore the boundary and "escape with its reference"
  31810. *
  31811. * When `escapeWithReference` is set to`true` and reference is completely
  31812. * outside its boundaries, the popper will overflow (or completely leave)
  31813. * the boundaries in order to remain attached to the edge of the reference.
  31814. *
  31815. * @memberof modifiers
  31816. * @inner
  31817. */
  31818. preventOverflow: {
  31819. /** @prop {number} order=300 - Index used to define the order of execution */
  31820. order: 300,
  31821. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31822. enabled: true,
  31823. /** @prop {ModifierFn} */
  31824. fn: preventOverflow,
  31825. /**
  31826. * @prop {Array} [priority=['left','right','top','bottom']]
  31827. * Popper will try to prevent overflow following these priorities by default,
  31828. * then, it could overflow on the left and on top of the `boundariesElement`
  31829. */
  31830. priority: ['left', 'right', 'top', 'bottom'],
  31831. /**
  31832. * @prop {number} padding=5
  31833. * Amount of pixel used to define a minimum distance between the boundaries
  31834. * and the popper. This makes sure the popper always has a little padding
  31835. * between the edges of its container
  31836. */
  31837. padding: 5,
  31838. /**
  31839. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  31840. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  31841. * `viewport` or any DOM element.
  31842. */
  31843. boundariesElement: 'scrollParent'
  31844. },
  31845. /**
  31846. * Modifier used to make sure the reference and its popper stay near each other
  31847. * without leaving any gap between the two. Especially useful when the arrow is
  31848. * enabled and you want to ensure that it points to its reference element.
  31849. * It cares only about the first axis. You can still have poppers with margin
  31850. * between the popper and its reference element.
  31851. * @memberof modifiers
  31852. * @inner
  31853. */
  31854. keepTogether: {
  31855. /** @prop {number} order=400 - Index used to define the order of execution */
  31856. order: 400,
  31857. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31858. enabled: true,
  31859. /** @prop {ModifierFn} */
  31860. fn: keepTogether
  31861. },
  31862. /**
  31863. * This modifier is used to move the `arrowElement` of the popper to make
  31864. * sure it is positioned between the reference element and its popper element.
  31865. * It will read the outer size of the `arrowElement` node to detect how many
  31866. * pixels of conjunction are needed.
  31867. *
  31868. * It has no effect if no `arrowElement` is provided.
  31869. * @memberof modifiers
  31870. * @inner
  31871. */
  31872. arrow: {
  31873. /** @prop {number} order=500 - Index used to define the order of execution */
  31874. order: 500,
  31875. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31876. enabled: true,
  31877. /** @prop {ModifierFn} */
  31878. fn: arrow,
  31879. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  31880. element: '[x-arrow]'
  31881. },
  31882. /**
  31883. * Modifier used to flip the popper's placement when it starts to overlap its
  31884. * reference element.
  31885. *
  31886. * Requires the `preventOverflow` modifier before it in order to work.
  31887. *
  31888. * **NOTE:** this modifier will interrupt the current update cycle and will
  31889. * restart it if it detects the need to flip the placement.
  31890. * @memberof modifiers
  31891. * @inner
  31892. */
  31893. flip: {
  31894. /** @prop {number} order=600 - Index used to define the order of execution */
  31895. order: 600,
  31896. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31897. enabled: true,
  31898. /** @prop {ModifierFn} */
  31899. fn: flip,
  31900. /**
  31901. * @prop {String|Array} behavior='flip'
  31902. * The behavior used to change the popper's placement. It can be one of
  31903. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  31904. * placements (with optional variations)
  31905. */
  31906. behavior: 'flip',
  31907. /**
  31908. * @prop {number} padding=5
  31909. * The popper will flip if it hits the edges of the `boundariesElement`
  31910. */
  31911. padding: 5,
  31912. /**
  31913. * @prop {String|HTMLElement} boundariesElement='viewport'
  31914. * The element which will define the boundaries of the popper position.
  31915. * The popper will never be placed outside of the defined boundaries
  31916. * (except if `keepTogether` is enabled)
  31917. */
  31918. boundariesElement: 'viewport',
  31919. /**
  31920. * @prop {Boolean} flipVariations=false
  31921. * The popper will switch placement variation between `-start` and `-end` when
  31922. * the reference element overlaps its boundaries.
  31923. *
  31924. * The original placement should have a set variation.
  31925. */
  31926. flipVariations: false,
  31927. /**
  31928. * @prop {Boolean} flipVariationsByContent=false
  31929. * The popper will switch placement variation between `-start` and `-end` when
  31930. * the popper element overlaps its reference boundaries.
  31931. *
  31932. * The original placement should have a set variation.
  31933. */
  31934. flipVariationsByContent: false
  31935. },
  31936. /**
  31937. * Modifier used to make the popper flow toward the inner of the reference element.
  31938. * By default, when this modifier is disabled, the popper will be placed outside
  31939. * the reference element.
  31940. * @memberof modifiers
  31941. * @inner
  31942. */
  31943. inner: {
  31944. /** @prop {number} order=700 - Index used to define the order of execution */
  31945. order: 700,
  31946. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  31947. enabled: false,
  31948. /** @prop {ModifierFn} */
  31949. fn: inner
  31950. },
  31951. /**
  31952. * Modifier used to hide the popper when its reference element is outside of the
  31953. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  31954. * be used to hide with a CSS selector the popper when its reference is
  31955. * out of boundaries.
  31956. *
  31957. * Requires the `preventOverflow` modifier before it in order to work.
  31958. * @memberof modifiers
  31959. * @inner
  31960. */
  31961. hide: {
  31962. /** @prop {number} order=800 - Index used to define the order of execution */
  31963. order: 800,
  31964. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31965. enabled: true,
  31966. /** @prop {ModifierFn} */
  31967. fn: hide
  31968. },
  31969. /**
  31970. * Computes the style that will be applied to the popper element to gets
  31971. * properly positioned.
  31972. *
  31973. * Note that this modifier will not touch the DOM, it just prepares the styles
  31974. * so that `applyStyle` modifier can apply it. This separation is useful
  31975. * in case you need to replace `applyStyle` with a custom implementation.
  31976. *
  31977. * This modifier has `850` as `order` value to maintain backward compatibility
  31978. * with previous versions of Popper.js. Expect the modifiers ordering method
  31979. * to change in future major versions of the library.
  31980. *
  31981. * @memberof modifiers
  31982. * @inner
  31983. */
  31984. computeStyle: {
  31985. /** @prop {number} order=850 - Index used to define the order of execution */
  31986. order: 850,
  31987. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31988. enabled: true,
  31989. /** @prop {ModifierFn} */
  31990. fn: computeStyle,
  31991. /**
  31992. * @prop {Boolean} gpuAcceleration=true
  31993. * If true, it uses the CSS 3D transformation to position the popper.
  31994. * Otherwise, it will use the `top` and `left` properties
  31995. */
  31996. gpuAcceleration: true,
  31997. /**
  31998. * @prop {string} [x='bottom']
  31999. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  32000. * Change this if your popper should grow in a direction different from `bottom`
  32001. */
  32002. x: 'bottom',
  32003. /**
  32004. * @prop {string} [x='left']
  32005. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  32006. * Change this if your popper should grow in a direction different from `right`
  32007. */
  32008. y: 'right'
  32009. },
  32010. /**
  32011. * Applies the computed styles to the popper element.
  32012. *
  32013. * All the DOM manipulations are limited to this modifier. This is useful in case
  32014. * you want to integrate Popper.js inside a framework or view library and you
  32015. * want to delegate all the DOM manipulations to it.
  32016. *
  32017. * Note that if you disable this modifier, you must make sure the popper element
  32018. * has its position set to `absolute` before Popper.js can do its work!
  32019. *
  32020. * Just disable this modifier and define your own to achieve the desired effect.
  32021. *
  32022. * @memberof modifiers
  32023. * @inner
  32024. */
  32025. applyStyle: {
  32026. /** @prop {number} order=900 - Index used to define the order of execution */
  32027. order: 900,
  32028. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  32029. enabled: true,
  32030. /** @prop {ModifierFn} */
  32031. fn: applyStyle,
  32032. /** @prop {Function} */
  32033. onLoad: applyStyleOnLoad,
  32034. /**
  32035. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  32036. * @prop {Boolean} gpuAcceleration=true
  32037. * If true, it uses the CSS 3D transformation to position the popper.
  32038. * Otherwise, it will use the `top` and `left` properties
  32039. */
  32040. gpuAcceleration: undefined
  32041. }
  32042. };
  32043. /**
  32044. * The `dataObject` is an object containing all the information used by Popper.js.
  32045. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  32046. * @name dataObject
  32047. * @property {Object} data.instance The Popper.js instance
  32048. * @property {String} data.placement Placement applied to popper
  32049. * @property {String} data.originalPlacement Placement originally defined on init
  32050. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  32051. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  32052. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  32053. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  32054. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  32055. * @property {Object} data.boundaries Offsets of the popper boundaries
  32056. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  32057. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  32058. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  32059. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  32060. */
  32061. /**
  32062. * Default options provided to Popper.js constructor.<br />
  32063. * These can be overridden using the `options` argument of Popper.js.<br />
  32064. * To override an option, simply pass an object with the same
  32065. * structure of the `options` object, as the 3rd argument. For example:
  32066. * ```
  32067. * new Popper(ref, pop, {
  32068. * modifiers: {
  32069. * preventOverflow: { enabled: false }
  32070. * }
  32071. * })
  32072. * ```
  32073. * @type {Object}
  32074. * @static
  32075. * @memberof Popper
  32076. */
  32077. var Defaults = {
  32078. /**
  32079. * Popper's placement.
  32080. * @prop {Popper.placements} placement='bottom'
  32081. */
  32082. placement: 'bottom',
  32083. /**
  32084. * Set this to true if you want popper to position it self in 'fixed' mode
  32085. * @prop {Boolean} positionFixed=false
  32086. */
  32087. positionFixed: false,
  32088. /**
  32089. * Whether events (resize, scroll) are initially enabled.
  32090. * @prop {Boolean} eventsEnabled=true
  32091. */
  32092. eventsEnabled: true,
  32093. /**
  32094. * Set to true if you want to automatically remove the popper when
  32095. * you call the `destroy` method.
  32096. * @prop {Boolean} removeOnDestroy=false
  32097. */
  32098. removeOnDestroy: false,
  32099. /**
  32100. * Callback called when the popper is created.<br />
  32101. * By default, it is set to no-op.<br />
  32102. * Access Popper.js instance with `data.instance`.
  32103. * @prop {onCreate}
  32104. */
  32105. onCreate: function onCreate() {},
  32106. /**
  32107. * Callback called when the popper is updated. This callback is not called
  32108. * on the initialization/creation of the popper, but only on subsequent
  32109. * updates.<br />
  32110. * By default, it is set to no-op.<br />
  32111. * Access Popper.js instance with `data.instance`.
  32112. * @prop {onUpdate}
  32113. */
  32114. onUpdate: function onUpdate() {},
  32115. /**
  32116. * List of modifiers used to modify the offsets before they are applied to the popper.
  32117. * They provide most of the functionalities of Popper.js.
  32118. * @prop {modifiers}
  32119. */
  32120. modifiers: modifiers
  32121. };
  32122. /**
  32123. * @callback onCreate
  32124. * @param {dataObject} data
  32125. */
  32126. /**
  32127. * @callback onUpdate
  32128. * @param {dataObject} data
  32129. */
  32130. // Utils
  32131. // Methods
  32132. var Popper = function () {
  32133. /**
  32134. * Creates a new Popper.js instance.
  32135. * @class Popper
  32136. * @param {Element|referenceObject} reference - The reference element used to position the popper
  32137. * @param {Element} popper - The HTML / XML element used as the popper
  32138. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  32139. * @return {Object} instance - The generated Popper.js instance
  32140. */
  32141. function Popper(reference, popper) {
  32142. var _this = this;
  32143. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  32144. classCallCheck(this, Popper);
  32145. this.scheduleUpdate = function () {
  32146. return requestAnimationFrame(_this.update);
  32147. };
  32148. // make update() debounced, so that it only runs at most once-per-tick
  32149. this.update = debounce(this.update.bind(this));
  32150. // with {} we create a new object with the options inside it
  32151. this.options = _extends({}, Popper.Defaults, options);
  32152. // init state
  32153. this.state = {
  32154. isDestroyed: false,
  32155. isCreated: false,
  32156. scrollParents: []
  32157. };
  32158. // get reference and popper elements (allow jQuery wrappers)
  32159. this.reference = reference && reference.jquery ? reference[0] : reference;
  32160. this.popper = popper && popper.jquery ? popper[0] : popper;
  32161. // Deep merge modifiers options
  32162. this.options.modifiers = {};
  32163. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  32164. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  32165. });
  32166. // Refactoring modifiers' list (Object => Array)
  32167. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  32168. return _extends({
  32169. name: name
  32170. }, _this.options.modifiers[name]);
  32171. })
  32172. // sort the modifiers by order
  32173. .sort(function (a, b) {
  32174. return a.order - b.order;
  32175. });
  32176. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  32177. // such code is executed in the same order of its modifier
  32178. // they could add new properties to their options configuration
  32179. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  32180. this.modifiers.forEach(function (modifierOptions) {
  32181. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  32182. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  32183. }
  32184. });
  32185. // fire the first update to position the popper in the right place
  32186. this.update();
  32187. var eventsEnabled = this.options.eventsEnabled;
  32188. if (eventsEnabled) {
  32189. // setup event listeners, they will take care of update the position in specific situations
  32190. this.enableEventListeners();
  32191. }
  32192. this.state.eventsEnabled = eventsEnabled;
  32193. }
  32194. // We can't use class properties because they don't get listed in the
  32195. // class prototype and break stuff like Sinon stubs
  32196. createClass(Popper, [{
  32197. key: 'update',
  32198. value: function update$$1() {
  32199. return update.call(this);
  32200. }
  32201. }, {
  32202. key: 'destroy',
  32203. value: function destroy$$1() {
  32204. return destroy.call(this);
  32205. }
  32206. }, {
  32207. key: 'enableEventListeners',
  32208. value: function enableEventListeners$$1() {
  32209. return enableEventListeners.call(this);
  32210. }
  32211. }, {
  32212. key: 'disableEventListeners',
  32213. value: function disableEventListeners$$1() {
  32214. return disableEventListeners.call(this);
  32215. }
  32216. /**
  32217. * Schedules an update. It will run on the next UI update available.
  32218. * @method scheduleUpdate
  32219. * @memberof Popper
  32220. */
  32221. /**
  32222. * Collection of utilities useful when writing custom modifiers.
  32223. * Starting from version 1.7, this method is available only if you
  32224. * include `popper-utils.js` before `popper.js`.
  32225. *
  32226. * **DEPRECATION**: This way to access PopperUtils is deprecated
  32227. * and will be removed in v2! Use the PopperUtils module directly instead.
  32228. * Due to the high instability of the methods contained in Utils, we can't
  32229. * guarantee them to follow semver. Use them at your own risk!
  32230. * @static
  32231. * @private
  32232. * @type {Object}
  32233. * @deprecated since version 1.8
  32234. * @member Utils
  32235. * @memberof Popper
  32236. */
  32237. }]);
  32238. return Popper;
  32239. }();
  32240. /**
  32241. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  32242. * and lets you use it as replacement of a real DOM node.<br />
  32243. * You can use this method to position a popper relatively to a set of coordinates
  32244. * in case you don't have a DOM node to use as reference.
  32245. *
  32246. * ```
  32247. * new Popper(referenceObject, popperNode);
  32248. * ```
  32249. *
  32250. * NB: This feature isn't supported in Internet Explorer 10.
  32251. * @name referenceObject
  32252. * @property {Function} data.getBoundingClientRect
  32253. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  32254. * @property {number} data.clientWidth
  32255. * An ES6 getter that will return the width of the virtual reference element.
  32256. * @property {number} data.clientHeight
  32257. * An ES6 getter that will return the height of the virtual reference element.
  32258. */
  32259. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  32260. Popper.placements = placements;
  32261. Popper.Defaults = Defaults;
  32262. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  32263. //# sourceMappingURL=popper.js.map
  32264. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  32265. /***/ }),
  32266. /***/ "./node_modules/process/browser.js":
  32267. /*!*****************************************!*\
  32268. !*** ./node_modules/process/browser.js ***!
  32269. \*****************************************/
  32270. /*! no static exports found */
  32271. /***/ (function(module, exports) {
  32272. // shim for using process in browser
  32273. var process = module.exports = {};
  32274. // cached from whatever global is present so that test runners that stub it
  32275. // don't break things. But we need to wrap it in a try catch in case it is
  32276. // wrapped in strict mode code which doesn't define any globals. It's inside a
  32277. // function because try/catches deoptimize in certain engines.
  32278. var cachedSetTimeout;
  32279. var cachedClearTimeout;
  32280. function defaultSetTimout() {
  32281. throw new Error('setTimeout has not been defined');
  32282. }
  32283. function defaultClearTimeout () {
  32284. throw new Error('clearTimeout has not been defined');
  32285. }
  32286. (function () {
  32287. try {
  32288. if (typeof setTimeout === 'function') {
  32289. cachedSetTimeout = setTimeout;
  32290. } else {
  32291. cachedSetTimeout = defaultSetTimout;
  32292. }
  32293. } catch (e) {
  32294. cachedSetTimeout = defaultSetTimout;
  32295. }
  32296. try {
  32297. if (typeof clearTimeout === 'function') {
  32298. cachedClearTimeout = clearTimeout;
  32299. } else {
  32300. cachedClearTimeout = defaultClearTimeout;
  32301. }
  32302. } catch (e) {
  32303. cachedClearTimeout = defaultClearTimeout;
  32304. }
  32305. } ())
  32306. function runTimeout(fun) {
  32307. if (cachedSetTimeout === setTimeout) {
  32308. //normal enviroments in sane situations
  32309. return setTimeout(fun, 0);
  32310. }
  32311. // if setTimeout wasn't available but was latter defined
  32312. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  32313. cachedSetTimeout = setTimeout;
  32314. return setTimeout(fun, 0);
  32315. }
  32316. try {
  32317. // when when somebody has screwed with setTimeout but no I.E. maddness
  32318. return cachedSetTimeout(fun, 0);
  32319. } catch(e){
  32320. try {
  32321. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  32322. return cachedSetTimeout.call(null, fun, 0);
  32323. } catch(e){
  32324. // 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
  32325. return cachedSetTimeout.call(this, fun, 0);
  32326. }
  32327. }
  32328. }
  32329. function runClearTimeout(marker) {
  32330. if (cachedClearTimeout === clearTimeout) {
  32331. //normal enviroments in sane situations
  32332. return clearTimeout(marker);
  32333. }
  32334. // if clearTimeout wasn't available but was latter defined
  32335. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  32336. cachedClearTimeout = clearTimeout;
  32337. return clearTimeout(marker);
  32338. }
  32339. try {
  32340. // when when somebody has screwed with setTimeout but no I.E. maddness
  32341. return cachedClearTimeout(marker);
  32342. } catch (e){
  32343. try {
  32344. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  32345. return cachedClearTimeout.call(null, marker);
  32346. } catch (e){
  32347. // 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.
  32348. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  32349. return cachedClearTimeout.call(this, marker);
  32350. }
  32351. }
  32352. }
  32353. var queue = [];
  32354. var draining = false;
  32355. var currentQueue;
  32356. var queueIndex = -1;
  32357. function cleanUpNextTick() {
  32358. if (!draining || !currentQueue) {
  32359. return;
  32360. }
  32361. draining = false;
  32362. if (currentQueue.length) {
  32363. queue = currentQueue.concat(queue);
  32364. } else {
  32365. queueIndex = -1;
  32366. }
  32367. if (queue.length) {
  32368. drainQueue();
  32369. }
  32370. }
  32371. function drainQueue() {
  32372. if (draining) {
  32373. return;
  32374. }
  32375. var timeout = runTimeout(cleanUpNextTick);
  32376. draining = true;
  32377. var len = queue.length;
  32378. while(len) {
  32379. currentQueue = queue;
  32380. queue = [];
  32381. while (++queueIndex < len) {
  32382. if (currentQueue) {
  32383. currentQueue[queueIndex].run();
  32384. }
  32385. }
  32386. queueIndex = -1;
  32387. len = queue.length;
  32388. }
  32389. currentQueue = null;
  32390. draining = false;
  32391. runClearTimeout(timeout);
  32392. }
  32393. process.nextTick = function (fun) {
  32394. var args = new Array(arguments.length - 1);
  32395. if (arguments.length > 1) {
  32396. for (var i = 1; i < arguments.length; i++) {
  32397. args[i - 1] = arguments[i];
  32398. }
  32399. }
  32400. queue.push(new Item(fun, args));
  32401. if (queue.length === 1 && !draining) {
  32402. runTimeout(drainQueue);
  32403. }
  32404. };
  32405. // v8 likes predictible objects
  32406. function Item(fun, array) {
  32407. this.fun = fun;
  32408. this.array = array;
  32409. }
  32410. Item.prototype.run = function () {
  32411. this.fun.apply(null, this.array);
  32412. };
  32413. process.title = 'browser';
  32414. process.browser = true;
  32415. process.env = {};
  32416. process.argv = [];
  32417. process.version = ''; // empty string to avoid regexp issues
  32418. process.versions = {};
  32419. function noop() {}
  32420. process.on = noop;
  32421. process.addListener = noop;
  32422. process.once = noop;
  32423. process.off = noop;
  32424. process.removeListener = noop;
  32425. process.removeAllListeners = noop;
  32426. process.emit = noop;
  32427. process.prependListener = noop;
  32428. process.prependOnceListener = noop;
  32429. process.listeners = function (name) { return [] }
  32430. process.binding = function (name) {
  32431. throw new Error('process.binding is not supported');
  32432. };
  32433. process.cwd = function () { return '/' };
  32434. process.chdir = function (dir) {
  32435. throw new Error('process.chdir is not supported');
  32436. };
  32437. process.umask = function() { return 0; };
  32438. /***/ }),
  32439. /***/ "./node_modules/setimmediate/setImmediate.js":
  32440. /*!***************************************************!*\
  32441. !*** ./node_modules/setimmediate/setImmediate.js ***!
  32442. \***************************************************/
  32443. /*! no static exports found */
  32444. /***/ (function(module, exports, __webpack_require__) {
  32445. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  32446. "use strict";
  32447. if (global.setImmediate) {
  32448. return;
  32449. }
  32450. var nextHandle = 1; // Spec says greater than zero
  32451. var tasksByHandle = {};
  32452. var currentlyRunningATask = false;
  32453. var doc = global.document;
  32454. var registerImmediate;
  32455. function setImmediate(callback) {
  32456. // Callback can either be a function or a string
  32457. if (typeof callback !== "function") {
  32458. callback = new Function("" + callback);
  32459. }
  32460. // Copy function arguments
  32461. var args = new Array(arguments.length - 1);
  32462. for (var i = 0; i < args.length; i++) {
  32463. args[i] = arguments[i + 1];
  32464. }
  32465. // Store and register the task
  32466. var task = { callback: callback, args: args };
  32467. tasksByHandle[nextHandle] = task;
  32468. registerImmediate(nextHandle);
  32469. return nextHandle++;
  32470. }
  32471. function clearImmediate(handle) {
  32472. delete tasksByHandle[handle];
  32473. }
  32474. function run(task) {
  32475. var callback = task.callback;
  32476. var args = task.args;
  32477. switch (args.length) {
  32478. case 0:
  32479. callback();
  32480. break;
  32481. case 1:
  32482. callback(args[0]);
  32483. break;
  32484. case 2:
  32485. callback(args[0], args[1]);
  32486. break;
  32487. case 3:
  32488. callback(args[0], args[1], args[2]);
  32489. break;
  32490. default:
  32491. callback.apply(undefined, args);
  32492. break;
  32493. }
  32494. }
  32495. function runIfPresent(handle) {
  32496. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  32497. // So if we're currently running a task, we'll need to delay this invocation.
  32498. if (currentlyRunningATask) {
  32499. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  32500. // "too much recursion" error.
  32501. setTimeout(runIfPresent, 0, handle);
  32502. } else {
  32503. var task = tasksByHandle[handle];
  32504. if (task) {
  32505. currentlyRunningATask = true;
  32506. try {
  32507. run(task);
  32508. } finally {
  32509. clearImmediate(handle);
  32510. currentlyRunningATask = false;
  32511. }
  32512. }
  32513. }
  32514. }
  32515. function installNextTickImplementation() {
  32516. registerImmediate = function(handle) {
  32517. process.nextTick(function () { runIfPresent(handle); });
  32518. };
  32519. }
  32520. function canUsePostMessage() {
  32521. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  32522. // where `global.postMessage` means something completely different and can't be used for this purpose.
  32523. if (global.postMessage && !global.importScripts) {
  32524. var postMessageIsAsynchronous = true;
  32525. var oldOnMessage = global.onmessage;
  32526. global.onmessage = function() {
  32527. postMessageIsAsynchronous = false;
  32528. };
  32529. global.postMessage("", "*");
  32530. global.onmessage = oldOnMessage;
  32531. return postMessageIsAsynchronous;
  32532. }
  32533. }
  32534. function installPostMessageImplementation() {
  32535. // Installs an event handler on `global` for the `message` event: see
  32536. // * https://developer.mozilla.org/en/DOM/window.postMessage
  32537. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  32538. var messagePrefix = "setImmediate$" + Math.random() + "$";
  32539. var onGlobalMessage = function(event) {
  32540. if (event.source === global &&
  32541. typeof event.data === "string" &&
  32542. event.data.indexOf(messagePrefix) === 0) {
  32543. runIfPresent(+event.data.slice(messagePrefix.length));
  32544. }
  32545. };
  32546. if (global.addEventListener) {
  32547. global.addEventListener("message", onGlobalMessage, false);
  32548. } else {
  32549. global.attachEvent("onmessage", onGlobalMessage);
  32550. }
  32551. registerImmediate = function(handle) {
  32552. global.postMessage(messagePrefix + handle, "*");
  32553. };
  32554. }
  32555. function installMessageChannelImplementation() {
  32556. var channel = new MessageChannel();
  32557. channel.port1.onmessage = function(event) {
  32558. var handle = event.data;
  32559. runIfPresent(handle);
  32560. };
  32561. registerImmediate = function(handle) {
  32562. channel.port2.postMessage(handle);
  32563. };
  32564. }
  32565. function installReadyStateChangeImplementation() {
  32566. var html = doc.documentElement;
  32567. registerImmediate = function(handle) {
  32568. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  32569. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  32570. var script = doc.createElement("script");
  32571. script.onreadystatechange = function () {
  32572. runIfPresent(handle);
  32573. script.onreadystatechange = null;
  32574. html.removeChild(script);
  32575. script = null;
  32576. };
  32577. html.appendChild(script);
  32578. };
  32579. }
  32580. function installSetTimeoutImplementation() {
  32581. registerImmediate = function(handle) {
  32582. setTimeout(runIfPresent, 0, handle);
  32583. };
  32584. }
  32585. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  32586. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  32587. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  32588. // Don't get fooled by e.g. browserify environments.
  32589. if ({}.toString.call(global.process) === "[object process]") {
  32590. // For Node.js before 0.9
  32591. installNextTickImplementation();
  32592. } else if (canUsePostMessage()) {
  32593. // For non-IE10 modern browsers
  32594. installPostMessageImplementation();
  32595. } else if (global.MessageChannel) {
  32596. // For web workers, where supported
  32597. installMessageChannelImplementation();
  32598. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  32599. // For IE 6–8
  32600. installReadyStateChangeImplementation();
  32601. } else {
  32602. // For older browsers
  32603. installSetTimeoutImplementation();
  32604. }
  32605. attachTo.setImmediate = setImmediate;
  32606. attachTo.clearImmediate = clearImmediate;
  32607. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  32608. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")))
  32609. /***/ }),
  32610. /***/ "./node_modules/timers-browserify/main.js":
  32611. /*!************************************************!*\
  32612. !*** ./node_modules/timers-browserify/main.js ***!
  32613. \************************************************/
  32614. /*! no static exports found */
  32615. /***/ (function(module, exports, __webpack_require__) {
  32616. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  32617. (typeof self !== "undefined" && self) ||
  32618. window;
  32619. var apply = Function.prototype.apply;
  32620. // DOM APIs, for completeness
  32621. exports.setTimeout = function() {
  32622. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  32623. };
  32624. exports.setInterval = function() {
  32625. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  32626. };
  32627. exports.clearTimeout =
  32628. exports.clearInterval = function(timeout) {
  32629. if (timeout) {
  32630. timeout.close();
  32631. }
  32632. };
  32633. function Timeout(id, clearFn) {
  32634. this._id = id;
  32635. this._clearFn = clearFn;
  32636. }
  32637. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  32638. Timeout.prototype.close = function() {
  32639. this._clearFn.call(scope, this._id);
  32640. };
  32641. // Does not start the time, just sets up the members needed.
  32642. exports.enroll = function(item, msecs) {
  32643. clearTimeout(item._idleTimeoutId);
  32644. item._idleTimeout = msecs;
  32645. };
  32646. exports.unenroll = function(item) {
  32647. clearTimeout(item._idleTimeoutId);
  32648. item._idleTimeout = -1;
  32649. };
  32650. exports._unrefActive = exports.active = function(item) {
  32651. clearTimeout(item._idleTimeoutId);
  32652. var msecs = item._idleTimeout;
  32653. if (msecs >= 0) {
  32654. item._idleTimeoutId = setTimeout(function onTimeout() {
  32655. if (item._onTimeout)
  32656. item._onTimeout();
  32657. }, msecs);
  32658. }
  32659. };
  32660. // setimmediate attaches itself to the global object
  32661. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  32662. // On some exotic environments, it's not clear which object `setimmediate` was
  32663. // able to install onto. Search each possibility in the same order as the
  32664. // `setimmediate` library.
  32665. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  32666. (typeof global !== "undefined" && global.setImmediate) ||
  32667. (this && this.setImmediate);
  32668. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  32669. (typeof global !== "undefined" && global.clearImmediate) ||
  32670. (this && this.clearImmediate);
  32671. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  32672. /***/ }),
  32673. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  32674. /*!*******************************************************************************************************************************************************************************************************************!*\
  32675. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  32676. \*******************************************************************************************************************************************************************************************************************/
  32677. /*! exports provided: render, staticRenderFns */
  32678. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  32679. "use strict";
  32680. __webpack_require__.r(__webpack_exports__);
  32681. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  32682. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  32683. var render = function() {
  32684. var _vm = this
  32685. var _h = _vm.$createElement
  32686. var _c = _vm._self._c || _h
  32687. return _vm._m(0)
  32688. }
  32689. var staticRenderFns = [
  32690. function() {
  32691. var _vm = this
  32692. var _h = _vm.$createElement
  32693. var _c = _vm._self._c || _h
  32694. return _c("div", { staticClass: "container" }, [
  32695. _c("div", { staticClass: "row justify-content-center" }, [
  32696. _c("div", { staticClass: "col-md-8" }, [
  32697. _c("div", { staticClass: "card" }, [
  32698. _c("div", { staticClass: "card-header" }, [
  32699. _vm._v("Example Component")
  32700. ]),
  32701. _vm._v(" "),
  32702. _c("div", { staticClass: "card-body" }, [
  32703. _vm._v(
  32704. "\n I'm an example component.\n "
  32705. )
  32706. ])
  32707. ])
  32708. ])
  32709. ])
  32710. ])
  32711. }
  32712. ]
  32713. render._withStripped = true
  32714. /***/ }),
  32715. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  32716. /*!********************************************************************!*\
  32717. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  32718. \********************************************************************/
  32719. /*! exports provided: default */
  32720. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  32721. "use strict";
  32722. __webpack_require__.r(__webpack_exports__);
  32723. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  32724. /* globals __VUE_SSR_CONTEXT__ */
  32725. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  32726. // This module is a runtime utility for cleaner component module output and will
  32727. // be included in the final webpack user bundle.
  32728. function normalizeComponent (
  32729. scriptExports,
  32730. render,
  32731. staticRenderFns,
  32732. functionalTemplate,
  32733. injectStyles,
  32734. scopeId,
  32735. moduleIdentifier, /* server only */
  32736. shadowMode /* vue-cli only */
  32737. ) {
  32738. // Vue.extend constructor export interop
  32739. var options = typeof scriptExports === 'function'
  32740. ? scriptExports.options
  32741. : scriptExports
  32742. // render functions
  32743. if (render) {
  32744. options.render = render
  32745. options.staticRenderFns = staticRenderFns
  32746. options._compiled = true
  32747. }
  32748. // functional template
  32749. if (functionalTemplate) {
  32750. options.functional = true
  32751. }
  32752. // scopedId
  32753. if (scopeId) {
  32754. options._scopeId = 'data-v-' + scopeId
  32755. }
  32756. var hook
  32757. if (moduleIdentifier) { // server build
  32758. hook = function (context) {
  32759. // 2.3 injection
  32760. context =
  32761. context || // cached call
  32762. (this.$vnode && this.$vnode.ssrContext) || // stateful
  32763. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  32764. // 2.2 with runInNewContext: true
  32765. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  32766. context = __VUE_SSR_CONTEXT__
  32767. }
  32768. // inject component styles
  32769. if (injectStyles) {
  32770. injectStyles.call(this, context)
  32771. }
  32772. // register component module identifier for async chunk inferrence
  32773. if (context && context._registeredComponents) {
  32774. context._registeredComponents.add(moduleIdentifier)
  32775. }
  32776. }
  32777. // used by ssr in case component is cached and beforeCreate
  32778. // never gets called
  32779. options._ssrRegister = hook
  32780. } else if (injectStyles) {
  32781. hook = shadowMode
  32782. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  32783. : injectStyles
  32784. }
  32785. if (hook) {
  32786. if (options.functional) {
  32787. // for template-only hot-reload because in that case the render fn doesn't
  32788. // go through the normalizer
  32789. options._injectStyles = hook
  32790. // register for functional component in vue file
  32791. var originalRender = options.render
  32792. options.render = function renderWithStyleInjection (h, context) {
  32793. hook.call(context)
  32794. return originalRender(h, context)
  32795. }
  32796. } else {
  32797. // inject component registration as beforeCreate hook
  32798. var existing = options.beforeCreate
  32799. options.beforeCreate = existing
  32800. ? [].concat(existing, hook)
  32801. : [hook]
  32802. }
  32803. }
  32804. return {
  32805. exports: scriptExports,
  32806. options: options
  32807. }
  32808. }
  32809. /***/ }),
  32810. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  32811. /*!*************************************************!*\
  32812. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  32813. \*************************************************/
  32814. /*! no static exports found */
  32815. /***/ (function(module, exports, __webpack_require__) {
  32816. "use strict";
  32817. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  32818. * Vue.js v2.6.11
  32819. * (c) 2014-2019 Evan You
  32820. * Released under the MIT License.
  32821. */
  32822. /* */
  32823. var emptyObject = Object.freeze({});
  32824. // These helpers produce better VM code in JS engines due to their
  32825. // explicitness and function inlining.
  32826. function isUndef (v) {
  32827. return v === undefined || v === null
  32828. }
  32829. function isDef (v) {
  32830. return v !== undefined && v !== null
  32831. }
  32832. function isTrue (v) {
  32833. return v === true
  32834. }
  32835. function isFalse (v) {
  32836. return v === false
  32837. }
  32838. /**
  32839. * Check if value is primitive.
  32840. */
  32841. function isPrimitive (value) {
  32842. return (
  32843. typeof value === 'string' ||
  32844. typeof value === 'number' ||
  32845. // $flow-disable-line
  32846. typeof value === 'symbol' ||
  32847. typeof value === 'boolean'
  32848. )
  32849. }
  32850. /**
  32851. * Quick object check - this is primarily used to tell
  32852. * Objects from primitive values when we know the value
  32853. * is a JSON-compliant type.
  32854. */
  32855. function isObject (obj) {
  32856. return obj !== null && typeof obj === 'object'
  32857. }
  32858. /**
  32859. * Get the raw type string of a value, e.g., [object Object].
  32860. */
  32861. var _toString = Object.prototype.toString;
  32862. function toRawType (value) {
  32863. return _toString.call(value).slice(8, -1)
  32864. }
  32865. /**
  32866. * Strict object type check. Only returns true
  32867. * for plain JavaScript objects.
  32868. */
  32869. function isPlainObject (obj) {
  32870. return _toString.call(obj) === '[object Object]'
  32871. }
  32872. function isRegExp (v) {
  32873. return _toString.call(v) === '[object RegExp]'
  32874. }
  32875. /**
  32876. * Check if val is a valid array index.
  32877. */
  32878. function isValidArrayIndex (val) {
  32879. var n = parseFloat(String(val));
  32880. return n >= 0 && Math.floor(n) === n && isFinite(val)
  32881. }
  32882. function isPromise (val) {
  32883. return (
  32884. isDef(val) &&
  32885. typeof val.then === 'function' &&
  32886. typeof val.catch === 'function'
  32887. )
  32888. }
  32889. /**
  32890. * Convert a value to a string that is actually rendered.
  32891. */
  32892. function toString (val) {
  32893. return val == null
  32894. ? ''
  32895. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  32896. ? JSON.stringify(val, null, 2)
  32897. : String(val)
  32898. }
  32899. /**
  32900. * Convert an input value to a number for persistence.
  32901. * If the conversion fails, return original string.
  32902. */
  32903. function toNumber (val) {
  32904. var n = parseFloat(val);
  32905. return isNaN(n) ? val : n
  32906. }
  32907. /**
  32908. * Make a map and return a function for checking if a key
  32909. * is in that map.
  32910. */
  32911. function makeMap (
  32912. str,
  32913. expectsLowerCase
  32914. ) {
  32915. var map = Object.create(null);
  32916. var list = str.split(',');
  32917. for (var i = 0; i < list.length; i++) {
  32918. map[list[i]] = true;
  32919. }
  32920. return expectsLowerCase
  32921. ? function (val) { return map[val.toLowerCase()]; }
  32922. : function (val) { return map[val]; }
  32923. }
  32924. /**
  32925. * Check if a tag is a built-in tag.
  32926. */
  32927. var isBuiltInTag = makeMap('slot,component', true);
  32928. /**
  32929. * Check if an attribute is a reserved attribute.
  32930. */
  32931. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  32932. /**
  32933. * Remove an item from an array.
  32934. */
  32935. function remove (arr, item) {
  32936. if (arr.length) {
  32937. var index = arr.indexOf(item);
  32938. if (index > -1) {
  32939. return arr.splice(index, 1)
  32940. }
  32941. }
  32942. }
  32943. /**
  32944. * Check whether an object has the property.
  32945. */
  32946. var hasOwnProperty = Object.prototype.hasOwnProperty;
  32947. function hasOwn (obj, key) {
  32948. return hasOwnProperty.call(obj, key)
  32949. }
  32950. /**
  32951. * Create a cached version of a pure function.
  32952. */
  32953. function cached (fn) {
  32954. var cache = Object.create(null);
  32955. return (function cachedFn (str) {
  32956. var hit = cache[str];
  32957. return hit || (cache[str] = fn(str))
  32958. })
  32959. }
  32960. /**
  32961. * Camelize a hyphen-delimited string.
  32962. */
  32963. var camelizeRE = /-(\w)/g;
  32964. var camelize = cached(function (str) {
  32965. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  32966. });
  32967. /**
  32968. * Capitalize a string.
  32969. */
  32970. var capitalize = cached(function (str) {
  32971. return str.charAt(0).toUpperCase() + str.slice(1)
  32972. });
  32973. /**
  32974. * Hyphenate a camelCase string.
  32975. */
  32976. var hyphenateRE = /\B([A-Z])/g;
  32977. var hyphenate = cached(function (str) {
  32978. return str.replace(hyphenateRE, '-$1').toLowerCase()
  32979. });
  32980. /**
  32981. * Simple bind polyfill for environments that do not support it,
  32982. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  32983. * since native bind is now performant enough in most browsers.
  32984. * But removing it would mean breaking code that was able to run in
  32985. * PhantomJS 1.x, so this must be kept for backward compatibility.
  32986. */
  32987. /* istanbul ignore next */
  32988. function polyfillBind (fn, ctx) {
  32989. function boundFn (a) {
  32990. var l = arguments.length;
  32991. return l
  32992. ? l > 1
  32993. ? fn.apply(ctx, arguments)
  32994. : fn.call(ctx, a)
  32995. : fn.call(ctx)
  32996. }
  32997. boundFn._length = fn.length;
  32998. return boundFn
  32999. }
  33000. function nativeBind (fn, ctx) {
  33001. return fn.bind(ctx)
  33002. }
  33003. var bind = Function.prototype.bind
  33004. ? nativeBind
  33005. : polyfillBind;
  33006. /**
  33007. * Convert an Array-like object to a real Array.
  33008. */
  33009. function toArray (list, start) {
  33010. start = start || 0;
  33011. var i = list.length - start;
  33012. var ret = new Array(i);
  33013. while (i--) {
  33014. ret[i] = list[i + start];
  33015. }
  33016. return ret
  33017. }
  33018. /**
  33019. * Mix properties into target object.
  33020. */
  33021. function extend (to, _from) {
  33022. for (var key in _from) {
  33023. to[key] = _from[key];
  33024. }
  33025. return to
  33026. }
  33027. /**
  33028. * Merge an Array of Objects into a single Object.
  33029. */
  33030. function toObject (arr) {
  33031. var res = {};
  33032. for (var i = 0; i < arr.length; i++) {
  33033. if (arr[i]) {
  33034. extend(res, arr[i]);
  33035. }
  33036. }
  33037. return res
  33038. }
  33039. /* eslint-disable no-unused-vars */
  33040. /**
  33041. * Perform no operation.
  33042. * Stubbing args to make Flow happy without leaving useless transpiled code
  33043. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  33044. */
  33045. function noop (a, b, c) {}
  33046. /**
  33047. * Always return false.
  33048. */
  33049. var no = function (a, b, c) { return false; };
  33050. /* eslint-enable no-unused-vars */
  33051. /**
  33052. * Return the same value.
  33053. */
  33054. var identity = function (_) { return _; };
  33055. /**
  33056. * Generate a string containing static keys from compiler modules.
  33057. */
  33058. function genStaticKeys (modules) {
  33059. return modules.reduce(function (keys, m) {
  33060. return keys.concat(m.staticKeys || [])
  33061. }, []).join(',')
  33062. }
  33063. /**
  33064. * Check if two values are loosely equal - that is,
  33065. * if they are plain objects, do they have the same shape?
  33066. */
  33067. function looseEqual (a, b) {
  33068. if (a === b) { return true }
  33069. var isObjectA = isObject(a);
  33070. var isObjectB = isObject(b);
  33071. if (isObjectA && isObjectB) {
  33072. try {
  33073. var isArrayA = Array.isArray(a);
  33074. var isArrayB = Array.isArray(b);
  33075. if (isArrayA && isArrayB) {
  33076. return a.length === b.length && a.every(function (e, i) {
  33077. return looseEqual(e, b[i])
  33078. })
  33079. } else if (a instanceof Date && b instanceof Date) {
  33080. return a.getTime() === b.getTime()
  33081. } else if (!isArrayA && !isArrayB) {
  33082. var keysA = Object.keys(a);
  33083. var keysB = Object.keys(b);
  33084. return keysA.length === keysB.length && keysA.every(function (key) {
  33085. return looseEqual(a[key], b[key])
  33086. })
  33087. } else {
  33088. /* istanbul ignore next */
  33089. return false
  33090. }
  33091. } catch (e) {
  33092. /* istanbul ignore next */
  33093. return false
  33094. }
  33095. } else if (!isObjectA && !isObjectB) {
  33096. return String(a) === String(b)
  33097. } else {
  33098. return false
  33099. }
  33100. }
  33101. /**
  33102. * Return the first index at which a loosely equal value can be
  33103. * found in the array (if value is a plain object, the array must
  33104. * contain an object of the same shape), or -1 if it is not present.
  33105. */
  33106. function looseIndexOf (arr, val) {
  33107. for (var i = 0; i < arr.length; i++) {
  33108. if (looseEqual(arr[i], val)) { return i }
  33109. }
  33110. return -1
  33111. }
  33112. /**
  33113. * Ensure a function is called only once.
  33114. */
  33115. function once (fn) {
  33116. var called = false;
  33117. return function () {
  33118. if (!called) {
  33119. called = true;
  33120. fn.apply(this, arguments);
  33121. }
  33122. }
  33123. }
  33124. var SSR_ATTR = 'data-server-rendered';
  33125. var ASSET_TYPES = [
  33126. 'component',
  33127. 'directive',
  33128. 'filter'
  33129. ];
  33130. var LIFECYCLE_HOOKS = [
  33131. 'beforeCreate',
  33132. 'created',
  33133. 'beforeMount',
  33134. 'mounted',
  33135. 'beforeUpdate',
  33136. 'updated',
  33137. 'beforeDestroy',
  33138. 'destroyed',
  33139. 'activated',
  33140. 'deactivated',
  33141. 'errorCaptured',
  33142. 'serverPrefetch'
  33143. ];
  33144. /* */
  33145. var config = ({
  33146. /**
  33147. * Option merge strategies (used in core/util/options)
  33148. */
  33149. // $flow-disable-line
  33150. optionMergeStrategies: Object.create(null),
  33151. /**
  33152. * Whether to suppress warnings.
  33153. */
  33154. silent: false,
  33155. /**
  33156. * Show production mode tip message on boot?
  33157. */
  33158. productionTip: "development" !== 'production',
  33159. /**
  33160. * Whether to enable devtools
  33161. */
  33162. devtools: "development" !== 'production',
  33163. /**
  33164. * Whether to record perf
  33165. */
  33166. performance: false,
  33167. /**
  33168. * Error handler for watcher errors
  33169. */
  33170. errorHandler: null,
  33171. /**
  33172. * Warn handler for watcher warns
  33173. */
  33174. warnHandler: null,
  33175. /**
  33176. * Ignore certain custom elements
  33177. */
  33178. ignoredElements: [],
  33179. /**
  33180. * Custom user key aliases for v-on
  33181. */
  33182. // $flow-disable-line
  33183. keyCodes: Object.create(null),
  33184. /**
  33185. * Check if a tag is reserved so that it cannot be registered as a
  33186. * component. This is platform-dependent and may be overwritten.
  33187. */
  33188. isReservedTag: no,
  33189. /**
  33190. * Check if an attribute is reserved so that it cannot be used as a component
  33191. * prop. This is platform-dependent and may be overwritten.
  33192. */
  33193. isReservedAttr: no,
  33194. /**
  33195. * Check if a tag is an unknown element.
  33196. * Platform-dependent.
  33197. */
  33198. isUnknownElement: no,
  33199. /**
  33200. * Get the namespace of an element
  33201. */
  33202. getTagNamespace: noop,
  33203. /**
  33204. * Parse the real tag name for the specific platform.
  33205. */
  33206. parsePlatformTagName: identity,
  33207. /**
  33208. * Check if an attribute must be bound using property, e.g. value
  33209. * Platform-dependent.
  33210. */
  33211. mustUseProp: no,
  33212. /**
  33213. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  33214. * This will significantly reduce performance if set to false.
  33215. */
  33216. async: true,
  33217. /**
  33218. * Exposed for legacy reasons
  33219. */
  33220. _lifecycleHooks: LIFECYCLE_HOOKS
  33221. });
  33222. /* */
  33223. /**
  33224. * unicode letters used for parsing html tags, component names and property paths.
  33225. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  33226. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  33227. */
  33228. 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/;
  33229. /**
  33230. * Check if a string starts with $ or _
  33231. */
  33232. function isReserved (str) {
  33233. var c = (str + '').charCodeAt(0);
  33234. return c === 0x24 || c === 0x5F
  33235. }
  33236. /**
  33237. * Define a property.
  33238. */
  33239. function def (obj, key, val, enumerable) {
  33240. Object.defineProperty(obj, key, {
  33241. value: val,
  33242. enumerable: !!enumerable,
  33243. writable: true,
  33244. configurable: true
  33245. });
  33246. }
  33247. /**
  33248. * Parse simple path.
  33249. */
  33250. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  33251. function parsePath (path) {
  33252. if (bailRE.test(path)) {
  33253. return
  33254. }
  33255. var segments = path.split('.');
  33256. return function (obj) {
  33257. for (var i = 0; i < segments.length; i++) {
  33258. if (!obj) { return }
  33259. obj = obj[segments[i]];
  33260. }
  33261. return obj
  33262. }
  33263. }
  33264. /* */
  33265. // can we use __proto__?
  33266. var hasProto = '__proto__' in {};
  33267. // Browser environment sniffing
  33268. var inBrowser = typeof window !== 'undefined';
  33269. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  33270. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  33271. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  33272. var isIE = UA && /msie|trident/.test(UA);
  33273. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  33274. var isEdge = UA && UA.indexOf('edge/') > 0;
  33275. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  33276. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  33277. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  33278. var isPhantomJS = UA && /phantomjs/.test(UA);
  33279. var isFF = UA && UA.match(/firefox\/(\d+)/);
  33280. // Firefox has a "watch" function on Object.prototype...
  33281. var nativeWatch = ({}).watch;
  33282. var supportsPassive = false;
  33283. if (inBrowser) {
  33284. try {
  33285. var opts = {};
  33286. Object.defineProperty(opts, 'passive', ({
  33287. get: function get () {
  33288. /* istanbul ignore next */
  33289. supportsPassive = true;
  33290. }
  33291. })); // https://github.com/facebook/flow/issues/285
  33292. window.addEventListener('test-passive', null, opts);
  33293. } catch (e) {}
  33294. }
  33295. // this needs to be lazy-evaled because vue may be required before
  33296. // vue-server-renderer can set VUE_ENV
  33297. var _isServer;
  33298. var isServerRendering = function () {
  33299. if (_isServer === undefined) {
  33300. /* istanbul ignore if */
  33301. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  33302. // detect presence of vue-server-renderer and avoid
  33303. // Webpack shimming the process
  33304. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  33305. } else {
  33306. _isServer = false;
  33307. }
  33308. }
  33309. return _isServer
  33310. };
  33311. // detect devtools
  33312. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  33313. /* istanbul ignore next */
  33314. function isNative (Ctor) {
  33315. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  33316. }
  33317. var hasSymbol =
  33318. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  33319. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  33320. var _Set;
  33321. /* istanbul ignore if */ // $flow-disable-line
  33322. if (typeof Set !== 'undefined' && isNative(Set)) {
  33323. // use native Set when available.
  33324. _Set = Set;
  33325. } else {
  33326. // a non-standard Set polyfill that only works with primitive keys.
  33327. _Set = /*@__PURE__*/(function () {
  33328. function Set () {
  33329. this.set = Object.create(null);
  33330. }
  33331. Set.prototype.has = function has (key) {
  33332. return this.set[key] === true
  33333. };
  33334. Set.prototype.add = function add (key) {
  33335. this.set[key] = true;
  33336. };
  33337. Set.prototype.clear = function clear () {
  33338. this.set = Object.create(null);
  33339. };
  33340. return Set;
  33341. }());
  33342. }
  33343. /* */
  33344. var warn = noop;
  33345. var tip = noop;
  33346. var generateComponentTrace = (noop); // work around flow check
  33347. var formatComponentName = (noop);
  33348. {
  33349. var hasConsole = typeof console !== 'undefined';
  33350. var classifyRE = /(?:^|[-_])(\w)/g;
  33351. var classify = function (str) { return str
  33352. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  33353. .replace(/[-_]/g, ''); };
  33354. warn = function (msg, vm) {
  33355. var trace = vm ? generateComponentTrace(vm) : '';
  33356. if (config.warnHandler) {
  33357. config.warnHandler.call(null, msg, vm, trace);
  33358. } else if (hasConsole && (!config.silent)) {
  33359. console.error(("[Vue warn]: " + msg + trace));
  33360. }
  33361. };
  33362. tip = function (msg, vm) {
  33363. if (hasConsole && (!config.silent)) {
  33364. console.warn("[Vue tip]: " + msg + (
  33365. vm ? generateComponentTrace(vm) : ''
  33366. ));
  33367. }
  33368. };
  33369. formatComponentName = function (vm, includeFile) {
  33370. if (vm.$root === vm) {
  33371. return '<Root>'
  33372. }
  33373. var options = typeof vm === 'function' && vm.cid != null
  33374. ? vm.options
  33375. : vm._isVue
  33376. ? vm.$options || vm.constructor.options
  33377. : vm;
  33378. var name = options.name || options._componentTag;
  33379. var file = options.__file;
  33380. if (!name && file) {
  33381. var match = file.match(/([^/\\]+)\.vue$/);
  33382. name = match && match[1];
  33383. }
  33384. return (
  33385. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  33386. (file && includeFile !== false ? (" at " + file) : '')
  33387. )
  33388. };
  33389. var repeat = function (str, n) {
  33390. var res = '';
  33391. while (n) {
  33392. if (n % 2 === 1) { res += str; }
  33393. if (n > 1) { str += str; }
  33394. n >>= 1;
  33395. }
  33396. return res
  33397. };
  33398. generateComponentTrace = function (vm) {
  33399. if (vm._isVue && vm.$parent) {
  33400. var tree = [];
  33401. var currentRecursiveSequence = 0;
  33402. while (vm) {
  33403. if (tree.length > 0) {
  33404. var last = tree[tree.length - 1];
  33405. if (last.constructor === vm.constructor) {
  33406. currentRecursiveSequence++;
  33407. vm = vm.$parent;
  33408. continue
  33409. } else if (currentRecursiveSequence > 0) {
  33410. tree[tree.length - 1] = [last, currentRecursiveSequence];
  33411. currentRecursiveSequence = 0;
  33412. }
  33413. }
  33414. tree.push(vm);
  33415. vm = vm.$parent;
  33416. }
  33417. return '\n\nfound in\n\n' + tree
  33418. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  33419. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  33420. : formatComponentName(vm))); })
  33421. .join('\n')
  33422. } else {
  33423. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  33424. }
  33425. };
  33426. }
  33427. /* */
  33428. var uid = 0;
  33429. /**
  33430. * A dep is an observable that can have multiple
  33431. * directives subscribing to it.
  33432. */
  33433. var Dep = function Dep () {
  33434. this.id = uid++;
  33435. this.subs = [];
  33436. };
  33437. Dep.prototype.addSub = function addSub (sub) {
  33438. this.subs.push(sub);
  33439. };
  33440. Dep.prototype.removeSub = function removeSub (sub) {
  33441. remove(this.subs, sub);
  33442. };
  33443. Dep.prototype.depend = function depend () {
  33444. if (Dep.target) {
  33445. Dep.target.addDep(this);
  33446. }
  33447. };
  33448. Dep.prototype.notify = function notify () {
  33449. // stabilize the subscriber list first
  33450. var subs = this.subs.slice();
  33451. if (!config.async) {
  33452. // subs aren't sorted in scheduler if not running async
  33453. // we need to sort them now to make sure they fire in correct
  33454. // order
  33455. subs.sort(function (a, b) { return a.id - b.id; });
  33456. }
  33457. for (var i = 0, l = subs.length; i < l; i++) {
  33458. subs[i].update();
  33459. }
  33460. };
  33461. // The current target watcher being evaluated.
  33462. // This is globally unique because only one watcher
  33463. // can be evaluated at a time.
  33464. Dep.target = null;
  33465. var targetStack = [];
  33466. function pushTarget (target) {
  33467. targetStack.push(target);
  33468. Dep.target = target;
  33469. }
  33470. function popTarget () {
  33471. targetStack.pop();
  33472. Dep.target = targetStack[targetStack.length - 1];
  33473. }
  33474. /* */
  33475. var VNode = function VNode (
  33476. tag,
  33477. data,
  33478. children,
  33479. text,
  33480. elm,
  33481. context,
  33482. componentOptions,
  33483. asyncFactory
  33484. ) {
  33485. this.tag = tag;
  33486. this.data = data;
  33487. this.children = children;
  33488. this.text = text;
  33489. this.elm = elm;
  33490. this.ns = undefined;
  33491. this.context = context;
  33492. this.fnContext = undefined;
  33493. this.fnOptions = undefined;
  33494. this.fnScopeId = undefined;
  33495. this.key = data && data.key;
  33496. this.componentOptions = componentOptions;
  33497. this.componentInstance = undefined;
  33498. this.parent = undefined;
  33499. this.raw = false;
  33500. this.isStatic = false;
  33501. this.isRootInsert = true;
  33502. this.isComment = false;
  33503. this.isCloned = false;
  33504. this.isOnce = false;
  33505. this.asyncFactory = asyncFactory;
  33506. this.asyncMeta = undefined;
  33507. this.isAsyncPlaceholder = false;
  33508. };
  33509. var prototypeAccessors = { child: { configurable: true } };
  33510. // DEPRECATED: alias for componentInstance for backwards compat.
  33511. /* istanbul ignore next */
  33512. prototypeAccessors.child.get = function () {
  33513. return this.componentInstance
  33514. };
  33515. Object.defineProperties( VNode.prototype, prototypeAccessors );
  33516. var createEmptyVNode = function (text) {
  33517. if ( text === void 0 ) text = '';
  33518. var node = new VNode();
  33519. node.text = text;
  33520. node.isComment = true;
  33521. return node
  33522. };
  33523. function createTextVNode (val) {
  33524. return new VNode(undefined, undefined, undefined, String(val))
  33525. }
  33526. // optimized shallow clone
  33527. // used for static nodes and slot nodes because they may be reused across
  33528. // multiple renders, cloning them avoids errors when DOM manipulations rely
  33529. // on their elm reference.
  33530. function cloneVNode (vnode) {
  33531. var cloned = new VNode(
  33532. vnode.tag,
  33533. vnode.data,
  33534. // #7975
  33535. // clone children array to avoid mutating original in case of cloning
  33536. // a child.
  33537. vnode.children && vnode.children.slice(),
  33538. vnode.text,
  33539. vnode.elm,
  33540. vnode.context,
  33541. vnode.componentOptions,
  33542. vnode.asyncFactory
  33543. );
  33544. cloned.ns = vnode.ns;
  33545. cloned.isStatic = vnode.isStatic;
  33546. cloned.key = vnode.key;
  33547. cloned.isComment = vnode.isComment;
  33548. cloned.fnContext = vnode.fnContext;
  33549. cloned.fnOptions = vnode.fnOptions;
  33550. cloned.fnScopeId = vnode.fnScopeId;
  33551. cloned.asyncMeta = vnode.asyncMeta;
  33552. cloned.isCloned = true;
  33553. return cloned
  33554. }
  33555. /*
  33556. * not type checking this file because flow doesn't play well with
  33557. * dynamically accessing methods on Array prototype
  33558. */
  33559. var arrayProto = Array.prototype;
  33560. var arrayMethods = Object.create(arrayProto);
  33561. var methodsToPatch = [
  33562. 'push',
  33563. 'pop',
  33564. 'shift',
  33565. 'unshift',
  33566. 'splice',
  33567. 'sort',
  33568. 'reverse'
  33569. ];
  33570. /**
  33571. * Intercept mutating methods and emit events
  33572. */
  33573. methodsToPatch.forEach(function (method) {
  33574. // cache original method
  33575. var original = arrayProto[method];
  33576. def(arrayMethods, method, function mutator () {
  33577. var args = [], len = arguments.length;
  33578. while ( len-- ) args[ len ] = arguments[ len ];
  33579. var result = original.apply(this, args);
  33580. var ob = this.__ob__;
  33581. var inserted;
  33582. switch (method) {
  33583. case 'push':
  33584. case 'unshift':
  33585. inserted = args;
  33586. break
  33587. case 'splice':
  33588. inserted = args.slice(2);
  33589. break
  33590. }
  33591. if (inserted) { ob.observeArray(inserted); }
  33592. // notify change
  33593. ob.dep.notify();
  33594. return result
  33595. });
  33596. });
  33597. /* */
  33598. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  33599. /**
  33600. * In some cases we may want to disable observation inside a component's
  33601. * update computation.
  33602. */
  33603. var shouldObserve = true;
  33604. function toggleObserving (value) {
  33605. shouldObserve = value;
  33606. }
  33607. /**
  33608. * Observer class that is attached to each observed
  33609. * object. Once attached, the observer converts the target
  33610. * object's property keys into getter/setters that
  33611. * collect dependencies and dispatch updates.
  33612. */
  33613. var Observer = function Observer (value) {
  33614. this.value = value;
  33615. this.dep = new Dep();
  33616. this.vmCount = 0;
  33617. def(value, '__ob__', this);
  33618. if (Array.isArray(value)) {
  33619. if (hasProto) {
  33620. protoAugment(value, arrayMethods);
  33621. } else {
  33622. copyAugment(value, arrayMethods, arrayKeys);
  33623. }
  33624. this.observeArray(value);
  33625. } else {
  33626. this.walk(value);
  33627. }
  33628. };
  33629. /**
  33630. * Walk through all properties and convert them into
  33631. * getter/setters. This method should only be called when
  33632. * value type is Object.
  33633. */
  33634. Observer.prototype.walk = function walk (obj) {
  33635. var keys = Object.keys(obj);
  33636. for (var i = 0; i < keys.length; i++) {
  33637. defineReactive$$1(obj, keys[i]);
  33638. }
  33639. };
  33640. /**
  33641. * Observe a list of Array items.
  33642. */
  33643. Observer.prototype.observeArray = function observeArray (items) {
  33644. for (var i = 0, l = items.length; i < l; i++) {
  33645. observe(items[i]);
  33646. }
  33647. };
  33648. // helpers
  33649. /**
  33650. * Augment a target Object or Array by intercepting
  33651. * the prototype chain using __proto__
  33652. */
  33653. function protoAugment (target, src) {
  33654. /* eslint-disable no-proto */
  33655. target.__proto__ = src;
  33656. /* eslint-enable no-proto */
  33657. }
  33658. /**
  33659. * Augment a target Object or Array by defining
  33660. * hidden properties.
  33661. */
  33662. /* istanbul ignore next */
  33663. function copyAugment (target, src, keys) {
  33664. for (var i = 0, l = keys.length; i < l; i++) {
  33665. var key = keys[i];
  33666. def(target, key, src[key]);
  33667. }
  33668. }
  33669. /**
  33670. * Attempt to create an observer instance for a value,
  33671. * returns the new observer if successfully observed,
  33672. * or the existing observer if the value already has one.
  33673. */
  33674. function observe (value, asRootData) {
  33675. if (!isObject(value) || value instanceof VNode) {
  33676. return
  33677. }
  33678. var ob;
  33679. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  33680. ob = value.__ob__;
  33681. } else if (
  33682. shouldObserve &&
  33683. !isServerRendering() &&
  33684. (Array.isArray(value) || isPlainObject(value)) &&
  33685. Object.isExtensible(value) &&
  33686. !value._isVue
  33687. ) {
  33688. ob = new Observer(value);
  33689. }
  33690. if (asRootData && ob) {
  33691. ob.vmCount++;
  33692. }
  33693. return ob
  33694. }
  33695. /**
  33696. * Define a reactive property on an Object.
  33697. */
  33698. function defineReactive$$1 (
  33699. obj,
  33700. key,
  33701. val,
  33702. customSetter,
  33703. shallow
  33704. ) {
  33705. var dep = new Dep();
  33706. var property = Object.getOwnPropertyDescriptor(obj, key);
  33707. if (property && property.configurable === false) {
  33708. return
  33709. }
  33710. // cater for pre-defined getter/setters
  33711. var getter = property && property.get;
  33712. var setter = property && property.set;
  33713. if ((!getter || setter) && arguments.length === 2) {
  33714. val = obj[key];
  33715. }
  33716. var childOb = !shallow && observe(val);
  33717. Object.defineProperty(obj, key, {
  33718. enumerable: true,
  33719. configurable: true,
  33720. get: function reactiveGetter () {
  33721. var value = getter ? getter.call(obj) : val;
  33722. if (Dep.target) {
  33723. dep.depend();
  33724. if (childOb) {
  33725. childOb.dep.depend();
  33726. if (Array.isArray(value)) {
  33727. dependArray(value);
  33728. }
  33729. }
  33730. }
  33731. return value
  33732. },
  33733. set: function reactiveSetter (newVal) {
  33734. var value = getter ? getter.call(obj) : val;
  33735. /* eslint-disable no-self-compare */
  33736. if (newVal === value || (newVal !== newVal && value !== value)) {
  33737. return
  33738. }
  33739. /* eslint-enable no-self-compare */
  33740. if (customSetter) {
  33741. customSetter();
  33742. }
  33743. // #7981: for accessor properties without setter
  33744. if (getter && !setter) { return }
  33745. if (setter) {
  33746. setter.call(obj, newVal);
  33747. } else {
  33748. val = newVal;
  33749. }
  33750. childOb = !shallow && observe(newVal);
  33751. dep.notify();
  33752. }
  33753. });
  33754. }
  33755. /**
  33756. * Set a property on an object. Adds the new property and
  33757. * triggers change notification if the property doesn't
  33758. * already exist.
  33759. */
  33760. function set (target, key, val) {
  33761. if (isUndef(target) || isPrimitive(target)
  33762. ) {
  33763. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  33764. }
  33765. if (Array.isArray(target) && isValidArrayIndex(key)) {
  33766. target.length = Math.max(target.length, key);
  33767. target.splice(key, 1, val);
  33768. return val
  33769. }
  33770. if (key in target && !(key in Object.prototype)) {
  33771. target[key] = val;
  33772. return val
  33773. }
  33774. var ob = (target).__ob__;
  33775. if (target._isVue || (ob && ob.vmCount)) {
  33776. warn(
  33777. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  33778. 'at runtime - declare it upfront in the data option.'
  33779. );
  33780. return val
  33781. }
  33782. if (!ob) {
  33783. target[key] = val;
  33784. return val
  33785. }
  33786. defineReactive$$1(ob.value, key, val);
  33787. ob.dep.notify();
  33788. return val
  33789. }
  33790. /**
  33791. * Delete a property and trigger change if necessary.
  33792. */
  33793. function del (target, key) {
  33794. if (isUndef(target) || isPrimitive(target)
  33795. ) {
  33796. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  33797. }
  33798. if (Array.isArray(target) && isValidArrayIndex(key)) {
  33799. target.splice(key, 1);
  33800. return
  33801. }
  33802. var ob = (target).__ob__;
  33803. if (target._isVue || (ob && ob.vmCount)) {
  33804. warn(
  33805. 'Avoid deleting properties on a Vue instance or its root $data ' +
  33806. '- just set it to null.'
  33807. );
  33808. return
  33809. }
  33810. if (!hasOwn(target, key)) {
  33811. return
  33812. }
  33813. delete target[key];
  33814. if (!ob) {
  33815. return
  33816. }
  33817. ob.dep.notify();
  33818. }
  33819. /**
  33820. * Collect dependencies on array elements when the array is touched, since
  33821. * we cannot intercept array element access like property getters.
  33822. */
  33823. function dependArray (value) {
  33824. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  33825. e = value[i];
  33826. e && e.__ob__ && e.__ob__.dep.depend();
  33827. if (Array.isArray(e)) {
  33828. dependArray(e);
  33829. }
  33830. }
  33831. }
  33832. /* */
  33833. /**
  33834. * Option overwriting strategies are functions that handle
  33835. * how to merge a parent option value and a child option
  33836. * value into the final value.
  33837. */
  33838. var strats = config.optionMergeStrategies;
  33839. /**
  33840. * Options with restrictions
  33841. */
  33842. {
  33843. strats.el = strats.propsData = function (parent, child, vm, key) {
  33844. if (!vm) {
  33845. warn(
  33846. "option \"" + key + "\" can only be used during instance " +
  33847. 'creation with the `new` keyword.'
  33848. );
  33849. }
  33850. return defaultStrat(parent, child)
  33851. };
  33852. }
  33853. /**
  33854. * Helper that recursively merges two data objects together.
  33855. */
  33856. function mergeData (to, from) {
  33857. if (!from) { return to }
  33858. var key, toVal, fromVal;
  33859. var keys = hasSymbol
  33860. ? Reflect.ownKeys(from)
  33861. : Object.keys(from);
  33862. for (var i = 0; i < keys.length; i++) {
  33863. key = keys[i];
  33864. // in case the object is already observed...
  33865. if (key === '__ob__') { continue }
  33866. toVal = to[key];
  33867. fromVal = from[key];
  33868. if (!hasOwn(to, key)) {
  33869. set(to, key, fromVal);
  33870. } else if (
  33871. toVal !== fromVal &&
  33872. isPlainObject(toVal) &&
  33873. isPlainObject(fromVal)
  33874. ) {
  33875. mergeData(toVal, fromVal);
  33876. }
  33877. }
  33878. return to
  33879. }
  33880. /**
  33881. * Data
  33882. */
  33883. function mergeDataOrFn (
  33884. parentVal,
  33885. childVal,
  33886. vm
  33887. ) {
  33888. if (!vm) {
  33889. // in a Vue.extend merge, both should be functions
  33890. if (!childVal) {
  33891. return parentVal
  33892. }
  33893. if (!parentVal) {
  33894. return childVal
  33895. }
  33896. // when parentVal & childVal are both present,
  33897. // we need to return a function that returns the
  33898. // merged result of both functions... no need to
  33899. // check if parentVal is a function here because
  33900. // it has to be a function to pass previous merges.
  33901. return function mergedDataFn () {
  33902. return mergeData(
  33903. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  33904. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  33905. )
  33906. }
  33907. } else {
  33908. return function mergedInstanceDataFn () {
  33909. // instance merge
  33910. var instanceData = typeof childVal === 'function'
  33911. ? childVal.call(vm, vm)
  33912. : childVal;
  33913. var defaultData = typeof parentVal === 'function'
  33914. ? parentVal.call(vm, vm)
  33915. : parentVal;
  33916. if (instanceData) {
  33917. return mergeData(instanceData, defaultData)
  33918. } else {
  33919. return defaultData
  33920. }
  33921. }
  33922. }
  33923. }
  33924. strats.data = function (
  33925. parentVal,
  33926. childVal,
  33927. vm
  33928. ) {
  33929. if (!vm) {
  33930. if (childVal && typeof childVal !== 'function') {
  33931. warn(
  33932. 'The "data" option should be a function ' +
  33933. 'that returns a per-instance value in component ' +
  33934. 'definitions.',
  33935. vm
  33936. );
  33937. return parentVal
  33938. }
  33939. return mergeDataOrFn(parentVal, childVal)
  33940. }
  33941. return mergeDataOrFn(parentVal, childVal, vm)
  33942. };
  33943. /**
  33944. * Hooks and props are merged as arrays.
  33945. */
  33946. function mergeHook (
  33947. parentVal,
  33948. childVal
  33949. ) {
  33950. var res = childVal
  33951. ? parentVal
  33952. ? parentVal.concat(childVal)
  33953. : Array.isArray(childVal)
  33954. ? childVal
  33955. : [childVal]
  33956. : parentVal;
  33957. return res
  33958. ? dedupeHooks(res)
  33959. : res
  33960. }
  33961. function dedupeHooks (hooks) {
  33962. var res = [];
  33963. for (var i = 0; i < hooks.length; i++) {
  33964. if (res.indexOf(hooks[i]) === -1) {
  33965. res.push(hooks[i]);
  33966. }
  33967. }
  33968. return res
  33969. }
  33970. LIFECYCLE_HOOKS.forEach(function (hook) {
  33971. strats[hook] = mergeHook;
  33972. });
  33973. /**
  33974. * Assets
  33975. *
  33976. * When a vm is present (instance creation), we need to do
  33977. * a three-way merge between constructor options, instance
  33978. * options and parent options.
  33979. */
  33980. function mergeAssets (
  33981. parentVal,
  33982. childVal,
  33983. vm,
  33984. key
  33985. ) {
  33986. var res = Object.create(parentVal || null);
  33987. if (childVal) {
  33988. assertObjectType(key, childVal, vm);
  33989. return extend(res, childVal)
  33990. } else {
  33991. return res
  33992. }
  33993. }
  33994. ASSET_TYPES.forEach(function (type) {
  33995. strats[type + 's'] = mergeAssets;
  33996. });
  33997. /**
  33998. * Watchers.
  33999. *
  34000. * Watchers hashes should not overwrite one
  34001. * another, so we merge them as arrays.
  34002. */
  34003. strats.watch = function (
  34004. parentVal,
  34005. childVal,
  34006. vm,
  34007. key
  34008. ) {
  34009. // work around Firefox's Object.prototype.watch...
  34010. if (parentVal === nativeWatch) { parentVal = undefined; }
  34011. if (childVal === nativeWatch) { childVal = undefined; }
  34012. /* istanbul ignore if */
  34013. if (!childVal) { return Object.create(parentVal || null) }
  34014. {
  34015. assertObjectType(key, childVal, vm);
  34016. }
  34017. if (!parentVal) { return childVal }
  34018. var ret = {};
  34019. extend(ret, parentVal);
  34020. for (var key$1 in childVal) {
  34021. var parent = ret[key$1];
  34022. var child = childVal[key$1];
  34023. if (parent && !Array.isArray(parent)) {
  34024. parent = [parent];
  34025. }
  34026. ret[key$1] = parent
  34027. ? parent.concat(child)
  34028. : Array.isArray(child) ? child : [child];
  34029. }
  34030. return ret
  34031. };
  34032. /**
  34033. * Other object hashes.
  34034. */
  34035. strats.props =
  34036. strats.methods =
  34037. strats.inject =
  34038. strats.computed = function (
  34039. parentVal,
  34040. childVal,
  34041. vm,
  34042. key
  34043. ) {
  34044. if (childVal && "development" !== 'production') {
  34045. assertObjectType(key, childVal, vm);
  34046. }
  34047. if (!parentVal) { return childVal }
  34048. var ret = Object.create(null);
  34049. extend(ret, parentVal);
  34050. if (childVal) { extend(ret, childVal); }
  34051. return ret
  34052. };
  34053. strats.provide = mergeDataOrFn;
  34054. /**
  34055. * Default strategy.
  34056. */
  34057. var defaultStrat = function (parentVal, childVal) {
  34058. return childVal === undefined
  34059. ? parentVal
  34060. : childVal
  34061. };
  34062. /**
  34063. * Validate component names
  34064. */
  34065. function checkComponents (options) {
  34066. for (var key in options.components) {
  34067. validateComponentName(key);
  34068. }
  34069. }
  34070. function validateComponentName (name) {
  34071. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  34072. warn(
  34073. 'Invalid component name: "' + name + '". Component names ' +
  34074. 'should conform to valid custom element name in html5 specification.'
  34075. );
  34076. }
  34077. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  34078. warn(
  34079. 'Do not use built-in or reserved HTML elements as component ' +
  34080. 'id: ' + name
  34081. );
  34082. }
  34083. }
  34084. /**
  34085. * Ensure all props option syntax are normalized into the
  34086. * Object-based format.
  34087. */
  34088. function normalizeProps (options, vm) {
  34089. var props = options.props;
  34090. if (!props) { return }
  34091. var res = {};
  34092. var i, val, name;
  34093. if (Array.isArray(props)) {
  34094. i = props.length;
  34095. while (i--) {
  34096. val = props[i];
  34097. if (typeof val === 'string') {
  34098. name = camelize(val);
  34099. res[name] = { type: null };
  34100. } else {
  34101. warn('props must be strings when using array syntax.');
  34102. }
  34103. }
  34104. } else if (isPlainObject(props)) {
  34105. for (var key in props) {
  34106. val = props[key];
  34107. name = camelize(key);
  34108. res[name] = isPlainObject(val)
  34109. ? val
  34110. : { type: val };
  34111. }
  34112. } else {
  34113. warn(
  34114. "Invalid value for option \"props\": expected an Array or an Object, " +
  34115. "but got " + (toRawType(props)) + ".",
  34116. vm
  34117. );
  34118. }
  34119. options.props = res;
  34120. }
  34121. /**
  34122. * Normalize all injections into Object-based format
  34123. */
  34124. function normalizeInject (options, vm) {
  34125. var inject = options.inject;
  34126. if (!inject) { return }
  34127. var normalized = options.inject = {};
  34128. if (Array.isArray(inject)) {
  34129. for (var i = 0; i < inject.length; i++) {
  34130. normalized[inject[i]] = { from: inject[i] };
  34131. }
  34132. } else if (isPlainObject(inject)) {
  34133. for (var key in inject) {
  34134. var val = inject[key];
  34135. normalized[key] = isPlainObject(val)
  34136. ? extend({ from: key }, val)
  34137. : { from: val };
  34138. }
  34139. } else {
  34140. warn(
  34141. "Invalid value for option \"inject\": expected an Array or an Object, " +
  34142. "but got " + (toRawType(inject)) + ".",
  34143. vm
  34144. );
  34145. }
  34146. }
  34147. /**
  34148. * Normalize raw function directives into object format.
  34149. */
  34150. function normalizeDirectives (options) {
  34151. var dirs = options.directives;
  34152. if (dirs) {
  34153. for (var key in dirs) {
  34154. var def$$1 = dirs[key];
  34155. if (typeof def$$1 === 'function') {
  34156. dirs[key] = { bind: def$$1, update: def$$1 };
  34157. }
  34158. }
  34159. }
  34160. }
  34161. function assertObjectType (name, value, vm) {
  34162. if (!isPlainObject(value)) {
  34163. warn(
  34164. "Invalid value for option \"" + name + "\": expected an Object, " +
  34165. "but got " + (toRawType(value)) + ".",
  34166. vm
  34167. );
  34168. }
  34169. }
  34170. /**
  34171. * Merge two option objects into a new one.
  34172. * Core utility used in both instantiation and inheritance.
  34173. */
  34174. function mergeOptions (
  34175. parent,
  34176. child,
  34177. vm
  34178. ) {
  34179. {
  34180. checkComponents(child);
  34181. }
  34182. if (typeof child === 'function') {
  34183. child = child.options;
  34184. }
  34185. normalizeProps(child, vm);
  34186. normalizeInject(child, vm);
  34187. normalizeDirectives(child);
  34188. // Apply extends and mixins on the child options,
  34189. // but only if it is a raw options object that isn't
  34190. // the result of another mergeOptions call.
  34191. // Only merged options has the _base property.
  34192. if (!child._base) {
  34193. if (child.extends) {
  34194. parent = mergeOptions(parent, child.extends, vm);
  34195. }
  34196. if (child.mixins) {
  34197. for (var i = 0, l = child.mixins.length; i < l; i++) {
  34198. parent = mergeOptions(parent, child.mixins[i], vm);
  34199. }
  34200. }
  34201. }
  34202. var options = {};
  34203. var key;
  34204. for (key in parent) {
  34205. mergeField(key);
  34206. }
  34207. for (key in child) {
  34208. if (!hasOwn(parent, key)) {
  34209. mergeField(key);
  34210. }
  34211. }
  34212. function mergeField (key) {
  34213. var strat = strats[key] || defaultStrat;
  34214. options[key] = strat(parent[key], child[key], vm, key);
  34215. }
  34216. return options
  34217. }
  34218. /**
  34219. * Resolve an asset.
  34220. * This function is used because child instances need access
  34221. * to assets defined in its ancestor chain.
  34222. */
  34223. function resolveAsset (
  34224. options,
  34225. type,
  34226. id,
  34227. warnMissing
  34228. ) {
  34229. /* istanbul ignore if */
  34230. if (typeof id !== 'string') {
  34231. return
  34232. }
  34233. var assets = options[type];
  34234. // check local registration variations first
  34235. if (hasOwn(assets, id)) { return assets[id] }
  34236. var camelizedId = camelize(id);
  34237. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  34238. var PascalCaseId = capitalize(camelizedId);
  34239. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  34240. // fallback to prototype chain
  34241. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  34242. if (warnMissing && !res) {
  34243. warn(
  34244. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  34245. options
  34246. );
  34247. }
  34248. return res
  34249. }
  34250. /* */
  34251. function validateProp (
  34252. key,
  34253. propOptions,
  34254. propsData,
  34255. vm
  34256. ) {
  34257. var prop = propOptions[key];
  34258. var absent = !hasOwn(propsData, key);
  34259. var value = propsData[key];
  34260. // boolean casting
  34261. var booleanIndex = getTypeIndex(Boolean, prop.type);
  34262. if (booleanIndex > -1) {
  34263. if (absent && !hasOwn(prop, 'default')) {
  34264. value = false;
  34265. } else if (value === '' || value === hyphenate(key)) {
  34266. // only cast empty string / same name to boolean if
  34267. // boolean has higher priority
  34268. var stringIndex = getTypeIndex(String, prop.type);
  34269. if (stringIndex < 0 || booleanIndex < stringIndex) {
  34270. value = true;
  34271. }
  34272. }
  34273. }
  34274. // check default value
  34275. if (value === undefined) {
  34276. value = getPropDefaultValue(vm, prop, key);
  34277. // since the default value is a fresh copy,
  34278. // make sure to observe it.
  34279. var prevShouldObserve = shouldObserve;
  34280. toggleObserving(true);
  34281. observe(value);
  34282. toggleObserving(prevShouldObserve);
  34283. }
  34284. {
  34285. assertProp(prop, key, value, vm, absent);
  34286. }
  34287. return value
  34288. }
  34289. /**
  34290. * Get the default value of a prop.
  34291. */
  34292. function getPropDefaultValue (vm, prop, key) {
  34293. // no default, return undefined
  34294. if (!hasOwn(prop, 'default')) {
  34295. return undefined
  34296. }
  34297. var def = prop.default;
  34298. // warn against non-factory defaults for Object & Array
  34299. if (isObject(def)) {
  34300. warn(
  34301. 'Invalid default value for prop "' + key + '": ' +
  34302. 'Props with type Object/Array must use a factory function ' +
  34303. 'to return the default value.',
  34304. vm
  34305. );
  34306. }
  34307. // the raw prop value was also undefined from previous render,
  34308. // return previous default value to avoid unnecessary watcher trigger
  34309. if (vm && vm.$options.propsData &&
  34310. vm.$options.propsData[key] === undefined &&
  34311. vm._props[key] !== undefined
  34312. ) {
  34313. return vm._props[key]
  34314. }
  34315. // call factory function for non-Function types
  34316. // a value is Function if its prototype is function even across different execution context
  34317. return typeof def === 'function' && getType(prop.type) !== 'Function'
  34318. ? def.call(vm)
  34319. : def
  34320. }
  34321. /**
  34322. * Assert whether a prop is valid.
  34323. */
  34324. function assertProp (
  34325. prop,
  34326. name,
  34327. value,
  34328. vm,
  34329. absent
  34330. ) {
  34331. if (prop.required && absent) {
  34332. warn(
  34333. 'Missing required prop: "' + name + '"',
  34334. vm
  34335. );
  34336. return
  34337. }
  34338. if (value == null && !prop.required) {
  34339. return
  34340. }
  34341. var type = prop.type;
  34342. var valid = !type || type === true;
  34343. var expectedTypes = [];
  34344. if (type) {
  34345. if (!Array.isArray(type)) {
  34346. type = [type];
  34347. }
  34348. for (var i = 0; i < type.length && !valid; i++) {
  34349. var assertedType = assertType(value, type[i]);
  34350. expectedTypes.push(assertedType.expectedType || '');
  34351. valid = assertedType.valid;
  34352. }
  34353. }
  34354. if (!valid) {
  34355. warn(
  34356. getInvalidTypeMessage(name, value, expectedTypes),
  34357. vm
  34358. );
  34359. return
  34360. }
  34361. var validator = prop.validator;
  34362. if (validator) {
  34363. if (!validator(value)) {
  34364. warn(
  34365. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  34366. vm
  34367. );
  34368. }
  34369. }
  34370. }
  34371. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  34372. function assertType (value, type) {
  34373. var valid;
  34374. var expectedType = getType(type);
  34375. if (simpleCheckRE.test(expectedType)) {
  34376. var t = typeof value;
  34377. valid = t === expectedType.toLowerCase();
  34378. // for primitive wrapper objects
  34379. if (!valid && t === 'object') {
  34380. valid = value instanceof type;
  34381. }
  34382. } else if (expectedType === 'Object') {
  34383. valid = isPlainObject(value);
  34384. } else if (expectedType === 'Array') {
  34385. valid = Array.isArray(value);
  34386. } else {
  34387. valid = value instanceof type;
  34388. }
  34389. return {
  34390. valid: valid,
  34391. expectedType: expectedType
  34392. }
  34393. }
  34394. /**
  34395. * Use function string name to check built-in types,
  34396. * because a simple equality check will fail when running
  34397. * across different vms / iframes.
  34398. */
  34399. function getType (fn) {
  34400. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  34401. return match ? match[1] : ''
  34402. }
  34403. function isSameType (a, b) {
  34404. return getType(a) === getType(b)
  34405. }
  34406. function getTypeIndex (type, expectedTypes) {
  34407. if (!Array.isArray(expectedTypes)) {
  34408. return isSameType(expectedTypes, type) ? 0 : -1
  34409. }
  34410. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  34411. if (isSameType(expectedTypes[i], type)) {
  34412. return i
  34413. }
  34414. }
  34415. return -1
  34416. }
  34417. function getInvalidTypeMessage (name, value, expectedTypes) {
  34418. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  34419. " Expected " + (expectedTypes.map(capitalize).join(', '));
  34420. var expectedType = expectedTypes[0];
  34421. var receivedType = toRawType(value);
  34422. var expectedValue = styleValue(value, expectedType);
  34423. var receivedValue = styleValue(value, receivedType);
  34424. // check if we need to specify expected value
  34425. if (expectedTypes.length === 1 &&
  34426. isExplicable(expectedType) &&
  34427. !isBoolean(expectedType, receivedType)) {
  34428. message += " with value " + expectedValue;
  34429. }
  34430. message += ", got " + receivedType + " ";
  34431. // check if we need to specify received value
  34432. if (isExplicable(receivedType)) {
  34433. message += "with value " + receivedValue + ".";
  34434. }
  34435. return message
  34436. }
  34437. function styleValue (value, type) {
  34438. if (type === 'String') {
  34439. return ("\"" + value + "\"")
  34440. } else if (type === 'Number') {
  34441. return ("" + (Number(value)))
  34442. } else {
  34443. return ("" + value)
  34444. }
  34445. }
  34446. function isExplicable (value) {
  34447. var explicitTypes = ['string', 'number', 'boolean'];
  34448. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  34449. }
  34450. function isBoolean () {
  34451. var args = [], len = arguments.length;
  34452. while ( len-- ) args[ len ] = arguments[ len ];
  34453. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  34454. }
  34455. /* */
  34456. function handleError (err, vm, info) {
  34457. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  34458. // See: https://github.com/vuejs/vuex/issues/1505
  34459. pushTarget();
  34460. try {
  34461. if (vm) {
  34462. var cur = vm;
  34463. while ((cur = cur.$parent)) {
  34464. var hooks = cur.$options.errorCaptured;
  34465. if (hooks) {
  34466. for (var i = 0; i < hooks.length; i++) {
  34467. try {
  34468. var capture = hooks[i].call(cur, err, vm, info) === false;
  34469. if (capture) { return }
  34470. } catch (e) {
  34471. globalHandleError(e, cur, 'errorCaptured hook');
  34472. }
  34473. }
  34474. }
  34475. }
  34476. }
  34477. globalHandleError(err, vm, info);
  34478. } finally {
  34479. popTarget();
  34480. }
  34481. }
  34482. function invokeWithErrorHandling (
  34483. handler,
  34484. context,
  34485. args,
  34486. vm,
  34487. info
  34488. ) {
  34489. var res;
  34490. try {
  34491. res = args ? handler.apply(context, args) : handler.call(context);
  34492. if (res && !res._isVue && isPromise(res) && !res._handled) {
  34493. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  34494. // issue #9511
  34495. // avoid catch triggering multiple times when nested calls
  34496. res._handled = true;
  34497. }
  34498. } catch (e) {
  34499. handleError(e, vm, info);
  34500. }
  34501. return res
  34502. }
  34503. function globalHandleError (err, vm, info) {
  34504. if (config.errorHandler) {
  34505. try {
  34506. return config.errorHandler.call(null, err, vm, info)
  34507. } catch (e) {
  34508. // if the user intentionally throws the original error in the handler,
  34509. // do not log it twice
  34510. if (e !== err) {
  34511. logError(e, null, 'config.errorHandler');
  34512. }
  34513. }
  34514. }
  34515. logError(err, vm, info);
  34516. }
  34517. function logError (err, vm, info) {
  34518. {
  34519. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  34520. }
  34521. /* istanbul ignore else */
  34522. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  34523. console.error(err);
  34524. } else {
  34525. throw err
  34526. }
  34527. }
  34528. /* */
  34529. var isUsingMicroTask = false;
  34530. var callbacks = [];
  34531. var pending = false;
  34532. function flushCallbacks () {
  34533. pending = false;
  34534. var copies = callbacks.slice(0);
  34535. callbacks.length = 0;
  34536. for (var i = 0; i < copies.length; i++) {
  34537. copies[i]();
  34538. }
  34539. }
  34540. // Here we have async deferring wrappers using microtasks.
  34541. // In 2.5 we used (macro) tasks (in combination with microtasks).
  34542. // However, it has subtle problems when state is changed right before repaint
  34543. // (e.g. #6813, out-in transitions).
  34544. // Also, using (macro) tasks in event handler would cause some weird behaviors
  34545. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  34546. // So we now use microtasks everywhere, again.
  34547. // A major drawback of this tradeoff is that there are some scenarios
  34548. // where microtasks have too high a priority and fire in between supposedly
  34549. // sequential events (e.g. #4521, #6690, which have workarounds)
  34550. // or even between bubbling of the same event (#6566).
  34551. var timerFunc;
  34552. // The nextTick behavior leverages the microtask queue, which can be accessed
  34553. // via either native Promise.then or MutationObserver.
  34554. // MutationObserver has wider support, however it is seriously bugged in
  34555. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  34556. // completely stops working after triggering a few times... so, if native
  34557. // Promise is available, we will use it:
  34558. /* istanbul ignore next, $flow-disable-line */
  34559. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  34560. var p = Promise.resolve();
  34561. timerFunc = function () {
  34562. p.then(flushCallbacks);
  34563. // In problematic UIWebViews, Promise.then doesn't completely break, but
  34564. // it can get stuck in a weird state where callbacks are pushed into the
  34565. // microtask queue but the queue isn't being flushed, until the browser
  34566. // needs to do some other work, e.g. handle a timer. Therefore we can
  34567. // "force" the microtask queue to be flushed by adding an empty timer.
  34568. if (isIOS) { setTimeout(noop); }
  34569. };
  34570. isUsingMicroTask = true;
  34571. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  34572. isNative(MutationObserver) ||
  34573. // PhantomJS and iOS 7.x
  34574. MutationObserver.toString() === '[object MutationObserverConstructor]'
  34575. )) {
  34576. // Use MutationObserver where native Promise is not available,
  34577. // e.g. PhantomJS, iOS7, Android 4.4
  34578. // (#6466 MutationObserver is unreliable in IE11)
  34579. var counter = 1;
  34580. var observer = new MutationObserver(flushCallbacks);
  34581. var textNode = document.createTextNode(String(counter));
  34582. observer.observe(textNode, {
  34583. characterData: true
  34584. });
  34585. timerFunc = function () {
  34586. counter = (counter + 1) % 2;
  34587. textNode.data = String(counter);
  34588. };
  34589. isUsingMicroTask = true;
  34590. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  34591. // Fallback to setImmediate.
  34592. // Technically it leverages the (macro) task queue,
  34593. // but it is still a better choice than setTimeout.
  34594. timerFunc = function () {
  34595. setImmediate(flushCallbacks);
  34596. };
  34597. } else {
  34598. // Fallback to setTimeout.
  34599. timerFunc = function () {
  34600. setTimeout(flushCallbacks, 0);
  34601. };
  34602. }
  34603. function nextTick (cb, ctx) {
  34604. var _resolve;
  34605. callbacks.push(function () {
  34606. if (cb) {
  34607. try {
  34608. cb.call(ctx);
  34609. } catch (e) {
  34610. handleError(e, ctx, 'nextTick');
  34611. }
  34612. } else if (_resolve) {
  34613. _resolve(ctx);
  34614. }
  34615. });
  34616. if (!pending) {
  34617. pending = true;
  34618. timerFunc();
  34619. }
  34620. // $flow-disable-line
  34621. if (!cb && typeof Promise !== 'undefined') {
  34622. return new Promise(function (resolve) {
  34623. _resolve = resolve;
  34624. })
  34625. }
  34626. }
  34627. /* */
  34628. var mark;
  34629. var measure;
  34630. {
  34631. var perf = inBrowser && window.performance;
  34632. /* istanbul ignore if */
  34633. if (
  34634. perf &&
  34635. perf.mark &&
  34636. perf.measure &&
  34637. perf.clearMarks &&
  34638. perf.clearMeasures
  34639. ) {
  34640. mark = function (tag) { return perf.mark(tag); };
  34641. measure = function (name, startTag, endTag) {
  34642. perf.measure(name, startTag, endTag);
  34643. perf.clearMarks(startTag);
  34644. perf.clearMarks(endTag);
  34645. // perf.clearMeasures(name)
  34646. };
  34647. }
  34648. }
  34649. /* not type checking this file because flow doesn't play well with Proxy */
  34650. var initProxy;
  34651. {
  34652. var allowedGlobals = makeMap(
  34653. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  34654. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  34655. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  34656. 'require' // for Webpack/Browserify
  34657. );
  34658. var warnNonPresent = function (target, key) {
  34659. warn(
  34660. "Property or method \"" + key + "\" is not defined on the instance but " +
  34661. 'referenced during render. Make sure that this property is reactive, ' +
  34662. 'either in the data option, or for class-based components, by ' +
  34663. 'initializing the property. ' +
  34664. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  34665. target
  34666. );
  34667. };
  34668. var warnReservedPrefix = function (target, key) {
  34669. warn(
  34670. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  34671. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  34672. 'prevent conflicts with Vue internals. ' +
  34673. 'See: https://vuejs.org/v2/api/#data',
  34674. target
  34675. );
  34676. };
  34677. var hasProxy =
  34678. typeof Proxy !== 'undefined' && isNative(Proxy);
  34679. if (hasProxy) {
  34680. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  34681. config.keyCodes = new Proxy(config.keyCodes, {
  34682. set: function set (target, key, value) {
  34683. if (isBuiltInModifier(key)) {
  34684. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  34685. return false
  34686. } else {
  34687. target[key] = value;
  34688. return true
  34689. }
  34690. }
  34691. });
  34692. }
  34693. var hasHandler = {
  34694. has: function has (target, key) {
  34695. var has = key in target;
  34696. var isAllowed = allowedGlobals(key) ||
  34697. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  34698. if (!has && !isAllowed) {
  34699. if (key in target.$data) { warnReservedPrefix(target, key); }
  34700. else { warnNonPresent(target, key); }
  34701. }
  34702. return has || !isAllowed
  34703. }
  34704. };
  34705. var getHandler = {
  34706. get: function get (target, key) {
  34707. if (typeof key === 'string' && !(key in target)) {
  34708. if (key in target.$data) { warnReservedPrefix(target, key); }
  34709. else { warnNonPresent(target, key); }
  34710. }
  34711. return target[key]
  34712. }
  34713. };
  34714. initProxy = function initProxy (vm) {
  34715. if (hasProxy) {
  34716. // determine which proxy handler to use
  34717. var options = vm.$options;
  34718. var handlers = options.render && options.render._withStripped
  34719. ? getHandler
  34720. : hasHandler;
  34721. vm._renderProxy = new Proxy(vm, handlers);
  34722. } else {
  34723. vm._renderProxy = vm;
  34724. }
  34725. };
  34726. }
  34727. /* */
  34728. var seenObjects = new _Set();
  34729. /**
  34730. * Recursively traverse an object to evoke all converted
  34731. * getters, so that every nested property inside the object
  34732. * is collected as a "deep" dependency.
  34733. */
  34734. function traverse (val) {
  34735. _traverse(val, seenObjects);
  34736. seenObjects.clear();
  34737. }
  34738. function _traverse (val, seen) {
  34739. var i, keys;
  34740. var isA = Array.isArray(val);
  34741. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  34742. return
  34743. }
  34744. if (val.__ob__) {
  34745. var depId = val.__ob__.dep.id;
  34746. if (seen.has(depId)) {
  34747. return
  34748. }
  34749. seen.add(depId);
  34750. }
  34751. if (isA) {
  34752. i = val.length;
  34753. while (i--) { _traverse(val[i], seen); }
  34754. } else {
  34755. keys = Object.keys(val);
  34756. i = keys.length;
  34757. while (i--) { _traverse(val[keys[i]], seen); }
  34758. }
  34759. }
  34760. /* */
  34761. var normalizeEvent = cached(function (name) {
  34762. var passive = name.charAt(0) === '&';
  34763. name = passive ? name.slice(1) : name;
  34764. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  34765. name = once$$1 ? name.slice(1) : name;
  34766. var capture = name.charAt(0) === '!';
  34767. name = capture ? name.slice(1) : name;
  34768. return {
  34769. name: name,
  34770. once: once$$1,
  34771. capture: capture,
  34772. passive: passive
  34773. }
  34774. });
  34775. function createFnInvoker (fns, vm) {
  34776. function invoker () {
  34777. var arguments$1 = arguments;
  34778. var fns = invoker.fns;
  34779. if (Array.isArray(fns)) {
  34780. var cloned = fns.slice();
  34781. for (var i = 0; i < cloned.length; i++) {
  34782. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  34783. }
  34784. } else {
  34785. // return handler return value for single handlers
  34786. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  34787. }
  34788. }
  34789. invoker.fns = fns;
  34790. return invoker
  34791. }
  34792. function updateListeners (
  34793. on,
  34794. oldOn,
  34795. add,
  34796. remove$$1,
  34797. createOnceHandler,
  34798. vm
  34799. ) {
  34800. var name, def$$1, cur, old, event;
  34801. for (name in on) {
  34802. def$$1 = cur = on[name];
  34803. old = oldOn[name];
  34804. event = normalizeEvent(name);
  34805. if (isUndef(cur)) {
  34806. warn(
  34807. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  34808. vm
  34809. );
  34810. } else if (isUndef(old)) {
  34811. if (isUndef(cur.fns)) {
  34812. cur = on[name] = createFnInvoker(cur, vm);
  34813. }
  34814. if (isTrue(event.once)) {
  34815. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  34816. }
  34817. add(event.name, cur, event.capture, event.passive, event.params);
  34818. } else if (cur !== old) {
  34819. old.fns = cur;
  34820. on[name] = old;
  34821. }
  34822. }
  34823. for (name in oldOn) {
  34824. if (isUndef(on[name])) {
  34825. event = normalizeEvent(name);
  34826. remove$$1(event.name, oldOn[name], event.capture);
  34827. }
  34828. }
  34829. }
  34830. /* */
  34831. function mergeVNodeHook (def, hookKey, hook) {
  34832. if (def instanceof VNode) {
  34833. def = def.data.hook || (def.data.hook = {});
  34834. }
  34835. var invoker;
  34836. var oldHook = def[hookKey];
  34837. function wrappedHook () {
  34838. hook.apply(this, arguments);
  34839. // important: remove merged hook to ensure it's called only once
  34840. // and prevent memory leak
  34841. remove(invoker.fns, wrappedHook);
  34842. }
  34843. if (isUndef(oldHook)) {
  34844. // no existing hook
  34845. invoker = createFnInvoker([wrappedHook]);
  34846. } else {
  34847. /* istanbul ignore if */
  34848. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  34849. // already a merged invoker
  34850. invoker = oldHook;
  34851. invoker.fns.push(wrappedHook);
  34852. } else {
  34853. // existing plain hook
  34854. invoker = createFnInvoker([oldHook, wrappedHook]);
  34855. }
  34856. }
  34857. invoker.merged = true;
  34858. def[hookKey] = invoker;
  34859. }
  34860. /* */
  34861. function extractPropsFromVNodeData (
  34862. data,
  34863. Ctor,
  34864. tag
  34865. ) {
  34866. // we are only extracting raw values here.
  34867. // validation and default values are handled in the child
  34868. // component itself.
  34869. var propOptions = Ctor.options.props;
  34870. if (isUndef(propOptions)) {
  34871. return
  34872. }
  34873. var res = {};
  34874. var attrs = data.attrs;
  34875. var props = data.props;
  34876. if (isDef(attrs) || isDef(props)) {
  34877. for (var key in propOptions) {
  34878. var altKey = hyphenate(key);
  34879. {
  34880. var keyInLowerCase = key.toLowerCase();
  34881. if (
  34882. key !== keyInLowerCase &&
  34883. attrs && hasOwn(attrs, keyInLowerCase)
  34884. ) {
  34885. tip(
  34886. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  34887. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  34888. " \"" + key + "\". " +
  34889. "Note that HTML attributes are case-insensitive and camelCased " +
  34890. "props need to use their kebab-case equivalents when using in-DOM " +
  34891. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  34892. );
  34893. }
  34894. }
  34895. checkProp(res, props, key, altKey, true) ||
  34896. checkProp(res, attrs, key, altKey, false);
  34897. }
  34898. }
  34899. return res
  34900. }
  34901. function checkProp (
  34902. res,
  34903. hash,
  34904. key,
  34905. altKey,
  34906. preserve
  34907. ) {
  34908. if (isDef(hash)) {
  34909. if (hasOwn(hash, key)) {
  34910. res[key] = hash[key];
  34911. if (!preserve) {
  34912. delete hash[key];
  34913. }
  34914. return true
  34915. } else if (hasOwn(hash, altKey)) {
  34916. res[key] = hash[altKey];
  34917. if (!preserve) {
  34918. delete hash[altKey];
  34919. }
  34920. return true
  34921. }
  34922. }
  34923. return false
  34924. }
  34925. /* */
  34926. // The template compiler attempts to minimize the need for normalization by
  34927. // statically analyzing the template at compile time.
  34928. //
  34929. // For plain HTML markup, normalization can be completely skipped because the
  34930. // generated render function is guaranteed to return Array<VNode>. There are
  34931. // two cases where extra normalization is needed:
  34932. // 1. When the children contains components - because a functional component
  34933. // may return an Array instead of a single root. In this case, just a simple
  34934. // normalization is needed - if any child is an Array, we flatten the whole
  34935. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  34936. // because functional components already normalize their own children.
  34937. function simpleNormalizeChildren (children) {
  34938. for (var i = 0; i < children.length; i++) {
  34939. if (Array.isArray(children[i])) {
  34940. return Array.prototype.concat.apply([], children)
  34941. }
  34942. }
  34943. return children
  34944. }
  34945. // 2. When the children contains constructs that always generated nested Arrays,
  34946. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  34947. // with hand-written render functions / JSX. In such cases a full normalization
  34948. // is needed to cater to all possible types of children values.
  34949. function normalizeChildren (children) {
  34950. return isPrimitive(children)
  34951. ? [createTextVNode(children)]
  34952. : Array.isArray(children)
  34953. ? normalizeArrayChildren(children)
  34954. : undefined
  34955. }
  34956. function isTextNode (node) {
  34957. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  34958. }
  34959. function normalizeArrayChildren (children, nestedIndex) {
  34960. var res = [];
  34961. var i, c, lastIndex, last;
  34962. for (i = 0; i < children.length; i++) {
  34963. c = children[i];
  34964. if (isUndef(c) || typeof c === 'boolean') { continue }
  34965. lastIndex = res.length - 1;
  34966. last = res[lastIndex];
  34967. // nested
  34968. if (Array.isArray(c)) {
  34969. if (c.length > 0) {
  34970. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  34971. // merge adjacent text nodes
  34972. if (isTextNode(c[0]) && isTextNode(last)) {
  34973. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  34974. c.shift();
  34975. }
  34976. res.push.apply(res, c);
  34977. }
  34978. } else if (isPrimitive(c)) {
  34979. if (isTextNode(last)) {
  34980. // merge adjacent text nodes
  34981. // this is necessary for SSR hydration because text nodes are
  34982. // essentially merged when rendered to HTML strings
  34983. res[lastIndex] = createTextVNode(last.text + c);
  34984. } else if (c !== '') {
  34985. // convert primitive to vnode
  34986. res.push(createTextVNode(c));
  34987. }
  34988. } else {
  34989. if (isTextNode(c) && isTextNode(last)) {
  34990. // merge adjacent text nodes
  34991. res[lastIndex] = createTextVNode(last.text + c.text);
  34992. } else {
  34993. // default key for nested array children (likely generated by v-for)
  34994. if (isTrue(children._isVList) &&
  34995. isDef(c.tag) &&
  34996. isUndef(c.key) &&
  34997. isDef(nestedIndex)) {
  34998. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  34999. }
  35000. res.push(c);
  35001. }
  35002. }
  35003. }
  35004. return res
  35005. }
  35006. /* */
  35007. function initProvide (vm) {
  35008. var provide = vm.$options.provide;
  35009. if (provide) {
  35010. vm._provided = typeof provide === 'function'
  35011. ? provide.call(vm)
  35012. : provide;
  35013. }
  35014. }
  35015. function initInjections (vm) {
  35016. var result = resolveInject(vm.$options.inject, vm);
  35017. if (result) {
  35018. toggleObserving(false);
  35019. Object.keys(result).forEach(function (key) {
  35020. /* istanbul ignore else */
  35021. {
  35022. defineReactive$$1(vm, key, result[key], function () {
  35023. warn(
  35024. "Avoid mutating an injected value directly since the changes will be " +
  35025. "overwritten whenever the provided component re-renders. " +
  35026. "injection being mutated: \"" + key + "\"",
  35027. vm
  35028. );
  35029. });
  35030. }
  35031. });
  35032. toggleObserving(true);
  35033. }
  35034. }
  35035. function resolveInject (inject, vm) {
  35036. if (inject) {
  35037. // inject is :any because flow is not smart enough to figure out cached
  35038. var result = Object.create(null);
  35039. var keys = hasSymbol
  35040. ? Reflect.ownKeys(inject)
  35041. : Object.keys(inject);
  35042. for (var i = 0; i < keys.length; i++) {
  35043. var key = keys[i];
  35044. // #6574 in case the inject object is observed...
  35045. if (key === '__ob__') { continue }
  35046. var provideKey = inject[key].from;
  35047. var source = vm;
  35048. while (source) {
  35049. if (source._provided && hasOwn(source._provided, provideKey)) {
  35050. result[key] = source._provided[provideKey];
  35051. break
  35052. }
  35053. source = source.$parent;
  35054. }
  35055. if (!source) {
  35056. if ('default' in inject[key]) {
  35057. var provideDefault = inject[key].default;
  35058. result[key] = typeof provideDefault === 'function'
  35059. ? provideDefault.call(vm)
  35060. : provideDefault;
  35061. } else {
  35062. warn(("Injection \"" + key + "\" not found"), vm);
  35063. }
  35064. }
  35065. }
  35066. return result
  35067. }
  35068. }
  35069. /* */
  35070. /**
  35071. * Runtime helper for resolving raw children VNodes into a slot object.
  35072. */
  35073. function resolveSlots (
  35074. children,
  35075. context
  35076. ) {
  35077. if (!children || !children.length) {
  35078. return {}
  35079. }
  35080. var slots = {};
  35081. for (var i = 0, l = children.length; i < l; i++) {
  35082. var child = children[i];
  35083. var data = child.data;
  35084. // remove slot attribute if the node is resolved as a Vue slot node
  35085. if (data && data.attrs && data.attrs.slot) {
  35086. delete data.attrs.slot;
  35087. }
  35088. // named slots should only be respected if the vnode was rendered in the
  35089. // same context.
  35090. if ((child.context === context || child.fnContext === context) &&
  35091. data && data.slot != null
  35092. ) {
  35093. var name = data.slot;
  35094. var slot = (slots[name] || (slots[name] = []));
  35095. if (child.tag === 'template') {
  35096. slot.push.apply(slot, child.children || []);
  35097. } else {
  35098. slot.push(child);
  35099. }
  35100. } else {
  35101. (slots.default || (slots.default = [])).push(child);
  35102. }
  35103. }
  35104. // ignore slots that contains only whitespace
  35105. for (var name$1 in slots) {
  35106. if (slots[name$1].every(isWhitespace)) {
  35107. delete slots[name$1];
  35108. }
  35109. }
  35110. return slots
  35111. }
  35112. function isWhitespace (node) {
  35113. return (node.isComment && !node.asyncFactory) || node.text === ' '
  35114. }
  35115. /* */
  35116. function normalizeScopedSlots (
  35117. slots,
  35118. normalSlots,
  35119. prevSlots
  35120. ) {
  35121. var res;
  35122. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  35123. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  35124. var key = slots && slots.$key;
  35125. if (!slots) {
  35126. res = {};
  35127. } else if (slots._normalized) {
  35128. // fast path 1: child component re-render only, parent did not change
  35129. return slots._normalized
  35130. } else if (
  35131. isStable &&
  35132. prevSlots &&
  35133. prevSlots !== emptyObject &&
  35134. key === prevSlots.$key &&
  35135. !hasNormalSlots &&
  35136. !prevSlots.$hasNormal
  35137. ) {
  35138. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  35139. // only need to normalize once
  35140. return prevSlots
  35141. } else {
  35142. res = {};
  35143. for (var key$1 in slots) {
  35144. if (slots[key$1] && key$1[0] !== '$') {
  35145. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  35146. }
  35147. }
  35148. }
  35149. // expose normal slots on scopedSlots
  35150. for (var key$2 in normalSlots) {
  35151. if (!(key$2 in res)) {
  35152. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  35153. }
  35154. }
  35155. // avoriaz seems to mock a non-extensible $scopedSlots object
  35156. // and when that is passed down this would cause an error
  35157. if (slots && Object.isExtensible(slots)) {
  35158. (slots)._normalized = res;
  35159. }
  35160. def(res, '$stable', isStable);
  35161. def(res, '$key', key);
  35162. def(res, '$hasNormal', hasNormalSlots);
  35163. return res
  35164. }
  35165. function normalizeScopedSlot(normalSlots, key, fn) {
  35166. var normalized = function () {
  35167. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  35168. res = res && typeof res === 'object' && !Array.isArray(res)
  35169. ? [res] // single vnode
  35170. : normalizeChildren(res);
  35171. return res && (
  35172. res.length === 0 ||
  35173. (res.length === 1 && res[0].isComment) // #9658
  35174. ) ? undefined
  35175. : res
  35176. };
  35177. // this is a slot using the new v-slot syntax without scope. although it is
  35178. // compiled as a scoped slot, render fn users would expect it to be present
  35179. // on this.$slots because the usage is semantically a normal slot.
  35180. if (fn.proxy) {
  35181. Object.defineProperty(normalSlots, key, {
  35182. get: normalized,
  35183. enumerable: true,
  35184. configurable: true
  35185. });
  35186. }
  35187. return normalized
  35188. }
  35189. function proxyNormalSlot(slots, key) {
  35190. return function () { return slots[key]; }
  35191. }
  35192. /* */
  35193. /**
  35194. * Runtime helper for rendering v-for lists.
  35195. */
  35196. function renderList (
  35197. val,
  35198. render
  35199. ) {
  35200. var ret, i, l, keys, key;
  35201. if (Array.isArray(val) || typeof val === 'string') {
  35202. ret = new Array(val.length);
  35203. for (i = 0, l = val.length; i < l; i++) {
  35204. ret[i] = render(val[i], i);
  35205. }
  35206. } else if (typeof val === 'number') {
  35207. ret = new Array(val);
  35208. for (i = 0; i < val; i++) {
  35209. ret[i] = render(i + 1, i);
  35210. }
  35211. } else if (isObject(val)) {
  35212. if (hasSymbol && val[Symbol.iterator]) {
  35213. ret = [];
  35214. var iterator = val[Symbol.iterator]();
  35215. var result = iterator.next();
  35216. while (!result.done) {
  35217. ret.push(render(result.value, ret.length));
  35218. result = iterator.next();
  35219. }
  35220. } else {
  35221. keys = Object.keys(val);
  35222. ret = new Array(keys.length);
  35223. for (i = 0, l = keys.length; i < l; i++) {
  35224. key = keys[i];
  35225. ret[i] = render(val[key], key, i);
  35226. }
  35227. }
  35228. }
  35229. if (!isDef(ret)) {
  35230. ret = [];
  35231. }
  35232. (ret)._isVList = true;
  35233. return ret
  35234. }
  35235. /* */
  35236. /**
  35237. * Runtime helper for rendering <slot>
  35238. */
  35239. function renderSlot (
  35240. name,
  35241. fallback,
  35242. props,
  35243. bindObject
  35244. ) {
  35245. var scopedSlotFn = this.$scopedSlots[name];
  35246. var nodes;
  35247. if (scopedSlotFn) { // scoped slot
  35248. props = props || {};
  35249. if (bindObject) {
  35250. if (!isObject(bindObject)) {
  35251. warn(
  35252. 'slot v-bind without argument expects an Object',
  35253. this
  35254. );
  35255. }
  35256. props = extend(extend({}, bindObject), props);
  35257. }
  35258. nodes = scopedSlotFn(props) || fallback;
  35259. } else {
  35260. nodes = this.$slots[name] || fallback;
  35261. }
  35262. var target = props && props.slot;
  35263. if (target) {
  35264. return this.$createElement('template', { slot: target }, nodes)
  35265. } else {
  35266. return nodes
  35267. }
  35268. }
  35269. /* */
  35270. /**
  35271. * Runtime helper for resolving filters
  35272. */
  35273. function resolveFilter (id) {
  35274. return resolveAsset(this.$options, 'filters', id, true) || identity
  35275. }
  35276. /* */
  35277. function isKeyNotMatch (expect, actual) {
  35278. if (Array.isArray(expect)) {
  35279. return expect.indexOf(actual) === -1
  35280. } else {
  35281. return expect !== actual
  35282. }
  35283. }
  35284. /**
  35285. * Runtime helper for checking keyCodes from config.
  35286. * exposed as Vue.prototype._k
  35287. * passing in eventKeyName as last argument separately for backwards compat
  35288. */
  35289. function checkKeyCodes (
  35290. eventKeyCode,
  35291. key,
  35292. builtInKeyCode,
  35293. eventKeyName,
  35294. builtInKeyName
  35295. ) {
  35296. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  35297. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  35298. return isKeyNotMatch(builtInKeyName, eventKeyName)
  35299. } else if (mappedKeyCode) {
  35300. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  35301. } else if (eventKeyName) {
  35302. return hyphenate(eventKeyName) !== key
  35303. }
  35304. }
  35305. /* */
  35306. /**
  35307. * Runtime helper for merging v-bind="object" into a VNode's data.
  35308. */
  35309. function bindObjectProps (
  35310. data,
  35311. tag,
  35312. value,
  35313. asProp,
  35314. isSync
  35315. ) {
  35316. if (value) {
  35317. if (!isObject(value)) {
  35318. warn(
  35319. 'v-bind without argument expects an Object or Array value',
  35320. this
  35321. );
  35322. } else {
  35323. if (Array.isArray(value)) {
  35324. value = toObject(value);
  35325. }
  35326. var hash;
  35327. var loop = function ( key ) {
  35328. if (
  35329. key === 'class' ||
  35330. key === 'style' ||
  35331. isReservedAttribute(key)
  35332. ) {
  35333. hash = data;
  35334. } else {
  35335. var type = data.attrs && data.attrs.type;
  35336. hash = asProp || config.mustUseProp(tag, type, key)
  35337. ? data.domProps || (data.domProps = {})
  35338. : data.attrs || (data.attrs = {});
  35339. }
  35340. var camelizedKey = camelize(key);
  35341. var hyphenatedKey = hyphenate(key);
  35342. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  35343. hash[key] = value[key];
  35344. if (isSync) {
  35345. var on = data.on || (data.on = {});
  35346. on[("update:" + key)] = function ($event) {
  35347. value[key] = $event;
  35348. };
  35349. }
  35350. }
  35351. };
  35352. for (var key in value) loop( key );
  35353. }
  35354. }
  35355. return data
  35356. }
  35357. /* */
  35358. /**
  35359. * Runtime helper for rendering static trees.
  35360. */
  35361. function renderStatic (
  35362. index,
  35363. isInFor
  35364. ) {
  35365. var cached = this._staticTrees || (this._staticTrees = []);
  35366. var tree = cached[index];
  35367. // if has already-rendered static tree and not inside v-for,
  35368. // we can reuse the same tree.
  35369. if (tree && !isInFor) {
  35370. return tree
  35371. }
  35372. // otherwise, render a fresh tree.
  35373. tree = cached[index] = this.$options.staticRenderFns[index].call(
  35374. this._renderProxy,
  35375. null,
  35376. this // for render fns generated for functional component templates
  35377. );
  35378. markStatic(tree, ("__static__" + index), false);
  35379. return tree
  35380. }
  35381. /**
  35382. * Runtime helper for v-once.
  35383. * Effectively it means marking the node as static with a unique key.
  35384. */
  35385. function markOnce (
  35386. tree,
  35387. index,
  35388. key
  35389. ) {
  35390. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  35391. return tree
  35392. }
  35393. function markStatic (
  35394. tree,
  35395. key,
  35396. isOnce
  35397. ) {
  35398. if (Array.isArray(tree)) {
  35399. for (var i = 0; i < tree.length; i++) {
  35400. if (tree[i] && typeof tree[i] !== 'string') {
  35401. markStaticNode(tree[i], (key + "_" + i), isOnce);
  35402. }
  35403. }
  35404. } else {
  35405. markStaticNode(tree, key, isOnce);
  35406. }
  35407. }
  35408. function markStaticNode (node, key, isOnce) {
  35409. node.isStatic = true;
  35410. node.key = key;
  35411. node.isOnce = isOnce;
  35412. }
  35413. /* */
  35414. function bindObjectListeners (data, value) {
  35415. if (value) {
  35416. if (!isPlainObject(value)) {
  35417. warn(
  35418. 'v-on without argument expects an Object value',
  35419. this
  35420. );
  35421. } else {
  35422. var on = data.on = data.on ? extend({}, data.on) : {};
  35423. for (var key in value) {
  35424. var existing = on[key];
  35425. var ours = value[key];
  35426. on[key] = existing ? [].concat(existing, ours) : ours;
  35427. }
  35428. }
  35429. }
  35430. return data
  35431. }
  35432. /* */
  35433. function resolveScopedSlots (
  35434. fns, // see flow/vnode
  35435. res,
  35436. // the following are added in 2.6
  35437. hasDynamicKeys,
  35438. contentHashKey
  35439. ) {
  35440. res = res || { $stable: !hasDynamicKeys };
  35441. for (var i = 0; i < fns.length; i++) {
  35442. var slot = fns[i];
  35443. if (Array.isArray(slot)) {
  35444. resolveScopedSlots(slot, res, hasDynamicKeys);
  35445. } else if (slot) {
  35446. // marker for reverse proxying v-slot without scope on this.$slots
  35447. if (slot.proxy) {
  35448. slot.fn.proxy = true;
  35449. }
  35450. res[slot.key] = slot.fn;
  35451. }
  35452. }
  35453. if (contentHashKey) {
  35454. (res).$key = contentHashKey;
  35455. }
  35456. return res
  35457. }
  35458. /* */
  35459. function bindDynamicKeys (baseObj, values) {
  35460. for (var i = 0; i < values.length; i += 2) {
  35461. var key = values[i];
  35462. if (typeof key === 'string' && key) {
  35463. baseObj[values[i]] = values[i + 1];
  35464. } else if (key !== '' && key !== null) {
  35465. // null is a special value for explicitly removing a binding
  35466. warn(
  35467. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  35468. this
  35469. );
  35470. }
  35471. }
  35472. return baseObj
  35473. }
  35474. // helper to dynamically append modifier runtime markers to event names.
  35475. // ensure only append when value is already string, otherwise it will be cast
  35476. // to string and cause the type check to miss.
  35477. function prependModifier (value, symbol) {
  35478. return typeof value === 'string' ? symbol + value : value
  35479. }
  35480. /* */
  35481. function installRenderHelpers (target) {
  35482. target._o = markOnce;
  35483. target._n = toNumber;
  35484. target._s = toString;
  35485. target._l = renderList;
  35486. target._t = renderSlot;
  35487. target._q = looseEqual;
  35488. target._i = looseIndexOf;
  35489. target._m = renderStatic;
  35490. target._f = resolveFilter;
  35491. target._k = checkKeyCodes;
  35492. target._b = bindObjectProps;
  35493. target._v = createTextVNode;
  35494. target._e = createEmptyVNode;
  35495. target._u = resolveScopedSlots;
  35496. target._g = bindObjectListeners;
  35497. target._d = bindDynamicKeys;
  35498. target._p = prependModifier;
  35499. }
  35500. /* */
  35501. function FunctionalRenderContext (
  35502. data,
  35503. props,
  35504. children,
  35505. parent,
  35506. Ctor
  35507. ) {
  35508. var this$1 = this;
  35509. var options = Ctor.options;
  35510. // ensure the createElement function in functional components
  35511. // gets a unique context - this is necessary for correct named slot check
  35512. var contextVm;
  35513. if (hasOwn(parent, '_uid')) {
  35514. contextVm = Object.create(parent);
  35515. // $flow-disable-line
  35516. contextVm._original = parent;
  35517. } else {
  35518. // the context vm passed in is a functional context as well.
  35519. // in this case we want to make sure we are able to get a hold to the
  35520. // real context instance.
  35521. contextVm = parent;
  35522. // $flow-disable-line
  35523. parent = parent._original;
  35524. }
  35525. var isCompiled = isTrue(options._compiled);
  35526. var needNormalization = !isCompiled;
  35527. this.data = data;
  35528. this.props = props;
  35529. this.children = children;
  35530. this.parent = parent;
  35531. this.listeners = data.on || emptyObject;
  35532. this.injections = resolveInject(options.inject, parent);
  35533. this.slots = function () {
  35534. if (!this$1.$slots) {
  35535. normalizeScopedSlots(
  35536. data.scopedSlots,
  35537. this$1.$slots = resolveSlots(children, parent)
  35538. );
  35539. }
  35540. return this$1.$slots
  35541. };
  35542. Object.defineProperty(this, 'scopedSlots', ({
  35543. enumerable: true,
  35544. get: function get () {
  35545. return normalizeScopedSlots(data.scopedSlots, this.slots())
  35546. }
  35547. }));
  35548. // support for compiled functional template
  35549. if (isCompiled) {
  35550. // exposing $options for renderStatic()
  35551. this.$options = options;
  35552. // pre-resolve slots for renderSlot()
  35553. this.$slots = this.slots();
  35554. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  35555. }
  35556. if (options._scopeId) {
  35557. this._c = function (a, b, c, d) {
  35558. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  35559. if (vnode && !Array.isArray(vnode)) {
  35560. vnode.fnScopeId = options._scopeId;
  35561. vnode.fnContext = parent;
  35562. }
  35563. return vnode
  35564. };
  35565. } else {
  35566. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  35567. }
  35568. }
  35569. installRenderHelpers(FunctionalRenderContext.prototype);
  35570. function createFunctionalComponent (
  35571. Ctor,
  35572. propsData,
  35573. data,
  35574. contextVm,
  35575. children
  35576. ) {
  35577. var options = Ctor.options;
  35578. var props = {};
  35579. var propOptions = options.props;
  35580. if (isDef(propOptions)) {
  35581. for (var key in propOptions) {
  35582. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  35583. }
  35584. } else {
  35585. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  35586. if (isDef(data.props)) { mergeProps(props, data.props); }
  35587. }
  35588. var renderContext = new FunctionalRenderContext(
  35589. data,
  35590. props,
  35591. children,
  35592. contextVm,
  35593. Ctor
  35594. );
  35595. var vnode = options.render.call(null, renderContext._c, renderContext);
  35596. if (vnode instanceof VNode) {
  35597. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  35598. } else if (Array.isArray(vnode)) {
  35599. var vnodes = normalizeChildren(vnode) || [];
  35600. var res = new Array(vnodes.length);
  35601. for (var i = 0; i < vnodes.length; i++) {
  35602. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  35603. }
  35604. return res
  35605. }
  35606. }
  35607. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  35608. // #7817 clone node before setting fnContext, otherwise if the node is reused
  35609. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  35610. // that should not be matched to match.
  35611. var clone = cloneVNode(vnode);
  35612. clone.fnContext = contextVm;
  35613. clone.fnOptions = options;
  35614. {
  35615. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  35616. }
  35617. if (data.slot) {
  35618. (clone.data || (clone.data = {})).slot = data.slot;
  35619. }
  35620. return clone
  35621. }
  35622. function mergeProps (to, from) {
  35623. for (var key in from) {
  35624. to[camelize(key)] = from[key];
  35625. }
  35626. }
  35627. /* */
  35628. /* */
  35629. /* */
  35630. /* */
  35631. // inline hooks to be invoked on component VNodes during patch
  35632. var componentVNodeHooks = {
  35633. init: function init (vnode, hydrating) {
  35634. if (
  35635. vnode.componentInstance &&
  35636. !vnode.componentInstance._isDestroyed &&
  35637. vnode.data.keepAlive
  35638. ) {
  35639. // kept-alive components, treat as a patch
  35640. var mountedNode = vnode; // work around flow
  35641. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  35642. } else {
  35643. var child = vnode.componentInstance = createComponentInstanceForVnode(
  35644. vnode,
  35645. activeInstance
  35646. );
  35647. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  35648. }
  35649. },
  35650. prepatch: function prepatch (oldVnode, vnode) {
  35651. var options = vnode.componentOptions;
  35652. var child = vnode.componentInstance = oldVnode.componentInstance;
  35653. updateChildComponent(
  35654. child,
  35655. options.propsData, // updated props
  35656. options.listeners, // updated listeners
  35657. vnode, // new parent vnode
  35658. options.children // new children
  35659. );
  35660. },
  35661. insert: function insert (vnode) {
  35662. var context = vnode.context;
  35663. var componentInstance = vnode.componentInstance;
  35664. if (!componentInstance._isMounted) {
  35665. componentInstance._isMounted = true;
  35666. callHook(componentInstance, 'mounted');
  35667. }
  35668. if (vnode.data.keepAlive) {
  35669. if (context._isMounted) {
  35670. // vue-router#1212
  35671. // During updates, a kept-alive component's child components may
  35672. // change, so directly walking the tree here may call activated hooks
  35673. // on incorrect children. Instead we push them into a queue which will
  35674. // be processed after the whole patch process ended.
  35675. queueActivatedComponent(componentInstance);
  35676. } else {
  35677. activateChildComponent(componentInstance, true /* direct */);
  35678. }
  35679. }
  35680. },
  35681. destroy: function destroy (vnode) {
  35682. var componentInstance = vnode.componentInstance;
  35683. if (!componentInstance._isDestroyed) {
  35684. if (!vnode.data.keepAlive) {
  35685. componentInstance.$destroy();
  35686. } else {
  35687. deactivateChildComponent(componentInstance, true /* direct */);
  35688. }
  35689. }
  35690. }
  35691. };
  35692. var hooksToMerge = Object.keys(componentVNodeHooks);
  35693. function createComponent (
  35694. Ctor,
  35695. data,
  35696. context,
  35697. children,
  35698. tag
  35699. ) {
  35700. if (isUndef(Ctor)) {
  35701. return
  35702. }
  35703. var baseCtor = context.$options._base;
  35704. // plain options object: turn it into a constructor
  35705. if (isObject(Ctor)) {
  35706. Ctor = baseCtor.extend(Ctor);
  35707. }
  35708. // if at this stage it's not a constructor or an async component factory,
  35709. // reject.
  35710. if (typeof Ctor !== 'function') {
  35711. {
  35712. warn(("Invalid Component definition: " + (String(Ctor))), context);
  35713. }
  35714. return
  35715. }
  35716. // async component
  35717. var asyncFactory;
  35718. if (isUndef(Ctor.cid)) {
  35719. asyncFactory = Ctor;
  35720. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  35721. if (Ctor === undefined) {
  35722. // return a placeholder node for async component, which is rendered
  35723. // as a comment node but preserves all the raw information for the node.
  35724. // the information will be used for async server-rendering and hydration.
  35725. return createAsyncPlaceholder(
  35726. asyncFactory,
  35727. data,
  35728. context,
  35729. children,
  35730. tag
  35731. )
  35732. }
  35733. }
  35734. data = data || {};
  35735. // resolve constructor options in case global mixins are applied after
  35736. // component constructor creation
  35737. resolveConstructorOptions(Ctor);
  35738. // transform component v-model data into props & events
  35739. if (isDef(data.model)) {
  35740. transformModel(Ctor.options, data);
  35741. }
  35742. // extract props
  35743. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  35744. // functional component
  35745. if (isTrue(Ctor.options.functional)) {
  35746. return createFunctionalComponent(Ctor, propsData, data, context, children)
  35747. }
  35748. // extract listeners, since these needs to be treated as
  35749. // child component listeners instead of DOM listeners
  35750. var listeners = data.on;
  35751. // replace with listeners with .native modifier
  35752. // so it gets processed during parent component patch.
  35753. data.on = data.nativeOn;
  35754. if (isTrue(Ctor.options.abstract)) {
  35755. // abstract components do not keep anything
  35756. // other than props & listeners & slot
  35757. // work around flow
  35758. var slot = data.slot;
  35759. data = {};
  35760. if (slot) {
  35761. data.slot = slot;
  35762. }
  35763. }
  35764. // install component management hooks onto the placeholder node
  35765. installComponentHooks(data);
  35766. // return a placeholder vnode
  35767. var name = Ctor.options.name || tag;
  35768. var vnode = new VNode(
  35769. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  35770. data, undefined, undefined, undefined, context,
  35771. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  35772. asyncFactory
  35773. );
  35774. return vnode
  35775. }
  35776. function createComponentInstanceForVnode (
  35777. vnode, // we know it's MountedComponentVNode but flow doesn't
  35778. parent // activeInstance in lifecycle state
  35779. ) {
  35780. var options = {
  35781. _isComponent: true,
  35782. _parentVnode: vnode,
  35783. parent: parent
  35784. };
  35785. // check inline-template render functions
  35786. var inlineTemplate = vnode.data.inlineTemplate;
  35787. if (isDef(inlineTemplate)) {
  35788. options.render = inlineTemplate.render;
  35789. options.staticRenderFns = inlineTemplate.staticRenderFns;
  35790. }
  35791. return new vnode.componentOptions.Ctor(options)
  35792. }
  35793. function installComponentHooks (data) {
  35794. var hooks = data.hook || (data.hook = {});
  35795. for (var i = 0; i < hooksToMerge.length; i++) {
  35796. var key = hooksToMerge[i];
  35797. var existing = hooks[key];
  35798. var toMerge = componentVNodeHooks[key];
  35799. if (existing !== toMerge && !(existing && existing._merged)) {
  35800. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  35801. }
  35802. }
  35803. }
  35804. function mergeHook$1 (f1, f2) {
  35805. var merged = function (a, b) {
  35806. // flow complains about extra args which is why we use any
  35807. f1(a, b);
  35808. f2(a, b);
  35809. };
  35810. merged._merged = true;
  35811. return merged
  35812. }
  35813. // transform component v-model info (value and callback) into
  35814. // prop and event handler respectively.
  35815. function transformModel (options, data) {
  35816. var prop = (options.model && options.model.prop) || 'value';
  35817. var event = (options.model && options.model.event) || 'input'
  35818. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  35819. var on = data.on || (data.on = {});
  35820. var existing = on[event];
  35821. var callback = data.model.callback;
  35822. if (isDef(existing)) {
  35823. if (
  35824. Array.isArray(existing)
  35825. ? existing.indexOf(callback) === -1
  35826. : existing !== callback
  35827. ) {
  35828. on[event] = [callback].concat(existing);
  35829. }
  35830. } else {
  35831. on[event] = callback;
  35832. }
  35833. }
  35834. /* */
  35835. var SIMPLE_NORMALIZE = 1;
  35836. var ALWAYS_NORMALIZE = 2;
  35837. // wrapper function for providing a more flexible interface
  35838. // without getting yelled at by flow
  35839. function createElement (
  35840. context,
  35841. tag,
  35842. data,
  35843. children,
  35844. normalizationType,
  35845. alwaysNormalize
  35846. ) {
  35847. if (Array.isArray(data) || isPrimitive(data)) {
  35848. normalizationType = children;
  35849. children = data;
  35850. data = undefined;
  35851. }
  35852. if (isTrue(alwaysNormalize)) {
  35853. normalizationType = ALWAYS_NORMALIZE;
  35854. }
  35855. return _createElement(context, tag, data, children, normalizationType)
  35856. }
  35857. function _createElement (
  35858. context,
  35859. tag,
  35860. data,
  35861. children,
  35862. normalizationType
  35863. ) {
  35864. if (isDef(data) && isDef((data).__ob__)) {
  35865. warn(
  35866. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  35867. 'Always create fresh vnode data objects in each render!',
  35868. context
  35869. );
  35870. return createEmptyVNode()
  35871. }
  35872. // object syntax in v-bind
  35873. if (isDef(data) && isDef(data.is)) {
  35874. tag = data.is;
  35875. }
  35876. if (!tag) {
  35877. // in case of component :is set to falsy value
  35878. return createEmptyVNode()
  35879. }
  35880. // warn against non-primitive key
  35881. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  35882. ) {
  35883. {
  35884. warn(
  35885. 'Avoid using non-primitive value as key, ' +
  35886. 'use string/number value instead.',
  35887. context
  35888. );
  35889. }
  35890. }
  35891. // support single function children as default scoped slot
  35892. if (Array.isArray(children) &&
  35893. typeof children[0] === 'function'
  35894. ) {
  35895. data = data || {};
  35896. data.scopedSlots = { default: children[0] };
  35897. children.length = 0;
  35898. }
  35899. if (normalizationType === ALWAYS_NORMALIZE) {
  35900. children = normalizeChildren(children);
  35901. } else if (normalizationType === SIMPLE_NORMALIZE) {
  35902. children = simpleNormalizeChildren(children);
  35903. }
  35904. var vnode, ns;
  35905. if (typeof tag === 'string') {
  35906. var Ctor;
  35907. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  35908. if (config.isReservedTag(tag)) {
  35909. // platform built-in elements
  35910. if (isDef(data) && isDef(data.nativeOn)) {
  35911. warn(
  35912. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  35913. context
  35914. );
  35915. }
  35916. vnode = new VNode(
  35917. config.parsePlatformTagName(tag), data, children,
  35918. undefined, undefined, context
  35919. );
  35920. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  35921. // component
  35922. vnode = createComponent(Ctor, data, context, children, tag);
  35923. } else {
  35924. // unknown or unlisted namespaced elements
  35925. // check at runtime because it may get assigned a namespace when its
  35926. // parent normalizes children
  35927. vnode = new VNode(
  35928. tag, data, children,
  35929. undefined, undefined, context
  35930. );
  35931. }
  35932. } else {
  35933. // direct component options / constructor
  35934. vnode = createComponent(tag, data, context, children);
  35935. }
  35936. if (Array.isArray(vnode)) {
  35937. return vnode
  35938. } else if (isDef(vnode)) {
  35939. if (isDef(ns)) { applyNS(vnode, ns); }
  35940. if (isDef(data)) { registerDeepBindings(data); }
  35941. return vnode
  35942. } else {
  35943. return createEmptyVNode()
  35944. }
  35945. }
  35946. function applyNS (vnode, ns, force) {
  35947. vnode.ns = ns;
  35948. if (vnode.tag === 'foreignObject') {
  35949. // use default namespace inside foreignObject
  35950. ns = undefined;
  35951. force = true;
  35952. }
  35953. if (isDef(vnode.children)) {
  35954. for (var i = 0, l = vnode.children.length; i < l; i++) {
  35955. var child = vnode.children[i];
  35956. if (isDef(child.tag) && (
  35957. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  35958. applyNS(child, ns, force);
  35959. }
  35960. }
  35961. }
  35962. }
  35963. // ref #5318
  35964. // necessary to ensure parent re-render when deep bindings like :style and
  35965. // :class are used on slot nodes
  35966. function registerDeepBindings (data) {
  35967. if (isObject(data.style)) {
  35968. traverse(data.style);
  35969. }
  35970. if (isObject(data.class)) {
  35971. traverse(data.class);
  35972. }
  35973. }
  35974. /* */
  35975. function initRender (vm) {
  35976. vm._vnode = null; // the root of the child tree
  35977. vm._staticTrees = null; // v-once cached trees
  35978. var options = vm.$options;
  35979. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  35980. var renderContext = parentVnode && parentVnode.context;
  35981. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  35982. vm.$scopedSlots = emptyObject;
  35983. // bind the createElement fn to this instance
  35984. // so that we get proper render context inside it.
  35985. // args order: tag, data, children, normalizationType, alwaysNormalize
  35986. // internal version is used by render functions compiled from templates
  35987. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  35988. // normalization is always applied for the public version, used in
  35989. // user-written render functions.
  35990. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  35991. // $attrs & $listeners are exposed for easier HOC creation.
  35992. // they need to be reactive so that HOCs using them are always updated
  35993. var parentData = parentVnode && parentVnode.data;
  35994. /* istanbul ignore else */
  35995. {
  35996. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  35997. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  35998. }, true);
  35999. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  36000. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  36001. }, true);
  36002. }
  36003. }
  36004. var currentRenderingInstance = null;
  36005. function renderMixin (Vue) {
  36006. // install runtime convenience helpers
  36007. installRenderHelpers(Vue.prototype);
  36008. Vue.prototype.$nextTick = function (fn) {
  36009. return nextTick(fn, this)
  36010. };
  36011. Vue.prototype._render = function () {
  36012. var vm = this;
  36013. var ref = vm.$options;
  36014. var render = ref.render;
  36015. var _parentVnode = ref._parentVnode;
  36016. if (_parentVnode) {
  36017. vm.$scopedSlots = normalizeScopedSlots(
  36018. _parentVnode.data.scopedSlots,
  36019. vm.$slots,
  36020. vm.$scopedSlots
  36021. );
  36022. }
  36023. // set parent vnode. this allows render functions to have access
  36024. // to the data on the placeholder node.
  36025. vm.$vnode = _parentVnode;
  36026. // render self
  36027. var vnode;
  36028. try {
  36029. // There's no need to maintain a stack because all render fns are called
  36030. // separately from one another. Nested component's render fns are called
  36031. // when parent component is patched.
  36032. currentRenderingInstance = vm;
  36033. vnode = render.call(vm._renderProxy, vm.$createElement);
  36034. } catch (e) {
  36035. handleError(e, vm, "render");
  36036. // return error render result,
  36037. // or previous vnode to prevent render error causing blank component
  36038. /* istanbul ignore else */
  36039. if (vm.$options.renderError) {
  36040. try {
  36041. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  36042. } catch (e) {
  36043. handleError(e, vm, "renderError");
  36044. vnode = vm._vnode;
  36045. }
  36046. } else {
  36047. vnode = vm._vnode;
  36048. }
  36049. } finally {
  36050. currentRenderingInstance = null;
  36051. }
  36052. // if the returned array contains only a single node, allow it
  36053. if (Array.isArray(vnode) && vnode.length === 1) {
  36054. vnode = vnode[0];
  36055. }
  36056. // return empty vnode in case the render function errored out
  36057. if (!(vnode instanceof VNode)) {
  36058. if (Array.isArray(vnode)) {
  36059. warn(
  36060. 'Multiple root nodes returned from render function. Render function ' +
  36061. 'should return a single root node.',
  36062. vm
  36063. );
  36064. }
  36065. vnode = createEmptyVNode();
  36066. }
  36067. // set parent
  36068. vnode.parent = _parentVnode;
  36069. return vnode
  36070. };
  36071. }
  36072. /* */
  36073. function ensureCtor (comp, base) {
  36074. if (
  36075. comp.__esModule ||
  36076. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  36077. ) {
  36078. comp = comp.default;
  36079. }
  36080. return isObject(comp)
  36081. ? base.extend(comp)
  36082. : comp
  36083. }
  36084. function createAsyncPlaceholder (
  36085. factory,
  36086. data,
  36087. context,
  36088. children,
  36089. tag
  36090. ) {
  36091. var node = createEmptyVNode();
  36092. node.asyncFactory = factory;
  36093. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  36094. return node
  36095. }
  36096. function resolveAsyncComponent (
  36097. factory,
  36098. baseCtor
  36099. ) {
  36100. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  36101. return factory.errorComp
  36102. }
  36103. if (isDef(factory.resolved)) {
  36104. return factory.resolved
  36105. }
  36106. var owner = currentRenderingInstance;
  36107. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  36108. // already pending
  36109. factory.owners.push(owner);
  36110. }
  36111. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  36112. return factory.loadingComp
  36113. }
  36114. if (owner && !isDef(factory.owners)) {
  36115. var owners = factory.owners = [owner];
  36116. var sync = true;
  36117. var timerLoading = null;
  36118. var timerTimeout = null
  36119. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  36120. var forceRender = function (renderCompleted) {
  36121. for (var i = 0, l = owners.length; i < l; i++) {
  36122. (owners[i]).$forceUpdate();
  36123. }
  36124. if (renderCompleted) {
  36125. owners.length = 0;
  36126. if (timerLoading !== null) {
  36127. clearTimeout(timerLoading);
  36128. timerLoading = null;
  36129. }
  36130. if (timerTimeout !== null) {
  36131. clearTimeout(timerTimeout);
  36132. timerTimeout = null;
  36133. }
  36134. }
  36135. };
  36136. var resolve = once(function (res) {
  36137. // cache resolved
  36138. factory.resolved = ensureCtor(res, baseCtor);
  36139. // invoke callbacks only if this is not a synchronous resolve
  36140. // (async resolves are shimmed as synchronous during SSR)
  36141. if (!sync) {
  36142. forceRender(true);
  36143. } else {
  36144. owners.length = 0;
  36145. }
  36146. });
  36147. var reject = once(function (reason) {
  36148. warn(
  36149. "Failed to resolve async component: " + (String(factory)) +
  36150. (reason ? ("\nReason: " + reason) : '')
  36151. );
  36152. if (isDef(factory.errorComp)) {
  36153. factory.error = true;
  36154. forceRender(true);
  36155. }
  36156. });
  36157. var res = factory(resolve, reject);
  36158. if (isObject(res)) {
  36159. if (isPromise(res)) {
  36160. // () => Promise
  36161. if (isUndef(factory.resolved)) {
  36162. res.then(resolve, reject);
  36163. }
  36164. } else if (isPromise(res.component)) {
  36165. res.component.then(resolve, reject);
  36166. if (isDef(res.error)) {
  36167. factory.errorComp = ensureCtor(res.error, baseCtor);
  36168. }
  36169. if (isDef(res.loading)) {
  36170. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  36171. if (res.delay === 0) {
  36172. factory.loading = true;
  36173. } else {
  36174. timerLoading = setTimeout(function () {
  36175. timerLoading = null;
  36176. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  36177. factory.loading = true;
  36178. forceRender(false);
  36179. }
  36180. }, res.delay || 200);
  36181. }
  36182. }
  36183. if (isDef(res.timeout)) {
  36184. timerTimeout = setTimeout(function () {
  36185. timerTimeout = null;
  36186. if (isUndef(factory.resolved)) {
  36187. reject(
  36188. "timeout (" + (res.timeout) + "ms)"
  36189. );
  36190. }
  36191. }, res.timeout);
  36192. }
  36193. }
  36194. }
  36195. sync = false;
  36196. // return in case resolved synchronously
  36197. return factory.loading
  36198. ? factory.loadingComp
  36199. : factory.resolved
  36200. }
  36201. }
  36202. /* */
  36203. function isAsyncPlaceholder (node) {
  36204. return node.isComment && node.asyncFactory
  36205. }
  36206. /* */
  36207. function getFirstComponentChild (children) {
  36208. if (Array.isArray(children)) {
  36209. for (var i = 0; i < children.length; i++) {
  36210. var c = children[i];
  36211. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  36212. return c
  36213. }
  36214. }
  36215. }
  36216. }
  36217. /* */
  36218. /* */
  36219. function initEvents (vm) {
  36220. vm._events = Object.create(null);
  36221. vm._hasHookEvent = false;
  36222. // init parent attached events
  36223. var listeners = vm.$options._parentListeners;
  36224. if (listeners) {
  36225. updateComponentListeners(vm, listeners);
  36226. }
  36227. }
  36228. var target;
  36229. function add (event, fn) {
  36230. target.$on(event, fn);
  36231. }
  36232. function remove$1 (event, fn) {
  36233. target.$off(event, fn);
  36234. }
  36235. function createOnceHandler (event, fn) {
  36236. var _target = target;
  36237. return function onceHandler () {
  36238. var res = fn.apply(null, arguments);
  36239. if (res !== null) {
  36240. _target.$off(event, onceHandler);
  36241. }
  36242. }
  36243. }
  36244. function updateComponentListeners (
  36245. vm,
  36246. listeners,
  36247. oldListeners
  36248. ) {
  36249. target = vm;
  36250. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  36251. target = undefined;
  36252. }
  36253. function eventsMixin (Vue) {
  36254. var hookRE = /^hook:/;
  36255. Vue.prototype.$on = function (event, fn) {
  36256. var vm = this;
  36257. if (Array.isArray(event)) {
  36258. for (var i = 0, l = event.length; i < l; i++) {
  36259. vm.$on(event[i], fn);
  36260. }
  36261. } else {
  36262. (vm._events[event] || (vm._events[event] = [])).push(fn);
  36263. // optimize hook:event cost by using a boolean flag marked at registration
  36264. // instead of a hash lookup
  36265. if (hookRE.test(event)) {
  36266. vm._hasHookEvent = true;
  36267. }
  36268. }
  36269. return vm
  36270. };
  36271. Vue.prototype.$once = function (event, fn) {
  36272. var vm = this;
  36273. function on () {
  36274. vm.$off(event, on);
  36275. fn.apply(vm, arguments);
  36276. }
  36277. on.fn = fn;
  36278. vm.$on(event, on);
  36279. return vm
  36280. };
  36281. Vue.prototype.$off = function (event, fn) {
  36282. var vm = this;
  36283. // all
  36284. if (!arguments.length) {
  36285. vm._events = Object.create(null);
  36286. return vm
  36287. }
  36288. // array of events
  36289. if (Array.isArray(event)) {
  36290. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  36291. vm.$off(event[i$1], fn);
  36292. }
  36293. return vm
  36294. }
  36295. // specific event
  36296. var cbs = vm._events[event];
  36297. if (!cbs) {
  36298. return vm
  36299. }
  36300. if (!fn) {
  36301. vm._events[event] = null;
  36302. return vm
  36303. }
  36304. // specific handler
  36305. var cb;
  36306. var i = cbs.length;
  36307. while (i--) {
  36308. cb = cbs[i];
  36309. if (cb === fn || cb.fn === fn) {
  36310. cbs.splice(i, 1);
  36311. break
  36312. }
  36313. }
  36314. return vm
  36315. };
  36316. Vue.prototype.$emit = function (event) {
  36317. var vm = this;
  36318. {
  36319. var lowerCaseEvent = event.toLowerCase();
  36320. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  36321. tip(
  36322. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  36323. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  36324. "Note that HTML attributes are case-insensitive and you cannot use " +
  36325. "v-on to listen to camelCase events when using in-DOM templates. " +
  36326. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  36327. );
  36328. }
  36329. }
  36330. var cbs = vm._events[event];
  36331. if (cbs) {
  36332. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  36333. var args = toArray(arguments, 1);
  36334. var info = "event handler for \"" + event + "\"";
  36335. for (var i = 0, l = cbs.length; i < l; i++) {
  36336. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  36337. }
  36338. }
  36339. return vm
  36340. };
  36341. }
  36342. /* */
  36343. var activeInstance = null;
  36344. var isUpdatingChildComponent = false;
  36345. function setActiveInstance(vm) {
  36346. var prevActiveInstance = activeInstance;
  36347. activeInstance = vm;
  36348. return function () {
  36349. activeInstance = prevActiveInstance;
  36350. }
  36351. }
  36352. function initLifecycle (vm) {
  36353. var options = vm.$options;
  36354. // locate first non-abstract parent
  36355. var parent = options.parent;
  36356. if (parent && !options.abstract) {
  36357. while (parent.$options.abstract && parent.$parent) {
  36358. parent = parent.$parent;
  36359. }
  36360. parent.$children.push(vm);
  36361. }
  36362. vm.$parent = parent;
  36363. vm.$root = parent ? parent.$root : vm;
  36364. vm.$children = [];
  36365. vm.$refs = {};
  36366. vm._watcher = null;
  36367. vm._inactive = null;
  36368. vm._directInactive = false;
  36369. vm._isMounted = false;
  36370. vm._isDestroyed = false;
  36371. vm._isBeingDestroyed = false;
  36372. }
  36373. function lifecycleMixin (Vue) {
  36374. Vue.prototype._update = function (vnode, hydrating) {
  36375. var vm = this;
  36376. var prevEl = vm.$el;
  36377. var prevVnode = vm._vnode;
  36378. var restoreActiveInstance = setActiveInstance(vm);
  36379. vm._vnode = vnode;
  36380. // Vue.prototype.__patch__ is injected in entry points
  36381. // based on the rendering backend used.
  36382. if (!prevVnode) {
  36383. // initial render
  36384. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  36385. } else {
  36386. // updates
  36387. vm.$el = vm.__patch__(prevVnode, vnode);
  36388. }
  36389. restoreActiveInstance();
  36390. // update __vue__ reference
  36391. if (prevEl) {
  36392. prevEl.__vue__ = null;
  36393. }
  36394. if (vm.$el) {
  36395. vm.$el.__vue__ = vm;
  36396. }
  36397. // if parent is an HOC, update its $el as well
  36398. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  36399. vm.$parent.$el = vm.$el;
  36400. }
  36401. // updated hook is called by the scheduler to ensure that children are
  36402. // updated in a parent's updated hook.
  36403. };
  36404. Vue.prototype.$forceUpdate = function () {
  36405. var vm = this;
  36406. if (vm._watcher) {
  36407. vm._watcher.update();
  36408. }
  36409. };
  36410. Vue.prototype.$destroy = function () {
  36411. var vm = this;
  36412. if (vm._isBeingDestroyed) {
  36413. return
  36414. }
  36415. callHook(vm, 'beforeDestroy');
  36416. vm._isBeingDestroyed = true;
  36417. // remove self from parent
  36418. var parent = vm.$parent;
  36419. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  36420. remove(parent.$children, vm);
  36421. }
  36422. // teardown watchers
  36423. if (vm._watcher) {
  36424. vm._watcher.teardown();
  36425. }
  36426. var i = vm._watchers.length;
  36427. while (i--) {
  36428. vm._watchers[i].teardown();
  36429. }
  36430. // remove reference from data ob
  36431. // frozen object may not have observer.
  36432. if (vm._data.__ob__) {
  36433. vm._data.__ob__.vmCount--;
  36434. }
  36435. // call the last hook...
  36436. vm._isDestroyed = true;
  36437. // invoke destroy hooks on current rendered tree
  36438. vm.__patch__(vm._vnode, null);
  36439. // fire destroyed hook
  36440. callHook(vm, 'destroyed');
  36441. // turn off all instance listeners.
  36442. vm.$off();
  36443. // remove __vue__ reference
  36444. if (vm.$el) {
  36445. vm.$el.__vue__ = null;
  36446. }
  36447. // release circular reference (#6759)
  36448. if (vm.$vnode) {
  36449. vm.$vnode.parent = null;
  36450. }
  36451. };
  36452. }
  36453. function mountComponent (
  36454. vm,
  36455. el,
  36456. hydrating
  36457. ) {
  36458. vm.$el = el;
  36459. if (!vm.$options.render) {
  36460. vm.$options.render = createEmptyVNode;
  36461. {
  36462. /* istanbul ignore if */
  36463. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  36464. vm.$options.el || el) {
  36465. warn(
  36466. 'You are using the runtime-only build of Vue where the template ' +
  36467. 'compiler is not available. Either pre-compile the templates into ' +
  36468. 'render functions, or use the compiler-included build.',
  36469. vm
  36470. );
  36471. } else {
  36472. warn(
  36473. 'Failed to mount component: template or render function not defined.',
  36474. vm
  36475. );
  36476. }
  36477. }
  36478. }
  36479. callHook(vm, 'beforeMount');
  36480. var updateComponent;
  36481. /* istanbul ignore if */
  36482. if (config.performance && mark) {
  36483. updateComponent = function () {
  36484. var name = vm._name;
  36485. var id = vm._uid;
  36486. var startTag = "vue-perf-start:" + id;
  36487. var endTag = "vue-perf-end:" + id;
  36488. mark(startTag);
  36489. var vnode = vm._render();
  36490. mark(endTag);
  36491. measure(("vue " + name + " render"), startTag, endTag);
  36492. mark(startTag);
  36493. vm._update(vnode, hydrating);
  36494. mark(endTag);
  36495. measure(("vue " + name + " patch"), startTag, endTag);
  36496. };
  36497. } else {
  36498. updateComponent = function () {
  36499. vm._update(vm._render(), hydrating);
  36500. };
  36501. }
  36502. // we set this to vm._watcher inside the watcher's constructor
  36503. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  36504. // component's mounted hook), which relies on vm._watcher being already defined
  36505. new Watcher(vm, updateComponent, noop, {
  36506. before: function before () {
  36507. if (vm._isMounted && !vm._isDestroyed) {
  36508. callHook(vm, 'beforeUpdate');
  36509. }
  36510. }
  36511. }, true /* isRenderWatcher */);
  36512. hydrating = false;
  36513. // manually mounted instance, call mounted on self
  36514. // mounted is called for render-created child components in its inserted hook
  36515. if (vm.$vnode == null) {
  36516. vm._isMounted = true;
  36517. callHook(vm, 'mounted');
  36518. }
  36519. return vm
  36520. }
  36521. function updateChildComponent (
  36522. vm,
  36523. propsData,
  36524. listeners,
  36525. parentVnode,
  36526. renderChildren
  36527. ) {
  36528. {
  36529. isUpdatingChildComponent = true;
  36530. }
  36531. // determine whether component has slot children
  36532. // we need to do this before overwriting $options._renderChildren.
  36533. // check if there are dynamic scopedSlots (hand-written or compiled but with
  36534. // dynamic slot names). Static scoped slots compiled from template has the
  36535. // "$stable" marker.
  36536. var newScopedSlots = parentVnode.data.scopedSlots;
  36537. var oldScopedSlots = vm.$scopedSlots;
  36538. var hasDynamicScopedSlot = !!(
  36539. (newScopedSlots && !newScopedSlots.$stable) ||
  36540. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  36541. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  36542. );
  36543. // Any static slot children from the parent may have changed during parent's
  36544. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  36545. // update is necessary to ensure correctness.
  36546. var needsForceUpdate = !!(
  36547. renderChildren || // has new static slots
  36548. vm.$options._renderChildren || // has old static slots
  36549. hasDynamicScopedSlot
  36550. );
  36551. vm.$options._parentVnode = parentVnode;
  36552. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  36553. if (vm._vnode) { // update child tree's parent
  36554. vm._vnode.parent = parentVnode;
  36555. }
  36556. vm.$options._renderChildren = renderChildren;
  36557. // update $attrs and $listeners hash
  36558. // these are also reactive so they may trigger child update if the child
  36559. // used them during render
  36560. vm.$attrs = parentVnode.data.attrs || emptyObject;
  36561. vm.$listeners = listeners || emptyObject;
  36562. // update props
  36563. if (propsData && vm.$options.props) {
  36564. toggleObserving(false);
  36565. var props = vm._props;
  36566. var propKeys = vm.$options._propKeys || [];
  36567. for (var i = 0; i < propKeys.length; i++) {
  36568. var key = propKeys[i];
  36569. var propOptions = vm.$options.props; // wtf flow?
  36570. props[key] = validateProp(key, propOptions, propsData, vm);
  36571. }
  36572. toggleObserving(true);
  36573. // keep a copy of raw propsData
  36574. vm.$options.propsData = propsData;
  36575. }
  36576. // update listeners
  36577. listeners = listeners || emptyObject;
  36578. var oldListeners = vm.$options._parentListeners;
  36579. vm.$options._parentListeners = listeners;
  36580. updateComponentListeners(vm, listeners, oldListeners);
  36581. // resolve slots + force update if has children
  36582. if (needsForceUpdate) {
  36583. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  36584. vm.$forceUpdate();
  36585. }
  36586. {
  36587. isUpdatingChildComponent = false;
  36588. }
  36589. }
  36590. function isInInactiveTree (vm) {
  36591. while (vm && (vm = vm.$parent)) {
  36592. if (vm._inactive) { return true }
  36593. }
  36594. return false
  36595. }
  36596. function activateChildComponent (vm, direct) {
  36597. if (direct) {
  36598. vm._directInactive = false;
  36599. if (isInInactiveTree(vm)) {
  36600. return
  36601. }
  36602. } else if (vm._directInactive) {
  36603. return
  36604. }
  36605. if (vm._inactive || vm._inactive === null) {
  36606. vm._inactive = false;
  36607. for (var i = 0; i < vm.$children.length; i++) {
  36608. activateChildComponent(vm.$children[i]);
  36609. }
  36610. callHook(vm, 'activated');
  36611. }
  36612. }
  36613. function deactivateChildComponent (vm, direct) {
  36614. if (direct) {
  36615. vm._directInactive = true;
  36616. if (isInInactiveTree(vm)) {
  36617. return
  36618. }
  36619. }
  36620. if (!vm._inactive) {
  36621. vm._inactive = true;
  36622. for (var i = 0; i < vm.$children.length; i++) {
  36623. deactivateChildComponent(vm.$children[i]);
  36624. }
  36625. callHook(vm, 'deactivated');
  36626. }
  36627. }
  36628. function callHook (vm, hook) {
  36629. // #7573 disable dep collection when invoking lifecycle hooks
  36630. pushTarget();
  36631. var handlers = vm.$options[hook];
  36632. var info = hook + " hook";
  36633. if (handlers) {
  36634. for (var i = 0, j = handlers.length; i < j; i++) {
  36635. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  36636. }
  36637. }
  36638. if (vm._hasHookEvent) {
  36639. vm.$emit('hook:' + hook);
  36640. }
  36641. popTarget();
  36642. }
  36643. /* */
  36644. var MAX_UPDATE_COUNT = 100;
  36645. var queue = [];
  36646. var activatedChildren = [];
  36647. var has = {};
  36648. var circular = {};
  36649. var waiting = false;
  36650. var flushing = false;
  36651. var index = 0;
  36652. /**
  36653. * Reset the scheduler's state.
  36654. */
  36655. function resetSchedulerState () {
  36656. index = queue.length = activatedChildren.length = 0;
  36657. has = {};
  36658. {
  36659. circular = {};
  36660. }
  36661. waiting = flushing = false;
  36662. }
  36663. // Async edge case #6566 requires saving the timestamp when event listeners are
  36664. // attached. However, calling performance.now() has a perf overhead especially
  36665. // if the page has thousands of event listeners. Instead, we take a timestamp
  36666. // every time the scheduler flushes and use that for all event listeners
  36667. // attached during that flush.
  36668. var currentFlushTimestamp = 0;
  36669. // Async edge case fix requires storing an event listener's attach timestamp.
  36670. var getNow = Date.now;
  36671. // Determine what event timestamp the browser is using. Annoyingly, the
  36672. // timestamp can either be hi-res (relative to page load) or low-res
  36673. // (relative to UNIX epoch), so in order to compare time we have to use the
  36674. // same timestamp type when saving the flush timestamp.
  36675. // All IE versions use low-res event timestamps, and have problematic clock
  36676. // implementations (#9632)
  36677. if (inBrowser && !isIE) {
  36678. var performance = window.performance;
  36679. if (
  36680. performance &&
  36681. typeof performance.now === 'function' &&
  36682. getNow() > document.createEvent('Event').timeStamp
  36683. ) {
  36684. // if the event timestamp, although evaluated AFTER the Date.now(), is
  36685. // smaller than it, it means the event is using a hi-res timestamp,
  36686. // and we need to use the hi-res version for event listener timestamps as
  36687. // well.
  36688. getNow = function () { return performance.now(); };
  36689. }
  36690. }
  36691. /**
  36692. * Flush both queues and run the watchers.
  36693. */
  36694. function flushSchedulerQueue () {
  36695. currentFlushTimestamp = getNow();
  36696. flushing = true;
  36697. var watcher, id;
  36698. // Sort queue before flush.
  36699. // This ensures that:
  36700. // 1. Components are updated from parent to child. (because parent is always
  36701. // created before the child)
  36702. // 2. A component's user watchers are run before its render watcher (because
  36703. // user watchers are created before the render watcher)
  36704. // 3. If a component is destroyed during a parent component's watcher run,
  36705. // its watchers can be skipped.
  36706. queue.sort(function (a, b) { return a.id - b.id; });
  36707. // do not cache length because more watchers might be pushed
  36708. // as we run existing watchers
  36709. for (index = 0; index < queue.length; index++) {
  36710. watcher = queue[index];
  36711. if (watcher.before) {
  36712. watcher.before();
  36713. }
  36714. id = watcher.id;
  36715. has[id] = null;
  36716. watcher.run();
  36717. // in dev build, check and stop circular updates.
  36718. if (has[id] != null) {
  36719. circular[id] = (circular[id] || 0) + 1;
  36720. if (circular[id] > MAX_UPDATE_COUNT) {
  36721. warn(
  36722. 'You may have an infinite update loop ' + (
  36723. watcher.user
  36724. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  36725. : "in a component render function."
  36726. ),
  36727. watcher.vm
  36728. );
  36729. break
  36730. }
  36731. }
  36732. }
  36733. // keep copies of post queues before resetting state
  36734. var activatedQueue = activatedChildren.slice();
  36735. var updatedQueue = queue.slice();
  36736. resetSchedulerState();
  36737. // call component updated and activated hooks
  36738. callActivatedHooks(activatedQueue);
  36739. callUpdatedHooks(updatedQueue);
  36740. // devtool hook
  36741. /* istanbul ignore if */
  36742. if (devtools && config.devtools) {
  36743. devtools.emit('flush');
  36744. }
  36745. }
  36746. function callUpdatedHooks (queue) {
  36747. var i = queue.length;
  36748. while (i--) {
  36749. var watcher = queue[i];
  36750. var vm = watcher.vm;
  36751. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  36752. callHook(vm, 'updated');
  36753. }
  36754. }
  36755. }
  36756. /**
  36757. * Queue a kept-alive component that was activated during patch.
  36758. * The queue will be processed after the entire tree has been patched.
  36759. */
  36760. function queueActivatedComponent (vm) {
  36761. // setting _inactive to false here so that a render function can
  36762. // rely on checking whether it's in an inactive tree (e.g. router-view)
  36763. vm._inactive = false;
  36764. activatedChildren.push(vm);
  36765. }
  36766. function callActivatedHooks (queue) {
  36767. for (var i = 0; i < queue.length; i++) {
  36768. queue[i]._inactive = true;
  36769. activateChildComponent(queue[i], true /* true */);
  36770. }
  36771. }
  36772. /**
  36773. * Push a watcher into the watcher queue.
  36774. * Jobs with duplicate IDs will be skipped unless it's
  36775. * pushed when the queue is being flushed.
  36776. */
  36777. function queueWatcher (watcher) {
  36778. var id = watcher.id;
  36779. if (has[id] == null) {
  36780. has[id] = true;
  36781. if (!flushing) {
  36782. queue.push(watcher);
  36783. } else {
  36784. // if already flushing, splice the watcher based on its id
  36785. // if already past its id, it will be run next immediately.
  36786. var i = queue.length - 1;
  36787. while (i > index && queue[i].id > watcher.id) {
  36788. i--;
  36789. }
  36790. queue.splice(i + 1, 0, watcher);
  36791. }
  36792. // queue the flush
  36793. if (!waiting) {
  36794. waiting = true;
  36795. if (!config.async) {
  36796. flushSchedulerQueue();
  36797. return
  36798. }
  36799. nextTick(flushSchedulerQueue);
  36800. }
  36801. }
  36802. }
  36803. /* */
  36804. var uid$2 = 0;
  36805. /**
  36806. * A watcher parses an expression, collects dependencies,
  36807. * and fires callback when the expression value changes.
  36808. * This is used for both the $watch() api and directives.
  36809. */
  36810. var Watcher = function Watcher (
  36811. vm,
  36812. expOrFn,
  36813. cb,
  36814. options,
  36815. isRenderWatcher
  36816. ) {
  36817. this.vm = vm;
  36818. if (isRenderWatcher) {
  36819. vm._watcher = this;
  36820. }
  36821. vm._watchers.push(this);
  36822. // options
  36823. if (options) {
  36824. this.deep = !!options.deep;
  36825. this.user = !!options.user;
  36826. this.lazy = !!options.lazy;
  36827. this.sync = !!options.sync;
  36828. this.before = options.before;
  36829. } else {
  36830. this.deep = this.user = this.lazy = this.sync = false;
  36831. }
  36832. this.cb = cb;
  36833. this.id = ++uid$2; // uid for batching
  36834. this.active = true;
  36835. this.dirty = this.lazy; // for lazy watchers
  36836. this.deps = [];
  36837. this.newDeps = [];
  36838. this.depIds = new _Set();
  36839. this.newDepIds = new _Set();
  36840. this.expression = expOrFn.toString();
  36841. // parse expression for getter
  36842. if (typeof expOrFn === 'function') {
  36843. this.getter = expOrFn;
  36844. } else {
  36845. this.getter = parsePath(expOrFn);
  36846. if (!this.getter) {
  36847. this.getter = noop;
  36848. warn(
  36849. "Failed watching path: \"" + expOrFn + "\" " +
  36850. 'Watcher only accepts simple dot-delimited paths. ' +
  36851. 'For full control, use a function instead.',
  36852. vm
  36853. );
  36854. }
  36855. }
  36856. this.value = this.lazy
  36857. ? undefined
  36858. : this.get();
  36859. };
  36860. /**
  36861. * Evaluate the getter, and re-collect dependencies.
  36862. */
  36863. Watcher.prototype.get = function get () {
  36864. pushTarget(this);
  36865. var value;
  36866. var vm = this.vm;
  36867. try {
  36868. value = this.getter.call(vm, vm);
  36869. } catch (e) {
  36870. if (this.user) {
  36871. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  36872. } else {
  36873. throw e
  36874. }
  36875. } finally {
  36876. // "touch" every property so they are all tracked as
  36877. // dependencies for deep watching
  36878. if (this.deep) {
  36879. traverse(value);
  36880. }
  36881. popTarget();
  36882. this.cleanupDeps();
  36883. }
  36884. return value
  36885. };
  36886. /**
  36887. * Add a dependency to this directive.
  36888. */
  36889. Watcher.prototype.addDep = function addDep (dep) {
  36890. var id = dep.id;
  36891. if (!this.newDepIds.has(id)) {
  36892. this.newDepIds.add(id);
  36893. this.newDeps.push(dep);
  36894. if (!this.depIds.has(id)) {
  36895. dep.addSub(this);
  36896. }
  36897. }
  36898. };
  36899. /**
  36900. * Clean up for dependency collection.
  36901. */
  36902. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  36903. var i = this.deps.length;
  36904. while (i--) {
  36905. var dep = this.deps[i];
  36906. if (!this.newDepIds.has(dep.id)) {
  36907. dep.removeSub(this);
  36908. }
  36909. }
  36910. var tmp = this.depIds;
  36911. this.depIds = this.newDepIds;
  36912. this.newDepIds = tmp;
  36913. this.newDepIds.clear();
  36914. tmp = this.deps;
  36915. this.deps = this.newDeps;
  36916. this.newDeps = tmp;
  36917. this.newDeps.length = 0;
  36918. };
  36919. /**
  36920. * Subscriber interface.
  36921. * Will be called when a dependency changes.
  36922. */
  36923. Watcher.prototype.update = function update () {
  36924. /* istanbul ignore else */
  36925. if (this.lazy) {
  36926. this.dirty = true;
  36927. } else if (this.sync) {
  36928. this.run();
  36929. } else {
  36930. queueWatcher(this);
  36931. }
  36932. };
  36933. /**
  36934. * Scheduler job interface.
  36935. * Will be called by the scheduler.
  36936. */
  36937. Watcher.prototype.run = function run () {
  36938. if (this.active) {
  36939. var value = this.get();
  36940. if (
  36941. value !== this.value ||
  36942. // Deep watchers and watchers on Object/Arrays should fire even
  36943. // when the value is the same, because the value may
  36944. // have mutated.
  36945. isObject(value) ||
  36946. this.deep
  36947. ) {
  36948. // set new value
  36949. var oldValue = this.value;
  36950. this.value = value;
  36951. if (this.user) {
  36952. try {
  36953. this.cb.call(this.vm, value, oldValue);
  36954. } catch (e) {
  36955. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  36956. }
  36957. } else {
  36958. this.cb.call(this.vm, value, oldValue);
  36959. }
  36960. }
  36961. }
  36962. };
  36963. /**
  36964. * Evaluate the value of the watcher.
  36965. * This only gets called for lazy watchers.
  36966. */
  36967. Watcher.prototype.evaluate = function evaluate () {
  36968. this.value = this.get();
  36969. this.dirty = false;
  36970. };
  36971. /**
  36972. * Depend on all deps collected by this watcher.
  36973. */
  36974. Watcher.prototype.depend = function depend () {
  36975. var i = this.deps.length;
  36976. while (i--) {
  36977. this.deps[i].depend();
  36978. }
  36979. };
  36980. /**
  36981. * Remove self from all dependencies' subscriber list.
  36982. */
  36983. Watcher.prototype.teardown = function teardown () {
  36984. if (this.active) {
  36985. // remove self from vm's watcher list
  36986. // this is a somewhat expensive operation so we skip it
  36987. // if the vm is being destroyed.
  36988. if (!this.vm._isBeingDestroyed) {
  36989. remove(this.vm._watchers, this);
  36990. }
  36991. var i = this.deps.length;
  36992. while (i--) {
  36993. this.deps[i].removeSub(this);
  36994. }
  36995. this.active = false;
  36996. }
  36997. };
  36998. /* */
  36999. var sharedPropertyDefinition = {
  37000. enumerable: true,
  37001. configurable: true,
  37002. get: noop,
  37003. set: noop
  37004. };
  37005. function proxy (target, sourceKey, key) {
  37006. sharedPropertyDefinition.get = function proxyGetter () {
  37007. return this[sourceKey][key]
  37008. };
  37009. sharedPropertyDefinition.set = function proxySetter (val) {
  37010. this[sourceKey][key] = val;
  37011. };
  37012. Object.defineProperty(target, key, sharedPropertyDefinition);
  37013. }
  37014. function initState (vm) {
  37015. vm._watchers = [];
  37016. var opts = vm.$options;
  37017. if (opts.props) { initProps(vm, opts.props); }
  37018. if (opts.methods) { initMethods(vm, opts.methods); }
  37019. if (opts.data) {
  37020. initData(vm);
  37021. } else {
  37022. observe(vm._data = {}, true /* asRootData */);
  37023. }
  37024. if (opts.computed) { initComputed(vm, opts.computed); }
  37025. if (opts.watch && opts.watch !== nativeWatch) {
  37026. initWatch(vm, opts.watch);
  37027. }
  37028. }
  37029. function initProps (vm, propsOptions) {
  37030. var propsData = vm.$options.propsData || {};
  37031. var props = vm._props = {};
  37032. // cache prop keys so that future props updates can iterate using Array
  37033. // instead of dynamic object key enumeration.
  37034. var keys = vm.$options._propKeys = [];
  37035. var isRoot = !vm.$parent;
  37036. // root instance props should be converted
  37037. if (!isRoot) {
  37038. toggleObserving(false);
  37039. }
  37040. var loop = function ( key ) {
  37041. keys.push(key);
  37042. var value = validateProp(key, propsOptions, propsData, vm);
  37043. /* istanbul ignore else */
  37044. {
  37045. var hyphenatedKey = hyphenate(key);
  37046. if (isReservedAttribute(hyphenatedKey) ||
  37047. config.isReservedAttr(hyphenatedKey)) {
  37048. warn(
  37049. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  37050. vm
  37051. );
  37052. }
  37053. defineReactive$$1(props, key, value, function () {
  37054. if (!isRoot && !isUpdatingChildComponent) {
  37055. warn(
  37056. "Avoid mutating a prop directly since the value will be " +
  37057. "overwritten whenever the parent component re-renders. " +
  37058. "Instead, use a data or computed property based on the prop's " +
  37059. "value. Prop being mutated: \"" + key + "\"",
  37060. vm
  37061. );
  37062. }
  37063. });
  37064. }
  37065. // static props are already proxied on the component's prototype
  37066. // during Vue.extend(). We only need to proxy props defined at
  37067. // instantiation here.
  37068. if (!(key in vm)) {
  37069. proxy(vm, "_props", key);
  37070. }
  37071. };
  37072. for (var key in propsOptions) loop( key );
  37073. toggleObserving(true);
  37074. }
  37075. function initData (vm) {
  37076. var data = vm.$options.data;
  37077. data = vm._data = typeof data === 'function'
  37078. ? getData(data, vm)
  37079. : data || {};
  37080. if (!isPlainObject(data)) {
  37081. data = {};
  37082. warn(
  37083. 'data functions should return an object:\n' +
  37084. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  37085. vm
  37086. );
  37087. }
  37088. // proxy data on instance
  37089. var keys = Object.keys(data);
  37090. var props = vm.$options.props;
  37091. var methods = vm.$options.methods;
  37092. var i = keys.length;
  37093. while (i--) {
  37094. var key = keys[i];
  37095. {
  37096. if (methods && hasOwn(methods, key)) {
  37097. warn(
  37098. ("Method \"" + key + "\" has already been defined as a data property."),
  37099. vm
  37100. );
  37101. }
  37102. }
  37103. if (props && hasOwn(props, key)) {
  37104. warn(
  37105. "The data property \"" + key + "\" is already declared as a prop. " +
  37106. "Use prop default value instead.",
  37107. vm
  37108. );
  37109. } else if (!isReserved(key)) {
  37110. proxy(vm, "_data", key);
  37111. }
  37112. }
  37113. // observe data
  37114. observe(data, true /* asRootData */);
  37115. }
  37116. function getData (data, vm) {
  37117. // #7573 disable dep collection when invoking data getters
  37118. pushTarget();
  37119. try {
  37120. return data.call(vm, vm)
  37121. } catch (e) {
  37122. handleError(e, vm, "data()");
  37123. return {}
  37124. } finally {
  37125. popTarget();
  37126. }
  37127. }
  37128. var computedWatcherOptions = { lazy: true };
  37129. function initComputed (vm, computed) {
  37130. // $flow-disable-line
  37131. var watchers = vm._computedWatchers = Object.create(null);
  37132. // computed properties are just getters during SSR
  37133. var isSSR = isServerRendering();
  37134. for (var key in computed) {
  37135. var userDef = computed[key];
  37136. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  37137. if (getter == null) {
  37138. warn(
  37139. ("Getter is missing for computed property \"" + key + "\"."),
  37140. vm
  37141. );
  37142. }
  37143. if (!isSSR) {
  37144. // create internal watcher for the computed property.
  37145. watchers[key] = new Watcher(
  37146. vm,
  37147. getter || noop,
  37148. noop,
  37149. computedWatcherOptions
  37150. );
  37151. }
  37152. // component-defined computed properties are already defined on the
  37153. // component prototype. We only need to define computed properties defined
  37154. // at instantiation here.
  37155. if (!(key in vm)) {
  37156. defineComputed(vm, key, userDef);
  37157. } else {
  37158. if (key in vm.$data) {
  37159. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  37160. } else if (vm.$options.props && key in vm.$options.props) {
  37161. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  37162. }
  37163. }
  37164. }
  37165. }
  37166. function defineComputed (
  37167. target,
  37168. key,
  37169. userDef
  37170. ) {
  37171. var shouldCache = !isServerRendering();
  37172. if (typeof userDef === 'function') {
  37173. sharedPropertyDefinition.get = shouldCache
  37174. ? createComputedGetter(key)
  37175. : createGetterInvoker(userDef);
  37176. sharedPropertyDefinition.set = noop;
  37177. } else {
  37178. sharedPropertyDefinition.get = userDef.get
  37179. ? shouldCache && userDef.cache !== false
  37180. ? createComputedGetter(key)
  37181. : createGetterInvoker(userDef.get)
  37182. : noop;
  37183. sharedPropertyDefinition.set = userDef.set || noop;
  37184. }
  37185. if (sharedPropertyDefinition.set === noop) {
  37186. sharedPropertyDefinition.set = function () {
  37187. warn(
  37188. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  37189. this
  37190. );
  37191. };
  37192. }
  37193. Object.defineProperty(target, key, sharedPropertyDefinition);
  37194. }
  37195. function createComputedGetter (key) {
  37196. return function computedGetter () {
  37197. var watcher = this._computedWatchers && this._computedWatchers[key];
  37198. if (watcher) {
  37199. if (watcher.dirty) {
  37200. watcher.evaluate();
  37201. }
  37202. if (Dep.target) {
  37203. watcher.depend();
  37204. }
  37205. return watcher.value
  37206. }
  37207. }
  37208. }
  37209. function createGetterInvoker(fn) {
  37210. return function computedGetter () {
  37211. return fn.call(this, this)
  37212. }
  37213. }
  37214. function initMethods (vm, methods) {
  37215. var props = vm.$options.props;
  37216. for (var key in methods) {
  37217. {
  37218. if (typeof methods[key] !== 'function') {
  37219. warn(
  37220. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  37221. "Did you reference the function correctly?",
  37222. vm
  37223. );
  37224. }
  37225. if (props && hasOwn(props, key)) {
  37226. warn(
  37227. ("Method \"" + key + "\" has already been defined as a prop."),
  37228. vm
  37229. );
  37230. }
  37231. if ((key in vm) && isReserved(key)) {
  37232. warn(
  37233. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  37234. "Avoid defining component methods that start with _ or $."
  37235. );
  37236. }
  37237. }
  37238. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  37239. }
  37240. }
  37241. function initWatch (vm, watch) {
  37242. for (var key in watch) {
  37243. var handler = watch[key];
  37244. if (Array.isArray(handler)) {
  37245. for (var i = 0; i < handler.length; i++) {
  37246. createWatcher(vm, key, handler[i]);
  37247. }
  37248. } else {
  37249. createWatcher(vm, key, handler);
  37250. }
  37251. }
  37252. }
  37253. function createWatcher (
  37254. vm,
  37255. expOrFn,
  37256. handler,
  37257. options
  37258. ) {
  37259. if (isPlainObject(handler)) {
  37260. options = handler;
  37261. handler = handler.handler;
  37262. }
  37263. if (typeof handler === 'string') {
  37264. handler = vm[handler];
  37265. }
  37266. return vm.$watch(expOrFn, handler, options)
  37267. }
  37268. function stateMixin (Vue) {
  37269. // flow somehow has problems with directly declared definition object
  37270. // when using Object.defineProperty, so we have to procedurally build up
  37271. // the object here.
  37272. var dataDef = {};
  37273. dataDef.get = function () { return this._data };
  37274. var propsDef = {};
  37275. propsDef.get = function () { return this._props };
  37276. {
  37277. dataDef.set = function () {
  37278. warn(
  37279. 'Avoid replacing instance root $data. ' +
  37280. 'Use nested data properties instead.',
  37281. this
  37282. );
  37283. };
  37284. propsDef.set = function () {
  37285. warn("$props is readonly.", this);
  37286. };
  37287. }
  37288. Object.defineProperty(Vue.prototype, '$data', dataDef);
  37289. Object.defineProperty(Vue.prototype, '$props', propsDef);
  37290. Vue.prototype.$set = set;
  37291. Vue.prototype.$delete = del;
  37292. Vue.prototype.$watch = function (
  37293. expOrFn,
  37294. cb,
  37295. options
  37296. ) {
  37297. var vm = this;
  37298. if (isPlainObject(cb)) {
  37299. return createWatcher(vm, expOrFn, cb, options)
  37300. }
  37301. options = options || {};
  37302. options.user = true;
  37303. var watcher = new Watcher(vm, expOrFn, cb, options);
  37304. if (options.immediate) {
  37305. try {
  37306. cb.call(vm, watcher.value);
  37307. } catch (error) {
  37308. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  37309. }
  37310. }
  37311. return function unwatchFn () {
  37312. watcher.teardown();
  37313. }
  37314. };
  37315. }
  37316. /* */
  37317. var uid$3 = 0;
  37318. function initMixin (Vue) {
  37319. Vue.prototype._init = function (options) {
  37320. var vm = this;
  37321. // a uid
  37322. vm._uid = uid$3++;
  37323. var startTag, endTag;
  37324. /* istanbul ignore if */
  37325. if (config.performance && mark) {
  37326. startTag = "vue-perf-start:" + (vm._uid);
  37327. endTag = "vue-perf-end:" + (vm._uid);
  37328. mark(startTag);
  37329. }
  37330. // a flag to avoid this being observed
  37331. vm._isVue = true;
  37332. // merge options
  37333. if (options && options._isComponent) {
  37334. // optimize internal component instantiation
  37335. // since dynamic options merging is pretty slow, and none of the
  37336. // internal component options needs special treatment.
  37337. initInternalComponent(vm, options);
  37338. } else {
  37339. vm.$options = mergeOptions(
  37340. resolveConstructorOptions(vm.constructor),
  37341. options || {},
  37342. vm
  37343. );
  37344. }
  37345. /* istanbul ignore else */
  37346. {
  37347. initProxy(vm);
  37348. }
  37349. // expose real self
  37350. vm._self = vm;
  37351. initLifecycle(vm);
  37352. initEvents(vm);
  37353. initRender(vm);
  37354. callHook(vm, 'beforeCreate');
  37355. initInjections(vm); // resolve injections before data/props
  37356. initState(vm);
  37357. initProvide(vm); // resolve provide after data/props
  37358. callHook(vm, 'created');
  37359. /* istanbul ignore if */
  37360. if (config.performance && mark) {
  37361. vm._name = formatComponentName(vm, false);
  37362. mark(endTag);
  37363. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  37364. }
  37365. if (vm.$options.el) {
  37366. vm.$mount(vm.$options.el);
  37367. }
  37368. };
  37369. }
  37370. function initInternalComponent (vm, options) {
  37371. var opts = vm.$options = Object.create(vm.constructor.options);
  37372. // doing this because it's faster than dynamic enumeration.
  37373. var parentVnode = options._parentVnode;
  37374. opts.parent = options.parent;
  37375. opts._parentVnode = parentVnode;
  37376. var vnodeComponentOptions = parentVnode.componentOptions;
  37377. opts.propsData = vnodeComponentOptions.propsData;
  37378. opts._parentListeners = vnodeComponentOptions.listeners;
  37379. opts._renderChildren = vnodeComponentOptions.children;
  37380. opts._componentTag = vnodeComponentOptions.tag;
  37381. if (options.render) {
  37382. opts.render = options.render;
  37383. opts.staticRenderFns = options.staticRenderFns;
  37384. }
  37385. }
  37386. function resolveConstructorOptions (Ctor) {
  37387. var options = Ctor.options;
  37388. if (Ctor.super) {
  37389. var superOptions = resolveConstructorOptions(Ctor.super);
  37390. var cachedSuperOptions = Ctor.superOptions;
  37391. if (superOptions !== cachedSuperOptions) {
  37392. // super option changed,
  37393. // need to resolve new options.
  37394. Ctor.superOptions = superOptions;
  37395. // check if there are any late-modified/attached options (#4976)
  37396. var modifiedOptions = resolveModifiedOptions(Ctor);
  37397. // update base extend options
  37398. if (modifiedOptions) {
  37399. extend(Ctor.extendOptions, modifiedOptions);
  37400. }
  37401. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  37402. if (options.name) {
  37403. options.components[options.name] = Ctor;
  37404. }
  37405. }
  37406. }
  37407. return options
  37408. }
  37409. function resolveModifiedOptions (Ctor) {
  37410. var modified;
  37411. var latest = Ctor.options;
  37412. var sealed = Ctor.sealedOptions;
  37413. for (var key in latest) {
  37414. if (latest[key] !== sealed[key]) {
  37415. if (!modified) { modified = {}; }
  37416. modified[key] = latest[key];
  37417. }
  37418. }
  37419. return modified
  37420. }
  37421. function Vue (options) {
  37422. if (!(this instanceof Vue)
  37423. ) {
  37424. warn('Vue is a constructor and should be called with the `new` keyword');
  37425. }
  37426. this._init(options);
  37427. }
  37428. initMixin(Vue);
  37429. stateMixin(Vue);
  37430. eventsMixin(Vue);
  37431. lifecycleMixin(Vue);
  37432. renderMixin(Vue);
  37433. /* */
  37434. function initUse (Vue) {
  37435. Vue.use = function (plugin) {
  37436. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  37437. if (installedPlugins.indexOf(plugin) > -1) {
  37438. return this
  37439. }
  37440. // additional parameters
  37441. var args = toArray(arguments, 1);
  37442. args.unshift(this);
  37443. if (typeof plugin.install === 'function') {
  37444. plugin.install.apply(plugin, args);
  37445. } else if (typeof plugin === 'function') {
  37446. plugin.apply(null, args);
  37447. }
  37448. installedPlugins.push(plugin);
  37449. return this
  37450. };
  37451. }
  37452. /* */
  37453. function initMixin$1 (Vue) {
  37454. Vue.mixin = function (mixin) {
  37455. this.options = mergeOptions(this.options, mixin);
  37456. return this
  37457. };
  37458. }
  37459. /* */
  37460. function initExtend (Vue) {
  37461. /**
  37462. * Each instance constructor, including Vue, has a unique
  37463. * cid. This enables us to create wrapped "child
  37464. * constructors" for prototypal inheritance and cache them.
  37465. */
  37466. Vue.cid = 0;
  37467. var cid = 1;
  37468. /**
  37469. * Class inheritance
  37470. */
  37471. Vue.extend = function (extendOptions) {
  37472. extendOptions = extendOptions || {};
  37473. var Super = this;
  37474. var SuperId = Super.cid;
  37475. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  37476. if (cachedCtors[SuperId]) {
  37477. return cachedCtors[SuperId]
  37478. }
  37479. var name = extendOptions.name || Super.options.name;
  37480. if (name) {
  37481. validateComponentName(name);
  37482. }
  37483. var Sub = function VueComponent (options) {
  37484. this._init(options);
  37485. };
  37486. Sub.prototype = Object.create(Super.prototype);
  37487. Sub.prototype.constructor = Sub;
  37488. Sub.cid = cid++;
  37489. Sub.options = mergeOptions(
  37490. Super.options,
  37491. extendOptions
  37492. );
  37493. Sub['super'] = Super;
  37494. // For props and computed properties, we define the proxy getters on
  37495. // the Vue instances at extension time, on the extended prototype. This
  37496. // avoids Object.defineProperty calls for each instance created.
  37497. if (Sub.options.props) {
  37498. initProps$1(Sub);
  37499. }
  37500. if (Sub.options.computed) {
  37501. initComputed$1(Sub);
  37502. }
  37503. // allow further extension/mixin/plugin usage
  37504. Sub.extend = Super.extend;
  37505. Sub.mixin = Super.mixin;
  37506. Sub.use = Super.use;
  37507. // create asset registers, so extended classes
  37508. // can have their private assets too.
  37509. ASSET_TYPES.forEach(function (type) {
  37510. Sub[type] = Super[type];
  37511. });
  37512. // enable recursive self-lookup
  37513. if (name) {
  37514. Sub.options.components[name] = Sub;
  37515. }
  37516. // keep a reference to the super options at extension time.
  37517. // later at instantiation we can check if Super's options have
  37518. // been updated.
  37519. Sub.superOptions = Super.options;
  37520. Sub.extendOptions = extendOptions;
  37521. Sub.sealedOptions = extend({}, Sub.options);
  37522. // cache constructor
  37523. cachedCtors[SuperId] = Sub;
  37524. return Sub
  37525. };
  37526. }
  37527. function initProps$1 (Comp) {
  37528. var props = Comp.options.props;
  37529. for (var key in props) {
  37530. proxy(Comp.prototype, "_props", key);
  37531. }
  37532. }
  37533. function initComputed$1 (Comp) {
  37534. var computed = Comp.options.computed;
  37535. for (var key in computed) {
  37536. defineComputed(Comp.prototype, key, computed[key]);
  37537. }
  37538. }
  37539. /* */
  37540. function initAssetRegisters (Vue) {
  37541. /**
  37542. * Create asset registration methods.
  37543. */
  37544. ASSET_TYPES.forEach(function (type) {
  37545. Vue[type] = function (
  37546. id,
  37547. definition
  37548. ) {
  37549. if (!definition) {
  37550. return this.options[type + 's'][id]
  37551. } else {
  37552. /* istanbul ignore if */
  37553. if (type === 'component') {
  37554. validateComponentName(id);
  37555. }
  37556. if (type === 'component' && isPlainObject(definition)) {
  37557. definition.name = definition.name || id;
  37558. definition = this.options._base.extend(definition);
  37559. }
  37560. if (type === 'directive' && typeof definition === 'function') {
  37561. definition = { bind: definition, update: definition };
  37562. }
  37563. this.options[type + 's'][id] = definition;
  37564. return definition
  37565. }
  37566. };
  37567. });
  37568. }
  37569. /* */
  37570. function getComponentName (opts) {
  37571. return opts && (opts.Ctor.options.name || opts.tag)
  37572. }
  37573. function matches (pattern, name) {
  37574. if (Array.isArray(pattern)) {
  37575. return pattern.indexOf(name) > -1
  37576. } else if (typeof pattern === 'string') {
  37577. return pattern.split(',').indexOf(name) > -1
  37578. } else if (isRegExp(pattern)) {
  37579. return pattern.test(name)
  37580. }
  37581. /* istanbul ignore next */
  37582. return false
  37583. }
  37584. function pruneCache (keepAliveInstance, filter) {
  37585. var cache = keepAliveInstance.cache;
  37586. var keys = keepAliveInstance.keys;
  37587. var _vnode = keepAliveInstance._vnode;
  37588. for (var key in cache) {
  37589. var cachedNode = cache[key];
  37590. if (cachedNode) {
  37591. var name = getComponentName(cachedNode.componentOptions);
  37592. if (name && !filter(name)) {
  37593. pruneCacheEntry(cache, key, keys, _vnode);
  37594. }
  37595. }
  37596. }
  37597. }
  37598. function pruneCacheEntry (
  37599. cache,
  37600. key,
  37601. keys,
  37602. current
  37603. ) {
  37604. var cached$$1 = cache[key];
  37605. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  37606. cached$$1.componentInstance.$destroy();
  37607. }
  37608. cache[key] = null;
  37609. remove(keys, key);
  37610. }
  37611. var patternTypes = [String, RegExp, Array];
  37612. var KeepAlive = {
  37613. name: 'keep-alive',
  37614. abstract: true,
  37615. props: {
  37616. include: patternTypes,
  37617. exclude: patternTypes,
  37618. max: [String, Number]
  37619. },
  37620. created: function created () {
  37621. this.cache = Object.create(null);
  37622. this.keys = [];
  37623. },
  37624. destroyed: function destroyed () {
  37625. for (var key in this.cache) {
  37626. pruneCacheEntry(this.cache, key, this.keys);
  37627. }
  37628. },
  37629. mounted: function mounted () {
  37630. var this$1 = this;
  37631. this.$watch('include', function (val) {
  37632. pruneCache(this$1, function (name) { return matches(val, name); });
  37633. });
  37634. this.$watch('exclude', function (val) {
  37635. pruneCache(this$1, function (name) { return !matches(val, name); });
  37636. });
  37637. },
  37638. render: function render () {
  37639. var slot = this.$slots.default;
  37640. var vnode = getFirstComponentChild(slot);
  37641. var componentOptions = vnode && vnode.componentOptions;
  37642. if (componentOptions) {
  37643. // check pattern
  37644. var name = getComponentName(componentOptions);
  37645. var ref = this;
  37646. var include = ref.include;
  37647. var exclude = ref.exclude;
  37648. if (
  37649. // not included
  37650. (include && (!name || !matches(include, name))) ||
  37651. // excluded
  37652. (exclude && name && matches(exclude, name))
  37653. ) {
  37654. return vnode
  37655. }
  37656. var ref$1 = this;
  37657. var cache = ref$1.cache;
  37658. var keys = ref$1.keys;
  37659. var key = vnode.key == null
  37660. // same constructor may get registered as different local components
  37661. // so cid alone is not enough (#3269)
  37662. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  37663. : vnode.key;
  37664. if (cache[key]) {
  37665. vnode.componentInstance = cache[key].componentInstance;
  37666. // make current key freshest
  37667. remove(keys, key);
  37668. keys.push(key);
  37669. } else {
  37670. cache[key] = vnode;
  37671. keys.push(key);
  37672. // prune oldest entry
  37673. if (this.max && keys.length > parseInt(this.max)) {
  37674. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  37675. }
  37676. }
  37677. vnode.data.keepAlive = true;
  37678. }
  37679. return vnode || (slot && slot[0])
  37680. }
  37681. };
  37682. var builtInComponents = {
  37683. KeepAlive: KeepAlive
  37684. };
  37685. /* */
  37686. function initGlobalAPI (Vue) {
  37687. // config
  37688. var configDef = {};
  37689. configDef.get = function () { return config; };
  37690. {
  37691. configDef.set = function () {
  37692. warn(
  37693. 'Do not replace the Vue.config object, set individual fields instead.'
  37694. );
  37695. };
  37696. }
  37697. Object.defineProperty(Vue, 'config', configDef);
  37698. // exposed util methods.
  37699. // NOTE: these are not considered part of the public API - avoid relying on
  37700. // them unless you are aware of the risk.
  37701. Vue.util = {
  37702. warn: warn,
  37703. extend: extend,
  37704. mergeOptions: mergeOptions,
  37705. defineReactive: defineReactive$$1
  37706. };
  37707. Vue.set = set;
  37708. Vue.delete = del;
  37709. Vue.nextTick = nextTick;
  37710. // 2.6 explicit observable API
  37711. Vue.observable = function (obj) {
  37712. observe(obj);
  37713. return obj
  37714. };
  37715. Vue.options = Object.create(null);
  37716. ASSET_TYPES.forEach(function (type) {
  37717. Vue.options[type + 's'] = Object.create(null);
  37718. });
  37719. // this is used to identify the "base" constructor to extend all plain-object
  37720. // components with in Weex's multi-instance scenarios.
  37721. Vue.options._base = Vue;
  37722. extend(Vue.options.components, builtInComponents);
  37723. initUse(Vue);
  37724. initMixin$1(Vue);
  37725. initExtend(Vue);
  37726. initAssetRegisters(Vue);
  37727. }
  37728. initGlobalAPI(Vue);
  37729. Object.defineProperty(Vue.prototype, '$isServer', {
  37730. get: isServerRendering
  37731. });
  37732. Object.defineProperty(Vue.prototype, '$ssrContext', {
  37733. get: function get () {
  37734. /* istanbul ignore next */
  37735. return this.$vnode && this.$vnode.ssrContext
  37736. }
  37737. });
  37738. // expose FunctionalRenderContext for ssr runtime helper installation
  37739. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  37740. value: FunctionalRenderContext
  37741. });
  37742. Vue.version = '2.6.11';
  37743. /* */
  37744. // these are reserved for web because they are directly compiled away
  37745. // during template compilation
  37746. var isReservedAttr = makeMap('style,class');
  37747. // attributes that should be using props for binding
  37748. var acceptValue = makeMap('input,textarea,option,select,progress');
  37749. var mustUseProp = function (tag, type, attr) {
  37750. return (
  37751. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  37752. (attr === 'selected' && tag === 'option') ||
  37753. (attr === 'checked' && tag === 'input') ||
  37754. (attr === 'muted' && tag === 'video')
  37755. )
  37756. };
  37757. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  37758. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  37759. var convertEnumeratedValue = function (key, value) {
  37760. return isFalsyAttrValue(value) || value === 'false'
  37761. ? 'false'
  37762. // allow arbitrary string value for contenteditable
  37763. : key === 'contenteditable' && isValidContentEditableValue(value)
  37764. ? value
  37765. : 'true'
  37766. };
  37767. var isBooleanAttr = makeMap(
  37768. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  37769. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  37770. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  37771. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  37772. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  37773. 'truespeed,typemustmatch,visible'
  37774. );
  37775. var xlinkNS = 'http://www.w3.org/1999/xlink';
  37776. var isXlink = function (name) {
  37777. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  37778. };
  37779. var getXlinkProp = function (name) {
  37780. return isXlink(name) ? name.slice(6, name.length) : ''
  37781. };
  37782. var isFalsyAttrValue = function (val) {
  37783. return val == null || val === false
  37784. };
  37785. /* */
  37786. function genClassForVnode (vnode) {
  37787. var data = vnode.data;
  37788. var parentNode = vnode;
  37789. var childNode = vnode;
  37790. while (isDef(childNode.componentInstance)) {
  37791. childNode = childNode.componentInstance._vnode;
  37792. if (childNode && childNode.data) {
  37793. data = mergeClassData(childNode.data, data);
  37794. }
  37795. }
  37796. while (isDef(parentNode = parentNode.parent)) {
  37797. if (parentNode && parentNode.data) {
  37798. data = mergeClassData(data, parentNode.data);
  37799. }
  37800. }
  37801. return renderClass(data.staticClass, data.class)
  37802. }
  37803. function mergeClassData (child, parent) {
  37804. return {
  37805. staticClass: concat(child.staticClass, parent.staticClass),
  37806. class: isDef(child.class)
  37807. ? [child.class, parent.class]
  37808. : parent.class
  37809. }
  37810. }
  37811. function renderClass (
  37812. staticClass,
  37813. dynamicClass
  37814. ) {
  37815. if (isDef(staticClass) || isDef(dynamicClass)) {
  37816. return concat(staticClass, stringifyClass(dynamicClass))
  37817. }
  37818. /* istanbul ignore next */
  37819. return ''
  37820. }
  37821. function concat (a, b) {
  37822. return a ? b ? (a + ' ' + b) : a : (b || '')
  37823. }
  37824. function stringifyClass (value) {
  37825. if (Array.isArray(value)) {
  37826. return stringifyArray(value)
  37827. }
  37828. if (isObject(value)) {
  37829. return stringifyObject(value)
  37830. }
  37831. if (typeof value === 'string') {
  37832. return value
  37833. }
  37834. /* istanbul ignore next */
  37835. return ''
  37836. }
  37837. function stringifyArray (value) {
  37838. var res = '';
  37839. var stringified;
  37840. for (var i = 0, l = value.length; i < l; i++) {
  37841. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  37842. if (res) { res += ' '; }
  37843. res += stringified;
  37844. }
  37845. }
  37846. return res
  37847. }
  37848. function stringifyObject (value) {
  37849. var res = '';
  37850. for (var key in value) {
  37851. if (value[key]) {
  37852. if (res) { res += ' '; }
  37853. res += key;
  37854. }
  37855. }
  37856. return res
  37857. }
  37858. /* */
  37859. var namespaceMap = {
  37860. svg: 'http://www.w3.org/2000/svg',
  37861. math: 'http://www.w3.org/1998/Math/MathML'
  37862. };
  37863. var isHTMLTag = makeMap(
  37864. 'html,body,base,head,link,meta,style,title,' +
  37865. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  37866. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  37867. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  37868. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  37869. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  37870. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  37871. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  37872. 'output,progress,select,textarea,' +
  37873. 'details,dialog,menu,menuitem,summary,' +
  37874. 'content,element,shadow,template,blockquote,iframe,tfoot'
  37875. );
  37876. // this map is intentionally selective, only covering SVG elements that may
  37877. // contain child elements.
  37878. var isSVG = makeMap(
  37879. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  37880. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  37881. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  37882. true
  37883. );
  37884. var isPreTag = function (tag) { return tag === 'pre'; };
  37885. var isReservedTag = function (tag) {
  37886. return isHTMLTag(tag) || isSVG(tag)
  37887. };
  37888. function getTagNamespace (tag) {
  37889. if (isSVG(tag)) {
  37890. return 'svg'
  37891. }
  37892. // basic support for MathML
  37893. // note it doesn't support other MathML elements being component roots
  37894. if (tag === 'math') {
  37895. return 'math'
  37896. }
  37897. }
  37898. var unknownElementCache = Object.create(null);
  37899. function isUnknownElement (tag) {
  37900. /* istanbul ignore if */
  37901. if (!inBrowser) {
  37902. return true
  37903. }
  37904. if (isReservedTag(tag)) {
  37905. return false
  37906. }
  37907. tag = tag.toLowerCase();
  37908. /* istanbul ignore if */
  37909. if (unknownElementCache[tag] != null) {
  37910. return unknownElementCache[tag]
  37911. }
  37912. var el = document.createElement(tag);
  37913. if (tag.indexOf('-') > -1) {
  37914. // http://stackoverflow.com/a/28210364/1070244
  37915. return (unknownElementCache[tag] = (
  37916. el.constructor === window.HTMLUnknownElement ||
  37917. el.constructor === window.HTMLElement
  37918. ))
  37919. } else {
  37920. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  37921. }
  37922. }
  37923. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  37924. /* */
  37925. /**
  37926. * Query an element selector if it's not an element already.
  37927. */
  37928. function query (el) {
  37929. if (typeof el === 'string') {
  37930. var selected = document.querySelector(el);
  37931. if (!selected) {
  37932. warn(
  37933. 'Cannot find element: ' + el
  37934. );
  37935. return document.createElement('div')
  37936. }
  37937. return selected
  37938. } else {
  37939. return el
  37940. }
  37941. }
  37942. /* */
  37943. function createElement$1 (tagName, vnode) {
  37944. var elm = document.createElement(tagName);
  37945. if (tagName !== 'select') {
  37946. return elm
  37947. }
  37948. // false or null will remove the attribute but undefined will not
  37949. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  37950. elm.setAttribute('multiple', 'multiple');
  37951. }
  37952. return elm
  37953. }
  37954. function createElementNS (namespace, tagName) {
  37955. return document.createElementNS(namespaceMap[namespace], tagName)
  37956. }
  37957. function createTextNode (text) {
  37958. return document.createTextNode(text)
  37959. }
  37960. function createComment (text) {
  37961. return document.createComment(text)
  37962. }
  37963. function insertBefore (parentNode, newNode, referenceNode) {
  37964. parentNode.insertBefore(newNode, referenceNode);
  37965. }
  37966. function removeChild (node, child) {
  37967. node.removeChild(child);
  37968. }
  37969. function appendChild (node, child) {
  37970. node.appendChild(child);
  37971. }
  37972. function parentNode (node) {
  37973. return node.parentNode
  37974. }
  37975. function nextSibling (node) {
  37976. return node.nextSibling
  37977. }
  37978. function tagName (node) {
  37979. return node.tagName
  37980. }
  37981. function setTextContent (node, text) {
  37982. node.textContent = text;
  37983. }
  37984. function setStyleScope (node, scopeId) {
  37985. node.setAttribute(scopeId, '');
  37986. }
  37987. var nodeOps = /*#__PURE__*/Object.freeze({
  37988. createElement: createElement$1,
  37989. createElementNS: createElementNS,
  37990. createTextNode: createTextNode,
  37991. createComment: createComment,
  37992. insertBefore: insertBefore,
  37993. removeChild: removeChild,
  37994. appendChild: appendChild,
  37995. parentNode: parentNode,
  37996. nextSibling: nextSibling,
  37997. tagName: tagName,
  37998. setTextContent: setTextContent,
  37999. setStyleScope: setStyleScope
  38000. });
  38001. /* */
  38002. var ref = {
  38003. create: function create (_, vnode) {
  38004. registerRef(vnode);
  38005. },
  38006. update: function update (oldVnode, vnode) {
  38007. if (oldVnode.data.ref !== vnode.data.ref) {
  38008. registerRef(oldVnode, true);
  38009. registerRef(vnode);
  38010. }
  38011. },
  38012. destroy: function destroy (vnode) {
  38013. registerRef(vnode, true);
  38014. }
  38015. };
  38016. function registerRef (vnode, isRemoval) {
  38017. var key = vnode.data.ref;
  38018. if (!isDef(key)) { return }
  38019. var vm = vnode.context;
  38020. var ref = vnode.componentInstance || vnode.elm;
  38021. var refs = vm.$refs;
  38022. if (isRemoval) {
  38023. if (Array.isArray(refs[key])) {
  38024. remove(refs[key], ref);
  38025. } else if (refs[key] === ref) {
  38026. refs[key] = undefined;
  38027. }
  38028. } else {
  38029. if (vnode.data.refInFor) {
  38030. if (!Array.isArray(refs[key])) {
  38031. refs[key] = [ref];
  38032. } else if (refs[key].indexOf(ref) < 0) {
  38033. // $flow-disable-line
  38034. refs[key].push(ref);
  38035. }
  38036. } else {
  38037. refs[key] = ref;
  38038. }
  38039. }
  38040. }
  38041. /**
  38042. * Virtual DOM patching algorithm based on Snabbdom by
  38043. * Simon Friis Vindum (@paldepind)
  38044. * Licensed under the MIT License
  38045. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  38046. *
  38047. * modified by Evan You (@yyx990803)
  38048. *
  38049. * Not type-checking this because this file is perf-critical and the cost
  38050. * of making flow understand it is not worth it.
  38051. */
  38052. var emptyNode = new VNode('', {}, []);
  38053. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  38054. function sameVnode (a, b) {
  38055. return (
  38056. a.key === b.key && (
  38057. (
  38058. a.tag === b.tag &&
  38059. a.isComment === b.isComment &&
  38060. isDef(a.data) === isDef(b.data) &&
  38061. sameInputType(a, b)
  38062. ) || (
  38063. isTrue(a.isAsyncPlaceholder) &&
  38064. a.asyncFactory === b.asyncFactory &&
  38065. isUndef(b.asyncFactory.error)
  38066. )
  38067. )
  38068. )
  38069. }
  38070. function sameInputType (a, b) {
  38071. if (a.tag !== 'input') { return true }
  38072. var i;
  38073. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  38074. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  38075. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  38076. }
  38077. function createKeyToOldIdx (children, beginIdx, endIdx) {
  38078. var i, key;
  38079. var map = {};
  38080. for (i = beginIdx; i <= endIdx; ++i) {
  38081. key = children[i].key;
  38082. if (isDef(key)) { map[key] = i; }
  38083. }
  38084. return map
  38085. }
  38086. function createPatchFunction (backend) {
  38087. var i, j;
  38088. var cbs = {};
  38089. var modules = backend.modules;
  38090. var nodeOps = backend.nodeOps;
  38091. for (i = 0; i < hooks.length; ++i) {
  38092. cbs[hooks[i]] = [];
  38093. for (j = 0; j < modules.length; ++j) {
  38094. if (isDef(modules[j][hooks[i]])) {
  38095. cbs[hooks[i]].push(modules[j][hooks[i]]);
  38096. }
  38097. }
  38098. }
  38099. function emptyNodeAt (elm) {
  38100. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  38101. }
  38102. function createRmCb (childElm, listeners) {
  38103. function remove$$1 () {
  38104. if (--remove$$1.listeners === 0) {
  38105. removeNode(childElm);
  38106. }
  38107. }
  38108. remove$$1.listeners = listeners;
  38109. return remove$$1
  38110. }
  38111. function removeNode (el) {
  38112. var parent = nodeOps.parentNode(el);
  38113. // element may have already been removed due to v-html / v-text
  38114. if (isDef(parent)) {
  38115. nodeOps.removeChild(parent, el);
  38116. }
  38117. }
  38118. function isUnknownElement$$1 (vnode, inVPre) {
  38119. return (
  38120. !inVPre &&
  38121. !vnode.ns &&
  38122. !(
  38123. config.ignoredElements.length &&
  38124. config.ignoredElements.some(function (ignore) {
  38125. return isRegExp(ignore)
  38126. ? ignore.test(vnode.tag)
  38127. : ignore === vnode.tag
  38128. })
  38129. ) &&
  38130. config.isUnknownElement(vnode.tag)
  38131. )
  38132. }
  38133. var creatingElmInVPre = 0;
  38134. function createElm (
  38135. vnode,
  38136. insertedVnodeQueue,
  38137. parentElm,
  38138. refElm,
  38139. nested,
  38140. ownerArray,
  38141. index
  38142. ) {
  38143. if (isDef(vnode.elm) && isDef(ownerArray)) {
  38144. // This vnode was used in a previous render!
  38145. // now it's used as a new node, overwriting its elm would cause
  38146. // potential patch errors down the road when it's used as an insertion
  38147. // reference node. Instead, we clone the node on-demand before creating
  38148. // associated DOM element for it.
  38149. vnode = ownerArray[index] = cloneVNode(vnode);
  38150. }
  38151. vnode.isRootInsert = !nested; // for transition enter check
  38152. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  38153. return
  38154. }
  38155. var data = vnode.data;
  38156. var children = vnode.children;
  38157. var tag = vnode.tag;
  38158. if (isDef(tag)) {
  38159. {
  38160. if (data && data.pre) {
  38161. creatingElmInVPre++;
  38162. }
  38163. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  38164. warn(
  38165. 'Unknown custom element: <' + tag + '> - did you ' +
  38166. 'register the component correctly? For recursive components, ' +
  38167. 'make sure to provide the "name" option.',
  38168. vnode.context
  38169. );
  38170. }
  38171. }
  38172. vnode.elm = vnode.ns
  38173. ? nodeOps.createElementNS(vnode.ns, tag)
  38174. : nodeOps.createElement(tag, vnode);
  38175. setScope(vnode);
  38176. /* istanbul ignore if */
  38177. {
  38178. createChildren(vnode, children, insertedVnodeQueue);
  38179. if (isDef(data)) {
  38180. invokeCreateHooks(vnode, insertedVnodeQueue);
  38181. }
  38182. insert(parentElm, vnode.elm, refElm);
  38183. }
  38184. if (data && data.pre) {
  38185. creatingElmInVPre--;
  38186. }
  38187. } else if (isTrue(vnode.isComment)) {
  38188. vnode.elm = nodeOps.createComment(vnode.text);
  38189. insert(parentElm, vnode.elm, refElm);
  38190. } else {
  38191. vnode.elm = nodeOps.createTextNode(vnode.text);
  38192. insert(parentElm, vnode.elm, refElm);
  38193. }
  38194. }
  38195. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  38196. var i = vnode.data;
  38197. if (isDef(i)) {
  38198. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  38199. if (isDef(i = i.hook) && isDef(i = i.init)) {
  38200. i(vnode, false /* hydrating */);
  38201. }
  38202. // after calling the init hook, if the vnode is a child component
  38203. // it should've created a child instance and mounted it. the child
  38204. // component also has set the placeholder vnode's elm.
  38205. // in that case we can just return the element and be done.
  38206. if (isDef(vnode.componentInstance)) {
  38207. initComponent(vnode, insertedVnodeQueue);
  38208. insert(parentElm, vnode.elm, refElm);
  38209. if (isTrue(isReactivated)) {
  38210. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  38211. }
  38212. return true
  38213. }
  38214. }
  38215. }
  38216. function initComponent (vnode, insertedVnodeQueue) {
  38217. if (isDef(vnode.data.pendingInsert)) {
  38218. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  38219. vnode.data.pendingInsert = null;
  38220. }
  38221. vnode.elm = vnode.componentInstance.$el;
  38222. if (isPatchable(vnode)) {
  38223. invokeCreateHooks(vnode, insertedVnodeQueue);
  38224. setScope(vnode);
  38225. } else {
  38226. // empty component root.
  38227. // skip all element-related modules except for ref (#3455)
  38228. registerRef(vnode);
  38229. // make sure to invoke the insert hook
  38230. insertedVnodeQueue.push(vnode);
  38231. }
  38232. }
  38233. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  38234. var i;
  38235. // hack for #4339: a reactivated component with inner transition
  38236. // does not trigger because the inner node's created hooks are not called
  38237. // again. It's not ideal to involve module-specific logic in here but
  38238. // there doesn't seem to be a better way to do it.
  38239. var innerNode = vnode;
  38240. while (innerNode.componentInstance) {
  38241. innerNode = innerNode.componentInstance._vnode;
  38242. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  38243. for (i = 0; i < cbs.activate.length; ++i) {
  38244. cbs.activate[i](emptyNode, innerNode);
  38245. }
  38246. insertedVnodeQueue.push(innerNode);
  38247. break
  38248. }
  38249. }
  38250. // unlike a newly created component,
  38251. // a reactivated keep-alive component doesn't insert itself
  38252. insert(parentElm, vnode.elm, refElm);
  38253. }
  38254. function insert (parent, elm, ref$$1) {
  38255. if (isDef(parent)) {
  38256. if (isDef(ref$$1)) {
  38257. if (nodeOps.parentNode(ref$$1) === parent) {
  38258. nodeOps.insertBefore(parent, elm, ref$$1);
  38259. }
  38260. } else {
  38261. nodeOps.appendChild(parent, elm);
  38262. }
  38263. }
  38264. }
  38265. function createChildren (vnode, children, insertedVnodeQueue) {
  38266. if (Array.isArray(children)) {
  38267. {
  38268. checkDuplicateKeys(children);
  38269. }
  38270. for (var i = 0; i < children.length; ++i) {
  38271. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  38272. }
  38273. } else if (isPrimitive(vnode.text)) {
  38274. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  38275. }
  38276. }
  38277. function isPatchable (vnode) {
  38278. while (vnode.componentInstance) {
  38279. vnode = vnode.componentInstance._vnode;
  38280. }
  38281. return isDef(vnode.tag)
  38282. }
  38283. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  38284. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  38285. cbs.create[i$1](emptyNode, vnode);
  38286. }
  38287. i = vnode.data.hook; // Reuse variable
  38288. if (isDef(i)) {
  38289. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  38290. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  38291. }
  38292. }
  38293. // set scope id attribute for scoped CSS.
  38294. // this is implemented as a special case to avoid the overhead
  38295. // of going through the normal attribute patching process.
  38296. function setScope (vnode) {
  38297. var i;
  38298. if (isDef(i = vnode.fnScopeId)) {
  38299. nodeOps.setStyleScope(vnode.elm, i);
  38300. } else {
  38301. var ancestor = vnode;
  38302. while (ancestor) {
  38303. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  38304. nodeOps.setStyleScope(vnode.elm, i);
  38305. }
  38306. ancestor = ancestor.parent;
  38307. }
  38308. }
  38309. // for slot content they should also get the scopeId from the host instance.
  38310. if (isDef(i = activeInstance) &&
  38311. i !== vnode.context &&
  38312. i !== vnode.fnContext &&
  38313. isDef(i = i.$options._scopeId)
  38314. ) {
  38315. nodeOps.setStyleScope(vnode.elm, i);
  38316. }
  38317. }
  38318. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  38319. for (; startIdx <= endIdx; ++startIdx) {
  38320. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  38321. }
  38322. }
  38323. function invokeDestroyHook (vnode) {
  38324. var i, j;
  38325. var data = vnode.data;
  38326. if (isDef(data)) {
  38327. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  38328. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  38329. }
  38330. if (isDef(i = vnode.children)) {
  38331. for (j = 0; j < vnode.children.length; ++j) {
  38332. invokeDestroyHook(vnode.children[j]);
  38333. }
  38334. }
  38335. }
  38336. function removeVnodes (vnodes, startIdx, endIdx) {
  38337. for (; startIdx <= endIdx; ++startIdx) {
  38338. var ch = vnodes[startIdx];
  38339. if (isDef(ch)) {
  38340. if (isDef(ch.tag)) {
  38341. removeAndInvokeRemoveHook(ch);
  38342. invokeDestroyHook(ch);
  38343. } else { // Text node
  38344. removeNode(ch.elm);
  38345. }
  38346. }
  38347. }
  38348. }
  38349. function removeAndInvokeRemoveHook (vnode, rm) {
  38350. if (isDef(rm) || isDef(vnode.data)) {
  38351. var i;
  38352. var listeners = cbs.remove.length + 1;
  38353. if (isDef(rm)) {
  38354. // we have a recursively passed down rm callback
  38355. // increase the listeners count
  38356. rm.listeners += listeners;
  38357. } else {
  38358. // directly removing
  38359. rm = createRmCb(vnode.elm, listeners);
  38360. }
  38361. // recursively invoke hooks on child component root node
  38362. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  38363. removeAndInvokeRemoveHook(i, rm);
  38364. }
  38365. for (i = 0; i < cbs.remove.length; ++i) {
  38366. cbs.remove[i](vnode, rm);
  38367. }
  38368. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  38369. i(vnode, rm);
  38370. } else {
  38371. rm();
  38372. }
  38373. } else {
  38374. removeNode(vnode.elm);
  38375. }
  38376. }
  38377. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  38378. var oldStartIdx = 0;
  38379. var newStartIdx = 0;
  38380. var oldEndIdx = oldCh.length - 1;
  38381. var oldStartVnode = oldCh[0];
  38382. var oldEndVnode = oldCh[oldEndIdx];
  38383. var newEndIdx = newCh.length - 1;
  38384. var newStartVnode = newCh[0];
  38385. var newEndVnode = newCh[newEndIdx];
  38386. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  38387. // removeOnly is a special flag used only by <transition-group>
  38388. // to ensure removed elements stay in correct relative positions
  38389. // during leaving transitions
  38390. var canMove = !removeOnly;
  38391. {
  38392. checkDuplicateKeys(newCh);
  38393. }
  38394. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  38395. if (isUndef(oldStartVnode)) {
  38396. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  38397. } else if (isUndef(oldEndVnode)) {
  38398. oldEndVnode = oldCh[--oldEndIdx];
  38399. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  38400. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  38401. oldStartVnode = oldCh[++oldStartIdx];
  38402. newStartVnode = newCh[++newStartIdx];
  38403. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  38404. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  38405. oldEndVnode = oldCh[--oldEndIdx];
  38406. newEndVnode = newCh[--newEndIdx];
  38407. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  38408. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  38409. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  38410. oldStartVnode = oldCh[++oldStartIdx];
  38411. newEndVnode = newCh[--newEndIdx];
  38412. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  38413. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  38414. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  38415. oldEndVnode = oldCh[--oldEndIdx];
  38416. newStartVnode = newCh[++newStartIdx];
  38417. } else {
  38418. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  38419. idxInOld = isDef(newStartVnode.key)
  38420. ? oldKeyToIdx[newStartVnode.key]
  38421. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  38422. if (isUndef(idxInOld)) { // New element
  38423. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  38424. } else {
  38425. vnodeToMove = oldCh[idxInOld];
  38426. if (sameVnode(vnodeToMove, newStartVnode)) {
  38427. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  38428. oldCh[idxInOld] = undefined;
  38429. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  38430. } else {
  38431. // same key but different element. treat as new element
  38432. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  38433. }
  38434. }
  38435. newStartVnode = newCh[++newStartIdx];
  38436. }
  38437. }
  38438. if (oldStartIdx > oldEndIdx) {
  38439. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  38440. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  38441. } else if (newStartIdx > newEndIdx) {
  38442. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  38443. }
  38444. }
  38445. function checkDuplicateKeys (children) {
  38446. var seenKeys = {};
  38447. for (var i = 0; i < children.length; i++) {
  38448. var vnode = children[i];
  38449. var key = vnode.key;
  38450. if (isDef(key)) {
  38451. if (seenKeys[key]) {
  38452. warn(
  38453. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  38454. vnode.context
  38455. );
  38456. } else {
  38457. seenKeys[key] = true;
  38458. }
  38459. }
  38460. }
  38461. }
  38462. function findIdxInOld (node, oldCh, start, end) {
  38463. for (var i = start; i < end; i++) {
  38464. var c = oldCh[i];
  38465. if (isDef(c) && sameVnode(node, c)) { return i }
  38466. }
  38467. }
  38468. function patchVnode (
  38469. oldVnode,
  38470. vnode,
  38471. insertedVnodeQueue,
  38472. ownerArray,
  38473. index,
  38474. removeOnly
  38475. ) {
  38476. if (oldVnode === vnode) {
  38477. return
  38478. }
  38479. if (isDef(vnode.elm) && isDef(ownerArray)) {
  38480. // clone reused vnode
  38481. vnode = ownerArray[index] = cloneVNode(vnode);
  38482. }
  38483. var elm = vnode.elm = oldVnode.elm;
  38484. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  38485. if (isDef(vnode.asyncFactory.resolved)) {
  38486. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  38487. } else {
  38488. vnode.isAsyncPlaceholder = true;
  38489. }
  38490. return
  38491. }
  38492. // reuse element for static trees.
  38493. // note we only do this if the vnode is cloned -
  38494. // if the new node is not cloned it means the render functions have been
  38495. // reset by the hot-reload-api and we need to do a proper re-render.
  38496. if (isTrue(vnode.isStatic) &&
  38497. isTrue(oldVnode.isStatic) &&
  38498. vnode.key === oldVnode.key &&
  38499. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  38500. ) {
  38501. vnode.componentInstance = oldVnode.componentInstance;
  38502. return
  38503. }
  38504. var i;
  38505. var data = vnode.data;
  38506. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  38507. i(oldVnode, vnode);
  38508. }
  38509. var oldCh = oldVnode.children;
  38510. var ch = vnode.children;
  38511. if (isDef(data) && isPatchable(vnode)) {
  38512. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  38513. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  38514. }
  38515. if (isUndef(vnode.text)) {
  38516. if (isDef(oldCh) && isDef(ch)) {
  38517. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  38518. } else if (isDef(ch)) {
  38519. {
  38520. checkDuplicateKeys(ch);
  38521. }
  38522. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  38523. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  38524. } else if (isDef(oldCh)) {
  38525. removeVnodes(oldCh, 0, oldCh.length - 1);
  38526. } else if (isDef(oldVnode.text)) {
  38527. nodeOps.setTextContent(elm, '');
  38528. }
  38529. } else if (oldVnode.text !== vnode.text) {
  38530. nodeOps.setTextContent(elm, vnode.text);
  38531. }
  38532. if (isDef(data)) {
  38533. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  38534. }
  38535. }
  38536. function invokeInsertHook (vnode, queue, initial) {
  38537. // delay insert hooks for component root nodes, invoke them after the
  38538. // element is really inserted
  38539. if (isTrue(initial) && isDef(vnode.parent)) {
  38540. vnode.parent.data.pendingInsert = queue;
  38541. } else {
  38542. for (var i = 0; i < queue.length; ++i) {
  38543. queue[i].data.hook.insert(queue[i]);
  38544. }
  38545. }
  38546. }
  38547. var hydrationBailed = false;
  38548. // list of modules that can skip create hook during hydration because they
  38549. // are already rendered on the client or has no need for initialization
  38550. // Note: style is excluded because it relies on initial clone for future
  38551. // deep updates (#7063).
  38552. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  38553. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  38554. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  38555. var i;
  38556. var tag = vnode.tag;
  38557. var data = vnode.data;
  38558. var children = vnode.children;
  38559. inVPre = inVPre || (data && data.pre);
  38560. vnode.elm = elm;
  38561. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  38562. vnode.isAsyncPlaceholder = true;
  38563. return true
  38564. }
  38565. // assert node match
  38566. {
  38567. if (!assertNodeMatch(elm, vnode, inVPre)) {
  38568. return false
  38569. }
  38570. }
  38571. if (isDef(data)) {
  38572. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  38573. if (isDef(i = vnode.componentInstance)) {
  38574. // child component. it should have hydrated its own tree.
  38575. initComponent(vnode, insertedVnodeQueue);
  38576. return true
  38577. }
  38578. }
  38579. if (isDef(tag)) {
  38580. if (isDef(children)) {
  38581. // empty element, allow client to pick up and populate children
  38582. if (!elm.hasChildNodes()) {
  38583. createChildren(vnode, children, insertedVnodeQueue);
  38584. } else {
  38585. // v-html and domProps: innerHTML
  38586. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  38587. if (i !== elm.innerHTML) {
  38588. /* istanbul ignore if */
  38589. if (typeof console !== 'undefined' &&
  38590. !hydrationBailed
  38591. ) {
  38592. hydrationBailed = true;
  38593. console.warn('Parent: ', elm);
  38594. console.warn('server innerHTML: ', i);
  38595. console.warn('client innerHTML: ', elm.innerHTML);
  38596. }
  38597. return false
  38598. }
  38599. } else {
  38600. // iterate and compare children lists
  38601. var childrenMatch = true;
  38602. var childNode = elm.firstChild;
  38603. for (var i$1 = 0; i$1 < children.length; i$1++) {
  38604. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  38605. childrenMatch = false;
  38606. break
  38607. }
  38608. childNode = childNode.nextSibling;
  38609. }
  38610. // if childNode is not null, it means the actual childNodes list is
  38611. // longer than the virtual children list.
  38612. if (!childrenMatch || childNode) {
  38613. /* istanbul ignore if */
  38614. if (typeof console !== 'undefined' &&
  38615. !hydrationBailed
  38616. ) {
  38617. hydrationBailed = true;
  38618. console.warn('Parent: ', elm);
  38619. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  38620. }
  38621. return false
  38622. }
  38623. }
  38624. }
  38625. }
  38626. if (isDef(data)) {
  38627. var fullInvoke = false;
  38628. for (var key in data) {
  38629. if (!isRenderedModule(key)) {
  38630. fullInvoke = true;
  38631. invokeCreateHooks(vnode, insertedVnodeQueue);
  38632. break
  38633. }
  38634. }
  38635. if (!fullInvoke && data['class']) {
  38636. // ensure collecting deps for deep class bindings for future updates
  38637. traverse(data['class']);
  38638. }
  38639. }
  38640. } else if (elm.data !== vnode.text) {
  38641. elm.data = vnode.text;
  38642. }
  38643. return true
  38644. }
  38645. function assertNodeMatch (node, vnode, inVPre) {
  38646. if (isDef(vnode.tag)) {
  38647. return vnode.tag.indexOf('vue-component') === 0 || (
  38648. !isUnknownElement$$1(vnode, inVPre) &&
  38649. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  38650. )
  38651. } else {
  38652. return node.nodeType === (vnode.isComment ? 8 : 3)
  38653. }
  38654. }
  38655. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  38656. if (isUndef(vnode)) {
  38657. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  38658. return
  38659. }
  38660. var isInitialPatch = false;
  38661. var insertedVnodeQueue = [];
  38662. if (isUndef(oldVnode)) {
  38663. // empty mount (likely as component), create new root element
  38664. isInitialPatch = true;
  38665. createElm(vnode, insertedVnodeQueue);
  38666. } else {
  38667. var isRealElement = isDef(oldVnode.nodeType);
  38668. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  38669. // patch existing root node
  38670. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  38671. } else {
  38672. if (isRealElement) {
  38673. // mounting to a real element
  38674. // check if this is server-rendered content and if we can perform
  38675. // a successful hydration.
  38676. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  38677. oldVnode.removeAttribute(SSR_ATTR);
  38678. hydrating = true;
  38679. }
  38680. if (isTrue(hydrating)) {
  38681. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  38682. invokeInsertHook(vnode, insertedVnodeQueue, true);
  38683. return oldVnode
  38684. } else {
  38685. warn(
  38686. 'The client-side rendered virtual DOM tree is not matching ' +
  38687. 'server-rendered content. This is likely caused by incorrect ' +
  38688. 'HTML markup, for example nesting block-level elements inside ' +
  38689. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  38690. 'full client-side render.'
  38691. );
  38692. }
  38693. }
  38694. // either not server-rendered, or hydration failed.
  38695. // create an empty node and replace it
  38696. oldVnode = emptyNodeAt(oldVnode);
  38697. }
  38698. // replacing existing element
  38699. var oldElm = oldVnode.elm;
  38700. var parentElm = nodeOps.parentNode(oldElm);
  38701. // create new node
  38702. createElm(
  38703. vnode,
  38704. insertedVnodeQueue,
  38705. // extremely rare edge case: do not insert if old element is in a
  38706. // leaving transition. Only happens when combining transition +
  38707. // keep-alive + HOCs. (#4590)
  38708. oldElm._leaveCb ? null : parentElm,
  38709. nodeOps.nextSibling(oldElm)
  38710. );
  38711. // update parent placeholder node element, recursively
  38712. if (isDef(vnode.parent)) {
  38713. var ancestor = vnode.parent;
  38714. var patchable = isPatchable(vnode);
  38715. while (ancestor) {
  38716. for (var i = 0; i < cbs.destroy.length; ++i) {
  38717. cbs.destroy[i](ancestor);
  38718. }
  38719. ancestor.elm = vnode.elm;
  38720. if (patchable) {
  38721. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  38722. cbs.create[i$1](emptyNode, ancestor);
  38723. }
  38724. // #6513
  38725. // invoke insert hooks that may have been merged by create hooks.
  38726. // e.g. for directives that uses the "inserted" hook.
  38727. var insert = ancestor.data.hook.insert;
  38728. if (insert.merged) {
  38729. // start at index 1 to avoid re-invoking component mounted hook
  38730. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  38731. insert.fns[i$2]();
  38732. }
  38733. }
  38734. } else {
  38735. registerRef(ancestor);
  38736. }
  38737. ancestor = ancestor.parent;
  38738. }
  38739. }
  38740. // destroy old node
  38741. if (isDef(parentElm)) {
  38742. removeVnodes([oldVnode], 0, 0);
  38743. } else if (isDef(oldVnode.tag)) {
  38744. invokeDestroyHook(oldVnode);
  38745. }
  38746. }
  38747. }
  38748. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  38749. return vnode.elm
  38750. }
  38751. }
  38752. /* */
  38753. var directives = {
  38754. create: updateDirectives,
  38755. update: updateDirectives,
  38756. destroy: function unbindDirectives (vnode) {
  38757. updateDirectives(vnode, emptyNode);
  38758. }
  38759. };
  38760. function updateDirectives (oldVnode, vnode) {
  38761. if (oldVnode.data.directives || vnode.data.directives) {
  38762. _update(oldVnode, vnode);
  38763. }
  38764. }
  38765. function _update (oldVnode, vnode) {
  38766. var isCreate = oldVnode === emptyNode;
  38767. var isDestroy = vnode === emptyNode;
  38768. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  38769. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  38770. var dirsWithInsert = [];
  38771. var dirsWithPostpatch = [];
  38772. var key, oldDir, dir;
  38773. for (key in newDirs) {
  38774. oldDir = oldDirs[key];
  38775. dir = newDirs[key];
  38776. if (!oldDir) {
  38777. // new directive, bind
  38778. callHook$1(dir, 'bind', vnode, oldVnode);
  38779. if (dir.def && dir.def.inserted) {
  38780. dirsWithInsert.push(dir);
  38781. }
  38782. } else {
  38783. // existing directive, update
  38784. dir.oldValue = oldDir.value;
  38785. dir.oldArg = oldDir.arg;
  38786. callHook$1(dir, 'update', vnode, oldVnode);
  38787. if (dir.def && dir.def.componentUpdated) {
  38788. dirsWithPostpatch.push(dir);
  38789. }
  38790. }
  38791. }
  38792. if (dirsWithInsert.length) {
  38793. var callInsert = function () {
  38794. for (var i = 0; i < dirsWithInsert.length; i++) {
  38795. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  38796. }
  38797. };
  38798. if (isCreate) {
  38799. mergeVNodeHook(vnode, 'insert', callInsert);
  38800. } else {
  38801. callInsert();
  38802. }
  38803. }
  38804. if (dirsWithPostpatch.length) {
  38805. mergeVNodeHook(vnode, 'postpatch', function () {
  38806. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  38807. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  38808. }
  38809. });
  38810. }
  38811. if (!isCreate) {
  38812. for (key in oldDirs) {
  38813. if (!newDirs[key]) {
  38814. // no longer present, unbind
  38815. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  38816. }
  38817. }
  38818. }
  38819. }
  38820. var emptyModifiers = Object.create(null);
  38821. function normalizeDirectives$1 (
  38822. dirs,
  38823. vm
  38824. ) {
  38825. var res = Object.create(null);
  38826. if (!dirs) {
  38827. // $flow-disable-line
  38828. return res
  38829. }
  38830. var i, dir;
  38831. for (i = 0; i < dirs.length; i++) {
  38832. dir = dirs[i];
  38833. if (!dir.modifiers) {
  38834. // $flow-disable-line
  38835. dir.modifiers = emptyModifiers;
  38836. }
  38837. res[getRawDirName(dir)] = dir;
  38838. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  38839. }
  38840. // $flow-disable-line
  38841. return res
  38842. }
  38843. function getRawDirName (dir) {
  38844. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  38845. }
  38846. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  38847. var fn = dir.def && dir.def[hook];
  38848. if (fn) {
  38849. try {
  38850. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  38851. } catch (e) {
  38852. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  38853. }
  38854. }
  38855. }
  38856. var baseModules = [
  38857. ref,
  38858. directives
  38859. ];
  38860. /* */
  38861. function updateAttrs (oldVnode, vnode) {
  38862. var opts = vnode.componentOptions;
  38863. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  38864. return
  38865. }
  38866. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  38867. return
  38868. }
  38869. var key, cur, old;
  38870. var elm = vnode.elm;
  38871. var oldAttrs = oldVnode.data.attrs || {};
  38872. var attrs = vnode.data.attrs || {};
  38873. // clone observed objects, as the user probably wants to mutate it
  38874. if (isDef(attrs.__ob__)) {
  38875. attrs = vnode.data.attrs = extend({}, attrs);
  38876. }
  38877. for (key in attrs) {
  38878. cur = attrs[key];
  38879. old = oldAttrs[key];
  38880. if (old !== cur) {
  38881. setAttr(elm, key, cur);
  38882. }
  38883. }
  38884. // #4391: in IE9, setting type can reset value for input[type=radio]
  38885. // #6666: IE/Edge forces progress value down to 1 before setting a max
  38886. /* istanbul ignore if */
  38887. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  38888. setAttr(elm, 'value', attrs.value);
  38889. }
  38890. for (key in oldAttrs) {
  38891. if (isUndef(attrs[key])) {
  38892. if (isXlink(key)) {
  38893. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  38894. } else if (!isEnumeratedAttr(key)) {
  38895. elm.removeAttribute(key);
  38896. }
  38897. }
  38898. }
  38899. }
  38900. function setAttr (el, key, value) {
  38901. if (el.tagName.indexOf('-') > -1) {
  38902. baseSetAttr(el, key, value);
  38903. } else if (isBooleanAttr(key)) {
  38904. // set attribute for blank value
  38905. // e.g. <option disabled>Select one</option>
  38906. if (isFalsyAttrValue(value)) {
  38907. el.removeAttribute(key);
  38908. } else {
  38909. // technically allowfullscreen is a boolean attribute for <iframe>,
  38910. // but Flash expects a value of "true" when used on <embed> tag
  38911. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  38912. ? 'true'
  38913. : key;
  38914. el.setAttribute(key, value);
  38915. }
  38916. } else if (isEnumeratedAttr(key)) {
  38917. el.setAttribute(key, convertEnumeratedValue(key, value));
  38918. } else if (isXlink(key)) {
  38919. if (isFalsyAttrValue(value)) {
  38920. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  38921. } else {
  38922. el.setAttributeNS(xlinkNS, key, value);
  38923. }
  38924. } else {
  38925. baseSetAttr(el, key, value);
  38926. }
  38927. }
  38928. function baseSetAttr (el, key, value) {
  38929. if (isFalsyAttrValue(value)) {
  38930. el.removeAttribute(key);
  38931. } else {
  38932. // #7138: IE10 & 11 fires input event when setting placeholder on
  38933. // <textarea>... block the first input event and remove the blocker
  38934. // immediately.
  38935. /* istanbul ignore if */
  38936. if (
  38937. isIE && !isIE9 &&
  38938. el.tagName === 'TEXTAREA' &&
  38939. key === 'placeholder' && value !== '' && !el.__ieph
  38940. ) {
  38941. var blocker = function (e) {
  38942. e.stopImmediatePropagation();
  38943. el.removeEventListener('input', blocker);
  38944. };
  38945. el.addEventListener('input', blocker);
  38946. // $flow-disable-line
  38947. el.__ieph = true; /* IE placeholder patched */
  38948. }
  38949. el.setAttribute(key, value);
  38950. }
  38951. }
  38952. var attrs = {
  38953. create: updateAttrs,
  38954. update: updateAttrs
  38955. };
  38956. /* */
  38957. function updateClass (oldVnode, vnode) {
  38958. var el = vnode.elm;
  38959. var data = vnode.data;
  38960. var oldData = oldVnode.data;
  38961. if (
  38962. isUndef(data.staticClass) &&
  38963. isUndef(data.class) && (
  38964. isUndef(oldData) || (
  38965. isUndef(oldData.staticClass) &&
  38966. isUndef(oldData.class)
  38967. )
  38968. )
  38969. ) {
  38970. return
  38971. }
  38972. var cls = genClassForVnode(vnode);
  38973. // handle transition classes
  38974. var transitionClass = el._transitionClasses;
  38975. if (isDef(transitionClass)) {
  38976. cls = concat(cls, stringifyClass(transitionClass));
  38977. }
  38978. // set the class
  38979. if (cls !== el._prevClass) {
  38980. el.setAttribute('class', cls);
  38981. el._prevClass = cls;
  38982. }
  38983. }
  38984. var klass = {
  38985. create: updateClass,
  38986. update: updateClass
  38987. };
  38988. /* */
  38989. var validDivisionCharRE = /[\w).+\-_$\]]/;
  38990. function parseFilters (exp) {
  38991. var inSingle = false;
  38992. var inDouble = false;
  38993. var inTemplateString = false;
  38994. var inRegex = false;
  38995. var curly = 0;
  38996. var square = 0;
  38997. var paren = 0;
  38998. var lastFilterIndex = 0;
  38999. var c, prev, i, expression, filters;
  39000. for (i = 0; i < exp.length; i++) {
  39001. prev = c;
  39002. c = exp.charCodeAt(i);
  39003. if (inSingle) {
  39004. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  39005. } else if (inDouble) {
  39006. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  39007. } else if (inTemplateString) {
  39008. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  39009. } else if (inRegex) {
  39010. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  39011. } else if (
  39012. c === 0x7C && // pipe
  39013. exp.charCodeAt(i + 1) !== 0x7C &&
  39014. exp.charCodeAt(i - 1) !== 0x7C &&
  39015. !curly && !square && !paren
  39016. ) {
  39017. if (expression === undefined) {
  39018. // first filter, end of expression
  39019. lastFilterIndex = i + 1;
  39020. expression = exp.slice(0, i).trim();
  39021. } else {
  39022. pushFilter();
  39023. }
  39024. } else {
  39025. switch (c) {
  39026. case 0x22: inDouble = true; break // "
  39027. case 0x27: inSingle = true; break // '
  39028. case 0x60: inTemplateString = true; break // `
  39029. case 0x28: paren++; break // (
  39030. case 0x29: paren--; break // )
  39031. case 0x5B: square++; break // [
  39032. case 0x5D: square--; break // ]
  39033. case 0x7B: curly++; break // {
  39034. case 0x7D: curly--; break // }
  39035. }
  39036. if (c === 0x2f) { // /
  39037. var j = i - 1;
  39038. var p = (void 0);
  39039. // find first non-whitespace prev char
  39040. for (; j >= 0; j--) {
  39041. p = exp.charAt(j);
  39042. if (p !== ' ') { break }
  39043. }
  39044. if (!p || !validDivisionCharRE.test(p)) {
  39045. inRegex = true;
  39046. }
  39047. }
  39048. }
  39049. }
  39050. if (expression === undefined) {
  39051. expression = exp.slice(0, i).trim();
  39052. } else if (lastFilterIndex !== 0) {
  39053. pushFilter();
  39054. }
  39055. function pushFilter () {
  39056. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  39057. lastFilterIndex = i + 1;
  39058. }
  39059. if (filters) {
  39060. for (i = 0; i < filters.length; i++) {
  39061. expression = wrapFilter(expression, filters[i]);
  39062. }
  39063. }
  39064. return expression
  39065. }
  39066. function wrapFilter (exp, filter) {
  39067. var i = filter.indexOf('(');
  39068. if (i < 0) {
  39069. // _f: resolveFilter
  39070. return ("_f(\"" + filter + "\")(" + exp + ")")
  39071. } else {
  39072. var name = filter.slice(0, i);
  39073. var args = filter.slice(i + 1);
  39074. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  39075. }
  39076. }
  39077. /* */
  39078. /* eslint-disable no-unused-vars */
  39079. function baseWarn (msg, range) {
  39080. console.error(("[Vue compiler]: " + msg));
  39081. }
  39082. /* eslint-enable no-unused-vars */
  39083. function pluckModuleFunction (
  39084. modules,
  39085. key
  39086. ) {
  39087. return modules
  39088. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  39089. : []
  39090. }
  39091. function addProp (el, name, value, range, dynamic) {
  39092. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  39093. el.plain = false;
  39094. }
  39095. function addAttr (el, name, value, range, dynamic) {
  39096. var attrs = dynamic
  39097. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  39098. : (el.attrs || (el.attrs = []));
  39099. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  39100. el.plain = false;
  39101. }
  39102. // add a raw attr (use this in preTransforms)
  39103. function addRawAttr (el, name, value, range) {
  39104. el.attrsMap[name] = value;
  39105. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  39106. }
  39107. function addDirective (
  39108. el,
  39109. name,
  39110. rawName,
  39111. value,
  39112. arg,
  39113. isDynamicArg,
  39114. modifiers,
  39115. range
  39116. ) {
  39117. (el.directives || (el.directives = [])).push(rangeSetItem({
  39118. name: name,
  39119. rawName: rawName,
  39120. value: value,
  39121. arg: arg,
  39122. isDynamicArg: isDynamicArg,
  39123. modifiers: modifiers
  39124. }, range));
  39125. el.plain = false;
  39126. }
  39127. function prependModifierMarker (symbol, name, dynamic) {
  39128. return dynamic
  39129. ? ("_p(" + name + ",\"" + symbol + "\")")
  39130. : symbol + name // mark the event as captured
  39131. }
  39132. function addHandler (
  39133. el,
  39134. name,
  39135. value,
  39136. modifiers,
  39137. important,
  39138. warn,
  39139. range,
  39140. dynamic
  39141. ) {
  39142. modifiers = modifiers || emptyObject;
  39143. // warn prevent and passive modifier
  39144. /* istanbul ignore if */
  39145. if (
  39146. warn &&
  39147. modifiers.prevent && modifiers.passive
  39148. ) {
  39149. warn(
  39150. 'passive and prevent can\'t be used together. ' +
  39151. 'Passive handler can\'t prevent default event.',
  39152. range
  39153. );
  39154. }
  39155. // normalize click.right and click.middle since they don't actually fire
  39156. // this is technically browser-specific, but at least for now browsers are
  39157. // the only target envs that have right/middle clicks.
  39158. if (modifiers.right) {
  39159. if (dynamic) {
  39160. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  39161. } else if (name === 'click') {
  39162. name = 'contextmenu';
  39163. delete modifiers.right;
  39164. }
  39165. } else if (modifiers.middle) {
  39166. if (dynamic) {
  39167. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  39168. } else if (name === 'click') {
  39169. name = 'mouseup';
  39170. }
  39171. }
  39172. // check capture modifier
  39173. if (modifiers.capture) {
  39174. delete modifiers.capture;
  39175. name = prependModifierMarker('!', name, dynamic);
  39176. }
  39177. if (modifiers.once) {
  39178. delete modifiers.once;
  39179. name = prependModifierMarker('~', name, dynamic);
  39180. }
  39181. /* istanbul ignore if */
  39182. if (modifiers.passive) {
  39183. delete modifiers.passive;
  39184. name = prependModifierMarker('&', name, dynamic);
  39185. }
  39186. var events;
  39187. if (modifiers.native) {
  39188. delete modifiers.native;
  39189. events = el.nativeEvents || (el.nativeEvents = {});
  39190. } else {
  39191. events = el.events || (el.events = {});
  39192. }
  39193. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  39194. if (modifiers !== emptyObject) {
  39195. newHandler.modifiers = modifiers;
  39196. }
  39197. var handlers = events[name];
  39198. /* istanbul ignore if */
  39199. if (Array.isArray(handlers)) {
  39200. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  39201. } else if (handlers) {
  39202. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  39203. } else {
  39204. events[name] = newHandler;
  39205. }
  39206. el.plain = false;
  39207. }
  39208. function getRawBindingAttr (
  39209. el,
  39210. name
  39211. ) {
  39212. return el.rawAttrsMap[':' + name] ||
  39213. el.rawAttrsMap['v-bind:' + name] ||
  39214. el.rawAttrsMap[name]
  39215. }
  39216. function getBindingAttr (
  39217. el,
  39218. name,
  39219. getStatic
  39220. ) {
  39221. var dynamicValue =
  39222. getAndRemoveAttr(el, ':' + name) ||
  39223. getAndRemoveAttr(el, 'v-bind:' + name);
  39224. if (dynamicValue != null) {
  39225. return parseFilters(dynamicValue)
  39226. } else if (getStatic !== false) {
  39227. var staticValue = getAndRemoveAttr(el, name);
  39228. if (staticValue != null) {
  39229. return JSON.stringify(staticValue)
  39230. }
  39231. }
  39232. }
  39233. // note: this only removes the attr from the Array (attrsList) so that it
  39234. // doesn't get processed by processAttrs.
  39235. // By default it does NOT remove it from the map (attrsMap) because the map is
  39236. // needed during codegen.
  39237. function getAndRemoveAttr (
  39238. el,
  39239. name,
  39240. removeFromMap
  39241. ) {
  39242. var val;
  39243. if ((val = el.attrsMap[name]) != null) {
  39244. var list = el.attrsList;
  39245. for (var i = 0, l = list.length; i < l; i++) {
  39246. if (list[i].name === name) {
  39247. list.splice(i, 1);
  39248. break
  39249. }
  39250. }
  39251. }
  39252. if (removeFromMap) {
  39253. delete el.attrsMap[name];
  39254. }
  39255. return val
  39256. }
  39257. function getAndRemoveAttrByRegex (
  39258. el,
  39259. name
  39260. ) {
  39261. var list = el.attrsList;
  39262. for (var i = 0, l = list.length; i < l; i++) {
  39263. var attr = list[i];
  39264. if (name.test(attr.name)) {
  39265. list.splice(i, 1);
  39266. return attr
  39267. }
  39268. }
  39269. }
  39270. function rangeSetItem (
  39271. item,
  39272. range
  39273. ) {
  39274. if (range) {
  39275. if (range.start != null) {
  39276. item.start = range.start;
  39277. }
  39278. if (range.end != null) {
  39279. item.end = range.end;
  39280. }
  39281. }
  39282. return item
  39283. }
  39284. /* */
  39285. /**
  39286. * Cross-platform code generation for component v-model
  39287. */
  39288. function genComponentModel (
  39289. el,
  39290. value,
  39291. modifiers
  39292. ) {
  39293. var ref = modifiers || {};
  39294. var number = ref.number;
  39295. var trim = ref.trim;
  39296. var baseValueExpression = '$$v';
  39297. var valueExpression = baseValueExpression;
  39298. if (trim) {
  39299. valueExpression =
  39300. "(typeof " + baseValueExpression + " === 'string'" +
  39301. "? " + baseValueExpression + ".trim()" +
  39302. ": " + baseValueExpression + ")";
  39303. }
  39304. if (number) {
  39305. valueExpression = "_n(" + valueExpression + ")";
  39306. }
  39307. var assignment = genAssignmentCode(value, valueExpression);
  39308. el.model = {
  39309. value: ("(" + value + ")"),
  39310. expression: JSON.stringify(value),
  39311. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  39312. };
  39313. }
  39314. /**
  39315. * Cross-platform codegen helper for generating v-model value assignment code.
  39316. */
  39317. function genAssignmentCode (
  39318. value,
  39319. assignment
  39320. ) {
  39321. var res = parseModel(value);
  39322. if (res.key === null) {
  39323. return (value + "=" + assignment)
  39324. } else {
  39325. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  39326. }
  39327. }
  39328. /**
  39329. * Parse a v-model expression into a base path and a final key segment.
  39330. * Handles both dot-path and possible square brackets.
  39331. *
  39332. * Possible cases:
  39333. *
  39334. * - test
  39335. * - test[key]
  39336. * - test[test1[key]]
  39337. * - test["a"][key]
  39338. * - xxx.test[a[a].test1[key]]
  39339. * - test.xxx.a["asa"][test1[key]]
  39340. *
  39341. */
  39342. var len, str, chr, index$1, expressionPos, expressionEndPos;
  39343. function parseModel (val) {
  39344. // Fix https://github.com/vuejs/vue/pull/7730
  39345. // allow v-model="obj.val " (trailing whitespace)
  39346. val = val.trim();
  39347. len = val.length;
  39348. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  39349. index$1 = val.lastIndexOf('.');
  39350. if (index$1 > -1) {
  39351. return {
  39352. exp: val.slice(0, index$1),
  39353. key: '"' + val.slice(index$1 + 1) + '"'
  39354. }
  39355. } else {
  39356. return {
  39357. exp: val,
  39358. key: null
  39359. }
  39360. }
  39361. }
  39362. str = val;
  39363. index$1 = expressionPos = expressionEndPos = 0;
  39364. while (!eof()) {
  39365. chr = next();
  39366. /* istanbul ignore if */
  39367. if (isStringStart(chr)) {
  39368. parseString(chr);
  39369. } else if (chr === 0x5B) {
  39370. parseBracket(chr);
  39371. }
  39372. }
  39373. return {
  39374. exp: val.slice(0, expressionPos),
  39375. key: val.slice(expressionPos + 1, expressionEndPos)
  39376. }
  39377. }
  39378. function next () {
  39379. return str.charCodeAt(++index$1)
  39380. }
  39381. function eof () {
  39382. return index$1 >= len
  39383. }
  39384. function isStringStart (chr) {
  39385. return chr === 0x22 || chr === 0x27
  39386. }
  39387. function parseBracket (chr) {
  39388. var inBracket = 1;
  39389. expressionPos = index$1;
  39390. while (!eof()) {
  39391. chr = next();
  39392. if (isStringStart(chr)) {
  39393. parseString(chr);
  39394. continue
  39395. }
  39396. if (chr === 0x5B) { inBracket++; }
  39397. if (chr === 0x5D) { inBracket--; }
  39398. if (inBracket === 0) {
  39399. expressionEndPos = index$1;
  39400. break
  39401. }
  39402. }
  39403. }
  39404. function parseString (chr) {
  39405. var stringQuote = chr;
  39406. while (!eof()) {
  39407. chr = next();
  39408. if (chr === stringQuote) {
  39409. break
  39410. }
  39411. }
  39412. }
  39413. /* */
  39414. var warn$1;
  39415. // in some cases, the event used has to be determined at runtime
  39416. // so we used some reserved tokens during compile.
  39417. var RANGE_TOKEN = '__r';
  39418. var CHECKBOX_RADIO_TOKEN = '__c';
  39419. function model (
  39420. el,
  39421. dir,
  39422. _warn
  39423. ) {
  39424. warn$1 = _warn;
  39425. var value = dir.value;
  39426. var modifiers = dir.modifiers;
  39427. var tag = el.tag;
  39428. var type = el.attrsMap.type;
  39429. {
  39430. // inputs with type="file" are read only and setting the input's
  39431. // value will throw an error.
  39432. if (tag === 'input' && type === 'file') {
  39433. warn$1(
  39434. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  39435. "File inputs are read only. Use a v-on:change listener instead.",
  39436. el.rawAttrsMap['v-model']
  39437. );
  39438. }
  39439. }
  39440. if (el.component) {
  39441. genComponentModel(el, value, modifiers);
  39442. // component v-model doesn't need extra runtime
  39443. return false
  39444. } else if (tag === 'select') {
  39445. genSelect(el, value, modifiers);
  39446. } else if (tag === 'input' && type === 'checkbox') {
  39447. genCheckboxModel(el, value, modifiers);
  39448. } else if (tag === 'input' && type === 'radio') {
  39449. genRadioModel(el, value, modifiers);
  39450. } else if (tag === 'input' || tag === 'textarea') {
  39451. genDefaultModel(el, value, modifiers);
  39452. } else if (!config.isReservedTag(tag)) {
  39453. genComponentModel(el, value, modifiers);
  39454. // component v-model doesn't need extra runtime
  39455. return false
  39456. } else {
  39457. warn$1(
  39458. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  39459. "v-model is not supported on this element type. " +
  39460. 'If you are working with contenteditable, it\'s recommended to ' +
  39461. 'wrap a library dedicated for that purpose inside a custom component.',
  39462. el.rawAttrsMap['v-model']
  39463. );
  39464. }
  39465. // ensure runtime directive metadata
  39466. return true
  39467. }
  39468. function genCheckboxModel (
  39469. el,
  39470. value,
  39471. modifiers
  39472. ) {
  39473. var number = modifiers && modifiers.number;
  39474. var valueBinding = getBindingAttr(el, 'value') || 'null';
  39475. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  39476. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  39477. addProp(el, 'checked',
  39478. "Array.isArray(" + value + ")" +
  39479. "?_i(" + value + "," + valueBinding + ")>-1" + (
  39480. trueValueBinding === 'true'
  39481. ? (":(" + value + ")")
  39482. : (":_q(" + value + "," + trueValueBinding + ")")
  39483. )
  39484. );
  39485. addHandler(el, 'change',
  39486. "var $$a=" + value + "," +
  39487. '$$el=$event.target,' +
  39488. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  39489. 'if(Array.isArray($$a)){' +
  39490. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  39491. '$$i=_i($$a,$$v);' +
  39492. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  39493. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  39494. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  39495. null, true
  39496. );
  39497. }
  39498. function genRadioModel (
  39499. el,
  39500. value,
  39501. modifiers
  39502. ) {
  39503. var number = modifiers && modifiers.number;
  39504. var valueBinding = getBindingAttr(el, 'value') || 'null';
  39505. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  39506. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  39507. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  39508. }
  39509. function genSelect (
  39510. el,
  39511. value,
  39512. modifiers
  39513. ) {
  39514. var number = modifiers && modifiers.number;
  39515. var selectedVal = "Array.prototype.filter" +
  39516. ".call($event.target.options,function(o){return o.selected})" +
  39517. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  39518. "return " + (number ? '_n(val)' : 'val') + "})";
  39519. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  39520. var code = "var $$selectedVal = " + selectedVal + ";";
  39521. code = code + " " + (genAssignmentCode(value, assignment));
  39522. addHandler(el, 'change', code, null, true);
  39523. }
  39524. function genDefaultModel (
  39525. el,
  39526. value,
  39527. modifiers
  39528. ) {
  39529. var type = el.attrsMap.type;
  39530. // warn if v-bind:value conflicts with v-model
  39531. // except for inputs with v-bind:type
  39532. {
  39533. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  39534. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  39535. if (value$1 && !typeBinding) {
  39536. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  39537. warn$1(
  39538. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  39539. 'because the latter already expands to a value binding internally',
  39540. el.rawAttrsMap[binding]
  39541. );
  39542. }
  39543. }
  39544. var ref = modifiers || {};
  39545. var lazy = ref.lazy;
  39546. var number = ref.number;
  39547. var trim = ref.trim;
  39548. var needCompositionGuard = !lazy && type !== 'range';
  39549. var event = lazy
  39550. ? 'change'
  39551. : type === 'range'
  39552. ? RANGE_TOKEN
  39553. : 'input';
  39554. var valueExpression = '$event.target.value';
  39555. if (trim) {
  39556. valueExpression = "$event.target.value.trim()";
  39557. }
  39558. if (number) {
  39559. valueExpression = "_n(" + valueExpression + ")";
  39560. }
  39561. var code = genAssignmentCode(value, valueExpression);
  39562. if (needCompositionGuard) {
  39563. code = "if($event.target.composing)return;" + code;
  39564. }
  39565. addProp(el, 'value', ("(" + value + ")"));
  39566. addHandler(el, event, code, null, true);
  39567. if (trim || number) {
  39568. addHandler(el, 'blur', '$forceUpdate()');
  39569. }
  39570. }
  39571. /* */
  39572. // normalize v-model event tokens that can only be determined at runtime.
  39573. // it's important to place the event as the first in the array because
  39574. // the whole point is ensuring the v-model callback gets called before
  39575. // user-attached handlers.
  39576. function normalizeEvents (on) {
  39577. /* istanbul ignore if */
  39578. if (isDef(on[RANGE_TOKEN])) {
  39579. // IE input[type=range] only supports `change` event
  39580. var event = isIE ? 'change' : 'input';
  39581. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  39582. delete on[RANGE_TOKEN];
  39583. }
  39584. // This was originally intended to fix #4521 but no longer necessary
  39585. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  39586. /* istanbul ignore if */
  39587. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  39588. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  39589. delete on[CHECKBOX_RADIO_TOKEN];
  39590. }
  39591. }
  39592. var target$1;
  39593. function createOnceHandler$1 (event, handler, capture) {
  39594. var _target = target$1; // save current target element in closure
  39595. return function onceHandler () {
  39596. var res = handler.apply(null, arguments);
  39597. if (res !== null) {
  39598. remove$2(event, onceHandler, capture, _target);
  39599. }
  39600. }
  39601. }
  39602. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  39603. // implementation and does not fire microtasks in between event propagation, so
  39604. // safe to exclude.
  39605. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  39606. function add$1 (
  39607. name,
  39608. handler,
  39609. capture,
  39610. passive
  39611. ) {
  39612. // async edge case #6566: inner click event triggers patch, event handler
  39613. // attached to outer element during patch, and triggered again. This
  39614. // happens because browsers fire microtask ticks between event propagation.
  39615. // the solution is simple: we save the timestamp when a handler is attached,
  39616. // and the handler would only fire if the event passed to it was fired
  39617. // AFTER it was attached.
  39618. if (useMicrotaskFix) {
  39619. var attachedTimestamp = currentFlushTimestamp;
  39620. var original = handler;
  39621. handler = original._wrapper = function (e) {
  39622. if (
  39623. // no bubbling, should always fire.
  39624. // this is just a safety net in case event.timeStamp is unreliable in
  39625. // certain weird environments...
  39626. e.target === e.currentTarget ||
  39627. // event is fired after handler attachment
  39628. e.timeStamp >= attachedTimestamp ||
  39629. // bail for environments that have buggy event.timeStamp implementations
  39630. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  39631. // #9681 QtWebEngine event.timeStamp is negative value
  39632. e.timeStamp <= 0 ||
  39633. // #9448 bail if event is fired in another document in a multi-page
  39634. // electron/nw.js app, since event.timeStamp will be using a different
  39635. // starting reference
  39636. e.target.ownerDocument !== document
  39637. ) {
  39638. return original.apply(this, arguments)
  39639. }
  39640. };
  39641. }
  39642. target$1.addEventListener(
  39643. name,
  39644. handler,
  39645. supportsPassive
  39646. ? { capture: capture, passive: passive }
  39647. : capture
  39648. );
  39649. }
  39650. function remove$2 (
  39651. name,
  39652. handler,
  39653. capture,
  39654. _target
  39655. ) {
  39656. (_target || target$1).removeEventListener(
  39657. name,
  39658. handler._wrapper || handler,
  39659. capture
  39660. );
  39661. }
  39662. function updateDOMListeners (oldVnode, vnode) {
  39663. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  39664. return
  39665. }
  39666. var on = vnode.data.on || {};
  39667. var oldOn = oldVnode.data.on || {};
  39668. target$1 = vnode.elm;
  39669. normalizeEvents(on);
  39670. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  39671. target$1 = undefined;
  39672. }
  39673. var events = {
  39674. create: updateDOMListeners,
  39675. update: updateDOMListeners
  39676. };
  39677. /* */
  39678. var svgContainer;
  39679. function updateDOMProps (oldVnode, vnode) {
  39680. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  39681. return
  39682. }
  39683. var key, cur;
  39684. var elm = vnode.elm;
  39685. var oldProps = oldVnode.data.domProps || {};
  39686. var props = vnode.data.domProps || {};
  39687. // clone observed objects, as the user probably wants to mutate it
  39688. if (isDef(props.__ob__)) {
  39689. props = vnode.data.domProps = extend({}, props);
  39690. }
  39691. for (key in oldProps) {
  39692. if (!(key in props)) {
  39693. elm[key] = '';
  39694. }
  39695. }
  39696. for (key in props) {
  39697. cur = props[key];
  39698. // ignore children if the node has textContent or innerHTML,
  39699. // as these will throw away existing DOM nodes and cause removal errors
  39700. // on subsequent patches (#3360)
  39701. if (key === 'textContent' || key === 'innerHTML') {
  39702. if (vnode.children) { vnode.children.length = 0; }
  39703. if (cur === oldProps[key]) { continue }
  39704. // #6601 work around Chrome version <= 55 bug where single textNode
  39705. // replaced by innerHTML/textContent retains its parentNode property
  39706. if (elm.childNodes.length === 1) {
  39707. elm.removeChild(elm.childNodes[0]);
  39708. }
  39709. }
  39710. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  39711. // store value as _value as well since
  39712. // non-string values will be stringified
  39713. elm._value = cur;
  39714. // avoid resetting cursor position when value is the same
  39715. var strCur = isUndef(cur) ? '' : String(cur);
  39716. if (shouldUpdateValue(elm, strCur)) {
  39717. elm.value = strCur;
  39718. }
  39719. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  39720. // IE doesn't support innerHTML for SVG elements
  39721. svgContainer = svgContainer || document.createElement('div');
  39722. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  39723. var svg = svgContainer.firstChild;
  39724. while (elm.firstChild) {
  39725. elm.removeChild(elm.firstChild);
  39726. }
  39727. while (svg.firstChild) {
  39728. elm.appendChild(svg.firstChild);
  39729. }
  39730. } else if (
  39731. // skip the update if old and new VDOM state is the same.
  39732. // `value` is handled separately because the DOM value may be temporarily
  39733. // out of sync with VDOM state due to focus, composition and modifiers.
  39734. // This #4521 by skipping the unnecesarry `checked` update.
  39735. cur !== oldProps[key]
  39736. ) {
  39737. // some property updates can throw
  39738. // e.g. `value` on <progress> w/ non-finite value
  39739. try {
  39740. elm[key] = cur;
  39741. } catch (e) {}
  39742. }
  39743. }
  39744. }
  39745. // check platforms/web/util/attrs.js acceptValue
  39746. function shouldUpdateValue (elm, checkVal) {
  39747. return (!elm.composing && (
  39748. elm.tagName === 'OPTION' ||
  39749. isNotInFocusAndDirty(elm, checkVal) ||
  39750. isDirtyWithModifiers(elm, checkVal)
  39751. ))
  39752. }
  39753. function isNotInFocusAndDirty (elm, checkVal) {
  39754. // return true when textbox (.number and .trim) loses focus and its value is
  39755. // not equal to the updated value
  39756. var notInFocus = true;
  39757. // #6157
  39758. // work around IE bug when accessing document.activeElement in an iframe
  39759. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  39760. return notInFocus && elm.value !== checkVal
  39761. }
  39762. function isDirtyWithModifiers (elm, newVal) {
  39763. var value = elm.value;
  39764. var modifiers = elm._vModifiers; // injected by v-model runtime
  39765. if (isDef(modifiers)) {
  39766. if (modifiers.number) {
  39767. return toNumber(value) !== toNumber(newVal)
  39768. }
  39769. if (modifiers.trim) {
  39770. return value.trim() !== newVal.trim()
  39771. }
  39772. }
  39773. return value !== newVal
  39774. }
  39775. var domProps = {
  39776. create: updateDOMProps,
  39777. update: updateDOMProps
  39778. };
  39779. /* */
  39780. var parseStyleText = cached(function (cssText) {
  39781. var res = {};
  39782. var listDelimiter = /;(?![^(]*\))/g;
  39783. var propertyDelimiter = /:(.+)/;
  39784. cssText.split(listDelimiter).forEach(function (item) {
  39785. if (item) {
  39786. var tmp = item.split(propertyDelimiter);
  39787. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  39788. }
  39789. });
  39790. return res
  39791. });
  39792. // merge static and dynamic style data on the same vnode
  39793. function normalizeStyleData (data) {
  39794. var style = normalizeStyleBinding(data.style);
  39795. // static style is pre-processed into an object during compilation
  39796. // and is always a fresh object, so it's safe to merge into it
  39797. return data.staticStyle
  39798. ? extend(data.staticStyle, style)
  39799. : style
  39800. }
  39801. // normalize possible array / string values into Object
  39802. function normalizeStyleBinding (bindingStyle) {
  39803. if (Array.isArray(bindingStyle)) {
  39804. return toObject(bindingStyle)
  39805. }
  39806. if (typeof bindingStyle === 'string') {
  39807. return parseStyleText(bindingStyle)
  39808. }
  39809. return bindingStyle
  39810. }
  39811. /**
  39812. * parent component style should be after child's
  39813. * so that parent component's style could override it
  39814. */
  39815. function getStyle (vnode, checkChild) {
  39816. var res = {};
  39817. var styleData;
  39818. if (checkChild) {
  39819. var childNode = vnode;
  39820. while (childNode.componentInstance) {
  39821. childNode = childNode.componentInstance._vnode;
  39822. if (
  39823. childNode && childNode.data &&
  39824. (styleData = normalizeStyleData(childNode.data))
  39825. ) {
  39826. extend(res, styleData);
  39827. }
  39828. }
  39829. }
  39830. if ((styleData = normalizeStyleData(vnode.data))) {
  39831. extend(res, styleData);
  39832. }
  39833. var parentNode = vnode;
  39834. while ((parentNode = parentNode.parent)) {
  39835. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  39836. extend(res, styleData);
  39837. }
  39838. }
  39839. return res
  39840. }
  39841. /* */
  39842. var cssVarRE = /^--/;
  39843. var importantRE = /\s*!important$/;
  39844. var setProp = function (el, name, val) {
  39845. /* istanbul ignore if */
  39846. if (cssVarRE.test(name)) {
  39847. el.style.setProperty(name, val);
  39848. } else if (importantRE.test(val)) {
  39849. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  39850. } else {
  39851. var normalizedName = normalize(name);
  39852. if (Array.isArray(val)) {
  39853. // Support values array created by autoprefixer, e.g.
  39854. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  39855. // Set them one by one, and the browser will only set those it can recognize
  39856. for (var i = 0, len = val.length; i < len; i++) {
  39857. el.style[normalizedName] = val[i];
  39858. }
  39859. } else {
  39860. el.style[normalizedName] = val;
  39861. }
  39862. }
  39863. };
  39864. var vendorNames = ['Webkit', 'Moz', 'ms'];
  39865. var emptyStyle;
  39866. var normalize = cached(function (prop) {
  39867. emptyStyle = emptyStyle || document.createElement('div').style;
  39868. prop = camelize(prop);
  39869. if (prop !== 'filter' && (prop in emptyStyle)) {
  39870. return prop
  39871. }
  39872. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  39873. for (var i = 0; i < vendorNames.length; i++) {
  39874. var name = vendorNames[i] + capName;
  39875. if (name in emptyStyle) {
  39876. return name
  39877. }
  39878. }
  39879. });
  39880. function updateStyle (oldVnode, vnode) {
  39881. var data = vnode.data;
  39882. var oldData = oldVnode.data;
  39883. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  39884. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  39885. ) {
  39886. return
  39887. }
  39888. var cur, name;
  39889. var el = vnode.elm;
  39890. var oldStaticStyle = oldData.staticStyle;
  39891. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  39892. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  39893. var oldStyle = oldStaticStyle || oldStyleBinding;
  39894. var style = normalizeStyleBinding(vnode.data.style) || {};
  39895. // store normalized style under a different key for next diff
  39896. // make sure to clone it if it's reactive, since the user likely wants
  39897. // to mutate it.
  39898. vnode.data.normalizedStyle = isDef(style.__ob__)
  39899. ? extend({}, style)
  39900. : style;
  39901. var newStyle = getStyle(vnode, true);
  39902. for (name in oldStyle) {
  39903. if (isUndef(newStyle[name])) {
  39904. setProp(el, name, '');
  39905. }
  39906. }
  39907. for (name in newStyle) {
  39908. cur = newStyle[name];
  39909. if (cur !== oldStyle[name]) {
  39910. // ie9 setting to null has no effect, must use empty string
  39911. setProp(el, name, cur == null ? '' : cur);
  39912. }
  39913. }
  39914. }
  39915. var style = {
  39916. create: updateStyle,
  39917. update: updateStyle
  39918. };
  39919. /* */
  39920. var whitespaceRE = /\s+/;
  39921. /**
  39922. * Add class with compatibility for SVG since classList is not supported on
  39923. * SVG elements in IE
  39924. */
  39925. function addClass (el, cls) {
  39926. /* istanbul ignore if */
  39927. if (!cls || !(cls = cls.trim())) {
  39928. return
  39929. }
  39930. /* istanbul ignore else */
  39931. if (el.classList) {
  39932. if (cls.indexOf(' ') > -1) {
  39933. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  39934. } else {
  39935. el.classList.add(cls);
  39936. }
  39937. } else {
  39938. var cur = " " + (el.getAttribute('class') || '') + " ";
  39939. if (cur.indexOf(' ' + cls + ' ') < 0) {
  39940. el.setAttribute('class', (cur + cls).trim());
  39941. }
  39942. }
  39943. }
  39944. /**
  39945. * Remove class with compatibility for SVG since classList is not supported on
  39946. * SVG elements in IE
  39947. */
  39948. function removeClass (el, cls) {
  39949. /* istanbul ignore if */
  39950. if (!cls || !(cls = cls.trim())) {
  39951. return
  39952. }
  39953. /* istanbul ignore else */
  39954. if (el.classList) {
  39955. if (cls.indexOf(' ') > -1) {
  39956. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  39957. } else {
  39958. el.classList.remove(cls);
  39959. }
  39960. if (!el.classList.length) {
  39961. el.removeAttribute('class');
  39962. }
  39963. } else {
  39964. var cur = " " + (el.getAttribute('class') || '') + " ";
  39965. var tar = ' ' + cls + ' ';
  39966. while (cur.indexOf(tar) >= 0) {
  39967. cur = cur.replace(tar, ' ');
  39968. }
  39969. cur = cur.trim();
  39970. if (cur) {
  39971. el.setAttribute('class', cur);
  39972. } else {
  39973. el.removeAttribute('class');
  39974. }
  39975. }
  39976. }
  39977. /* */
  39978. function resolveTransition (def$$1) {
  39979. if (!def$$1) {
  39980. return
  39981. }
  39982. /* istanbul ignore else */
  39983. if (typeof def$$1 === 'object') {
  39984. var res = {};
  39985. if (def$$1.css !== false) {
  39986. extend(res, autoCssTransition(def$$1.name || 'v'));
  39987. }
  39988. extend(res, def$$1);
  39989. return res
  39990. } else if (typeof def$$1 === 'string') {
  39991. return autoCssTransition(def$$1)
  39992. }
  39993. }
  39994. var autoCssTransition = cached(function (name) {
  39995. return {
  39996. enterClass: (name + "-enter"),
  39997. enterToClass: (name + "-enter-to"),
  39998. enterActiveClass: (name + "-enter-active"),
  39999. leaveClass: (name + "-leave"),
  40000. leaveToClass: (name + "-leave-to"),
  40001. leaveActiveClass: (name + "-leave-active")
  40002. }
  40003. });
  40004. var hasTransition = inBrowser && !isIE9;
  40005. var TRANSITION = 'transition';
  40006. var ANIMATION = 'animation';
  40007. // Transition property/event sniffing
  40008. var transitionProp = 'transition';
  40009. var transitionEndEvent = 'transitionend';
  40010. var animationProp = 'animation';
  40011. var animationEndEvent = 'animationend';
  40012. if (hasTransition) {
  40013. /* istanbul ignore if */
  40014. if (window.ontransitionend === undefined &&
  40015. window.onwebkittransitionend !== undefined
  40016. ) {
  40017. transitionProp = 'WebkitTransition';
  40018. transitionEndEvent = 'webkitTransitionEnd';
  40019. }
  40020. if (window.onanimationend === undefined &&
  40021. window.onwebkitanimationend !== undefined
  40022. ) {
  40023. animationProp = 'WebkitAnimation';
  40024. animationEndEvent = 'webkitAnimationEnd';
  40025. }
  40026. }
  40027. // binding to window is necessary to make hot reload work in IE in strict mode
  40028. var raf = inBrowser
  40029. ? window.requestAnimationFrame
  40030. ? window.requestAnimationFrame.bind(window)
  40031. : setTimeout
  40032. : /* istanbul ignore next */ function (fn) { return fn(); };
  40033. function nextFrame (fn) {
  40034. raf(function () {
  40035. raf(fn);
  40036. });
  40037. }
  40038. function addTransitionClass (el, cls) {
  40039. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  40040. if (transitionClasses.indexOf(cls) < 0) {
  40041. transitionClasses.push(cls);
  40042. addClass(el, cls);
  40043. }
  40044. }
  40045. function removeTransitionClass (el, cls) {
  40046. if (el._transitionClasses) {
  40047. remove(el._transitionClasses, cls);
  40048. }
  40049. removeClass(el, cls);
  40050. }
  40051. function whenTransitionEnds (
  40052. el,
  40053. expectedType,
  40054. cb
  40055. ) {
  40056. var ref = getTransitionInfo(el, expectedType);
  40057. var type = ref.type;
  40058. var timeout = ref.timeout;
  40059. var propCount = ref.propCount;
  40060. if (!type) { return cb() }
  40061. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  40062. var ended = 0;
  40063. var end = function () {
  40064. el.removeEventListener(event, onEnd);
  40065. cb();
  40066. };
  40067. var onEnd = function (e) {
  40068. if (e.target === el) {
  40069. if (++ended >= propCount) {
  40070. end();
  40071. }
  40072. }
  40073. };
  40074. setTimeout(function () {
  40075. if (ended < propCount) {
  40076. end();
  40077. }
  40078. }, timeout + 1);
  40079. el.addEventListener(event, onEnd);
  40080. }
  40081. var transformRE = /\b(transform|all)(,|$)/;
  40082. function getTransitionInfo (el, expectedType) {
  40083. var styles = window.getComputedStyle(el);
  40084. // JSDOM may return undefined for transition properties
  40085. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  40086. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  40087. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  40088. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  40089. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  40090. var animationTimeout = getTimeout(animationDelays, animationDurations);
  40091. var type;
  40092. var timeout = 0;
  40093. var propCount = 0;
  40094. /* istanbul ignore if */
  40095. if (expectedType === TRANSITION) {
  40096. if (transitionTimeout > 0) {
  40097. type = TRANSITION;
  40098. timeout = transitionTimeout;
  40099. propCount = transitionDurations.length;
  40100. }
  40101. } else if (expectedType === ANIMATION) {
  40102. if (animationTimeout > 0) {
  40103. type = ANIMATION;
  40104. timeout = animationTimeout;
  40105. propCount = animationDurations.length;
  40106. }
  40107. } else {
  40108. timeout = Math.max(transitionTimeout, animationTimeout);
  40109. type = timeout > 0
  40110. ? transitionTimeout > animationTimeout
  40111. ? TRANSITION
  40112. : ANIMATION
  40113. : null;
  40114. propCount = type
  40115. ? type === TRANSITION
  40116. ? transitionDurations.length
  40117. : animationDurations.length
  40118. : 0;
  40119. }
  40120. var hasTransform =
  40121. type === TRANSITION &&
  40122. transformRE.test(styles[transitionProp + 'Property']);
  40123. return {
  40124. type: type,
  40125. timeout: timeout,
  40126. propCount: propCount,
  40127. hasTransform: hasTransform
  40128. }
  40129. }
  40130. function getTimeout (delays, durations) {
  40131. /* istanbul ignore next */
  40132. while (delays.length < durations.length) {
  40133. delays = delays.concat(delays);
  40134. }
  40135. return Math.max.apply(null, durations.map(function (d, i) {
  40136. return toMs(d) + toMs(delays[i])
  40137. }))
  40138. }
  40139. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  40140. // in a locale-dependent way, using a comma instead of a dot.
  40141. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  40142. // as a floor function) causing unexpected behaviors
  40143. function toMs (s) {
  40144. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  40145. }
  40146. /* */
  40147. function enter (vnode, toggleDisplay) {
  40148. var el = vnode.elm;
  40149. // call leave callback now
  40150. if (isDef(el._leaveCb)) {
  40151. el._leaveCb.cancelled = true;
  40152. el._leaveCb();
  40153. }
  40154. var data = resolveTransition(vnode.data.transition);
  40155. if (isUndef(data)) {
  40156. return
  40157. }
  40158. /* istanbul ignore if */
  40159. if (isDef(el._enterCb) || el.nodeType !== 1) {
  40160. return
  40161. }
  40162. var css = data.css;
  40163. var type = data.type;
  40164. var enterClass = data.enterClass;
  40165. var enterToClass = data.enterToClass;
  40166. var enterActiveClass = data.enterActiveClass;
  40167. var appearClass = data.appearClass;
  40168. var appearToClass = data.appearToClass;
  40169. var appearActiveClass = data.appearActiveClass;
  40170. var beforeEnter = data.beforeEnter;
  40171. var enter = data.enter;
  40172. var afterEnter = data.afterEnter;
  40173. var enterCancelled = data.enterCancelled;
  40174. var beforeAppear = data.beforeAppear;
  40175. var appear = data.appear;
  40176. var afterAppear = data.afterAppear;
  40177. var appearCancelled = data.appearCancelled;
  40178. var duration = data.duration;
  40179. // activeInstance will always be the <transition> component managing this
  40180. // transition. One edge case to check is when the <transition> is placed
  40181. // as the root node of a child component. In that case we need to check
  40182. // <transition>'s parent for appear check.
  40183. var context = activeInstance;
  40184. var transitionNode = activeInstance.$vnode;
  40185. while (transitionNode && transitionNode.parent) {
  40186. context = transitionNode.context;
  40187. transitionNode = transitionNode.parent;
  40188. }
  40189. var isAppear = !context._isMounted || !vnode.isRootInsert;
  40190. if (isAppear && !appear && appear !== '') {
  40191. return
  40192. }
  40193. var startClass = isAppear && appearClass
  40194. ? appearClass
  40195. : enterClass;
  40196. var activeClass = isAppear && appearActiveClass
  40197. ? appearActiveClass
  40198. : enterActiveClass;
  40199. var toClass = isAppear && appearToClass
  40200. ? appearToClass
  40201. : enterToClass;
  40202. var beforeEnterHook = isAppear
  40203. ? (beforeAppear || beforeEnter)
  40204. : beforeEnter;
  40205. var enterHook = isAppear
  40206. ? (typeof appear === 'function' ? appear : enter)
  40207. : enter;
  40208. var afterEnterHook = isAppear
  40209. ? (afterAppear || afterEnter)
  40210. : afterEnter;
  40211. var enterCancelledHook = isAppear
  40212. ? (appearCancelled || enterCancelled)
  40213. : enterCancelled;
  40214. var explicitEnterDuration = toNumber(
  40215. isObject(duration)
  40216. ? duration.enter
  40217. : duration
  40218. );
  40219. if (explicitEnterDuration != null) {
  40220. checkDuration(explicitEnterDuration, 'enter', vnode);
  40221. }
  40222. var expectsCSS = css !== false && !isIE9;
  40223. var userWantsControl = getHookArgumentsLength(enterHook);
  40224. var cb = el._enterCb = once(function () {
  40225. if (expectsCSS) {
  40226. removeTransitionClass(el, toClass);
  40227. removeTransitionClass(el, activeClass);
  40228. }
  40229. if (cb.cancelled) {
  40230. if (expectsCSS) {
  40231. removeTransitionClass(el, startClass);
  40232. }
  40233. enterCancelledHook && enterCancelledHook(el);
  40234. } else {
  40235. afterEnterHook && afterEnterHook(el);
  40236. }
  40237. el._enterCb = null;
  40238. });
  40239. if (!vnode.data.show) {
  40240. // remove pending leave element on enter by injecting an insert hook
  40241. mergeVNodeHook(vnode, 'insert', function () {
  40242. var parent = el.parentNode;
  40243. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  40244. if (pendingNode &&
  40245. pendingNode.tag === vnode.tag &&
  40246. pendingNode.elm._leaveCb
  40247. ) {
  40248. pendingNode.elm._leaveCb();
  40249. }
  40250. enterHook && enterHook(el, cb);
  40251. });
  40252. }
  40253. // start enter transition
  40254. beforeEnterHook && beforeEnterHook(el);
  40255. if (expectsCSS) {
  40256. addTransitionClass(el, startClass);
  40257. addTransitionClass(el, activeClass);
  40258. nextFrame(function () {
  40259. removeTransitionClass(el, startClass);
  40260. if (!cb.cancelled) {
  40261. addTransitionClass(el, toClass);
  40262. if (!userWantsControl) {
  40263. if (isValidDuration(explicitEnterDuration)) {
  40264. setTimeout(cb, explicitEnterDuration);
  40265. } else {
  40266. whenTransitionEnds(el, type, cb);
  40267. }
  40268. }
  40269. }
  40270. });
  40271. }
  40272. if (vnode.data.show) {
  40273. toggleDisplay && toggleDisplay();
  40274. enterHook && enterHook(el, cb);
  40275. }
  40276. if (!expectsCSS && !userWantsControl) {
  40277. cb();
  40278. }
  40279. }
  40280. function leave (vnode, rm) {
  40281. var el = vnode.elm;
  40282. // call enter callback now
  40283. if (isDef(el._enterCb)) {
  40284. el._enterCb.cancelled = true;
  40285. el._enterCb();
  40286. }
  40287. var data = resolveTransition(vnode.data.transition);
  40288. if (isUndef(data) || el.nodeType !== 1) {
  40289. return rm()
  40290. }
  40291. /* istanbul ignore if */
  40292. if (isDef(el._leaveCb)) {
  40293. return
  40294. }
  40295. var css = data.css;
  40296. var type = data.type;
  40297. var leaveClass = data.leaveClass;
  40298. var leaveToClass = data.leaveToClass;
  40299. var leaveActiveClass = data.leaveActiveClass;
  40300. var beforeLeave = data.beforeLeave;
  40301. var leave = data.leave;
  40302. var afterLeave = data.afterLeave;
  40303. var leaveCancelled = data.leaveCancelled;
  40304. var delayLeave = data.delayLeave;
  40305. var duration = data.duration;
  40306. var expectsCSS = css !== false && !isIE9;
  40307. var userWantsControl = getHookArgumentsLength(leave);
  40308. var explicitLeaveDuration = toNumber(
  40309. isObject(duration)
  40310. ? duration.leave
  40311. : duration
  40312. );
  40313. if (isDef(explicitLeaveDuration)) {
  40314. checkDuration(explicitLeaveDuration, 'leave', vnode);
  40315. }
  40316. var cb = el._leaveCb = once(function () {
  40317. if (el.parentNode && el.parentNode._pending) {
  40318. el.parentNode._pending[vnode.key] = null;
  40319. }
  40320. if (expectsCSS) {
  40321. removeTransitionClass(el, leaveToClass);
  40322. removeTransitionClass(el, leaveActiveClass);
  40323. }
  40324. if (cb.cancelled) {
  40325. if (expectsCSS) {
  40326. removeTransitionClass(el, leaveClass);
  40327. }
  40328. leaveCancelled && leaveCancelled(el);
  40329. } else {
  40330. rm();
  40331. afterLeave && afterLeave(el);
  40332. }
  40333. el._leaveCb = null;
  40334. });
  40335. if (delayLeave) {
  40336. delayLeave(performLeave);
  40337. } else {
  40338. performLeave();
  40339. }
  40340. function performLeave () {
  40341. // the delayed leave may have already been cancelled
  40342. if (cb.cancelled) {
  40343. return
  40344. }
  40345. // record leaving element
  40346. if (!vnode.data.show && el.parentNode) {
  40347. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  40348. }
  40349. beforeLeave && beforeLeave(el);
  40350. if (expectsCSS) {
  40351. addTransitionClass(el, leaveClass);
  40352. addTransitionClass(el, leaveActiveClass);
  40353. nextFrame(function () {
  40354. removeTransitionClass(el, leaveClass);
  40355. if (!cb.cancelled) {
  40356. addTransitionClass(el, leaveToClass);
  40357. if (!userWantsControl) {
  40358. if (isValidDuration(explicitLeaveDuration)) {
  40359. setTimeout(cb, explicitLeaveDuration);
  40360. } else {
  40361. whenTransitionEnds(el, type, cb);
  40362. }
  40363. }
  40364. }
  40365. });
  40366. }
  40367. leave && leave(el, cb);
  40368. if (!expectsCSS && !userWantsControl) {
  40369. cb();
  40370. }
  40371. }
  40372. }
  40373. // only used in dev mode
  40374. function checkDuration (val, name, vnode) {
  40375. if (typeof val !== 'number') {
  40376. warn(
  40377. "<transition> explicit " + name + " duration is not a valid number - " +
  40378. "got " + (JSON.stringify(val)) + ".",
  40379. vnode.context
  40380. );
  40381. } else if (isNaN(val)) {
  40382. warn(
  40383. "<transition> explicit " + name + " duration is NaN - " +
  40384. 'the duration expression might be incorrect.',
  40385. vnode.context
  40386. );
  40387. }
  40388. }
  40389. function isValidDuration (val) {
  40390. return typeof val === 'number' && !isNaN(val)
  40391. }
  40392. /**
  40393. * Normalize a transition hook's argument length. The hook may be:
  40394. * - a merged hook (invoker) with the original in .fns
  40395. * - a wrapped component method (check ._length)
  40396. * - a plain function (.length)
  40397. */
  40398. function getHookArgumentsLength (fn) {
  40399. if (isUndef(fn)) {
  40400. return false
  40401. }
  40402. var invokerFns = fn.fns;
  40403. if (isDef(invokerFns)) {
  40404. // invoker
  40405. return getHookArgumentsLength(
  40406. Array.isArray(invokerFns)
  40407. ? invokerFns[0]
  40408. : invokerFns
  40409. )
  40410. } else {
  40411. return (fn._length || fn.length) > 1
  40412. }
  40413. }
  40414. function _enter (_, vnode) {
  40415. if (vnode.data.show !== true) {
  40416. enter(vnode);
  40417. }
  40418. }
  40419. var transition = inBrowser ? {
  40420. create: _enter,
  40421. activate: _enter,
  40422. remove: function remove$$1 (vnode, rm) {
  40423. /* istanbul ignore else */
  40424. if (vnode.data.show !== true) {
  40425. leave(vnode, rm);
  40426. } else {
  40427. rm();
  40428. }
  40429. }
  40430. } : {};
  40431. var platformModules = [
  40432. attrs,
  40433. klass,
  40434. events,
  40435. domProps,
  40436. style,
  40437. transition
  40438. ];
  40439. /* */
  40440. // the directive module should be applied last, after all
  40441. // built-in modules have been applied.
  40442. var modules = platformModules.concat(baseModules);
  40443. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  40444. /**
  40445. * Not type checking this file because flow doesn't like attaching
  40446. * properties to Elements.
  40447. */
  40448. /* istanbul ignore if */
  40449. if (isIE9) {
  40450. // http://www.matts411.com/post/internet-explorer-9-oninput/
  40451. document.addEventListener('selectionchange', function () {
  40452. var el = document.activeElement;
  40453. if (el && el.vmodel) {
  40454. trigger(el, 'input');
  40455. }
  40456. });
  40457. }
  40458. var directive = {
  40459. inserted: function inserted (el, binding, vnode, oldVnode) {
  40460. if (vnode.tag === 'select') {
  40461. // #6903
  40462. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  40463. mergeVNodeHook(vnode, 'postpatch', function () {
  40464. directive.componentUpdated(el, binding, vnode);
  40465. });
  40466. } else {
  40467. setSelected(el, binding, vnode.context);
  40468. }
  40469. el._vOptions = [].map.call(el.options, getValue);
  40470. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  40471. el._vModifiers = binding.modifiers;
  40472. if (!binding.modifiers.lazy) {
  40473. el.addEventListener('compositionstart', onCompositionStart);
  40474. el.addEventListener('compositionend', onCompositionEnd);
  40475. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  40476. // switching focus before confirming composition choice
  40477. // this also fixes the issue where some browsers e.g. iOS Chrome
  40478. // fires "change" instead of "input" on autocomplete.
  40479. el.addEventListener('change', onCompositionEnd);
  40480. /* istanbul ignore if */
  40481. if (isIE9) {
  40482. el.vmodel = true;
  40483. }
  40484. }
  40485. }
  40486. },
  40487. componentUpdated: function componentUpdated (el, binding, vnode) {
  40488. if (vnode.tag === 'select') {
  40489. setSelected(el, binding, vnode.context);
  40490. // in case the options rendered by v-for have changed,
  40491. // it's possible that the value is out-of-sync with the rendered options.
  40492. // detect such cases and filter out values that no longer has a matching
  40493. // option in the DOM.
  40494. var prevOptions = el._vOptions;
  40495. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  40496. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  40497. // trigger change event if
  40498. // no matching option found for at least one value
  40499. var needReset = el.multiple
  40500. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  40501. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  40502. if (needReset) {
  40503. trigger(el, 'change');
  40504. }
  40505. }
  40506. }
  40507. }
  40508. };
  40509. function setSelected (el, binding, vm) {
  40510. actuallySetSelected(el, binding, vm);
  40511. /* istanbul ignore if */
  40512. if (isIE || isEdge) {
  40513. setTimeout(function () {
  40514. actuallySetSelected(el, binding, vm);
  40515. }, 0);
  40516. }
  40517. }
  40518. function actuallySetSelected (el, binding, vm) {
  40519. var value = binding.value;
  40520. var isMultiple = el.multiple;
  40521. if (isMultiple && !Array.isArray(value)) {
  40522. warn(
  40523. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  40524. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  40525. vm
  40526. );
  40527. return
  40528. }
  40529. var selected, option;
  40530. for (var i = 0, l = el.options.length; i < l; i++) {
  40531. option = el.options[i];
  40532. if (isMultiple) {
  40533. selected = looseIndexOf(value, getValue(option)) > -1;
  40534. if (option.selected !== selected) {
  40535. option.selected = selected;
  40536. }
  40537. } else {
  40538. if (looseEqual(getValue(option), value)) {
  40539. if (el.selectedIndex !== i) {
  40540. el.selectedIndex = i;
  40541. }
  40542. return
  40543. }
  40544. }
  40545. }
  40546. if (!isMultiple) {
  40547. el.selectedIndex = -1;
  40548. }
  40549. }
  40550. function hasNoMatchingOption (value, options) {
  40551. return options.every(function (o) { return !looseEqual(o, value); })
  40552. }
  40553. function getValue (option) {
  40554. return '_value' in option
  40555. ? option._value
  40556. : option.value
  40557. }
  40558. function onCompositionStart (e) {
  40559. e.target.composing = true;
  40560. }
  40561. function onCompositionEnd (e) {
  40562. // prevent triggering an input event for no reason
  40563. if (!e.target.composing) { return }
  40564. e.target.composing = false;
  40565. trigger(e.target, 'input');
  40566. }
  40567. function trigger (el, type) {
  40568. var e = document.createEvent('HTMLEvents');
  40569. e.initEvent(type, true, true);
  40570. el.dispatchEvent(e);
  40571. }
  40572. /* */
  40573. // recursively search for possible transition defined inside the component root
  40574. function locateNode (vnode) {
  40575. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  40576. ? locateNode(vnode.componentInstance._vnode)
  40577. : vnode
  40578. }
  40579. var show = {
  40580. bind: function bind (el, ref, vnode) {
  40581. var value = ref.value;
  40582. vnode = locateNode(vnode);
  40583. var transition$$1 = vnode.data && vnode.data.transition;
  40584. var originalDisplay = el.__vOriginalDisplay =
  40585. el.style.display === 'none' ? '' : el.style.display;
  40586. if (value && transition$$1) {
  40587. vnode.data.show = true;
  40588. enter(vnode, function () {
  40589. el.style.display = originalDisplay;
  40590. });
  40591. } else {
  40592. el.style.display = value ? originalDisplay : 'none';
  40593. }
  40594. },
  40595. update: function update (el, ref, vnode) {
  40596. var value = ref.value;
  40597. var oldValue = ref.oldValue;
  40598. /* istanbul ignore if */
  40599. if (!value === !oldValue) { return }
  40600. vnode = locateNode(vnode);
  40601. var transition$$1 = vnode.data && vnode.data.transition;
  40602. if (transition$$1) {
  40603. vnode.data.show = true;
  40604. if (value) {
  40605. enter(vnode, function () {
  40606. el.style.display = el.__vOriginalDisplay;
  40607. });
  40608. } else {
  40609. leave(vnode, function () {
  40610. el.style.display = 'none';
  40611. });
  40612. }
  40613. } else {
  40614. el.style.display = value ? el.__vOriginalDisplay : 'none';
  40615. }
  40616. },
  40617. unbind: function unbind (
  40618. el,
  40619. binding,
  40620. vnode,
  40621. oldVnode,
  40622. isDestroy
  40623. ) {
  40624. if (!isDestroy) {
  40625. el.style.display = el.__vOriginalDisplay;
  40626. }
  40627. }
  40628. };
  40629. var platformDirectives = {
  40630. model: directive,
  40631. show: show
  40632. };
  40633. /* */
  40634. var transitionProps = {
  40635. name: String,
  40636. appear: Boolean,
  40637. css: Boolean,
  40638. mode: String,
  40639. type: String,
  40640. enterClass: String,
  40641. leaveClass: String,
  40642. enterToClass: String,
  40643. leaveToClass: String,
  40644. enterActiveClass: String,
  40645. leaveActiveClass: String,
  40646. appearClass: String,
  40647. appearActiveClass: String,
  40648. appearToClass: String,
  40649. duration: [Number, String, Object]
  40650. };
  40651. // in case the child is also an abstract component, e.g. <keep-alive>
  40652. // we want to recursively retrieve the real component to be rendered
  40653. function getRealChild (vnode) {
  40654. var compOptions = vnode && vnode.componentOptions;
  40655. if (compOptions && compOptions.Ctor.options.abstract) {
  40656. return getRealChild(getFirstComponentChild(compOptions.children))
  40657. } else {
  40658. return vnode
  40659. }
  40660. }
  40661. function extractTransitionData (comp) {
  40662. var data = {};
  40663. var options = comp.$options;
  40664. // props
  40665. for (var key in options.propsData) {
  40666. data[key] = comp[key];
  40667. }
  40668. // events.
  40669. // extract listeners and pass them directly to the transition methods
  40670. var listeners = options._parentListeners;
  40671. for (var key$1 in listeners) {
  40672. data[camelize(key$1)] = listeners[key$1];
  40673. }
  40674. return data
  40675. }
  40676. function placeholder (h, rawChild) {
  40677. if (/\d-keep-alive$/.test(rawChild.tag)) {
  40678. return h('keep-alive', {
  40679. props: rawChild.componentOptions.propsData
  40680. })
  40681. }
  40682. }
  40683. function hasParentTransition (vnode) {
  40684. while ((vnode = vnode.parent)) {
  40685. if (vnode.data.transition) {
  40686. return true
  40687. }
  40688. }
  40689. }
  40690. function isSameChild (child, oldChild) {
  40691. return oldChild.key === child.key && oldChild.tag === child.tag
  40692. }
  40693. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  40694. var isVShowDirective = function (d) { return d.name === 'show'; };
  40695. var Transition = {
  40696. name: 'transition',
  40697. props: transitionProps,
  40698. abstract: true,
  40699. render: function render (h) {
  40700. var this$1 = this;
  40701. var children = this.$slots.default;
  40702. if (!children) {
  40703. return
  40704. }
  40705. // filter out text nodes (possible whitespaces)
  40706. children = children.filter(isNotTextNode);
  40707. /* istanbul ignore if */
  40708. if (!children.length) {
  40709. return
  40710. }
  40711. // warn multiple elements
  40712. if (children.length > 1) {
  40713. warn(
  40714. '<transition> can only be used on a single element. Use ' +
  40715. '<transition-group> for lists.',
  40716. this.$parent
  40717. );
  40718. }
  40719. var mode = this.mode;
  40720. // warn invalid mode
  40721. if (mode && mode !== 'in-out' && mode !== 'out-in'
  40722. ) {
  40723. warn(
  40724. 'invalid <transition> mode: ' + mode,
  40725. this.$parent
  40726. );
  40727. }
  40728. var rawChild = children[0];
  40729. // if this is a component root node and the component's
  40730. // parent container node also has transition, skip.
  40731. if (hasParentTransition(this.$vnode)) {
  40732. return rawChild
  40733. }
  40734. // apply transition data to child
  40735. // use getRealChild() to ignore abstract components e.g. keep-alive
  40736. var child = getRealChild(rawChild);
  40737. /* istanbul ignore if */
  40738. if (!child) {
  40739. return rawChild
  40740. }
  40741. if (this._leaving) {
  40742. return placeholder(h, rawChild)
  40743. }
  40744. // ensure a key that is unique to the vnode type and to this transition
  40745. // component instance. This key will be used to remove pending leaving nodes
  40746. // during entering.
  40747. var id = "__transition-" + (this._uid) + "-";
  40748. child.key = child.key == null
  40749. ? child.isComment
  40750. ? id + 'comment'
  40751. : id + child.tag
  40752. : isPrimitive(child.key)
  40753. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  40754. : child.key;
  40755. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  40756. var oldRawChild = this._vnode;
  40757. var oldChild = getRealChild(oldRawChild);
  40758. // mark v-show
  40759. // so that the transition module can hand over the control to the directive
  40760. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  40761. child.data.show = true;
  40762. }
  40763. if (
  40764. oldChild &&
  40765. oldChild.data &&
  40766. !isSameChild(child, oldChild) &&
  40767. !isAsyncPlaceholder(oldChild) &&
  40768. // #6687 component root is a comment node
  40769. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  40770. ) {
  40771. // replace old child transition data with fresh one
  40772. // important for dynamic transitions!
  40773. var oldData = oldChild.data.transition = extend({}, data);
  40774. // handle transition mode
  40775. if (mode === 'out-in') {
  40776. // return placeholder node and queue update when leave finishes
  40777. this._leaving = true;
  40778. mergeVNodeHook(oldData, 'afterLeave', function () {
  40779. this$1._leaving = false;
  40780. this$1.$forceUpdate();
  40781. });
  40782. return placeholder(h, rawChild)
  40783. } else if (mode === 'in-out') {
  40784. if (isAsyncPlaceholder(child)) {
  40785. return oldRawChild
  40786. }
  40787. var delayedLeave;
  40788. var performLeave = function () { delayedLeave(); };
  40789. mergeVNodeHook(data, 'afterEnter', performLeave);
  40790. mergeVNodeHook(data, 'enterCancelled', performLeave);
  40791. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  40792. }
  40793. }
  40794. return rawChild
  40795. }
  40796. };
  40797. /* */
  40798. var props = extend({
  40799. tag: String,
  40800. moveClass: String
  40801. }, transitionProps);
  40802. delete props.mode;
  40803. var TransitionGroup = {
  40804. props: props,
  40805. beforeMount: function beforeMount () {
  40806. var this$1 = this;
  40807. var update = this._update;
  40808. this._update = function (vnode, hydrating) {
  40809. var restoreActiveInstance = setActiveInstance(this$1);
  40810. // force removing pass
  40811. this$1.__patch__(
  40812. this$1._vnode,
  40813. this$1.kept,
  40814. false, // hydrating
  40815. true // removeOnly (!important, avoids unnecessary moves)
  40816. );
  40817. this$1._vnode = this$1.kept;
  40818. restoreActiveInstance();
  40819. update.call(this$1, vnode, hydrating);
  40820. };
  40821. },
  40822. render: function render (h) {
  40823. var tag = this.tag || this.$vnode.data.tag || 'span';
  40824. var map = Object.create(null);
  40825. var prevChildren = this.prevChildren = this.children;
  40826. var rawChildren = this.$slots.default || [];
  40827. var children = this.children = [];
  40828. var transitionData = extractTransitionData(this);
  40829. for (var i = 0; i < rawChildren.length; i++) {
  40830. var c = rawChildren[i];
  40831. if (c.tag) {
  40832. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  40833. children.push(c);
  40834. map[c.key] = c
  40835. ;(c.data || (c.data = {})).transition = transitionData;
  40836. } else {
  40837. var opts = c.componentOptions;
  40838. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  40839. warn(("<transition-group> children must be keyed: <" + name + ">"));
  40840. }
  40841. }
  40842. }
  40843. if (prevChildren) {
  40844. var kept = [];
  40845. var removed = [];
  40846. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  40847. var c$1 = prevChildren[i$1];
  40848. c$1.data.transition = transitionData;
  40849. c$1.data.pos = c$1.elm.getBoundingClientRect();
  40850. if (map[c$1.key]) {
  40851. kept.push(c$1);
  40852. } else {
  40853. removed.push(c$1);
  40854. }
  40855. }
  40856. this.kept = h(tag, null, kept);
  40857. this.removed = removed;
  40858. }
  40859. return h(tag, null, children)
  40860. },
  40861. updated: function updated () {
  40862. var children = this.prevChildren;
  40863. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  40864. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  40865. return
  40866. }
  40867. // we divide the work into three loops to avoid mixing DOM reads and writes
  40868. // in each iteration - which helps prevent layout thrashing.
  40869. children.forEach(callPendingCbs);
  40870. children.forEach(recordPosition);
  40871. children.forEach(applyTranslation);
  40872. // force reflow to put everything in position
  40873. // assign to this to avoid being removed in tree-shaking
  40874. // $flow-disable-line
  40875. this._reflow = document.body.offsetHeight;
  40876. children.forEach(function (c) {
  40877. if (c.data.moved) {
  40878. var el = c.elm;
  40879. var s = el.style;
  40880. addTransitionClass(el, moveClass);
  40881. s.transform = s.WebkitTransform = s.transitionDuration = '';
  40882. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  40883. if (e && e.target !== el) {
  40884. return
  40885. }
  40886. if (!e || /transform$/.test(e.propertyName)) {
  40887. el.removeEventListener(transitionEndEvent, cb);
  40888. el._moveCb = null;
  40889. removeTransitionClass(el, moveClass);
  40890. }
  40891. });
  40892. }
  40893. });
  40894. },
  40895. methods: {
  40896. hasMove: function hasMove (el, moveClass) {
  40897. /* istanbul ignore if */
  40898. if (!hasTransition) {
  40899. return false
  40900. }
  40901. /* istanbul ignore if */
  40902. if (this._hasMove) {
  40903. return this._hasMove
  40904. }
  40905. // Detect whether an element with the move class applied has
  40906. // CSS transitions. Since the element may be inside an entering
  40907. // transition at this very moment, we make a clone of it and remove
  40908. // all other transition classes applied to ensure only the move class
  40909. // is applied.
  40910. var clone = el.cloneNode();
  40911. if (el._transitionClasses) {
  40912. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  40913. }
  40914. addClass(clone, moveClass);
  40915. clone.style.display = 'none';
  40916. this.$el.appendChild(clone);
  40917. var info = getTransitionInfo(clone);
  40918. this.$el.removeChild(clone);
  40919. return (this._hasMove = info.hasTransform)
  40920. }
  40921. }
  40922. };
  40923. function callPendingCbs (c) {
  40924. /* istanbul ignore if */
  40925. if (c.elm._moveCb) {
  40926. c.elm._moveCb();
  40927. }
  40928. /* istanbul ignore if */
  40929. if (c.elm._enterCb) {
  40930. c.elm._enterCb();
  40931. }
  40932. }
  40933. function recordPosition (c) {
  40934. c.data.newPos = c.elm.getBoundingClientRect();
  40935. }
  40936. function applyTranslation (c) {
  40937. var oldPos = c.data.pos;
  40938. var newPos = c.data.newPos;
  40939. var dx = oldPos.left - newPos.left;
  40940. var dy = oldPos.top - newPos.top;
  40941. if (dx || dy) {
  40942. c.data.moved = true;
  40943. var s = c.elm.style;
  40944. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  40945. s.transitionDuration = '0s';
  40946. }
  40947. }
  40948. var platformComponents = {
  40949. Transition: Transition,
  40950. TransitionGroup: TransitionGroup
  40951. };
  40952. /* */
  40953. // install platform specific utils
  40954. Vue.config.mustUseProp = mustUseProp;
  40955. Vue.config.isReservedTag = isReservedTag;
  40956. Vue.config.isReservedAttr = isReservedAttr;
  40957. Vue.config.getTagNamespace = getTagNamespace;
  40958. Vue.config.isUnknownElement = isUnknownElement;
  40959. // install platform runtime directives & components
  40960. extend(Vue.options.directives, platformDirectives);
  40961. extend(Vue.options.components, platformComponents);
  40962. // install platform patch function
  40963. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  40964. // public mount method
  40965. Vue.prototype.$mount = function (
  40966. el,
  40967. hydrating
  40968. ) {
  40969. el = el && inBrowser ? query(el) : undefined;
  40970. return mountComponent(this, el, hydrating)
  40971. };
  40972. // devtools global hook
  40973. /* istanbul ignore next */
  40974. if (inBrowser) {
  40975. setTimeout(function () {
  40976. if (config.devtools) {
  40977. if (devtools) {
  40978. devtools.emit('init', Vue);
  40979. } else {
  40980. console[console.info ? 'info' : 'log'](
  40981. 'Download the Vue Devtools extension for a better development experience:\n' +
  40982. 'https://github.com/vuejs/vue-devtools'
  40983. );
  40984. }
  40985. }
  40986. if (config.productionTip !== false &&
  40987. typeof console !== 'undefined'
  40988. ) {
  40989. console[console.info ? 'info' : 'log'](
  40990. "You are running Vue in development mode.\n" +
  40991. "Make sure to turn on production mode when deploying for production.\n" +
  40992. "See more tips at https://vuejs.org/guide/deployment.html"
  40993. );
  40994. }
  40995. }, 0);
  40996. }
  40997. /* */
  40998. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  40999. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  41000. var buildRegex = cached(function (delimiters) {
  41001. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  41002. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  41003. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  41004. });
  41005. function parseText (
  41006. text,
  41007. delimiters
  41008. ) {
  41009. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  41010. if (!tagRE.test(text)) {
  41011. return
  41012. }
  41013. var tokens = [];
  41014. var rawTokens = [];
  41015. var lastIndex = tagRE.lastIndex = 0;
  41016. var match, index, tokenValue;
  41017. while ((match = tagRE.exec(text))) {
  41018. index = match.index;
  41019. // push text token
  41020. if (index > lastIndex) {
  41021. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  41022. tokens.push(JSON.stringify(tokenValue));
  41023. }
  41024. // tag token
  41025. var exp = parseFilters(match[1].trim());
  41026. tokens.push(("_s(" + exp + ")"));
  41027. rawTokens.push({ '@binding': exp });
  41028. lastIndex = index + match[0].length;
  41029. }
  41030. if (lastIndex < text.length) {
  41031. rawTokens.push(tokenValue = text.slice(lastIndex));
  41032. tokens.push(JSON.stringify(tokenValue));
  41033. }
  41034. return {
  41035. expression: tokens.join('+'),
  41036. tokens: rawTokens
  41037. }
  41038. }
  41039. /* */
  41040. function transformNode (el, options) {
  41041. var warn = options.warn || baseWarn;
  41042. var staticClass = getAndRemoveAttr(el, 'class');
  41043. if (staticClass) {
  41044. var res = parseText(staticClass, options.delimiters);
  41045. if (res) {
  41046. warn(
  41047. "class=\"" + staticClass + "\": " +
  41048. 'Interpolation inside attributes has been removed. ' +
  41049. 'Use v-bind or the colon shorthand instead. For example, ' +
  41050. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  41051. el.rawAttrsMap['class']
  41052. );
  41053. }
  41054. }
  41055. if (staticClass) {
  41056. el.staticClass = JSON.stringify(staticClass);
  41057. }
  41058. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  41059. if (classBinding) {
  41060. el.classBinding = classBinding;
  41061. }
  41062. }
  41063. function genData (el) {
  41064. var data = '';
  41065. if (el.staticClass) {
  41066. data += "staticClass:" + (el.staticClass) + ",";
  41067. }
  41068. if (el.classBinding) {
  41069. data += "class:" + (el.classBinding) + ",";
  41070. }
  41071. return data
  41072. }
  41073. var klass$1 = {
  41074. staticKeys: ['staticClass'],
  41075. transformNode: transformNode,
  41076. genData: genData
  41077. };
  41078. /* */
  41079. function transformNode$1 (el, options) {
  41080. var warn = options.warn || baseWarn;
  41081. var staticStyle = getAndRemoveAttr(el, 'style');
  41082. if (staticStyle) {
  41083. /* istanbul ignore if */
  41084. {
  41085. var res = parseText(staticStyle, options.delimiters);
  41086. if (res) {
  41087. warn(
  41088. "style=\"" + staticStyle + "\": " +
  41089. 'Interpolation inside attributes has been removed. ' +
  41090. 'Use v-bind or the colon shorthand instead. For example, ' +
  41091. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  41092. el.rawAttrsMap['style']
  41093. );
  41094. }
  41095. }
  41096. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  41097. }
  41098. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  41099. if (styleBinding) {
  41100. el.styleBinding = styleBinding;
  41101. }
  41102. }
  41103. function genData$1 (el) {
  41104. var data = '';
  41105. if (el.staticStyle) {
  41106. data += "staticStyle:" + (el.staticStyle) + ",";
  41107. }
  41108. if (el.styleBinding) {
  41109. data += "style:(" + (el.styleBinding) + "),";
  41110. }
  41111. return data
  41112. }
  41113. var style$1 = {
  41114. staticKeys: ['staticStyle'],
  41115. transformNode: transformNode$1,
  41116. genData: genData$1
  41117. };
  41118. /* */
  41119. var decoder;
  41120. var he = {
  41121. decode: function decode (html) {
  41122. decoder = decoder || document.createElement('div');
  41123. decoder.innerHTML = html;
  41124. return decoder.textContent
  41125. }
  41126. };
  41127. /* */
  41128. var isUnaryTag = makeMap(
  41129. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  41130. 'link,meta,param,source,track,wbr'
  41131. );
  41132. // Elements that you can, intentionally, leave open
  41133. // (and which close themselves)
  41134. var canBeLeftOpenTag = makeMap(
  41135. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  41136. );
  41137. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  41138. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  41139. var isNonPhrasingTag = makeMap(
  41140. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  41141. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  41142. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  41143. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  41144. 'title,tr,track'
  41145. );
  41146. /**
  41147. * Not type-checking this file because it's mostly vendor code.
  41148. */
  41149. // Regular Expressions for parsing tags and attributes
  41150. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  41151. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  41152. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  41153. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  41154. var startTagOpen = new RegExp(("^<" + qnameCapture));
  41155. var startTagClose = /^\s*(\/?)>/;
  41156. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  41157. var doctype = /^<!DOCTYPE [^>]+>/i;
  41158. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  41159. var comment = /^<!\--/;
  41160. var conditionalComment = /^<!\[/;
  41161. // Special Elements (can contain anything)
  41162. var isPlainTextElement = makeMap('script,style,textarea', true);
  41163. var reCache = {};
  41164. var decodingMap = {
  41165. '&lt;': '<',
  41166. '&gt;': '>',
  41167. '&quot;': '"',
  41168. '&amp;': '&',
  41169. '&#10;': '\n',
  41170. '&#9;': '\t',
  41171. '&#39;': "'"
  41172. };
  41173. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  41174. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  41175. // #5992
  41176. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  41177. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  41178. function decodeAttr (value, shouldDecodeNewlines) {
  41179. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  41180. return value.replace(re, function (match) { return decodingMap[match]; })
  41181. }
  41182. function parseHTML (html, options) {
  41183. var stack = [];
  41184. var expectHTML = options.expectHTML;
  41185. var isUnaryTag$$1 = options.isUnaryTag || no;
  41186. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  41187. var index = 0;
  41188. var last, lastTag;
  41189. while (html) {
  41190. last = html;
  41191. // Make sure we're not in a plaintext content element like script/style
  41192. if (!lastTag || !isPlainTextElement(lastTag)) {
  41193. var textEnd = html.indexOf('<');
  41194. if (textEnd === 0) {
  41195. // Comment:
  41196. if (comment.test(html)) {
  41197. var commentEnd = html.indexOf('-->');
  41198. if (commentEnd >= 0) {
  41199. if (options.shouldKeepComment) {
  41200. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  41201. }
  41202. advance(commentEnd + 3);
  41203. continue
  41204. }
  41205. }
  41206. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  41207. if (conditionalComment.test(html)) {
  41208. var conditionalEnd = html.indexOf(']>');
  41209. if (conditionalEnd >= 0) {
  41210. advance(conditionalEnd + 2);
  41211. continue
  41212. }
  41213. }
  41214. // Doctype:
  41215. var doctypeMatch = html.match(doctype);
  41216. if (doctypeMatch) {
  41217. advance(doctypeMatch[0].length);
  41218. continue
  41219. }
  41220. // End tag:
  41221. var endTagMatch = html.match(endTag);
  41222. if (endTagMatch) {
  41223. var curIndex = index;
  41224. advance(endTagMatch[0].length);
  41225. parseEndTag(endTagMatch[1], curIndex, index);
  41226. continue
  41227. }
  41228. // Start tag:
  41229. var startTagMatch = parseStartTag();
  41230. if (startTagMatch) {
  41231. handleStartTag(startTagMatch);
  41232. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  41233. advance(1);
  41234. }
  41235. continue
  41236. }
  41237. }
  41238. var text = (void 0), rest = (void 0), next = (void 0);
  41239. if (textEnd >= 0) {
  41240. rest = html.slice(textEnd);
  41241. while (
  41242. !endTag.test(rest) &&
  41243. !startTagOpen.test(rest) &&
  41244. !comment.test(rest) &&
  41245. !conditionalComment.test(rest)
  41246. ) {
  41247. // < in plain text, be forgiving and treat it as text
  41248. next = rest.indexOf('<', 1);
  41249. if (next < 0) { break }
  41250. textEnd += next;
  41251. rest = html.slice(textEnd);
  41252. }
  41253. text = html.substring(0, textEnd);
  41254. }
  41255. if (textEnd < 0) {
  41256. text = html;
  41257. }
  41258. if (text) {
  41259. advance(text.length);
  41260. }
  41261. if (options.chars && text) {
  41262. options.chars(text, index - text.length, index);
  41263. }
  41264. } else {
  41265. var endTagLength = 0;
  41266. var stackedTag = lastTag.toLowerCase();
  41267. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  41268. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  41269. endTagLength = endTag.length;
  41270. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  41271. text = text
  41272. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  41273. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  41274. }
  41275. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  41276. text = text.slice(1);
  41277. }
  41278. if (options.chars) {
  41279. options.chars(text);
  41280. }
  41281. return ''
  41282. });
  41283. index += html.length - rest$1.length;
  41284. html = rest$1;
  41285. parseEndTag(stackedTag, index - endTagLength, index);
  41286. }
  41287. if (html === last) {
  41288. options.chars && options.chars(html);
  41289. if (!stack.length && options.warn) {
  41290. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  41291. }
  41292. break
  41293. }
  41294. }
  41295. // Clean up any remaining tags
  41296. parseEndTag();
  41297. function advance (n) {
  41298. index += n;
  41299. html = html.substring(n);
  41300. }
  41301. function parseStartTag () {
  41302. var start = html.match(startTagOpen);
  41303. if (start) {
  41304. var match = {
  41305. tagName: start[1],
  41306. attrs: [],
  41307. start: index
  41308. };
  41309. advance(start[0].length);
  41310. var end, attr;
  41311. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  41312. attr.start = index;
  41313. advance(attr[0].length);
  41314. attr.end = index;
  41315. match.attrs.push(attr);
  41316. }
  41317. if (end) {
  41318. match.unarySlash = end[1];
  41319. advance(end[0].length);
  41320. match.end = index;
  41321. return match
  41322. }
  41323. }
  41324. }
  41325. function handleStartTag (match) {
  41326. var tagName = match.tagName;
  41327. var unarySlash = match.unarySlash;
  41328. if (expectHTML) {
  41329. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  41330. parseEndTag(lastTag);
  41331. }
  41332. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  41333. parseEndTag(tagName);
  41334. }
  41335. }
  41336. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  41337. var l = match.attrs.length;
  41338. var attrs = new Array(l);
  41339. for (var i = 0; i < l; i++) {
  41340. var args = match.attrs[i];
  41341. var value = args[3] || args[4] || args[5] || '';
  41342. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  41343. ? options.shouldDecodeNewlinesForHref
  41344. : options.shouldDecodeNewlines;
  41345. attrs[i] = {
  41346. name: args[1],
  41347. value: decodeAttr(value, shouldDecodeNewlines)
  41348. };
  41349. if (options.outputSourceRange) {
  41350. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  41351. attrs[i].end = args.end;
  41352. }
  41353. }
  41354. if (!unary) {
  41355. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  41356. lastTag = tagName;
  41357. }
  41358. if (options.start) {
  41359. options.start(tagName, attrs, unary, match.start, match.end);
  41360. }
  41361. }
  41362. function parseEndTag (tagName, start, end) {
  41363. var pos, lowerCasedTagName;
  41364. if (start == null) { start = index; }
  41365. if (end == null) { end = index; }
  41366. // Find the closest opened tag of the same type
  41367. if (tagName) {
  41368. lowerCasedTagName = tagName.toLowerCase();
  41369. for (pos = stack.length - 1; pos >= 0; pos--) {
  41370. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  41371. break
  41372. }
  41373. }
  41374. } else {
  41375. // If no tag name is provided, clean shop
  41376. pos = 0;
  41377. }
  41378. if (pos >= 0) {
  41379. // Close all the open elements, up the stack
  41380. for (var i = stack.length - 1; i >= pos; i--) {
  41381. if (i > pos || !tagName &&
  41382. options.warn
  41383. ) {
  41384. options.warn(
  41385. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  41386. { start: stack[i].start, end: stack[i].end }
  41387. );
  41388. }
  41389. if (options.end) {
  41390. options.end(stack[i].tag, start, end);
  41391. }
  41392. }
  41393. // Remove the open elements from the stack
  41394. stack.length = pos;
  41395. lastTag = pos && stack[pos - 1].tag;
  41396. } else if (lowerCasedTagName === 'br') {
  41397. if (options.start) {
  41398. options.start(tagName, [], true, start, end);
  41399. }
  41400. } else if (lowerCasedTagName === 'p') {
  41401. if (options.start) {
  41402. options.start(tagName, [], false, start, end);
  41403. }
  41404. if (options.end) {
  41405. options.end(tagName, start, end);
  41406. }
  41407. }
  41408. }
  41409. }
  41410. /* */
  41411. var onRE = /^@|^v-on:/;
  41412. var dirRE = /^v-|^@|^:|^#/;
  41413. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  41414. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  41415. var stripParensRE = /^\(|\)$/g;
  41416. var dynamicArgRE = /^\[.*\]$/;
  41417. var argRE = /:(.*)$/;
  41418. var bindRE = /^:|^\.|^v-bind:/;
  41419. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  41420. var slotRE = /^v-slot(:|$)|^#/;
  41421. var lineBreakRE = /[\r\n]/;
  41422. var whitespaceRE$1 = /\s+/g;
  41423. var invalidAttributeRE = /[\s"'<>\/=]/;
  41424. var decodeHTMLCached = cached(he.decode);
  41425. var emptySlotScopeToken = "_empty_";
  41426. // configurable state
  41427. var warn$2;
  41428. var delimiters;
  41429. var transforms;
  41430. var preTransforms;
  41431. var postTransforms;
  41432. var platformIsPreTag;
  41433. var platformMustUseProp;
  41434. var platformGetTagNamespace;
  41435. var maybeComponent;
  41436. function createASTElement (
  41437. tag,
  41438. attrs,
  41439. parent
  41440. ) {
  41441. return {
  41442. type: 1,
  41443. tag: tag,
  41444. attrsList: attrs,
  41445. attrsMap: makeAttrsMap(attrs),
  41446. rawAttrsMap: {},
  41447. parent: parent,
  41448. children: []
  41449. }
  41450. }
  41451. /**
  41452. * Convert HTML string to AST.
  41453. */
  41454. function parse (
  41455. template,
  41456. options
  41457. ) {
  41458. warn$2 = options.warn || baseWarn;
  41459. platformIsPreTag = options.isPreTag || no;
  41460. platformMustUseProp = options.mustUseProp || no;
  41461. platformGetTagNamespace = options.getTagNamespace || no;
  41462. var isReservedTag = options.isReservedTag || no;
  41463. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  41464. transforms = pluckModuleFunction(options.modules, 'transformNode');
  41465. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  41466. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  41467. delimiters = options.delimiters;
  41468. var stack = [];
  41469. var preserveWhitespace = options.preserveWhitespace !== false;
  41470. var whitespaceOption = options.whitespace;
  41471. var root;
  41472. var currentParent;
  41473. var inVPre = false;
  41474. var inPre = false;
  41475. var warned = false;
  41476. function warnOnce (msg, range) {
  41477. if (!warned) {
  41478. warned = true;
  41479. warn$2(msg, range);
  41480. }
  41481. }
  41482. function closeElement (element) {
  41483. trimEndingWhitespace(element);
  41484. if (!inVPre && !element.processed) {
  41485. element = processElement(element, options);
  41486. }
  41487. // tree management
  41488. if (!stack.length && element !== root) {
  41489. // allow root elements with v-if, v-else-if and v-else
  41490. if (root.if && (element.elseif || element.else)) {
  41491. {
  41492. checkRootConstraints(element);
  41493. }
  41494. addIfCondition(root, {
  41495. exp: element.elseif,
  41496. block: element
  41497. });
  41498. } else {
  41499. warnOnce(
  41500. "Component template should contain exactly one root element. " +
  41501. "If you are using v-if on multiple elements, " +
  41502. "use v-else-if to chain them instead.",
  41503. { start: element.start }
  41504. );
  41505. }
  41506. }
  41507. if (currentParent && !element.forbidden) {
  41508. if (element.elseif || element.else) {
  41509. processIfConditions(element, currentParent);
  41510. } else {
  41511. if (element.slotScope) {
  41512. // scoped slot
  41513. // keep it in the children list so that v-else(-if) conditions can
  41514. // find it as the prev node.
  41515. var name = element.slotTarget || '"default"'
  41516. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  41517. }
  41518. currentParent.children.push(element);
  41519. element.parent = currentParent;
  41520. }
  41521. }
  41522. // final children cleanup
  41523. // filter out scoped slots
  41524. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  41525. // remove trailing whitespace node again
  41526. trimEndingWhitespace(element);
  41527. // check pre state
  41528. if (element.pre) {
  41529. inVPre = false;
  41530. }
  41531. if (platformIsPreTag(element.tag)) {
  41532. inPre = false;
  41533. }
  41534. // apply post-transforms
  41535. for (var i = 0; i < postTransforms.length; i++) {
  41536. postTransforms[i](element, options);
  41537. }
  41538. }
  41539. function trimEndingWhitespace (el) {
  41540. // remove trailing whitespace node
  41541. if (!inPre) {
  41542. var lastNode;
  41543. while (
  41544. (lastNode = el.children[el.children.length - 1]) &&
  41545. lastNode.type === 3 &&
  41546. lastNode.text === ' '
  41547. ) {
  41548. el.children.pop();
  41549. }
  41550. }
  41551. }
  41552. function checkRootConstraints (el) {
  41553. if (el.tag === 'slot' || el.tag === 'template') {
  41554. warnOnce(
  41555. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  41556. 'contain multiple nodes.',
  41557. { start: el.start }
  41558. );
  41559. }
  41560. if (el.attrsMap.hasOwnProperty('v-for')) {
  41561. warnOnce(
  41562. 'Cannot use v-for on stateful component root element because ' +
  41563. 'it renders multiple elements.',
  41564. el.rawAttrsMap['v-for']
  41565. );
  41566. }
  41567. }
  41568. parseHTML(template, {
  41569. warn: warn$2,
  41570. expectHTML: options.expectHTML,
  41571. isUnaryTag: options.isUnaryTag,
  41572. canBeLeftOpenTag: options.canBeLeftOpenTag,
  41573. shouldDecodeNewlines: options.shouldDecodeNewlines,
  41574. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  41575. shouldKeepComment: options.comments,
  41576. outputSourceRange: options.outputSourceRange,
  41577. start: function start (tag, attrs, unary, start$1, end) {
  41578. // check namespace.
  41579. // inherit parent ns if there is one
  41580. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  41581. // handle IE svg bug
  41582. /* istanbul ignore if */
  41583. if (isIE && ns === 'svg') {
  41584. attrs = guardIESVGBug(attrs);
  41585. }
  41586. var element = createASTElement(tag, attrs, currentParent);
  41587. if (ns) {
  41588. element.ns = ns;
  41589. }
  41590. {
  41591. if (options.outputSourceRange) {
  41592. element.start = start$1;
  41593. element.end = end;
  41594. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  41595. cumulated[attr.name] = attr;
  41596. return cumulated
  41597. }, {});
  41598. }
  41599. attrs.forEach(function (attr) {
  41600. if (invalidAttributeRE.test(attr.name)) {
  41601. warn$2(
  41602. "Invalid dynamic argument expression: attribute names cannot contain " +
  41603. "spaces, quotes, <, >, / or =.",
  41604. {
  41605. start: attr.start + attr.name.indexOf("["),
  41606. end: attr.start + attr.name.length
  41607. }
  41608. );
  41609. }
  41610. });
  41611. }
  41612. if (isForbiddenTag(element) && !isServerRendering()) {
  41613. element.forbidden = true;
  41614. warn$2(
  41615. 'Templates should only be responsible for mapping the state to the ' +
  41616. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  41617. "<" + tag + ">" + ', as they will not be parsed.',
  41618. { start: element.start }
  41619. );
  41620. }
  41621. // apply pre-transforms
  41622. for (var i = 0; i < preTransforms.length; i++) {
  41623. element = preTransforms[i](element, options) || element;
  41624. }
  41625. if (!inVPre) {
  41626. processPre(element);
  41627. if (element.pre) {
  41628. inVPre = true;
  41629. }
  41630. }
  41631. if (platformIsPreTag(element.tag)) {
  41632. inPre = true;
  41633. }
  41634. if (inVPre) {
  41635. processRawAttrs(element);
  41636. } else if (!element.processed) {
  41637. // structural directives
  41638. processFor(element);
  41639. processIf(element);
  41640. processOnce(element);
  41641. }
  41642. if (!root) {
  41643. root = element;
  41644. {
  41645. checkRootConstraints(root);
  41646. }
  41647. }
  41648. if (!unary) {
  41649. currentParent = element;
  41650. stack.push(element);
  41651. } else {
  41652. closeElement(element);
  41653. }
  41654. },
  41655. end: function end (tag, start, end$1) {
  41656. var element = stack[stack.length - 1];
  41657. // pop stack
  41658. stack.length -= 1;
  41659. currentParent = stack[stack.length - 1];
  41660. if (options.outputSourceRange) {
  41661. element.end = end$1;
  41662. }
  41663. closeElement(element);
  41664. },
  41665. chars: function chars (text, start, end) {
  41666. if (!currentParent) {
  41667. {
  41668. if (text === template) {
  41669. warnOnce(
  41670. 'Component template requires a root element, rather than just text.',
  41671. { start: start }
  41672. );
  41673. } else if ((text = text.trim())) {
  41674. warnOnce(
  41675. ("text \"" + text + "\" outside root element will be ignored."),
  41676. { start: start }
  41677. );
  41678. }
  41679. }
  41680. return
  41681. }
  41682. // IE textarea placeholder bug
  41683. /* istanbul ignore if */
  41684. if (isIE &&
  41685. currentParent.tag === 'textarea' &&
  41686. currentParent.attrsMap.placeholder === text
  41687. ) {
  41688. return
  41689. }
  41690. var children = currentParent.children;
  41691. if (inPre || text.trim()) {
  41692. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  41693. } else if (!children.length) {
  41694. // remove the whitespace-only node right after an opening tag
  41695. text = '';
  41696. } else if (whitespaceOption) {
  41697. if (whitespaceOption === 'condense') {
  41698. // in condense mode, remove the whitespace node if it contains
  41699. // line break, otherwise condense to a single space
  41700. text = lineBreakRE.test(text) ? '' : ' ';
  41701. } else {
  41702. text = ' ';
  41703. }
  41704. } else {
  41705. text = preserveWhitespace ? ' ' : '';
  41706. }
  41707. if (text) {
  41708. if (!inPre && whitespaceOption === 'condense') {
  41709. // condense consecutive whitespaces into single space
  41710. text = text.replace(whitespaceRE$1, ' ');
  41711. }
  41712. var res;
  41713. var child;
  41714. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  41715. child = {
  41716. type: 2,
  41717. expression: res.expression,
  41718. tokens: res.tokens,
  41719. text: text
  41720. };
  41721. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  41722. child = {
  41723. type: 3,
  41724. text: text
  41725. };
  41726. }
  41727. if (child) {
  41728. if (options.outputSourceRange) {
  41729. child.start = start;
  41730. child.end = end;
  41731. }
  41732. children.push(child);
  41733. }
  41734. }
  41735. },
  41736. comment: function comment (text, start, end) {
  41737. // adding anyting as a sibling to the root node is forbidden
  41738. // comments should still be allowed, but ignored
  41739. if (currentParent) {
  41740. var child = {
  41741. type: 3,
  41742. text: text,
  41743. isComment: true
  41744. };
  41745. if (options.outputSourceRange) {
  41746. child.start = start;
  41747. child.end = end;
  41748. }
  41749. currentParent.children.push(child);
  41750. }
  41751. }
  41752. });
  41753. return root
  41754. }
  41755. function processPre (el) {
  41756. if (getAndRemoveAttr(el, 'v-pre') != null) {
  41757. el.pre = true;
  41758. }
  41759. }
  41760. function processRawAttrs (el) {
  41761. var list = el.attrsList;
  41762. var len = list.length;
  41763. if (len) {
  41764. var attrs = el.attrs = new Array(len);
  41765. for (var i = 0; i < len; i++) {
  41766. attrs[i] = {
  41767. name: list[i].name,
  41768. value: JSON.stringify(list[i].value)
  41769. };
  41770. if (list[i].start != null) {
  41771. attrs[i].start = list[i].start;
  41772. attrs[i].end = list[i].end;
  41773. }
  41774. }
  41775. } else if (!el.pre) {
  41776. // non root node in pre blocks with no attributes
  41777. el.plain = true;
  41778. }
  41779. }
  41780. function processElement (
  41781. element,
  41782. options
  41783. ) {
  41784. processKey(element);
  41785. // determine whether this is a plain element after
  41786. // removing structural attributes
  41787. element.plain = (
  41788. !element.key &&
  41789. !element.scopedSlots &&
  41790. !element.attrsList.length
  41791. );
  41792. processRef(element);
  41793. processSlotContent(element);
  41794. processSlotOutlet(element);
  41795. processComponent(element);
  41796. for (var i = 0; i < transforms.length; i++) {
  41797. element = transforms[i](element, options) || element;
  41798. }
  41799. processAttrs(element);
  41800. return element
  41801. }
  41802. function processKey (el) {
  41803. var exp = getBindingAttr(el, 'key');
  41804. if (exp) {
  41805. {
  41806. if (el.tag === 'template') {
  41807. warn$2(
  41808. "<template> cannot be keyed. Place the key on real elements instead.",
  41809. getRawBindingAttr(el, 'key')
  41810. );
  41811. }
  41812. if (el.for) {
  41813. var iterator = el.iterator2 || el.iterator1;
  41814. var parent = el.parent;
  41815. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  41816. warn$2(
  41817. "Do not use v-for index as key on <transition-group> children, " +
  41818. "this is the same as not using keys.",
  41819. getRawBindingAttr(el, 'key'),
  41820. true /* tip */
  41821. );
  41822. }
  41823. }
  41824. }
  41825. el.key = exp;
  41826. }
  41827. }
  41828. function processRef (el) {
  41829. var ref = getBindingAttr(el, 'ref');
  41830. if (ref) {
  41831. el.ref = ref;
  41832. el.refInFor = checkInFor(el);
  41833. }
  41834. }
  41835. function processFor (el) {
  41836. var exp;
  41837. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  41838. var res = parseFor(exp);
  41839. if (res) {
  41840. extend(el, res);
  41841. } else {
  41842. warn$2(
  41843. ("Invalid v-for expression: " + exp),
  41844. el.rawAttrsMap['v-for']
  41845. );
  41846. }
  41847. }
  41848. }
  41849. function parseFor (exp) {
  41850. var inMatch = exp.match(forAliasRE);
  41851. if (!inMatch) { return }
  41852. var res = {};
  41853. res.for = inMatch[2].trim();
  41854. var alias = inMatch[1].trim().replace(stripParensRE, '');
  41855. var iteratorMatch = alias.match(forIteratorRE);
  41856. if (iteratorMatch) {
  41857. res.alias = alias.replace(forIteratorRE, '').trim();
  41858. res.iterator1 = iteratorMatch[1].trim();
  41859. if (iteratorMatch[2]) {
  41860. res.iterator2 = iteratorMatch[2].trim();
  41861. }
  41862. } else {
  41863. res.alias = alias;
  41864. }
  41865. return res
  41866. }
  41867. function processIf (el) {
  41868. var exp = getAndRemoveAttr(el, 'v-if');
  41869. if (exp) {
  41870. el.if = exp;
  41871. addIfCondition(el, {
  41872. exp: exp,
  41873. block: el
  41874. });
  41875. } else {
  41876. if (getAndRemoveAttr(el, 'v-else') != null) {
  41877. el.else = true;
  41878. }
  41879. var elseif = getAndRemoveAttr(el, 'v-else-if');
  41880. if (elseif) {
  41881. el.elseif = elseif;
  41882. }
  41883. }
  41884. }
  41885. function processIfConditions (el, parent) {
  41886. var prev = findPrevElement(parent.children);
  41887. if (prev && prev.if) {
  41888. addIfCondition(prev, {
  41889. exp: el.elseif,
  41890. block: el
  41891. });
  41892. } else {
  41893. warn$2(
  41894. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  41895. "used on element <" + (el.tag) + "> without corresponding v-if.",
  41896. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  41897. );
  41898. }
  41899. }
  41900. function findPrevElement (children) {
  41901. var i = children.length;
  41902. while (i--) {
  41903. if (children[i].type === 1) {
  41904. return children[i]
  41905. } else {
  41906. if (children[i].text !== ' ') {
  41907. warn$2(
  41908. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  41909. "will be ignored.",
  41910. children[i]
  41911. );
  41912. }
  41913. children.pop();
  41914. }
  41915. }
  41916. }
  41917. function addIfCondition (el, condition) {
  41918. if (!el.ifConditions) {
  41919. el.ifConditions = [];
  41920. }
  41921. el.ifConditions.push(condition);
  41922. }
  41923. function processOnce (el) {
  41924. var once$$1 = getAndRemoveAttr(el, 'v-once');
  41925. if (once$$1 != null) {
  41926. el.once = true;
  41927. }
  41928. }
  41929. // handle content being passed to a component as slot,
  41930. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  41931. function processSlotContent (el) {
  41932. var slotScope;
  41933. if (el.tag === 'template') {
  41934. slotScope = getAndRemoveAttr(el, 'scope');
  41935. /* istanbul ignore if */
  41936. if (slotScope) {
  41937. warn$2(
  41938. "the \"scope\" attribute for scoped slots have been deprecated and " +
  41939. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  41940. "can also be used on plain elements in addition to <template> to " +
  41941. "denote scoped slots.",
  41942. el.rawAttrsMap['scope'],
  41943. true
  41944. );
  41945. }
  41946. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  41947. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  41948. /* istanbul ignore if */
  41949. if (el.attrsMap['v-for']) {
  41950. warn$2(
  41951. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  41952. "(v-for takes higher priority). Use a wrapper <template> for the " +
  41953. "scoped slot to make it clearer.",
  41954. el.rawAttrsMap['slot-scope'],
  41955. true
  41956. );
  41957. }
  41958. el.slotScope = slotScope;
  41959. }
  41960. // slot="xxx"
  41961. var slotTarget = getBindingAttr(el, 'slot');
  41962. if (slotTarget) {
  41963. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  41964. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  41965. // preserve slot as an attribute for native shadow DOM compat
  41966. // only for non-scoped slots.
  41967. if (el.tag !== 'template' && !el.slotScope) {
  41968. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  41969. }
  41970. }
  41971. // 2.6 v-slot syntax
  41972. {
  41973. if (el.tag === 'template') {
  41974. // v-slot on <template>
  41975. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  41976. if (slotBinding) {
  41977. {
  41978. if (el.slotTarget || el.slotScope) {
  41979. warn$2(
  41980. "Unexpected mixed usage of different slot syntaxes.",
  41981. el
  41982. );
  41983. }
  41984. if (el.parent && !maybeComponent(el.parent)) {
  41985. warn$2(
  41986. "<template v-slot> can only appear at the root level inside " +
  41987. "the receiving component",
  41988. el
  41989. );
  41990. }
  41991. }
  41992. var ref = getSlotName(slotBinding);
  41993. var name = ref.name;
  41994. var dynamic = ref.dynamic;
  41995. el.slotTarget = name;
  41996. el.slotTargetDynamic = dynamic;
  41997. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  41998. }
  41999. } else {
  42000. // v-slot on component, denotes default slot
  42001. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  42002. if (slotBinding$1) {
  42003. {
  42004. if (!maybeComponent(el)) {
  42005. warn$2(
  42006. "v-slot can only be used on components or <template>.",
  42007. slotBinding$1
  42008. );
  42009. }
  42010. if (el.slotScope || el.slotTarget) {
  42011. warn$2(
  42012. "Unexpected mixed usage of different slot syntaxes.",
  42013. el
  42014. );
  42015. }
  42016. if (el.scopedSlots) {
  42017. warn$2(
  42018. "To avoid scope ambiguity, the default slot should also use " +
  42019. "<template> syntax when there are other named slots.",
  42020. slotBinding$1
  42021. );
  42022. }
  42023. }
  42024. // add the component's children to its default slot
  42025. var slots = el.scopedSlots || (el.scopedSlots = {});
  42026. var ref$1 = getSlotName(slotBinding$1);
  42027. var name$1 = ref$1.name;
  42028. var dynamic$1 = ref$1.dynamic;
  42029. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  42030. slotContainer.slotTarget = name$1;
  42031. slotContainer.slotTargetDynamic = dynamic$1;
  42032. slotContainer.children = el.children.filter(function (c) {
  42033. if (!c.slotScope) {
  42034. c.parent = slotContainer;
  42035. return true
  42036. }
  42037. });
  42038. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  42039. // remove children as they are returned from scopedSlots now
  42040. el.children = [];
  42041. // mark el non-plain so data gets generated
  42042. el.plain = false;
  42043. }
  42044. }
  42045. }
  42046. }
  42047. function getSlotName (binding) {
  42048. var name = binding.name.replace(slotRE, '');
  42049. if (!name) {
  42050. if (binding.name[0] !== '#') {
  42051. name = 'default';
  42052. } else {
  42053. warn$2(
  42054. "v-slot shorthand syntax requires a slot name.",
  42055. binding
  42056. );
  42057. }
  42058. }
  42059. return dynamicArgRE.test(name)
  42060. // dynamic [name]
  42061. ? { name: name.slice(1, -1), dynamic: true }
  42062. // static name
  42063. : { name: ("\"" + name + "\""), dynamic: false }
  42064. }
  42065. // handle <slot/> outlets
  42066. function processSlotOutlet (el) {
  42067. if (el.tag === 'slot') {
  42068. el.slotName = getBindingAttr(el, 'name');
  42069. if (el.key) {
  42070. warn$2(
  42071. "`key` does not work on <slot> because slots are abstract outlets " +
  42072. "and can possibly expand into multiple elements. " +
  42073. "Use the key on a wrapping element instead.",
  42074. getRawBindingAttr(el, 'key')
  42075. );
  42076. }
  42077. }
  42078. }
  42079. function processComponent (el) {
  42080. var binding;
  42081. if ((binding = getBindingAttr(el, 'is'))) {
  42082. el.component = binding;
  42083. }
  42084. if (getAndRemoveAttr(el, 'inline-template') != null) {
  42085. el.inlineTemplate = true;
  42086. }
  42087. }
  42088. function processAttrs (el) {
  42089. var list = el.attrsList;
  42090. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  42091. for (i = 0, l = list.length; i < l; i++) {
  42092. name = rawName = list[i].name;
  42093. value = list[i].value;
  42094. if (dirRE.test(name)) {
  42095. // mark element as dynamic
  42096. el.hasBindings = true;
  42097. // modifiers
  42098. modifiers = parseModifiers(name.replace(dirRE, ''));
  42099. // support .foo shorthand syntax for the .prop modifier
  42100. if (modifiers) {
  42101. name = name.replace(modifierRE, '');
  42102. }
  42103. if (bindRE.test(name)) { // v-bind
  42104. name = name.replace(bindRE, '');
  42105. value = parseFilters(value);
  42106. isDynamic = dynamicArgRE.test(name);
  42107. if (isDynamic) {
  42108. name = name.slice(1, -1);
  42109. }
  42110. if (
  42111. value.trim().length === 0
  42112. ) {
  42113. warn$2(
  42114. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  42115. );
  42116. }
  42117. if (modifiers) {
  42118. if (modifiers.prop && !isDynamic) {
  42119. name = camelize(name);
  42120. if (name === 'innerHtml') { name = 'innerHTML'; }
  42121. }
  42122. if (modifiers.camel && !isDynamic) {
  42123. name = camelize(name);
  42124. }
  42125. if (modifiers.sync) {
  42126. syncGen = genAssignmentCode(value, "$event");
  42127. if (!isDynamic) {
  42128. addHandler(
  42129. el,
  42130. ("update:" + (camelize(name))),
  42131. syncGen,
  42132. null,
  42133. false,
  42134. warn$2,
  42135. list[i]
  42136. );
  42137. if (hyphenate(name) !== camelize(name)) {
  42138. addHandler(
  42139. el,
  42140. ("update:" + (hyphenate(name))),
  42141. syncGen,
  42142. null,
  42143. false,
  42144. warn$2,
  42145. list[i]
  42146. );
  42147. }
  42148. } else {
  42149. // handler w/ dynamic event name
  42150. addHandler(
  42151. el,
  42152. ("\"update:\"+(" + name + ")"),
  42153. syncGen,
  42154. null,
  42155. false,
  42156. warn$2,
  42157. list[i],
  42158. true // dynamic
  42159. );
  42160. }
  42161. }
  42162. }
  42163. if ((modifiers && modifiers.prop) || (
  42164. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  42165. )) {
  42166. addProp(el, name, value, list[i], isDynamic);
  42167. } else {
  42168. addAttr(el, name, value, list[i], isDynamic);
  42169. }
  42170. } else if (onRE.test(name)) { // v-on
  42171. name = name.replace(onRE, '');
  42172. isDynamic = dynamicArgRE.test(name);
  42173. if (isDynamic) {
  42174. name = name.slice(1, -1);
  42175. }
  42176. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  42177. } else { // normal directives
  42178. name = name.replace(dirRE, '');
  42179. // parse arg
  42180. var argMatch = name.match(argRE);
  42181. var arg = argMatch && argMatch[1];
  42182. isDynamic = false;
  42183. if (arg) {
  42184. name = name.slice(0, -(arg.length + 1));
  42185. if (dynamicArgRE.test(arg)) {
  42186. arg = arg.slice(1, -1);
  42187. isDynamic = true;
  42188. }
  42189. }
  42190. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  42191. if (name === 'model') {
  42192. checkForAliasModel(el, value);
  42193. }
  42194. }
  42195. } else {
  42196. // literal attribute
  42197. {
  42198. var res = parseText(value, delimiters);
  42199. if (res) {
  42200. warn$2(
  42201. name + "=\"" + value + "\": " +
  42202. 'Interpolation inside attributes has been removed. ' +
  42203. 'Use v-bind or the colon shorthand instead. For example, ' +
  42204. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  42205. list[i]
  42206. );
  42207. }
  42208. }
  42209. addAttr(el, name, JSON.stringify(value), list[i]);
  42210. // #6887 firefox doesn't update muted state if set via attribute
  42211. // even immediately after element creation
  42212. if (!el.component &&
  42213. name === 'muted' &&
  42214. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  42215. addProp(el, name, 'true', list[i]);
  42216. }
  42217. }
  42218. }
  42219. }
  42220. function checkInFor (el) {
  42221. var parent = el;
  42222. while (parent) {
  42223. if (parent.for !== undefined) {
  42224. return true
  42225. }
  42226. parent = parent.parent;
  42227. }
  42228. return false
  42229. }
  42230. function parseModifiers (name) {
  42231. var match = name.match(modifierRE);
  42232. if (match) {
  42233. var ret = {};
  42234. match.forEach(function (m) { ret[m.slice(1)] = true; });
  42235. return ret
  42236. }
  42237. }
  42238. function makeAttrsMap (attrs) {
  42239. var map = {};
  42240. for (var i = 0, l = attrs.length; i < l; i++) {
  42241. if (
  42242. map[attrs[i].name] && !isIE && !isEdge
  42243. ) {
  42244. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  42245. }
  42246. map[attrs[i].name] = attrs[i].value;
  42247. }
  42248. return map
  42249. }
  42250. // for script (e.g. type="x/template") or style, do not decode content
  42251. function isTextTag (el) {
  42252. return el.tag === 'script' || el.tag === 'style'
  42253. }
  42254. function isForbiddenTag (el) {
  42255. return (
  42256. el.tag === 'style' ||
  42257. (el.tag === 'script' && (
  42258. !el.attrsMap.type ||
  42259. el.attrsMap.type === 'text/javascript'
  42260. ))
  42261. )
  42262. }
  42263. var ieNSBug = /^xmlns:NS\d+/;
  42264. var ieNSPrefix = /^NS\d+:/;
  42265. /* istanbul ignore next */
  42266. function guardIESVGBug (attrs) {
  42267. var res = [];
  42268. for (var i = 0; i < attrs.length; i++) {
  42269. var attr = attrs[i];
  42270. if (!ieNSBug.test(attr.name)) {
  42271. attr.name = attr.name.replace(ieNSPrefix, '');
  42272. res.push(attr);
  42273. }
  42274. }
  42275. return res
  42276. }
  42277. function checkForAliasModel (el, value) {
  42278. var _el = el;
  42279. while (_el) {
  42280. if (_el.for && _el.alias === value) {
  42281. warn$2(
  42282. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  42283. "You are binding v-model directly to a v-for iteration alias. " +
  42284. "This will not be able to modify the v-for source array because " +
  42285. "writing to the alias is like modifying a function local variable. " +
  42286. "Consider using an array of objects and use v-model on an object property instead.",
  42287. el.rawAttrsMap['v-model']
  42288. );
  42289. }
  42290. _el = _el.parent;
  42291. }
  42292. }
  42293. /* */
  42294. function preTransformNode (el, options) {
  42295. if (el.tag === 'input') {
  42296. var map = el.attrsMap;
  42297. if (!map['v-model']) {
  42298. return
  42299. }
  42300. var typeBinding;
  42301. if (map[':type'] || map['v-bind:type']) {
  42302. typeBinding = getBindingAttr(el, 'type');
  42303. }
  42304. if (!map.type && !typeBinding && map['v-bind']) {
  42305. typeBinding = "(" + (map['v-bind']) + ").type";
  42306. }
  42307. if (typeBinding) {
  42308. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  42309. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  42310. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  42311. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  42312. // 1. checkbox
  42313. var branch0 = cloneASTElement(el);
  42314. // process for on the main node
  42315. processFor(branch0);
  42316. addRawAttr(branch0, 'type', 'checkbox');
  42317. processElement(branch0, options);
  42318. branch0.processed = true; // prevent it from double-processed
  42319. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  42320. addIfCondition(branch0, {
  42321. exp: branch0.if,
  42322. block: branch0
  42323. });
  42324. // 2. add radio else-if condition
  42325. var branch1 = cloneASTElement(el);
  42326. getAndRemoveAttr(branch1, 'v-for', true);
  42327. addRawAttr(branch1, 'type', 'radio');
  42328. processElement(branch1, options);
  42329. addIfCondition(branch0, {
  42330. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  42331. block: branch1
  42332. });
  42333. // 3. other
  42334. var branch2 = cloneASTElement(el);
  42335. getAndRemoveAttr(branch2, 'v-for', true);
  42336. addRawAttr(branch2, ':type', typeBinding);
  42337. processElement(branch2, options);
  42338. addIfCondition(branch0, {
  42339. exp: ifCondition,
  42340. block: branch2
  42341. });
  42342. if (hasElse) {
  42343. branch0.else = true;
  42344. } else if (elseIfCondition) {
  42345. branch0.elseif = elseIfCondition;
  42346. }
  42347. return branch0
  42348. }
  42349. }
  42350. }
  42351. function cloneASTElement (el) {
  42352. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  42353. }
  42354. var model$1 = {
  42355. preTransformNode: preTransformNode
  42356. };
  42357. var modules$1 = [
  42358. klass$1,
  42359. style$1,
  42360. model$1
  42361. ];
  42362. /* */
  42363. function text (el, dir) {
  42364. if (dir.value) {
  42365. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  42366. }
  42367. }
  42368. /* */
  42369. function html (el, dir) {
  42370. if (dir.value) {
  42371. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  42372. }
  42373. }
  42374. var directives$1 = {
  42375. model: model,
  42376. text: text,
  42377. html: html
  42378. };
  42379. /* */
  42380. var baseOptions = {
  42381. expectHTML: true,
  42382. modules: modules$1,
  42383. directives: directives$1,
  42384. isPreTag: isPreTag,
  42385. isUnaryTag: isUnaryTag,
  42386. mustUseProp: mustUseProp,
  42387. canBeLeftOpenTag: canBeLeftOpenTag,
  42388. isReservedTag: isReservedTag,
  42389. getTagNamespace: getTagNamespace,
  42390. staticKeys: genStaticKeys(modules$1)
  42391. };
  42392. /* */
  42393. var isStaticKey;
  42394. var isPlatformReservedTag;
  42395. var genStaticKeysCached = cached(genStaticKeys$1);
  42396. /**
  42397. * Goal of the optimizer: walk the generated template AST tree
  42398. * and detect sub-trees that are purely static, i.e. parts of
  42399. * the DOM that never needs to change.
  42400. *
  42401. * Once we detect these sub-trees, we can:
  42402. *
  42403. * 1. Hoist them into constants, so that we no longer need to
  42404. * create fresh nodes for them on each re-render;
  42405. * 2. Completely skip them in the patching process.
  42406. */
  42407. function optimize (root, options) {
  42408. if (!root) { return }
  42409. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  42410. isPlatformReservedTag = options.isReservedTag || no;
  42411. // first pass: mark all non-static nodes.
  42412. markStatic$1(root);
  42413. // second pass: mark static roots.
  42414. markStaticRoots(root, false);
  42415. }
  42416. function genStaticKeys$1 (keys) {
  42417. return makeMap(
  42418. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  42419. (keys ? ',' + keys : '')
  42420. )
  42421. }
  42422. function markStatic$1 (node) {
  42423. node.static = isStatic(node);
  42424. if (node.type === 1) {
  42425. // do not make component slot content static. this avoids
  42426. // 1. components not able to mutate slot nodes
  42427. // 2. static slot content fails for hot-reloading
  42428. if (
  42429. !isPlatformReservedTag(node.tag) &&
  42430. node.tag !== 'slot' &&
  42431. node.attrsMap['inline-template'] == null
  42432. ) {
  42433. return
  42434. }
  42435. for (var i = 0, l = node.children.length; i < l; i++) {
  42436. var child = node.children[i];
  42437. markStatic$1(child);
  42438. if (!child.static) {
  42439. node.static = false;
  42440. }
  42441. }
  42442. if (node.ifConditions) {
  42443. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  42444. var block = node.ifConditions[i$1].block;
  42445. markStatic$1(block);
  42446. if (!block.static) {
  42447. node.static = false;
  42448. }
  42449. }
  42450. }
  42451. }
  42452. }
  42453. function markStaticRoots (node, isInFor) {
  42454. if (node.type === 1) {
  42455. if (node.static || node.once) {
  42456. node.staticInFor = isInFor;
  42457. }
  42458. // For a node to qualify as a static root, it should have children that
  42459. // are not just static text. Otherwise the cost of hoisting out will
  42460. // outweigh the benefits and it's better off to just always render it fresh.
  42461. if (node.static && node.children.length && !(
  42462. node.children.length === 1 &&
  42463. node.children[0].type === 3
  42464. )) {
  42465. node.staticRoot = true;
  42466. return
  42467. } else {
  42468. node.staticRoot = false;
  42469. }
  42470. if (node.children) {
  42471. for (var i = 0, l = node.children.length; i < l; i++) {
  42472. markStaticRoots(node.children[i], isInFor || !!node.for);
  42473. }
  42474. }
  42475. if (node.ifConditions) {
  42476. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  42477. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  42478. }
  42479. }
  42480. }
  42481. }
  42482. function isStatic (node) {
  42483. if (node.type === 2) { // expression
  42484. return false
  42485. }
  42486. if (node.type === 3) { // text
  42487. return true
  42488. }
  42489. return !!(node.pre || (
  42490. !node.hasBindings && // no dynamic bindings
  42491. !node.if && !node.for && // not v-if or v-for or v-else
  42492. !isBuiltInTag(node.tag) && // not a built-in
  42493. isPlatformReservedTag(node.tag) && // not a component
  42494. !isDirectChildOfTemplateFor(node) &&
  42495. Object.keys(node).every(isStaticKey)
  42496. ))
  42497. }
  42498. function isDirectChildOfTemplateFor (node) {
  42499. while (node.parent) {
  42500. node = node.parent;
  42501. if (node.tag !== 'template') {
  42502. return false
  42503. }
  42504. if (node.for) {
  42505. return true
  42506. }
  42507. }
  42508. return false
  42509. }
  42510. /* */
  42511. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  42512. var fnInvokeRE = /\([^)]*?\);*$/;
  42513. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  42514. // KeyboardEvent.keyCode aliases
  42515. var keyCodes = {
  42516. esc: 27,
  42517. tab: 9,
  42518. enter: 13,
  42519. space: 32,
  42520. up: 38,
  42521. left: 37,
  42522. right: 39,
  42523. down: 40,
  42524. 'delete': [8, 46]
  42525. };
  42526. // KeyboardEvent.key aliases
  42527. var keyNames = {
  42528. // #7880: IE11 and Edge use `Esc` for Escape key name.
  42529. esc: ['Esc', 'Escape'],
  42530. tab: 'Tab',
  42531. enter: 'Enter',
  42532. // #9112: IE11 uses `Spacebar` for Space key name.
  42533. space: [' ', 'Spacebar'],
  42534. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  42535. up: ['Up', 'ArrowUp'],
  42536. left: ['Left', 'ArrowLeft'],
  42537. right: ['Right', 'ArrowRight'],
  42538. down: ['Down', 'ArrowDown'],
  42539. // #9112: IE11 uses `Del` for Delete key name.
  42540. 'delete': ['Backspace', 'Delete', 'Del']
  42541. };
  42542. // #4868: modifiers that prevent the execution of the listener
  42543. // need to explicitly return null so that we can determine whether to remove
  42544. // the listener for .once
  42545. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  42546. var modifierCode = {
  42547. stop: '$event.stopPropagation();',
  42548. prevent: '$event.preventDefault();',
  42549. self: genGuard("$event.target !== $event.currentTarget"),
  42550. ctrl: genGuard("!$event.ctrlKey"),
  42551. shift: genGuard("!$event.shiftKey"),
  42552. alt: genGuard("!$event.altKey"),
  42553. meta: genGuard("!$event.metaKey"),
  42554. left: genGuard("'button' in $event && $event.button !== 0"),
  42555. middle: genGuard("'button' in $event && $event.button !== 1"),
  42556. right: genGuard("'button' in $event && $event.button !== 2")
  42557. };
  42558. function genHandlers (
  42559. events,
  42560. isNative
  42561. ) {
  42562. var prefix = isNative ? 'nativeOn:' : 'on:';
  42563. var staticHandlers = "";
  42564. var dynamicHandlers = "";
  42565. for (var name in events) {
  42566. var handlerCode = genHandler(events[name]);
  42567. if (events[name] && events[name].dynamic) {
  42568. dynamicHandlers += name + "," + handlerCode + ",";
  42569. } else {
  42570. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  42571. }
  42572. }
  42573. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  42574. if (dynamicHandlers) {
  42575. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  42576. } else {
  42577. return prefix + staticHandlers
  42578. }
  42579. }
  42580. function genHandler (handler) {
  42581. if (!handler) {
  42582. return 'function(){}'
  42583. }
  42584. if (Array.isArray(handler)) {
  42585. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  42586. }
  42587. var isMethodPath = simplePathRE.test(handler.value);
  42588. var isFunctionExpression = fnExpRE.test(handler.value);
  42589. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  42590. if (!handler.modifiers) {
  42591. if (isMethodPath || isFunctionExpression) {
  42592. return handler.value
  42593. }
  42594. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  42595. } else {
  42596. var code = '';
  42597. var genModifierCode = '';
  42598. var keys = [];
  42599. for (var key in handler.modifiers) {
  42600. if (modifierCode[key]) {
  42601. genModifierCode += modifierCode[key];
  42602. // left/right
  42603. if (keyCodes[key]) {
  42604. keys.push(key);
  42605. }
  42606. } else if (key === 'exact') {
  42607. var modifiers = (handler.modifiers);
  42608. genModifierCode += genGuard(
  42609. ['ctrl', 'shift', 'alt', 'meta']
  42610. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  42611. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  42612. .join('||')
  42613. );
  42614. } else {
  42615. keys.push(key);
  42616. }
  42617. }
  42618. if (keys.length) {
  42619. code += genKeyFilter(keys);
  42620. }
  42621. // Make sure modifiers like prevent and stop get executed after key filtering
  42622. if (genModifierCode) {
  42623. code += genModifierCode;
  42624. }
  42625. var handlerCode = isMethodPath
  42626. ? ("return " + (handler.value) + "($event)")
  42627. : isFunctionExpression
  42628. ? ("return (" + (handler.value) + ")($event)")
  42629. : isFunctionInvocation
  42630. ? ("return " + (handler.value))
  42631. : handler.value;
  42632. return ("function($event){" + code + handlerCode + "}")
  42633. }
  42634. }
  42635. function genKeyFilter (keys) {
  42636. return (
  42637. // make sure the key filters only apply to KeyboardEvents
  42638. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  42639. // key events that do not have keyCode property...
  42640. "if(!$event.type.indexOf('key')&&" +
  42641. (keys.map(genFilterCode).join('&&')) + ")return null;"
  42642. )
  42643. }
  42644. function genFilterCode (key) {
  42645. var keyVal = parseInt(key, 10);
  42646. if (keyVal) {
  42647. return ("$event.keyCode!==" + keyVal)
  42648. }
  42649. var keyCode = keyCodes[key];
  42650. var keyName = keyNames[key];
  42651. return (
  42652. "_k($event.keyCode," +
  42653. (JSON.stringify(key)) + "," +
  42654. (JSON.stringify(keyCode)) + "," +
  42655. "$event.key," +
  42656. "" + (JSON.stringify(keyName)) +
  42657. ")"
  42658. )
  42659. }
  42660. /* */
  42661. function on (el, dir) {
  42662. if (dir.modifiers) {
  42663. warn("v-on without argument does not support modifiers.");
  42664. }
  42665. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  42666. }
  42667. /* */
  42668. function bind$1 (el, dir) {
  42669. el.wrapData = function (code) {
  42670. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  42671. };
  42672. }
  42673. /* */
  42674. var baseDirectives = {
  42675. on: on,
  42676. bind: bind$1,
  42677. cloak: noop
  42678. };
  42679. /* */
  42680. var CodegenState = function CodegenState (options) {
  42681. this.options = options;
  42682. this.warn = options.warn || baseWarn;
  42683. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  42684. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  42685. this.directives = extend(extend({}, baseDirectives), options.directives);
  42686. var isReservedTag = options.isReservedTag || no;
  42687. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  42688. this.onceId = 0;
  42689. this.staticRenderFns = [];
  42690. this.pre = false;
  42691. };
  42692. function generate (
  42693. ast,
  42694. options
  42695. ) {
  42696. var state = new CodegenState(options);
  42697. var code = ast ? genElement(ast, state) : '_c("div")';
  42698. return {
  42699. render: ("with(this){return " + code + "}"),
  42700. staticRenderFns: state.staticRenderFns
  42701. }
  42702. }
  42703. function genElement (el, state) {
  42704. if (el.parent) {
  42705. el.pre = el.pre || el.parent.pre;
  42706. }
  42707. if (el.staticRoot && !el.staticProcessed) {
  42708. return genStatic(el, state)
  42709. } else if (el.once && !el.onceProcessed) {
  42710. return genOnce(el, state)
  42711. } else if (el.for && !el.forProcessed) {
  42712. return genFor(el, state)
  42713. } else if (el.if && !el.ifProcessed) {
  42714. return genIf(el, state)
  42715. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  42716. return genChildren(el, state) || 'void 0'
  42717. } else if (el.tag === 'slot') {
  42718. return genSlot(el, state)
  42719. } else {
  42720. // component or element
  42721. var code;
  42722. if (el.component) {
  42723. code = genComponent(el.component, el, state);
  42724. } else {
  42725. var data;
  42726. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  42727. data = genData$2(el, state);
  42728. }
  42729. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  42730. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  42731. }
  42732. // module transforms
  42733. for (var i = 0; i < state.transforms.length; i++) {
  42734. code = state.transforms[i](el, code);
  42735. }
  42736. return code
  42737. }
  42738. }
  42739. // hoist static sub-trees out
  42740. function genStatic (el, state) {
  42741. el.staticProcessed = true;
  42742. // Some elements (templates) need to behave differently inside of a v-pre
  42743. // node. All pre nodes are static roots, so we can use this as a location to
  42744. // wrap a state change and reset it upon exiting the pre node.
  42745. var originalPreState = state.pre;
  42746. if (el.pre) {
  42747. state.pre = el.pre;
  42748. }
  42749. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  42750. state.pre = originalPreState;
  42751. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  42752. }
  42753. // v-once
  42754. function genOnce (el, state) {
  42755. el.onceProcessed = true;
  42756. if (el.if && !el.ifProcessed) {
  42757. return genIf(el, state)
  42758. } else if (el.staticInFor) {
  42759. var key = '';
  42760. var parent = el.parent;
  42761. while (parent) {
  42762. if (parent.for) {
  42763. key = parent.key;
  42764. break
  42765. }
  42766. parent = parent.parent;
  42767. }
  42768. if (!key) {
  42769. state.warn(
  42770. "v-once can only be used inside v-for that is keyed. ",
  42771. el.rawAttrsMap['v-once']
  42772. );
  42773. return genElement(el, state)
  42774. }
  42775. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  42776. } else {
  42777. return genStatic(el, state)
  42778. }
  42779. }
  42780. function genIf (
  42781. el,
  42782. state,
  42783. altGen,
  42784. altEmpty
  42785. ) {
  42786. el.ifProcessed = true; // avoid recursion
  42787. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  42788. }
  42789. function genIfConditions (
  42790. conditions,
  42791. state,
  42792. altGen,
  42793. altEmpty
  42794. ) {
  42795. if (!conditions.length) {
  42796. return altEmpty || '_e()'
  42797. }
  42798. var condition = conditions.shift();
  42799. if (condition.exp) {
  42800. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  42801. } else {
  42802. return ("" + (genTernaryExp(condition.block)))
  42803. }
  42804. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  42805. function genTernaryExp (el) {
  42806. return altGen
  42807. ? altGen(el, state)
  42808. : el.once
  42809. ? genOnce(el, state)
  42810. : genElement(el, state)
  42811. }
  42812. }
  42813. function genFor (
  42814. el,
  42815. state,
  42816. altGen,
  42817. altHelper
  42818. ) {
  42819. var exp = el.for;
  42820. var alias = el.alias;
  42821. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  42822. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  42823. if (state.maybeComponent(el) &&
  42824. el.tag !== 'slot' &&
  42825. el.tag !== 'template' &&
  42826. !el.key
  42827. ) {
  42828. state.warn(
  42829. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  42830. "v-for should have explicit keys. " +
  42831. "See https://vuejs.org/guide/list.html#key for more info.",
  42832. el.rawAttrsMap['v-for'],
  42833. true /* tip */
  42834. );
  42835. }
  42836. el.forProcessed = true; // avoid recursion
  42837. return (altHelper || '_l') + "((" + exp + ")," +
  42838. "function(" + alias + iterator1 + iterator2 + "){" +
  42839. "return " + ((altGen || genElement)(el, state)) +
  42840. '})'
  42841. }
  42842. function genData$2 (el, state) {
  42843. var data = '{';
  42844. // directives first.
  42845. // directives may mutate the el's other properties before they are generated.
  42846. var dirs = genDirectives(el, state);
  42847. if (dirs) { data += dirs + ','; }
  42848. // key
  42849. if (el.key) {
  42850. data += "key:" + (el.key) + ",";
  42851. }
  42852. // ref
  42853. if (el.ref) {
  42854. data += "ref:" + (el.ref) + ",";
  42855. }
  42856. if (el.refInFor) {
  42857. data += "refInFor:true,";
  42858. }
  42859. // pre
  42860. if (el.pre) {
  42861. data += "pre:true,";
  42862. }
  42863. // record original tag name for components using "is" attribute
  42864. if (el.component) {
  42865. data += "tag:\"" + (el.tag) + "\",";
  42866. }
  42867. // module data generation functions
  42868. for (var i = 0; i < state.dataGenFns.length; i++) {
  42869. data += state.dataGenFns[i](el);
  42870. }
  42871. // attributes
  42872. if (el.attrs) {
  42873. data += "attrs:" + (genProps(el.attrs)) + ",";
  42874. }
  42875. // DOM props
  42876. if (el.props) {
  42877. data += "domProps:" + (genProps(el.props)) + ",";
  42878. }
  42879. // event handlers
  42880. if (el.events) {
  42881. data += (genHandlers(el.events, false)) + ",";
  42882. }
  42883. if (el.nativeEvents) {
  42884. data += (genHandlers(el.nativeEvents, true)) + ",";
  42885. }
  42886. // slot target
  42887. // only for non-scoped slots
  42888. if (el.slotTarget && !el.slotScope) {
  42889. data += "slot:" + (el.slotTarget) + ",";
  42890. }
  42891. // scoped slots
  42892. if (el.scopedSlots) {
  42893. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  42894. }
  42895. // component v-model
  42896. if (el.model) {
  42897. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  42898. }
  42899. // inline-template
  42900. if (el.inlineTemplate) {
  42901. var inlineTemplate = genInlineTemplate(el, state);
  42902. if (inlineTemplate) {
  42903. data += inlineTemplate + ",";
  42904. }
  42905. }
  42906. data = data.replace(/,$/, '') + '}';
  42907. // v-bind dynamic argument wrap
  42908. // v-bind with dynamic arguments must be applied using the same v-bind object
  42909. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  42910. if (el.dynamicAttrs) {
  42911. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  42912. }
  42913. // v-bind data wrap
  42914. if (el.wrapData) {
  42915. data = el.wrapData(data);
  42916. }
  42917. // v-on data wrap
  42918. if (el.wrapListeners) {
  42919. data = el.wrapListeners(data);
  42920. }
  42921. return data
  42922. }
  42923. function genDirectives (el, state) {
  42924. var dirs = el.directives;
  42925. if (!dirs) { return }
  42926. var res = 'directives:[';
  42927. var hasRuntime = false;
  42928. var i, l, dir, needRuntime;
  42929. for (i = 0, l = dirs.length; i < l; i++) {
  42930. dir = dirs[i];
  42931. needRuntime = true;
  42932. var gen = state.directives[dir.name];
  42933. if (gen) {
  42934. // compile-time directive that manipulates AST.
  42935. // returns true if it also needs a runtime counterpart.
  42936. needRuntime = !!gen(el, dir, state.warn);
  42937. }
  42938. if (needRuntime) {
  42939. hasRuntime = true;
  42940. 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))) : '') + "},";
  42941. }
  42942. }
  42943. if (hasRuntime) {
  42944. return res.slice(0, -1) + ']'
  42945. }
  42946. }
  42947. function genInlineTemplate (el, state) {
  42948. var ast = el.children[0];
  42949. if (el.children.length !== 1 || ast.type !== 1) {
  42950. state.warn(
  42951. 'Inline-template components must have exactly one child element.',
  42952. { start: el.start }
  42953. );
  42954. }
  42955. if (ast && ast.type === 1) {
  42956. var inlineRenderFns = generate(ast, state.options);
  42957. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  42958. }
  42959. }
  42960. function genScopedSlots (
  42961. el,
  42962. slots,
  42963. state
  42964. ) {
  42965. // by default scoped slots are considered "stable", this allows child
  42966. // components with only scoped slots to skip forced updates from parent.
  42967. // but in some cases we have to bail-out of this optimization
  42968. // for example if the slot contains dynamic names, has v-if or v-for on them...
  42969. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  42970. var slot = slots[key];
  42971. return (
  42972. slot.slotTargetDynamic ||
  42973. slot.if ||
  42974. slot.for ||
  42975. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  42976. )
  42977. });
  42978. // #9534: if a component with scoped slots is inside a conditional branch,
  42979. // it's possible for the same component to be reused but with different
  42980. // compiled slot content. To avoid that, we generate a unique key based on
  42981. // the generated code of all the slot contents.
  42982. var needsKey = !!el.if;
  42983. // OR when it is inside another scoped slot or v-for (the reactivity may be
  42984. // disconnected due to the intermediate scope variable)
  42985. // #9438, #9506
  42986. // TODO: this can be further optimized by properly analyzing in-scope bindings
  42987. // and skip force updating ones that do not actually use scope variables.
  42988. if (!needsForceUpdate) {
  42989. var parent = el.parent;
  42990. while (parent) {
  42991. if (
  42992. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  42993. parent.for
  42994. ) {
  42995. needsForceUpdate = true;
  42996. break
  42997. }
  42998. if (parent.if) {
  42999. needsKey = true;
  43000. }
  43001. parent = parent.parent;
  43002. }
  43003. }
  43004. var generatedSlots = Object.keys(slots)
  43005. .map(function (key) { return genScopedSlot(slots[key], state); })
  43006. .join(',');
  43007. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  43008. }
  43009. function hash(str) {
  43010. var hash = 5381;
  43011. var i = str.length;
  43012. while(i) {
  43013. hash = (hash * 33) ^ str.charCodeAt(--i);
  43014. }
  43015. return hash >>> 0
  43016. }
  43017. function containsSlotChild (el) {
  43018. if (el.type === 1) {
  43019. if (el.tag === 'slot') {
  43020. return true
  43021. }
  43022. return el.children.some(containsSlotChild)
  43023. }
  43024. return false
  43025. }
  43026. function genScopedSlot (
  43027. el,
  43028. state
  43029. ) {
  43030. var isLegacySyntax = el.attrsMap['slot-scope'];
  43031. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  43032. return genIf(el, state, genScopedSlot, "null")
  43033. }
  43034. if (el.for && !el.forProcessed) {
  43035. return genFor(el, state, genScopedSlot)
  43036. }
  43037. var slotScope = el.slotScope === emptySlotScopeToken
  43038. ? ""
  43039. : String(el.slotScope);
  43040. var fn = "function(" + slotScope + "){" +
  43041. "return " + (el.tag === 'template'
  43042. ? el.if && isLegacySyntax
  43043. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  43044. : genChildren(el, state) || 'undefined'
  43045. : genElement(el, state)) + "}";
  43046. // reverse proxy v-slot without scope on this.$slots
  43047. var reverseProxy = slotScope ? "" : ",proxy:true";
  43048. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  43049. }
  43050. function genChildren (
  43051. el,
  43052. state,
  43053. checkSkip,
  43054. altGenElement,
  43055. altGenNode
  43056. ) {
  43057. var children = el.children;
  43058. if (children.length) {
  43059. var el$1 = children[0];
  43060. // optimize single v-for
  43061. if (children.length === 1 &&
  43062. el$1.for &&
  43063. el$1.tag !== 'template' &&
  43064. el$1.tag !== 'slot'
  43065. ) {
  43066. var normalizationType = checkSkip
  43067. ? state.maybeComponent(el$1) ? ",1" : ",0"
  43068. : "";
  43069. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  43070. }
  43071. var normalizationType$1 = checkSkip
  43072. ? getNormalizationType(children, state.maybeComponent)
  43073. : 0;
  43074. var gen = altGenNode || genNode;
  43075. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  43076. }
  43077. }
  43078. // determine the normalization needed for the children array.
  43079. // 0: no normalization needed
  43080. // 1: simple normalization needed (possible 1-level deep nested array)
  43081. // 2: full normalization needed
  43082. function getNormalizationType (
  43083. children,
  43084. maybeComponent
  43085. ) {
  43086. var res = 0;
  43087. for (var i = 0; i < children.length; i++) {
  43088. var el = children[i];
  43089. if (el.type !== 1) {
  43090. continue
  43091. }
  43092. if (needsNormalization(el) ||
  43093. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  43094. res = 2;
  43095. break
  43096. }
  43097. if (maybeComponent(el) ||
  43098. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  43099. res = 1;
  43100. }
  43101. }
  43102. return res
  43103. }
  43104. function needsNormalization (el) {
  43105. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  43106. }
  43107. function genNode (node, state) {
  43108. if (node.type === 1) {
  43109. return genElement(node, state)
  43110. } else if (node.type === 3 && node.isComment) {
  43111. return genComment(node)
  43112. } else {
  43113. return genText(node)
  43114. }
  43115. }
  43116. function genText (text) {
  43117. return ("_v(" + (text.type === 2
  43118. ? text.expression // no need for () because already wrapped in _s()
  43119. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  43120. }
  43121. function genComment (comment) {
  43122. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  43123. }
  43124. function genSlot (el, state) {
  43125. var slotName = el.slotName || '"default"';
  43126. var children = genChildren(el, state);
  43127. var res = "_t(" + slotName + (children ? ("," + children) : '');
  43128. var attrs = el.attrs || el.dynamicAttrs
  43129. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  43130. // slot props are camelized
  43131. name: camelize(attr.name),
  43132. value: attr.value,
  43133. dynamic: attr.dynamic
  43134. }); }))
  43135. : null;
  43136. var bind$$1 = el.attrsMap['v-bind'];
  43137. if ((attrs || bind$$1) && !children) {
  43138. res += ",null";
  43139. }
  43140. if (attrs) {
  43141. res += "," + attrs;
  43142. }
  43143. if (bind$$1) {
  43144. res += (attrs ? '' : ',null') + "," + bind$$1;
  43145. }
  43146. return res + ')'
  43147. }
  43148. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  43149. function genComponent (
  43150. componentName,
  43151. el,
  43152. state
  43153. ) {
  43154. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  43155. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  43156. }
  43157. function genProps (props) {
  43158. var staticProps = "";
  43159. var dynamicProps = "";
  43160. for (var i = 0; i < props.length; i++) {
  43161. var prop = props[i];
  43162. var value = transformSpecialNewlines(prop.value);
  43163. if (prop.dynamic) {
  43164. dynamicProps += (prop.name) + "," + value + ",";
  43165. } else {
  43166. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  43167. }
  43168. }
  43169. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  43170. if (dynamicProps) {
  43171. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  43172. } else {
  43173. return staticProps
  43174. }
  43175. }
  43176. // #3895, #4268
  43177. function transformSpecialNewlines (text) {
  43178. return text
  43179. .replace(/\u2028/g, '\\u2028')
  43180. .replace(/\u2029/g, '\\u2029')
  43181. }
  43182. /* */
  43183. // these keywords should not appear inside expressions, but operators like
  43184. // typeof, instanceof and in are allowed
  43185. var prohibitedKeywordRE = new RegExp('\\b' + (
  43186. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  43187. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  43188. 'extends,finally,continue,debugger,function,arguments'
  43189. ).split(',').join('\\b|\\b') + '\\b');
  43190. // these unary operators should not be used as property/method names
  43191. var unaryOperatorsRE = new RegExp('\\b' + (
  43192. 'delete,typeof,void'
  43193. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  43194. // strip strings in expressions
  43195. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  43196. // detect problematic expressions in a template
  43197. function detectErrors (ast, warn) {
  43198. if (ast) {
  43199. checkNode(ast, warn);
  43200. }
  43201. }
  43202. function checkNode (node, warn) {
  43203. if (node.type === 1) {
  43204. for (var name in node.attrsMap) {
  43205. if (dirRE.test(name)) {
  43206. var value = node.attrsMap[name];
  43207. if (value) {
  43208. var range = node.rawAttrsMap[name];
  43209. if (name === 'v-for') {
  43210. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  43211. } else if (name === 'v-slot' || name[0] === '#') {
  43212. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  43213. } else if (onRE.test(name)) {
  43214. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  43215. } else {
  43216. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  43217. }
  43218. }
  43219. }
  43220. }
  43221. if (node.children) {
  43222. for (var i = 0; i < node.children.length; i++) {
  43223. checkNode(node.children[i], warn);
  43224. }
  43225. }
  43226. } else if (node.type === 2) {
  43227. checkExpression(node.expression, node.text, warn, node);
  43228. }
  43229. }
  43230. function checkEvent (exp, text, warn, range) {
  43231. var stripped = exp.replace(stripStringRE, '');
  43232. var keywordMatch = stripped.match(unaryOperatorsRE);
  43233. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  43234. warn(
  43235. "avoid using JavaScript unary operator as property name: " +
  43236. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  43237. range
  43238. );
  43239. }
  43240. checkExpression(exp, text, warn, range);
  43241. }
  43242. function checkFor (node, text, warn, range) {
  43243. checkExpression(node.for || '', text, warn, range);
  43244. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  43245. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  43246. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  43247. }
  43248. function checkIdentifier (
  43249. ident,
  43250. type,
  43251. text,
  43252. warn,
  43253. range
  43254. ) {
  43255. if (typeof ident === 'string') {
  43256. try {
  43257. new Function(("var " + ident + "=_"));
  43258. } catch (e) {
  43259. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  43260. }
  43261. }
  43262. }
  43263. function checkExpression (exp, text, warn, range) {
  43264. try {
  43265. new Function(("return " + exp));
  43266. } catch (e) {
  43267. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  43268. if (keywordMatch) {
  43269. warn(
  43270. "avoid using JavaScript keyword as property name: " +
  43271. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  43272. range
  43273. );
  43274. } else {
  43275. warn(
  43276. "invalid expression: " + (e.message) + " in\n\n" +
  43277. " " + exp + "\n\n" +
  43278. " Raw expression: " + (text.trim()) + "\n",
  43279. range
  43280. );
  43281. }
  43282. }
  43283. }
  43284. function checkFunctionParameterExpression (exp, text, warn, range) {
  43285. try {
  43286. new Function(exp, '');
  43287. } catch (e) {
  43288. warn(
  43289. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  43290. " " + exp + "\n\n" +
  43291. " Raw expression: " + (text.trim()) + "\n",
  43292. range
  43293. );
  43294. }
  43295. }
  43296. /* */
  43297. var range = 2;
  43298. function generateCodeFrame (
  43299. source,
  43300. start,
  43301. end
  43302. ) {
  43303. if ( start === void 0 ) start = 0;
  43304. if ( end === void 0 ) end = source.length;
  43305. var lines = source.split(/\r?\n/);
  43306. var count = 0;
  43307. var res = [];
  43308. for (var i = 0; i < lines.length; i++) {
  43309. count += lines[i].length + 1;
  43310. if (count >= start) {
  43311. for (var j = i - range; j <= i + range || end > count; j++) {
  43312. if (j < 0 || j >= lines.length) { continue }
  43313. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  43314. var lineLength = lines[j].length;
  43315. if (j === i) {
  43316. // push underline
  43317. var pad = start - (count - lineLength) + 1;
  43318. var length = end > count ? lineLength - pad : end - start;
  43319. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  43320. } else if (j > i) {
  43321. if (end > count) {
  43322. var length$1 = Math.min(end - count, lineLength);
  43323. res.push(" | " + repeat$1("^", length$1));
  43324. }
  43325. count += lineLength + 1;
  43326. }
  43327. }
  43328. break
  43329. }
  43330. }
  43331. return res.join('\n')
  43332. }
  43333. function repeat$1 (str, n) {
  43334. var result = '';
  43335. if (n > 0) {
  43336. while (true) { // eslint-disable-line
  43337. if (n & 1) { result += str; }
  43338. n >>>= 1;
  43339. if (n <= 0) { break }
  43340. str += str;
  43341. }
  43342. }
  43343. return result
  43344. }
  43345. /* */
  43346. function createFunction (code, errors) {
  43347. try {
  43348. return new Function(code)
  43349. } catch (err) {
  43350. errors.push({ err: err, code: code });
  43351. return noop
  43352. }
  43353. }
  43354. function createCompileToFunctionFn (compile) {
  43355. var cache = Object.create(null);
  43356. return function compileToFunctions (
  43357. template,
  43358. options,
  43359. vm
  43360. ) {
  43361. options = extend({}, options);
  43362. var warn$$1 = options.warn || warn;
  43363. delete options.warn;
  43364. /* istanbul ignore if */
  43365. {
  43366. // detect possible CSP restriction
  43367. try {
  43368. new Function('return 1');
  43369. } catch (e) {
  43370. if (e.toString().match(/unsafe-eval|CSP/)) {
  43371. warn$$1(
  43372. 'It seems you are using the standalone build of Vue.js in an ' +
  43373. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  43374. 'The template compiler cannot work in this environment. Consider ' +
  43375. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  43376. 'templates into render functions.'
  43377. );
  43378. }
  43379. }
  43380. }
  43381. // check cache
  43382. var key = options.delimiters
  43383. ? String(options.delimiters) + template
  43384. : template;
  43385. if (cache[key]) {
  43386. return cache[key]
  43387. }
  43388. // compile
  43389. var compiled = compile(template, options);
  43390. // check compilation errors/tips
  43391. {
  43392. if (compiled.errors && compiled.errors.length) {
  43393. if (options.outputSourceRange) {
  43394. compiled.errors.forEach(function (e) {
  43395. warn$$1(
  43396. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  43397. generateCodeFrame(template, e.start, e.end),
  43398. vm
  43399. );
  43400. });
  43401. } else {
  43402. warn$$1(
  43403. "Error compiling template:\n\n" + template + "\n\n" +
  43404. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  43405. vm
  43406. );
  43407. }
  43408. }
  43409. if (compiled.tips && compiled.tips.length) {
  43410. if (options.outputSourceRange) {
  43411. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  43412. } else {
  43413. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  43414. }
  43415. }
  43416. }
  43417. // turn code into functions
  43418. var res = {};
  43419. var fnGenErrors = [];
  43420. res.render = createFunction(compiled.render, fnGenErrors);
  43421. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  43422. return createFunction(code, fnGenErrors)
  43423. });
  43424. // check function generation errors.
  43425. // this should only happen if there is a bug in the compiler itself.
  43426. // mostly for codegen development use
  43427. /* istanbul ignore if */
  43428. {
  43429. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  43430. warn$$1(
  43431. "Failed to generate render function:\n\n" +
  43432. fnGenErrors.map(function (ref) {
  43433. var err = ref.err;
  43434. var code = ref.code;
  43435. return ((err.toString()) + " in\n\n" + code + "\n");
  43436. }).join('\n'),
  43437. vm
  43438. );
  43439. }
  43440. }
  43441. return (cache[key] = res)
  43442. }
  43443. }
  43444. /* */
  43445. function createCompilerCreator (baseCompile) {
  43446. return function createCompiler (baseOptions) {
  43447. function compile (
  43448. template,
  43449. options
  43450. ) {
  43451. var finalOptions = Object.create(baseOptions);
  43452. var errors = [];
  43453. var tips = [];
  43454. var warn = function (msg, range, tip) {
  43455. (tip ? tips : errors).push(msg);
  43456. };
  43457. if (options) {
  43458. if (options.outputSourceRange) {
  43459. // $flow-disable-line
  43460. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  43461. warn = function (msg, range, tip) {
  43462. var data = { msg: msg };
  43463. if (range) {
  43464. if (range.start != null) {
  43465. data.start = range.start + leadingSpaceLength;
  43466. }
  43467. if (range.end != null) {
  43468. data.end = range.end + leadingSpaceLength;
  43469. }
  43470. }
  43471. (tip ? tips : errors).push(data);
  43472. };
  43473. }
  43474. // merge custom modules
  43475. if (options.modules) {
  43476. finalOptions.modules =
  43477. (baseOptions.modules || []).concat(options.modules);
  43478. }
  43479. // merge custom directives
  43480. if (options.directives) {
  43481. finalOptions.directives = extend(
  43482. Object.create(baseOptions.directives || null),
  43483. options.directives
  43484. );
  43485. }
  43486. // copy other options
  43487. for (var key in options) {
  43488. if (key !== 'modules' && key !== 'directives') {
  43489. finalOptions[key] = options[key];
  43490. }
  43491. }
  43492. }
  43493. finalOptions.warn = warn;
  43494. var compiled = baseCompile(template.trim(), finalOptions);
  43495. {
  43496. detectErrors(compiled.ast, warn);
  43497. }
  43498. compiled.errors = errors;
  43499. compiled.tips = tips;
  43500. return compiled
  43501. }
  43502. return {
  43503. compile: compile,
  43504. compileToFunctions: createCompileToFunctionFn(compile)
  43505. }
  43506. }
  43507. }
  43508. /* */
  43509. // `createCompilerCreator` allows creating compilers that use alternative
  43510. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  43511. // Here we just export a default compiler using the default parts.
  43512. var createCompiler = createCompilerCreator(function baseCompile (
  43513. template,
  43514. options
  43515. ) {
  43516. var ast = parse(template.trim(), options);
  43517. if (options.optimize !== false) {
  43518. optimize(ast, options);
  43519. }
  43520. var code = generate(ast, options);
  43521. return {
  43522. ast: ast,
  43523. render: code.render,
  43524. staticRenderFns: code.staticRenderFns
  43525. }
  43526. });
  43527. /* */
  43528. var ref$1 = createCompiler(baseOptions);
  43529. var compile = ref$1.compile;
  43530. var compileToFunctions = ref$1.compileToFunctions;
  43531. /* */
  43532. // check whether current browser encodes a char inside attribute values
  43533. var div;
  43534. function getShouldDecode (href) {
  43535. div = div || document.createElement('div');
  43536. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  43537. return div.innerHTML.indexOf('&#10;') > 0
  43538. }
  43539. // #3663: IE encodes newlines inside attribute values while other browsers don't
  43540. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  43541. // #6828: chrome encodes content in a[href]
  43542. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  43543. /* */
  43544. var idToTemplate = cached(function (id) {
  43545. var el = query(id);
  43546. return el && el.innerHTML
  43547. });
  43548. var mount = Vue.prototype.$mount;
  43549. Vue.prototype.$mount = function (
  43550. el,
  43551. hydrating
  43552. ) {
  43553. el = el && query(el);
  43554. /* istanbul ignore if */
  43555. if (el === document.body || el === document.documentElement) {
  43556. warn(
  43557. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  43558. );
  43559. return this
  43560. }
  43561. var options = this.$options;
  43562. // resolve template/el and convert to render function
  43563. if (!options.render) {
  43564. var template = options.template;
  43565. if (template) {
  43566. if (typeof template === 'string') {
  43567. if (template.charAt(0) === '#') {
  43568. template = idToTemplate(template);
  43569. /* istanbul ignore if */
  43570. if (!template) {
  43571. warn(
  43572. ("Template element not found or is empty: " + (options.template)),
  43573. this
  43574. );
  43575. }
  43576. }
  43577. } else if (template.nodeType) {
  43578. template = template.innerHTML;
  43579. } else {
  43580. {
  43581. warn('invalid template option:' + template, this);
  43582. }
  43583. return this
  43584. }
  43585. } else if (el) {
  43586. template = getOuterHTML(el);
  43587. }
  43588. if (template) {
  43589. /* istanbul ignore if */
  43590. if (config.performance && mark) {
  43591. mark('compile');
  43592. }
  43593. var ref = compileToFunctions(template, {
  43594. outputSourceRange: "development" !== 'production',
  43595. shouldDecodeNewlines: shouldDecodeNewlines,
  43596. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  43597. delimiters: options.delimiters,
  43598. comments: options.comments
  43599. }, this);
  43600. var render = ref.render;
  43601. var staticRenderFns = ref.staticRenderFns;
  43602. options.render = render;
  43603. options.staticRenderFns = staticRenderFns;
  43604. /* istanbul ignore if */
  43605. if (config.performance && mark) {
  43606. mark('compile end');
  43607. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  43608. }
  43609. }
  43610. }
  43611. return mount.call(this, el, hydrating)
  43612. };
  43613. /**
  43614. * Get outerHTML of elements, taking care
  43615. * of SVG elements in IE as well.
  43616. */
  43617. function getOuterHTML (el) {
  43618. if (el.outerHTML) {
  43619. return el.outerHTML
  43620. } else {
  43621. var container = document.createElement('div');
  43622. container.appendChild(el.cloneNode(true));
  43623. return container.innerHTML
  43624. }
  43625. }
  43626. Vue.compile = compileToFunctions;
  43627. module.exports = Vue;
  43628. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../../timers-browserify/main.js */ "./node_modules/timers-browserify/main.js").setImmediate))
  43629. /***/ }),
  43630. /***/ "./node_modules/vue/dist/vue.common.js":
  43631. /*!*********************************************!*\
  43632. !*** ./node_modules/vue/dist/vue.common.js ***!
  43633. \*********************************************/
  43634. /*! no static exports found */
  43635. /***/ (function(module, exports, __webpack_require__) {
  43636. if (false) {} else {
  43637. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  43638. }
  43639. /***/ }),
  43640. /***/ "./node_modules/webpack/buildin/global.js":
  43641. /*!***********************************!*\
  43642. !*** (webpack)/buildin/global.js ***!
  43643. \***********************************/
  43644. /*! no static exports found */
  43645. /***/ (function(module, exports) {
  43646. var g;
  43647. // This works in non-strict mode
  43648. g = (function() {
  43649. return this;
  43650. })();
  43651. try {
  43652. // This works if eval is allowed (see CSP)
  43653. g = g || new Function("return this")();
  43654. } catch (e) {
  43655. // This works if the window reference is available
  43656. if (typeof window === "object") g = window;
  43657. }
  43658. // g can still be undefined, but nothing to do about it...
  43659. // We return undefined, instead of nothing here, so it's
  43660. // easier to handle this case. if(!global) { ...}
  43661. module.exports = g;
  43662. /***/ }),
  43663. /***/ "./node_modules/webpack/buildin/module.js":
  43664. /*!***********************************!*\
  43665. !*** (webpack)/buildin/module.js ***!
  43666. \***********************************/
  43667. /*! no static exports found */
  43668. /***/ (function(module, exports) {
  43669. module.exports = function(module) {
  43670. if (!module.webpackPolyfill) {
  43671. module.deprecate = function() {};
  43672. module.paths = [];
  43673. // module.parent = undefined by default
  43674. if (!module.children) module.children = [];
  43675. Object.defineProperty(module, "loaded", {
  43676. enumerable: true,
  43677. get: function() {
  43678. return module.l;
  43679. }
  43680. });
  43681. Object.defineProperty(module, "id", {
  43682. enumerable: true,
  43683. get: function() {
  43684. return module.i;
  43685. }
  43686. });
  43687. module.webpackPolyfill = 1;
  43688. }
  43689. return module;
  43690. };
  43691. /***/ }),
  43692. /***/ "./resources/js/app.js":
  43693. /*!*****************************!*\
  43694. !*** ./resources/js/app.js ***!
  43695. \*****************************/
  43696. /*! no static exports found */
  43697. /***/ (function(module, exports, __webpack_require__) {
  43698. /**
  43699. * First we will load all of this project's JavaScript dependencies which
  43700. * includes Vue and other libraries. It is a great starting point when
  43701. * building robust, powerful web applications using Vue and Laravel.
  43702. */
  43703. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  43704. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  43705. /**
  43706. * The following block of code may be used to automatically register your
  43707. * Vue components. It will recursively scan this directory for the Vue
  43708. * components and automatically register them with their "basename".
  43709. *
  43710. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  43711. */
  43712. // const files = require.context('./', true, /\.vue$/i)
  43713. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  43714. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  43715. /**
  43716. * Next, we will create a fresh Vue application instance and attach it to
  43717. * the page. Then, you may begin adding components to this application
  43718. * or customize the JavaScript scaffolding to fit your unique needs.
  43719. */
  43720. var app = new Vue({
  43721. el: '#app'
  43722. });
  43723. /***/ }),
  43724. /***/ "./resources/js/bootstrap.js":
  43725. /*!***********************************!*\
  43726. !*** ./resources/js/bootstrap.js ***!
  43727. \***********************************/
  43728. /*! no static exports found */
  43729. /***/ (function(module, exports, __webpack_require__) {
  43730. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  43731. /**
  43732. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  43733. * for JavaScript based Bootstrap features such as modals and tabs. This
  43734. * code may be modified to fit the specific needs of your application.
  43735. */
  43736. try {
  43737. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  43738. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  43739. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  43740. } catch (e) {}
  43741. /**
  43742. * We'll load the axios HTTP library which allows us to easily issue requests
  43743. * to our Laravel back-end. This library automatically handles sending the
  43744. * CSRF token as a header based on the value of the "XSRF" token cookie.
  43745. */
  43746. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  43747. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  43748. /**
  43749. * Echo exposes an expressive API for subscribing to channels and listening
  43750. * for events that are broadcast by Laravel. Echo and event broadcasting
  43751. * allows your team to easily build robust real-time web applications.
  43752. */
  43753. // import Echo from 'laravel-echo';
  43754. // window.Pusher = require('pusher-js');
  43755. // window.Echo = new Echo({
  43756. // broadcaster: 'pusher',
  43757. // key: process.env.MIX_PUSHER_APP_KEY,
  43758. // cluster: process.env.MIX_PUSHER_APP_CLUSTER,
  43759. // encrypted: true
  43760. // });
  43761. /***/ }),
  43762. /***/ "./resources/js/components/ExampleComponent.vue":
  43763. /*!******************************************************!*\
  43764. !*** ./resources/js/components/ExampleComponent.vue ***!
  43765. \******************************************************/
  43766. /*! exports provided: default */
  43767. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43768. "use strict";
  43769. __webpack_require__.r(__webpack_exports__);
  43770. /* harmony import */ var _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ExampleComponent.vue?vue&type=template&id=299e239e& */ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&");
  43771. /* harmony import */ var _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ExampleComponent.vue?vue&type=script&lang=js& */ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&");
  43772. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  43773. /* normalize component */
  43774. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  43775. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  43776. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  43777. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  43778. false,
  43779. null,
  43780. null,
  43781. null
  43782. )
  43783. /* hot reload */
  43784. if (false) { var api; }
  43785. component.options.__file = "resources/js/components/ExampleComponent.vue"
  43786. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  43787. /***/ }),
  43788. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  43789. /*!*******************************************************************************!*\
  43790. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  43791. \*******************************************************************************/
  43792. /*! exports provided: default */
  43793. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43794. "use strict";
  43795. __webpack_require__.r(__webpack_exports__);
  43796. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./ExampleComponent.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&");
  43797. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  43798. /***/ }),
  43799. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  43800. /*!*************************************************************************************!*\
  43801. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  43802. \*************************************************************************************/
  43803. /*! exports provided: render, staticRenderFns */
  43804. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43805. "use strict";
  43806. __webpack_require__.r(__webpack_exports__);
  43807. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./ExampleComponent.vue?vue&type=template&id=299e239e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&");
  43808. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  43809. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  43810. /***/ }),
  43811. /***/ "./resources/sass/app.scss":
  43812. /*!*********************************!*\
  43813. !*** ./resources/sass/app.scss ***!
  43814. \*********************************/
  43815. /*! no static exports found */
  43816. /***/ (function(module, exports) {
  43817. // removed by extract-text-webpack-plugin
  43818. /***/ }),
  43819. /***/ 0:
  43820. /*!*************************************************************!*\
  43821. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  43822. \*************************************************************/
  43823. /*! no static exports found */
  43824. /***/ (function(module, exports, __webpack_require__) {
  43825. __webpack_require__(/*! c:\xampp\htdocs\ISR\resources\js\app.js */"./resources/js/app.js");
  43826. module.exports = __webpack_require__(/*! c:\xampp\htdocs\ISR\resources\sass\app.scss */"./resources/sass/app.scss");
  43827. /***/ })
  43828. /******/ });