app.js 1.7 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098
  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/after/index.js":
  89. /*!*************************************!*\
  90. !*** ./node_modules/after/index.js ***!
  91. \*************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports) {
  94. module.exports = after
  95. function after(count, callback, err_cb) {
  96. var bail = false
  97. err_cb = err_cb || noop
  98. proxy.count = count
  99. return (count === 0) ? callback() : proxy
  100. function proxy(err, result) {
  101. if (proxy.count <= 0) {
  102. throw new Error('after called too many times')
  103. }
  104. --proxy.count
  105. // after first error, rest are passed to err_cb
  106. if (err) {
  107. bail = true
  108. callback(err)
  109. // future error callbacks will go to error handler
  110. callback = err_cb
  111. } else if (proxy.count === 0 && !bail) {
  112. callback(null, result)
  113. }
  114. }
  115. }
  116. function noop() {}
  117. /***/ }),
  118. /***/ "./node_modules/arraybuffer.slice/index.js":
  119. /*!*************************************************!*\
  120. !*** ./node_modules/arraybuffer.slice/index.js ***!
  121. \*************************************************/
  122. /*! no static exports found */
  123. /***/ (function(module, exports) {
  124. /**
  125. * An abstraction for slicing an arraybuffer even when
  126. * ArrayBuffer.prototype.slice is not supported
  127. *
  128. * @api public
  129. */
  130. module.exports = function(arraybuffer, start, end) {
  131. var bytes = arraybuffer.byteLength;
  132. start = start || 0;
  133. end = end || bytes;
  134. if (arraybuffer.slice) { return arraybuffer.slice(start, end); }
  135. if (start < 0) { start += bytes; }
  136. if (end < 0) { end += bytes; }
  137. if (end > bytes) { end = bytes; }
  138. if (start >= bytes || start >= end || bytes === 0) {
  139. return new ArrayBuffer(0);
  140. }
  141. var abv = new Uint8Array(arraybuffer);
  142. var result = new Uint8Array(end - start);
  143. for (var i = start, ii = 0; i < end; i++, ii++) {
  144. result[ii] = abv[i];
  145. }
  146. return result.buffer;
  147. };
  148. /***/ }),
  149. /***/ "./node_modules/axios/index.js":
  150. /*!*************************************!*\
  151. !*** ./node_modules/axios/index.js ***!
  152. \*************************************/
  153. /*! no static exports found */
  154. /***/ (function(module, exports, __webpack_require__) {
  155. module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
  156. /***/ }),
  157. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  158. /*!************************************************!*\
  159. !*** ./node_modules/axios/lib/adapters/xhr.js ***!
  160. \************************************************/
  161. /*! no static exports found */
  162. /***/ (function(module, exports, __webpack_require__) {
  163. "use strict";
  164. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  165. var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
  166. var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  167. var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
  168. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  169. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  170. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  171. module.exports = function xhrAdapter(config) {
  172. return new Promise(function dispatchXhrRequest(resolve, reject) {
  173. var requestData = config.data;
  174. var requestHeaders = config.headers;
  175. if (utils.isFormData(requestData)) {
  176. delete requestHeaders['Content-Type']; // Let the browser set it
  177. }
  178. var request = new XMLHttpRequest();
  179. // HTTP basic authentication
  180. if (config.auth) {
  181. var username = config.auth.username || '';
  182. var password = config.auth.password || '';
  183. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  184. }
  185. var fullPath = buildFullPath(config.baseURL, config.url);
  186. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  187. // Set the request timeout in MS
  188. request.timeout = config.timeout;
  189. // Listen for ready state
  190. request.onreadystatechange = function handleLoad() {
  191. if (!request || request.readyState !== 4) {
  192. return;
  193. }
  194. // The request errored out and we didn't get a response, this will be
  195. // handled by onerror instead
  196. // With one exception: request that using file: protocol, most browsers
  197. // will return status as 0 even though it's a successful request
  198. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  199. return;
  200. }
  201. // Prepare the response
  202. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  203. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  204. var response = {
  205. data: responseData,
  206. status: request.status,
  207. statusText: request.statusText,
  208. headers: responseHeaders,
  209. config: config,
  210. request: request
  211. };
  212. settle(resolve, reject, response);
  213. // Clean up request
  214. request = null;
  215. };
  216. // Handle browser request cancellation (as opposed to a manual cancellation)
  217. request.onabort = function handleAbort() {
  218. if (!request) {
  219. return;
  220. }
  221. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  222. // Clean up request
  223. request = null;
  224. };
  225. // Handle low level network errors
  226. request.onerror = function handleError() {
  227. // Real errors are hidden from us by the browser
  228. // onerror should only fire if it's a network error
  229. reject(createError('Network Error', config, null, request));
  230. // Clean up request
  231. request = null;
  232. };
  233. // Handle timeout
  234. request.ontimeout = function handleTimeout() {
  235. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  236. if (config.timeoutErrorMessage) {
  237. timeoutErrorMessage = config.timeoutErrorMessage;
  238. }
  239. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  240. request));
  241. // Clean up request
  242. request = null;
  243. };
  244. // Add xsrf header
  245. // This is only done if running in a standard browser environment.
  246. // Specifically not if we're in a web worker, or react-native.
  247. if (utils.isStandardBrowserEnv()) {
  248. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  249. // Add xsrf header
  250. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  251. cookies.read(config.xsrfCookieName) :
  252. undefined;
  253. if (xsrfValue) {
  254. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  255. }
  256. }
  257. // Add headers to the request
  258. if ('setRequestHeader' in request) {
  259. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  260. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  261. // Remove Content-Type if data is undefined
  262. delete requestHeaders[key];
  263. } else {
  264. // Otherwise add header to the request
  265. request.setRequestHeader(key, val);
  266. }
  267. });
  268. }
  269. // Add withCredentials to request if needed
  270. if (!utils.isUndefined(config.withCredentials)) {
  271. request.withCredentials = !!config.withCredentials;
  272. }
  273. // Add responseType to request if needed
  274. if (config.responseType) {
  275. try {
  276. request.responseType = config.responseType;
  277. } catch (e) {
  278. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  279. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  280. if (config.responseType !== 'json') {
  281. throw e;
  282. }
  283. }
  284. }
  285. // Handle progress if needed
  286. if (typeof config.onDownloadProgress === 'function') {
  287. request.addEventListener('progress', config.onDownloadProgress);
  288. }
  289. // Not all browsers support upload events
  290. if (typeof config.onUploadProgress === 'function' && request.upload) {
  291. request.upload.addEventListener('progress', config.onUploadProgress);
  292. }
  293. if (config.cancelToken) {
  294. // Handle cancellation
  295. config.cancelToken.promise.then(function onCanceled(cancel) {
  296. if (!request) {
  297. return;
  298. }
  299. request.abort();
  300. reject(cancel);
  301. // Clean up request
  302. request = null;
  303. });
  304. }
  305. if (requestData === undefined) {
  306. requestData = null;
  307. }
  308. // Send the request
  309. request.send(requestData);
  310. });
  311. };
  312. /***/ }),
  313. /***/ "./node_modules/axios/lib/axios.js":
  314. /*!*****************************************!*\
  315. !*** ./node_modules/axios/lib/axios.js ***!
  316. \*****************************************/
  317. /*! no static exports found */
  318. /***/ (function(module, exports, __webpack_require__) {
  319. "use strict";
  320. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  321. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  322. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  323. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  324. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  325. /**
  326. * Create an instance of Axios
  327. *
  328. * @param {Object} defaultConfig The default config for the instance
  329. * @return {Axios} A new instance of Axios
  330. */
  331. function createInstance(defaultConfig) {
  332. var context = new Axios(defaultConfig);
  333. var instance = bind(Axios.prototype.request, context);
  334. // Copy axios.prototype to instance
  335. utils.extend(instance, Axios.prototype, context);
  336. // Copy context to instance
  337. utils.extend(instance, context);
  338. return instance;
  339. }
  340. // Create the default instance to be exported
  341. var axios = createInstance(defaults);
  342. // Expose Axios class to allow class inheritance
  343. axios.Axios = Axios;
  344. // Factory for creating new instances
  345. axios.create = function create(instanceConfig) {
  346. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  347. };
  348. // Expose Cancel & CancelToken
  349. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  350. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  351. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  352. // Expose all/spread
  353. axios.all = function all(promises) {
  354. return Promise.all(promises);
  355. };
  356. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  357. module.exports = axios;
  358. // Allow use of default import syntax in TypeScript
  359. module.exports.default = axios;
  360. /***/ }),
  361. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  362. /*!*************************************************!*\
  363. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  364. \*************************************************/
  365. /*! no static exports found */
  366. /***/ (function(module, exports, __webpack_require__) {
  367. "use strict";
  368. /**
  369. * A `Cancel` is an object that is thrown when an operation is canceled.
  370. *
  371. * @class
  372. * @param {string=} message The message.
  373. */
  374. function Cancel(message) {
  375. this.message = message;
  376. }
  377. Cancel.prototype.toString = function toString() {
  378. return 'Cancel' + (this.message ? ': ' + this.message : '');
  379. };
  380. Cancel.prototype.__CANCEL__ = true;
  381. module.exports = Cancel;
  382. /***/ }),
  383. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  384. /*!******************************************************!*\
  385. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  386. \******************************************************/
  387. /*! no static exports found */
  388. /***/ (function(module, exports, __webpack_require__) {
  389. "use strict";
  390. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  391. /**
  392. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  393. *
  394. * @class
  395. * @param {Function} executor The executor function.
  396. */
  397. function CancelToken(executor) {
  398. if (typeof executor !== 'function') {
  399. throw new TypeError('executor must be a function.');
  400. }
  401. var resolvePromise;
  402. this.promise = new Promise(function promiseExecutor(resolve) {
  403. resolvePromise = resolve;
  404. });
  405. var token = this;
  406. executor(function cancel(message) {
  407. if (token.reason) {
  408. // Cancellation has already been requested
  409. return;
  410. }
  411. token.reason = new Cancel(message);
  412. resolvePromise(token.reason);
  413. });
  414. }
  415. /**
  416. * Throws a `Cancel` if cancellation has been requested.
  417. */
  418. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  419. if (this.reason) {
  420. throw this.reason;
  421. }
  422. };
  423. /**
  424. * Returns an object that contains a new `CancelToken` and a function that, when called,
  425. * cancels the `CancelToken`.
  426. */
  427. CancelToken.source = function source() {
  428. var cancel;
  429. var token = new CancelToken(function executor(c) {
  430. cancel = c;
  431. });
  432. return {
  433. token: token,
  434. cancel: cancel
  435. };
  436. };
  437. module.exports = CancelToken;
  438. /***/ }),
  439. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  440. /*!***************************************************!*\
  441. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  442. \***************************************************/
  443. /*! no static exports found */
  444. /***/ (function(module, exports, __webpack_require__) {
  445. "use strict";
  446. module.exports = function isCancel(value) {
  447. return !!(value && value.__CANCEL__);
  448. };
  449. /***/ }),
  450. /***/ "./node_modules/axios/lib/core/Axios.js":
  451. /*!**********************************************!*\
  452. !*** ./node_modules/axios/lib/core/Axios.js ***!
  453. \**********************************************/
  454. /*! no static exports found */
  455. /***/ (function(module, exports, __webpack_require__) {
  456. "use strict";
  457. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  458. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  459. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  460. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  461. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  462. /**
  463. * Create a new instance of Axios
  464. *
  465. * @param {Object} instanceConfig The default config for the instance
  466. */
  467. function Axios(instanceConfig) {
  468. this.defaults = instanceConfig;
  469. this.interceptors = {
  470. request: new InterceptorManager(),
  471. response: new InterceptorManager()
  472. };
  473. }
  474. /**
  475. * Dispatch a request
  476. *
  477. * @param {Object} config The config specific for this request (merged with this.defaults)
  478. */
  479. Axios.prototype.request = function request(config) {
  480. /*eslint no-param-reassign:0*/
  481. // Allow for axios('example/url'[, config]) a la fetch API
  482. if (typeof config === 'string') {
  483. config = arguments[1] || {};
  484. config.url = arguments[0];
  485. } else {
  486. config = config || {};
  487. }
  488. config = mergeConfig(this.defaults, config);
  489. // Set config.method
  490. if (config.method) {
  491. config.method = config.method.toLowerCase();
  492. } else if (this.defaults.method) {
  493. config.method = this.defaults.method.toLowerCase();
  494. } else {
  495. config.method = 'get';
  496. }
  497. // Hook up interceptors middleware
  498. var chain = [dispatchRequest, undefined];
  499. var promise = Promise.resolve(config);
  500. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  501. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  502. });
  503. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  504. chain.push(interceptor.fulfilled, interceptor.rejected);
  505. });
  506. while (chain.length) {
  507. promise = promise.then(chain.shift(), chain.shift());
  508. }
  509. return promise;
  510. };
  511. Axios.prototype.getUri = function getUri(config) {
  512. config = mergeConfig(this.defaults, config);
  513. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  514. };
  515. // Provide aliases for supported request methods
  516. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  517. /*eslint func-names:0*/
  518. Axios.prototype[method] = function(url, config) {
  519. return this.request(utils.merge(config || {}, {
  520. method: method,
  521. url: url
  522. }));
  523. };
  524. });
  525. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  526. /*eslint func-names:0*/
  527. Axios.prototype[method] = function(url, data, config) {
  528. return this.request(utils.merge(config || {}, {
  529. method: method,
  530. url: url,
  531. data: data
  532. }));
  533. };
  534. });
  535. module.exports = Axios;
  536. /***/ }),
  537. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  538. /*!***********************************************************!*\
  539. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  540. \***********************************************************/
  541. /*! no static exports found */
  542. /***/ (function(module, exports, __webpack_require__) {
  543. "use strict";
  544. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  545. function InterceptorManager() {
  546. this.handlers = [];
  547. }
  548. /**
  549. * Add a new interceptor to the stack
  550. *
  551. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  552. * @param {Function} rejected The function to handle `reject` for a `Promise`
  553. *
  554. * @return {Number} An ID used to remove interceptor later
  555. */
  556. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  557. this.handlers.push({
  558. fulfilled: fulfilled,
  559. rejected: rejected
  560. });
  561. return this.handlers.length - 1;
  562. };
  563. /**
  564. * Remove an interceptor from the stack
  565. *
  566. * @param {Number} id The ID that was returned by `use`
  567. */
  568. InterceptorManager.prototype.eject = function eject(id) {
  569. if (this.handlers[id]) {
  570. this.handlers[id] = null;
  571. }
  572. };
  573. /**
  574. * Iterate over all the registered interceptors
  575. *
  576. * This method is particularly useful for skipping over any
  577. * interceptors that may have become `null` calling `eject`.
  578. *
  579. * @param {Function} fn The function to call for each interceptor
  580. */
  581. InterceptorManager.prototype.forEach = function forEach(fn) {
  582. utils.forEach(this.handlers, function forEachHandler(h) {
  583. if (h !== null) {
  584. fn(h);
  585. }
  586. });
  587. };
  588. module.exports = InterceptorManager;
  589. /***/ }),
  590. /***/ "./node_modules/axios/lib/core/buildFullPath.js":
  591. /*!******************************************************!*\
  592. !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
  593. \******************************************************/
  594. /*! no static exports found */
  595. /***/ (function(module, exports, __webpack_require__) {
  596. "use strict";
  597. var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  598. var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  599. /**
  600. * Creates a new URL by combining the baseURL with the requestedURL,
  601. * only when the requestedURL is not already an absolute URL.
  602. * If the requestURL is absolute, this function returns the requestedURL untouched.
  603. *
  604. * @param {string} baseURL The base URL
  605. * @param {string} requestedURL Absolute or relative URL to combine
  606. * @returns {string} The combined full path
  607. */
  608. module.exports = function buildFullPath(baseURL, requestedURL) {
  609. if (baseURL && !isAbsoluteURL(requestedURL)) {
  610. return combineURLs(baseURL, requestedURL);
  611. }
  612. return requestedURL;
  613. };
  614. /***/ }),
  615. /***/ "./node_modules/axios/lib/core/createError.js":
  616. /*!****************************************************!*\
  617. !*** ./node_modules/axios/lib/core/createError.js ***!
  618. \****************************************************/
  619. /*! no static exports found */
  620. /***/ (function(module, exports, __webpack_require__) {
  621. "use strict";
  622. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  623. /**
  624. * Create an Error with the specified message, config, error code, request and response.
  625. *
  626. * @param {string} message The error message.
  627. * @param {Object} config The config.
  628. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  629. * @param {Object} [request] The request.
  630. * @param {Object} [response] The response.
  631. * @returns {Error} The created error.
  632. */
  633. module.exports = function createError(message, config, code, request, response) {
  634. var error = new Error(message);
  635. return enhanceError(error, config, code, request, response);
  636. };
  637. /***/ }),
  638. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  639. /*!********************************************************!*\
  640. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  641. \********************************************************/
  642. /*! no static exports found */
  643. /***/ (function(module, exports, __webpack_require__) {
  644. "use strict";
  645. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  646. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  647. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  648. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  649. /**
  650. * Throws a `Cancel` if cancellation has been requested.
  651. */
  652. function throwIfCancellationRequested(config) {
  653. if (config.cancelToken) {
  654. config.cancelToken.throwIfRequested();
  655. }
  656. }
  657. /**
  658. * Dispatch a request to the server using the configured adapter.
  659. *
  660. * @param {object} config The config that is to be used for the request
  661. * @returns {Promise} The Promise to be fulfilled
  662. */
  663. module.exports = function dispatchRequest(config) {
  664. throwIfCancellationRequested(config);
  665. // Ensure headers exist
  666. config.headers = config.headers || {};
  667. // Transform request data
  668. config.data = transformData(
  669. config.data,
  670. config.headers,
  671. config.transformRequest
  672. );
  673. // Flatten headers
  674. config.headers = utils.merge(
  675. config.headers.common || {},
  676. config.headers[config.method] || {},
  677. config.headers
  678. );
  679. utils.forEach(
  680. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  681. function cleanHeaderConfig(method) {
  682. delete config.headers[method];
  683. }
  684. );
  685. var adapter = config.adapter || defaults.adapter;
  686. return adapter(config).then(function onAdapterResolution(response) {
  687. throwIfCancellationRequested(config);
  688. // Transform response data
  689. response.data = transformData(
  690. response.data,
  691. response.headers,
  692. config.transformResponse
  693. );
  694. return response;
  695. }, function onAdapterRejection(reason) {
  696. if (!isCancel(reason)) {
  697. throwIfCancellationRequested(config);
  698. // Transform response data
  699. if (reason && reason.response) {
  700. reason.response.data = transformData(
  701. reason.response.data,
  702. reason.response.headers,
  703. config.transformResponse
  704. );
  705. }
  706. }
  707. return Promise.reject(reason);
  708. });
  709. };
  710. /***/ }),
  711. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  712. /*!*****************************************************!*\
  713. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  714. \*****************************************************/
  715. /*! no static exports found */
  716. /***/ (function(module, exports, __webpack_require__) {
  717. "use strict";
  718. /**
  719. * Update an Error with the specified config, error code, and response.
  720. *
  721. * @param {Error} error The error to update.
  722. * @param {Object} config The config.
  723. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  724. * @param {Object} [request] The request.
  725. * @param {Object} [response] The response.
  726. * @returns {Error} The error.
  727. */
  728. module.exports = function enhanceError(error, config, code, request, response) {
  729. error.config = config;
  730. if (code) {
  731. error.code = code;
  732. }
  733. error.request = request;
  734. error.response = response;
  735. error.isAxiosError = true;
  736. error.toJSON = function() {
  737. return {
  738. // Standard
  739. message: this.message,
  740. name: this.name,
  741. // Microsoft
  742. description: this.description,
  743. number: this.number,
  744. // Mozilla
  745. fileName: this.fileName,
  746. lineNumber: this.lineNumber,
  747. columnNumber: this.columnNumber,
  748. stack: this.stack,
  749. // Axios
  750. config: this.config,
  751. code: this.code
  752. };
  753. };
  754. return error;
  755. };
  756. /***/ }),
  757. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  758. /*!****************************************************!*\
  759. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  760. \****************************************************/
  761. /*! no static exports found */
  762. /***/ (function(module, exports, __webpack_require__) {
  763. "use strict";
  764. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  765. /**
  766. * Config-specific merge-function which creates a new config-object
  767. * by merging two configuration objects together.
  768. *
  769. * @param {Object} config1
  770. * @param {Object} config2
  771. * @returns {Object} New object resulting from merging config2 to config1
  772. */
  773. module.exports = function mergeConfig(config1, config2) {
  774. // eslint-disable-next-line no-param-reassign
  775. config2 = config2 || {};
  776. var config = {};
  777. var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
  778. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
  779. var defaultToConfig2Keys = [
  780. 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
  781. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  782. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
  783. 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
  784. 'httpsAgent', 'cancelToken', 'socketPath'
  785. ];
  786. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  787. if (typeof config2[prop] !== 'undefined') {
  788. config[prop] = config2[prop];
  789. }
  790. });
  791. utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
  792. if (utils.isObject(config2[prop])) {
  793. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  794. } else if (typeof config2[prop] !== 'undefined') {
  795. config[prop] = config2[prop];
  796. } else if (utils.isObject(config1[prop])) {
  797. config[prop] = utils.deepMerge(config1[prop]);
  798. } else if (typeof config1[prop] !== 'undefined') {
  799. config[prop] = config1[prop];
  800. }
  801. });
  802. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  803. if (typeof config2[prop] !== 'undefined') {
  804. config[prop] = config2[prop];
  805. } else if (typeof config1[prop] !== 'undefined') {
  806. config[prop] = config1[prop];
  807. }
  808. });
  809. var axiosKeys = valueFromConfig2Keys
  810. .concat(mergeDeepPropertiesKeys)
  811. .concat(defaultToConfig2Keys);
  812. var otherKeys = Object
  813. .keys(config2)
  814. .filter(function filterAxiosKeys(key) {
  815. return axiosKeys.indexOf(key) === -1;
  816. });
  817. utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
  818. if (typeof config2[prop] !== 'undefined') {
  819. config[prop] = config2[prop];
  820. } else if (typeof config1[prop] !== 'undefined') {
  821. config[prop] = config1[prop];
  822. }
  823. });
  824. return config;
  825. };
  826. /***/ }),
  827. /***/ "./node_modules/axios/lib/core/settle.js":
  828. /*!***********************************************!*\
  829. !*** ./node_modules/axios/lib/core/settle.js ***!
  830. \***********************************************/
  831. /*! no static exports found */
  832. /***/ (function(module, exports, __webpack_require__) {
  833. "use strict";
  834. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  835. /**
  836. * Resolve or reject a Promise based on response status.
  837. *
  838. * @param {Function} resolve A function that resolves the promise.
  839. * @param {Function} reject A function that rejects the promise.
  840. * @param {object} response The response.
  841. */
  842. module.exports = function settle(resolve, reject, response) {
  843. var validateStatus = response.config.validateStatus;
  844. if (!validateStatus || validateStatus(response.status)) {
  845. resolve(response);
  846. } else {
  847. reject(createError(
  848. 'Request failed with status code ' + response.status,
  849. response.config,
  850. null,
  851. response.request,
  852. response
  853. ));
  854. }
  855. };
  856. /***/ }),
  857. /***/ "./node_modules/axios/lib/core/transformData.js":
  858. /*!******************************************************!*\
  859. !*** ./node_modules/axios/lib/core/transformData.js ***!
  860. \******************************************************/
  861. /*! no static exports found */
  862. /***/ (function(module, exports, __webpack_require__) {
  863. "use strict";
  864. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  865. /**
  866. * Transform the data for a request or a response
  867. *
  868. * @param {Object|String} data The data to be transformed
  869. * @param {Array} headers The headers for the request or response
  870. * @param {Array|Function} fns A single function or Array of functions
  871. * @returns {*} The resulting transformed data
  872. */
  873. module.exports = function transformData(data, headers, fns) {
  874. /*eslint no-param-reassign:0*/
  875. utils.forEach(fns, function transform(fn) {
  876. data = fn(data, headers);
  877. });
  878. return data;
  879. };
  880. /***/ }),
  881. /***/ "./node_modules/axios/lib/defaults.js":
  882. /*!********************************************!*\
  883. !*** ./node_modules/axios/lib/defaults.js ***!
  884. \********************************************/
  885. /*! no static exports found */
  886. /***/ (function(module, exports, __webpack_require__) {
  887. "use strict";
  888. /* WEBPACK VAR INJECTION */(function(process) {
  889. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  890. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  891. var DEFAULT_CONTENT_TYPE = {
  892. 'Content-Type': 'application/x-www-form-urlencoded'
  893. };
  894. function setContentTypeIfUnset(headers, value) {
  895. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  896. headers['Content-Type'] = value;
  897. }
  898. }
  899. function getDefaultAdapter() {
  900. var adapter;
  901. if (typeof XMLHttpRequest !== 'undefined') {
  902. // For browsers use XHR adapter
  903. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  904. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  905. // For node use HTTP adapter
  906. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  907. }
  908. return adapter;
  909. }
  910. var defaults = {
  911. adapter: getDefaultAdapter(),
  912. transformRequest: [function transformRequest(data, headers) {
  913. normalizeHeaderName(headers, 'Accept');
  914. normalizeHeaderName(headers, 'Content-Type');
  915. if (utils.isFormData(data) ||
  916. utils.isArrayBuffer(data) ||
  917. utils.isBuffer(data) ||
  918. utils.isStream(data) ||
  919. utils.isFile(data) ||
  920. utils.isBlob(data)
  921. ) {
  922. return data;
  923. }
  924. if (utils.isArrayBufferView(data)) {
  925. return data.buffer;
  926. }
  927. if (utils.isURLSearchParams(data)) {
  928. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  929. return data.toString();
  930. }
  931. if (utils.isObject(data)) {
  932. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  933. return JSON.stringify(data);
  934. }
  935. return data;
  936. }],
  937. transformResponse: [function transformResponse(data) {
  938. /*eslint no-param-reassign:0*/
  939. if (typeof data === 'string') {
  940. try {
  941. data = JSON.parse(data);
  942. } catch (e) { /* Ignore */ }
  943. }
  944. return data;
  945. }],
  946. /**
  947. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  948. * timeout is not created.
  949. */
  950. timeout: 0,
  951. xsrfCookieName: 'XSRF-TOKEN',
  952. xsrfHeaderName: 'X-XSRF-TOKEN',
  953. maxContentLength: -1,
  954. validateStatus: function validateStatus(status) {
  955. return status >= 200 && status < 300;
  956. }
  957. };
  958. defaults.headers = {
  959. common: {
  960. 'Accept': 'application/json, text/plain, */*'
  961. }
  962. };
  963. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  964. defaults.headers[method] = {};
  965. });
  966. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  967. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  968. });
  969. module.exports = defaults;
  970. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  971. /***/ }),
  972. /***/ "./node_modules/axios/lib/helpers/bind.js":
  973. /*!************************************************!*\
  974. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  975. \************************************************/
  976. /*! no static exports found */
  977. /***/ (function(module, exports, __webpack_require__) {
  978. "use strict";
  979. module.exports = function bind(fn, thisArg) {
  980. return function wrap() {
  981. var args = new Array(arguments.length);
  982. for (var i = 0; i < args.length; i++) {
  983. args[i] = arguments[i];
  984. }
  985. return fn.apply(thisArg, args);
  986. };
  987. };
  988. /***/ }),
  989. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  990. /*!****************************************************!*\
  991. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  992. \****************************************************/
  993. /*! no static exports found */
  994. /***/ (function(module, exports, __webpack_require__) {
  995. "use strict";
  996. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  997. function encode(val) {
  998. return encodeURIComponent(val).
  999. replace(/%40/gi, '@').
  1000. replace(/%3A/gi, ':').
  1001. replace(/%24/g, '$').
  1002. replace(/%2C/gi, ',').
  1003. replace(/%20/g, '+').
  1004. replace(/%5B/gi, '[').
  1005. replace(/%5D/gi, ']');
  1006. }
  1007. /**
  1008. * Build a URL by appending params to the end
  1009. *
  1010. * @param {string} url The base of the url (e.g., http://www.google.com)
  1011. * @param {object} [params] The params to be appended
  1012. * @returns {string} The formatted url
  1013. */
  1014. module.exports = function buildURL(url, params, paramsSerializer) {
  1015. /*eslint no-param-reassign:0*/
  1016. if (!params) {
  1017. return url;
  1018. }
  1019. var serializedParams;
  1020. if (paramsSerializer) {
  1021. serializedParams = paramsSerializer(params);
  1022. } else if (utils.isURLSearchParams(params)) {
  1023. serializedParams = params.toString();
  1024. } else {
  1025. var parts = [];
  1026. utils.forEach(params, function serialize(val, key) {
  1027. if (val === null || typeof val === 'undefined') {
  1028. return;
  1029. }
  1030. if (utils.isArray(val)) {
  1031. key = key + '[]';
  1032. } else {
  1033. val = [val];
  1034. }
  1035. utils.forEach(val, function parseValue(v) {
  1036. if (utils.isDate(v)) {
  1037. v = v.toISOString();
  1038. } else if (utils.isObject(v)) {
  1039. v = JSON.stringify(v);
  1040. }
  1041. parts.push(encode(key) + '=' + encode(v));
  1042. });
  1043. });
  1044. serializedParams = parts.join('&');
  1045. }
  1046. if (serializedParams) {
  1047. var hashmarkIndex = url.indexOf('#');
  1048. if (hashmarkIndex !== -1) {
  1049. url = url.slice(0, hashmarkIndex);
  1050. }
  1051. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  1052. }
  1053. return url;
  1054. };
  1055. /***/ }),
  1056. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  1057. /*!*******************************************************!*\
  1058. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  1059. \*******************************************************/
  1060. /*! no static exports found */
  1061. /***/ (function(module, exports, __webpack_require__) {
  1062. "use strict";
  1063. /**
  1064. * Creates a new URL by combining the specified URLs
  1065. *
  1066. * @param {string} baseURL The base URL
  1067. * @param {string} relativeURL The relative URL
  1068. * @returns {string} The combined URL
  1069. */
  1070. module.exports = function combineURLs(baseURL, relativeURL) {
  1071. return relativeURL
  1072. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1073. : baseURL;
  1074. };
  1075. /***/ }),
  1076. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  1077. /*!***************************************************!*\
  1078. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  1079. \***************************************************/
  1080. /*! no static exports found */
  1081. /***/ (function(module, exports, __webpack_require__) {
  1082. "use strict";
  1083. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1084. module.exports = (
  1085. utils.isStandardBrowserEnv() ?
  1086. // Standard browser envs support document.cookie
  1087. (function standardBrowserEnv() {
  1088. return {
  1089. write: function write(name, value, expires, path, domain, secure) {
  1090. var cookie = [];
  1091. cookie.push(name + '=' + encodeURIComponent(value));
  1092. if (utils.isNumber(expires)) {
  1093. cookie.push('expires=' + new Date(expires).toGMTString());
  1094. }
  1095. if (utils.isString(path)) {
  1096. cookie.push('path=' + path);
  1097. }
  1098. if (utils.isString(domain)) {
  1099. cookie.push('domain=' + domain);
  1100. }
  1101. if (secure === true) {
  1102. cookie.push('secure');
  1103. }
  1104. document.cookie = cookie.join('; ');
  1105. },
  1106. read: function read(name) {
  1107. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1108. return (match ? decodeURIComponent(match[3]) : null);
  1109. },
  1110. remove: function remove(name) {
  1111. this.write(name, '', Date.now() - 86400000);
  1112. }
  1113. };
  1114. })() :
  1115. // Non standard browser env (web workers, react-native) lack needed support.
  1116. (function nonStandardBrowserEnv() {
  1117. return {
  1118. write: function write() {},
  1119. read: function read() { return null; },
  1120. remove: function remove() {}
  1121. };
  1122. })()
  1123. );
  1124. /***/ }),
  1125. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1126. /*!*********************************************************!*\
  1127. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1128. \*********************************************************/
  1129. /*! no static exports found */
  1130. /***/ (function(module, exports, __webpack_require__) {
  1131. "use strict";
  1132. /**
  1133. * Determines whether the specified URL is absolute
  1134. *
  1135. * @param {string} url The URL to test
  1136. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1137. */
  1138. module.exports = function isAbsoluteURL(url) {
  1139. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1140. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1141. // by any combination of letters, digits, plus, period, or hyphen.
  1142. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1143. };
  1144. /***/ }),
  1145. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1146. /*!***********************************************************!*\
  1147. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1148. \***********************************************************/
  1149. /*! no static exports found */
  1150. /***/ (function(module, exports, __webpack_require__) {
  1151. "use strict";
  1152. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1153. module.exports = (
  1154. utils.isStandardBrowserEnv() ?
  1155. // Standard browser envs have full support of the APIs needed to test
  1156. // whether the request URL is of the same origin as current location.
  1157. (function standardBrowserEnv() {
  1158. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1159. var urlParsingNode = document.createElement('a');
  1160. var originURL;
  1161. /**
  1162. * Parse a URL to discover it's components
  1163. *
  1164. * @param {String} url The URL to be parsed
  1165. * @returns {Object}
  1166. */
  1167. function resolveURL(url) {
  1168. var href = url;
  1169. if (msie) {
  1170. // IE needs attribute set twice to normalize properties
  1171. urlParsingNode.setAttribute('href', href);
  1172. href = urlParsingNode.href;
  1173. }
  1174. urlParsingNode.setAttribute('href', href);
  1175. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1176. return {
  1177. href: urlParsingNode.href,
  1178. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1179. host: urlParsingNode.host,
  1180. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1181. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1182. hostname: urlParsingNode.hostname,
  1183. port: urlParsingNode.port,
  1184. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1185. urlParsingNode.pathname :
  1186. '/' + urlParsingNode.pathname
  1187. };
  1188. }
  1189. originURL = resolveURL(window.location.href);
  1190. /**
  1191. * Determine if a URL shares the same origin as the current location
  1192. *
  1193. * @param {String} requestURL The URL to test
  1194. * @returns {boolean} True if URL shares the same origin, otherwise false
  1195. */
  1196. return function isURLSameOrigin(requestURL) {
  1197. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1198. return (parsed.protocol === originURL.protocol &&
  1199. parsed.host === originURL.host);
  1200. };
  1201. })() :
  1202. // Non standard browser envs (web workers, react-native) lack needed support.
  1203. (function nonStandardBrowserEnv() {
  1204. return function isURLSameOrigin() {
  1205. return true;
  1206. };
  1207. })()
  1208. );
  1209. /***/ }),
  1210. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1211. /*!***************************************************************!*\
  1212. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1213. \***************************************************************/
  1214. /*! no static exports found */
  1215. /***/ (function(module, exports, __webpack_require__) {
  1216. "use strict";
  1217. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1218. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1219. utils.forEach(headers, function processHeader(value, name) {
  1220. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1221. headers[normalizedName] = value;
  1222. delete headers[name];
  1223. }
  1224. });
  1225. };
  1226. /***/ }),
  1227. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1228. /*!********************************************************!*\
  1229. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1230. \********************************************************/
  1231. /*! no static exports found */
  1232. /***/ (function(module, exports, __webpack_require__) {
  1233. "use strict";
  1234. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1235. // Headers whose duplicates are ignored by node
  1236. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1237. var ignoreDuplicateOf = [
  1238. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1239. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1240. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1241. 'referer', 'retry-after', 'user-agent'
  1242. ];
  1243. /**
  1244. * Parse headers into an object
  1245. *
  1246. * ```
  1247. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1248. * Content-Type: application/json
  1249. * Connection: keep-alive
  1250. * Transfer-Encoding: chunked
  1251. * ```
  1252. *
  1253. * @param {String} headers Headers needing to be parsed
  1254. * @returns {Object} Headers parsed into an object
  1255. */
  1256. module.exports = function parseHeaders(headers) {
  1257. var parsed = {};
  1258. var key;
  1259. var val;
  1260. var i;
  1261. if (!headers) { return parsed; }
  1262. utils.forEach(headers.split('\n'), function parser(line) {
  1263. i = line.indexOf(':');
  1264. key = utils.trim(line.substr(0, i)).toLowerCase();
  1265. val = utils.trim(line.substr(i + 1));
  1266. if (key) {
  1267. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1268. return;
  1269. }
  1270. if (key === 'set-cookie') {
  1271. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1272. } else {
  1273. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1274. }
  1275. }
  1276. });
  1277. return parsed;
  1278. };
  1279. /***/ }),
  1280. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1281. /*!**************************************************!*\
  1282. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1283. \**************************************************/
  1284. /*! no static exports found */
  1285. /***/ (function(module, exports, __webpack_require__) {
  1286. "use strict";
  1287. /**
  1288. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1289. *
  1290. * Common use case would be to use `Function.prototype.apply`.
  1291. *
  1292. * ```js
  1293. * function f(x, y, z) {}
  1294. * var args = [1, 2, 3];
  1295. * f.apply(null, args);
  1296. * ```
  1297. *
  1298. * With `spread` this example can be re-written.
  1299. *
  1300. * ```js
  1301. * spread(function(x, y, z) {})([1, 2, 3]);
  1302. * ```
  1303. *
  1304. * @param {Function} callback
  1305. * @returns {Function}
  1306. */
  1307. module.exports = function spread(callback) {
  1308. return function wrap(arr) {
  1309. return callback.apply(null, arr);
  1310. };
  1311. };
  1312. /***/ }),
  1313. /***/ "./node_modules/axios/lib/utils.js":
  1314. /*!*****************************************!*\
  1315. !*** ./node_modules/axios/lib/utils.js ***!
  1316. \*****************************************/
  1317. /*! no static exports found */
  1318. /***/ (function(module, exports, __webpack_require__) {
  1319. "use strict";
  1320. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1321. /*global toString:true*/
  1322. // utils is a library of generic helper functions non-specific to axios
  1323. var toString = Object.prototype.toString;
  1324. /**
  1325. * Determine if a value is an Array
  1326. *
  1327. * @param {Object} val The value to test
  1328. * @returns {boolean} True if value is an Array, otherwise false
  1329. */
  1330. function isArray(val) {
  1331. return toString.call(val) === '[object Array]';
  1332. }
  1333. /**
  1334. * Determine if a value is undefined
  1335. *
  1336. * @param {Object} val The value to test
  1337. * @returns {boolean} True if the value is undefined, otherwise false
  1338. */
  1339. function isUndefined(val) {
  1340. return typeof val === 'undefined';
  1341. }
  1342. /**
  1343. * Determine if a value is a Buffer
  1344. *
  1345. * @param {Object} val The value to test
  1346. * @returns {boolean} True if value is a Buffer, otherwise false
  1347. */
  1348. function isBuffer(val) {
  1349. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  1350. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  1351. }
  1352. /**
  1353. * Determine if a value is an ArrayBuffer
  1354. *
  1355. * @param {Object} val The value to test
  1356. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1357. */
  1358. function isArrayBuffer(val) {
  1359. return toString.call(val) === '[object ArrayBuffer]';
  1360. }
  1361. /**
  1362. * Determine if a value is a FormData
  1363. *
  1364. * @param {Object} val The value to test
  1365. * @returns {boolean} True if value is an FormData, otherwise false
  1366. */
  1367. function isFormData(val) {
  1368. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1369. }
  1370. /**
  1371. * Determine if a value is a view on an ArrayBuffer
  1372. *
  1373. * @param {Object} val The value to test
  1374. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1375. */
  1376. function isArrayBufferView(val) {
  1377. var result;
  1378. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1379. result = ArrayBuffer.isView(val);
  1380. } else {
  1381. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1382. }
  1383. return result;
  1384. }
  1385. /**
  1386. * Determine if a value is a String
  1387. *
  1388. * @param {Object} val The value to test
  1389. * @returns {boolean} True if value is a String, otherwise false
  1390. */
  1391. function isString(val) {
  1392. return typeof val === 'string';
  1393. }
  1394. /**
  1395. * Determine if a value is a Number
  1396. *
  1397. * @param {Object} val The value to test
  1398. * @returns {boolean} True if value is a Number, otherwise false
  1399. */
  1400. function isNumber(val) {
  1401. return typeof val === 'number';
  1402. }
  1403. /**
  1404. * Determine if a value is an Object
  1405. *
  1406. * @param {Object} val The value to test
  1407. * @returns {boolean} True if value is an Object, otherwise false
  1408. */
  1409. function isObject(val) {
  1410. return val !== null && typeof val === 'object';
  1411. }
  1412. /**
  1413. * Determine if a value is a Date
  1414. *
  1415. * @param {Object} val The value to test
  1416. * @returns {boolean} True if value is a Date, otherwise false
  1417. */
  1418. function isDate(val) {
  1419. return toString.call(val) === '[object Date]';
  1420. }
  1421. /**
  1422. * Determine if a value is a File
  1423. *
  1424. * @param {Object} val The value to test
  1425. * @returns {boolean} True if value is a File, otherwise false
  1426. */
  1427. function isFile(val) {
  1428. return toString.call(val) === '[object File]';
  1429. }
  1430. /**
  1431. * Determine if a value is a Blob
  1432. *
  1433. * @param {Object} val The value to test
  1434. * @returns {boolean} True if value is a Blob, otherwise false
  1435. */
  1436. function isBlob(val) {
  1437. return toString.call(val) === '[object Blob]';
  1438. }
  1439. /**
  1440. * Determine if a value is a Function
  1441. *
  1442. * @param {Object} val The value to test
  1443. * @returns {boolean} True if value is a Function, otherwise false
  1444. */
  1445. function isFunction(val) {
  1446. return toString.call(val) === '[object Function]';
  1447. }
  1448. /**
  1449. * Determine if a value is a Stream
  1450. *
  1451. * @param {Object} val The value to test
  1452. * @returns {boolean} True if value is a Stream, otherwise false
  1453. */
  1454. function isStream(val) {
  1455. return isObject(val) && isFunction(val.pipe);
  1456. }
  1457. /**
  1458. * Determine if a value is a URLSearchParams object
  1459. *
  1460. * @param {Object} val The value to test
  1461. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1462. */
  1463. function isURLSearchParams(val) {
  1464. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1465. }
  1466. /**
  1467. * Trim excess whitespace off the beginning and end of a string
  1468. *
  1469. * @param {String} str The String to trim
  1470. * @returns {String} The String freed of excess whitespace
  1471. */
  1472. function trim(str) {
  1473. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1474. }
  1475. /**
  1476. * Determine if we're running in a standard browser environment
  1477. *
  1478. * This allows axios to run in a web worker, and react-native.
  1479. * Both environments support XMLHttpRequest, but not fully standard globals.
  1480. *
  1481. * web workers:
  1482. * typeof window -> undefined
  1483. * typeof document -> undefined
  1484. *
  1485. * react-native:
  1486. * navigator.product -> 'ReactNative'
  1487. * nativescript
  1488. * navigator.product -> 'NativeScript' or 'NS'
  1489. */
  1490. function isStandardBrowserEnv() {
  1491. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1492. navigator.product === 'NativeScript' ||
  1493. navigator.product === 'NS')) {
  1494. return false;
  1495. }
  1496. return (
  1497. typeof window !== 'undefined' &&
  1498. typeof document !== 'undefined'
  1499. );
  1500. }
  1501. /**
  1502. * Iterate over an Array or an Object invoking a function for each item.
  1503. *
  1504. * If `obj` is an Array callback will be called passing
  1505. * the value, index, and complete array for each item.
  1506. *
  1507. * If 'obj' is an Object callback will be called passing
  1508. * the value, key, and complete object for each property.
  1509. *
  1510. * @param {Object|Array} obj The object to iterate
  1511. * @param {Function} fn The callback to invoke for each item
  1512. */
  1513. function forEach(obj, fn) {
  1514. // Don't bother if no value provided
  1515. if (obj === null || typeof obj === 'undefined') {
  1516. return;
  1517. }
  1518. // Force an array if not already something iterable
  1519. if (typeof obj !== 'object') {
  1520. /*eslint no-param-reassign:0*/
  1521. obj = [obj];
  1522. }
  1523. if (isArray(obj)) {
  1524. // Iterate over array values
  1525. for (var i = 0, l = obj.length; i < l; i++) {
  1526. fn.call(null, obj[i], i, obj);
  1527. }
  1528. } else {
  1529. // Iterate over object keys
  1530. for (var key in obj) {
  1531. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1532. fn.call(null, obj[key], key, obj);
  1533. }
  1534. }
  1535. }
  1536. }
  1537. /**
  1538. * Accepts varargs expecting each argument to be an object, then
  1539. * immutably merges the properties of each object and returns result.
  1540. *
  1541. * When multiple objects contain the same key the later object in
  1542. * the arguments list will take precedence.
  1543. *
  1544. * Example:
  1545. *
  1546. * ```js
  1547. * var result = merge({foo: 123}, {foo: 456});
  1548. * console.log(result.foo); // outputs 456
  1549. * ```
  1550. *
  1551. * @param {Object} obj1 Object to merge
  1552. * @returns {Object} Result of all merge properties
  1553. */
  1554. function merge(/* obj1, obj2, obj3, ... */) {
  1555. var result = {};
  1556. function assignValue(val, key) {
  1557. if (typeof result[key] === 'object' && typeof val === 'object') {
  1558. result[key] = merge(result[key], val);
  1559. } else {
  1560. result[key] = val;
  1561. }
  1562. }
  1563. for (var i = 0, l = arguments.length; i < l; i++) {
  1564. forEach(arguments[i], assignValue);
  1565. }
  1566. return result;
  1567. }
  1568. /**
  1569. * Function equal to merge with the difference being that no reference
  1570. * to original objects is kept.
  1571. *
  1572. * @see merge
  1573. * @param {Object} obj1 Object to merge
  1574. * @returns {Object} Result of all merge properties
  1575. */
  1576. function deepMerge(/* obj1, obj2, obj3, ... */) {
  1577. var result = {};
  1578. function assignValue(val, key) {
  1579. if (typeof result[key] === 'object' && typeof val === 'object') {
  1580. result[key] = deepMerge(result[key], val);
  1581. } else if (typeof val === 'object') {
  1582. result[key] = deepMerge({}, val);
  1583. } else {
  1584. result[key] = val;
  1585. }
  1586. }
  1587. for (var i = 0, l = arguments.length; i < l; i++) {
  1588. forEach(arguments[i], assignValue);
  1589. }
  1590. return result;
  1591. }
  1592. /**
  1593. * Extends object a by mutably adding to it the properties of object b.
  1594. *
  1595. * @param {Object} a The object to be extended
  1596. * @param {Object} b The object to copy properties from
  1597. * @param {Object} thisArg The object to bind function to
  1598. * @return {Object} The resulting value of object a
  1599. */
  1600. function extend(a, b, thisArg) {
  1601. forEach(b, function assignValue(val, key) {
  1602. if (thisArg && typeof val === 'function') {
  1603. a[key] = bind(val, thisArg);
  1604. } else {
  1605. a[key] = val;
  1606. }
  1607. });
  1608. return a;
  1609. }
  1610. module.exports = {
  1611. isArray: isArray,
  1612. isArrayBuffer: isArrayBuffer,
  1613. isBuffer: isBuffer,
  1614. isFormData: isFormData,
  1615. isArrayBufferView: isArrayBufferView,
  1616. isString: isString,
  1617. isNumber: isNumber,
  1618. isObject: isObject,
  1619. isUndefined: isUndefined,
  1620. isDate: isDate,
  1621. isFile: isFile,
  1622. isBlob: isBlob,
  1623. isFunction: isFunction,
  1624. isStream: isStream,
  1625. isURLSearchParams: isURLSearchParams,
  1626. isStandardBrowserEnv: isStandardBrowserEnv,
  1627. forEach: forEach,
  1628. merge: merge,
  1629. deepMerge: deepMerge,
  1630. extend: extend,
  1631. trim: trim
  1632. };
  1633. /***/ }),
  1634. /***/ "./node_modules/backo2/index.js":
  1635. /*!**************************************!*\
  1636. !*** ./node_modules/backo2/index.js ***!
  1637. \**************************************/
  1638. /*! no static exports found */
  1639. /***/ (function(module, exports) {
  1640. /**
  1641. * Expose `Backoff`.
  1642. */
  1643. module.exports = Backoff;
  1644. /**
  1645. * Initialize backoff timer with `opts`.
  1646. *
  1647. * - `min` initial timeout in milliseconds [100]
  1648. * - `max` max timeout [10000]
  1649. * - `jitter` [0]
  1650. * - `factor` [2]
  1651. *
  1652. * @param {Object} opts
  1653. * @api public
  1654. */
  1655. function Backoff(opts) {
  1656. opts = opts || {};
  1657. this.ms = opts.min || 100;
  1658. this.max = opts.max || 10000;
  1659. this.factor = opts.factor || 2;
  1660. this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;
  1661. this.attempts = 0;
  1662. }
  1663. /**
  1664. * Return the backoff duration.
  1665. *
  1666. * @return {Number}
  1667. * @api public
  1668. */
  1669. Backoff.prototype.duration = function(){
  1670. var ms = this.ms * Math.pow(this.factor, this.attempts++);
  1671. if (this.jitter) {
  1672. var rand = Math.random();
  1673. var deviation = Math.floor(rand * this.jitter * ms);
  1674. ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;
  1675. }
  1676. return Math.min(ms, this.max) | 0;
  1677. };
  1678. /**
  1679. * Reset the number of attempts.
  1680. *
  1681. * @api public
  1682. */
  1683. Backoff.prototype.reset = function(){
  1684. this.attempts = 0;
  1685. };
  1686. /**
  1687. * Set the minimum duration
  1688. *
  1689. * @api public
  1690. */
  1691. Backoff.prototype.setMin = function(min){
  1692. this.ms = min;
  1693. };
  1694. /**
  1695. * Set the maximum duration
  1696. *
  1697. * @api public
  1698. */
  1699. Backoff.prototype.setMax = function(max){
  1700. this.max = max;
  1701. };
  1702. /**
  1703. * Set the jitter
  1704. *
  1705. * @api public
  1706. */
  1707. Backoff.prototype.setJitter = function(jitter){
  1708. this.jitter = jitter;
  1709. };
  1710. /***/ }),
  1711. /***/ "./node_modules/base64-arraybuffer/lib/base64-arraybuffer.js":
  1712. /*!*******************************************************************!*\
  1713. !*** ./node_modules/base64-arraybuffer/lib/base64-arraybuffer.js ***!
  1714. \*******************************************************************/
  1715. /*! no static exports found */
  1716. /***/ (function(module, exports) {
  1717. /*
  1718. * base64-arraybuffer
  1719. * https://github.com/niklasvh/base64-arraybuffer
  1720. *
  1721. * Copyright (c) 2012 Niklas von Hertzen
  1722. * Licensed under the MIT license.
  1723. */
  1724. (function(){
  1725. "use strict";
  1726. var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  1727. // Use a lookup table to find the index.
  1728. var lookup = new Uint8Array(256);
  1729. for (var i = 0; i < chars.length; i++) {
  1730. lookup[chars.charCodeAt(i)] = i;
  1731. }
  1732. exports.encode = function(arraybuffer) {
  1733. var bytes = new Uint8Array(arraybuffer),
  1734. i, len = bytes.length, base64 = "";
  1735. for (i = 0; i < len; i+=3) {
  1736. base64 += chars[bytes[i] >> 2];
  1737. base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
  1738. base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
  1739. base64 += chars[bytes[i + 2] & 63];
  1740. }
  1741. if ((len % 3) === 2) {
  1742. base64 = base64.substring(0, base64.length - 1) + "=";
  1743. } else if (len % 3 === 1) {
  1744. base64 = base64.substring(0, base64.length - 2) + "==";
  1745. }
  1746. return base64;
  1747. };
  1748. exports.decode = function(base64) {
  1749. var bufferLength = base64.length * 0.75,
  1750. len = base64.length, i, p = 0,
  1751. encoded1, encoded2, encoded3, encoded4;
  1752. if (base64[base64.length - 1] === "=") {
  1753. bufferLength--;
  1754. if (base64[base64.length - 2] === "=") {
  1755. bufferLength--;
  1756. }
  1757. }
  1758. var arraybuffer = new ArrayBuffer(bufferLength),
  1759. bytes = new Uint8Array(arraybuffer);
  1760. for (i = 0; i < len; i+=4) {
  1761. encoded1 = lookup[base64.charCodeAt(i)];
  1762. encoded2 = lookup[base64.charCodeAt(i+1)];
  1763. encoded3 = lookup[base64.charCodeAt(i+2)];
  1764. encoded4 = lookup[base64.charCodeAt(i+3)];
  1765. bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
  1766. bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
  1767. bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
  1768. }
  1769. return arraybuffer;
  1770. };
  1771. })();
  1772. /***/ }),
  1773. /***/ "./node_modules/base64-js/index.js":
  1774. /*!*****************************************!*\
  1775. !*** ./node_modules/base64-js/index.js ***!
  1776. \*****************************************/
  1777. /*! no static exports found */
  1778. /***/ (function(module, exports, __webpack_require__) {
  1779. "use strict";
  1780. exports.byteLength = byteLength
  1781. exports.toByteArray = toByteArray
  1782. exports.fromByteArray = fromByteArray
  1783. var lookup = []
  1784. var revLookup = []
  1785. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  1786. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  1787. for (var i = 0, len = code.length; i < len; ++i) {
  1788. lookup[i] = code[i]
  1789. revLookup[code.charCodeAt(i)] = i
  1790. }
  1791. // Support decoding URL-safe base64 strings, as Node.js does.
  1792. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  1793. revLookup['-'.charCodeAt(0)] = 62
  1794. revLookup['_'.charCodeAt(0)] = 63
  1795. function getLens (b64) {
  1796. var len = b64.length
  1797. if (len % 4 > 0) {
  1798. throw new Error('Invalid string. Length must be a multiple of 4')
  1799. }
  1800. // Trim off extra bytes after placeholder bytes are found
  1801. // See: https://github.com/beatgammit/base64-js/issues/42
  1802. var validLen = b64.indexOf('=')
  1803. if (validLen === -1) validLen = len
  1804. var placeHoldersLen = validLen === len
  1805. ? 0
  1806. : 4 - (validLen % 4)
  1807. return [validLen, placeHoldersLen]
  1808. }
  1809. // base64 is 4/3 + up to two characters of the original data
  1810. function byteLength (b64) {
  1811. var lens = getLens(b64)
  1812. var validLen = lens[0]
  1813. var placeHoldersLen = lens[1]
  1814. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  1815. }
  1816. function _byteLength (b64, validLen, placeHoldersLen) {
  1817. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  1818. }
  1819. function toByteArray (b64) {
  1820. var tmp
  1821. var lens = getLens(b64)
  1822. var validLen = lens[0]
  1823. var placeHoldersLen = lens[1]
  1824. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  1825. var curByte = 0
  1826. // if there are placeholders, only get up to the last complete 4 chars
  1827. var len = placeHoldersLen > 0
  1828. ? validLen - 4
  1829. : validLen
  1830. var i
  1831. for (i = 0; i < len; i += 4) {
  1832. tmp =
  1833. (revLookup[b64.charCodeAt(i)] << 18) |
  1834. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  1835. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  1836. revLookup[b64.charCodeAt(i + 3)]
  1837. arr[curByte++] = (tmp >> 16) & 0xFF
  1838. arr[curByte++] = (tmp >> 8) & 0xFF
  1839. arr[curByte++] = tmp & 0xFF
  1840. }
  1841. if (placeHoldersLen === 2) {
  1842. tmp =
  1843. (revLookup[b64.charCodeAt(i)] << 2) |
  1844. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  1845. arr[curByte++] = tmp & 0xFF
  1846. }
  1847. if (placeHoldersLen === 1) {
  1848. tmp =
  1849. (revLookup[b64.charCodeAt(i)] << 10) |
  1850. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  1851. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  1852. arr[curByte++] = (tmp >> 8) & 0xFF
  1853. arr[curByte++] = tmp & 0xFF
  1854. }
  1855. return arr
  1856. }
  1857. function tripletToBase64 (num) {
  1858. return lookup[num >> 18 & 0x3F] +
  1859. lookup[num >> 12 & 0x3F] +
  1860. lookup[num >> 6 & 0x3F] +
  1861. lookup[num & 0x3F]
  1862. }
  1863. function encodeChunk (uint8, start, end) {
  1864. var tmp
  1865. var output = []
  1866. for (var i = start; i < end; i += 3) {
  1867. tmp =
  1868. ((uint8[i] << 16) & 0xFF0000) +
  1869. ((uint8[i + 1] << 8) & 0xFF00) +
  1870. (uint8[i + 2] & 0xFF)
  1871. output.push(tripletToBase64(tmp))
  1872. }
  1873. return output.join('')
  1874. }
  1875. function fromByteArray (uint8) {
  1876. var tmp
  1877. var len = uint8.length
  1878. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  1879. var parts = []
  1880. var maxChunkLength = 16383 // must be multiple of 3
  1881. // go through the array every three bytes, we'll deal with trailing stuff later
  1882. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  1883. parts.push(encodeChunk(
  1884. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  1885. ))
  1886. }
  1887. // pad the end with zeros, but make sure to not forget the extra bytes
  1888. if (extraBytes === 1) {
  1889. tmp = uint8[len - 1]
  1890. parts.push(
  1891. lookup[tmp >> 2] +
  1892. lookup[(tmp << 4) & 0x3F] +
  1893. '=='
  1894. )
  1895. } else if (extraBytes === 2) {
  1896. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  1897. parts.push(
  1898. lookup[tmp >> 10] +
  1899. lookup[(tmp >> 4) & 0x3F] +
  1900. lookup[(tmp << 2) & 0x3F] +
  1901. '='
  1902. )
  1903. }
  1904. return parts.join('')
  1905. }
  1906. /***/ }),
  1907. /***/ "./node_modules/blob/index.js":
  1908. /*!************************************!*\
  1909. !*** ./node_modules/blob/index.js ***!
  1910. \************************************/
  1911. /*! no static exports found */
  1912. /***/ (function(module, exports) {
  1913. /**
  1914. * Create a blob builder even when vendor prefixes exist
  1915. */
  1916. var BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder :
  1917. typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder :
  1918. typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder :
  1919. typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder :
  1920. false;
  1921. /**
  1922. * Check if Blob constructor is supported
  1923. */
  1924. var blobSupported = (function() {
  1925. try {
  1926. var a = new Blob(['hi']);
  1927. return a.size === 2;
  1928. } catch(e) {
  1929. return false;
  1930. }
  1931. })();
  1932. /**
  1933. * Check if Blob constructor supports ArrayBufferViews
  1934. * Fails in Safari 6, so we need to map to ArrayBuffers there.
  1935. */
  1936. var blobSupportsArrayBufferView = blobSupported && (function() {
  1937. try {
  1938. var b = new Blob([new Uint8Array([1,2])]);
  1939. return b.size === 2;
  1940. } catch(e) {
  1941. return false;
  1942. }
  1943. })();
  1944. /**
  1945. * Check if BlobBuilder is supported
  1946. */
  1947. var blobBuilderSupported = BlobBuilder
  1948. && BlobBuilder.prototype.append
  1949. && BlobBuilder.prototype.getBlob;
  1950. /**
  1951. * Helper function that maps ArrayBufferViews to ArrayBuffers
  1952. * Used by BlobBuilder constructor and old browsers that didn't
  1953. * support it in the Blob constructor.
  1954. */
  1955. function mapArrayBufferViews(ary) {
  1956. return ary.map(function(chunk) {
  1957. if (chunk.buffer instanceof ArrayBuffer) {
  1958. var buf = chunk.buffer;
  1959. // if this is a subarray, make a copy so we only
  1960. // include the subarray region from the underlying buffer
  1961. if (chunk.byteLength !== buf.byteLength) {
  1962. var copy = new Uint8Array(chunk.byteLength);
  1963. copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength));
  1964. buf = copy.buffer;
  1965. }
  1966. return buf;
  1967. }
  1968. return chunk;
  1969. });
  1970. }
  1971. function BlobBuilderConstructor(ary, options) {
  1972. options = options || {};
  1973. var bb = new BlobBuilder();
  1974. mapArrayBufferViews(ary).forEach(function(part) {
  1975. bb.append(part);
  1976. });
  1977. return (options.type) ? bb.getBlob(options.type) : bb.getBlob();
  1978. };
  1979. function BlobConstructor(ary, options) {
  1980. return new Blob(mapArrayBufferViews(ary), options || {});
  1981. };
  1982. if (typeof Blob !== 'undefined') {
  1983. BlobBuilderConstructor.prototype = Blob.prototype;
  1984. BlobConstructor.prototype = Blob.prototype;
  1985. }
  1986. module.exports = (function() {
  1987. if (blobSupported) {
  1988. return blobSupportsArrayBufferView ? Blob : BlobConstructor;
  1989. } else if (blobBuilderSupported) {
  1990. return BlobBuilderConstructor;
  1991. } else {
  1992. return undefined;
  1993. }
  1994. })();
  1995. /***/ }),
  1996. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  1997. /*!*****************************************************!*\
  1998. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  1999. \*****************************************************/
  2000. /*! no static exports found */
  2001. /***/ (function(module, exports, __webpack_require__) {
  2002. /*!
  2003. * Bootstrap v4.5.0 (https://getbootstrap.com/)
  2004. * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2005. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2006. */
  2007. (function (global, factory) {
  2008. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2009. undefined;
  2010. }(this, (function (exports, $, Popper) { 'use strict';
  2011. $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $;
  2012. Popper = Popper && Object.prototype.hasOwnProperty.call(Popper, 'default') ? Popper['default'] : Popper;
  2013. function _defineProperties(target, props) {
  2014. for (var i = 0; i < props.length; i++) {
  2015. var descriptor = props[i];
  2016. descriptor.enumerable = descriptor.enumerable || false;
  2017. descriptor.configurable = true;
  2018. if ("value" in descriptor) descriptor.writable = true;
  2019. Object.defineProperty(target, descriptor.key, descriptor);
  2020. }
  2021. }
  2022. function _createClass(Constructor, protoProps, staticProps) {
  2023. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2024. if (staticProps) _defineProperties(Constructor, staticProps);
  2025. return Constructor;
  2026. }
  2027. function _defineProperty(obj, key, value) {
  2028. if (key in obj) {
  2029. Object.defineProperty(obj, key, {
  2030. value: value,
  2031. enumerable: true,
  2032. configurable: true,
  2033. writable: true
  2034. });
  2035. } else {
  2036. obj[key] = value;
  2037. }
  2038. return obj;
  2039. }
  2040. function ownKeys(object, enumerableOnly) {
  2041. var keys = Object.keys(object);
  2042. if (Object.getOwnPropertySymbols) {
  2043. var symbols = Object.getOwnPropertySymbols(object);
  2044. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2045. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2046. });
  2047. keys.push.apply(keys, symbols);
  2048. }
  2049. return keys;
  2050. }
  2051. function _objectSpread2(target) {
  2052. for (var i = 1; i < arguments.length; i++) {
  2053. var source = arguments[i] != null ? arguments[i] : {};
  2054. if (i % 2) {
  2055. ownKeys(Object(source), true).forEach(function (key) {
  2056. _defineProperty(target, key, source[key]);
  2057. });
  2058. } else if (Object.getOwnPropertyDescriptors) {
  2059. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2060. } else {
  2061. ownKeys(Object(source)).forEach(function (key) {
  2062. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2063. });
  2064. }
  2065. }
  2066. return target;
  2067. }
  2068. function _inheritsLoose(subClass, superClass) {
  2069. subClass.prototype = Object.create(superClass.prototype);
  2070. subClass.prototype.constructor = subClass;
  2071. subClass.__proto__ = superClass;
  2072. }
  2073. /**
  2074. * --------------------------------------------------------------------------
  2075. * Bootstrap (v4.5.0): util.js
  2076. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2077. * --------------------------------------------------------------------------
  2078. */
  2079. /**
  2080. * ------------------------------------------------------------------------
  2081. * Private TransitionEnd Helpers
  2082. * ------------------------------------------------------------------------
  2083. */
  2084. var TRANSITION_END = 'transitionend';
  2085. var MAX_UID = 1000000;
  2086. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2087. function toType(obj) {
  2088. if (obj === null || typeof obj === 'undefined') {
  2089. return "" + obj;
  2090. }
  2091. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2092. }
  2093. function getSpecialTransitionEndEvent() {
  2094. return {
  2095. bindType: TRANSITION_END,
  2096. delegateType: TRANSITION_END,
  2097. handle: function handle(event) {
  2098. if ($(event.target).is(this)) {
  2099. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2100. }
  2101. return undefined;
  2102. }
  2103. };
  2104. }
  2105. function transitionEndEmulator(duration) {
  2106. var _this = this;
  2107. var called = false;
  2108. $(this).one(Util.TRANSITION_END, function () {
  2109. called = true;
  2110. });
  2111. setTimeout(function () {
  2112. if (!called) {
  2113. Util.triggerTransitionEnd(_this);
  2114. }
  2115. }, duration);
  2116. return this;
  2117. }
  2118. function setTransitionEndSupport() {
  2119. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2120. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2121. }
  2122. /**
  2123. * --------------------------------------------------------------------------
  2124. * Public Util Api
  2125. * --------------------------------------------------------------------------
  2126. */
  2127. var Util = {
  2128. TRANSITION_END: 'bsTransitionEnd',
  2129. getUID: function getUID(prefix) {
  2130. do {
  2131. // eslint-disable-next-line no-bitwise
  2132. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2133. } while (document.getElementById(prefix));
  2134. return prefix;
  2135. },
  2136. getSelectorFromElement: function getSelectorFromElement(element) {
  2137. var selector = element.getAttribute('data-target');
  2138. if (!selector || selector === '#') {
  2139. var hrefAttr = element.getAttribute('href');
  2140. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2141. }
  2142. try {
  2143. return document.querySelector(selector) ? selector : null;
  2144. } catch (err) {
  2145. return null;
  2146. }
  2147. },
  2148. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2149. if (!element) {
  2150. return 0;
  2151. } // Get transition-duration of the element
  2152. var transitionDuration = $(element).css('transition-duration');
  2153. var transitionDelay = $(element).css('transition-delay');
  2154. var floatTransitionDuration = parseFloat(transitionDuration);
  2155. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2156. if (!floatTransitionDuration && !floatTransitionDelay) {
  2157. return 0;
  2158. } // If multiple durations are defined, take the first
  2159. transitionDuration = transitionDuration.split(',')[0];
  2160. transitionDelay = transitionDelay.split(',')[0];
  2161. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2162. },
  2163. reflow: function reflow(element) {
  2164. return element.offsetHeight;
  2165. },
  2166. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2167. $(element).trigger(TRANSITION_END);
  2168. },
  2169. // TODO: Remove in v5
  2170. supportsTransitionEnd: function supportsTransitionEnd() {
  2171. return Boolean(TRANSITION_END);
  2172. },
  2173. isElement: function isElement(obj) {
  2174. return (obj[0] || obj).nodeType;
  2175. },
  2176. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2177. for (var property in configTypes) {
  2178. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2179. var expectedTypes = configTypes[property];
  2180. var value = config[property];
  2181. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2182. if (!new RegExp(expectedTypes).test(valueType)) {
  2183. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2184. }
  2185. }
  2186. }
  2187. },
  2188. findShadowRoot: function findShadowRoot(element) {
  2189. if (!document.documentElement.attachShadow) {
  2190. return null;
  2191. } // Can find the shadow root otherwise it'll return the document
  2192. if (typeof element.getRootNode === 'function') {
  2193. var root = element.getRootNode();
  2194. return root instanceof ShadowRoot ? root : null;
  2195. }
  2196. if (element instanceof ShadowRoot) {
  2197. return element;
  2198. } // when we don't find a shadow root
  2199. if (!element.parentNode) {
  2200. return null;
  2201. }
  2202. return Util.findShadowRoot(element.parentNode);
  2203. },
  2204. jQueryDetection: function jQueryDetection() {
  2205. if (typeof $ === 'undefined') {
  2206. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2207. }
  2208. var version = $.fn.jquery.split(' ')[0].split('.');
  2209. var minMajor = 1;
  2210. var ltMajor = 2;
  2211. var minMinor = 9;
  2212. var minPatch = 1;
  2213. var maxMajor = 4;
  2214. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2215. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2216. }
  2217. }
  2218. };
  2219. Util.jQueryDetection();
  2220. setTransitionEndSupport();
  2221. /**
  2222. * ------------------------------------------------------------------------
  2223. * Constants
  2224. * ------------------------------------------------------------------------
  2225. */
  2226. var NAME = 'alert';
  2227. var VERSION = '4.5.0';
  2228. var DATA_KEY = 'bs.alert';
  2229. var EVENT_KEY = "." + DATA_KEY;
  2230. var DATA_API_KEY = '.data-api';
  2231. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2232. var SELECTOR_DISMISS = '[data-dismiss="alert"]';
  2233. var EVENT_CLOSE = "close" + EVENT_KEY;
  2234. var EVENT_CLOSED = "closed" + EVENT_KEY;
  2235. var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
  2236. var CLASS_NAME_ALERT = 'alert';
  2237. var CLASS_NAME_FADE = 'fade';
  2238. var CLASS_NAME_SHOW = 'show';
  2239. /**
  2240. * ------------------------------------------------------------------------
  2241. * Class Definition
  2242. * ------------------------------------------------------------------------
  2243. */
  2244. var Alert = /*#__PURE__*/function () {
  2245. function Alert(element) {
  2246. this._element = element;
  2247. } // Getters
  2248. var _proto = Alert.prototype;
  2249. // Public
  2250. _proto.close = function close(element) {
  2251. var rootElement = this._element;
  2252. if (element) {
  2253. rootElement = this._getRootElement(element);
  2254. }
  2255. var customEvent = this._triggerCloseEvent(rootElement);
  2256. if (customEvent.isDefaultPrevented()) {
  2257. return;
  2258. }
  2259. this._removeElement(rootElement);
  2260. };
  2261. _proto.dispose = function dispose() {
  2262. $.removeData(this._element, DATA_KEY);
  2263. this._element = null;
  2264. } // Private
  2265. ;
  2266. _proto._getRootElement = function _getRootElement(element) {
  2267. var selector = Util.getSelectorFromElement(element);
  2268. var parent = false;
  2269. if (selector) {
  2270. parent = document.querySelector(selector);
  2271. }
  2272. if (!parent) {
  2273. parent = $(element).closest("." + CLASS_NAME_ALERT)[0];
  2274. }
  2275. return parent;
  2276. };
  2277. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2278. var closeEvent = $.Event(EVENT_CLOSE);
  2279. $(element).trigger(closeEvent);
  2280. return closeEvent;
  2281. };
  2282. _proto._removeElement = function _removeElement(element) {
  2283. var _this = this;
  2284. $(element).removeClass(CLASS_NAME_SHOW);
  2285. if (!$(element).hasClass(CLASS_NAME_FADE)) {
  2286. this._destroyElement(element);
  2287. return;
  2288. }
  2289. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2290. $(element).one(Util.TRANSITION_END, function (event) {
  2291. return _this._destroyElement(element, event);
  2292. }).emulateTransitionEnd(transitionDuration);
  2293. };
  2294. _proto._destroyElement = function _destroyElement(element) {
  2295. $(element).detach().trigger(EVENT_CLOSED).remove();
  2296. } // Static
  2297. ;
  2298. Alert._jQueryInterface = function _jQueryInterface(config) {
  2299. return this.each(function () {
  2300. var $element = $(this);
  2301. var data = $element.data(DATA_KEY);
  2302. if (!data) {
  2303. data = new Alert(this);
  2304. $element.data(DATA_KEY, data);
  2305. }
  2306. if (config === 'close') {
  2307. data[config](this);
  2308. }
  2309. });
  2310. };
  2311. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2312. return function (event) {
  2313. if (event) {
  2314. event.preventDefault();
  2315. }
  2316. alertInstance.close(this);
  2317. };
  2318. };
  2319. _createClass(Alert, null, [{
  2320. key: "VERSION",
  2321. get: function get() {
  2322. return VERSION;
  2323. }
  2324. }]);
  2325. return Alert;
  2326. }();
  2327. /**
  2328. * ------------------------------------------------------------------------
  2329. * Data Api implementation
  2330. * ------------------------------------------------------------------------
  2331. */
  2332. $(document).on(EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert._handleDismiss(new Alert()));
  2333. /**
  2334. * ------------------------------------------------------------------------
  2335. * jQuery
  2336. * ------------------------------------------------------------------------
  2337. */
  2338. $.fn[NAME] = Alert._jQueryInterface;
  2339. $.fn[NAME].Constructor = Alert;
  2340. $.fn[NAME].noConflict = function () {
  2341. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2342. return Alert._jQueryInterface;
  2343. };
  2344. /**
  2345. * ------------------------------------------------------------------------
  2346. * Constants
  2347. * ------------------------------------------------------------------------
  2348. */
  2349. var NAME$1 = 'button';
  2350. var VERSION$1 = '4.5.0';
  2351. var DATA_KEY$1 = 'bs.button';
  2352. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2353. var DATA_API_KEY$1 = '.data-api';
  2354. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2355. var CLASS_NAME_ACTIVE = 'active';
  2356. var CLASS_NAME_BUTTON = 'btn';
  2357. var CLASS_NAME_FOCUS = 'focus';
  2358. var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]';
  2359. var SELECTOR_DATA_TOGGLES = '[data-toggle="buttons"]';
  2360. var SELECTOR_DATA_TOGGLE = '[data-toggle="button"]';
  2361. var SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle="buttons"] .btn';
  2362. var SELECTOR_INPUT = 'input:not([type="hidden"])';
  2363. var SELECTOR_ACTIVE = '.active';
  2364. var SELECTOR_BUTTON = '.btn';
  2365. var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1;
  2366. var EVENT_FOCUS_BLUR_DATA_API = "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1);
  2367. var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$1 + DATA_API_KEY$1;
  2368. /**
  2369. * ------------------------------------------------------------------------
  2370. * Class Definition
  2371. * ------------------------------------------------------------------------
  2372. */
  2373. var Button = /*#__PURE__*/function () {
  2374. function Button(element) {
  2375. this._element = element;
  2376. } // Getters
  2377. var _proto = Button.prototype;
  2378. // Public
  2379. _proto.toggle = function toggle() {
  2380. var triggerChangeEvent = true;
  2381. var addAriaPressed = true;
  2382. var rootElement = $(this._element).closest(SELECTOR_DATA_TOGGLES)[0];
  2383. if (rootElement) {
  2384. var input = this._element.querySelector(SELECTOR_INPUT);
  2385. if (input) {
  2386. if (input.type === 'radio') {
  2387. if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
  2388. triggerChangeEvent = false;
  2389. } else {
  2390. var activeElement = rootElement.querySelector(SELECTOR_ACTIVE);
  2391. if (activeElement) {
  2392. $(activeElement).removeClass(CLASS_NAME_ACTIVE);
  2393. }
  2394. }
  2395. }
  2396. if (triggerChangeEvent) {
  2397. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2398. if (input.type === 'checkbox' || input.type === 'radio') {
  2399. input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE);
  2400. }
  2401. $(input).trigger('change');
  2402. }
  2403. input.focus();
  2404. addAriaPressed = false;
  2405. }
  2406. }
  2407. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2408. if (addAriaPressed) {
  2409. this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE));
  2410. }
  2411. if (triggerChangeEvent) {
  2412. $(this._element).toggleClass(CLASS_NAME_ACTIVE);
  2413. }
  2414. }
  2415. };
  2416. _proto.dispose = function dispose() {
  2417. $.removeData(this._element, DATA_KEY$1);
  2418. this._element = null;
  2419. } // Static
  2420. ;
  2421. Button._jQueryInterface = function _jQueryInterface(config) {
  2422. return this.each(function () {
  2423. var data = $(this).data(DATA_KEY$1);
  2424. if (!data) {
  2425. data = new Button(this);
  2426. $(this).data(DATA_KEY$1, data);
  2427. }
  2428. if (config === 'toggle') {
  2429. data[config]();
  2430. }
  2431. });
  2432. };
  2433. _createClass(Button, null, [{
  2434. key: "VERSION",
  2435. get: function get() {
  2436. return VERSION$1;
  2437. }
  2438. }]);
  2439. return Button;
  2440. }();
  2441. /**
  2442. * ------------------------------------------------------------------------
  2443. * Data Api implementation
  2444. * ------------------------------------------------------------------------
  2445. */
  2446. $(document).on(EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
  2447. var button = event.target;
  2448. var initialButton = button;
  2449. if (!$(button).hasClass(CLASS_NAME_BUTTON)) {
  2450. button = $(button).closest(SELECTOR_BUTTON)[0];
  2451. }
  2452. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2453. event.preventDefault(); // work around Firefox bug #1540995
  2454. } else {
  2455. var inputBtn = button.querySelector(SELECTOR_INPUT);
  2456. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2457. event.preventDefault(); // work around Firefox bug #1540995
  2458. return;
  2459. }
  2460. if (initialButton.tagName === 'LABEL' && inputBtn && inputBtn.type === 'checkbox') {
  2461. event.preventDefault(); // work around event sent to label and input
  2462. }
  2463. Button._jQueryInterface.call($(button), 'toggle');
  2464. }
  2465. }).on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
  2466. var button = $(event.target).closest(SELECTOR_BUTTON)[0];
  2467. $(button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type));
  2468. });
  2469. $(window).on(EVENT_LOAD_DATA_API, function () {
  2470. // ensure correct active class is set to match the controls' actual values/states
  2471. // find all checkboxes/readio buttons inside data-toggle groups
  2472. var buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS));
  2473. for (var i = 0, len = buttons.length; i < len; i++) {
  2474. var button = buttons[i];
  2475. var input = button.querySelector(SELECTOR_INPUT);
  2476. if (input.checked || input.hasAttribute('checked')) {
  2477. button.classList.add(CLASS_NAME_ACTIVE);
  2478. } else {
  2479. button.classList.remove(CLASS_NAME_ACTIVE);
  2480. }
  2481. } // find all button toggles
  2482. buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE));
  2483. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2484. var _button = buttons[_i];
  2485. if (_button.getAttribute('aria-pressed') === 'true') {
  2486. _button.classList.add(CLASS_NAME_ACTIVE);
  2487. } else {
  2488. _button.classList.remove(CLASS_NAME_ACTIVE);
  2489. }
  2490. }
  2491. });
  2492. /**
  2493. * ------------------------------------------------------------------------
  2494. * jQuery
  2495. * ------------------------------------------------------------------------
  2496. */
  2497. $.fn[NAME$1] = Button._jQueryInterface;
  2498. $.fn[NAME$1].Constructor = Button;
  2499. $.fn[NAME$1].noConflict = function () {
  2500. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2501. return Button._jQueryInterface;
  2502. };
  2503. /**
  2504. * ------------------------------------------------------------------------
  2505. * Constants
  2506. * ------------------------------------------------------------------------
  2507. */
  2508. var NAME$2 = 'carousel';
  2509. var VERSION$2 = '4.5.0';
  2510. var DATA_KEY$2 = 'bs.carousel';
  2511. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2512. var DATA_API_KEY$2 = '.data-api';
  2513. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2514. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2515. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2516. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2517. var SWIPE_THRESHOLD = 40;
  2518. var Default = {
  2519. interval: 5000,
  2520. keyboard: true,
  2521. slide: false,
  2522. pause: 'hover',
  2523. wrap: true,
  2524. touch: true
  2525. };
  2526. var DefaultType = {
  2527. interval: '(number|boolean)',
  2528. keyboard: 'boolean',
  2529. slide: '(boolean|string)',
  2530. pause: '(string|boolean)',
  2531. wrap: 'boolean',
  2532. touch: 'boolean'
  2533. };
  2534. var DIRECTION_NEXT = 'next';
  2535. var DIRECTION_PREV = 'prev';
  2536. var DIRECTION_LEFT = 'left';
  2537. var DIRECTION_RIGHT = 'right';
  2538. var EVENT_SLIDE = "slide" + EVENT_KEY$2;
  2539. var EVENT_SLID = "slid" + EVENT_KEY$2;
  2540. var EVENT_KEYDOWN = "keydown" + EVENT_KEY$2;
  2541. var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$2;
  2542. var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$2;
  2543. var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$2;
  2544. var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$2;
  2545. var EVENT_TOUCHEND = "touchend" + EVENT_KEY$2;
  2546. var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$2;
  2547. var EVENT_POINTERUP = "pointerup" + EVENT_KEY$2;
  2548. var EVENT_DRAG_START = "dragstart" + EVENT_KEY$2;
  2549. var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$2 + DATA_API_KEY$2;
  2550. var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$2 + DATA_API_KEY$2;
  2551. var CLASS_NAME_CAROUSEL = 'carousel';
  2552. var CLASS_NAME_ACTIVE$1 = 'active';
  2553. var CLASS_NAME_SLIDE = 'slide';
  2554. var CLASS_NAME_RIGHT = 'carousel-item-right';
  2555. var CLASS_NAME_LEFT = 'carousel-item-left';
  2556. var CLASS_NAME_NEXT = 'carousel-item-next';
  2557. var CLASS_NAME_PREV = 'carousel-item-prev';
  2558. var CLASS_NAME_POINTER_EVENT = 'pointer-event';
  2559. var SELECTOR_ACTIVE$1 = '.active';
  2560. var SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
  2561. var SELECTOR_ITEM = '.carousel-item';
  2562. var SELECTOR_ITEM_IMG = '.carousel-item img';
  2563. var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
  2564. var SELECTOR_INDICATORS = '.carousel-indicators';
  2565. var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]';
  2566. var SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
  2567. var PointerType = {
  2568. TOUCH: 'touch',
  2569. PEN: 'pen'
  2570. };
  2571. /**
  2572. * ------------------------------------------------------------------------
  2573. * Class Definition
  2574. * ------------------------------------------------------------------------
  2575. */
  2576. var Carousel = /*#__PURE__*/function () {
  2577. function Carousel(element, config) {
  2578. this._items = null;
  2579. this._interval = null;
  2580. this._activeElement = null;
  2581. this._isPaused = false;
  2582. this._isSliding = false;
  2583. this.touchTimeout = null;
  2584. this.touchStartX = 0;
  2585. this.touchDeltaX = 0;
  2586. this._config = this._getConfig(config);
  2587. this._element = element;
  2588. this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS);
  2589. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2590. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2591. this._addEventListeners();
  2592. } // Getters
  2593. var _proto = Carousel.prototype;
  2594. // Public
  2595. _proto.next = function next() {
  2596. if (!this._isSliding) {
  2597. this._slide(DIRECTION_NEXT);
  2598. }
  2599. };
  2600. _proto.nextWhenVisible = function nextWhenVisible() {
  2601. // Don't call next when the page isn't visible
  2602. // or the carousel or its parent isn't visible
  2603. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  2604. this.next();
  2605. }
  2606. };
  2607. _proto.prev = function prev() {
  2608. if (!this._isSliding) {
  2609. this._slide(DIRECTION_PREV);
  2610. }
  2611. };
  2612. _proto.pause = function pause(event) {
  2613. if (!event) {
  2614. this._isPaused = true;
  2615. }
  2616. if (this._element.querySelector(SELECTOR_NEXT_PREV)) {
  2617. Util.triggerTransitionEnd(this._element);
  2618. this.cycle(true);
  2619. }
  2620. clearInterval(this._interval);
  2621. this._interval = null;
  2622. };
  2623. _proto.cycle = function cycle(event) {
  2624. if (!event) {
  2625. this._isPaused = false;
  2626. }
  2627. if (this._interval) {
  2628. clearInterval(this._interval);
  2629. this._interval = null;
  2630. }
  2631. if (this._config.interval && !this._isPaused) {
  2632. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2633. }
  2634. };
  2635. _proto.to = function to(index) {
  2636. var _this = this;
  2637. this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
  2638. var activeIndex = this._getItemIndex(this._activeElement);
  2639. if (index > this._items.length - 1 || index < 0) {
  2640. return;
  2641. }
  2642. if (this._isSliding) {
  2643. $(this._element).one(EVENT_SLID, function () {
  2644. return _this.to(index);
  2645. });
  2646. return;
  2647. }
  2648. if (activeIndex === index) {
  2649. this.pause();
  2650. this.cycle();
  2651. return;
  2652. }
  2653. var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
  2654. this._slide(direction, this._items[index]);
  2655. };
  2656. _proto.dispose = function dispose() {
  2657. $(this._element).off(EVENT_KEY$2);
  2658. $.removeData(this._element, DATA_KEY$2);
  2659. this._items = null;
  2660. this._config = null;
  2661. this._element = null;
  2662. this._interval = null;
  2663. this._isPaused = null;
  2664. this._isSliding = null;
  2665. this._activeElement = null;
  2666. this._indicatorsElement = null;
  2667. } // Private
  2668. ;
  2669. _proto._getConfig = function _getConfig(config) {
  2670. config = _objectSpread2(_objectSpread2({}, Default), config);
  2671. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2672. return config;
  2673. };
  2674. _proto._handleSwipe = function _handleSwipe() {
  2675. var absDeltax = Math.abs(this.touchDeltaX);
  2676. if (absDeltax <= SWIPE_THRESHOLD) {
  2677. return;
  2678. }
  2679. var direction = absDeltax / this.touchDeltaX;
  2680. this.touchDeltaX = 0; // swipe left
  2681. if (direction > 0) {
  2682. this.prev();
  2683. } // swipe right
  2684. if (direction < 0) {
  2685. this.next();
  2686. }
  2687. };
  2688. _proto._addEventListeners = function _addEventListeners() {
  2689. var _this2 = this;
  2690. if (this._config.keyboard) {
  2691. $(this._element).on(EVENT_KEYDOWN, function (event) {
  2692. return _this2._keydown(event);
  2693. });
  2694. }
  2695. if (this._config.pause === 'hover') {
  2696. $(this._element).on(EVENT_MOUSEENTER, function (event) {
  2697. return _this2.pause(event);
  2698. }).on(EVENT_MOUSELEAVE, function (event) {
  2699. return _this2.cycle(event);
  2700. });
  2701. }
  2702. if (this._config.touch) {
  2703. this._addTouchEventListeners();
  2704. }
  2705. };
  2706. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2707. var _this3 = this;
  2708. if (!this._touchSupported) {
  2709. return;
  2710. }
  2711. var start = function start(event) {
  2712. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2713. _this3.touchStartX = event.originalEvent.clientX;
  2714. } else if (!_this3._pointerEvent) {
  2715. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2716. }
  2717. };
  2718. var move = function move(event) {
  2719. // ensure swiping with one touch and not pinching
  2720. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2721. _this3.touchDeltaX = 0;
  2722. } else {
  2723. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2724. }
  2725. };
  2726. var end = function end(event) {
  2727. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2728. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2729. }
  2730. _this3._handleSwipe();
  2731. if (_this3._config.pause === 'hover') {
  2732. // If it's a touch-enabled device, mouseenter/leave are fired as
  2733. // part of the mouse compatibility events on first tap - the carousel
  2734. // would stop cycling until user tapped out of it;
  2735. // here, we listen for touchend, explicitly pause the carousel
  2736. // (as if it's the second time we tap on it, mouseenter compat event
  2737. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2738. // events to fire) we explicitly restart cycling
  2739. _this3.pause();
  2740. if (_this3.touchTimeout) {
  2741. clearTimeout(_this3.touchTimeout);
  2742. }
  2743. _this3.touchTimeout = setTimeout(function (event) {
  2744. return _this3.cycle(event);
  2745. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2746. }
  2747. };
  2748. $(this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) {
  2749. return e.preventDefault();
  2750. });
  2751. if (this._pointerEvent) {
  2752. $(this._element).on(EVENT_POINTERDOWN, function (event) {
  2753. return start(event);
  2754. });
  2755. $(this._element).on(EVENT_POINTERUP, function (event) {
  2756. return end(event);
  2757. });
  2758. this._element.classList.add(CLASS_NAME_POINTER_EVENT);
  2759. } else {
  2760. $(this._element).on(EVENT_TOUCHSTART, function (event) {
  2761. return start(event);
  2762. });
  2763. $(this._element).on(EVENT_TOUCHMOVE, function (event) {
  2764. return move(event);
  2765. });
  2766. $(this._element).on(EVENT_TOUCHEND, function (event) {
  2767. return end(event);
  2768. });
  2769. }
  2770. };
  2771. _proto._keydown = function _keydown(event) {
  2772. if (/input|textarea/i.test(event.target.tagName)) {
  2773. return;
  2774. }
  2775. switch (event.which) {
  2776. case ARROW_LEFT_KEYCODE:
  2777. event.preventDefault();
  2778. this.prev();
  2779. break;
  2780. case ARROW_RIGHT_KEYCODE:
  2781. event.preventDefault();
  2782. this.next();
  2783. break;
  2784. }
  2785. };
  2786. _proto._getItemIndex = function _getItemIndex(element) {
  2787. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : [];
  2788. return this._items.indexOf(element);
  2789. };
  2790. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2791. var isNextDirection = direction === DIRECTION_NEXT;
  2792. var isPrevDirection = direction === DIRECTION_PREV;
  2793. var activeIndex = this._getItemIndex(activeElement);
  2794. var lastItemIndex = this._items.length - 1;
  2795. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2796. if (isGoingToWrap && !this._config.wrap) {
  2797. return activeElement;
  2798. }
  2799. var delta = direction === DIRECTION_PREV ? -1 : 1;
  2800. var itemIndex = (activeIndex + delta) % this._items.length;
  2801. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2802. };
  2803. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2804. var targetIndex = this._getItemIndex(relatedTarget);
  2805. var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM));
  2806. var slideEvent = $.Event(EVENT_SLIDE, {
  2807. relatedTarget: relatedTarget,
  2808. direction: eventDirectionName,
  2809. from: fromIndex,
  2810. to: targetIndex
  2811. });
  2812. $(this._element).trigger(slideEvent);
  2813. return slideEvent;
  2814. };
  2815. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  2816. if (this._indicatorsElement) {
  2817. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE$1));
  2818. $(indicators).removeClass(CLASS_NAME_ACTIVE$1);
  2819. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  2820. if (nextIndicator) {
  2821. $(nextIndicator).addClass(CLASS_NAME_ACTIVE$1);
  2822. }
  2823. }
  2824. };
  2825. _proto._slide = function _slide(direction, element) {
  2826. var _this4 = this;
  2827. var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
  2828. var activeElementIndex = this._getItemIndex(activeElement);
  2829. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  2830. var nextElementIndex = this._getItemIndex(nextElement);
  2831. var isCycling = Boolean(this._interval);
  2832. var directionalClassName;
  2833. var orderClassName;
  2834. var eventDirectionName;
  2835. if (direction === DIRECTION_NEXT) {
  2836. directionalClassName = CLASS_NAME_LEFT;
  2837. orderClassName = CLASS_NAME_NEXT;
  2838. eventDirectionName = DIRECTION_LEFT;
  2839. } else {
  2840. directionalClassName = CLASS_NAME_RIGHT;
  2841. orderClassName = CLASS_NAME_PREV;
  2842. eventDirectionName = DIRECTION_RIGHT;
  2843. }
  2844. if (nextElement && $(nextElement).hasClass(CLASS_NAME_ACTIVE$1)) {
  2845. this._isSliding = false;
  2846. return;
  2847. }
  2848. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  2849. if (slideEvent.isDefaultPrevented()) {
  2850. return;
  2851. }
  2852. if (!activeElement || !nextElement) {
  2853. // Some weirdness is happening, so we bail
  2854. return;
  2855. }
  2856. this._isSliding = true;
  2857. if (isCycling) {
  2858. this.pause();
  2859. }
  2860. this._setActiveIndicatorElement(nextElement);
  2861. var slidEvent = $.Event(EVENT_SLID, {
  2862. relatedTarget: nextElement,
  2863. direction: eventDirectionName,
  2864. from: activeElementIndex,
  2865. to: nextElementIndex
  2866. });
  2867. if ($(this._element).hasClass(CLASS_NAME_SLIDE)) {
  2868. $(nextElement).addClass(orderClassName);
  2869. Util.reflow(nextElement);
  2870. $(activeElement).addClass(directionalClassName);
  2871. $(nextElement).addClass(directionalClassName);
  2872. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  2873. if (nextElementInterval) {
  2874. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  2875. this._config.interval = nextElementInterval;
  2876. } else {
  2877. this._config.interval = this._config.defaultInterval || this._config.interval;
  2878. }
  2879. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  2880. $(activeElement).one(Util.TRANSITION_END, function () {
  2881. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE$1);
  2882. $(activeElement).removeClass(CLASS_NAME_ACTIVE$1 + " " + orderClassName + " " + directionalClassName);
  2883. _this4._isSliding = false;
  2884. setTimeout(function () {
  2885. return $(_this4._element).trigger(slidEvent);
  2886. }, 0);
  2887. }).emulateTransitionEnd(transitionDuration);
  2888. } else {
  2889. $(activeElement).removeClass(CLASS_NAME_ACTIVE$1);
  2890. $(nextElement).addClass(CLASS_NAME_ACTIVE$1);
  2891. this._isSliding = false;
  2892. $(this._element).trigger(slidEvent);
  2893. }
  2894. if (isCycling) {
  2895. this.cycle();
  2896. }
  2897. } // Static
  2898. ;
  2899. Carousel._jQueryInterface = function _jQueryInterface(config) {
  2900. return this.each(function () {
  2901. var data = $(this).data(DATA_KEY$2);
  2902. var _config = _objectSpread2(_objectSpread2({}, Default), $(this).data());
  2903. if (typeof config === 'object') {
  2904. _config = _objectSpread2(_objectSpread2({}, _config), config);
  2905. }
  2906. var action = typeof config === 'string' ? config : _config.slide;
  2907. if (!data) {
  2908. data = new Carousel(this, _config);
  2909. $(this).data(DATA_KEY$2, data);
  2910. }
  2911. if (typeof config === 'number') {
  2912. data.to(config);
  2913. } else if (typeof action === 'string') {
  2914. if (typeof data[action] === 'undefined') {
  2915. throw new TypeError("No method named \"" + action + "\"");
  2916. }
  2917. data[action]();
  2918. } else if (_config.interval && _config.ride) {
  2919. data.pause();
  2920. data.cycle();
  2921. }
  2922. });
  2923. };
  2924. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  2925. var selector = Util.getSelectorFromElement(this);
  2926. if (!selector) {
  2927. return;
  2928. }
  2929. var target = $(selector)[0];
  2930. if (!target || !$(target).hasClass(CLASS_NAME_CAROUSEL)) {
  2931. return;
  2932. }
  2933. var config = _objectSpread2(_objectSpread2({}, $(target).data()), $(this).data());
  2934. var slideIndex = this.getAttribute('data-slide-to');
  2935. if (slideIndex) {
  2936. config.interval = false;
  2937. }
  2938. Carousel._jQueryInterface.call($(target), config);
  2939. if (slideIndex) {
  2940. $(target).data(DATA_KEY$2).to(slideIndex);
  2941. }
  2942. event.preventDefault();
  2943. };
  2944. _createClass(Carousel, null, [{
  2945. key: "VERSION",
  2946. get: function get() {
  2947. return VERSION$2;
  2948. }
  2949. }, {
  2950. key: "Default",
  2951. get: function get() {
  2952. return Default;
  2953. }
  2954. }]);
  2955. return Carousel;
  2956. }();
  2957. /**
  2958. * ------------------------------------------------------------------------
  2959. * Data Api implementation
  2960. * ------------------------------------------------------------------------
  2961. */
  2962. $(document).on(EVENT_CLICK_DATA_API$2, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler);
  2963. $(window).on(EVENT_LOAD_DATA_API$1, function () {
  2964. var carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE));
  2965. for (var i = 0, len = carousels.length; i < len; i++) {
  2966. var $carousel = $(carousels[i]);
  2967. Carousel._jQueryInterface.call($carousel, $carousel.data());
  2968. }
  2969. });
  2970. /**
  2971. * ------------------------------------------------------------------------
  2972. * jQuery
  2973. * ------------------------------------------------------------------------
  2974. */
  2975. $.fn[NAME$2] = Carousel._jQueryInterface;
  2976. $.fn[NAME$2].Constructor = Carousel;
  2977. $.fn[NAME$2].noConflict = function () {
  2978. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  2979. return Carousel._jQueryInterface;
  2980. };
  2981. /**
  2982. * ------------------------------------------------------------------------
  2983. * Constants
  2984. * ------------------------------------------------------------------------
  2985. */
  2986. var NAME$3 = 'collapse';
  2987. var VERSION$3 = '4.5.0';
  2988. var DATA_KEY$3 = 'bs.collapse';
  2989. var EVENT_KEY$3 = "." + DATA_KEY$3;
  2990. var DATA_API_KEY$3 = '.data-api';
  2991. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  2992. var Default$1 = {
  2993. toggle: true,
  2994. parent: ''
  2995. };
  2996. var DefaultType$1 = {
  2997. toggle: 'boolean',
  2998. parent: '(string|element)'
  2999. };
  3000. var EVENT_SHOW = "show" + EVENT_KEY$3;
  3001. var EVENT_SHOWN = "shown" + EVENT_KEY$3;
  3002. var EVENT_HIDE = "hide" + EVENT_KEY$3;
  3003. var EVENT_HIDDEN = "hidden" + EVENT_KEY$3;
  3004. var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$3 + DATA_API_KEY$3;
  3005. var CLASS_NAME_SHOW$1 = 'show';
  3006. var CLASS_NAME_COLLAPSE = 'collapse';
  3007. var CLASS_NAME_COLLAPSING = 'collapsing';
  3008. var CLASS_NAME_COLLAPSED = 'collapsed';
  3009. var DIMENSION_WIDTH = 'width';
  3010. var DIMENSION_HEIGHT = 'height';
  3011. var SELECTOR_ACTIVES = '.show, .collapsing';
  3012. var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="collapse"]';
  3013. /**
  3014. * ------------------------------------------------------------------------
  3015. * Class Definition
  3016. * ------------------------------------------------------------------------
  3017. */
  3018. var Collapse = /*#__PURE__*/function () {
  3019. function Collapse(element, config) {
  3020. this._isTransitioning = false;
  3021. this._element = element;
  3022. this._config = this._getConfig(config);
  3023. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3024. var toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$1));
  3025. for (var i = 0, len = toggleList.length; i < len; i++) {
  3026. var elem = toggleList[i];
  3027. var selector = Util.getSelectorFromElement(elem);
  3028. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3029. return foundElem === element;
  3030. });
  3031. if (selector !== null && filterElement.length > 0) {
  3032. this._selector = selector;
  3033. this._triggerArray.push(elem);
  3034. }
  3035. }
  3036. this._parent = this._config.parent ? this._getParent() : null;
  3037. if (!this._config.parent) {
  3038. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3039. }
  3040. if (this._config.toggle) {
  3041. this.toggle();
  3042. }
  3043. } // Getters
  3044. var _proto = Collapse.prototype;
  3045. // Public
  3046. _proto.toggle = function toggle() {
  3047. if ($(this._element).hasClass(CLASS_NAME_SHOW$1)) {
  3048. this.hide();
  3049. } else {
  3050. this.show();
  3051. }
  3052. };
  3053. _proto.show = function show() {
  3054. var _this = this;
  3055. if (this._isTransitioning || $(this._element).hasClass(CLASS_NAME_SHOW$1)) {
  3056. return;
  3057. }
  3058. var actives;
  3059. var activesData;
  3060. if (this._parent) {
  3061. actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)).filter(function (elem) {
  3062. if (typeof _this._config.parent === 'string') {
  3063. return elem.getAttribute('data-parent') === _this._config.parent;
  3064. }
  3065. return elem.classList.contains(CLASS_NAME_COLLAPSE);
  3066. });
  3067. if (actives.length === 0) {
  3068. actives = null;
  3069. }
  3070. }
  3071. if (actives) {
  3072. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3073. if (activesData && activesData._isTransitioning) {
  3074. return;
  3075. }
  3076. }
  3077. var startEvent = $.Event(EVENT_SHOW);
  3078. $(this._element).trigger(startEvent);
  3079. if (startEvent.isDefaultPrevented()) {
  3080. return;
  3081. }
  3082. if (actives) {
  3083. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3084. if (!activesData) {
  3085. $(actives).data(DATA_KEY$3, null);
  3086. }
  3087. }
  3088. var dimension = this._getDimension();
  3089. $(this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING);
  3090. this._element.style[dimension] = 0;
  3091. if (this._triggerArray.length) {
  3092. $(this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true);
  3093. }
  3094. this.setTransitioning(true);
  3095. var complete = function complete() {
  3096. $(_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1);
  3097. _this._element.style[dimension] = '';
  3098. _this.setTransitioning(false);
  3099. $(_this._element).trigger(EVENT_SHOWN);
  3100. };
  3101. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3102. var scrollSize = "scroll" + capitalizedDimension;
  3103. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3104. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3105. this._element.style[dimension] = this._element[scrollSize] + "px";
  3106. };
  3107. _proto.hide = function hide() {
  3108. var _this2 = this;
  3109. if (this._isTransitioning || !$(this._element).hasClass(CLASS_NAME_SHOW$1)) {
  3110. return;
  3111. }
  3112. var startEvent = $.Event(EVENT_HIDE);
  3113. $(this._element).trigger(startEvent);
  3114. if (startEvent.isDefaultPrevented()) {
  3115. return;
  3116. }
  3117. var dimension = this._getDimension();
  3118. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3119. Util.reflow(this._element);
  3120. $(this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1);
  3121. var triggerArrayLength = this._triggerArray.length;
  3122. if (triggerArrayLength > 0) {
  3123. for (var i = 0; i < triggerArrayLength; i++) {
  3124. var trigger = this._triggerArray[i];
  3125. var selector = Util.getSelectorFromElement(trigger);
  3126. if (selector !== null) {
  3127. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3128. if (!$elem.hasClass(CLASS_NAME_SHOW$1)) {
  3129. $(trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false);
  3130. }
  3131. }
  3132. }
  3133. }
  3134. this.setTransitioning(true);
  3135. var complete = function complete() {
  3136. _this2.setTransitioning(false);
  3137. $(_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN);
  3138. };
  3139. this._element.style[dimension] = '';
  3140. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3141. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3142. };
  3143. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3144. this._isTransitioning = isTransitioning;
  3145. };
  3146. _proto.dispose = function dispose() {
  3147. $.removeData(this._element, DATA_KEY$3);
  3148. this._config = null;
  3149. this._parent = null;
  3150. this._element = null;
  3151. this._triggerArray = null;
  3152. this._isTransitioning = null;
  3153. } // Private
  3154. ;
  3155. _proto._getConfig = function _getConfig(config) {
  3156. config = _objectSpread2(_objectSpread2({}, Default$1), config);
  3157. config.toggle = Boolean(config.toggle); // Coerce string values
  3158. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3159. return config;
  3160. };
  3161. _proto._getDimension = function _getDimension() {
  3162. var hasWidth = $(this._element).hasClass(DIMENSION_WIDTH);
  3163. return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT;
  3164. };
  3165. _proto._getParent = function _getParent() {
  3166. var _this3 = this;
  3167. var parent;
  3168. if (Util.isElement(this._config.parent)) {
  3169. parent = this._config.parent; // It's a jQuery object
  3170. if (typeof this._config.parent.jquery !== 'undefined') {
  3171. parent = this._config.parent[0];
  3172. }
  3173. } else {
  3174. parent = document.querySelector(this._config.parent);
  3175. }
  3176. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3177. var children = [].slice.call(parent.querySelectorAll(selector));
  3178. $(children).each(function (i, element) {
  3179. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3180. });
  3181. return parent;
  3182. };
  3183. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3184. var isOpen = $(element).hasClass(CLASS_NAME_SHOW$1);
  3185. if (triggerArray.length) {
  3186. $(triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3187. }
  3188. } // Static
  3189. ;
  3190. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3191. var selector = Util.getSelectorFromElement(element);
  3192. return selector ? document.querySelector(selector) : null;
  3193. };
  3194. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3195. return this.each(function () {
  3196. var $this = $(this);
  3197. var data = $this.data(DATA_KEY$3);
  3198. var _config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default$1), $this.data()), typeof config === 'object' && config ? config : {});
  3199. if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
  3200. _config.toggle = false;
  3201. }
  3202. if (!data) {
  3203. data = new Collapse(this, _config);
  3204. $this.data(DATA_KEY$3, data);
  3205. }
  3206. if (typeof config === 'string') {
  3207. if (typeof data[config] === 'undefined') {
  3208. throw new TypeError("No method named \"" + config + "\"");
  3209. }
  3210. data[config]();
  3211. }
  3212. });
  3213. };
  3214. _createClass(Collapse, null, [{
  3215. key: "VERSION",
  3216. get: function get() {
  3217. return VERSION$3;
  3218. }
  3219. }, {
  3220. key: "Default",
  3221. get: function get() {
  3222. return Default$1;
  3223. }
  3224. }]);
  3225. return Collapse;
  3226. }();
  3227. /**
  3228. * ------------------------------------------------------------------------
  3229. * Data Api implementation
  3230. * ------------------------------------------------------------------------
  3231. */
  3232. $(document).on(EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$1, function (event) {
  3233. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3234. if (event.currentTarget.tagName === 'A') {
  3235. event.preventDefault();
  3236. }
  3237. var $trigger = $(this);
  3238. var selector = Util.getSelectorFromElement(this);
  3239. var selectors = [].slice.call(document.querySelectorAll(selector));
  3240. $(selectors).each(function () {
  3241. var $target = $(this);
  3242. var data = $target.data(DATA_KEY$3);
  3243. var config = data ? 'toggle' : $trigger.data();
  3244. Collapse._jQueryInterface.call($target, config);
  3245. });
  3246. });
  3247. /**
  3248. * ------------------------------------------------------------------------
  3249. * jQuery
  3250. * ------------------------------------------------------------------------
  3251. */
  3252. $.fn[NAME$3] = Collapse._jQueryInterface;
  3253. $.fn[NAME$3].Constructor = Collapse;
  3254. $.fn[NAME$3].noConflict = function () {
  3255. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3256. return Collapse._jQueryInterface;
  3257. };
  3258. /**
  3259. * ------------------------------------------------------------------------
  3260. * Constants
  3261. * ------------------------------------------------------------------------
  3262. */
  3263. var NAME$4 = 'dropdown';
  3264. var VERSION$4 = '4.5.0';
  3265. var DATA_KEY$4 = 'bs.dropdown';
  3266. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3267. var DATA_API_KEY$4 = '.data-api';
  3268. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3269. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3270. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3271. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3272. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3273. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3274. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3275. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3276. var EVENT_HIDE$1 = "hide" + EVENT_KEY$4;
  3277. var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$4;
  3278. var EVENT_SHOW$1 = "show" + EVENT_KEY$4;
  3279. var EVENT_SHOWN$1 = "shown" + EVENT_KEY$4;
  3280. var EVENT_CLICK = "click" + EVENT_KEY$4;
  3281. var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$4 + DATA_API_KEY$4;
  3282. var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$4 + DATA_API_KEY$4;
  3283. var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$4 + DATA_API_KEY$4;
  3284. var CLASS_NAME_DISABLED = 'disabled';
  3285. var CLASS_NAME_SHOW$2 = 'show';
  3286. var CLASS_NAME_DROPUP = 'dropup';
  3287. var CLASS_NAME_DROPRIGHT = 'dropright';
  3288. var CLASS_NAME_DROPLEFT = 'dropleft';
  3289. var CLASS_NAME_MENURIGHT = 'dropdown-menu-right';
  3290. var CLASS_NAME_POSITION_STATIC = 'position-static';
  3291. var SELECTOR_DATA_TOGGLE$2 = '[data-toggle="dropdown"]';
  3292. var SELECTOR_FORM_CHILD = '.dropdown form';
  3293. var SELECTOR_MENU = '.dropdown-menu';
  3294. var SELECTOR_NAVBAR_NAV = '.navbar-nav';
  3295. var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
  3296. var PLACEMENT_TOP = 'top-start';
  3297. var PLACEMENT_TOPEND = 'top-end';
  3298. var PLACEMENT_BOTTOM = 'bottom-start';
  3299. var PLACEMENT_BOTTOMEND = 'bottom-end';
  3300. var PLACEMENT_RIGHT = 'right-start';
  3301. var PLACEMENT_LEFT = 'left-start';
  3302. var Default$2 = {
  3303. offset: 0,
  3304. flip: true,
  3305. boundary: 'scrollParent',
  3306. reference: 'toggle',
  3307. display: 'dynamic',
  3308. popperConfig: null
  3309. };
  3310. var DefaultType$2 = {
  3311. offset: '(number|string|function)',
  3312. flip: 'boolean',
  3313. boundary: '(string|element)',
  3314. reference: '(string|element)',
  3315. display: 'string',
  3316. popperConfig: '(null|object)'
  3317. };
  3318. /**
  3319. * ------------------------------------------------------------------------
  3320. * Class Definition
  3321. * ------------------------------------------------------------------------
  3322. */
  3323. var Dropdown = /*#__PURE__*/function () {
  3324. function Dropdown(element, config) {
  3325. this._element = element;
  3326. this._popper = null;
  3327. this._config = this._getConfig(config);
  3328. this._menu = this._getMenuElement();
  3329. this._inNavbar = this._detectNavbar();
  3330. this._addEventListeners();
  3331. } // Getters
  3332. var _proto = Dropdown.prototype;
  3333. // Public
  3334. _proto.toggle = function toggle() {
  3335. if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED)) {
  3336. return;
  3337. }
  3338. var isActive = $(this._menu).hasClass(CLASS_NAME_SHOW$2);
  3339. Dropdown._clearMenus();
  3340. if (isActive) {
  3341. return;
  3342. }
  3343. this.show(true);
  3344. };
  3345. _proto.show = function show(usePopper) {
  3346. if (usePopper === void 0) {
  3347. usePopper = false;
  3348. }
  3349. if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED) || $(this._menu).hasClass(CLASS_NAME_SHOW$2)) {
  3350. return;
  3351. }
  3352. var relatedTarget = {
  3353. relatedTarget: this._element
  3354. };
  3355. var showEvent = $.Event(EVENT_SHOW$1, relatedTarget);
  3356. var parent = Dropdown._getParentFromElement(this._element);
  3357. $(parent).trigger(showEvent);
  3358. if (showEvent.isDefaultPrevented()) {
  3359. return;
  3360. } // Disable totally Popper.js for Dropdown in Navbar
  3361. if (!this._inNavbar && usePopper) {
  3362. /**
  3363. * Check for Popper dependency
  3364. * Popper - https://popper.js.org
  3365. */
  3366. if (typeof Popper === 'undefined') {
  3367. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3368. }
  3369. var referenceElement = this._element;
  3370. if (this._config.reference === 'parent') {
  3371. referenceElement = parent;
  3372. } else if (Util.isElement(this._config.reference)) {
  3373. referenceElement = this._config.reference; // Check if it's jQuery element
  3374. if (typeof this._config.reference.jquery !== 'undefined') {
  3375. referenceElement = this._config.reference[0];
  3376. }
  3377. } // If boundary is not `scrollParent`, then set position to `static`
  3378. // to allow the menu to "escape" the scroll parent's boundaries
  3379. // https://github.com/twbs/bootstrap/issues/24251
  3380. if (this._config.boundary !== 'scrollParent') {
  3381. $(parent).addClass(CLASS_NAME_POSITION_STATIC);
  3382. }
  3383. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3384. } // If this is a touch-enabled device we add extra
  3385. // empty mouseover listeners to the body's immediate children;
  3386. // only needed because of broken event delegation on iOS
  3387. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3388. if ('ontouchstart' in document.documentElement && $(parent).closest(SELECTOR_NAVBAR_NAV).length === 0) {
  3389. $(document.body).children().on('mouseover', null, $.noop);
  3390. }
  3391. this._element.focus();
  3392. this._element.setAttribute('aria-expanded', true);
  3393. $(this._menu).toggleClass(CLASS_NAME_SHOW$2);
  3394. $(parent).toggleClass(CLASS_NAME_SHOW$2).trigger($.Event(EVENT_SHOWN$1, relatedTarget));
  3395. };
  3396. _proto.hide = function hide() {
  3397. if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED) || !$(this._menu).hasClass(CLASS_NAME_SHOW$2)) {
  3398. return;
  3399. }
  3400. var relatedTarget = {
  3401. relatedTarget: this._element
  3402. };
  3403. var hideEvent = $.Event(EVENT_HIDE$1, relatedTarget);
  3404. var parent = Dropdown._getParentFromElement(this._element);
  3405. $(parent).trigger(hideEvent);
  3406. if (hideEvent.isDefaultPrevented()) {
  3407. return;
  3408. }
  3409. if (this._popper) {
  3410. this._popper.destroy();
  3411. }
  3412. $(this._menu).toggleClass(CLASS_NAME_SHOW$2);
  3413. $(parent).toggleClass(CLASS_NAME_SHOW$2).trigger($.Event(EVENT_HIDDEN$1, relatedTarget));
  3414. };
  3415. _proto.dispose = function dispose() {
  3416. $.removeData(this._element, DATA_KEY$4);
  3417. $(this._element).off(EVENT_KEY$4);
  3418. this._element = null;
  3419. this._menu = null;
  3420. if (this._popper !== null) {
  3421. this._popper.destroy();
  3422. this._popper = null;
  3423. }
  3424. };
  3425. _proto.update = function update() {
  3426. this._inNavbar = this._detectNavbar();
  3427. if (this._popper !== null) {
  3428. this._popper.scheduleUpdate();
  3429. }
  3430. } // Private
  3431. ;
  3432. _proto._addEventListeners = function _addEventListeners() {
  3433. var _this = this;
  3434. $(this._element).on(EVENT_CLICK, function (event) {
  3435. event.preventDefault();
  3436. event.stopPropagation();
  3437. _this.toggle();
  3438. });
  3439. };
  3440. _proto._getConfig = function _getConfig(config) {
  3441. config = _objectSpread2(_objectSpread2(_objectSpread2({}, this.constructor.Default), $(this._element).data()), config);
  3442. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3443. return config;
  3444. };
  3445. _proto._getMenuElement = function _getMenuElement() {
  3446. if (!this._menu) {
  3447. var parent = Dropdown._getParentFromElement(this._element);
  3448. if (parent) {
  3449. this._menu = parent.querySelector(SELECTOR_MENU);
  3450. }
  3451. }
  3452. return this._menu;
  3453. };
  3454. _proto._getPlacement = function _getPlacement() {
  3455. var $parentDropdown = $(this._element.parentNode);
  3456. var placement = PLACEMENT_BOTTOM; // Handle dropup
  3457. if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) {
  3458. placement = $(this._menu).hasClass(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP;
  3459. } else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) {
  3460. placement = PLACEMENT_RIGHT;
  3461. } else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) {
  3462. placement = PLACEMENT_LEFT;
  3463. } else if ($(this._menu).hasClass(CLASS_NAME_MENURIGHT)) {
  3464. placement = PLACEMENT_BOTTOMEND;
  3465. }
  3466. return placement;
  3467. };
  3468. _proto._detectNavbar = function _detectNavbar() {
  3469. return $(this._element).closest('.navbar').length > 0;
  3470. };
  3471. _proto._getOffset = function _getOffset() {
  3472. var _this2 = this;
  3473. var offset = {};
  3474. if (typeof this._config.offset === 'function') {
  3475. offset.fn = function (data) {
  3476. data.offsets = _objectSpread2(_objectSpread2({}, data.offsets), _this2._config.offset(data.offsets, _this2._element) || {});
  3477. return data;
  3478. };
  3479. } else {
  3480. offset.offset = this._config.offset;
  3481. }
  3482. return offset;
  3483. };
  3484. _proto._getPopperConfig = function _getPopperConfig() {
  3485. var popperConfig = {
  3486. placement: this._getPlacement(),
  3487. modifiers: {
  3488. offset: this._getOffset(),
  3489. flip: {
  3490. enabled: this._config.flip
  3491. },
  3492. preventOverflow: {
  3493. boundariesElement: this._config.boundary
  3494. }
  3495. }
  3496. }; // Disable Popper.js if we have a static display
  3497. if (this._config.display === 'static') {
  3498. popperConfig.modifiers.applyStyle = {
  3499. enabled: false
  3500. };
  3501. }
  3502. return _objectSpread2(_objectSpread2({}, popperConfig), this._config.popperConfig);
  3503. } // Static
  3504. ;
  3505. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3506. return this.each(function () {
  3507. var data = $(this).data(DATA_KEY$4);
  3508. var _config = typeof config === 'object' ? config : null;
  3509. if (!data) {
  3510. data = new Dropdown(this, _config);
  3511. $(this).data(DATA_KEY$4, data);
  3512. }
  3513. if (typeof config === 'string') {
  3514. if (typeof data[config] === 'undefined') {
  3515. throw new TypeError("No method named \"" + config + "\"");
  3516. }
  3517. data[config]();
  3518. }
  3519. });
  3520. };
  3521. Dropdown._clearMenus = function _clearMenus(event) {
  3522. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3523. return;
  3524. }
  3525. var toggles = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$2));
  3526. for (var i = 0, len = toggles.length; i < len; i++) {
  3527. var parent = Dropdown._getParentFromElement(toggles[i]);
  3528. var context = $(toggles[i]).data(DATA_KEY$4);
  3529. var relatedTarget = {
  3530. relatedTarget: toggles[i]
  3531. };
  3532. if (event && event.type === 'click') {
  3533. relatedTarget.clickEvent = event;
  3534. }
  3535. if (!context) {
  3536. continue;
  3537. }
  3538. var dropdownMenu = context._menu;
  3539. if (!$(parent).hasClass(CLASS_NAME_SHOW$2)) {
  3540. continue;
  3541. }
  3542. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3543. continue;
  3544. }
  3545. var hideEvent = $.Event(EVENT_HIDE$1, relatedTarget);
  3546. $(parent).trigger(hideEvent);
  3547. if (hideEvent.isDefaultPrevented()) {
  3548. continue;
  3549. } // If this is a touch-enabled device we remove the extra
  3550. // empty mouseover listeners we added for iOS support
  3551. if ('ontouchstart' in document.documentElement) {
  3552. $(document.body).children().off('mouseover', null, $.noop);
  3553. }
  3554. toggles[i].setAttribute('aria-expanded', 'false');
  3555. if (context._popper) {
  3556. context._popper.destroy();
  3557. }
  3558. $(dropdownMenu).removeClass(CLASS_NAME_SHOW$2);
  3559. $(parent).removeClass(CLASS_NAME_SHOW$2).trigger($.Event(EVENT_HIDDEN$1, relatedTarget));
  3560. }
  3561. };
  3562. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3563. var parent;
  3564. var selector = Util.getSelectorFromElement(element);
  3565. if (selector) {
  3566. parent = document.querySelector(selector);
  3567. }
  3568. return parent || element.parentNode;
  3569. } // eslint-disable-next-line complexity
  3570. ;
  3571. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3572. // If not input/textarea:
  3573. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3574. // If input/textarea:
  3575. // - If space key => not a dropdown command
  3576. // - If key is other than escape
  3577. // - If key is not up or down => not a dropdown command
  3578. // - If trigger inside the menu => not a dropdown command
  3579. 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_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
  3580. return;
  3581. }
  3582. if (this.disabled || $(this).hasClass(CLASS_NAME_DISABLED)) {
  3583. return;
  3584. }
  3585. var parent = Dropdown._getParentFromElement(this);
  3586. var isActive = $(parent).hasClass(CLASS_NAME_SHOW$2);
  3587. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3588. return;
  3589. }
  3590. event.preventDefault();
  3591. event.stopPropagation();
  3592. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3593. if (event.which === ESCAPE_KEYCODE) {
  3594. $(parent.querySelector(SELECTOR_DATA_TOGGLE$2)).trigger('focus');
  3595. }
  3596. $(this).trigger('click');
  3597. return;
  3598. }
  3599. var items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS)).filter(function (item) {
  3600. return $(item).is(':visible');
  3601. });
  3602. if (items.length === 0) {
  3603. return;
  3604. }
  3605. var index = items.indexOf(event.target);
  3606. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3607. // Up
  3608. index--;
  3609. }
  3610. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3611. // Down
  3612. index++;
  3613. }
  3614. if (index < 0) {
  3615. index = 0;
  3616. }
  3617. items[index].focus();
  3618. };
  3619. _createClass(Dropdown, null, [{
  3620. key: "VERSION",
  3621. get: function get() {
  3622. return VERSION$4;
  3623. }
  3624. }, {
  3625. key: "Default",
  3626. get: function get() {
  3627. return Default$2;
  3628. }
  3629. }, {
  3630. key: "DefaultType",
  3631. get: function get() {
  3632. return DefaultType$2;
  3633. }
  3634. }]);
  3635. return Dropdown;
  3636. }();
  3637. /**
  3638. * ------------------------------------------------------------------------
  3639. * Data Api implementation
  3640. * ------------------------------------------------------------------------
  3641. */
  3642. $(document).on(EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$2, Dropdown._dataApiKeydownHandler).on(EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown._dataApiKeydownHandler).on(EVENT_CLICK_DATA_API$4 + " " + EVENT_KEYUP_DATA_API, Dropdown._clearMenus).on(EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$2, function (event) {
  3643. event.preventDefault();
  3644. event.stopPropagation();
  3645. Dropdown._jQueryInterface.call($(this), 'toggle');
  3646. }).on(EVENT_CLICK_DATA_API$4, SELECTOR_FORM_CHILD, function (e) {
  3647. e.stopPropagation();
  3648. });
  3649. /**
  3650. * ------------------------------------------------------------------------
  3651. * jQuery
  3652. * ------------------------------------------------------------------------
  3653. */
  3654. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3655. $.fn[NAME$4].Constructor = Dropdown;
  3656. $.fn[NAME$4].noConflict = function () {
  3657. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3658. return Dropdown._jQueryInterface;
  3659. };
  3660. /**
  3661. * ------------------------------------------------------------------------
  3662. * Constants
  3663. * ------------------------------------------------------------------------
  3664. */
  3665. var NAME$5 = 'modal';
  3666. var VERSION$5 = '4.5.0';
  3667. var DATA_KEY$5 = 'bs.modal';
  3668. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3669. var DATA_API_KEY$5 = '.data-api';
  3670. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3671. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3672. var Default$3 = {
  3673. backdrop: true,
  3674. keyboard: true,
  3675. focus: true,
  3676. show: true
  3677. };
  3678. var DefaultType$3 = {
  3679. backdrop: '(boolean|string)',
  3680. keyboard: 'boolean',
  3681. focus: 'boolean',
  3682. show: 'boolean'
  3683. };
  3684. var EVENT_HIDE$2 = "hide" + EVENT_KEY$5;
  3685. var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5;
  3686. var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5;
  3687. var EVENT_SHOW$2 = "show" + EVENT_KEY$5;
  3688. var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5;
  3689. var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5;
  3690. var EVENT_RESIZE = "resize" + EVENT_KEY$5;
  3691. var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY$5;
  3692. var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5;
  3693. var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5;
  3694. var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5;
  3695. var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$5 + DATA_API_KEY$5;
  3696. var CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable';
  3697. var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
  3698. var CLASS_NAME_BACKDROP = 'modal-backdrop';
  3699. var CLASS_NAME_OPEN = 'modal-open';
  3700. var CLASS_NAME_FADE$1 = 'fade';
  3701. var CLASS_NAME_SHOW$3 = 'show';
  3702. var CLASS_NAME_STATIC = 'modal-static';
  3703. var SELECTOR_DIALOG = '.modal-dialog';
  3704. var SELECTOR_MODAL_BODY = '.modal-body';
  3705. var SELECTOR_DATA_TOGGLE$3 = '[data-toggle="modal"]';
  3706. var SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]';
  3707. var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
  3708. var SELECTOR_STICKY_CONTENT = '.sticky-top';
  3709. /**
  3710. * ------------------------------------------------------------------------
  3711. * Class Definition
  3712. * ------------------------------------------------------------------------
  3713. */
  3714. var Modal = /*#__PURE__*/function () {
  3715. function Modal(element, config) {
  3716. this._config = this._getConfig(config);
  3717. this._element = element;
  3718. this._dialog = element.querySelector(SELECTOR_DIALOG);
  3719. this._backdrop = null;
  3720. this._isShown = false;
  3721. this._isBodyOverflowing = false;
  3722. this._ignoreBackdropClick = false;
  3723. this._isTransitioning = false;
  3724. this._scrollbarWidth = 0;
  3725. } // Getters
  3726. var _proto = Modal.prototype;
  3727. // Public
  3728. _proto.toggle = function toggle(relatedTarget) {
  3729. return this._isShown ? this.hide() : this.show(relatedTarget);
  3730. };
  3731. _proto.show = function show(relatedTarget) {
  3732. var _this = this;
  3733. if (this._isShown || this._isTransitioning) {
  3734. return;
  3735. }
  3736. if ($(this._element).hasClass(CLASS_NAME_FADE$1)) {
  3737. this._isTransitioning = true;
  3738. }
  3739. var showEvent = $.Event(EVENT_SHOW$2, {
  3740. relatedTarget: relatedTarget
  3741. });
  3742. $(this._element).trigger(showEvent);
  3743. if (this._isShown || showEvent.isDefaultPrevented()) {
  3744. return;
  3745. }
  3746. this._isShown = true;
  3747. this._checkScrollbar();
  3748. this._setScrollbar();
  3749. this._adjustDialog();
  3750. this._setEscapeEvent();
  3751. this._setResizeEvent();
  3752. $(this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
  3753. return _this.hide(event);
  3754. });
  3755. $(this._dialog).on(EVENT_MOUSEDOWN_DISMISS, function () {
  3756. $(_this._element).one(EVENT_MOUSEUP_DISMISS, function (event) {
  3757. if ($(event.target).is(_this._element)) {
  3758. _this._ignoreBackdropClick = true;
  3759. }
  3760. });
  3761. });
  3762. this._showBackdrop(function () {
  3763. return _this._showElement(relatedTarget);
  3764. });
  3765. };
  3766. _proto.hide = function hide(event) {
  3767. var _this2 = this;
  3768. if (event) {
  3769. event.preventDefault();
  3770. }
  3771. if (!this._isShown || this._isTransitioning) {
  3772. return;
  3773. }
  3774. var hideEvent = $.Event(EVENT_HIDE$2);
  3775. $(this._element).trigger(hideEvent);
  3776. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3777. return;
  3778. }
  3779. this._isShown = false;
  3780. var transition = $(this._element).hasClass(CLASS_NAME_FADE$1);
  3781. if (transition) {
  3782. this._isTransitioning = true;
  3783. }
  3784. this._setEscapeEvent();
  3785. this._setResizeEvent();
  3786. $(document).off(EVENT_FOCUSIN);
  3787. $(this._element).removeClass(CLASS_NAME_SHOW$3);
  3788. $(this._element).off(EVENT_CLICK_DISMISS);
  3789. $(this._dialog).off(EVENT_MOUSEDOWN_DISMISS);
  3790. if (transition) {
  3791. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3792. $(this._element).one(Util.TRANSITION_END, function (event) {
  3793. return _this2._hideModal(event);
  3794. }).emulateTransitionEnd(transitionDuration);
  3795. } else {
  3796. this._hideModal();
  3797. }
  3798. };
  3799. _proto.dispose = function dispose() {
  3800. [window, this._element, this._dialog].forEach(function (htmlElement) {
  3801. return $(htmlElement).off(EVENT_KEY$5);
  3802. });
  3803. /**
  3804. * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
  3805. * Do not move `document` in `htmlElements` array
  3806. * It will remove `EVENT_CLICK_DATA_API` event that should remain
  3807. */
  3808. $(document).off(EVENT_FOCUSIN);
  3809. $.removeData(this._element, DATA_KEY$5);
  3810. this._config = null;
  3811. this._element = null;
  3812. this._dialog = null;
  3813. this._backdrop = null;
  3814. this._isShown = null;
  3815. this._isBodyOverflowing = null;
  3816. this._ignoreBackdropClick = null;
  3817. this._isTransitioning = null;
  3818. this._scrollbarWidth = null;
  3819. };
  3820. _proto.handleUpdate = function handleUpdate() {
  3821. this._adjustDialog();
  3822. } // Private
  3823. ;
  3824. _proto._getConfig = function _getConfig(config) {
  3825. config = _objectSpread2(_objectSpread2({}, Default$3), config);
  3826. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  3827. return config;
  3828. };
  3829. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  3830. var _this3 = this;
  3831. if (this._config.backdrop === 'static') {
  3832. var hideEventPrevented = $.Event(EVENT_HIDE_PREVENTED);
  3833. $(this._element).trigger(hideEventPrevented);
  3834. if (hideEventPrevented.defaultPrevented) {
  3835. return;
  3836. }
  3837. this._element.classList.add(CLASS_NAME_STATIC);
  3838. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  3839. $(this._element).one(Util.TRANSITION_END, function () {
  3840. _this3._element.classList.remove(CLASS_NAME_STATIC);
  3841. }).emulateTransitionEnd(modalTransitionDuration);
  3842. this._element.focus();
  3843. } else {
  3844. this.hide();
  3845. }
  3846. };
  3847. _proto._showElement = function _showElement(relatedTarget) {
  3848. var _this4 = this;
  3849. var transition = $(this._element).hasClass(CLASS_NAME_FADE$1);
  3850. var modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null;
  3851. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  3852. // Don't move modal's DOM position
  3853. document.body.appendChild(this._element);
  3854. }
  3855. this._element.style.display = 'block';
  3856. this._element.removeAttribute('aria-hidden');
  3857. this._element.setAttribute('aria-modal', true);
  3858. if ($(this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) {
  3859. modalBody.scrollTop = 0;
  3860. } else {
  3861. this._element.scrollTop = 0;
  3862. }
  3863. if (transition) {
  3864. Util.reflow(this._element);
  3865. }
  3866. $(this._element).addClass(CLASS_NAME_SHOW$3);
  3867. if (this._config.focus) {
  3868. this._enforceFocus();
  3869. }
  3870. var shownEvent = $.Event(EVENT_SHOWN$2, {
  3871. relatedTarget: relatedTarget
  3872. });
  3873. var transitionComplete = function transitionComplete() {
  3874. if (_this4._config.focus) {
  3875. _this4._element.focus();
  3876. }
  3877. _this4._isTransitioning = false;
  3878. $(_this4._element).trigger(shownEvent);
  3879. };
  3880. if (transition) {
  3881. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3882. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  3883. } else {
  3884. transitionComplete();
  3885. }
  3886. };
  3887. _proto._enforceFocus = function _enforceFocus() {
  3888. var _this5 = this;
  3889. $(document).off(EVENT_FOCUSIN) // Guard against infinite focus loop
  3890. .on(EVENT_FOCUSIN, function (event) {
  3891. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  3892. _this5._element.focus();
  3893. }
  3894. });
  3895. };
  3896. _proto._setEscapeEvent = function _setEscapeEvent() {
  3897. var _this6 = this;
  3898. if (this._isShown) {
  3899. $(this._element).on(EVENT_KEYDOWN_DISMISS, function (event) {
  3900. if (_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) {
  3901. event.preventDefault();
  3902. _this6.hide();
  3903. } else if (!_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) {
  3904. _this6._triggerBackdropTransition();
  3905. }
  3906. });
  3907. } else if (!this._isShown) {
  3908. $(this._element).off(EVENT_KEYDOWN_DISMISS);
  3909. }
  3910. };
  3911. _proto._setResizeEvent = function _setResizeEvent() {
  3912. var _this7 = this;
  3913. if (this._isShown) {
  3914. $(window).on(EVENT_RESIZE, function (event) {
  3915. return _this7.handleUpdate(event);
  3916. });
  3917. } else {
  3918. $(window).off(EVENT_RESIZE);
  3919. }
  3920. };
  3921. _proto._hideModal = function _hideModal() {
  3922. var _this8 = this;
  3923. this._element.style.display = 'none';
  3924. this._element.setAttribute('aria-hidden', true);
  3925. this._element.removeAttribute('aria-modal');
  3926. this._isTransitioning = false;
  3927. this._showBackdrop(function () {
  3928. $(document.body).removeClass(CLASS_NAME_OPEN);
  3929. _this8._resetAdjustments();
  3930. _this8._resetScrollbar();
  3931. $(_this8._element).trigger(EVENT_HIDDEN$2);
  3932. });
  3933. };
  3934. _proto._removeBackdrop = function _removeBackdrop() {
  3935. if (this._backdrop) {
  3936. $(this._backdrop).remove();
  3937. this._backdrop = null;
  3938. }
  3939. };
  3940. _proto._showBackdrop = function _showBackdrop(callback) {
  3941. var _this9 = this;
  3942. var animate = $(this._element).hasClass(CLASS_NAME_FADE$1) ? CLASS_NAME_FADE$1 : '';
  3943. if (this._isShown && this._config.backdrop) {
  3944. this._backdrop = document.createElement('div');
  3945. this._backdrop.className = CLASS_NAME_BACKDROP;
  3946. if (animate) {
  3947. this._backdrop.classList.add(animate);
  3948. }
  3949. $(this._backdrop).appendTo(document.body);
  3950. $(this._element).on(EVENT_CLICK_DISMISS, function (event) {
  3951. if (_this9._ignoreBackdropClick) {
  3952. _this9._ignoreBackdropClick = false;
  3953. return;
  3954. }
  3955. if (event.target !== event.currentTarget) {
  3956. return;
  3957. }
  3958. _this9._triggerBackdropTransition();
  3959. });
  3960. if (animate) {
  3961. Util.reflow(this._backdrop);
  3962. }
  3963. $(this._backdrop).addClass(CLASS_NAME_SHOW$3);
  3964. if (!callback) {
  3965. return;
  3966. }
  3967. if (!animate) {
  3968. callback();
  3969. return;
  3970. }
  3971. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3972. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  3973. } else if (!this._isShown && this._backdrop) {
  3974. $(this._backdrop).removeClass(CLASS_NAME_SHOW$3);
  3975. var callbackRemove = function callbackRemove() {
  3976. _this9._removeBackdrop();
  3977. if (callback) {
  3978. callback();
  3979. }
  3980. };
  3981. if ($(this._element).hasClass(CLASS_NAME_FADE$1)) {
  3982. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3983. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  3984. } else {
  3985. callbackRemove();
  3986. }
  3987. } else if (callback) {
  3988. callback();
  3989. }
  3990. } // ----------------------------------------------------------------------
  3991. // the following methods are used to handle overflowing modals
  3992. // todo (fat): these should probably be refactored out of modal.js
  3993. // ----------------------------------------------------------------------
  3994. ;
  3995. _proto._adjustDialog = function _adjustDialog() {
  3996. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  3997. if (!this._isBodyOverflowing && isModalOverflowing) {
  3998. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  3999. }
  4000. if (this._isBodyOverflowing && !isModalOverflowing) {
  4001. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4002. }
  4003. };
  4004. _proto._resetAdjustments = function _resetAdjustments() {
  4005. this._element.style.paddingLeft = '';
  4006. this._element.style.paddingRight = '';
  4007. };
  4008. _proto._checkScrollbar = function _checkScrollbar() {
  4009. var rect = document.body.getBoundingClientRect();
  4010. this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
  4011. this._scrollbarWidth = this._getScrollbarWidth();
  4012. };
  4013. _proto._setScrollbar = function _setScrollbar() {
  4014. var _this10 = this;
  4015. if (this._isBodyOverflowing) {
  4016. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4017. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4018. var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
  4019. var stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT)); // Adjust fixed content padding
  4020. $(fixedContent).each(function (index, element) {
  4021. var actualPadding = element.style.paddingRight;
  4022. var calculatedPadding = $(element).css('padding-right');
  4023. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4024. }); // Adjust sticky content margin
  4025. $(stickyContent).each(function (index, element) {
  4026. var actualMargin = element.style.marginRight;
  4027. var calculatedMargin = $(element).css('margin-right');
  4028. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4029. }); // Adjust body padding
  4030. var actualPadding = document.body.style.paddingRight;
  4031. var calculatedPadding = $(document.body).css('padding-right');
  4032. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4033. }
  4034. $(document.body).addClass(CLASS_NAME_OPEN);
  4035. };
  4036. _proto._resetScrollbar = function _resetScrollbar() {
  4037. // Restore fixed content padding
  4038. var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
  4039. $(fixedContent).each(function (index, element) {
  4040. var padding = $(element).data('padding-right');
  4041. $(element).removeData('padding-right');
  4042. element.style.paddingRight = padding ? padding : '';
  4043. }); // Restore sticky content
  4044. var elements = [].slice.call(document.querySelectorAll("" + SELECTOR_STICKY_CONTENT));
  4045. $(elements).each(function (index, element) {
  4046. var margin = $(element).data('margin-right');
  4047. if (typeof margin !== 'undefined') {
  4048. $(element).css('margin-right', margin).removeData('margin-right');
  4049. }
  4050. }); // Restore body padding
  4051. var padding = $(document.body).data('padding-right');
  4052. $(document.body).removeData('padding-right');
  4053. document.body.style.paddingRight = padding ? padding : '';
  4054. };
  4055. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4056. // thx d.walsh
  4057. var scrollDiv = document.createElement('div');
  4058. scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
  4059. document.body.appendChild(scrollDiv);
  4060. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4061. document.body.removeChild(scrollDiv);
  4062. return scrollbarWidth;
  4063. } // Static
  4064. ;
  4065. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4066. return this.each(function () {
  4067. var data = $(this).data(DATA_KEY$5);
  4068. var _config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default$3), $(this).data()), typeof config === 'object' && config ? config : {});
  4069. if (!data) {
  4070. data = new Modal(this, _config);
  4071. $(this).data(DATA_KEY$5, data);
  4072. }
  4073. if (typeof config === 'string') {
  4074. if (typeof data[config] === 'undefined') {
  4075. throw new TypeError("No method named \"" + config + "\"");
  4076. }
  4077. data[config](relatedTarget);
  4078. } else if (_config.show) {
  4079. data.show(relatedTarget);
  4080. }
  4081. });
  4082. };
  4083. _createClass(Modal, null, [{
  4084. key: "VERSION",
  4085. get: function get() {
  4086. return VERSION$5;
  4087. }
  4088. }, {
  4089. key: "Default",
  4090. get: function get() {
  4091. return Default$3;
  4092. }
  4093. }]);
  4094. return Modal;
  4095. }();
  4096. /**
  4097. * ------------------------------------------------------------------------
  4098. * Data Api implementation
  4099. * ------------------------------------------------------------------------
  4100. */
  4101. $(document).on(EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, function (event) {
  4102. var _this11 = this;
  4103. var target;
  4104. var selector = Util.getSelectorFromElement(this);
  4105. if (selector) {
  4106. target = document.querySelector(selector);
  4107. }
  4108. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2(_objectSpread2({}, $(target).data()), $(this).data());
  4109. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4110. event.preventDefault();
  4111. }
  4112. var $target = $(target).one(EVENT_SHOW$2, function (showEvent) {
  4113. if (showEvent.isDefaultPrevented()) {
  4114. // Only register focus restorer if modal will actually get shown
  4115. return;
  4116. }
  4117. $target.one(EVENT_HIDDEN$2, function () {
  4118. if ($(_this11).is(':visible')) {
  4119. _this11.focus();
  4120. }
  4121. });
  4122. });
  4123. Modal._jQueryInterface.call($(target), config, this);
  4124. });
  4125. /**
  4126. * ------------------------------------------------------------------------
  4127. * jQuery
  4128. * ------------------------------------------------------------------------
  4129. */
  4130. $.fn[NAME$5] = Modal._jQueryInterface;
  4131. $.fn[NAME$5].Constructor = Modal;
  4132. $.fn[NAME$5].noConflict = function () {
  4133. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4134. return Modal._jQueryInterface;
  4135. };
  4136. /**
  4137. * --------------------------------------------------------------------------
  4138. * Bootstrap (v4.5.0): tools/sanitizer.js
  4139. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4140. * --------------------------------------------------------------------------
  4141. */
  4142. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4143. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4144. var DefaultWhitelist = {
  4145. // Global attributes allowed on any supplied element below.
  4146. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4147. a: ['target', 'href', 'title', 'rel'],
  4148. area: [],
  4149. b: [],
  4150. br: [],
  4151. col: [],
  4152. code: [],
  4153. div: [],
  4154. em: [],
  4155. hr: [],
  4156. h1: [],
  4157. h2: [],
  4158. h3: [],
  4159. h4: [],
  4160. h5: [],
  4161. h6: [],
  4162. i: [],
  4163. img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
  4164. li: [],
  4165. ol: [],
  4166. p: [],
  4167. pre: [],
  4168. s: [],
  4169. small: [],
  4170. span: [],
  4171. sub: [],
  4172. sup: [],
  4173. strong: [],
  4174. u: [],
  4175. ul: []
  4176. };
  4177. /**
  4178. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4179. *
  4180. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4181. */
  4182. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
  4183. /**
  4184. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4185. *
  4186. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4187. */
  4188. var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
  4189. function allowedAttribute(attr, allowedAttributeList) {
  4190. var attrName = attr.nodeName.toLowerCase();
  4191. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4192. if (uriAttrs.indexOf(attrName) !== -1) {
  4193. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4194. }
  4195. return true;
  4196. }
  4197. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4198. return attrRegex instanceof RegExp;
  4199. }); // Check if a regular expression validates the attribute.
  4200. for (var i = 0, len = regExp.length; i < len; i++) {
  4201. if (attrName.match(regExp[i])) {
  4202. return true;
  4203. }
  4204. }
  4205. return false;
  4206. }
  4207. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4208. if (unsafeHtml.length === 0) {
  4209. return unsafeHtml;
  4210. }
  4211. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4212. return sanitizeFn(unsafeHtml);
  4213. }
  4214. var domParser = new window.DOMParser();
  4215. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4216. var whitelistKeys = Object.keys(whiteList);
  4217. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4218. var _loop = function _loop(i, len) {
  4219. var el = elements[i];
  4220. var elName = el.nodeName.toLowerCase();
  4221. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4222. el.parentNode.removeChild(el);
  4223. return "continue";
  4224. }
  4225. var attributeList = [].slice.call(el.attributes);
  4226. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4227. attributeList.forEach(function (attr) {
  4228. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4229. el.removeAttribute(attr.nodeName);
  4230. }
  4231. });
  4232. };
  4233. for (var i = 0, len = elements.length; i < len; i++) {
  4234. var _ret = _loop(i);
  4235. if (_ret === "continue") continue;
  4236. }
  4237. return createdDocument.body.innerHTML;
  4238. }
  4239. /**
  4240. * ------------------------------------------------------------------------
  4241. * Constants
  4242. * ------------------------------------------------------------------------
  4243. */
  4244. var NAME$6 = 'tooltip';
  4245. var VERSION$6 = '4.5.0';
  4246. var DATA_KEY$6 = 'bs.tooltip';
  4247. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4248. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4249. var CLASS_PREFIX = 'bs-tooltip';
  4250. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4251. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4252. var DefaultType$4 = {
  4253. animation: 'boolean',
  4254. template: 'string',
  4255. title: '(string|element|function)',
  4256. trigger: 'string',
  4257. delay: '(number|object)',
  4258. html: 'boolean',
  4259. selector: '(string|boolean)',
  4260. placement: '(string|function)',
  4261. offset: '(number|string|function)',
  4262. container: '(string|element|boolean)',
  4263. fallbackPlacement: '(string|array)',
  4264. boundary: '(string|element)',
  4265. sanitize: 'boolean',
  4266. sanitizeFn: '(null|function)',
  4267. whiteList: 'object',
  4268. popperConfig: '(null|object)'
  4269. };
  4270. var AttachmentMap = {
  4271. AUTO: 'auto',
  4272. TOP: 'top',
  4273. RIGHT: 'right',
  4274. BOTTOM: 'bottom',
  4275. LEFT: 'left'
  4276. };
  4277. var Default$4 = {
  4278. animation: true,
  4279. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4280. trigger: 'hover focus',
  4281. title: '',
  4282. delay: 0,
  4283. html: false,
  4284. selector: false,
  4285. placement: 'top',
  4286. offset: 0,
  4287. container: false,
  4288. fallbackPlacement: 'flip',
  4289. boundary: 'scrollParent',
  4290. sanitize: true,
  4291. sanitizeFn: null,
  4292. whiteList: DefaultWhitelist,
  4293. popperConfig: null
  4294. };
  4295. var HOVER_STATE_SHOW = 'show';
  4296. var HOVER_STATE_OUT = 'out';
  4297. var Event = {
  4298. HIDE: "hide" + EVENT_KEY$6,
  4299. HIDDEN: "hidden" + EVENT_KEY$6,
  4300. SHOW: "show" + EVENT_KEY$6,
  4301. SHOWN: "shown" + EVENT_KEY$6,
  4302. INSERTED: "inserted" + EVENT_KEY$6,
  4303. CLICK: "click" + EVENT_KEY$6,
  4304. FOCUSIN: "focusin" + EVENT_KEY$6,
  4305. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4306. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4307. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4308. };
  4309. var CLASS_NAME_FADE$2 = 'fade';
  4310. var CLASS_NAME_SHOW$4 = 'show';
  4311. var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
  4312. var SELECTOR_ARROW = '.arrow';
  4313. var TRIGGER_HOVER = 'hover';
  4314. var TRIGGER_FOCUS = 'focus';
  4315. var TRIGGER_CLICK = 'click';
  4316. var TRIGGER_MANUAL = 'manual';
  4317. /**
  4318. * ------------------------------------------------------------------------
  4319. * Class Definition
  4320. * ------------------------------------------------------------------------
  4321. */
  4322. var Tooltip = /*#__PURE__*/function () {
  4323. function Tooltip(element, config) {
  4324. if (typeof Popper === 'undefined') {
  4325. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4326. } // private
  4327. this._isEnabled = true;
  4328. this._timeout = 0;
  4329. this._hoverState = '';
  4330. this._activeTrigger = {};
  4331. this._popper = null; // Protected
  4332. this.element = element;
  4333. this.config = this._getConfig(config);
  4334. this.tip = null;
  4335. this._setListeners();
  4336. } // Getters
  4337. var _proto = Tooltip.prototype;
  4338. // Public
  4339. _proto.enable = function enable() {
  4340. this._isEnabled = true;
  4341. };
  4342. _proto.disable = function disable() {
  4343. this._isEnabled = false;
  4344. };
  4345. _proto.toggleEnabled = function toggleEnabled() {
  4346. this._isEnabled = !this._isEnabled;
  4347. };
  4348. _proto.toggle = function toggle(event) {
  4349. if (!this._isEnabled) {
  4350. return;
  4351. }
  4352. if (event) {
  4353. var dataKey = this.constructor.DATA_KEY;
  4354. var context = $(event.currentTarget).data(dataKey);
  4355. if (!context) {
  4356. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4357. $(event.currentTarget).data(dataKey, context);
  4358. }
  4359. context._activeTrigger.click = !context._activeTrigger.click;
  4360. if (context._isWithActiveTrigger()) {
  4361. context._enter(null, context);
  4362. } else {
  4363. context._leave(null, context);
  4364. }
  4365. } else {
  4366. if ($(this.getTipElement()).hasClass(CLASS_NAME_SHOW$4)) {
  4367. this._leave(null, this);
  4368. return;
  4369. }
  4370. this._enter(null, this);
  4371. }
  4372. };
  4373. _proto.dispose = function dispose() {
  4374. clearTimeout(this._timeout);
  4375. $.removeData(this.element, this.constructor.DATA_KEY);
  4376. $(this.element).off(this.constructor.EVENT_KEY);
  4377. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4378. if (this.tip) {
  4379. $(this.tip).remove();
  4380. }
  4381. this._isEnabled = null;
  4382. this._timeout = null;
  4383. this._hoverState = null;
  4384. this._activeTrigger = null;
  4385. if (this._popper) {
  4386. this._popper.destroy();
  4387. }
  4388. this._popper = null;
  4389. this.element = null;
  4390. this.config = null;
  4391. this.tip = null;
  4392. };
  4393. _proto.show = function show() {
  4394. var _this = this;
  4395. if ($(this.element).css('display') === 'none') {
  4396. throw new Error('Please use show on visible elements');
  4397. }
  4398. var showEvent = $.Event(this.constructor.Event.SHOW);
  4399. if (this.isWithContent() && this._isEnabled) {
  4400. $(this.element).trigger(showEvent);
  4401. var shadowRoot = Util.findShadowRoot(this.element);
  4402. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4403. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4404. return;
  4405. }
  4406. var tip = this.getTipElement();
  4407. var tipId = Util.getUID(this.constructor.NAME);
  4408. tip.setAttribute('id', tipId);
  4409. this.element.setAttribute('aria-describedby', tipId);
  4410. this.setContent();
  4411. if (this.config.animation) {
  4412. $(tip).addClass(CLASS_NAME_FADE$2);
  4413. }
  4414. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4415. var attachment = this._getAttachment(placement);
  4416. this.addAttachmentClass(attachment);
  4417. var container = this._getContainer();
  4418. $(tip).data(this.constructor.DATA_KEY, this);
  4419. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4420. $(tip).appendTo(container);
  4421. }
  4422. $(this.element).trigger(this.constructor.Event.INSERTED);
  4423. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4424. $(tip).addClass(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we add extra
  4425. // empty mouseover listeners to the body's immediate children;
  4426. // only needed because of broken event delegation on iOS
  4427. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4428. if ('ontouchstart' in document.documentElement) {
  4429. $(document.body).children().on('mouseover', null, $.noop);
  4430. }
  4431. var complete = function complete() {
  4432. if (_this.config.animation) {
  4433. _this._fixTransition();
  4434. }
  4435. var prevHoverState = _this._hoverState;
  4436. _this._hoverState = null;
  4437. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4438. if (prevHoverState === HOVER_STATE_OUT) {
  4439. _this._leave(null, _this);
  4440. }
  4441. };
  4442. if ($(this.tip).hasClass(CLASS_NAME_FADE$2)) {
  4443. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4444. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4445. } else {
  4446. complete();
  4447. }
  4448. }
  4449. };
  4450. _proto.hide = function hide(callback) {
  4451. var _this2 = this;
  4452. var tip = this.getTipElement();
  4453. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4454. var complete = function complete() {
  4455. if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
  4456. tip.parentNode.removeChild(tip);
  4457. }
  4458. _this2._cleanTipClass();
  4459. _this2.element.removeAttribute('aria-describedby');
  4460. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4461. if (_this2._popper !== null) {
  4462. _this2._popper.destroy();
  4463. }
  4464. if (callback) {
  4465. callback();
  4466. }
  4467. };
  4468. $(this.element).trigger(hideEvent);
  4469. if (hideEvent.isDefaultPrevented()) {
  4470. return;
  4471. }
  4472. $(tip).removeClass(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we remove the extra
  4473. // empty mouseover listeners we added for iOS support
  4474. if ('ontouchstart' in document.documentElement) {
  4475. $(document.body).children().off('mouseover', null, $.noop);
  4476. }
  4477. this._activeTrigger[TRIGGER_CLICK] = false;
  4478. this._activeTrigger[TRIGGER_FOCUS] = false;
  4479. this._activeTrigger[TRIGGER_HOVER] = false;
  4480. if ($(this.tip).hasClass(CLASS_NAME_FADE$2)) {
  4481. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4482. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4483. } else {
  4484. complete();
  4485. }
  4486. this._hoverState = '';
  4487. };
  4488. _proto.update = function update() {
  4489. if (this._popper !== null) {
  4490. this._popper.scheduleUpdate();
  4491. }
  4492. } // Protected
  4493. ;
  4494. _proto.isWithContent = function isWithContent() {
  4495. return Boolean(this.getTitle());
  4496. };
  4497. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4498. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4499. };
  4500. _proto.getTipElement = function getTipElement() {
  4501. this.tip = this.tip || $(this.config.template)[0];
  4502. return this.tip;
  4503. };
  4504. _proto.setContent = function setContent() {
  4505. var tip = this.getTipElement();
  4506. this.setElementContent($(tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle());
  4507. $(tip).removeClass(CLASS_NAME_FADE$2 + " " + CLASS_NAME_SHOW$4);
  4508. };
  4509. _proto.setElementContent = function setElementContent($element, content) {
  4510. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4511. // Content is a DOM node or a jQuery
  4512. if (this.config.html) {
  4513. if (!$(content).parent().is($element)) {
  4514. $element.empty().append(content);
  4515. }
  4516. } else {
  4517. $element.text($(content).text());
  4518. }
  4519. return;
  4520. }
  4521. if (this.config.html) {
  4522. if (this.config.sanitize) {
  4523. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4524. }
  4525. $element.html(content);
  4526. } else {
  4527. $element.text(content);
  4528. }
  4529. };
  4530. _proto.getTitle = function getTitle() {
  4531. var title = this.element.getAttribute('data-original-title');
  4532. if (!title) {
  4533. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4534. }
  4535. return title;
  4536. } // Private
  4537. ;
  4538. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4539. var _this3 = this;
  4540. var defaultBsConfig = {
  4541. placement: attachment,
  4542. modifiers: {
  4543. offset: this._getOffset(),
  4544. flip: {
  4545. behavior: this.config.fallbackPlacement
  4546. },
  4547. arrow: {
  4548. element: SELECTOR_ARROW
  4549. },
  4550. preventOverflow: {
  4551. boundariesElement: this.config.boundary
  4552. }
  4553. },
  4554. onCreate: function onCreate(data) {
  4555. if (data.originalPlacement !== data.placement) {
  4556. _this3._handlePopperPlacementChange(data);
  4557. }
  4558. },
  4559. onUpdate: function onUpdate(data) {
  4560. return _this3._handlePopperPlacementChange(data);
  4561. }
  4562. };
  4563. return _objectSpread2(_objectSpread2({}, defaultBsConfig), this.config.popperConfig);
  4564. };
  4565. _proto._getOffset = function _getOffset() {
  4566. var _this4 = this;
  4567. var offset = {};
  4568. if (typeof this.config.offset === 'function') {
  4569. offset.fn = function (data) {
  4570. data.offsets = _objectSpread2(_objectSpread2({}, data.offsets), _this4.config.offset(data.offsets, _this4.element) || {});
  4571. return data;
  4572. };
  4573. } else {
  4574. offset.offset = this.config.offset;
  4575. }
  4576. return offset;
  4577. };
  4578. _proto._getContainer = function _getContainer() {
  4579. if (this.config.container === false) {
  4580. return document.body;
  4581. }
  4582. if (Util.isElement(this.config.container)) {
  4583. return $(this.config.container);
  4584. }
  4585. return $(document).find(this.config.container);
  4586. };
  4587. _proto._getAttachment = function _getAttachment(placement) {
  4588. return AttachmentMap[placement.toUpperCase()];
  4589. };
  4590. _proto._setListeners = function _setListeners() {
  4591. var _this5 = this;
  4592. var triggers = this.config.trigger.split(' ');
  4593. triggers.forEach(function (trigger) {
  4594. if (trigger === 'click') {
  4595. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4596. return _this5.toggle(event);
  4597. });
  4598. } else if (trigger !== TRIGGER_MANUAL) {
  4599. var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4600. var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4601. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4602. return _this5._enter(event);
  4603. }).on(eventOut, _this5.config.selector, function (event) {
  4604. return _this5._leave(event);
  4605. });
  4606. }
  4607. });
  4608. this._hideModalHandler = function () {
  4609. if (_this5.element) {
  4610. _this5.hide();
  4611. }
  4612. };
  4613. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4614. if (this.config.selector) {
  4615. this.config = _objectSpread2(_objectSpread2({}, this.config), {}, {
  4616. trigger: 'manual',
  4617. selector: ''
  4618. });
  4619. } else {
  4620. this._fixTitle();
  4621. }
  4622. };
  4623. _proto._fixTitle = function _fixTitle() {
  4624. var titleType = typeof this.element.getAttribute('data-original-title');
  4625. if (this.element.getAttribute('title') || titleType !== 'string') {
  4626. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4627. this.element.setAttribute('title', '');
  4628. }
  4629. };
  4630. _proto._enter = function _enter(event, context) {
  4631. var dataKey = this.constructor.DATA_KEY;
  4632. context = context || $(event.currentTarget).data(dataKey);
  4633. if (!context) {
  4634. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4635. $(event.currentTarget).data(dataKey, context);
  4636. }
  4637. if (event) {
  4638. context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
  4639. }
  4640. if ($(context.getTipElement()).hasClass(CLASS_NAME_SHOW$4) || context._hoverState === HOVER_STATE_SHOW) {
  4641. context._hoverState = HOVER_STATE_SHOW;
  4642. return;
  4643. }
  4644. clearTimeout(context._timeout);
  4645. context._hoverState = HOVER_STATE_SHOW;
  4646. if (!context.config.delay || !context.config.delay.show) {
  4647. context.show();
  4648. return;
  4649. }
  4650. context._timeout = setTimeout(function () {
  4651. if (context._hoverState === HOVER_STATE_SHOW) {
  4652. context.show();
  4653. }
  4654. }, context.config.delay.show);
  4655. };
  4656. _proto._leave = function _leave(event, context) {
  4657. var dataKey = this.constructor.DATA_KEY;
  4658. context = context || $(event.currentTarget).data(dataKey);
  4659. if (!context) {
  4660. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4661. $(event.currentTarget).data(dataKey, context);
  4662. }
  4663. if (event) {
  4664. context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
  4665. }
  4666. if (context._isWithActiveTrigger()) {
  4667. return;
  4668. }
  4669. clearTimeout(context._timeout);
  4670. context._hoverState = HOVER_STATE_OUT;
  4671. if (!context.config.delay || !context.config.delay.hide) {
  4672. context.hide();
  4673. return;
  4674. }
  4675. context._timeout = setTimeout(function () {
  4676. if (context._hoverState === HOVER_STATE_OUT) {
  4677. context.hide();
  4678. }
  4679. }, context.config.delay.hide);
  4680. };
  4681. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4682. for (var trigger in this._activeTrigger) {
  4683. if (this._activeTrigger[trigger]) {
  4684. return true;
  4685. }
  4686. }
  4687. return false;
  4688. };
  4689. _proto._getConfig = function _getConfig(config) {
  4690. var dataAttributes = $(this.element).data();
  4691. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4692. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4693. delete dataAttributes[dataAttr];
  4694. }
  4695. });
  4696. config = _objectSpread2(_objectSpread2(_objectSpread2({}, this.constructor.Default), dataAttributes), typeof config === 'object' && config ? config : {});
  4697. if (typeof config.delay === 'number') {
  4698. config.delay = {
  4699. show: config.delay,
  4700. hide: config.delay
  4701. };
  4702. }
  4703. if (typeof config.title === 'number') {
  4704. config.title = config.title.toString();
  4705. }
  4706. if (typeof config.content === 'number') {
  4707. config.content = config.content.toString();
  4708. }
  4709. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4710. if (config.sanitize) {
  4711. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4712. }
  4713. return config;
  4714. };
  4715. _proto._getDelegateConfig = function _getDelegateConfig() {
  4716. var config = {};
  4717. if (this.config) {
  4718. for (var key in this.config) {
  4719. if (this.constructor.Default[key] !== this.config[key]) {
  4720. config[key] = this.config[key];
  4721. }
  4722. }
  4723. }
  4724. return config;
  4725. };
  4726. _proto._cleanTipClass = function _cleanTipClass() {
  4727. var $tip = $(this.getTipElement());
  4728. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4729. if (tabClass !== null && tabClass.length) {
  4730. $tip.removeClass(tabClass.join(''));
  4731. }
  4732. };
  4733. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4734. this.tip = popperData.instance.popper;
  4735. this._cleanTipClass();
  4736. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4737. };
  4738. _proto._fixTransition = function _fixTransition() {
  4739. var tip = this.getTipElement();
  4740. var initConfigAnimation = this.config.animation;
  4741. if (tip.getAttribute('x-placement') !== null) {
  4742. return;
  4743. }
  4744. $(tip).removeClass(CLASS_NAME_FADE$2);
  4745. this.config.animation = false;
  4746. this.hide();
  4747. this.show();
  4748. this.config.animation = initConfigAnimation;
  4749. } // Static
  4750. ;
  4751. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4752. return this.each(function () {
  4753. var data = $(this).data(DATA_KEY$6);
  4754. var _config = typeof config === 'object' && config;
  4755. if (!data && /dispose|hide/.test(config)) {
  4756. return;
  4757. }
  4758. if (!data) {
  4759. data = new Tooltip(this, _config);
  4760. $(this).data(DATA_KEY$6, data);
  4761. }
  4762. if (typeof config === 'string') {
  4763. if (typeof data[config] === 'undefined') {
  4764. throw new TypeError("No method named \"" + config + "\"");
  4765. }
  4766. data[config]();
  4767. }
  4768. });
  4769. };
  4770. _createClass(Tooltip, null, [{
  4771. key: "VERSION",
  4772. get: function get() {
  4773. return VERSION$6;
  4774. }
  4775. }, {
  4776. key: "Default",
  4777. get: function get() {
  4778. return Default$4;
  4779. }
  4780. }, {
  4781. key: "NAME",
  4782. get: function get() {
  4783. return NAME$6;
  4784. }
  4785. }, {
  4786. key: "DATA_KEY",
  4787. get: function get() {
  4788. return DATA_KEY$6;
  4789. }
  4790. }, {
  4791. key: "Event",
  4792. get: function get() {
  4793. return Event;
  4794. }
  4795. }, {
  4796. key: "EVENT_KEY",
  4797. get: function get() {
  4798. return EVENT_KEY$6;
  4799. }
  4800. }, {
  4801. key: "DefaultType",
  4802. get: function get() {
  4803. return DefaultType$4;
  4804. }
  4805. }]);
  4806. return Tooltip;
  4807. }();
  4808. /**
  4809. * ------------------------------------------------------------------------
  4810. * jQuery
  4811. * ------------------------------------------------------------------------
  4812. */
  4813. $.fn[NAME$6] = Tooltip._jQueryInterface;
  4814. $.fn[NAME$6].Constructor = Tooltip;
  4815. $.fn[NAME$6].noConflict = function () {
  4816. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  4817. return Tooltip._jQueryInterface;
  4818. };
  4819. /**
  4820. * ------------------------------------------------------------------------
  4821. * Constants
  4822. * ------------------------------------------------------------------------
  4823. */
  4824. var NAME$7 = 'popover';
  4825. var VERSION$7 = '4.5.0';
  4826. var DATA_KEY$7 = 'bs.popover';
  4827. var EVENT_KEY$7 = "." + DATA_KEY$7;
  4828. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  4829. var CLASS_PREFIX$1 = 'bs-popover';
  4830. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  4831. var Default$5 = _objectSpread2(_objectSpread2({}, Tooltip.Default), {}, {
  4832. placement: 'right',
  4833. trigger: 'click',
  4834. content: '',
  4835. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  4836. });
  4837. var DefaultType$5 = _objectSpread2(_objectSpread2({}, Tooltip.DefaultType), {}, {
  4838. content: '(string|element|function)'
  4839. });
  4840. var CLASS_NAME_FADE$3 = 'fade';
  4841. var CLASS_NAME_SHOW$5 = 'show';
  4842. var SELECTOR_TITLE = '.popover-header';
  4843. var SELECTOR_CONTENT = '.popover-body';
  4844. var Event$1 = {
  4845. HIDE: "hide" + EVENT_KEY$7,
  4846. HIDDEN: "hidden" + EVENT_KEY$7,
  4847. SHOW: "show" + EVENT_KEY$7,
  4848. SHOWN: "shown" + EVENT_KEY$7,
  4849. INSERTED: "inserted" + EVENT_KEY$7,
  4850. CLICK: "click" + EVENT_KEY$7,
  4851. FOCUSIN: "focusin" + EVENT_KEY$7,
  4852. FOCUSOUT: "focusout" + EVENT_KEY$7,
  4853. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  4854. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  4855. };
  4856. /**
  4857. * ------------------------------------------------------------------------
  4858. * Class Definition
  4859. * ------------------------------------------------------------------------
  4860. */
  4861. var Popover = /*#__PURE__*/function (_Tooltip) {
  4862. _inheritsLoose(Popover, _Tooltip);
  4863. function Popover() {
  4864. return _Tooltip.apply(this, arguments) || this;
  4865. }
  4866. var _proto = Popover.prototype;
  4867. // Overrides
  4868. _proto.isWithContent = function isWithContent() {
  4869. return this.getTitle() || this._getContent();
  4870. };
  4871. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4872. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  4873. };
  4874. _proto.getTipElement = function getTipElement() {
  4875. this.tip = this.tip || $(this.config.template)[0];
  4876. return this.tip;
  4877. };
  4878. _proto.setContent = function setContent() {
  4879. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  4880. this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle());
  4881. var content = this._getContent();
  4882. if (typeof content === 'function') {
  4883. content = content.call(this.element);
  4884. }
  4885. this.setElementContent($tip.find(SELECTOR_CONTENT), content);
  4886. $tip.removeClass(CLASS_NAME_FADE$3 + " " + CLASS_NAME_SHOW$5);
  4887. } // Private
  4888. ;
  4889. _proto._getContent = function _getContent() {
  4890. return this.element.getAttribute('data-content') || this.config.content;
  4891. };
  4892. _proto._cleanTipClass = function _cleanTipClass() {
  4893. var $tip = $(this.getTipElement());
  4894. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  4895. if (tabClass !== null && tabClass.length > 0) {
  4896. $tip.removeClass(tabClass.join(''));
  4897. }
  4898. } // Static
  4899. ;
  4900. Popover._jQueryInterface = function _jQueryInterface(config) {
  4901. return this.each(function () {
  4902. var data = $(this).data(DATA_KEY$7);
  4903. var _config = typeof config === 'object' ? config : null;
  4904. if (!data && /dispose|hide/.test(config)) {
  4905. return;
  4906. }
  4907. if (!data) {
  4908. data = new Popover(this, _config);
  4909. $(this).data(DATA_KEY$7, data);
  4910. }
  4911. if (typeof config === 'string') {
  4912. if (typeof data[config] === 'undefined') {
  4913. throw new TypeError("No method named \"" + config + "\"");
  4914. }
  4915. data[config]();
  4916. }
  4917. });
  4918. };
  4919. _createClass(Popover, null, [{
  4920. key: "VERSION",
  4921. // Getters
  4922. get: function get() {
  4923. return VERSION$7;
  4924. }
  4925. }, {
  4926. key: "Default",
  4927. get: function get() {
  4928. return Default$5;
  4929. }
  4930. }, {
  4931. key: "NAME",
  4932. get: function get() {
  4933. return NAME$7;
  4934. }
  4935. }, {
  4936. key: "DATA_KEY",
  4937. get: function get() {
  4938. return DATA_KEY$7;
  4939. }
  4940. }, {
  4941. key: "Event",
  4942. get: function get() {
  4943. return Event$1;
  4944. }
  4945. }, {
  4946. key: "EVENT_KEY",
  4947. get: function get() {
  4948. return EVENT_KEY$7;
  4949. }
  4950. }, {
  4951. key: "DefaultType",
  4952. get: function get() {
  4953. return DefaultType$5;
  4954. }
  4955. }]);
  4956. return Popover;
  4957. }(Tooltip);
  4958. /**
  4959. * ------------------------------------------------------------------------
  4960. * jQuery
  4961. * ------------------------------------------------------------------------
  4962. */
  4963. $.fn[NAME$7] = Popover._jQueryInterface;
  4964. $.fn[NAME$7].Constructor = Popover;
  4965. $.fn[NAME$7].noConflict = function () {
  4966. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  4967. return Popover._jQueryInterface;
  4968. };
  4969. /**
  4970. * ------------------------------------------------------------------------
  4971. * Constants
  4972. * ------------------------------------------------------------------------
  4973. */
  4974. var NAME$8 = 'scrollspy';
  4975. var VERSION$8 = '4.5.0';
  4976. var DATA_KEY$8 = 'bs.scrollspy';
  4977. var EVENT_KEY$8 = "." + DATA_KEY$8;
  4978. var DATA_API_KEY$6 = '.data-api';
  4979. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  4980. var Default$6 = {
  4981. offset: 10,
  4982. method: 'auto',
  4983. target: ''
  4984. };
  4985. var DefaultType$6 = {
  4986. offset: 'number',
  4987. method: 'string',
  4988. target: '(string|element)'
  4989. };
  4990. var EVENT_ACTIVATE = "activate" + EVENT_KEY$8;
  4991. var EVENT_SCROLL = "scroll" + EVENT_KEY$8;
  4992. var EVENT_LOAD_DATA_API$2 = "load" + EVENT_KEY$8 + DATA_API_KEY$6;
  4993. var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
  4994. var CLASS_NAME_ACTIVE$2 = 'active';
  4995. var SELECTOR_DATA_SPY = '[data-spy="scroll"]';
  4996. var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
  4997. var SELECTOR_NAV_LINKS = '.nav-link';
  4998. var SELECTOR_NAV_ITEMS = '.nav-item';
  4999. var SELECTOR_LIST_ITEMS = '.list-group-item';
  5000. var SELECTOR_DROPDOWN = '.dropdown';
  5001. var SELECTOR_DROPDOWN_ITEMS = '.dropdown-item';
  5002. var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
  5003. var METHOD_OFFSET = 'offset';
  5004. var METHOD_POSITION = 'position';
  5005. /**
  5006. * ------------------------------------------------------------------------
  5007. * Class Definition
  5008. * ------------------------------------------------------------------------
  5009. */
  5010. var ScrollSpy = /*#__PURE__*/function () {
  5011. function ScrollSpy(element, config) {
  5012. var _this = this;
  5013. this._element = element;
  5014. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5015. this._config = this._getConfig(config);
  5016. this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " " + SELECTOR_DROPDOWN_ITEMS);
  5017. this._offsets = [];
  5018. this._targets = [];
  5019. this._activeTarget = null;
  5020. this._scrollHeight = 0;
  5021. $(this._scrollElement).on(EVENT_SCROLL, function (event) {
  5022. return _this._process(event);
  5023. });
  5024. this.refresh();
  5025. this._process();
  5026. } // Getters
  5027. var _proto = ScrollSpy.prototype;
  5028. // Public
  5029. _proto.refresh = function refresh() {
  5030. var _this2 = this;
  5031. var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
  5032. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5033. var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
  5034. this._offsets = [];
  5035. this._targets = [];
  5036. this._scrollHeight = this._getScrollHeight();
  5037. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5038. targets.map(function (element) {
  5039. var target;
  5040. var targetSelector = Util.getSelectorFromElement(element);
  5041. if (targetSelector) {
  5042. target = document.querySelector(targetSelector);
  5043. }
  5044. if (target) {
  5045. var targetBCR = target.getBoundingClientRect();
  5046. if (targetBCR.width || targetBCR.height) {
  5047. // TODO (fat): remove sketch reliance on jQuery position/offset
  5048. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5049. }
  5050. }
  5051. return null;
  5052. }).filter(function (item) {
  5053. return item;
  5054. }).sort(function (a, b) {
  5055. return a[0] - b[0];
  5056. }).forEach(function (item) {
  5057. _this2._offsets.push(item[0]);
  5058. _this2._targets.push(item[1]);
  5059. });
  5060. };
  5061. _proto.dispose = function dispose() {
  5062. $.removeData(this._element, DATA_KEY$8);
  5063. $(this._scrollElement).off(EVENT_KEY$8);
  5064. this._element = null;
  5065. this._scrollElement = null;
  5066. this._config = null;
  5067. this._selector = null;
  5068. this._offsets = null;
  5069. this._targets = null;
  5070. this._activeTarget = null;
  5071. this._scrollHeight = null;
  5072. } // Private
  5073. ;
  5074. _proto._getConfig = function _getConfig(config) {
  5075. config = _objectSpread2(_objectSpread2({}, Default$6), typeof config === 'object' && config ? config : {});
  5076. if (typeof config.target !== 'string' && Util.isElement(config.target)) {
  5077. var id = $(config.target).attr('id');
  5078. if (!id) {
  5079. id = Util.getUID(NAME$8);
  5080. $(config.target).attr('id', id);
  5081. }
  5082. config.target = "#" + id;
  5083. }
  5084. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5085. return config;
  5086. };
  5087. _proto._getScrollTop = function _getScrollTop() {
  5088. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5089. };
  5090. _proto._getScrollHeight = function _getScrollHeight() {
  5091. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5092. };
  5093. _proto._getOffsetHeight = function _getOffsetHeight() {
  5094. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5095. };
  5096. _proto._process = function _process() {
  5097. var scrollTop = this._getScrollTop() + this._config.offset;
  5098. var scrollHeight = this._getScrollHeight();
  5099. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5100. if (this._scrollHeight !== scrollHeight) {
  5101. this.refresh();
  5102. }
  5103. if (scrollTop >= maxScroll) {
  5104. var target = this._targets[this._targets.length - 1];
  5105. if (this._activeTarget !== target) {
  5106. this._activate(target);
  5107. }
  5108. return;
  5109. }
  5110. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5111. this._activeTarget = null;
  5112. this._clear();
  5113. return;
  5114. }
  5115. for (var i = this._offsets.length; i--;) {
  5116. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5117. if (isActiveTarget) {
  5118. this._activate(this._targets[i]);
  5119. }
  5120. }
  5121. };
  5122. _proto._activate = function _activate(target) {
  5123. this._activeTarget = target;
  5124. this._clear();
  5125. var queries = this._selector.split(',').map(function (selector) {
  5126. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5127. });
  5128. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5129. if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) {
  5130. $link.closest(SELECTOR_DROPDOWN).find(SELECTOR_DROPDOWN_TOGGLE).addClass(CLASS_NAME_ACTIVE$2);
  5131. $link.addClass(CLASS_NAME_ACTIVE$2);
  5132. } else {
  5133. // Set triggered link as active
  5134. $link.addClass(CLASS_NAME_ACTIVE$2); // Set triggered links parents as active
  5135. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5136. $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).addClass(CLASS_NAME_ACTIVE$2); // Handle special case when .nav-link is inside .nav-item
  5137. $link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_ITEMS).children(SELECTOR_NAV_LINKS).addClass(CLASS_NAME_ACTIVE$2);
  5138. }
  5139. $(this._scrollElement).trigger(EVENT_ACTIVATE, {
  5140. relatedTarget: target
  5141. });
  5142. };
  5143. _proto._clear = function _clear() {
  5144. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5145. return node.classList.contains(CLASS_NAME_ACTIVE$2);
  5146. }).forEach(function (node) {
  5147. return node.classList.remove(CLASS_NAME_ACTIVE$2);
  5148. });
  5149. } // Static
  5150. ;
  5151. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5152. return this.each(function () {
  5153. var data = $(this).data(DATA_KEY$8);
  5154. var _config = typeof config === 'object' && config;
  5155. if (!data) {
  5156. data = new ScrollSpy(this, _config);
  5157. $(this).data(DATA_KEY$8, data);
  5158. }
  5159. if (typeof config === 'string') {
  5160. if (typeof data[config] === 'undefined') {
  5161. throw new TypeError("No method named \"" + config + "\"");
  5162. }
  5163. data[config]();
  5164. }
  5165. });
  5166. };
  5167. _createClass(ScrollSpy, null, [{
  5168. key: "VERSION",
  5169. get: function get() {
  5170. return VERSION$8;
  5171. }
  5172. }, {
  5173. key: "Default",
  5174. get: function get() {
  5175. return Default$6;
  5176. }
  5177. }]);
  5178. return ScrollSpy;
  5179. }();
  5180. /**
  5181. * ------------------------------------------------------------------------
  5182. * Data Api implementation
  5183. * ------------------------------------------------------------------------
  5184. */
  5185. $(window).on(EVENT_LOAD_DATA_API$2, function () {
  5186. var scrollSpys = [].slice.call(document.querySelectorAll(SELECTOR_DATA_SPY));
  5187. var scrollSpysLength = scrollSpys.length;
  5188. for (var i = scrollSpysLength; i--;) {
  5189. var $spy = $(scrollSpys[i]);
  5190. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5191. }
  5192. });
  5193. /**
  5194. * ------------------------------------------------------------------------
  5195. * jQuery
  5196. * ------------------------------------------------------------------------
  5197. */
  5198. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5199. $.fn[NAME$8].Constructor = ScrollSpy;
  5200. $.fn[NAME$8].noConflict = function () {
  5201. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5202. return ScrollSpy._jQueryInterface;
  5203. };
  5204. /**
  5205. * ------------------------------------------------------------------------
  5206. * Constants
  5207. * ------------------------------------------------------------------------
  5208. */
  5209. var NAME$9 = 'tab';
  5210. var VERSION$9 = '4.5.0';
  5211. var DATA_KEY$9 = 'bs.tab';
  5212. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5213. var DATA_API_KEY$7 = '.data-api';
  5214. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5215. var EVENT_HIDE$3 = "hide" + EVENT_KEY$9;
  5216. var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$9;
  5217. var EVENT_SHOW$3 = "show" + EVENT_KEY$9;
  5218. var EVENT_SHOWN$3 = "shown" + EVENT_KEY$9;
  5219. var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$9 + DATA_API_KEY$7;
  5220. var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
  5221. var CLASS_NAME_ACTIVE$3 = 'active';
  5222. var CLASS_NAME_DISABLED$1 = 'disabled';
  5223. var CLASS_NAME_FADE$4 = 'fade';
  5224. var CLASS_NAME_SHOW$6 = 'show';
  5225. var SELECTOR_DROPDOWN$1 = '.dropdown';
  5226. var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
  5227. var SELECTOR_ACTIVE$2 = '.active';
  5228. var SELECTOR_ACTIVE_UL = '> li > .active';
  5229. var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]';
  5230. var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
  5231. var SELECTOR_DROPDOWN_ACTIVE_CHILD = '> .dropdown-menu .active';
  5232. /**
  5233. * ------------------------------------------------------------------------
  5234. * Class Definition
  5235. * ------------------------------------------------------------------------
  5236. */
  5237. var Tab = /*#__PURE__*/function () {
  5238. function Tab(element) {
  5239. this._element = element;
  5240. } // Getters
  5241. var _proto = Tab.prototype;
  5242. // Public
  5243. _proto.show = function show() {
  5244. var _this = this;
  5245. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(CLASS_NAME_ACTIVE$3) || $(this._element).hasClass(CLASS_NAME_DISABLED$1)) {
  5246. return;
  5247. }
  5248. var target;
  5249. var previous;
  5250. var listElement = $(this._element).closest(SELECTOR_NAV_LIST_GROUP$1)[0];
  5251. var selector = Util.getSelectorFromElement(this._element);
  5252. if (listElement) {
  5253. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$2;
  5254. previous = $.makeArray($(listElement).find(itemSelector));
  5255. previous = previous[previous.length - 1];
  5256. }
  5257. var hideEvent = $.Event(EVENT_HIDE$3, {
  5258. relatedTarget: this._element
  5259. });
  5260. var showEvent = $.Event(EVENT_SHOW$3, {
  5261. relatedTarget: previous
  5262. });
  5263. if (previous) {
  5264. $(previous).trigger(hideEvent);
  5265. }
  5266. $(this._element).trigger(showEvent);
  5267. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5268. return;
  5269. }
  5270. if (selector) {
  5271. target = document.querySelector(selector);
  5272. }
  5273. this._activate(this._element, listElement);
  5274. var complete = function complete() {
  5275. var hiddenEvent = $.Event(EVENT_HIDDEN$3, {
  5276. relatedTarget: _this._element
  5277. });
  5278. var shownEvent = $.Event(EVENT_SHOWN$3, {
  5279. relatedTarget: previous
  5280. });
  5281. $(previous).trigger(hiddenEvent);
  5282. $(_this._element).trigger(shownEvent);
  5283. };
  5284. if (target) {
  5285. this._activate(target, target.parentNode, complete);
  5286. } else {
  5287. complete();
  5288. }
  5289. };
  5290. _proto.dispose = function dispose() {
  5291. $.removeData(this._element, DATA_KEY$9);
  5292. this._element = null;
  5293. } // Private
  5294. ;
  5295. _proto._activate = function _activate(element, container, callback) {
  5296. var _this2 = this;
  5297. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(SELECTOR_ACTIVE_UL) : $(container).children(SELECTOR_ACTIVE$2);
  5298. var active = activeElements[0];
  5299. var isTransitioning = callback && active && $(active).hasClass(CLASS_NAME_FADE$4);
  5300. var complete = function complete() {
  5301. return _this2._transitionComplete(element, active, callback);
  5302. };
  5303. if (active && isTransitioning) {
  5304. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5305. $(active).removeClass(CLASS_NAME_SHOW$6).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5306. } else {
  5307. complete();
  5308. }
  5309. };
  5310. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5311. if (active) {
  5312. $(active).removeClass(CLASS_NAME_ACTIVE$3);
  5313. var dropdownChild = $(active.parentNode).find(SELECTOR_DROPDOWN_ACTIVE_CHILD)[0];
  5314. if (dropdownChild) {
  5315. $(dropdownChild).removeClass(CLASS_NAME_ACTIVE$3);
  5316. }
  5317. if (active.getAttribute('role') === 'tab') {
  5318. active.setAttribute('aria-selected', false);
  5319. }
  5320. }
  5321. $(element).addClass(CLASS_NAME_ACTIVE$3);
  5322. if (element.getAttribute('role') === 'tab') {
  5323. element.setAttribute('aria-selected', true);
  5324. }
  5325. Util.reflow(element);
  5326. if (element.classList.contains(CLASS_NAME_FADE$4)) {
  5327. element.classList.add(CLASS_NAME_SHOW$6);
  5328. }
  5329. if (element.parentNode && $(element.parentNode).hasClass(CLASS_NAME_DROPDOWN_MENU)) {
  5330. var dropdownElement = $(element).closest(SELECTOR_DROPDOWN$1)[0];
  5331. if (dropdownElement) {
  5332. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(SELECTOR_DROPDOWN_TOGGLE$1));
  5333. $(dropdownToggleList).addClass(CLASS_NAME_ACTIVE$3);
  5334. }
  5335. element.setAttribute('aria-expanded', true);
  5336. }
  5337. if (callback) {
  5338. callback();
  5339. }
  5340. } // Static
  5341. ;
  5342. Tab._jQueryInterface = function _jQueryInterface(config) {
  5343. return this.each(function () {
  5344. var $this = $(this);
  5345. var data = $this.data(DATA_KEY$9);
  5346. if (!data) {
  5347. data = new Tab(this);
  5348. $this.data(DATA_KEY$9, data);
  5349. }
  5350. if (typeof config === 'string') {
  5351. if (typeof data[config] === 'undefined') {
  5352. throw new TypeError("No method named \"" + config + "\"");
  5353. }
  5354. data[config]();
  5355. }
  5356. });
  5357. };
  5358. _createClass(Tab, null, [{
  5359. key: "VERSION",
  5360. get: function get() {
  5361. return VERSION$9;
  5362. }
  5363. }]);
  5364. return Tab;
  5365. }();
  5366. /**
  5367. * ------------------------------------------------------------------------
  5368. * Data Api implementation
  5369. * ------------------------------------------------------------------------
  5370. */
  5371. $(document).on(EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$4, function (event) {
  5372. event.preventDefault();
  5373. Tab._jQueryInterface.call($(this), 'show');
  5374. });
  5375. /**
  5376. * ------------------------------------------------------------------------
  5377. * jQuery
  5378. * ------------------------------------------------------------------------
  5379. */
  5380. $.fn[NAME$9] = Tab._jQueryInterface;
  5381. $.fn[NAME$9].Constructor = Tab;
  5382. $.fn[NAME$9].noConflict = function () {
  5383. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5384. return Tab._jQueryInterface;
  5385. };
  5386. /**
  5387. * ------------------------------------------------------------------------
  5388. * Constants
  5389. * ------------------------------------------------------------------------
  5390. */
  5391. var NAME$a = 'toast';
  5392. var VERSION$a = '4.5.0';
  5393. var DATA_KEY$a = 'bs.toast';
  5394. var EVENT_KEY$a = "." + DATA_KEY$a;
  5395. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5396. var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a;
  5397. var EVENT_HIDE$4 = "hide" + EVENT_KEY$a;
  5398. var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$a;
  5399. var EVENT_SHOW$4 = "show" + EVENT_KEY$a;
  5400. var EVENT_SHOWN$4 = "shown" + EVENT_KEY$a;
  5401. var CLASS_NAME_FADE$5 = 'fade';
  5402. var CLASS_NAME_HIDE = 'hide';
  5403. var CLASS_NAME_SHOW$7 = 'show';
  5404. var CLASS_NAME_SHOWING = 'showing';
  5405. var DefaultType$7 = {
  5406. animation: 'boolean',
  5407. autohide: 'boolean',
  5408. delay: 'number'
  5409. };
  5410. var Default$7 = {
  5411. animation: true,
  5412. autohide: true,
  5413. delay: 500
  5414. };
  5415. var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="toast"]';
  5416. /**
  5417. * ------------------------------------------------------------------------
  5418. * Class Definition
  5419. * ------------------------------------------------------------------------
  5420. */
  5421. var Toast = /*#__PURE__*/function () {
  5422. function Toast(element, config) {
  5423. this._element = element;
  5424. this._config = this._getConfig(config);
  5425. this._timeout = null;
  5426. this._setListeners();
  5427. } // Getters
  5428. var _proto = Toast.prototype;
  5429. // Public
  5430. _proto.show = function show() {
  5431. var _this = this;
  5432. var showEvent = $.Event(EVENT_SHOW$4);
  5433. $(this._element).trigger(showEvent);
  5434. if (showEvent.isDefaultPrevented()) {
  5435. return;
  5436. }
  5437. if (this._config.animation) {
  5438. this._element.classList.add(CLASS_NAME_FADE$5);
  5439. }
  5440. var complete = function complete() {
  5441. _this._element.classList.remove(CLASS_NAME_SHOWING);
  5442. _this._element.classList.add(CLASS_NAME_SHOW$7);
  5443. $(_this._element).trigger(EVENT_SHOWN$4);
  5444. if (_this._config.autohide) {
  5445. _this._timeout = setTimeout(function () {
  5446. _this.hide();
  5447. }, _this._config.delay);
  5448. }
  5449. };
  5450. this._element.classList.remove(CLASS_NAME_HIDE);
  5451. Util.reflow(this._element);
  5452. this._element.classList.add(CLASS_NAME_SHOWING);
  5453. if (this._config.animation) {
  5454. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5455. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5456. } else {
  5457. complete();
  5458. }
  5459. };
  5460. _proto.hide = function hide() {
  5461. if (!this._element.classList.contains(CLASS_NAME_SHOW$7)) {
  5462. return;
  5463. }
  5464. var hideEvent = $.Event(EVENT_HIDE$4);
  5465. $(this._element).trigger(hideEvent);
  5466. if (hideEvent.isDefaultPrevented()) {
  5467. return;
  5468. }
  5469. this._close();
  5470. };
  5471. _proto.dispose = function dispose() {
  5472. clearTimeout(this._timeout);
  5473. this._timeout = null;
  5474. if (this._element.classList.contains(CLASS_NAME_SHOW$7)) {
  5475. this._element.classList.remove(CLASS_NAME_SHOW$7);
  5476. }
  5477. $(this._element).off(EVENT_CLICK_DISMISS$1);
  5478. $.removeData(this._element, DATA_KEY$a);
  5479. this._element = null;
  5480. this._config = null;
  5481. } // Private
  5482. ;
  5483. _proto._getConfig = function _getConfig(config) {
  5484. config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default$7), $(this._element).data()), typeof config === 'object' && config ? config : {});
  5485. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5486. return config;
  5487. };
  5488. _proto._setListeners = function _setListeners() {
  5489. var _this2 = this;
  5490. $(this._element).on(EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () {
  5491. return _this2.hide();
  5492. });
  5493. };
  5494. _proto._close = function _close() {
  5495. var _this3 = this;
  5496. var complete = function complete() {
  5497. _this3._element.classList.add(CLASS_NAME_HIDE);
  5498. $(_this3._element).trigger(EVENT_HIDDEN$4);
  5499. };
  5500. this._element.classList.remove(CLASS_NAME_SHOW$7);
  5501. if (this._config.animation) {
  5502. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5503. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5504. } else {
  5505. complete();
  5506. }
  5507. } // Static
  5508. ;
  5509. Toast._jQueryInterface = function _jQueryInterface(config) {
  5510. return this.each(function () {
  5511. var $element = $(this);
  5512. var data = $element.data(DATA_KEY$a);
  5513. var _config = typeof config === 'object' && config;
  5514. if (!data) {
  5515. data = new Toast(this, _config);
  5516. $element.data(DATA_KEY$a, data);
  5517. }
  5518. if (typeof config === 'string') {
  5519. if (typeof data[config] === 'undefined') {
  5520. throw new TypeError("No method named \"" + config + "\"");
  5521. }
  5522. data[config](this);
  5523. }
  5524. });
  5525. };
  5526. _createClass(Toast, null, [{
  5527. key: "VERSION",
  5528. get: function get() {
  5529. return VERSION$a;
  5530. }
  5531. }, {
  5532. key: "DefaultType",
  5533. get: function get() {
  5534. return DefaultType$7;
  5535. }
  5536. }, {
  5537. key: "Default",
  5538. get: function get() {
  5539. return Default$7;
  5540. }
  5541. }]);
  5542. return Toast;
  5543. }();
  5544. /**
  5545. * ------------------------------------------------------------------------
  5546. * jQuery
  5547. * ------------------------------------------------------------------------
  5548. */
  5549. $.fn[NAME$a] = Toast._jQueryInterface;
  5550. $.fn[NAME$a].Constructor = Toast;
  5551. $.fn[NAME$a].noConflict = function () {
  5552. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5553. return Toast._jQueryInterface;
  5554. };
  5555. exports.Alert = Alert;
  5556. exports.Button = Button;
  5557. exports.Carousel = Carousel;
  5558. exports.Collapse = Collapse;
  5559. exports.Dropdown = Dropdown;
  5560. exports.Modal = Modal;
  5561. exports.Popover = Popover;
  5562. exports.Scrollspy = ScrollSpy;
  5563. exports.Tab = Tab;
  5564. exports.Toast = Toast;
  5565. exports.Tooltip = Tooltip;
  5566. exports.Util = Util;
  5567. Object.defineProperty(exports, '__esModule', { value: true });
  5568. })));
  5569. //# sourceMappingURL=bootstrap.js.map
  5570. /***/ }),
  5571. /***/ "./node_modules/buffer/index.js":
  5572. /*!**************************************!*\
  5573. !*** ./node_modules/buffer/index.js ***!
  5574. \**************************************/
  5575. /*! no static exports found */
  5576. /***/ (function(module, exports, __webpack_require__) {
  5577. "use strict";
  5578. /* WEBPACK VAR INJECTION */(function(global) {/*!
  5579. * The buffer module from node.js, for the browser.
  5580. *
  5581. * @author Feross Aboukhadijeh <http://feross.org>
  5582. * @license MIT
  5583. */
  5584. /* eslint-disable no-proto */
  5585. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  5586. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  5587. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  5588. exports.Buffer = Buffer
  5589. exports.SlowBuffer = SlowBuffer
  5590. exports.INSPECT_MAX_BYTES = 50
  5591. /**
  5592. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  5593. * === true Use Uint8Array implementation (fastest)
  5594. * === false Use Object implementation (most compatible, even IE6)
  5595. *
  5596. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  5597. * Opera 11.6+, iOS 4.2+.
  5598. *
  5599. * Due to various browser bugs, sometimes the Object implementation will be used even
  5600. * when the browser supports typed arrays.
  5601. *
  5602. * Note:
  5603. *
  5604. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  5605. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  5606. *
  5607. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  5608. *
  5609. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  5610. * incorrect length in some situations.
  5611. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  5612. * get the Object implementation, which is slower but behaves correctly.
  5613. */
  5614. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  5615. ? global.TYPED_ARRAY_SUPPORT
  5616. : typedArraySupport()
  5617. /*
  5618. * Export kMaxLength after typed array support is determined.
  5619. */
  5620. exports.kMaxLength = kMaxLength()
  5621. function typedArraySupport () {
  5622. try {
  5623. var arr = new Uint8Array(1)
  5624. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  5625. return arr.foo() === 42 && // typed array instances can be augmented
  5626. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  5627. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  5628. } catch (e) {
  5629. return false
  5630. }
  5631. }
  5632. function kMaxLength () {
  5633. return Buffer.TYPED_ARRAY_SUPPORT
  5634. ? 0x7fffffff
  5635. : 0x3fffffff
  5636. }
  5637. function createBuffer (that, length) {
  5638. if (kMaxLength() < length) {
  5639. throw new RangeError('Invalid typed array length')
  5640. }
  5641. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5642. // Return an augmented `Uint8Array` instance, for best performance
  5643. that = new Uint8Array(length)
  5644. that.__proto__ = Buffer.prototype
  5645. } else {
  5646. // Fallback: Return an object instance of the Buffer class
  5647. if (that === null) {
  5648. that = new Buffer(length)
  5649. }
  5650. that.length = length
  5651. }
  5652. return that
  5653. }
  5654. /**
  5655. * The Buffer constructor returns instances of `Uint8Array` that have their
  5656. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  5657. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  5658. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  5659. * returns a single octet.
  5660. *
  5661. * The `Uint8Array` prototype remains unmodified.
  5662. */
  5663. function Buffer (arg, encodingOrOffset, length) {
  5664. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  5665. return new Buffer(arg, encodingOrOffset, length)
  5666. }
  5667. // Common case.
  5668. if (typeof arg === 'number') {
  5669. if (typeof encodingOrOffset === 'string') {
  5670. throw new Error(
  5671. 'If encoding is specified then the first argument must be a string'
  5672. )
  5673. }
  5674. return allocUnsafe(this, arg)
  5675. }
  5676. return from(this, arg, encodingOrOffset, length)
  5677. }
  5678. Buffer.poolSize = 8192 // not used by this implementation
  5679. // TODO: Legacy, not needed anymore. Remove in next major version.
  5680. Buffer._augment = function (arr) {
  5681. arr.__proto__ = Buffer.prototype
  5682. return arr
  5683. }
  5684. function from (that, value, encodingOrOffset, length) {
  5685. if (typeof value === 'number') {
  5686. throw new TypeError('"value" argument must not be a number')
  5687. }
  5688. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  5689. return fromArrayBuffer(that, value, encodingOrOffset, length)
  5690. }
  5691. if (typeof value === 'string') {
  5692. return fromString(that, value, encodingOrOffset)
  5693. }
  5694. return fromObject(that, value)
  5695. }
  5696. /**
  5697. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  5698. * if value is a number.
  5699. * Buffer.from(str[, encoding])
  5700. * Buffer.from(array)
  5701. * Buffer.from(buffer)
  5702. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  5703. **/
  5704. Buffer.from = function (value, encodingOrOffset, length) {
  5705. return from(null, value, encodingOrOffset, length)
  5706. }
  5707. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5708. Buffer.prototype.__proto__ = Uint8Array.prototype
  5709. Buffer.__proto__ = Uint8Array
  5710. if (typeof Symbol !== 'undefined' && Symbol.species &&
  5711. Buffer[Symbol.species] === Buffer) {
  5712. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  5713. Object.defineProperty(Buffer, Symbol.species, {
  5714. value: null,
  5715. configurable: true
  5716. })
  5717. }
  5718. }
  5719. function assertSize (size) {
  5720. if (typeof size !== 'number') {
  5721. throw new TypeError('"size" argument must be a number')
  5722. } else if (size < 0) {
  5723. throw new RangeError('"size" argument must not be negative')
  5724. }
  5725. }
  5726. function alloc (that, size, fill, encoding) {
  5727. assertSize(size)
  5728. if (size <= 0) {
  5729. return createBuffer(that, size)
  5730. }
  5731. if (fill !== undefined) {
  5732. // Only pay attention to encoding if it's a string. This
  5733. // prevents accidentally sending in a number that would
  5734. // be interpretted as a start offset.
  5735. return typeof encoding === 'string'
  5736. ? createBuffer(that, size).fill(fill, encoding)
  5737. : createBuffer(that, size).fill(fill)
  5738. }
  5739. return createBuffer(that, size)
  5740. }
  5741. /**
  5742. * Creates a new filled Buffer instance.
  5743. * alloc(size[, fill[, encoding]])
  5744. **/
  5745. Buffer.alloc = function (size, fill, encoding) {
  5746. return alloc(null, size, fill, encoding)
  5747. }
  5748. function allocUnsafe (that, size) {
  5749. assertSize(size)
  5750. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  5751. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  5752. for (var i = 0; i < size; ++i) {
  5753. that[i] = 0
  5754. }
  5755. }
  5756. return that
  5757. }
  5758. /**
  5759. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  5760. * */
  5761. Buffer.allocUnsafe = function (size) {
  5762. return allocUnsafe(null, size)
  5763. }
  5764. /**
  5765. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  5766. */
  5767. Buffer.allocUnsafeSlow = function (size) {
  5768. return allocUnsafe(null, size)
  5769. }
  5770. function fromString (that, string, encoding) {
  5771. if (typeof encoding !== 'string' || encoding === '') {
  5772. encoding = 'utf8'
  5773. }
  5774. if (!Buffer.isEncoding(encoding)) {
  5775. throw new TypeError('"encoding" must be a valid string encoding')
  5776. }
  5777. var length = byteLength(string, encoding) | 0
  5778. that = createBuffer(that, length)
  5779. var actual = that.write(string, encoding)
  5780. if (actual !== length) {
  5781. // Writing a hex string, for example, that contains invalid characters will
  5782. // cause everything after the first invalid character to be ignored. (e.g.
  5783. // 'abxxcd' will be treated as 'ab')
  5784. that = that.slice(0, actual)
  5785. }
  5786. return that
  5787. }
  5788. function fromArrayLike (that, array) {
  5789. var length = array.length < 0 ? 0 : checked(array.length) | 0
  5790. that = createBuffer(that, length)
  5791. for (var i = 0; i < length; i += 1) {
  5792. that[i] = array[i] & 255
  5793. }
  5794. return that
  5795. }
  5796. function fromArrayBuffer (that, array, byteOffset, length) {
  5797. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  5798. if (byteOffset < 0 || array.byteLength < byteOffset) {
  5799. throw new RangeError('\'offset\' is out of bounds')
  5800. }
  5801. if (array.byteLength < byteOffset + (length || 0)) {
  5802. throw new RangeError('\'length\' is out of bounds')
  5803. }
  5804. if (byteOffset === undefined && length === undefined) {
  5805. array = new Uint8Array(array)
  5806. } else if (length === undefined) {
  5807. array = new Uint8Array(array, byteOffset)
  5808. } else {
  5809. array = new Uint8Array(array, byteOffset, length)
  5810. }
  5811. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5812. // Return an augmented `Uint8Array` instance, for best performance
  5813. that = array
  5814. that.__proto__ = Buffer.prototype
  5815. } else {
  5816. // Fallback: Return an object instance of the Buffer class
  5817. that = fromArrayLike(that, array)
  5818. }
  5819. return that
  5820. }
  5821. function fromObject (that, obj) {
  5822. if (Buffer.isBuffer(obj)) {
  5823. var len = checked(obj.length) | 0
  5824. that = createBuffer(that, len)
  5825. if (that.length === 0) {
  5826. return that
  5827. }
  5828. obj.copy(that, 0, 0, len)
  5829. return that
  5830. }
  5831. if (obj) {
  5832. if ((typeof ArrayBuffer !== 'undefined' &&
  5833. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  5834. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  5835. return createBuffer(that, 0)
  5836. }
  5837. return fromArrayLike(that, obj)
  5838. }
  5839. if (obj.type === 'Buffer' && isArray(obj.data)) {
  5840. return fromArrayLike(that, obj.data)
  5841. }
  5842. }
  5843. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  5844. }
  5845. function checked (length) {
  5846. // Note: cannot use `length < kMaxLength()` here because that fails when
  5847. // length is NaN (which is otherwise coerced to zero.)
  5848. if (length >= kMaxLength()) {
  5849. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  5850. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  5851. }
  5852. return length | 0
  5853. }
  5854. function SlowBuffer (length) {
  5855. if (+length != length) { // eslint-disable-line eqeqeq
  5856. length = 0
  5857. }
  5858. return Buffer.alloc(+length)
  5859. }
  5860. Buffer.isBuffer = function isBuffer (b) {
  5861. return !!(b != null && b._isBuffer)
  5862. }
  5863. Buffer.compare = function compare (a, b) {
  5864. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  5865. throw new TypeError('Arguments must be Buffers')
  5866. }
  5867. if (a === b) return 0
  5868. var x = a.length
  5869. var y = b.length
  5870. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  5871. if (a[i] !== b[i]) {
  5872. x = a[i]
  5873. y = b[i]
  5874. break
  5875. }
  5876. }
  5877. if (x < y) return -1
  5878. if (y < x) return 1
  5879. return 0
  5880. }
  5881. Buffer.isEncoding = function isEncoding (encoding) {
  5882. switch (String(encoding).toLowerCase()) {
  5883. case 'hex':
  5884. case 'utf8':
  5885. case 'utf-8':
  5886. case 'ascii':
  5887. case 'latin1':
  5888. case 'binary':
  5889. case 'base64':
  5890. case 'ucs2':
  5891. case 'ucs-2':
  5892. case 'utf16le':
  5893. case 'utf-16le':
  5894. return true
  5895. default:
  5896. return false
  5897. }
  5898. }
  5899. Buffer.concat = function concat (list, length) {
  5900. if (!isArray(list)) {
  5901. throw new TypeError('"list" argument must be an Array of Buffers')
  5902. }
  5903. if (list.length === 0) {
  5904. return Buffer.alloc(0)
  5905. }
  5906. var i
  5907. if (length === undefined) {
  5908. length = 0
  5909. for (i = 0; i < list.length; ++i) {
  5910. length += list[i].length
  5911. }
  5912. }
  5913. var buffer = Buffer.allocUnsafe(length)
  5914. var pos = 0
  5915. for (i = 0; i < list.length; ++i) {
  5916. var buf = list[i]
  5917. if (!Buffer.isBuffer(buf)) {
  5918. throw new TypeError('"list" argument must be an Array of Buffers')
  5919. }
  5920. buf.copy(buffer, pos)
  5921. pos += buf.length
  5922. }
  5923. return buffer
  5924. }
  5925. function byteLength (string, encoding) {
  5926. if (Buffer.isBuffer(string)) {
  5927. return string.length
  5928. }
  5929. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  5930. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  5931. return string.byteLength
  5932. }
  5933. if (typeof string !== 'string') {
  5934. string = '' + string
  5935. }
  5936. var len = string.length
  5937. if (len === 0) return 0
  5938. // Use a for loop to avoid recursion
  5939. var loweredCase = false
  5940. for (;;) {
  5941. switch (encoding) {
  5942. case 'ascii':
  5943. case 'latin1':
  5944. case 'binary':
  5945. return len
  5946. case 'utf8':
  5947. case 'utf-8':
  5948. case undefined:
  5949. return utf8ToBytes(string).length
  5950. case 'ucs2':
  5951. case 'ucs-2':
  5952. case 'utf16le':
  5953. case 'utf-16le':
  5954. return len * 2
  5955. case 'hex':
  5956. return len >>> 1
  5957. case 'base64':
  5958. return base64ToBytes(string).length
  5959. default:
  5960. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  5961. encoding = ('' + encoding).toLowerCase()
  5962. loweredCase = true
  5963. }
  5964. }
  5965. }
  5966. Buffer.byteLength = byteLength
  5967. function slowToString (encoding, start, end) {
  5968. var loweredCase = false
  5969. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  5970. // property of a typed array.
  5971. // This behaves neither like String nor Uint8Array in that we set start/end
  5972. // to their upper/lower bounds if the value passed is out of range.
  5973. // undefined is handled specially as per ECMA-262 6th Edition,
  5974. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  5975. if (start === undefined || start < 0) {
  5976. start = 0
  5977. }
  5978. // Return early if start > this.length. Done here to prevent potential uint32
  5979. // coercion fail below.
  5980. if (start > this.length) {
  5981. return ''
  5982. }
  5983. if (end === undefined || end > this.length) {
  5984. end = this.length
  5985. }
  5986. if (end <= 0) {
  5987. return ''
  5988. }
  5989. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  5990. end >>>= 0
  5991. start >>>= 0
  5992. if (end <= start) {
  5993. return ''
  5994. }
  5995. if (!encoding) encoding = 'utf8'
  5996. while (true) {
  5997. switch (encoding) {
  5998. case 'hex':
  5999. return hexSlice(this, start, end)
  6000. case 'utf8':
  6001. case 'utf-8':
  6002. return utf8Slice(this, start, end)
  6003. case 'ascii':
  6004. return asciiSlice(this, start, end)
  6005. case 'latin1':
  6006. case 'binary':
  6007. return latin1Slice(this, start, end)
  6008. case 'base64':
  6009. return base64Slice(this, start, end)
  6010. case 'ucs2':
  6011. case 'ucs-2':
  6012. case 'utf16le':
  6013. case 'utf-16le':
  6014. return utf16leSlice(this, start, end)
  6015. default:
  6016. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6017. encoding = (encoding + '').toLowerCase()
  6018. loweredCase = true
  6019. }
  6020. }
  6021. }
  6022. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6023. // Buffer instances.
  6024. Buffer.prototype._isBuffer = true
  6025. function swap (b, n, m) {
  6026. var i = b[n]
  6027. b[n] = b[m]
  6028. b[m] = i
  6029. }
  6030. Buffer.prototype.swap16 = function swap16 () {
  6031. var len = this.length
  6032. if (len % 2 !== 0) {
  6033. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6034. }
  6035. for (var i = 0; i < len; i += 2) {
  6036. swap(this, i, i + 1)
  6037. }
  6038. return this
  6039. }
  6040. Buffer.prototype.swap32 = function swap32 () {
  6041. var len = this.length
  6042. if (len % 4 !== 0) {
  6043. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6044. }
  6045. for (var i = 0; i < len; i += 4) {
  6046. swap(this, i, i + 3)
  6047. swap(this, i + 1, i + 2)
  6048. }
  6049. return this
  6050. }
  6051. Buffer.prototype.swap64 = function swap64 () {
  6052. var len = this.length
  6053. if (len % 8 !== 0) {
  6054. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6055. }
  6056. for (var i = 0; i < len; i += 8) {
  6057. swap(this, i, i + 7)
  6058. swap(this, i + 1, i + 6)
  6059. swap(this, i + 2, i + 5)
  6060. swap(this, i + 3, i + 4)
  6061. }
  6062. return this
  6063. }
  6064. Buffer.prototype.toString = function toString () {
  6065. var length = this.length | 0
  6066. if (length === 0) return ''
  6067. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6068. return slowToString.apply(this, arguments)
  6069. }
  6070. Buffer.prototype.equals = function equals (b) {
  6071. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6072. if (this === b) return true
  6073. return Buffer.compare(this, b) === 0
  6074. }
  6075. Buffer.prototype.inspect = function inspect () {
  6076. var str = ''
  6077. var max = exports.INSPECT_MAX_BYTES
  6078. if (this.length > 0) {
  6079. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6080. if (this.length > max) str += ' ... '
  6081. }
  6082. return '<Buffer ' + str + '>'
  6083. }
  6084. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6085. if (!Buffer.isBuffer(target)) {
  6086. throw new TypeError('Argument must be a Buffer')
  6087. }
  6088. if (start === undefined) {
  6089. start = 0
  6090. }
  6091. if (end === undefined) {
  6092. end = target ? target.length : 0
  6093. }
  6094. if (thisStart === undefined) {
  6095. thisStart = 0
  6096. }
  6097. if (thisEnd === undefined) {
  6098. thisEnd = this.length
  6099. }
  6100. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6101. throw new RangeError('out of range index')
  6102. }
  6103. if (thisStart >= thisEnd && start >= end) {
  6104. return 0
  6105. }
  6106. if (thisStart >= thisEnd) {
  6107. return -1
  6108. }
  6109. if (start >= end) {
  6110. return 1
  6111. }
  6112. start >>>= 0
  6113. end >>>= 0
  6114. thisStart >>>= 0
  6115. thisEnd >>>= 0
  6116. if (this === target) return 0
  6117. var x = thisEnd - thisStart
  6118. var y = end - start
  6119. var len = Math.min(x, y)
  6120. var thisCopy = this.slice(thisStart, thisEnd)
  6121. var targetCopy = target.slice(start, end)
  6122. for (var i = 0; i < len; ++i) {
  6123. if (thisCopy[i] !== targetCopy[i]) {
  6124. x = thisCopy[i]
  6125. y = targetCopy[i]
  6126. break
  6127. }
  6128. }
  6129. if (x < y) return -1
  6130. if (y < x) return 1
  6131. return 0
  6132. }
  6133. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6134. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6135. //
  6136. // Arguments:
  6137. // - buffer - a Buffer to search
  6138. // - val - a string, Buffer, or number
  6139. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6140. // - encoding - an optional encoding, relevant is val is a string
  6141. // - dir - true for indexOf, false for lastIndexOf
  6142. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6143. // Empty buffer means no match
  6144. if (buffer.length === 0) return -1
  6145. // Normalize byteOffset
  6146. if (typeof byteOffset === 'string') {
  6147. encoding = byteOffset
  6148. byteOffset = 0
  6149. } else if (byteOffset > 0x7fffffff) {
  6150. byteOffset = 0x7fffffff
  6151. } else if (byteOffset < -0x80000000) {
  6152. byteOffset = -0x80000000
  6153. }
  6154. byteOffset = +byteOffset // Coerce to Number.
  6155. if (isNaN(byteOffset)) {
  6156. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6157. byteOffset = dir ? 0 : (buffer.length - 1)
  6158. }
  6159. // Normalize byteOffset: negative offsets start from the end of the buffer
  6160. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6161. if (byteOffset >= buffer.length) {
  6162. if (dir) return -1
  6163. else byteOffset = buffer.length - 1
  6164. } else if (byteOffset < 0) {
  6165. if (dir) byteOffset = 0
  6166. else return -1
  6167. }
  6168. // Normalize val
  6169. if (typeof val === 'string') {
  6170. val = Buffer.from(val, encoding)
  6171. }
  6172. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6173. if (Buffer.isBuffer(val)) {
  6174. // Special case: looking for empty string/buffer always fails
  6175. if (val.length === 0) {
  6176. return -1
  6177. }
  6178. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6179. } else if (typeof val === 'number') {
  6180. val = val & 0xFF // Search for a byte value [0-255]
  6181. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6182. typeof Uint8Array.prototype.indexOf === 'function') {
  6183. if (dir) {
  6184. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6185. } else {
  6186. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6187. }
  6188. }
  6189. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6190. }
  6191. throw new TypeError('val must be string, number or Buffer')
  6192. }
  6193. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6194. var indexSize = 1
  6195. var arrLength = arr.length
  6196. var valLength = val.length
  6197. if (encoding !== undefined) {
  6198. encoding = String(encoding).toLowerCase()
  6199. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6200. encoding === 'utf16le' || encoding === 'utf-16le') {
  6201. if (arr.length < 2 || val.length < 2) {
  6202. return -1
  6203. }
  6204. indexSize = 2
  6205. arrLength /= 2
  6206. valLength /= 2
  6207. byteOffset /= 2
  6208. }
  6209. }
  6210. function read (buf, i) {
  6211. if (indexSize === 1) {
  6212. return buf[i]
  6213. } else {
  6214. return buf.readUInt16BE(i * indexSize)
  6215. }
  6216. }
  6217. var i
  6218. if (dir) {
  6219. var foundIndex = -1
  6220. for (i = byteOffset; i < arrLength; i++) {
  6221. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6222. if (foundIndex === -1) foundIndex = i
  6223. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6224. } else {
  6225. if (foundIndex !== -1) i -= i - foundIndex
  6226. foundIndex = -1
  6227. }
  6228. }
  6229. } else {
  6230. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6231. for (i = byteOffset; i >= 0; i--) {
  6232. var found = true
  6233. for (var j = 0; j < valLength; j++) {
  6234. if (read(arr, i + j) !== read(val, j)) {
  6235. found = false
  6236. break
  6237. }
  6238. }
  6239. if (found) return i
  6240. }
  6241. }
  6242. return -1
  6243. }
  6244. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6245. return this.indexOf(val, byteOffset, encoding) !== -1
  6246. }
  6247. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6248. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6249. }
  6250. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6251. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6252. }
  6253. function hexWrite (buf, string, offset, length) {
  6254. offset = Number(offset) || 0
  6255. var remaining = buf.length - offset
  6256. if (!length) {
  6257. length = remaining
  6258. } else {
  6259. length = Number(length)
  6260. if (length > remaining) {
  6261. length = remaining
  6262. }
  6263. }
  6264. // must be an even number of digits
  6265. var strLen = string.length
  6266. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6267. if (length > strLen / 2) {
  6268. length = strLen / 2
  6269. }
  6270. for (var i = 0; i < length; ++i) {
  6271. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6272. if (isNaN(parsed)) return i
  6273. buf[offset + i] = parsed
  6274. }
  6275. return i
  6276. }
  6277. function utf8Write (buf, string, offset, length) {
  6278. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6279. }
  6280. function asciiWrite (buf, string, offset, length) {
  6281. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6282. }
  6283. function latin1Write (buf, string, offset, length) {
  6284. return asciiWrite(buf, string, offset, length)
  6285. }
  6286. function base64Write (buf, string, offset, length) {
  6287. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6288. }
  6289. function ucs2Write (buf, string, offset, length) {
  6290. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6291. }
  6292. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6293. // Buffer#write(string)
  6294. if (offset === undefined) {
  6295. encoding = 'utf8'
  6296. length = this.length
  6297. offset = 0
  6298. // Buffer#write(string, encoding)
  6299. } else if (length === undefined && typeof offset === 'string') {
  6300. encoding = offset
  6301. length = this.length
  6302. offset = 0
  6303. // Buffer#write(string, offset[, length][, encoding])
  6304. } else if (isFinite(offset)) {
  6305. offset = offset | 0
  6306. if (isFinite(length)) {
  6307. length = length | 0
  6308. if (encoding === undefined) encoding = 'utf8'
  6309. } else {
  6310. encoding = length
  6311. length = undefined
  6312. }
  6313. // legacy write(string, encoding, offset, length) - remove in v0.13
  6314. } else {
  6315. throw new Error(
  6316. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6317. )
  6318. }
  6319. var remaining = this.length - offset
  6320. if (length === undefined || length > remaining) length = remaining
  6321. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6322. throw new RangeError('Attempt to write outside buffer bounds')
  6323. }
  6324. if (!encoding) encoding = 'utf8'
  6325. var loweredCase = false
  6326. for (;;) {
  6327. switch (encoding) {
  6328. case 'hex':
  6329. return hexWrite(this, string, offset, length)
  6330. case 'utf8':
  6331. case 'utf-8':
  6332. return utf8Write(this, string, offset, length)
  6333. case 'ascii':
  6334. return asciiWrite(this, string, offset, length)
  6335. case 'latin1':
  6336. case 'binary':
  6337. return latin1Write(this, string, offset, length)
  6338. case 'base64':
  6339. // Warning: maxLength not taken into account in base64Write
  6340. return base64Write(this, string, offset, length)
  6341. case 'ucs2':
  6342. case 'ucs-2':
  6343. case 'utf16le':
  6344. case 'utf-16le':
  6345. return ucs2Write(this, string, offset, length)
  6346. default:
  6347. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6348. encoding = ('' + encoding).toLowerCase()
  6349. loweredCase = true
  6350. }
  6351. }
  6352. }
  6353. Buffer.prototype.toJSON = function toJSON () {
  6354. return {
  6355. type: 'Buffer',
  6356. data: Array.prototype.slice.call(this._arr || this, 0)
  6357. }
  6358. }
  6359. function base64Slice (buf, start, end) {
  6360. if (start === 0 && end === buf.length) {
  6361. return base64.fromByteArray(buf)
  6362. } else {
  6363. return base64.fromByteArray(buf.slice(start, end))
  6364. }
  6365. }
  6366. function utf8Slice (buf, start, end) {
  6367. end = Math.min(buf.length, end)
  6368. var res = []
  6369. var i = start
  6370. while (i < end) {
  6371. var firstByte = buf[i]
  6372. var codePoint = null
  6373. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6374. : (firstByte > 0xDF) ? 3
  6375. : (firstByte > 0xBF) ? 2
  6376. : 1
  6377. if (i + bytesPerSequence <= end) {
  6378. var secondByte, thirdByte, fourthByte, tempCodePoint
  6379. switch (bytesPerSequence) {
  6380. case 1:
  6381. if (firstByte < 0x80) {
  6382. codePoint = firstByte
  6383. }
  6384. break
  6385. case 2:
  6386. secondByte = buf[i + 1]
  6387. if ((secondByte & 0xC0) === 0x80) {
  6388. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6389. if (tempCodePoint > 0x7F) {
  6390. codePoint = tempCodePoint
  6391. }
  6392. }
  6393. break
  6394. case 3:
  6395. secondByte = buf[i + 1]
  6396. thirdByte = buf[i + 2]
  6397. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6398. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6399. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6400. codePoint = tempCodePoint
  6401. }
  6402. }
  6403. break
  6404. case 4:
  6405. secondByte = buf[i + 1]
  6406. thirdByte = buf[i + 2]
  6407. fourthByte = buf[i + 3]
  6408. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6409. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6410. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6411. codePoint = tempCodePoint
  6412. }
  6413. }
  6414. }
  6415. }
  6416. if (codePoint === null) {
  6417. // we did not generate a valid codePoint so insert a
  6418. // replacement char (U+FFFD) and advance only 1 byte
  6419. codePoint = 0xFFFD
  6420. bytesPerSequence = 1
  6421. } else if (codePoint > 0xFFFF) {
  6422. // encode to utf16 (surrogate pair dance)
  6423. codePoint -= 0x10000
  6424. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6425. codePoint = 0xDC00 | codePoint & 0x3FF
  6426. }
  6427. res.push(codePoint)
  6428. i += bytesPerSequence
  6429. }
  6430. return decodeCodePointsArray(res)
  6431. }
  6432. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6433. // the lowest limit is Chrome, with 0x10000 args.
  6434. // We go 1 magnitude less, for safety
  6435. var MAX_ARGUMENTS_LENGTH = 0x1000
  6436. function decodeCodePointsArray (codePoints) {
  6437. var len = codePoints.length
  6438. if (len <= MAX_ARGUMENTS_LENGTH) {
  6439. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6440. }
  6441. // Decode in chunks to avoid "call stack size exceeded".
  6442. var res = ''
  6443. var i = 0
  6444. while (i < len) {
  6445. res += String.fromCharCode.apply(
  6446. String,
  6447. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6448. )
  6449. }
  6450. return res
  6451. }
  6452. function asciiSlice (buf, start, end) {
  6453. var ret = ''
  6454. end = Math.min(buf.length, end)
  6455. for (var i = start; i < end; ++i) {
  6456. ret += String.fromCharCode(buf[i] & 0x7F)
  6457. }
  6458. return ret
  6459. }
  6460. function latin1Slice (buf, start, end) {
  6461. var ret = ''
  6462. end = Math.min(buf.length, end)
  6463. for (var i = start; i < end; ++i) {
  6464. ret += String.fromCharCode(buf[i])
  6465. }
  6466. return ret
  6467. }
  6468. function hexSlice (buf, start, end) {
  6469. var len = buf.length
  6470. if (!start || start < 0) start = 0
  6471. if (!end || end < 0 || end > len) end = len
  6472. var out = ''
  6473. for (var i = start; i < end; ++i) {
  6474. out += toHex(buf[i])
  6475. }
  6476. return out
  6477. }
  6478. function utf16leSlice (buf, start, end) {
  6479. var bytes = buf.slice(start, end)
  6480. var res = ''
  6481. for (var i = 0; i < bytes.length; i += 2) {
  6482. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  6483. }
  6484. return res
  6485. }
  6486. Buffer.prototype.slice = function slice (start, end) {
  6487. var len = this.length
  6488. start = ~~start
  6489. end = end === undefined ? len : ~~end
  6490. if (start < 0) {
  6491. start += len
  6492. if (start < 0) start = 0
  6493. } else if (start > len) {
  6494. start = len
  6495. }
  6496. if (end < 0) {
  6497. end += len
  6498. if (end < 0) end = 0
  6499. } else if (end > len) {
  6500. end = len
  6501. }
  6502. if (end < start) end = start
  6503. var newBuf
  6504. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6505. newBuf = this.subarray(start, end)
  6506. newBuf.__proto__ = Buffer.prototype
  6507. } else {
  6508. var sliceLen = end - start
  6509. newBuf = new Buffer(sliceLen, undefined)
  6510. for (var i = 0; i < sliceLen; ++i) {
  6511. newBuf[i] = this[i + start]
  6512. }
  6513. }
  6514. return newBuf
  6515. }
  6516. /*
  6517. * Need to make sure that buffer isn't trying to write out of bounds.
  6518. */
  6519. function checkOffset (offset, ext, length) {
  6520. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  6521. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  6522. }
  6523. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  6524. offset = offset | 0
  6525. byteLength = byteLength | 0
  6526. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6527. var val = this[offset]
  6528. var mul = 1
  6529. var i = 0
  6530. while (++i < byteLength && (mul *= 0x100)) {
  6531. val += this[offset + i] * mul
  6532. }
  6533. return val
  6534. }
  6535. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  6536. offset = offset | 0
  6537. byteLength = byteLength | 0
  6538. if (!noAssert) {
  6539. checkOffset(offset, byteLength, this.length)
  6540. }
  6541. var val = this[offset + --byteLength]
  6542. var mul = 1
  6543. while (byteLength > 0 && (mul *= 0x100)) {
  6544. val += this[offset + --byteLength] * mul
  6545. }
  6546. return val
  6547. }
  6548. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  6549. if (!noAssert) checkOffset(offset, 1, this.length)
  6550. return this[offset]
  6551. }
  6552. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  6553. if (!noAssert) checkOffset(offset, 2, this.length)
  6554. return this[offset] | (this[offset + 1] << 8)
  6555. }
  6556. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  6557. if (!noAssert) checkOffset(offset, 2, this.length)
  6558. return (this[offset] << 8) | this[offset + 1]
  6559. }
  6560. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  6561. if (!noAssert) checkOffset(offset, 4, this.length)
  6562. return ((this[offset]) |
  6563. (this[offset + 1] << 8) |
  6564. (this[offset + 2] << 16)) +
  6565. (this[offset + 3] * 0x1000000)
  6566. }
  6567. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  6568. if (!noAssert) checkOffset(offset, 4, this.length)
  6569. return (this[offset] * 0x1000000) +
  6570. ((this[offset + 1] << 16) |
  6571. (this[offset + 2] << 8) |
  6572. this[offset + 3])
  6573. }
  6574. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  6575. offset = offset | 0
  6576. byteLength = byteLength | 0
  6577. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6578. var val = this[offset]
  6579. var mul = 1
  6580. var i = 0
  6581. while (++i < byteLength && (mul *= 0x100)) {
  6582. val += this[offset + i] * mul
  6583. }
  6584. mul *= 0x80
  6585. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6586. return val
  6587. }
  6588. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  6589. offset = offset | 0
  6590. byteLength = byteLength | 0
  6591. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6592. var i = byteLength
  6593. var mul = 1
  6594. var val = this[offset + --i]
  6595. while (i > 0 && (mul *= 0x100)) {
  6596. val += this[offset + --i] * mul
  6597. }
  6598. mul *= 0x80
  6599. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6600. return val
  6601. }
  6602. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  6603. if (!noAssert) checkOffset(offset, 1, this.length)
  6604. if (!(this[offset] & 0x80)) return (this[offset])
  6605. return ((0xff - this[offset] + 1) * -1)
  6606. }
  6607. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  6608. if (!noAssert) checkOffset(offset, 2, this.length)
  6609. var val = this[offset] | (this[offset + 1] << 8)
  6610. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6611. }
  6612. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  6613. if (!noAssert) checkOffset(offset, 2, this.length)
  6614. var val = this[offset + 1] | (this[offset] << 8)
  6615. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6616. }
  6617. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  6618. if (!noAssert) checkOffset(offset, 4, this.length)
  6619. return (this[offset]) |
  6620. (this[offset + 1] << 8) |
  6621. (this[offset + 2] << 16) |
  6622. (this[offset + 3] << 24)
  6623. }
  6624. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  6625. if (!noAssert) checkOffset(offset, 4, this.length)
  6626. return (this[offset] << 24) |
  6627. (this[offset + 1] << 16) |
  6628. (this[offset + 2] << 8) |
  6629. (this[offset + 3])
  6630. }
  6631. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  6632. if (!noAssert) checkOffset(offset, 4, this.length)
  6633. return ieee754.read(this, offset, true, 23, 4)
  6634. }
  6635. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  6636. if (!noAssert) checkOffset(offset, 4, this.length)
  6637. return ieee754.read(this, offset, false, 23, 4)
  6638. }
  6639. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  6640. if (!noAssert) checkOffset(offset, 8, this.length)
  6641. return ieee754.read(this, offset, true, 52, 8)
  6642. }
  6643. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  6644. if (!noAssert) checkOffset(offset, 8, this.length)
  6645. return ieee754.read(this, offset, false, 52, 8)
  6646. }
  6647. function checkInt (buf, value, offset, ext, max, min) {
  6648. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  6649. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  6650. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6651. }
  6652. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  6653. value = +value
  6654. offset = offset | 0
  6655. byteLength = byteLength | 0
  6656. if (!noAssert) {
  6657. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6658. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6659. }
  6660. var mul = 1
  6661. var i = 0
  6662. this[offset] = value & 0xFF
  6663. while (++i < byteLength && (mul *= 0x100)) {
  6664. this[offset + i] = (value / mul) & 0xFF
  6665. }
  6666. return offset + byteLength
  6667. }
  6668. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  6669. value = +value
  6670. offset = offset | 0
  6671. byteLength = byteLength | 0
  6672. if (!noAssert) {
  6673. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6674. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6675. }
  6676. var i = byteLength - 1
  6677. var mul = 1
  6678. this[offset + i] = value & 0xFF
  6679. while (--i >= 0 && (mul *= 0x100)) {
  6680. this[offset + i] = (value / mul) & 0xFF
  6681. }
  6682. return offset + byteLength
  6683. }
  6684. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  6685. value = +value
  6686. offset = offset | 0
  6687. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  6688. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6689. this[offset] = (value & 0xff)
  6690. return offset + 1
  6691. }
  6692. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  6693. if (value < 0) value = 0xffff + value + 1
  6694. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  6695. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  6696. (littleEndian ? i : 1 - i) * 8
  6697. }
  6698. }
  6699. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  6700. value = +value
  6701. offset = offset | 0
  6702. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6703. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6704. this[offset] = (value & 0xff)
  6705. this[offset + 1] = (value >>> 8)
  6706. } else {
  6707. objectWriteUInt16(this, value, offset, true)
  6708. }
  6709. return offset + 2
  6710. }
  6711. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  6712. value = +value
  6713. offset = offset | 0
  6714. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6715. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6716. this[offset] = (value >>> 8)
  6717. this[offset + 1] = (value & 0xff)
  6718. } else {
  6719. objectWriteUInt16(this, value, offset, false)
  6720. }
  6721. return offset + 2
  6722. }
  6723. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  6724. if (value < 0) value = 0xffffffff + value + 1
  6725. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  6726. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  6727. }
  6728. }
  6729. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  6730. value = +value
  6731. offset = offset | 0
  6732. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6733. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6734. this[offset + 3] = (value >>> 24)
  6735. this[offset + 2] = (value >>> 16)
  6736. this[offset + 1] = (value >>> 8)
  6737. this[offset] = (value & 0xff)
  6738. } else {
  6739. objectWriteUInt32(this, value, offset, true)
  6740. }
  6741. return offset + 4
  6742. }
  6743. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  6744. value = +value
  6745. offset = offset | 0
  6746. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6747. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6748. this[offset] = (value >>> 24)
  6749. this[offset + 1] = (value >>> 16)
  6750. this[offset + 2] = (value >>> 8)
  6751. this[offset + 3] = (value & 0xff)
  6752. } else {
  6753. objectWriteUInt32(this, value, offset, false)
  6754. }
  6755. return offset + 4
  6756. }
  6757. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  6758. value = +value
  6759. offset = offset | 0
  6760. if (!noAssert) {
  6761. var limit = Math.pow(2, 8 * byteLength - 1)
  6762. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  6763. }
  6764. var i = 0
  6765. var mul = 1
  6766. var sub = 0
  6767. this[offset] = value & 0xFF
  6768. while (++i < byteLength && (mul *= 0x100)) {
  6769. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  6770. sub = 1
  6771. }
  6772. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  6773. }
  6774. return offset + byteLength
  6775. }
  6776. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  6777. value = +value
  6778. offset = offset | 0
  6779. if (!noAssert) {
  6780. var limit = Math.pow(2, 8 * byteLength - 1)
  6781. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  6782. }
  6783. var i = byteLength - 1
  6784. var mul = 1
  6785. var sub = 0
  6786. this[offset + i] = value & 0xFF
  6787. while (--i >= 0 && (mul *= 0x100)) {
  6788. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  6789. sub = 1
  6790. }
  6791. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  6792. }
  6793. return offset + byteLength
  6794. }
  6795. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  6796. value = +value
  6797. offset = offset | 0
  6798. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  6799. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6800. if (value < 0) value = 0xff + value + 1
  6801. this[offset] = (value & 0xff)
  6802. return offset + 1
  6803. }
  6804. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  6805. value = +value
  6806. offset = offset | 0
  6807. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  6808. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6809. this[offset] = (value & 0xff)
  6810. this[offset + 1] = (value >>> 8)
  6811. } else {
  6812. objectWriteUInt16(this, value, offset, true)
  6813. }
  6814. return offset + 2
  6815. }
  6816. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  6817. value = +value
  6818. offset = offset | 0
  6819. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  6820. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6821. this[offset] = (value >>> 8)
  6822. this[offset + 1] = (value & 0xff)
  6823. } else {
  6824. objectWriteUInt16(this, value, offset, false)
  6825. }
  6826. return offset + 2
  6827. }
  6828. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  6829. value = +value
  6830. offset = offset | 0
  6831. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  6832. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6833. this[offset] = (value & 0xff)
  6834. this[offset + 1] = (value >>> 8)
  6835. this[offset + 2] = (value >>> 16)
  6836. this[offset + 3] = (value >>> 24)
  6837. } else {
  6838. objectWriteUInt32(this, value, offset, true)
  6839. }
  6840. return offset + 4
  6841. }
  6842. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  6843. value = +value
  6844. offset = offset | 0
  6845. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  6846. if (value < 0) value = 0xffffffff + value + 1
  6847. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6848. this[offset] = (value >>> 24)
  6849. this[offset + 1] = (value >>> 16)
  6850. this[offset + 2] = (value >>> 8)
  6851. this[offset + 3] = (value & 0xff)
  6852. } else {
  6853. objectWriteUInt32(this, value, offset, false)
  6854. }
  6855. return offset + 4
  6856. }
  6857. function checkIEEE754 (buf, value, offset, ext, max, min) {
  6858. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6859. if (offset < 0) throw new RangeError('Index out of range')
  6860. }
  6861. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  6862. if (!noAssert) {
  6863. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  6864. }
  6865. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  6866. return offset + 4
  6867. }
  6868. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  6869. return writeFloat(this, value, offset, true, noAssert)
  6870. }
  6871. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  6872. return writeFloat(this, value, offset, false, noAssert)
  6873. }
  6874. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  6875. if (!noAssert) {
  6876. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  6877. }
  6878. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  6879. return offset + 8
  6880. }
  6881. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  6882. return writeDouble(this, value, offset, true, noAssert)
  6883. }
  6884. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  6885. return writeDouble(this, value, offset, false, noAssert)
  6886. }
  6887. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  6888. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  6889. if (!start) start = 0
  6890. if (!end && end !== 0) end = this.length
  6891. if (targetStart >= target.length) targetStart = target.length
  6892. if (!targetStart) targetStart = 0
  6893. if (end > 0 && end < start) end = start
  6894. // Copy 0 bytes; we're done
  6895. if (end === start) return 0
  6896. if (target.length === 0 || this.length === 0) return 0
  6897. // Fatal error conditions
  6898. if (targetStart < 0) {
  6899. throw new RangeError('targetStart out of bounds')
  6900. }
  6901. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  6902. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  6903. // Are we oob?
  6904. if (end > this.length) end = this.length
  6905. if (target.length - targetStart < end - start) {
  6906. end = target.length - targetStart + start
  6907. }
  6908. var len = end - start
  6909. var i
  6910. if (this === target && start < targetStart && targetStart < end) {
  6911. // descending copy from end
  6912. for (i = len - 1; i >= 0; --i) {
  6913. target[i + targetStart] = this[i + start]
  6914. }
  6915. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  6916. // ascending copy from start
  6917. for (i = 0; i < len; ++i) {
  6918. target[i + targetStart] = this[i + start]
  6919. }
  6920. } else {
  6921. Uint8Array.prototype.set.call(
  6922. target,
  6923. this.subarray(start, start + len),
  6924. targetStart
  6925. )
  6926. }
  6927. return len
  6928. }
  6929. // Usage:
  6930. // buffer.fill(number[, offset[, end]])
  6931. // buffer.fill(buffer[, offset[, end]])
  6932. // buffer.fill(string[, offset[, end]][, encoding])
  6933. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  6934. // Handle string cases:
  6935. if (typeof val === 'string') {
  6936. if (typeof start === 'string') {
  6937. encoding = start
  6938. start = 0
  6939. end = this.length
  6940. } else if (typeof end === 'string') {
  6941. encoding = end
  6942. end = this.length
  6943. }
  6944. if (val.length === 1) {
  6945. var code = val.charCodeAt(0)
  6946. if (code < 256) {
  6947. val = code
  6948. }
  6949. }
  6950. if (encoding !== undefined && typeof encoding !== 'string') {
  6951. throw new TypeError('encoding must be a string')
  6952. }
  6953. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  6954. throw new TypeError('Unknown encoding: ' + encoding)
  6955. }
  6956. } else if (typeof val === 'number') {
  6957. val = val & 255
  6958. }
  6959. // Invalid ranges are not set to a default, so can range check early.
  6960. if (start < 0 || this.length < start || this.length < end) {
  6961. throw new RangeError('Out of range index')
  6962. }
  6963. if (end <= start) {
  6964. return this
  6965. }
  6966. start = start >>> 0
  6967. end = end === undefined ? this.length : end >>> 0
  6968. if (!val) val = 0
  6969. var i
  6970. if (typeof val === 'number') {
  6971. for (i = start; i < end; ++i) {
  6972. this[i] = val
  6973. }
  6974. } else {
  6975. var bytes = Buffer.isBuffer(val)
  6976. ? val
  6977. : utf8ToBytes(new Buffer(val, encoding).toString())
  6978. var len = bytes.length
  6979. for (i = 0; i < end - start; ++i) {
  6980. this[i + start] = bytes[i % len]
  6981. }
  6982. }
  6983. return this
  6984. }
  6985. // HELPER FUNCTIONS
  6986. // ================
  6987. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  6988. function base64clean (str) {
  6989. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  6990. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  6991. // Node converts strings with length < 2 to ''
  6992. if (str.length < 2) return ''
  6993. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  6994. while (str.length % 4 !== 0) {
  6995. str = str + '='
  6996. }
  6997. return str
  6998. }
  6999. function stringtrim (str) {
  7000. if (str.trim) return str.trim()
  7001. return str.replace(/^\s+|\s+$/g, '')
  7002. }
  7003. function toHex (n) {
  7004. if (n < 16) return '0' + n.toString(16)
  7005. return n.toString(16)
  7006. }
  7007. function utf8ToBytes (string, units) {
  7008. units = units || Infinity
  7009. var codePoint
  7010. var length = string.length
  7011. var leadSurrogate = null
  7012. var bytes = []
  7013. for (var i = 0; i < length; ++i) {
  7014. codePoint = string.charCodeAt(i)
  7015. // is surrogate component
  7016. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7017. // last char was a lead
  7018. if (!leadSurrogate) {
  7019. // no lead yet
  7020. if (codePoint > 0xDBFF) {
  7021. // unexpected trail
  7022. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7023. continue
  7024. } else if (i + 1 === length) {
  7025. // unpaired lead
  7026. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7027. continue
  7028. }
  7029. // valid lead
  7030. leadSurrogate = codePoint
  7031. continue
  7032. }
  7033. // 2 leads in a row
  7034. if (codePoint < 0xDC00) {
  7035. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7036. leadSurrogate = codePoint
  7037. continue
  7038. }
  7039. // valid surrogate pair
  7040. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7041. } else if (leadSurrogate) {
  7042. // valid bmp char, but last char was a lead
  7043. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7044. }
  7045. leadSurrogate = null
  7046. // encode utf8
  7047. if (codePoint < 0x80) {
  7048. if ((units -= 1) < 0) break
  7049. bytes.push(codePoint)
  7050. } else if (codePoint < 0x800) {
  7051. if ((units -= 2) < 0) break
  7052. bytes.push(
  7053. codePoint >> 0x6 | 0xC0,
  7054. codePoint & 0x3F | 0x80
  7055. )
  7056. } else if (codePoint < 0x10000) {
  7057. if ((units -= 3) < 0) break
  7058. bytes.push(
  7059. codePoint >> 0xC | 0xE0,
  7060. codePoint >> 0x6 & 0x3F | 0x80,
  7061. codePoint & 0x3F | 0x80
  7062. )
  7063. } else if (codePoint < 0x110000) {
  7064. if ((units -= 4) < 0) break
  7065. bytes.push(
  7066. codePoint >> 0x12 | 0xF0,
  7067. codePoint >> 0xC & 0x3F | 0x80,
  7068. codePoint >> 0x6 & 0x3F | 0x80,
  7069. codePoint & 0x3F | 0x80
  7070. )
  7071. } else {
  7072. throw new Error('Invalid code point')
  7073. }
  7074. }
  7075. return bytes
  7076. }
  7077. function asciiToBytes (str) {
  7078. var byteArray = []
  7079. for (var i = 0; i < str.length; ++i) {
  7080. // Node's code seems to be doing this and not & 0x7F..
  7081. byteArray.push(str.charCodeAt(i) & 0xFF)
  7082. }
  7083. return byteArray
  7084. }
  7085. function utf16leToBytes (str, units) {
  7086. var c, hi, lo
  7087. var byteArray = []
  7088. for (var i = 0; i < str.length; ++i) {
  7089. if ((units -= 2) < 0) break
  7090. c = str.charCodeAt(i)
  7091. hi = c >> 8
  7092. lo = c % 256
  7093. byteArray.push(lo)
  7094. byteArray.push(hi)
  7095. }
  7096. return byteArray
  7097. }
  7098. function base64ToBytes (str) {
  7099. return base64.toByteArray(base64clean(str))
  7100. }
  7101. function blitBuffer (src, dst, offset, length) {
  7102. for (var i = 0; i < length; ++i) {
  7103. if ((i + offset >= dst.length) || (i >= src.length)) break
  7104. dst[i + offset] = src[i]
  7105. }
  7106. return i
  7107. }
  7108. function isnan (val) {
  7109. return val !== val // eslint-disable-line no-self-compare
  7110. }
  7111. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7112. /***/ }),
  7113. /***/ "./node_modules/component-bind/index.js":
  7114. /*!**********************************************!*\
  7115. !*** ./node_modules/component-bind/index.js ***!
  7116. \**********************************************/
  7117. /*! no static exports found */
  7118. /***/ (function(module, exports) {
  7119. /**
  7120. * Slice reference.
  7121. */
  7122. var slice = [].slice;
  7123. /**
  7124. * Bind `obj` to `fn`.
  7125. *
  7126. * @param {Object} obj
  7127. * @param {Function|String} fn or string
  7128. * @return {Function}
  7129. * @api public
  7130. */
  7131. module.exports = function(obj, fn){
  7132. if ('string' == typeof fn) fn = obj[fn];
  7133. if ('function' != typeof fn) throw new Error('bind() requires a function');
  7134. var args = slice.call(arguments, 2);
  7135. return function(){
  7136. return fn.apply(obj, args.concat(slice.call(arguments)));
  7137. }
  7138. };
  7139. /***/ }),
  7140. /***/ "./node_modules/component-emitter/index.js":
  7141. /*!*************************************************!*\
  7142. !*** ./node_modules/component-emitter/index.js ***!
  7143. \*************************************************/
  7144. /*! no static exports found */
  7145. /***/ (function(module, exports, __webpack_require__) {
  7146. /**
  7147. * Expose `Emitter`.
  7148. */
  7149. if (true) {
  7150. module.exports = Emitter;
  7151. }
  7152. /**
  7153. * Initialize a new `Emitter`.
  7154. *
  7155. * @api public
  7156. */
  7157. function Emitter(obj) {
  7158. if (obj) return mixin(obj);
  7159. };
  7160. /**
  7161. * Mixin the emitter properties.
  7162. *
  7163. * @param {Object} obj
  7164. * @return {Object}
  7165. * @api private
  7166. */
  7167. function mixin(obj) {
  7168. for (var key in Emitter.prototype) {
  7169. obj[key] = Emitter.prototype[key];
  7170. }
  7171. return obj;
  7172. }
  7173. /**
  7174. * Listen on the given `event` with `fn`.
  7175. *
  7176. * @param {String} event
  7177. * @param {Function} fn
  7178. * @return {Emitter}
  7179. * @api public
  7180. */
  7181. Emitter.prototype.on =
  7182. Emitter.prototype.addEventListener = function(event, fn){
  7183. this._callbacks = this._callbacks || {};
  7184. (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
  7185. .push(fn);
  7186. return this;
  7187. };
  7188. /**
  7189. * Adds an `event` listener that will be invoked a single
  7190. * time then automatically removed.
  7191. *
  7192. * @param {String} event
  7193. * @param {Function} fn
  7194. * @return {Emitter}
  7195. * @api public
  7196. */
  7197. Emitter.prototype.once = function(event, fn){
  7198. function on() {
  7199. this.off(event, on);
  7200. fn.apply(this, arguments);
  7201. }
  7202. on.fn = fn;
  7203. this.on(event, on);
  7204. return this;
  7205. };
  7206. /**
  7207. * Remove the given callback for `event` or all
  7208. * registered callbacks.
  7209. *
  7210. * @param {String} event
  7211. * @param {Function} fn
  7212. * @return {Emitter}
  7213. * @api public
  7214. */
  7215. Emitter.prototype.off =
  7216. Emitter.prototype.removeListener =
  7217. Emitter.prototype.removeAllListeners =
  7218. Emitter.prototype.removeEventListener = function(event, fn){
  7219. this._callbacks = this._callbacks || {};
  7220. // all
  7221. if (0 == arguments.length) {
  7222. this._callbacks = {};
  7223. return this;
  7224. }
  7225. // specific event
  7226. var callbacks = this._callbacks['$' + event];
  7227. if (!callbacks) return this;
  7228. // remove all handlers
  7229. if (1 == arguments.length) {
  7230. delete this._callbacks['$' + event];
  7231. return this;
  7232. }
  7233. // remove specific handler
  7234. var cb;
  7235. for (var i = 0; i < callbacks.length; i++) {
  7236. cb = callbacks[i];
  7237. if (cb === fn || cb.fn === fn) {
  7238. callbacks.splice(i, 1);
  7239. break;
  7240. }
  7241. }
  7242. return this;
  7243. };
  7244. /**
  7245. * Emit `event` with the given args.
  7246. *
  7247. * @param {String} event
  7248. * @param {Mixed} ...
  7249. * @return {Emitter}
  7250. */
  7251. Emitter.prototype.emit = function(event){
  7252. this._callbacks = this._callbacks || {};
  7253. var args = [].slice.call(arguments, 1)
  7254. , callbacks = this._callbacks['$' + event];
  7255. if (callbacks) {
  7256. callbacks = callbacks.slice(0);
  7257. for (var i = 0, len = callbacks.length; i < len; ++i) {
  7258. callbacks[i].apply(this, args);
  7259. }
  7260. }
  7261. return this;
  7262. };
  7263. /**
  7264. * Return array of callbacks for `event`.
  7265. *
  7266. * @param {String} event
  7267. * @return {Array}
  7268. * @api public
  7269. */
  7270. Emitter.prototype.listeners = function(event){
  7271. this._callbacks = this._callbacks || {};
  7272. return this._callbacks['$' + event] || [];
  7273. };
  7274. /**
  7275. * Check if this emitter has `event` handlers.
  7276. *
  7277. * @param {String} event
  7278. * @return {Boolean}
  7279. * @api public
  7280. */
  7281. Emitter.prototype.hasListeners = function(event){
  7282. return !! this.listeners(event).length;
  7283. };
  7284. /***/ }),
  7285. /***/ "./node_modules/component-inherit/index.js":
  7286. /*!*************************************************!*\
  7287. !*** ./node_modules/component-inherit/index.js ***!
  7288. \*************************************************/
  7289. /*! no static exports found */
  7290. /***/ (function(module, exports) {
  7291. module.exports = function(a, b){
  7292. var fn = function(){};
  7293. fn.prototype = b.prototype;
  7294. a.prototype = new fn;
  7295. a.prototype.constructor = a;
  7296. };
  7297. /***/ }),
  7298. /***/ "./node_modules/debug/node_modules/ms/index.js":
  7299. /*!*****************************************************!*\
  7300. !*** ./node_modules/debug/node_modules/ms/index.js ***!
  7301. \*****************************************************/
  7302. /*! no static exports found */
  7303. /***/ (function(module, exports) {
  7304. /**
  7305. * Helpers.
  7306. */
  7307. var s = 1000;
  7308. var m = s * 60;
  7309. var h = m * 60;
  7310. var d = h * 24;
  7311. var w = d * 7;
  7312. var y = d * 365.25;
  7313. /**
  7314. * Parse or format the given `val`.
  7315. *
  7316. * Options:
  7317. *
  7318. * - `long` verbose formatting [false]
  7319. *
  7320. * @param {String|Number} val
  7321. * @param {Object} [options]
  7322. * @throws {Error} throw an error if val is not a non-empty string or a number
  7323. * @return {String|Number}
  7324. * @api public
  7325. */
  7326. module.exports = function(val, options) {
  7327. options = options || {};
  7328. var type = typeof val;
  7329. if (type === 'string' && val.length > 0) {
  7330. return parse(val);
  7331. } else if (type === 'number' && isFinite(val)) {
  7332. return options.long ? fmtLong(val) : fmtShort(val);
  7333. }
  7334. throw new Error(
  7335. 'val is not a non-empty string or a valid number. val=' +
  7336. JSON.stringify(val)
  7337. );
  7338. };
  7339. /**
  7340. * Parse the given `str` and return milliseconds.
  7341. *
  7342. * @param {String} str
  7343. * @return {Number}
  7344. * @api private
  7345. */
  7346. function parse(str) {
  7347. str = String(str);
  7348. if (str.length > 100) {
  7349. return;
  7350. }
  7351. var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
  7352. str
  7353. );
  7354. if (!match) {
  7355. return;
  7356. }
  7357. var n = parseFloat(match[1]);
  7358. var type = (match[2] || 'ms').toLowerCase();
  7359. switch (type) {
  7360. case 'years':
  7361. case 'year':
  7362. case 'yrs':
  7363. case 'yr':
  7364. case 'y':
  7365. return n * y;
  7366. case 'weeks':
  7367. case 'week':
  7368. case 'w':
  7369. return n * w;
  7370. case 'days':
  7371. case 'day':
  7372. case 'd':
  7373. return n * d;
  7374. case 'hours':
  7375. case 'hour':
  7376. case 'hrs':
  7377. case 'hr':
  7378. case 'h':
  7379. return n * h;
  7380. case 'minutes':
  7381. case 'minute':
  7382. case 'mins':
  7383. case 'min':
  7384. case 'm':
  7385. return n * m;
  7386. case 'seconds':
  7387. case 'second':
  7388. case 'secs':
  7389. case 'sec':
  7390. case 's':
  7391. return n * s;
  7392. case 'milliseconds':
  7393. case 'millisecond':
  7394. case 'msecs':
  7395. case 'msec':
  7396. case 'ms':
  7397. return n;
  7398. default:
  7399. return undefined;
  7400. }
  7401. }
  7402. /**
  7403. * Short format for `ms`.
  7404. *
  7405. * @param {Number} ms
  7406. * @return {String}
  7407. * @api private
  7408. */
  7409. function fmtShort(ms) {
  7410. var msAbs = Math.abs(ms);
  7411. if (msAbs >= d) {
  7412. return Math.round(ms / d) + 'd';
  7413. }
  7414. if (msAbs >= h) {
  7415. return Math.round(ms / h) + 'h';
  7416. }
  7417. if (msAbs >= m) {
  7418. return Math.round(ms / m) + 'm';
  7419. }
  7420. if (msAbs >= s) {
  7421. return Math.round(ms / s) + 's';
  7422. }
  7423. return ms + 'ms';
  7424. }
  7425. /**
  7426. * Long format for `ms`.
  7427. *
  7428. * @param {Number} ms
  7429. * @return {String}
  7430. * @api private
  7431. */
  7432. function fmtLong(ms) {
  7433. var msAbs = Math.abs(ms);
  7434. if (msAbs >= d) {
  7435. return plural(ms, msAbs, d, 'day');
  7436. }
  7437. if (msAbs >= h) {
  7438. return plural(ms, msAbs, h, 'hour');
  7439. }
  7440. if (msAbs >= m) {
  7441. return plural(ms, msAbs, m, 'minute');
  7442. }
  7443. if (msAbs >= s) {
  7444. return plural(ms, msAbs, s, 'second');
  7445. }
  7446. return ms + ' ms';
  7447. }
  7448. /**
  7449. * Pluralization helper.
  7450. */
  7451. function plural(ms, msAbs, n, name) {
  7452. var isPlural = msAbs >= n * 1.5;
  7453. return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
  7454. }
  7455. /***/ }),
  7456. /***/ "./node_modules/debug/src/browser.js":
  7457. /*!*******************************************!*\
  7458. !*** ./node_modules/debug/src/browser.js ***!
  7459. \*******************************************/
  7460. /*! no static exports found */
  7461. /***/ (function(module, exports, __webpack_require__) {
  7462. /* WEBPACK VAR INJECTION */(function(process) {/* eslint-env browser */
  7463. /**
  7464. * This is the web browser implementation of `debug()`.
  7465. */
  7466. exports.log = log;
  7467. exports.formatArgs = formatArgs;
  7468. exports.save = save;
  7469. exports.load = load;
  7470. exports.useColors = useColors;
  7471. exports.storage = localstorage();
  7472. /**
  7473. * Colors.
  7474. */
  7475. exports.colors = [
  7476. '#0000CC',
  7477. '#0000FF',
  7478. '#0033CC',
  7479. '#0033FF',
  7480. '#0066CC',
  7481. '#0066FF',
  7482. '#0099CC',
  7483. '#0099FF',
  7484. '#00CC00',
  7485. '#00CC33',
  7486. '#00CC66',
  7487. '#00CC99',
  7488. '#00CCCC',
  7489. '#00CCFF',
  7490. '#3300CC',
  7491. '#3300FF',
  7492. '#3333CC',
  7493. '#3333FF',
  7494. '#3366CC',
  7495. '#3366FF',
  7496. '#3399CC',
  7497. '#3399FF',
  7498. '#33CC00',
  7499. '#33CC33',
  7500. '#33CC66',
  7501. '#33CC99',
  7502. '#33CCCC',
  7503. '#33CCFF',
  7504. '#6600CC',
  7505. '#6600FF',
  7506. '#6633CC',
  7507. '#6633FF',
  7508. '#66CC00',
  7509. '#66CC33',
  7510. '#9900CC',
  7511. '#9900FF',
  7512. '#9933CC',
  7513. '#9933FF',
  7514. '#99CC00',
  7515. '#99CC33',
  7516. '#CC0000',
  7517. '#CC0033',
  7518. '#CC0066',
  7519. '#CC0099',
  7520. '#CC00CC',
  7521. '#CC00FF',
  7522. '#CC3300',
  7523. '#CC3333',
  7524. '#CC3366',
  7525. '#CC3399',
  7526. '#CC33CC',
  7527. '#CC33FF',
  7528. '#CC6600',
  7529. '#CC6633',
  7530. '#CC9900',
  7531. '#CC9933',
  7532. '#CCCC00',
  7533. '#CCCC33',
  7534. '#FF0000',
  7535. '#FF0033',
  7536. '#FF0066',
  7537. '#FF0099',
  7538. '#FF00CC',
  7539. '#FF00FF',
  7540. '#FF3300',
  7541. '#FF3333',
  7542. '#FF3366',
  7543. '#FF3399',
  7544. '#FF33CC',
  7545. '#FF33FF',
  7546. '#FF6600',
  7547. '#FF6633',
  7548. '#FF9900',
  7549. '#FF9933',
  7550. '#FFCC00',
  7551. '#FFCC33'
  7552. ];
  7553. /**
  7554. * Currently only WebKit-based Web Inspectors, Firefox >= v31,
  7555. * and the Firebug extension (any Firefox version) are known
  7556. * to support "%c" CSS customizations.
  7557. *
  7558. * TODO: add a `localStorage` variable to explicitly enable/disable colors
  7559. */
  7560. // eslint-disable-next-line complexity
  7561. function useColors() {
  7562. // NB: In an Electron preload script, document will be defined but not fully
  7563. // initialized. Since we know we're in Chrome, we'll just detect this case
  7564. // explicitly
  7565. if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
  7566. return true;
  7567. }
  7568. // Internet Explorer and Edge do not support colors.
  7569. if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
  7570. return false;
  7571. }
  7572. // Is webkit? http://stackoverflow.com/a/16459606/376773
  7573. // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
  7574. return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
  7575. // Is firebug? http://stackoverflow.com/a/398120/376773
  7576. (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
  7577. // Is firefox >= v31?
  7578. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  7579. (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
  7580. // Double check webkit in userAgent just in case we are in a worker
  7581. (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
  7582. }
  7583. /**
  7584. * Colorize log arguments if enabled.
  7585. *
  7586. * @api public
  7587. */
  7588. function formatArgs(args) {
  7589. args[0] = (this.useColors ? '%c' : '') +
  7590. this.namespace +
  7591. (this.useColors ? ' %c' : ' ') +
  7592. args[0] +
  7593. (this.useColors ? '%c ' : ' ') +
  7594. '+' + module.exports.humanize(this.diff);
  7595. if (!this.useColors) {
  7596. return;
  7597. }
  7598. const c = 'color: ' + this.color;
  7599. args.splice(1, 0, c, 'color: inherit');
  7600. // The final "%c" is somewhat tricky, because there could be other
  7601. // arguments passed either before or after the %c, so we need to
  7602. // figure out the correct index to insert the CSS into
  7603. let index = 0;
  7604. let lastC = 0;
  7605. args[0].replace(/%[a-zA-Z%]/g, match => {
  7606. if (match === '%%') {
  7607. return;
  7608. }
  7609. index++;
  7610. if (match === '%c') {
  7611. // We only are interested in the *last* %c
  7612. // (the user may have provided their own)
  7613. lastC = index;
  7614. }
  7615. });
  7616. args.splice(lastC, 0, c);
  7617. }
  7618. /**
  7619. * Invokes `console.log()` when available.
  7620. * No-op when `console.log` is not a "function".
  7621. *
  7622. * @api public
  7623. */
  7624. function log(...args) {
  7625. // This hackery is required for IE8/9, where
  7626. // the `console.log` function doesn't have 'apply'
  7627. return typeof console === 'object' &&
  7628. console.log &&
  7629. console.log(...args);
  7630. }
  7631. /**
  7632. * Save `namespaces`.
  7633. *
  7634. * @param {String} namespaces
  7635. * @api private
  7636. */
  7637. function save(namespaces) {
  7638. try {
  7639. if (namespaces) {
  7640. exports.storage.setItem('debug', namespaces);
  7641. } else {
  7642. exports.storage.removeItem('debug');
  7643. }
  7644. } catch (error) {
  7645. // Swallow
  7646. // XXX (@Qix-) should we be logging these?
  7647. }
  7648. }
  7649. /**
  7650. * Load `namespaces`.
  7651. *
  7652. * @return {String} returns the previously persisted debug modes
  7653. * @api private
  7654. */
  7655. function load() {
  7656. let r;
  7657. try {
  7658. r = exports.storage.getItem('debug');
  7659. } catch (error) {
  7660. // Swallow
  7661. // XXX (@Qix-) should we be logging these?
  7662. }
  7663. // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
  7664. if (!r && typeof process !== 'undefined' && 'env' in process) {
  7665. r = process.env.DEBUG;
  7666. }
  7667. return r;
  7668. }
  7669. /**
  7670. * Localstorage attempts to return the localstorage.
  7671. *
  7672. * This is necessary because safari throws
  7673. * when a user disables cookies/localstorage
  7674. * and you attempt to access it.
  7675. *
  7676. * @return {LocalStorage}
  7677. * @api private
  7678. */
  7679. function localstorage() {
  7680. try {
  7681. // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
  7682. // The Browser also has localStorage in the global context.
  7683. return localStorage;
  7684. } catch (error) {
  7685. // Swallow
  7686. // XXX (@Qix-) should we be logging these?
  7687. }
  7688. }
  7689. module.exports = __webpack_require__(/*! ./common */ "./node_modules/debug/src/common.js")(exports);
  7690. const {formatters} = module.exports;
  7691. /**
  7692. * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
  7693. */
  7694. formatters.j = function (v) {
  7695. try {
  7696. return JSON.stringify(v);
  7697. } catch (error) {
  7698. return '[UnexpectedJSONParseError]: ' + error.message;
  7699. }
  7700. };
  7701. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  7702. /***/ }),
  7703. /***/ "./node_modules/debug/src/common.js":
  7704. /*!******************************************!*\
  7705. !*** ./node_modules/debug/src/common.js ***!
  7706. \******************************************/
  7707. /*! no static exports found */
  7708. /***/ (function(module, exports, __webpack_require__) {
  7709. /**
  7710. * This is the common logic for both the Node.js and web browser
  7711. * implementations of `debug()`.
  7712. */
  7713. function setup(env) {
  7714. createDebug.debug = createDebug;
  7715. createDebug.default = createDebug;
  7716. createDebug.coerce = coerce;
  7717. createDebug.disable = disable;
  7718. createDebug.enable = enable;
  7719. createDebug.enabled = enabled;
  7720. createDebug.humanize = __webpack_require__(/*! ms */ "./node_modules/debug/node_modules/ms/index.js");
  7721. Object.keys(env).forEach(key => {
  7722. createDebug[key] = env[key];
  7723. });
  7724. /**
  7725. * Active `debug` instances.
  7726. */
  7727. createDebug.instances = [];
  7728. /**
  7729. * The currently active debug mode names, and names to skip.
  7730. */
  7731. createDebug.names = [];
  7732. createDebug.skips = [];
  7733. /**
  7734. * Map of special "%n" handling functions, for the debug "format" argument.
  7735. *
  7736. * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
  7737. */
  7738. createDebug.formatters = {};
  7739. /**
  7740. * Selects a color for a debug namespace
  7741. * @param {String} namespace The namespace string for the for the debug instance to be colored
  7742. * @return {Number|String} An ANSI color code for the given namespace
  7743. * @api private
  7744. */
  7745. function selectColor(namespace) {
  7746. let hash = 0;
  7747. for (let i = 0; i < namespace.length; i++) {
  7748. hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
  7749. hash |= 0; // Convert to 32bit integer
  7750. }
  7751. return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
  7752. }
  7753. createDebug.selectColor = selectColor;
  7754. /**
  7755. * Create a debugger with the given `namespace`.
  7756. *
  7757. * @param {String} namespace
  7758. * @return {Function}
  7759. * @api public
  7760. */
  7761. function createDebug(namespace) {
  7762. let prevTime;
  7763. function debug(...args) {
  7764. // Disabled?
  7765. if (!debug.enabled) {
  7766. return;
  7767. }
  7768. const self = debug;
  7769. // Set `diff` timestamp
  7770. const curr = Number(new Date());
  7771. const ms = curr - (prevTime || curr);
  7772. self.diff = ms;
  7773. self.prev = prevTime;
  7774. self.curr = curr;
  7775. prevTime = curr;
  7776. args[0] = createDebug.coerce(args[0]);
  7777. if (typeof args[0] !== 'string') {
  7778. // Anything else let's inspect with %O
  7779. args.unshift('%O');
  7780. }
  7781. // Apply any `formatters` transformations
  7782. let index = 0;
  7783. args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
  7784. // If we encounter an escaped % then don't increase the array index
  7785. if (match === '%%') {
  7786. return match;
  7787. }
  7788. index++;
  7789. const formatter = createDebug.formatters[format];
  7790. if (typeof formatter === 'function') {
  7791. const val = args[index];
  7792. match = formatter.call(self, val);
  7793. // Now we need to remove `args[index]` since it's inlined in the `format`
  7794. args.splice(index, 1);
  7795. index--;
  7796. }
  7797. return match;
  7798. });
  7799. // Apply env-specific formatting (colors, etc.)
  7800. createDebug.formatArgs.call(self, args);
  7801. const logFn = self.log || createDebug.log;
  7802. logFn.apply(self, args);
  7803. }
  7804. debug.namespace = namespace;
  7805. debug.enabled = createDebug.enabled(namespace);
  7806. debug.useColors = createDebug.useColors();
  7807. debug.color = selectColor(namespace);
  7808. debug.destroy = destroy;
  7809. debug.extend = extend;
  7810. // Debug.formatArgs = formatArgs;
  7811. // debug.rawLog = rawLog;
  7812. // env-specific initialization logic for debug instances
  7813. if (typeof createDebug.init === 'function') {
  7814. createDebug.init(debug);
  7815. }
  7816. createDebug.instances.push(debug);
  7817. return debug;
  7818. }
  7819. function destroy() {
  7820. const index = createDebug.instances.indexOf(this);
  7821. if (index !== -1) {
  7822. createDebug.instances.splice(index, 1);
  7823. return true;
  7824. }
  7825. return false;
  7826. }
  7827. function extend(namespace, delimiter) {
  7828. const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
  7829. newDebug.log = this.log;
  7830. return newDebug;
  7831. }
  7832. /**
  7833. * Enables a debug mode by namespaces. This can include modes
  7834. * separated by a colon and wildcards.
  7835. *
  7836. * @param {String} namespaces
  7837. * @api public
  7838. */
  7839. function enable(namespaces) {
  7840. createDebug.save(namespaces);
  7841. createDebug.names = [];
  7842. createDebug.skips = [];
  7843. let i;
  7844. const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
  7845. const len = split.length;
  7846. for (i = 0; i < len; i++) {
  7847. if (!split[i]) {
  7848. // ignore empty strings
  7849. continue;
  7850. }
  7851. namespaces = split[i].replace(/\*/g, '.*?');
  7852. if (namespaces[0] === '-') {
  7853. createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
  7854. } else {
  7855. createDebug.names.push(new RegExp('^' + namespaces + '$'));
  7856. }
  7857. }
  7858. for (i = 0; i < createDebug.instances.length; i++) {
  7859. const instance = createDebug.instances[i];
  7860. instance.enabled = createDebug.enabled(instance.namespace);
  7861. }
  7862. }
  7863. /**
  7864. * Disable debug output.
  7865. *
  7866. * @return {String} namespaces
  7867. * @api public
  7868. */
  7869. function disable() {
  7870. const namespaces = [
  7871. ...createDebug.names.map(toNamespace),
  7872. ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
  7873. ].join(',');
  7874. createDebug.enable('');
  7875. return namespaces;
  7876. }
  7877. /**
  7878. * Returns true if the given mode name is enabled, false otherwise.
  7879. *
  7880. * @param {String} name
  7881. * @return {Boolean}
  7882. * @api public
  7883. */
  7884. function enabled(name) {
  7885. if (name[name.length - 1] === '*') {
  7886. return true;
  7887. }
  7888. let i;
  7889. let len;
  7890. for (i = 0, len = createDebug.skips.length; i < len; i++) {
  7891. if (createDebug.skips[i].test(name)) {
  7892. return false;
  7893. }
  7894. }
  7895. for (i = 0, len = createDebug.names.length; i < len; i++) {
  7896. if (createDebug.names[i].test(name)) {
  7897. return true;
  7898. }
  7899. }
  7900. return false;
  7901. }
  7902. /**
  7903. * Convert regexp to namespace
  7904. *
  7905. * @param {RegExp} regxep
  7906. * @return {String} namespace
  7907. * @api private
  7908. */
  7909. function toNamespace(regexp) {
  7910. return regexp.toString()
  7911. .substring(2, regexp.toString().length - 2)
  7912. .replace(/\.\*\?$/, '*');
  7913. }
  7914. /**
  7915. * Coerce `val`.
  7916. *
  7917. * @param {Mixed} val
  7918. * @return {Mixed}
  7919. * @api private
  7920. */
  7921. function coerce(val) {
  7922. if (val instanceof Error) {
  7923. return val.stack || val.message;
  7924. }
  7925. return val;
  7926. }
  7927. createDebug.enable(createDebug.load());
  7928. return createDebug;
  7929. }
  7930. module.exports = setup;
  7931. /***/ }),
  7932. /***/ "./node_modules/engine.io-client/lib/globalThis.browser.js":
  7933. /*!*****************************************************************!*\
  7934. !*** ./node_modules/engine.io-client/lib/globalThis.browser.js ***!
  7935. \*****************************************************************/
  7936. /*! no static exports found */
  7937. /***/ (function(module, exports) {
  7938. module.exports = (function () {
  7939. if (typeof self !== 'undefined') {
  7940. return self;
  7941. } else if (typeof window !== 'undefined') {
  7942. return window;
  7943. } else {
  7944. return Function('return this')(); // eslint-disable-line no-new-func
  7945. }
  7946. })();
  7947. /***/ }),
  7948. /***/ "./node_modules/engine.io-client/lib/index.js":
  7949. /*!****************************************************!*\
  7950. !*** ./node_modules/engine.io-client/lib/index.js ***!
  7951. \****************************************************/
  7952. /*! no static exports found */
  7953. /***/ (function(module, exports, __webpack_require__) {
  7954. module.exports = __webpack_require__(/*! ./socket */ "./node_modules/engine.io-client/lib/socket.js");
  7955. /**
  7956. * Exports parser
  7957. *
  7958. * @api public
  7959. *
  7960. */
  7961. module.exports.parser = __webpack_require__(/*! engine.io-parser */ "./node_modules/engine.io-parser/lib/browser.js");
  7962. /***/ }),
  7963. /***/ "./node_modules/engine.io-client/lib/socket.js":
  7964. /*!*****************************************************!*\
  7965. !*** ./node_modules/engine.io-client/lib/socket.js ***!
  7966. \*****************************************************/
  7967. /*! no static exports found */
  7968. /***/ (function(module, exports, __webpack_require__) {
  7969. /**
  7970. * Module dependencies.
  7971. */
  7972. var transports = __webpack_require__(/*! ./transports/index */ "./node_modules/engine.io-client/lib/transports/index.js");
  7973. var Emitter = __webpack_require__(/*! component-emitter */ "./node_modules/engine.io-client/node_modules/component-emitter/index.js");
  7974. var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")('engine.io-client:socket');
  7975. var index = __webpack_require__(/*! indexof */ "./node_modules/indexof/index.js");
  7976. var parser = __webpack_require__(/*! engine.io-parser */ "./node_modules/engine.io-parser/lib/browser.js");
  7977. var parseuri = __webpack_require__(/*! parseuri */ "./node_modules/parseuri/index.js");
  7978. var parseqs = __webpack_require__(/*! parseqs */ "./node_modules/parseqs/index.js");
  7979. /**
  7980. * Module exports.
  7981. */
  7982. module.exports = Socket;
  7983. /**
  7984. * Socket constructor.
  7985. *
  7986. * @param {String|Object} uri or options
  7987. * @param {Object} options
  7988. * @api public
  7989. */
  7990. function Socket (uri, opts) {
  7991. if (!(this instanceof Socket)) return new Socket(uri, opts);
  7992. opts = opts || {};
  7993. if (uri && 'object' === typeof uri) {
  7994. opts = uri;
  7995. uri = null;
  7996. }
  7997. if (uri) {
  7998. uri = parseuri(uri);
  7999. opts.hostname = uri.host;
  8000. opts.secure = uri.protocol === 'https' || uri.protocol === 'wss';
  8001. opts.port = uri.port;
  8002. if (uri.query) opts.query = uri.query;
  8003. } else if (opts.host) {
  8004. opts.hostname = parseuri(opts.host).host;
  8005. }
  8006. this.secure = null != opts.secure ? opts.secure
  8007. : (typeof location !== 'undefined' && 'https:' === location.protocol);
  8008. if (opts.hostname && !opts.port) {
  8009. // if no port is specified manually, use the protocol default
  8010. opts.port = this.secure ? '443' : '80';
  8011. }
  8012. this.agent = opts.agent || false;
  8013. this.hostname = opts.hostname ||
  8014. (typeof location !== 'undefined' ? location.hostname : 'localhost');
  8015. this.port = opts.port || (typeof location !== 'undefined' && location.port
  8016. ? location.port
  8017. : (this.secure ? 443 : 80));
  8018. this.query = opts.query || {};
  8019. if ('string' === typeof this.query) this.query = parseqs.decode(this.query);
  8020. this.upgrade = false !== opts.upgrade;
  8021. this.path = (opts.path || '/engine.io').replace(/\/$/, '') + '/';
  8022. this.forceJSONP = !!opts.forceJSONP;
  8023. this.jsonp = false !== opts.jsonp;
  8024. this.forceBase64 = !!opts.forceBase64;
  8025. this.enablesXDR = !!opts.enablesXDR;
  8026. this.withCredentials = false !== opts.withCredentials;
  8027. this.timestampParam = opts.timestampParam || 't';
  8028. this.timestampRequests = opts.timestampRequests;
  8029. this.transports = opts.transports || ['polling', 'websocket'];
  8030. this.transportOptions = opts.transportOptions || {};
  8031. this.readyState = '';
  8032. this.writeBuffer = [];
  8033. this.prevBufferLen = 0;
  8034. this.policyPort = opts.policyPort || 843;
  8035. this.rememberUpgrade = opts.rememberUpgrade || false;
  8036. this.binaryType = null;
  8037. this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades;
  8038. this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false;
  8039. if (true === this.perMessageDeflate) this.perMessageDeflate = {};
  8040. if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) {
  8041. this.perMessageDeflate.threshold = 1024;
  8042. }
  8043. // SSL options for Node.js client
  8044. this.pfx = opts.pfx || null;
  8045. this.key = opts.key || null;
  8046. this.passphrase = opts.passphrase || null;
  8047. this.cert = opts.cert || null;
  8048. this.ca = opts.ca || null;
  8049. this.ciphers = opts.ciphers || null;
  8050. this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized;
  8051. this.forceNode = !!opts.forceNode;
  8052. // detect ReactNative environment
  8053. this.isReactNative = (typeof navigator !== 'undefined' && typeof navigator.product === 'string' && navigator.product.toLowerCase() === 'reactnative');
  8054. // other options for Node.js or ReactNative client
  8055. if (typeof self === 'undefined' || this.isReactNative) {
  8056. if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) {
  8057. this.extraHeaders = opts.extraHeaders;
  8058. }
  8059. if (opts.localAddress) {
  8060. this.localAddress = opts.localAddress;
  8061. }
  8062. }
  8063. // set on handshake
  8064. this.id = null;
  8065. this.upgrades = null;
  8066. this.pingInterval = null;
  8067. this.pingTimeout = null;
  8068. // set on heartbeat
  8069. this.pingIntervalTimer = null;
  8070. this.pingTimeoutTimer = null;
  8071. this.open();
  8072. }
  8073. Socket.priorWebsocketSuccess = false;
  8074. /**
  8075. * Mix in `Emitter`.
  8076. */
  8077. Emitter(Socket.prototype);
  8078. /**
  8079. * Protocol version.
  8080. *
  8081. * @api public
  8082. */
  8083. Socket.protocol = parser.protocol; // this is an int
  8084. /**
  8085. * Expose deps for legacy compatibility
  8086. * and standalone browser access.
  8087. */
  8088. Socket.Socket = Socket;
  8089. Socket.Transport = __webpack_require__(/*! ./transport */ "./node_modules/engine.io-client/lib/transport.js");
  8090. Socket.transports = __webpack_require__(/*! ./transports/index */ "./node_modules/engine.io-client/lib/transports/index.js");
  8091. Socket.parser = __webpack_require__(/*! engine.io-parser */ "./node_modules/engine.io-parser/lib/browser.js");
  8092. /**
  8093. * Creates transport of the given type.
  8094. *
  8095. * @param {String} transport name
  8096. * @return {Transport}
  8097. * @api private
  8098. */
  8099. Socket.prototype.createTransport = function (name) {
  8100. debug('creating transport "%s"', name);
  8101. var query = clone(this.query);
  8102. // append engine.io protocol identifier
  8103. query.EIO = parser.protocol;
  8104. // transport name
  8105. query.transport = name;
  8106. // per-transport options
  8107. var options = this.transportOptions[name] || {};
  8108. // session id if we already have one
  8109. if (this.id) query.sid = this.id;
  8110. var transport = new transports[name]({
  8111. query: query,
  8112. socket: this,
  8113. agent: options.agent || this.agent,
  8114. hostname: options.hostname || this.hostname,
  8115. port: options.port || this.port,
  8116. secure: options.secure || this.secure,
  8117. path: options.path || this.path,
  8118. forceJSONP: options.forceJSONP || this.forceJSONP,
  8119. jsonp: options.jsonp || this.jsonp,
  8120. forceBase64: options.forceBase64 || this.forceBase64,
  8121. enablesXDR: options.enablesXDR || this.enablesXDR,
  8122. withCredentials: options.withCredentials || this.withCredentials,
  8123. timestampRequests: options.timestampRequests || this.timestampRequests,
  8124. timestampParam: options.timestampParam || this.timestampParam,
  8125. policyPort: options.policyPort || this.policyPort,
  8126. pfx: options.pfx || this.pfx,
  8127. key: options.key || this.key,
  8128. passphrase: options.passphrase || this.passphrase,
  8129. cert: options.cert || this.cert,
  8130. ca: options.ca || this.ca,
  8131. ciphers: options.ciphers || this.ciphers,
  8132. rejectUnauthorized: options.rejectUnauthorized || this.rejectUnauthorized,
  8133. perMessageDeflate: options.perMessageDeflate || this.perMessageDeflate,
  8134. extraHeaders: options.extraHeaders || this.extraHeaders,
  8135. forceNode: options.forceNode || this.forceNode,
  8136. localAddress: options.localAddress || this.localAddress,
  8137. requestTimeout: options.requestTimeout || this.requestTimeout,
  8138. protocols: options.protocols || void (0),
  8139. isReactNative: this.isReactNative
  8140. });
  8141. return transport;
  8142. };
  8143. function clone (obj) {
  8144. var o = {};
  8145. for (var i in obj) {
  8146. if (obj.hasOwnProperty(i)) {
  8147. o[i] = obj[i];
  8148. }
  8149. }
  8150. return o;
  8151. }
  8152. /**
  8153. * Initializes transport to use and starts probe.
  8154. *
  8155. * @api private
  8156. */
  8157. Socket.prototype.open = function () {
  8158. var transport;
  8159. if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) {
  8160. transport = 'websocket';
  8161. } else if (0 === this.transports.length) {
  8162. // Emit error on next tick so it can be listened to
  8163. var self = this;
  8164. setTimeout(function () {
  8165. self.emit('error', 'No transports available');
  8166. }, 0);
  8167. return;
  8168. } else {
  8169. transport = this.transports[0];
  8170. }
  8171. this.readyState = 'opening';
  8172. // Retry with the next transport if the transport is disabled (jsonp: false)
  8173. try {
  8174. transport = this.createTransport(transport);
  8175. } catch (e) {
  8176. this.transports.shift();
  8177. this.open();
  8178. return;
  8179. }
  8180. transport.open();
  8181. this.setTransport(transport);
  8182. };
  8183. /**
  8184. * Sets the current transport. Disables the existing one (if any).
  8185. *
  8186. * @api private
  8187. */
  8188. Socket.prototype.setTransport = function (transport) {
  8189. debug('setting transport %s', transport.name);
  8190. var self = this;
  8191. if (this.transport) {
  8192. debug('clearing existing transport %s', this.transport.name);
  8193. this.transport.removeAllListeners();
  8194. }
  8195. // set up transport
  8196. this.transport = transport;
  8197. // set up transport listeners
  8198. transport
  8199. .on('drain', function () {
  8200. self.onDrain();
  8201. })
  8202. .on('packet', function (packet) {
  8203. self.onPacket(packet);
  8204. })
  8205. .on('error', function (e) {
  8206. self.onError(e);
  8207. })
  8208. .on('close', function () {
  8209. self.onClose('transport close');
  8210. });
  8211. };
  8212. /**
  8213. * Probes a transport.
  8214. *
  8215. * @param {String} transport name
  8216. * @api private
  8217. */
  8218. Socket.prototype.probe = function (name) {
  8219. debug('probing transport "%s"', name);
  8220. var transport = this.createTransport(name, { probe: 1 });
  8221. var failed = false;
  8222. var self = this;
  8223. Socket.priorWebsocketSuccess = false;
  8224. function onTransportOpen () {
  8225. if (self.onlyBinaryUpgrades) {
  8226. var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary;
  8227. failed = failed || upgradeLosesBinary;
  8228. }
  8229. if (failed) return;
  8230. debug('probe transport "%s" opened', name);
  8231. transport.send([{ type: 'ping', data: 'probe' }]);
  8232. transport.once('packet', function (msg) {
  8233. if (failed) return;
  8234. if ('pong' === msg.type && 'probe' === msg.data) {
  8235. debug('probe transport "%s" pong', name);
  8236. self.upgrading = true;
  8237. self.emit('upgrading', transport);
  8238. if (!transport) return;
  8239. Socket.priorWebsocketSuccess = 'websocket' === transport.name;
  8240. debug('pausing current transport "%s"', self.transport.name);
  8241. self.transport.pause(function () {
  8242. if (failed) return;
  8243. if ('closed' === self.readyState) return;
  8244. debug('changing transport and sending upgrade packet');
  8245. cleanup();
  8246. self.setTransport(transport);
  8247. transport.send([{ type: 'upgrade' }]);
  8248. self.emit('upgrade', transport);
  8249. transport = null;
  8250. self.upgrading = false;
  8251. self.flush();
  8252. });
  8253. } else {
  8254. debug('probe transport "%s" failed', name);
  8255. var err = new Error('probe error');
  8256. err.transport = transport.name;
  8257. self.emit('upgradeError', err);
  8258. }
  8259. });
  8260. }
  8261. function freezeTransport () {
  8262. if (failed) return;
  8263. // Any callback called by transport should be ignored since now
  8264. failed = true;
  8265. cleanup();
  8266. transport.close();
  8267. transport = null;
  8268. }
  8269. // Handle any error that happens while probing
  8270. function onerror (err) {
  8271. var error = new Error('probe error: ' + err);
  8272. error.transport = transport.name;
  8273. freezeTransport();
  8274. debug('probe transport "%s" failed because of error: %s', name, err);
  8275. self.emit('upgradeError', error);
  8276. }
  8277. function onTransportClose () {
  8278. onerror('transport closed');
  8279. }
  8280. // When the socket is closed while we're probing
  8281. function onclose () {
  8282. onerror('socket closed');
  8283. }
  8284. // When the socket is upgraded while we're probing
  8285. function onupgrade (to) {
  8286. if (transport && to.name !== transport.name) {
  8287. debug('"%s" works - aborting "%s"', to.name, transport.name);
  8288. freezeTransport();
  8289. }
  8290. }
  8291. // Remove all listeners on the transport and on self
  8292. function cleanup () {
  8293. transport.removeListener('open', onTransportOpen);
  8294. transport.removeListener('error', onerror);
  8295. transport.removeListener('close', onTransportClose);
  8296. self.removeListener('close', onclose);
  8297. self.removeListener('upgrading', onupgrade);
  8298. }
  8299. transport.once('open', onTransportOpen);
  8300. transport.once('error', onerror);
  8301. transport.once('close', onTransportClose);
  8302. this.once('close', onclose);
  8303. this.once('upgrading', onupgrade);
  8304. transport.open();
  8305. };
  8306. /**
  8307. * Called when connection is deemed open.
  8308. *
  8309. * @api public
  8310. */
  8311. Socket.prototype.onOpen = function () {
  8312. debug('socket open');
  8313. this.readyState = 'open';
  8314. Socket.priorWebsocketSuccess = 'websocket' === this.transport.name;
  8315. this.emit('open');
  8316. this.flush();
  8317. // we check for `readyState` in case an `open`
  8318. // listener already closed the socket
  8319. if ('open' === this.readyState && this.upgrade && this.transport.pause) {
  8320. debug('starting upgrade probes');
  8321. for (var i = 0, l = this.upgrades.length; i < l; i++) {
  8322. this.probe(this.upgrades[i]);
  8323. }
  8324. }
  8325. };
  8326. /**
  8327. * Handles a packet.
  8328. *
  8329. * @api private
  8330. */
  8331. Socket.prototype.onPacket = function (packet) {
  8332. if ('opening' === this.readyState || 'open' === this.readyState ||
  8333. 'closing' === this.readyState) {
  8334. debug('socket receive: type "%s", data "%s"', packet.type, packet.data);
  8335. this.emit('packet', packet);
  8336. // Socket is live - any packet counts
  8337. this.emit('heartbeat');
  8338. switch (packet.type) {
  8339. case 'open':
  8340. this.onHandshake(JSON.parse(packet.data));
  8341. break;
  8342. case 'pong':
  8343. this.setPing();
  8344. this.emit('pong');
  8345. break;
  8346. case 'error':
  8347. var err = new Error('server error');
  8348. err.code = packet.data;
  8349. this.onError(err);
  8350. break;
  8351. case 'message':
  8352. this.emit('data', packet.data);
  8353. this.emit('message', packet.data);
  8354. break;
  8355. }
  8356. } else {
  8357. debug('packet received with socket readyState "%s"', this.readyState);
  8358. }
  8359. };
  8360. /**
  8361. * Called upon handshake completion.
  8362. *
  8363. * @param {Object} handshake obj
  8364. * @api private
  8365. */
  8366. Socket.prototype.onHandshake = function (data) {
  8367. this.emit('handshake', data);
  8368. this.id = data.sid;
  8369. this.transport.query.sid = data.sid;
  8370. this.upgrades = this.filterUpgrades(data.upgrades);
  8371. this.pingInterval = data.pingInterval;
  8372. this.pingTimeout = data.pingTimeout;
  8373. this.onOpen();
  8374. // In case open handler closes socket
  8375. if ('closed' === this.readyState) return;
  8376. this.setPing();
  8377. // Prolong liveness of socket on heartbeat
  8378. this.removeListener('heartbeat', this.onHeartbeat);
  8379. this.on('heartbeat', this.onHeartbeat);
  8380. };
  8381. /**
  8382. * Resets ping timeout.
  8383. *
  8384. * @api private
  8385. */
  8386. Socket.prototype.onHeartbeat = function (timeout) {
  8387. clearTimeout(this.pingTimeoutTimer);
  8388. var self = this;
  8389. self.pingTimeoutTimer = setTimeout(function () {
  8390. if ('closed' === self.readyState) return;
  8391. self.onClose('ping timeout');
  8392. }, timeout || (self.pingInterval + self.pingTimeout));
  8393. };
  8394. /**
  8395. * Pings server every `this.pingInterval` and expects response
  8396. * within `this.pingTimeout` or closes connection.
  8397. *
  8398. * @api private
  8399. */
  8400. Socket.prototype.setPing = function () {
  8401. var self = this;
  8402. clearTimeout(self.pingIntervalTimer);
  8403. self.pingIntervalTimer = setTimeout(function () {
  8404. debug('writing ping packet - expecting pong within %sms', self.pingTimeout);
  8405. self.ping();
  8406. self.onHeartbeat(self.pingTimeout);
  8407. }, self.pingInterval);
  8408. };
  8409. /**
  8410. * Sends a ping packet.
  8411. *
  8412. * @api private
  8413. */
  8414. Socket.prototype.ping = function () {
  8415. var self = this;
  8416. this.sendPacket('ping', function () {
  8417. self.emit('ping');
  8418. });
  8419. };
  8420. /**
  8421. * Called on `drain` event
  8422. *
  8423. * @api private
  8424. */
  8425. Socket.prototype.onDrain = function () {
  8426. this.writeBuffer.splice(0, this.prevBufferLen);
  8427. // setting prevBufferLen = 0 is very important
  8428. // for example, when upgrading, upgrade packet is sent over,
  8429. // and a nonzero prevBufferLen could cause problems on `drain`
  8430. this.prevBufferLen = 0;
  8431. if (0 === this.writeBuffer.length) {
  8432. this.emit('drain');
  8433. } else {
  8434. this.flush();
  8435. }
  8436. };
  8437. /**
  8438. * Flush write buffers.
  8439. *
  8440. * @api private
  8441. */
  8442. Socket.prototype.flush = function () {
  8443. if ('closed' !== this.readyState && this.transport.writable &&
  8444. !this.upgrading && this.writeBuffer.length) {
  8445. debug('flushing %d packets in socket', this.writeBuffer.length);
  8446. this.transport.send(this.writeBuffer);
  8447. // keep track of current length of writeBuffer
  8448. // splice writeBuffer and callbackBuffer on `drain`
  8449. this.prevBufferLen = this.writeBuffer.length;
  8450. this.emit('flush');
  8451. }
  8452. };
  8453. /**
  8454. * Sends a message.
  8455. *
  8456. * @param {String} message.
  8457. * @param {Function} callback function.
  8458. * @param {Object} options.
  8459. * @return {Socket} for chaining.
  8460. * @api public
  8461. */
  8462. Socket.prototype.write =
  8463. Socket.prototype.send = function (msg, options, fn) {
  8464. this.sendPacket('message', msg, options, fn);
  8465. return this;
  8466. };
  8467. /**
  8468. * Sends a packet.
  8469. *
  8470. * @param {String} packet type.
  8471. * @param {String} data.
  8472. * @param {Object} options.
  8473. * @param {Function} callback function.
  8474. * @api private
  8475. */
  8476. Socket.prototype.sendPacket = function (type, data, options, fn) {
  8477. if ('function' === typeof data) {
  8478. fn = data;
  8479. data = undefined;
  8480. }
  8481. if ('function' === typeof options) {
  8482. fn = options;
  8483. options = null;
  8484. }
  8485. if ('closing' === this.readyState || 'closed' === this.readyState) {
  8486. return;
  8487. }
  8488. options = options || {};
  8489. options.compress = false !== options.compress;
  8490. var packet = {
  8491. type: type,
  8492. data: data,
  8493. options: options
  8494. };
  8495. this.emit('packetCreate', packet);
  8496. this.writeBuffer.push(packet);
  8497. if (fn) this.once('flush', fn);
  8498. this.flush();
  8499. };
  8500. /**
  8501. * Closes the connection.
  8502. *
  8503. * @api private
  8504. */
  8505. Socket.prototype.close = function () {
  8506. if ('opening' === this.readyState || 'open' === this.readyState) {
  8507. this.readyState = 'closing';
  8508. var self = this;
  8509. if (this.writeBuffer.length) {
  8510. this.once('drain', function () {
  8511. if (this.upgrading) {
  8512. waitForUpgrade();
  8513. } else {
  8514. close();
  8515. }
  8516. });
  8517. } else if (this.upgrading) {
  8518. waitForUpgrade();
  8519. } else {
  8520. close();
  8521. }
  8522. }
  8523. function close () {
  8524. self.onClose('forced close');
  8525. debug('socket closing - telling transport to close');
  8526. self.transport.close();
  8527. }
  8528. function cleanupAndClose () {
  8529. self.removeListener('upgrade', cleanupAndClose);
  8530. self.removeListener('upgradeError', cleanupAndClose);
  8531. close();
  8532. }
  8533. function waitForUpgrade () {
  8534. // wait for upgrade to finish since we can't send packets while pausing a transport
  8535. self.once('upgrade', cleanupAndClose);
  8536. self.once('upgradeError', cleanupAndClose);
  8537. }
  8538. return this;
  8539. };
  8540. /**
  8541. * Called upon transport error
  8542. *
  8543. * @api private
  8544. */
  8545. Socket.prototype.onError = function (err) {
  8546. debug('socket error %j', err);
  8547. Socket.priorWebsocketSuccess = false;
  8548. this.emit('error', err);
  8549. this.onClose('transport error', err);
  8550. };
  8551. /**
  8552. * Called upon transport close.
  8553. *
  8554. * @api private
  8555. */
  8556. Socket.prototype.onClose = function (reason, desc) {
  8557. if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) {
  8558. debug('socket close with reason: "%s"', reason);
  8559. var self = this;
  8560. // clear timers
  8561. clearTimeout(this.pingIntervalTimer);
  8562. clearTimeout(this.pingTimeoutTimer);
  8563. // stop event from firing again for transport
  8564. this.transport.removeAllListeners('close');
  8565. // ensure transport won't stay open
  8566. this.transport.close();
  8567. // ignore further transport communication
  8568. this.transport.removeAllListeners();
  8569. // set ready state
  8570. this.readyState = 'closed';
  8571. // clear session id
  8572. this.id = null;
  8573. // emit close event
  8574. this.emit('close', reason, desc);
  8575. // clean buffers after, so users can still
  8576. // grab the buffers on `close` event
  8577. self.writeBuffer = [];
  8578. self.prevBufferLen = 0;
  8579. }
  8580. };
  8581. /**
  8582. * Filters upgrades, returning only those matching client transports.
  8583. *
  8584. * @param {Array} server upgrades
  8585. * @api private
  8586. *
  8587. */
  8588. Socket.prototype.filterUpgrades = function (upgrades) {
  8589. var filteredUpgrades = [];
  8590. for (var i = 0, j = upgrades.length; i < j; i++) {
  8591. if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]);
  8592. }
  8593. return filteredUpgrades;
  8594. };
  8595. /***/ }),
  8596. /***/ "./node_modules/engine.io-client/lib/transport.js":
  8597. /*!********************************************************!*\
  8598. !*** ./node_modules/engine.io-client/lib/transport.js ***!
  8599. \********************************************************/
  8600. /*! no static exports found */
  8601. /***/ (function(module, exports, __webpack_require__) {
  8602. /**
  8603. * Module dependencies.
  8604. */
  8605. var parser = __webpack_require__(/*! engine.io-parser */ "./node_modules/engine.io-parser/lib/browser.js");
  8606. var Emitter = __webpack_require__(/*! component-emitter */ "./node_modules/engine.io-client/node_modules/component-emitter/index.js");
  8607. /**
  8608. * Module exports.
  8609. */
  8610. module.exports = Transport;
  8611. /**
  8612. * Transport abstract constructor.
  8613. *
  8614. * @param {Object} options.
  8615. * @api private
  8616. */
  8617. function Transport (opts) {
  8618. this.path = opts.path;
  8619. this.hostname = opts.hostname;
  8620. this.port = opts.port;
  8621. this.secure = opts.secure;
  8622. this.query = opts.query;
  8623. this.timestampParam = opts.timestampParam;
  8624. this.timestampRequests = opts.timestampRequests;
  8625. this.readyState = '';
  8626. this.agent = opts.agent || false;
  8627. this.socket = opts.socket;
  8628. this.enablesXDR = opts.enablesXDR;
  8629. this.withCredentials = opts.withCredentials;
  8630. // SSL options for Node.js client
  8631. this.pfx = opts.pfx;
  8632. this.key = opts.key;
  8633. this.passphrase = opts.passphrase;
  8634. this.cert = opts.cert;
  8635. this.ca = opts.ca;
  8636. this.ciphers = opts.ciphers;
  8637. this.rejectUnauthorized = opts.rejectUnauthorized;
  8638. this.forceNode = opts.forceNode;
  8639. // results of ReactNative environment detection
  8640. this.isReactNative = opts.isReactNative;
  8641. // other options for Node.js client
  8642. this.extraHeaders = opts.extraHeaders;
  8643. this.localAddress = opts.localAddress;
  8644. }
  8645. /**
  8646. * Mix in `Emitter`.
  8647. */
  8648. Emitter(Transport.prototype);
  8649. /**
  8650. * Emits an error.
  8651. *
  8652. * @param {String} str
  8653. * @return {Transport} for chaining
  8654. * @api public
  8655. */
  8656. Transport.prototype.onError = function (msg, desc) {
  8657. var err = new Error(msg);
  8658. err.type = 'TransportError';
  8659. err.description = desc;
  8660. this.emit('error', err);
  8661. return this;
  8662. };
  8663. /**
  8664. * Opens the transport.
  8665. *
  8666. * @api public
  8667. */
  8668. Transport.prototype.open = function () {
  8669. if ('closed' === this.readyState || '' === this.readyState) {
  8670. this.readyState = 'opening';
  8671. this.doOpen();
  8672. }
  8673. return this;
  8674. };
  8675. /**
  8676. * Closes the transport.
  8677. *
  8678. * @api private
  8679. */
  8680. Transport.prototype.close = function () {
  8681. if ('opening' === this.readyState || 'open' === this.readyState) {
  8682. this.doClose();
  8683. this.onClose();
  8684. }
  8685. return this;
  8686. };
  8687. /**
  8688. * Sends multiple packets.
  8689. *
  8690. * @param {Array} packets
  8691. * @api private
  8692. */
  8693. Transport.prototype.send = function (packets) {
  8694. if ('open' === this.readyState) {
  8695. this.write(packets);
  8696. } else {
  8697. throw new Error('Transport not open');
  8698. }
  8699. };
  8700. /**
  8701. * Called upon open
  8702. *
  8703. * @api private
  8704. */
  8705. Transport.prototype.onOpen = function () {
  8706. this.readyState = 'open';
  8707. this.writable = true;
  8708. this.emit('open');
  8709. };
  8710. /**
  8711. * Called with data.
  8712. *
  8713. * @param {String} data
  8714. * @api private
  8715. */
  8716. Transport.prototype.onData = function (data) {
  8717. var packet = parser.decodePacket(data, this.socket.binaryType);
  8718. this.onPacket(packet);
  8719. };
  8720. /**
  8721. * Called with a decoded packet.
  8722. */
  8723. Transport.prototype.onPacket = function (packet) {
  8724. this.emit('packet', packet);
  8725. };
  8726. /**
  8727. * Called upon close.
  8728. *
  8729. * @api private
  8730. */
  8731. Transport.prototype.onClose = function () {
  8732. this.readyState = 'closed';
  8733. this.emit('close');
  8734. };
  8735. /***/ }),
  8736. /***/ "./node_modules/engine.io-client/lib/transports/index.js":
  8737. /*!***************************************************************!*\
  8738. !*** ./node_modules/engine.io-client/lib/transports/index.js ***!
  8739. \***************************************************************/
  8740. /*! no static exports found */
  8741. /***/ (function(module, exports, __webpack_require__) {
  8742. /**
  8743. * Module dependencies
  8744. */
  8745. var XMLHttpRequest = __webpack_require__(/*! xmlhttprequest-ssl */ "./node_modules/engine.io-client/lib/xmlhttprequest.js");
  8746. var XHR = __webpack_require__(/*! ./polling-xhr */ "./node_modules/engine.io-client/lib/transports/polling-xhr.js");
  8747. var JSONP = __webpack_require__(/*! ./polling-jsonp */ "./node_modules/engine.io-client/lib/transports/polling-jsonp.js");
  8748. var websocket = __webpack_require__(/*! ./websocket */ "./node_modules/engine.io-client/lib/transports/websocket.js");
  8749. /**
  8750. * Export transports.
  8751. */
  8752. exports.polling = polling;
  8753. exports.websocket = websocket;
  8754. /**
  8755. * Polling transport polymorphic constructor.
  8756. * Decides on xhr vs jsonp based on feature detection.
  8757. *
  8758. * @api private
  8759. */
  8760. function polling (opts) {
  8761. var xhr;
  8762. var xd = false;
  8763. var xs = false;
  8764. var jsonp = false !== opts.jsonp;
  8765. if (typeof location !== 'undefined') {
  8766. var isSSL = 'https:' === location.protocol;
  8767. var port = location.port;
  8768. // some user agents have empty `location.port`
  8769. if (!port) {
  8770. port = isSSL ? 443 : 80;
  8771. }
  8772. xd = opts.hostname !== location.hostname || port !== opts.port;
  8773. xs = opts.secure !== isSSL;
  8774. }
  8775. opts.xdomain = xd;
  8776. opts.xscheme = xs;
  8777. xhr = new XMLHttpRequest(opts);
  8778. if ('open' in xhr && !opts.forceJSONP) {
  8779. return new XHR(opts);
  8780. } else {
  8781. if (!jsonp) throw new Error('JSONP disabled');
  8782. return new JSONP(opts);
  8783. }
  8784. }
  8785. /***/ }),
  8786. /***/ "./node_modules/engine.io-client/lib/transports/polling-jsonp.js":
  8787. /*!***********************************************************************!*\
  8788. !*** ./node_modules/engine.io-client/lib/transports/polling-jsonp.js ***!
  8789. \***********************************************************************/
  8790. /*! no static exports found */
  8791. /***/ (function(module, exports, __webpack_require__) {
  8792. /**
  8793. * Module requirements.
  8794. */
  8795. var Polling = __webpack_require__(/*! ./polling */ "./node_modules/engine.io-client/lib/transports/polling.js");
  8796. var inherit = __webpack_require__(/*! component-inherit */ "./node_modules/component-inherit/index.js");
  8797. var globalThis = __webpack_require__(/*! ../globalThis */ "./node_modules/engine.io-client/lib/globalThis.browser.js");
  8798. /**
  8799. * Module exports.
  8800. */
  8801. module.exports = JSONPPolling;
  8802. /**
  8803. * Cached regular expressions.
  8804. */
  8805. var rNewline = /\n/g;
  8806. var rEscapedNewline = /\\n/g;
  8807. /**
  8808. * Global JSONP callbacks.
  8809. */
  8810. var callbacks;
  8811. /**
  8812. * Noop.
  8813. */
  8814. function empty () { }
  8815. /**
  8816. * JSONP Polling constructor.
  8817. *
  8818. * @param {Object} opts.
  8819. * @api public
  8820. */
  8821. function JSONPPolling (opts) {
  8822. Polling.call(this, opts);
  8823. this.query = this.query || {};
  8824. // define global callbacks array if not present
  8825. // we do this here (lazily) to avoid unneeded global pollution
  8826. if (!callbacks) {
  8827. // we need to consider multiple engines in the same page
  8828. callbacks = globalThis.___eio = (globalThis.___eio || []);
  8829. }
  8830. // callback identifier
  8831. this.index = callbacks.length;
  8832. // add callback to jsonp global
  8833. var self = this;
  8834. callbacks.push(function (msg) {
  8835. self.onData(msg);
  8836. });
  8837. // append to query string
  8838. this.query.j = this.index;
  8839. // prevent spurious errors from being emitted when the window is unloaded
  8840. if (typeof addEventListener === 'function') {
  8841. addEventListener('beforeunload', function () {
  8842. if (self.script) self.script.onerror = empty;
  8843. }, false);
  8844. }
  8845. }
  8846. /**
  8847. * Inherits from Polling.
  8848. */
  8849. inherit(JSONPPolling, Polling);
  8850. /*
  8851. * JSONP only supports binary as base64 encoded strings
  8852. */
  8853. JSONPPolling.prototype.supportsBinary = false;
  8854. /**
  8855. * Closes the socket.
  8856. *
  8857. * @api private
  8858. */
  8859. JSONPPolling.prototype.doClose = function () {
  8860. if (this.script) {
  8861. this.script.parentNode.removeChild(this.script);
  8862. this.script = null;
  8863. }
  8864. if (this.form) {
  8865. this.form.parentNode.removeChild(this.form);
  8866. this.form = null;
  8867. this.iframe = null;
  8868. }
  8869. Polling.prototype.doClose.call(this);
  8870. };
  8871. /**
  8872. * Starts a poll cycle.
  8873. *
  8874. * @api private
  8875. */
  8876. JSONPPolling.prototype.doPoll = function () {
  8877. var self = this;
  8878. var script = document.createElement('script');
  8879. if (this.script) {
  8880. this.script.parentNode.removeChild(this.script);
  8881. this.script = null;
  8882. }
  8883. script.async = true;
  8884. script.src = this.uri();
  8885. script.onerror = function (e) {
  8886. self.onError('jsonp poll error', e);
  8887. };
  8888. var insertAt = document.getElementsByTagName('script')[0];
  8889. if (insertAt) {
  8890. insertAt.parentNode.insertBefore(script, insertAt);
  8891. } else {
  8892. (document.head || document.body).appendChild(script);
  8893. }
  8894. this.script = script;
  8895. var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent);
  8896. if (isUAgecko) {
  8897. setTimeout(function () {
  8898. var iframe = document.createElement('iframe');
  8899. document.body.appendChild(iframe);
  8900. document.body.removeChild(iframe);
  8901. }, 100);
  8902. }
  8903. };
  8904. /**
  8905. * Writes with a hidden iframe.
  8906. *
  8907. * @param {String} data to send
  8908. * @param {Function} called upon flush.
  8909. * @api private
  8910. */
  8911. JSONPPolling.prototype.doWrite = function (data, fn) {
  8912. var self = this;
  8913. if (!this.form) {
  8914. var form = document.createElement('form');
  8915. var area = document.createElement('textarea');
  8916. var id = this.iframeId = 'eio_iframe_' + this.index;
  8917. var iframe;
  8918. form.className = 'socketio';
  8919. form.style.position = 'absolute';
  8920. form.style.top = '-1000px';
  8921. form.style.left = '-1000px';
  8922. form.target = id;
  8923. form.method = 'POST';
  8924. form.setAttribute('accept-charset', 'utf-8');
  8925. area.name = 'd';
  8926. form.appendChild(area);
  8927. document.body.appendChild(form);
  8928. this.form = form;
  8929. this.area = area;
  8930. }
  8931. this.form.action = this.uri();
  8932. function complete () {
  8933. initIframe();
  8934. fn();
  8935. }
  8936. function initIframe () {
  8937. if (self.iframe) {
  8938. try {
  8939. self.form.removeChild(self.iframe);
  8940. } catch (e) {
  8941. self.onError('jsonp polling iframe removal error', e);
  8942. }
  8943. }
  8944. try {
  8945. // ie6 dynamic iframes with target="" support (thanks Chris Lambacher)
  8946. var html = '<iframe src="javascript:0" name="' + self.iframeId + '">';
  8947. iframe = document.createElement(html);
  8948. } catch (e) {
  8949. iframe = document.createElement('iframe');
  8950. iframe.name = self.iframeId;
  8951. iframe.src = 'javascript:0';
  8952. }
  8953. iframe.id = self.iframeId;
  8954. self.form.appendChild(iframe);
  8955. self.iframe = iframe;
  8956. }
  8957. initIframe();
  8958. // escape \n to prevent it from being converted into \r\n by some UAs
  8959. // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side
  8960. data = data.replace(rEscapedNewline, '\\\n');
  8961. this.area.value = data.replace(rNewline, '\\n');
  8962. try {
  8963. this.form.submit();
  8964. } catch (e) {}
  8965. if (this.iframe.attachEvent) {
  8966. this.iframe.onreadystatechange = function () {
  8967. if (self.iframe.readyState === 'complete') {
  8968. complete();
  8969. }
  8970. };
  8971. } else {
  8972. this.iframe.onload = complete;
  8973. }
  8974. };
  8975. /***/ }),
  8976. /***/ "./node_modules/engine.io-client/lib/transports/polling-xhr.js":
  8977. /*!*********************************************************************!*\
  8978. !*** ./node_modules/engine.io-client/lib/transports/polling-xhr.js ***!
  8979. \*********************************************************************/
  8980. /*! no static exports found */
  8981. /***/ (function(module, exports, __webpack_require__) {
  8982. /* global attachEvent */
  8983. /**
  8984. * Module requirements.
  8985. */
  8986. var XMLHttpRequest = __webpack_require__(/*! xmlhttprequest-ssl */ "./node_modules/engine.io-client/lib/xmlhttprequest.js");
  8987. var Polling = __webpack_require__(/*! ./polling */ "./node_modules/engine.io-client/lib/transports/polling.js");
  8988. var Emitter = __webpack_require__(/*! component-emitter */ "./node_modules/engine.io-client/node_modules/component-emitter/index.js");
  8989. var inherit = __webpack_require__(/*! component-inherit */ "./node_modules/component-inherit/index.js");
  8990. var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")('engine.io-client:polling-xhr');
  8991. var globalThis = __webpack_require__(/*! ../globalThis */ "./node_modules/engine.io-client/lib/globalThis.browser.js");
  8992. /**
  8993. * Module exports.
  8994. */
  8995. module.exports = XHR;
  8996. module.exports.Request = Request;
  8997. /**
  8998. * Empty function
  8999. */
  9000. function empty () {}
  9001. /**
  9002. * XHR Polling constructor.
  9003. *
  9004. * @param {Object} opts
  9005. * @api public
  9006. */
  9007. function XHR (opts) {
  9008. Polling.call(this, opts);
  9009. this.requestTimeout = opts.requestTimeout;
  9010. this.extraHeaders = opts.extraHeaders;
  9011. if (typeof location !== 'undefined') {
  9012. var isSSL = 'https:' === location.protocol;
  9013. var port = location.port;
  9014. // some user agents have empty `location.port`
  9015. if (!port) {
  9016. port = isSSL ? 443 : 80;
  9017. }
  9018. this.xd = (typeof location !== 'undefined' && opts.hostname !== location.hostname) ||
  9019. port !== opts.port;
  9020. this.xs = opts.secure !== isSSL;
  9021. }
  9022. }
  9023. /**
  9024. * Inherits from Polling.
  9025. */
  9026. inherit(XHR, Polling);
  9027. /**
  9028. * XHR supports binary
  9029. */
  9030. XHR.prototype.supportsBinary = true;
  9031. /**
  9032. * Creates a request.
  9033. *
  9034. * @param {String} method
  9035. * @api private
  9036. */
  9037. XHR.prototype.request = function (opts) {
  9038. opts = opts || {};
  9039. opts.uri = this.uri();
  9040. opts.xd = this.xd;
  9041. opts.xs = this.xs;
  9042. opts.agent = this.agent || false;
  9043. opts.supportsBinary = this.supportsBinary;
  9044. opts.enablesXDR = this.enablesXDR;
  9045. opts.withCredentials = this.withCredentials;
  9046. // SSL options for Node.js client
  9047. opts.pfx = this.pfx;
  9048. opts.key = this.key;
  9049. opts.passphrase = this.passphrase;
  9050. opts.cert = this.cert;
  9051. opts.ca = this.ca;
  9052. opts.ciphers = this.ciphers;
  9053. opts.rejectUnauthorized = this.rejectUnauthorized;
  9054. opts.requestTimeout = this.requestTimeout;
  9055. // other options for Node.js client
  9056. opts.extraHeaders = this.extraHeaders;
  9057. return new Request(opts);
  9058. };
  9059. /**
  9060. * Sends data.
  9061. *
  9062. * @param {String} data to send.
  9063. * @param {Function} called upon flush.
  9064. * @api private
  9065. */
  9066. XHR.prototype.doWrite = function (data, fn) {
  9067. var isBinary = typeof data !== 'string' && data !== undefined;
  9068. var req = this.request({ method: 'POST', data: data, isBinary: isBinary });
  9069. var self = this;
  9070. req.on('success', fn);
  9071. req.on('error', function (err) {
  9072. self.onError('xhr post error', err);
  9073. });
  9074. this.sendXhr = req;
  9075. };
  9076. /**
  9077. * Starts a poll cycle.
  9078. *
  9079. * @api private
  9080. */
  9081. XHR.prototype.doPoll = function () {
  9082. debug('xhr poll');
  9083. var req = this.request();
  9084. var self = this;
  9085. req.on('data', function (data) {
  9086. self.onData(data);
  9087. });
  9088. req.on('error', function (err) {
  9089. self.onError('xhr poll error', err);
  9090. });
  9091. this.pollXhr = req;
  9092. };
  9093. /**
  9094. * Request constructor
  9095. *
  9096. * @param {Object} options
  9097. * @api public
  9098. */
  9099. function Request (opts) {
  9100. this.method = opts.method || 'GET';
  9101. this.uri = opts.uri;
  9102. this.xd = !!opts.xd;
  9103. this.xs = !!opts.xs;
  9104. this.async = false !== opts.async;
  9105. this.data = undefined !== opts.data ? opts.data : null;
  9106. this.agent = opts.agent;
  9107. this.isBinary = opts.isBinary;
  9108. this.supportsBinary = opts.supportsBinary;
  9109. this.enablesXDR = opts.enablesXDR;
  9110. this.withCredentials = opts.withCredentials;
  9111. this.requestTimeout = opts.requestTimeout;
  9112. // SSL options for Node.js client
  9113. this.pfx = opts.pfx;
  9114. this.key = opts.key;
  9115. this.passphrase = opts.passphrase;
  9116. this.cert = opts.cert;
  9117. this.ca = opts.ca;
  9118. this.ciphers = opts.ciphers;
  9119. this.rejectUnauthorized = opts.rejectUnauthorized;
  9120. // other options for Node.js client
  9121. this.extraHeaders = opts.extraHeaders;
  9122. this.create();
  9123. }
  9124. /**
  9125. * Mix in `Emitter`.
  9126. */
  9127. Emitter(Request.prototype);
  9128. /**
  9129. * Creates the XHR object and sends the request.
  9130. *
  9131. * @api private
  9132. */
  9133. Request.prototype.create = function () {
  9134. var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR };
  9135. // SSL options for Node.js client
  9136. opts.pfx = this.pfx;
  9137. opts.key = this.key;
  9138. opts.passphrase = this.passphrase;
  9139. opts.cert = this.cert;
  9140. opts.ca = this.ca;
  9141. opts.ciphers = this.ciphers;
  9142. opts.rejectUnauthorized = this.rejectUnauthorized;
  9143. var xhr = this.xhr = new XMLHttpRequest(opts);
  9144. var self = this;
  9145. try {
  9146. debug('xhr open %s: %s', this.method, this.uri);
  9147. xhr.open(this.method, this.uri, this.async);
  9148. try {
  9149. if (this.extraHeaders) {
  9150. xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true);
  9151. for (var i in this.extraHeaders) {
  9152. if (this.extraHeaders.hasOwnProperty(i)) {
  9153. xhr.setRequestHeader(i, this.extraHeaders[i]);
  9154. }
  9155. }
  9156. }
  9157. } catch (e) {}
  9158. if ('POST' === this.method) {
  9159. try {
  9160. if (this.isBinary) {
  9161. xhr.setRequestHeader('Content-type', 'application/octet-stream');
  9162. } else {
  9163. xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8');
  9164. }
  9165. } catch (e) {}
  9166. }
  9167. try {
  9168. xhr.setRequestHeader('Accept', '*/*');
  9169. } catch (e) {}
  9170. // ie6 check
  9171. if ('withCredentials' in xhr) {
  9172. xhr.withCredentials = this.withCredentials;
  9173. }
  9174. if (this.requestTimeout) {
  9175. xhr.timeout = this.requestTimeout;
  9176. }
  9177. if (this.hasXDR()) {
  9178. xhr.onload = function () {
  9179. self.onLoad();
  9180. };
  9181. xhr.onerror = function () {
  9182. self.onError(xhr.responseText);
  9183. };
  9184. } else {
  9185. xhr.onreadystatechange = function () {
  9186. if (xhr.readyState === 2) {
  9187. try {
  9188. var contentType = xhr.getResponseHeader('Content-Type');
  9189. if (self.supportsBinary && contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {
  9190. xhr.responseType = 'arraybuffer';
  9191. }
  9192. } catch (e) {}
  9193. }
  9194. if (4 !== xhr.readyState) return;
  9195. if (200 === xhr.status || 1223 === xhr.status) {
  9196. self.onLoad();
  9197. } else {
  9198. // make sure the `error` event handler that's user-set
  9199. // does not throw in the same tick and gets caught here
  9200. setTimeout(function () {
  9201. self.onError(typeof xhr.status === 'number' ? xhr.status : 0);
  9202. }, 0);
  9203. }
  9204. };
  9205. }
  9206. debug('xhr data %s', this.data);
  9207. xhr.send(this.data);
  9208. } catch (e) {
  9209. // Need to defer since .create() is called directly fhrom the constructor
  9210. // and thus the 'error' event can only be only bound *after* this exception
  9211. // occurs. Therefore, also, we cannot throw here at all.
  9212. setTimeout(function () {
  9213. self.onError(e);
  9214. }, 0);
  9215. return;
  9216. }
  9217. if (typeof document !== 'undefined') {
  9218. this.index = Request.requestsCount++;
  9219. Request.requests[this.index] = this;
  9220. }
  9221. };
  9222. /**
  9223. * Called upon successful response.
  9224. *
  9225. * @api private
  9226. */
  9227. Request.prototype.onSuccess = function () {
  9228. this.emit('success');
  9229. this.cleanup();
  9230. };
  9231. /**
  9232. * Called if we have data.
  9233. *
  9234. * @api private
  9235. */
  9236. Request.prototype.onData = function (data) {
  9237. this.emit('data', data);
  9238. this.onSuccess();
  9239. };
  9240. /**
  9241. * Called upon error.
  9242. *
  9243. * @api private
  9244. */
  9245. Request.prototype.onError = function (err) {
  9246. this.emit('error', err);
  9247. this.cleanup(true);
  9248. };
  9249. /**
  9250. * Cleans up house.
  9251. *
  9252. * @api private
  9253. */
  9254. Request.prototype.cleanup = function (fromError) {
  9255. if ('undefined' === typeof this.xhr || null === this.xhr) {
  9256. return;
  9257. }
  9258. // xmlhttprequest
  9259. if (this.hasXDR()) {
  9260. this.xhr.onload = this.xhr.onerror = empty;
  9261. } else {
  9262. this.xhr.onreadystatechange = empty;
  9263. }
  9264. if (fromError) {
  9265. try {
  9266. this.xhr.abort();
  9267. } catch (e) {}
  9268. }
  9269. if (typeof document !== 'undefined') {
  9270. delete Request.requests[this.index];
  9271. }
  9272. this.xhr = null;
  9273. };
  9274. /**
  9275. * Called upon load.
  9276. *
  9277. * @api private
  9278. */
  9279. Request.prototype.onLoad = function () {
  9280. var data;
  9281. try {
  9282. var contentType;
  9283. try {
  9284. contentType = this.xhr.getResponseHeader('Content-Type');
  9285. } catch (e) {}
  9286. if (contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {
  9287. data = this.xhr.response || this.xhr.responseText;
  9288. } else {
  9289. data = this.xhr.responseText;
  9290. }
  9291. } catch (e) {
  9292. this.onError(e);
  9293. }
  9294. if (null != data) {
  9295. this.onData(data);
  9296. }
  9297. };
  9298. /**
  9299. * Check if it has XDomainRequest.
  9300. *
  9301. * @api private
  9302. */
  9303. Request.prototype.hasXDR = function () {
  9304. return typeof XDomainRequest !== 'undefined' && !this.xs && this.enablesXDR;
  9305. };
  9306. /**
  9307. * Aborts the request.
  9308. *
  9309. * @api public
  9310. */
  9311. Request.prototype.abort = function () {
  9312. this.cleanup();
  9313. };
  9314. /**
  9315. * Aborts pending requests when unloading the window. This is needed to prevent
  9316. * memory leaks (e.g. when using IE) and to ensure that no spurious error is
  9317. * emitted.
  9318. */
  9319. Request.requestsCount = 0;
  9320. Request.requests = {};
  9321. if (typeof document !== 'undefined') {
  9322. if (typeof attachEvent === 'function') {
  9323. attachEvent('onunload', unloadHandler);
  9324. } else if (typeof addEventListener === 'function') {
  9325. var terminationEvent = 'onpagehide' in globalThis ? 'pagehide' : 'unload';
  9326. addEventListener(terminationEvent, unloadHandler, false);
  9327. }
  9328. }
  9329. function unloadHandler () {
  9330. for (var i in Request.requests) {
  9331. if (Request.requests.hasOwnProperty(i)) {
  9332. Request.requests[i].abort();
  9333. }
  9334. }
  9335. }
  9336. /***/ }),
  9337. /***/ "./node_modules/engine.io-client/lib/transports/polling.js":
  9338. /*!*****************************************************************!*\
  9339. !*** ./node_modules/engine.io-client/lib/transports/polling.js ***!
  9340. \*****************************************************************/
  9341. /*! no static exports found */
  9342. /***/ (function(module, exports, __webpack_require__) {
  9343. /**
  9344. * Module dependencies.
  9345. */
  9346. var Transport = __webpack_require__(/*! ../transport */ "./node_modules/engine.io-client/lib/transport.js");
  9347. var parseqs = __webpack_require__(/*! parseqs */ "./node_modules/parseqs/index.js");
  9348. var parser = __webpack_require__(/*! engine.io-parser */ "./node_modules/engine.io-parser/lib/browser.js");
  9349. var inherit = __webpack_require__(/*! component-inherit */ "./node_modules/component-inherit/index.js");
  9350. var yeast = __webpack_require__(/*! yeast */ "./node_modules/yeast/index.js");
  9351. var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")('engine.io-client:polling');
  9352. /**
  9353. * Module exports.
  9354. */
  9355. module.exports = Polling;
  9356. /**
  9357. * Is XHR2 supported?
  9358. */
  9359. var hasXHR2 = (function () {
  9360. var XMLHttpRequest = __webpack_require__(/*! xmlhttprequest-ssl */ "./node_modules/engine.io-client/lib/xmlhttprequest.js");
  9361. var xhr = new XMLHttpRequest({ xdomain: false });
  9362. return null != xhr.responseType;
  9363. })();
  9364. /**
  9365. * Polling interface.
  9366. *
  9367. * @param {Object} opts
  9368. * @api private
  9369. */
  9370. function Polling (opts) {
  9371. var forceBase64 = (opts && opts.forceBase64);
  9372. if (!hasXHR2 || forceBase64) {
  9373. this.supportsBinary = false;
  9374. }
  9375. Transport.call(this, opts);
  9376. }
  9377. /**
  9378. * Inherits from Transport.
  9379. */
  9380. inherit(Polling, Transport);
  9381. /**
  9382. * Transport name.
  9383. */
  9384. Polling.prototype.name = 'polling';
  9385. /**
  9386. * Opens the socket (triggers polling). We write a PING message to determine
  9387. * when the transport is open.
  9388. *
  9389. * @api private
  9390. */
  9391. Polling.prototype.doOpen = function () {
  9392. this.poll();
  9393. };
  9394. /**
  9395. * Pauses polling.
  9396. *
  9397. * @param {Function} callback upon buffers are flushed and transport is paused
  9398. * @api private
  9399. */
  9400. Polling.prototype.pause = function (onPause) {
  9401. var self = this;
  9402. this.readyState = 'pausing';
  9403. function pause () {
  9404. debug('paused');
  9405. self.readyState = 'paused';
  9406. onPause();
  9407. }
  9408. if (this.polling || !this.writable) {
  9409. var total = 0;
  9410. if (this.polling) {
  9411. debug('we are currently polling - waiting to pause');
  9412. total++;
  9413. this.once('pollComplete', function () {
  9414. debug('pre-pause polling complete');
  9415. --total || pause();
  9416. });
  9417. }
  9418. if (!this.writable) {
  9419. debug('we are currently writing - waiting to pause');
  9420. total++;
  9421. this.once('drain', function () {
  9422. debug('pre-pause writing complete');
  9423. --total || pause();
  9424. });
  9425. }
  9426. } else {
  9427. pause();
  9428. }
  9429. };
  9430. /**
  9431. * Starts polling cycle.
  9432. *
  9433. * @api public
  9434. */
  9435. Polling.prototype.poll = function () {
  9436. debug('polling');
  9437. this.polling = true;
  9438. this.doPoll();
  9439. this.emit('poll');
  9440. };
  9441. /**
  9442. * Overloads onData to detect payloads.
  9443. *
  9444. * @api private
  9445. */
  9446. Polling.prototype.onData = function (data) {
  9447. var self = this;
  9448. debug('polling got data %s', data);
  9449. var callback = function (packet, index, total) {
  9450. // if its the first message we consider the transport open
  9451. if ('opening' === self.readyState) {
  9452. self.onOpen();
  9453. }
  9454. // if its a close packet, we close the ongoing requests
  9455. if ('close' === packet.type) {
  9456. self.onClose();
  9457. return false;
  9458. }
  9459. // otherwise bypass onData and handle the message
  9460. self.onPacket(packet);
  9461. };
  9462. // decode payload
  9463. parser.decodePayload(data, this.socket.binaryType, callback);
  9464. // if an event did not trigger closing
  9465. if ('closed' !== this.readyState) {
  9466. // if we got data we're not polling
  9467. this.polling = false;
  9468. this.emit('pollComplete');
  9469. if ('open' === this.readyState) {
  9470. this.poll();
  9471. } else {
  9472. debug('ignoring poll - transport state "%s"', this.readyState);
  9473. }
  9474. }
  9475. };
  9476. /**
  9477. * For polling, send a close packet.
  9478. *
  9479. * @api private
  9480. */
  9481. Polling.prototype.doClose = function () {
  9482. var self = this;
  9483. function close () {
  9484. debug('writing close packet');
  9485. self.write([{ type: 'close' }]);
  9486. }
  9487. if ('open' === this.readyState) {
  9488. debug('transport open - closing');
  9489. close();
  9490. } else {
  9491. // in case we're trying to close while
  9492. // handshaking is in progress (GH-164)
  9493. debug('transport not open - deferring close');
  9494. this.once('open', close);
  9495. }
  9496. };
  9497. /**
  9498. * Writes a packets payload.
  9499. *
  9500. * @param {Array} data packets
  9501. * @param {Function} drain callback
  9502. * @api private
  9503. */
  9504. Polling.prototype.write = function (packets) {
  9505. var self = this;
  9506. this.writable = false;
  9507. var callbackfn = function () {
  9508. self.writable = true;
  9509. self.emit('drain');
  9510. };
  9511. parser.encodePayload(packets, this.supportsBinary, function (data) {
  9512. self.doWrite(data, callbackfn);
  9513. });
  9514. };
  9515. /**
  9516. * Generates uri for connection.
  9517. *
  9518. * @api private
  9519. */
  9520. Polling.prototype.uri = function () {
  9521. var query = this.query || {};
  9522. var schema = this.secure ? 'https' : 'http';
  9523. var port = '';
  9524. // cache busting is forced
  9525. if (false !== this.timestampRequests) {
  9526. query[this.timestampParam] = yeast();
  9527. }
  9528. if (!this.supportsBinary && !query.sid) {
  9529. query.b64 = 1;
  9530. }
  9531. query = parseqs.encode(query);
  9532. // avoid port if default for schema
  9533. if (this.port && (('https' === schema && Number(this.port) !== 443) ||
  9534. ('http' === schema && Number(this.port) !== 80))) {
  9535. port = ':' + this.port;
  9536. }
  9537. // prepend ? to query
  9538. if (query.length) {
  9539. query = '?' + query;
  9540. }
  9541. var ipv6 = this.hostname.indexOf(':') !== -1;
  9542. return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
  9543. };
  9544. /***/ }),
  9545. /***/ "./node_modules/engine.io-client/lib/transports/websocket.js":
  9546. /*!*******************************************************************!*\
  9547. !*** ./node_modules/engine.io-client/lib/transports/websocket.js ***!
  9548. \*******************************************************************/
  9549. /*! no static exports found */
  9550. /***/ (function(module, exports, __webpack_require__) {
  9551. /* WEBPACK VAR INJECTION */(function(Buffer) {/**
  9552. * Module dependencies.
  9553. */
  9554. var Transport = __webpack_require__(/*! ../transport */ "./node_modules/engine.io-client/lib/transport.js");
  9555. var parser = __webpack_require__(/*! engine.io-parser */ "./node_modules/engine.io-parser/lib/browser.js");
  9556. var parseqs = __webpack_require__(/*! parseqs */ "./node_modules/parseqs/index.js");
  9557. var inherit = __webpack_require__(/*! component-inherit */ "./node_modules/component-inherit/index.js");
  9558. var yeast = __webpack_require__(/*! yeast */ "./node_modules/yeast/index.js");
  9559. var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")('engine.io-client:websocket');
  9560. var BrowserWebSocket, NodeWebSocket;
  9561. if (typeof WebSocket !== 'undefined') {
  9562. BrowserWebSocket = WebSocket;
  9563. } else if (typeof self !== 'undefined') {
  9564. BrowserWebSocket = self.WebSocket || self.MozWebSocket;
  9565. }
  9566. if (typeof window === 'undefined') {
  9567. try {
  9568. NodeWebSocket = __webpack_require__(/*! ws */ 1);
  9569. } catch (e) { }
  9570. }
  9571. /**
  9572. * Get either the `WebSocket` or `MozWebSocket` globals
  9573. * in the browser or try to resolve WebSocket-compatible
  9574. * interface exposed by `ws` for Node-like environment.
  9575. */
  9576. var WebSocketImpl = BrowserWebSocket || NodeWebSocket;
  9577. /**
  9578. * Module exports.
  9579. */
  9580. module.exports = WS;
  9581. /**
  9582. * WebSocket transport constructor.
  9583. *
  9584. * @api {Object} connection options
  9585. * @api public
  9586. */
  9587. function WS (opts) {
  9588. var forceBase64 = (opts && opts.forceBase64);
  9589. if (forceBase64) {
  9590. this.supportsBinary = false;
  9591. }
  9592. this.perMessageDeflate = opts.perMessageDeflate;
  9593. this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode;
  9594. this.protocols = opts.protocols;
  9595. if (!this.usingBrowserWebSocket) {
  9596. WebSocketImpl = NodeWebSocket;
  9597. }
  9598. Transport.call(this, opts);
  9599. }
  9600. /**
  9601. * Inherits from Transport.
  9602. */
  9603. inherit(WS, Transport);
  9604. /**
  9605. * Transport name.
  9606. *
  9607. * @api public
  9608. */
  9609. WS.prototype.name = 'websocket';
  9610. /*
  9611. * WebSockets support binary
  9612. */
  9613. WS.prototype.supportsBinary = true;
  9614. /**
  9615. * Opens socket.
  9616. *
  9617. * @api private
  9618. */
  9619. WS.prototype.doOpen = function () {
  9620. if (!this.check()) {
  9621. // let probe timeout
  9622. return;
  9623. }
  9624. var uri = this.uri();
  9625. var protocols = this.protocols;
  9626. var opts = {};
  9627. if (!this.isReactNative) {
  9628. opts.agent = this.agent;
  9629. opts.perMessageDeflate = this.perMessageDeflate;
  9630. // SSL options for Node.js client
  9631. opts.pfx = this.pfx;
  9632. opts.key = this.key;
  9633. opts.passphrase = this.passphrase;
  9634. opts.cert = this.cert;
  9635. opts.ca = this.ca;
  9636. opts.ciphers = this.ciphers;
  9637. opts.rejectUnauthorized = this.rejectUnauthorized;
  9638. }
  9639. if (this.extraHeaders) {
  9640. opts.headers = this.extraHeaders;
  9641. }
  9642. if (this.localAddress) {
  9643. opts.localAddress = this.localAddress;
  9644. }
  9645. try {
  9646. this.ws =
  9647. this.usingBrowserWebSocket && !this.isReactNative
  9648. ? protocols
  9649. ? new WebSocketImpl(uri, protocols)
  9650. : new WebSocketImpl(uri)
  9651. : new WebSocketImpl(uri, protocols, opts);
  9652. } catch (err) {
  9653. return this.emit('error', err);
  9654. }
  9655. if (this.ws.binaryType === undefined) {
  9656. this.supportsBinary = false;
  9657. }
  9658. if (this.ws.supports && this.ws.supports.binary) {
  9659. this.supportsBinary = true;
  9660. this.ws.binaryType = 'nodebuffer';
  9661. } else {
  9662. this.ws.binaryType = 'arraybuffer';
  9663. }
  9664. this.addEventListeners();
  9665. };
  9666. /**
  9667. * Adds event listeners to the socket
  9668. *
  9669. * @api private
  9670. */
  9671. WS.prototype.addEventListeners = function () {
  9672. var self = this;
  9673. this.ws.onopen = function () {
  9674. self.onOpen();
  9675. };
  9676. this.ws.onclose = function () {
  9677. self.onClose();
  9678. };
  9679. this.ws.onmessage = function (ev) {
  9680. self.onData(ev.data);
  9681. };
  9682. this.ws.onerror = function (e) {
  9683. self.onError('websocket error', e);
  9684. };
  9685. };
  9686. /**
  9687. * Writes data to socket.
  9688. *
  9689. * @param {Array} array of packets.
  9690. * @api private
  9691. */
  9692. WS.prototype.write = function (packets) {
  9693. var self = this;
  9694. this.writable = false;
  9695. // encodePacket efficient as it uses WS framing
  9696. // no need for encodePayload
  9697. var total = packets.length;
  9698. for (var i = 0, l = total; i < l; i++) {
  9699. (function (packet) {
  9700. parser.encodePacket(packet, self.supportsBinary, function (data) {
  9701. if (!self.usingBrowserWebSocket) {
  9702. // always create a new object (GH-437)
  9703. var opts = {};
  9704. if (packet.options) {
  9705. opts.compress = packet.options.compress;
  9706. }
  9707. if (self.perMessageDeflate) {
  9708. var len = 'string' === typeof data ? Buffer.byteLength(data) : data.length;
  9709. if (len < self.perMessageDeflate.threshold) {
  9710. opts.compress = false;
  9711. }
  9712. }
  9713. }
  9714. // Sometimes the websocket has already been closed but the browser didn't
  9715. // have a chance of informing us about it yet, in that case send will
  9716. // throw an error
  9717. try {
  9718. if (self.usingBrowserWebSocket) {
  9719. // TypeError is thrown when passing the second argument on Safari
  9720. self.ws.send(data);
  9721. } else {
  9722. self.ws.send(data, opts);
  9723. }
  9724. } catch (e) {
  9725. debug('websocket closed before onclose event');
  9726. }
  9727. --total || done();
  9728. });
  9729. })(packets[i]);
  9730. }
  9731. function done () {
  9732. self.emit('flush');
  9733. // fake drain
  9734. // defer to next tick to allow Socket to clear writeBuffer
  9735. setTimeout(function () {
  9736. self.writable = true;
  9737. self.emit('drain');
  9738. }, 0);
  9739. }
  9740. };
  9741. /**
  9742. * Called upon close
  9743. *
  9744. * @api private
  9745. */
  9746. WS.prototype.onClose = function () {
  9747. Transport.prototype.onClose.call(this);
  9748. };
  9749. /**
  9750. * Closes socket.
  9751. *
  9752. * @api private
  9753. */
  9754. WS.prototype.doClose = function () {
  9755. if (typeof this.ws !== 'undefined') {
  9756. this.ws.close();
  9757. }
  9758. };
  9759. /**
  9760. * Generates uri for connection.
  9761. *
  9762. * @api private
  9763. */
  9764. WS.prototype.uri = function () {
  9765. var query = this.query || {};
  9766. var schema = this.secure ? 'wss' : 'ws';
  9767. var port = '';
  9768. // avoid port if default for schema
  9769. if (this.port && (('wss' === schema && Number(this.port) !== 443) ||
  9770. ('ws' === schema && Number(this.port) !== 80))) {
  9771. port = ':' + this.port;
  9772. }
  9773. // append timestamp to URI
  9774. if (this.timestampRequests) {
  9775. query[this.timestampParam] = yeast();
  9776. }
  9777. // communicate binary support capabilities
  9778. if (!this.supportsBinary) {
  9779. query.b64 = 1;
  9780. }
  9781. query = parseqs.encode(query);
  9782. // prepend ? to query
  9783. if (query.length) {
  9784. query = '?' + query;
  9785. }
  9786. var ipv6 = this.hostname.indexOf(':') !== -1;
  9787. return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
  9788. };
  9789. /**
  9790. * Feature detection for WebSocket.
  9791. *
  9792. * @return {Boolean} whether this transport is available.
  9793. * @api public
  9794. */
  9795. WS.prototype.check = function () {
  9796. return !!WebSocketImpl && !('__initialize' in WebSocketImpl && this.name === WS.prototype.name);
  9797. };
  9798. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  9799. /***/ }),
  9800. /***/ "./node_modules/engine.io-client/lib/xmlhttprequest.js":
  9801. /*!*************************************************************!*\
  9802. !*** ./node_modules/engine.io-client/lib/xmlhttprequest.js ***!
  9803. \*************************************************************/
  9804. /*! no static exports found */
  9805. /***/ (function(module, exports, __webpack_require__) {
  9806. // browser shim for xmlhttprequest module
  9807. var hasCORS = __webpack_require__(/*! has-cors */ "./node_modules/has-cors/index.js");
  9808. var globalThis = __webpack_require__(/*! ./globalThis */ "./node_modules/engine.io-client/lib/globalThis.browser.js");
  9809. module.exports = function (opts) {
  9810. var xdomain = opts.xdomain;
  9811. // scheme must be same when usign XDomainRequest
  9812. // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx
  9813. var xscheme = opts.xscheme;
  9814. // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default.
  9815. // https://github.com/Automattic/engine.io-client/pull/217
  9816. var enablesXDR = opts.enablesXDR;
  9817. // XMLHttpRequest can be disabled on IE
  9818. try {
  9819. if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {
  9820. return new XMLHttpRequest();
  9821. }
  9822. } catch (e) { }
  9823. // Use XDomainRequest for IE8 if enablesXDR is true
  9824. // because loading bar keeps flashing when using jsonp-polling
  9825. // https://github.com/yujiosaka/socke.io-ie8-loading-example
  9826. try {
  9827. if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) {
  9828. return new XDomainRequest();
  9829. }
  9830. } catch (e) { }
  9831. if (!xdomain) {
  9832. try {
  9833. return new globalThis[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP');
  9834. } catch (e) { }
  9835. }
  9836. };
  9837. /***/ }),
  9838. /***/ "./node_modules/engine.io-client/node_modules/component-emitter/index.js":
  9839. /*!*******************************************************************************!*\
  9840. !*** ./node_modules/engine.io-client/node_modules/component-emitter/index.js ***!
  9841. \*******************************************************************************/
  9842. /*! no static exports found */
  9843. /***/ (function(module, exports, __webpack_require__) {
  9844. /**
  9845. * Expose `Emitter`.
  9846. */
  9847. if (true) {
  9848. module.exports = Emitter;
  9849. }
  9850. /**
  9851. * Initialize a new `Emitter`.
  9852. *
  9853. * @api public
  9854. */
  9855. function Emitter(obj) {
  9856. if (obj) return mixin(obj);
  9857. };
  9858. /**
  9859. * Mixin the emitter properties.
  9860. *
  9861. * @param {Object} obj
  9862. * @return {Object}
  9863. * @api private
  9864. */
  9865. function mixin(obj) {
  9866. for (var key in Emitter.prototype) {
  9867. obj[key] = Emitter.prototype[key];
  9868. }
  9869. return obj;
  9870. }
  9871. /**
  9872. * Listen on the given `event` with `fn`.
  9873. *
  9874. * @param {String} event
  9875. * @param {Function} fn
  9876. * @return {Emitter}
  9877. * @api public
  9878. */
  9879. Emitter.prototype.on =
  9880. Emitter.prototype.addEventListener = function(event, fn){
  9881. this._callbacks = this._callbacks || {};
  9882. (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
  9883. .push(fn);
  9884. return this;
  9885. };
  9886. /**
  9887. * Adds an `event` listener that will be invoked a single
  9888. * time then automatically removed.
  9889. *
  9890. * @param {String} event
  9891. * @param {Function} fn
  9892. * @return {Emitter}
  9893. * @api public
  9894. */
  9895. Emitter.prototype.once = function(event, fn){
  9896. function on() {
  9897. this.off(event, on);
  9898. fn.apply(this, arguments);
  9899. }
  9900. on.fn = fn;
  9901. this.on(event, on);
  9902. return this;
  9903. };
  9904. /**
  9905. * Remove the given callback for `event` or all
  9906. * registered callbacks.
  9907. *
  9908. * @param {String} event
  9909. * @param {Function} fn
  9910. * @return {Emitter}
  9911. * @api public
  9912. */
  9913. Emitter.prototype.off =
  9914. Emitter.prototype.removeListener =
  9915. Emitter.prototype.removeAllListeners =
  9916. Emitter.prototype.removeEventListener = function(event, fn){
  9917. this._callbacks = this._callbacks || {};
  9918. // all
  9919. if (0 == arguments.length) {
  9920. this._callbacks = {};
  9921. return this;
  9922. }
  9923. // specific event
  9924. var callbacks = this._callbacks['$' + event];
  9925. if (!callbacks) return this;
  9926. // remove all handlers
  9927. if (1 == arguments.length) {
  9928. delete this._callbacks['$' + event];
  9929. return this;
  9930. }
  9931. // remove specific handler
  9932. var cb;
  9933. for (var i = 0; i < callbacks.length; i++) {
  9934. cb = callbacks[i];
  9935. if (cb === fn || cb.fn === fn) {
  9936. callbacks.splice(i, 1);
  9937. break;
  9938. }
  9939. }
  9940. // Remove event specific arrays for event types that no
  9941. // one is subscribed for to avoid memory leak.
  9942. if (callbacks.length === 0) {
  9943. delete this._callbacks['$' + event];
  9944. }
  9945. return this;
  9946. };
  9947. /**
  9948. * Emit `event` with the given args.
  9949. *
  9950. * @param {String} event
  9951. * @param {Mixed} ...
  9952. * @return {Emitter}
  9953. */
  9954. Emitter.prototype.emit = function(event){
  9955. this._callbacks = this._callbacks || {};
  9956. var args = new Array(arguments.length - 1)
  9957. , callbacks = this._callbacks['$' + event];
  9958. for (var i = 1; i < arguments.length; i++) {
  9959. args[i - 1] = arguments[i];
  9960. }
  9961. if (callbacks) {
  9962. callbacks = callbacks.slice(0);
  9963. for (var i = 0, len = callbacks.length; i < len; ++i) {
  9964. callbacks[i].apply(this, args);
  9965. }
  9966. }
  9967. return this;
  9968. };
  9969. /**
  9970. * Return array of callbacks for `event`.
  9971. *
  9972. * @param {String} event
  9973. * @return {Array}
  9974. * @api public
  9975. */
  9976. Emitter.prototype.listeners = function(event){
  9977. this._callbacks = this._callbacks || {};
  9978. return this._callbacks['$' + event] || [];
  9979. };
  9980. /**
  9981. * Check if this emitter has `event` handlers.
  9982. *
  9983. * @param {String} event
  9984. * @return {Boolean}
  9985. * @api public
  9986. */
  9987. Emitter.prototype.hasListeners = function(event){
  9988. return !! this.listeners(event).length;
  9989. };
  9990. /***/ }),
  9991. /***/ "./node_modules/engine.io-parser/lib/browser.js":
  9992. /*!******************************************************!*\
  9993. !*** ./node_modules/engine.io-parser/lib/browser.js ***!
  9994. \******************************************************/
  9995. /*! no static exports found */
  9996. /***/ (function(module, exports, __webpack_require__) {
  9997. /**
  9998. * Module dependencies.
  9999. */
  10000. var keys = __webpack_require__(/*! ./keys */ "./node_modules/engine.io-parser/lib/keys.js");
  10001. var hasBinary = __webpack_require__(/*! has-binary2 */ "./node_modules/has-binary2/index.js");
  10002. var sliceBuffer = __webpack_require__(/*! arraybuffer.slice */ "./node_modules/arraybuffer.slice/index.js");
  10003. var after = __webpack_require__(/*! after */ "./node_modules/after/index.js");
  10004. var utf8 = __webpack_require__(/*! ./utf8 */ "./node_modules/engine.io-parser/lib/utf8.js");
  10005. var base64encoder;
  10006. if (typeof ArrayBuffer !== 'undefined') {
  10007. base64encoder = __webpack_require__(/*! base64-arraybuffer */ "./node_modules/base64-arraybuffer/lib/base64-arraybuffer.js");
  10008. }
  10009. /**
  10010. * Check if we are running an android browser. That requires us to use
  10011. * ArrayBuffer with polling transports...
  10012. *
  10013. * http://ghinda.net/jpeg-blob-ajax-android/
  10014. */
  10015. var isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent);
  10016. /**
  10017. * Check if we are running in PhantomJS.
  10018. * Uploading a Blob with PhantomJS does not work correctly, as reported here:
  10019. * https://github.com/ariya/phantomjs/issues/11395
  10020. * @type boolean
  10021. */
  10022. var isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent);
  10023. /**
  10024. * When true, avoids using Blobs to encode payloads.
  10025. * @type boolean
  10026. */
  10027. var dontSendBlobs = isAndroid || isPhantomJS;
  10028. /**
  10029. * Current protocol version.
  10030. */
  10031. exports.protocol = 3;
  10032. /**
  10033. * Packet types.
  10034. */
  10035. var packets = exports.packets = {
  10036. open: 0 // non-ws
  10037. , close: 1 // non-ws
  10038. , ping: 2
  10039. , pong: 3
  10040. , message: 4
  10041. , upgrade: 5
  10042. , noop: 6
  10043. };
  10044. var packetslist = keys(packets);
  10045. /**
  10046. * Premade error packet.
  10047. */
  10048. var err = { type: 'error', data: 'parser error' };
  10049. /**
  10050. * Create a blob api even for blob builder when vendor prefixes exist
  10051. */
  10052. var Blob = __webpack_require__(/*! blob */ "./node_modules/blob/index.js");
  10053. /**
  10054. * Encodes a packet.
  10055. *
  10056. * <packet type id> [ <data> ]
  10057. *
  10058. * Example:
  10059. *
  10060. * 5hello world
  10061. * 3
  10062. * 4
  10063. *
  10064. * Binary is encoded in an identical principle
  10065. *
  10066. * @api private
  10067. */
  10068. exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {
  10069. if (typeof supportsBinary === 'function') {
  10070. callback = supportsBinary;
  10071. supportsBinary = false;
  10072. }
  10073. if (typeof utf8encode === 'function') {
  10074. callback = utf8encode;
  10075. utf8encode = null;
  10076. }
  10077. var data = (packet.data === undefined)
  10078. ? undefined
  10079. : packet.data.buffer || packet.data;
  10080. if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) {
  10081. return encodeArrayBuffer(packet, supportsBinary, callback);
  10082. } else if (typeof Blob !== 'undefined' && data instanceof Blob) {
  10083. return encodeBlob(packet, supportsBinary, callback);
  10084. }
  10085. // might be an object with { base64: true, data: dataAsBase64String }
  10086. if (data && data.base64) {
  10087. return encodeBase64Object(packet, callback);
  10088. }
  10089. // Sending data as a utf-8 string
  10090. var encoded = packets[packet.type];
  10091. // data fragment is optional
  10092. if (undefined !== packet.data) {
  10093. encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data);
  10094. }
  10095. return callback('' + encoded);
  10096. };
  10097. function encodeBase64Object(packet, callback) {
  10098. // packet data is an object { base64: true, data: dataAsBase64String }
  10099. var message = 'b' + exports.packets[packet.type] + packet.data.data;
  10100. return callback(message);
  10101. }
  10102. /**
  10103. * Encode packet helpers for binary types
  10104. */
  10105. function encodeArrayBuffer(packet, supportsBinary, callback) {
  10106. if (!supportsBinary) {
  10107. return exports.encodeBase64Packet(packet, callback);
  10108. }
  10109. var data = packet.data;
  10110. var contentArray = new Uint8Array(data);
  10111. var resultBuffer = new Uint8Array(1 + data.byteLength);
  10112. resultBuffer[0] = packets[packet.type];
  10113. for (var i = 0; i < contentArray.length; i++) {
  10114. resultBuffer[i+1] = contentArray[i];
  10115. }
  10116. return callback(resultBuffer.buffer);
  10117. }
  10118. function encodeBlobAsArrayBuffer(packet, supportsBinary, callback) {
  10119. if (!supportsBinary) {
  10120. return exports.encodeBase64Packet(packet, callback);
  10121. }
  10122. var fr = new FileReader();
  10123. fr.onload = function() {
  10124. exports.encodePacket({ type: packet.type, data: fr.result }, supportsBinary, true, callback);
  10125. };
  10126. return fr.readAsArrayBuffer(packet.data);
  10127. }
  10128. function encodeBlob(packet, supportsBinary, callback) {
  10129. if (!supportsBinary) {
  10130. return exports.encodeBase64Packet(packet, callback);
  10131. }
  10132. if (dontSendBlobs) {
  10133. return encodeBlobAsArrayBuffer(packet, supportsBinary, callback);
  10134. }
  10135. var length = new Uint8Array(1);
  10136. length[0] = packets[packet.type];
  10137. var blob = new Blob([length.buffer, packet.data]);
  10138. return callback(blob);
  10139. }
  10140. /**
  10141. * Encodes a packet with binary data in a base64 string
  10142. *
  10143. * @param {Object} packet, has `type` and `data`
  10144. * @return {String} base64 encoded message
  10145. */
  10146. exports.encodeBase64Packet = function(packet, callback) {
  10147. var message = 'b' + exports.packets[packet.type];
  10148. if (typeof Blob !== 'undefined' && packet.data instanceof Blob) {
  10149. var fr = new FileReader();
  10150. fr.onload = function() {
  10151. var b64 = fr.result.split(',')[1];
  10152. callback(message + b64);
  10153. };
  10154. return fr.readAsDataURL(packet.data);
  10155. }
  10156. var b64data;
  10157. try {
  10158. b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data));
  10159. } catch (e) {
  10160. // iPhone Safari doesn't let you apply with typed arrays
  10161. var typed = new Uint8Array(packet.data);
  10162. var basic = new Array(typed.length);
  10163. for (var i = 0; i < typed.length; i++) {
  10164. basic[i] = typed[i];
  10165. }
  10166. b64data = String.fromCharCode.apply(null, basic);
  10167. }
  10168. message += btoa(b64data);
  10169. return callback(message);
  10170. };
  10171. /**
  10172. * Decodes a packet. Changes format to Blob if requested.
  10173. *
  10174. * @return {Object} with `type` and `data` (if any)
  10175. * @api private
  10176. */
  10177. exports.decodePacket = function (data, binaryType, utf8decode) {
  10178. if (data === undefined) {
  10179. return err;
  10180. }
  10181. // String data
  10182. if (typeof data === 'string') {
  10183. if (data.charAt(0) === 'b') {
  10184. return exports.decodeBase64Packet(data.substr(1), binaryType);
  10185. }
  10186. if (utf8decode) {
  10187. data = tryDecode(data);
  10188. if (data === false) {
  10189. return err;
  10190. }
  10191. }
  10192. var type = data.charAt(0);
  10193. if (Number(type) != type || !packetslist[type]) {
  10194. return err;
  10195. }
  10196. if (data.length > 1) {
  10197. return { type: packetslist[type], data: data.substring(1) };
  10198. } else {
  10199. return { type: packetslist[type] };
  10200. }
  10201. }
  10202. var asArray = new Uint8Array(data);
  10203. var type = asArray[0];
  10204. var rest = sliceBuffer(data, 1);
  10205. if (Blob && binaryType === 'blob') {
  10206. rest = new Blob([rest]);
  10207. }
  10208. return { type: packetslist[type], data: rest };
  10209. };
  10210. function tryDecode(data) {
  10211. try {
  10212. data = utf8.decode(data, { strict: false });
  10213. } catch (e) {
  10214. return false;
  10215. }
  10216. return data;
  10217. }
  10218. /**
  10219. * Decodes a packet encoded in a base64 string
  10220. *
  10221. * @param {String} base64 encoded message
  10222. * @return {Object} with `type` and `data` (if any)
  10223. */
  10224. exports.decodeBase64Packet = function(msg, binaryType) {
  10225. var type = packetslist[msg.charAt(0)];
  10226. if (!base64encoder) {
  10227. return { type: type, data: { base64: true, data: msg.substr(1) } };
  10228. }
  10229. var data = base64encoder.decode(msg.substr(1));
  10230. if (binaryType === 'blob' && Blob) {
  10231. data = new Blob([data]);
  10232. }
  10233. return { type: type, data: data };
  10234. };
  10235. /**
  10236. * Encodes multiple messages (payload).
  10237. *
  10238. * <length>:data
  10239. *
  10240. * Example:
  10241. *
  10242. * 11:hello world2:hi
  10243. *
  10244. * If any contents are binary, they will be encoded as base64 strings. Base64
  10245. * encoded strings are marked with a b before the length specifier
  10246. *
  10247. * @param {Array} packets
  10248. * @api private
  10249. */
  10250. exports.encodePayload = function (packets, supportsBinary, callback) {
  10251. if (typeof supportsBinary === 'function') {
  10252. callback = supportsBinary;
  10253. supportsBinary = null;
  10254. }
  10255. var isBinary = hasBinary(packets);
  10256. if (supportsBinary && isBinary) {
  10257. if (Blob && !dontSendBlobs) {
  10258. return exports.encodePayloadAsBlob(packets, callback);
  10259. }
  10260. return exports.encodePayloadAsArrayBuffer(packets, callback);
  10261. }
  10262. if (!packets.length) {
  10263. return callback('0:');
  10264. }
  10265. function setLengthHeader(message) {
  10266. return message.length + ':' + message;
  10267. }
  10268. function encodeOne(packet, doneCallback) {
  10269. exports.encodePacket(packet, !isBinary ? false : supportsBinary, false, function(message) {
  10270. doneCallback(null, setLengthHeader(message));
  10271. });
  10272. }
  10273. map(packets, encodeOne, function(err, results) {
  10274. return callback(results.join(''));
  10275. });
  10276. };
  10277. /**
  10278. * Async array map using after
  10279. */
  10280. function map(ary, each, done) {
  10281. var result = new Array(ary.length);
  10282. var next = after(ary.length, done);
  10283. var eachWithIndex = function(i, el, cb) {
  10284. each(el, function(error, msg) {
  10285. result[i] = msg;
  10286. cb(error, result);
  10287. });
  10288. };
  10289. for (var i = 0; i < ary.length; i++) {
  10290. eachWithIndex(i, ary[i], next);
  10291. }
  10292. }
  10293. /*
  10294. * Decodes data when a payload is maybe expected. Possible binary contents are
  10295. * decoded from their base64 representation
  10296. *
  10297. * @param {String} data, callback method
  10298. * @api public
  10299. */
  10300. exports.decodePayload = function (data, binaryType, callback) {
  10301. if (typeof data !== 'string') {
  10302. return exports.decodePayloadAsBinary(data, binaryType, callback);
  10303. }
  10304. if (typeof binaryType === 'function') {
  10305. callback = binaryType;
  10306. binaryType = null;
  10307. }
  10308. var packet;
  10309. if (data === '') {
  10310. // parser error - ignoring payload
  10311. return callback(err, 0, 1);
  10312. }
  10313. var length = '', n, msg;
  10314. for (var i = 0, l = data.length; i < l; i++) {
  10315. var chr = data.charAt(i);
  10316. if (chr !== ':') {
  10317. length += chr;
  10318. continue;
  10319. }
  10320. if (length === '' || (length != (n = Number(length)))) {
  10321. // parser error - ignoring payload
  10322. return callback(err, 0, 1);
  10323. }
  10324. msg = data.substr(i + 1, n);
  10325. if (length != msg.length) {
  10326. // parser error - ignoring payload
  10327. return callback(err, 0, 1);
  10328. }
  10329. if (msg.length) {
  10330. packet = exports.decodePacket(msg, binaryType, false);
  10331. if (err.type === packet.type && err.data === packet.data) {
  10332. // parser error in individual packet - ignoring payload
  10333. return callback(err, 0, 1);
  10334. }
  10335. var ret = callback(packet, i + n, l);
  10336. if (false === ret) return;
  10337. }
  10338. // advance cursor
  10339. i += n;
  10340. length = '';
  10341. }
  10342. if (length !== '') {
  10343. // parser error - ignoring payload
  10344. return callback(err, 0, 1);
  10345. }
  10346. };
  10347. /**
  10348. * Encodes multiple messages (payload) as binary.
  10349. *
  10350. * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number
  10351. * 255><data>
  10352. *
  10353. * Example:
  10354. * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers
  10355. *
  10356. * @param {Array} packets
  10357. * @return {ArrayBuffer} encoded payload
  10358. * @api private
  10359. */
  10360. exports.encodePayloadAsArrayBuffer = function(packets, callback) {
  10361. if (!packets.length) {
  10362. return callback(new ArrayBuffer(0));
  10363. }
  10364. function encodeOne(packet, doneCallback) {
  10365. exports.encodePacket(packet, true, true, function(data) {
  10366. return doneCallback(null, data);
  10367. });
  10368. }
  10369. map(packets, encodeOne, function(err, encodedPackets) {
  10370. var totalLength = encodedPackets.reduce(function(acc, p) {
  10371. var len;
  10372. if (typeof p === 'string'){
  10373. len = p.length;
  10374. } else {
  10375. len = p.byteLength;
  10376. }
  10377. return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2
  10378. }, 0);
  10379. var resultArray = new Uint8Array(totalLength);
  10380. var bufferIndex = 0;
  10381. encodedPackets.forEach(function(p) {
  10382. var isString = typeof p === 'string';
  10383. var ab = p;
  10384. if (isString) {
  10385. var view = new Uint8Array(p.length);
  10386. for (var i = 0; i < p.length; i++) {
  10387. view[i] = p.charCodeAt(i);
  10388. }
  10389. ab = view.buffer;
  10390. }
  10391. if (isString) { // not true binary
  10392. resultArray[bufferIndex++] = 0;
  10393. } else { // true binary
  10394. resultArray[bufferIndex++] = 1;
  10395. }
  10396. var lenStr = ab.byteLength.toString();
  10397. for (var i = 0; i < lenStr.length; i++) {
  10398. resultArray[bufferIndex++] = parseInt(lenStr[i]);
  10399. }
  10400. resultArray[bufferIndex++] = 255;
  10401. var view = new Uint8Array(ab);
  10402. for (var i = 0; i < view.length; i++) {
  10403. resultArray[bufferIndex++] = view[i];
  10404. }
  10405. });
  10406. return callback(resultArray.buffer);
  10407. });
  10408. };
  10409. /**
  10410. * Encode as Blob
  10411. */
  10412. exports.encodePayloadAsBlob = function(packets, callback) {
  10413. function encodeOne(packet, doneCallback) {
  10414. exports.encodePacket(packet, true, true, function(encoded) {
  10415. var binaryIdentifier = new Uint8Array(1);
  10416. binaryIdentifier[0] = 1;
  10417. if (typeof encoded === 'string') {
  10418. var view = new Uint8Array(encoded.length);
  10419. for (var i = 0; i < encoded.length; i++) {
  10420. view[i] = encoded.charCodeAt(i);
  10421. }
  10422. encoded = view.buffer;
  10423. binaryIdentifier[0] = 0;
  10424. }
  10425. var len = (encoded instanceof ArrayBuffer)
  10426. ? encoded.byteLength
  10427. : encoded.size;
  10428. var lenStr = len.toString();
  10429. var lengthAry = new Uint8Array(lenStr.length + 1);
  10430. for (var i = 0; i < lenStr.length; i++) {
  10431. lengthAry[i] = parseInt(lenStr[i]);
  10432. }
  10433. lengthAry[lenStr.length] = 255;
  10434. if (Blob) {
  10435. var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]);
  10436. doneCallback(null, blob);
  10437. }
  10438. });
  10439. }
  10440. map(packets, encodeOne, function(err, results) {
  10441. return callback(new Blob(results));
  10442. });
  10443. };
  10444. /*
  10445. * Decodes data when a payload is maybe expected. Strings are decoded by
  10446. * interpreting each byte as a key code for entries marked to start with 0. See
  10447. * description of encodePayloadAsBinary
  10448. *
  10449. * @param {ArrayBuffer} data, callback method
  10450. * @api public
  10451. */
  10452. exports.decodePayloadAsBinary = function (data, binaryType, callback) {
  10453. if (typeof binaryType === 'function') {
  10454. callback = binaryType;
  10455. binaryType = null;
  10456. }
  10457. var bufferTail = data;
  10458. var buffers = [];
  10459. while (bufferTail.byteLength > 0) {
  10460. var tailArray = new Uint8Array(bufferTail);
  10461. var isString = tailArray[0] === 0;
  10462. var msgLength = '';
  10463. for (var i = 1; ; i++) {
  10464. if (tailArray[i] === 255) break;
  10465. // 310 = char length of Number.MAX_VALUE
  10466. if (msgLength.length > 310) {
  10467. return callback(err, 0, 1);
  10468. }
  10469. msgLength += tailArray[i];
  10470. }
  10471. bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length);
  10472. msgLength = parseInt(msgLength);
  10473. var msg = sliceBuffer(bufferTail, 0, msgLength);
  10474. if (isString) {
  10475. try {
  10476. msg = String.fromCharCode.apply(null, new Uint8Array(msg));
  10477. } catch (e) {
  10478. // iPhone Safari doesn't let you apply to typed arrays
  10479. var typed = new Uint8Array(msg);
  10480. msg = '';
  10481. for (var i = 0; i < typed.length; i++) {
  10482. msg += String.fromCharCode(typed[i]);
  10483. }
  10484. }
  10485. }
  10486. buffers.push(msg);
  10487. bufferTail = sliceBuffer(bufferTail, msgLength);
  10488. }
  10489. var total = buffers.length;
  10490. buffers.forEach(function(buffer, i) {
  10491. callback(exports.decodePacket(buffer, binaryType, true), i, total);
  10492. });
  10493. };
  10494. /***/ }),
  10495. /***/ "./node_modules/engine.io-parser/lib/keys.js":
  10496. /*!***************************************************!*\
  10497. !*** ./node_modules/engine.io-parser/lib/keys.js ***!
  10498. \***************************************************/
  10499. /*! no static exports found */
  10500. /***/ (function(module, exports) {
  10501. /**
  10502. * Gets the keys for an object.
  10503. *
  10504. * @return {Array} keys
  10505. * @api private
  10506. */
  10507. module.exports = Object.keys || function keys (obj){
  10508. var arr = [];
  10509. var has = Object.prototype.hasOwnProperty;
  10510. for (var i in obj) {
  10511. if (has.call(obj, i)) {
  10512. arr.push(i);
  10513. }
  10514. }
  10515. return arr;
  10516. };
  10517. /***/ }),
  10518. /***/ "./node_modules/engine.io-parser/lib/utf8.js":
  10519. /*!***************************************************!*\
  10520. !*** ./node_modules/engine.io-parser/lib/utf8.js ***!
  10521. \***************************************************/
  10522. /*! no static exports found */
  10523. /***/ (function(module, exports) {
  10524. /*! https://mths.be/utf8js v2.1.2 by @mathias */
  10525. var stringFromCharCode = String.fromCharCode;
  10526. // Taken from https://mths.be/punycode
  10527. function ucs2decode(string) {
  10528. var output = [];
  10529. var counter = 0;
  10530. var length = string.length;
  10531. var value;
  10532. var extra;
  10533. while (counter < length) {
  10534. value = string.charCodeAt(counter++);
  10535. if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
  10536. // high surrogate, and there is a next character
  10537. extra = string.charCodeAt(counter++);
  10538. if ((extra & 0xFC00) == 0xDC00) { // low surrogate
  10539. output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
  10540. } else {
  10541. // unmatched surrogate; only append this code unit, in case the next
  10542. // code unit is the high surrogate of a surrogate pair
  10543. output.push(value);
  10544. counter--;
  10545. }
  10546. } else {
  10547. output.push(value);
  10548. }
  10549. }
  10550. return output;
  10551. }
  10552. // Taken from https://mths.be/punycode
  10553. function ucs2encode(array) {
  10554. var length = array.length;
  10555. var index = -1;
  10556. var value;
  10557. var output = '';
  10558. while (++index < length) {
  10559. value = array[index];
  10560. if (value > 0xFFFF) {
  10561. value -= 0x10000;
  10562. output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
  10563. value = 0xDC00 | value & 0x3FF;
  10564. }
  10565. output += stringFromCharCode(value);
  10566. }
  10567. return output;
  10568. }
  10569. function checkScalarValue(codePoint, strict) {
  10570. if (codePoint >= 0xD800 && codePoint <= 0xDFFF) {
  10571. if (strict) {
  10572. throw Error(
  10573. 'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +
  10574. ' is not a scalar value'
  10575. );
  10576. }
  10577. return false;
  10578. }
  10579. return true;
  10580. }
  10581. /*--------------------------------------------------------------------------*/
  10582. function createByte(codePoint, shift) {
  10583. return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);
  10584. }
  10585. function encodeCodePoint(codePoint, strict) {
  10586. if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence
  10587. return stringFromCharCode(codePoint);
  10588. }
  10589. var symbol = '';
  10590. if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence
  10591. symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);
  10592. }
  10593. else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence
  10594. if (!checkScalarValue(codePoint, strict)) {
  10595. codePoint = 0xFFFD;
  10596. }
  10597. symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);
  10598. symbol += createByte(codePoint, 6);
  10599. }
  10600. else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence
  10601. symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);
  10602. symbol += createByte(codePoint, 12);
  10603. symbol += createByte(codePoint, 6);
  10604. }
  10605. symbol += stringFromCharCode((codePoint & 0x3F) | 0x80);
  10606. return symbol;
  10607. }
  10608. function utf8encode(string, opts) {
  10609. opts = opts || {};
  10610. var strict = false !== opts.strict;
  10611. var codePoints = ucs2decode(string);
  10612. var length = codePoints.length;
  10613. var index = -1;
  10614. var codePoint;
  10615. var byteString = '';
  10616. while (++index < length) {
  10617. codePoint = codePoints[index];
  10618. byteString += encodeCodePoint(codePoint, strict);
  10619. }
  10620. return byteString;
  10621. }
  10622. /*--------------------------------------------------------------------------*/
  10623. function readContinuationByte() {
  10624. if (byteIndex >= byteCount) {
  10625. throw Error('Invalid byte index');
  10626. }
  10627. var continuationByte = byteArray[byteIndex] & 0xFF;
  10628. byteIndex++;
  10629. if ((continuationByte & 0xC0) == 0x80) {
  10630. return continuationByte & 0x3F;
  10631. }
  10632. // If we end up here, it’s not a continuation byte
  10633. throw Error('Invalid continuation byte');
  10634. }
  10635. function decodeSymbol(strict) {
  10636. var byte1;
  10637. var byte2;
  10638. var byte3;
  10639. var byte4;
  10640. var codePoint;
  10641. if (byteIndex > byteCount) {
  10642. throw Error('Invalid byte index');
  10643. }
  10644. if (byteIndex == byteCount) {
  10645. return false;
  10646. }
  10647. // Read first byte
  10648. byte1 = byteArray[byteIndex] & 0xFF;
  10649. byteIndex++;
  10650. // 1-byte sequence (no continuation bytes)
  10651. if ((byte1 & 0x80) == 0) {
  10652. return byte1;
  10653. }
  10654. // 2-byte sequence
  10655. if ((byte1 & 0xE0) == 0xC0) {
  10656. byte2 = readContinuationByte();
  10657. codePoint = ((byte1 & 0x1F) << 6) | byte2;
  10658. if (codePoint >= 0x80) {
  10659. return codePoint;
  10660. } else {
  10661. throw Error('Invalid continuation byte');
  10662. }
  10663. }
  10664. // 3-byte sequence (may include unpaired surrogates)
  10665. if ((byte1 & 0xF0) == 0xE0) {
  10666. byte2 = readContinuationByte();
  10667. byte3 = readContinuationByte();
  10668. codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;
  10669. if (codePoint >= 0x0800) {
  10670. return checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD;
  10671. } else {
  10672. throw Error('Invalid continuation byte');
  10673. }
  10674. }
  10675. // 4-byte sequence
  10676. if ((byte1 & 0xF8) == 0xF0) {
  10677. byte2 = readContinuationByte();
  10678. byte3 = readContinuationByte();
  10679. byte4 = readContinuationByte();
  10680. codePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) |
  10681. (byte3 << 0x06) | byte4;
  10682. if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {
  10683. return codePoint;
  10684. }
  10685. }
  10686. throw Error('Invalid UTF-8 detected');
  10687. }
  10688. var byteArray;
  10689. var byteCount;
  10690. var byteIndex;
  10691. function utf8decode(byteString, opts) {
  10692. opts = opts || {};
  10693. var strict = false !== opts.strict;
  10694. byteArray = ucs2decode(byteString);
  10695. byteCount = byteArray.length;
  10696. byteIndex = 0;
  10697. var codePoints = [];
  10698. var tmp;
  10699. while ((tmp = decodeSymbol(strict)) !== false) {
  10700. codePoints.push(tmp);
  10701. }
  10702. return ucs2encode(codePoints);
  10703. }
  10704. module.exports = {
  10705. version: '2.1.2',
  10706. encode: utf8encode,
  10707. decode: utf8decode
  10708. };
  10709. /***/ }),
  10710. /***/ "./node_modules/has-binary2/index.js":
  10711. /*!*******************************************!*\
  10712. !*** ./node_modules/has-binary2/index.js ***!
  10713. \*******************************************/
  10714. /*! no static exports found */
  10715. /***/ (function(module, exports, __webpack_require__) {
  10716. /* WEBPACK VAR INJECTION */(function(Buffer) {/* global Blob File */
  10717. /*
  10718. * Module requirements.
  10719. */
  10720. var isArray = __webpack_require__(/*! isarray */ "./node_modules/has-binary2/node_modules/isarray/index.js");
  10721. var toString = Object.prototype.toString;
  10722. var withNativeBlob = typeof Blob === 'function' ||
  10723. typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]';
  10724. var withNativeFile = typeof File === 'function' ||
  10725. typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]';
  10726. /**
  10727. * Module exports.
  10728. */
  10729. module.exports = hasBinary;
  10730. /**
  10731. * Checks for binary data.
  10732. *
  10733. * Supports Buffer, ArrayBuffer, Blob and File.
  10734. *
  10735. * @param {Object} anything
  10736. * @api public
  10737. */
  10738. function hasBinary (obj) {
  10739. if (!obj || typeof obj !== 'object') {
  10740. return false;
  10741. }
  10742. if (isArray(obj)) {
  10743. for (var i = 0, l = obj.length; i < l; i++) {
  10744. if (hasBinary(obj[i])) {
  10745. return true;
  10746. }
  10747. }
  10748. return false;
  10749. }
  10750. if ((typeof Buffer === 'function' && Buffer.isBuffer && Buffer.isBuffer(obj)) ||
  10751. (typeof ArrayBuffer === 'function' && obj instanceof ArrayBuffer) ||
  10752. (withNativeBlob && obj instanceof Blob) ||
  10753. (withNativeFile && obj instanceof File)
  10754. ) {
  10755. return true;
  10756. }
  10757. // see: https://github.com/Automattic/has-binary/pull/4
  10758. if (obj.toJSON && typeof obj.toJSON === 'function' && arguments.length === 1) {
  10759. return hasBinary(obj.toJSON(), true);
  10760. }
  10761. for (var key in obj) {
  10762. if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) {
  10763. return true;
  10764. }
  10765. }
  10766. return false;
  10767. }
  10768. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  10769. /***/ }),
  10770. /***/ "./node_modules/has-binary2/node_modules/isarray/index.js":
  10771. /*!****************************************************************!*\
  10772. !*** ./node_modules/has-binary2/node_modules/isarray/index.js ***!
  10773. \****************************************************************/
  10774. /*! no static exports found */
  10775. /***/ (function(module, exports) {
  10776. var toString = {}.toString;
  10777. module.exports = Array.isArray || function (arr) {
  10778. return toString.call(arr) == '[object Array]';
  10779. };
  10780. /***/ }),
  10781. /***/ "./node_modules/has-cors/index.js":
  10782. /*!****************************************!*\
  10783. !*** ./node_modules/has-cors/index.js ***!
  10784. \****************************************/
  10785. /*! no static exports found */
  10786. /***/ (function(module, exports) {
  10787. /**
  10788. * Module exports.
  10789. *
  10790. * Logic borrowed from Modernizr:
  10791. *
  10792. * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js
  10793. */
  10794. try {
  10795. module.exports = typeof XMLHttpRequest !== 'undefined' &&
  10796. 'withCredentials' in new XMLHttpRequest();
  10797. } catch (err) {
  10798. // if XMLHttp support is disabled in IE then it will throw
  10799. // when trying to create
  10800. module.exports = false;
  10801. }
  10802. /***/ }),
  10803. /***/ "./node_modules/ieee754/index.js":
  10804. /*!***************************************!*\
  10805. !*** ./node_modules/ieee754/index.js ***!
  10806. \***************************************/
  10807. /*! no static exports found */
  10808. /***/ (function(module, exports) {
  10809. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  10810. var e, m
  10811. var eLen = (nBytes * 8) - mLen - 1
  10812. var eMax = (1 << eLen) - 1
  10813. var eBias = eMax >> 1
  10814. var nBits = -7
  10815. var i = isLE ? (nBytes - 1) : 0
  10816. var d = isLE ? -1 : 1
  10817. var s = buffer[offset + i]
  10818. i += d
  10819. e = s & ((1 << (-nBits)) - 1)
  10820. s >>= (-nBits)
  10821. nBits += eLen
  10822. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  10823. m = e & ((1 << (-nBits)) - 1)
  10824. e >>= (-nBits)
  10825. nBits += mLen
  10826. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  10827. if (e === 0) {
  10828. e = 1 - eBias
  10829. } else if (e === eMax) {
  10830. return m ? NaN : ((s ? -1 : 1) * Infinity)
  10831. } else {
  10832. m = m + Math.pow(2, mLen)
  10833. e = e - eBias
  10834. }
  10835. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  10836. }
  10837. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  10838. var e, m, c
  10839. var eLen = (nBytes * 8) - mLen - 1
  10840. var eMax = (1 << eLen) - 1
  10841. var eBias = eMax >> 1
  10842. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  10843. var i = isLE ? 0 : (nBytes - 1)
  10844. var d = isLE ? 1 : -1
  10845. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  10846. value = Math.abs(value)
  10847. if (isNaN(value) || value === Infinity) {
  10848. m = isNaN(value) ? 1 : 0
  10849. e = eMax
  10850. } else {
  10851. e = Math.floor(Math.log(value) / Math.LN2)
  10852. if (value * (c = Math.pow(2, -e)) < 1) {
  10853. e--
  10854. c *= 2
  10855. }
  10856. if (e + eBias >= 1) {
  10857. value += rt / c
  10858. } else {
  10859. value += rt * Math.pow(2, 1 - eBias)
  10860. }
  10861. if (value * c >= 2) {
  10862. e++
  10863. c /= 2
  10864. }
  10865. if (e + eBias >= eMax) {
  10866. m = 0
  10867. e = eMax
  10868. } else if (e + eBias >= 1) {
  10869. m = ((value * c) - 1) * Math.pow(2, mLen)
  10870. e = e + eBias
  10871. } else {
  10872. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  10873. e = 0
  10874. }
  10875. }
  10876. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  10877. e = (e << mLen) | m
  10878. eLen += mLen
  10879. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  10880. buffer[offset + i - d] |= s * 128
  10881. }
  10882. /***/ }),
  10883. /***/ "./node_modules/indexof/index.js":
  10884. /*!***************************************!*\
  10885. !*** ./node_modules/indexof/index.js ***!
  10886. \***************************************/
  10887. /*! no static exports found */
  10888. /***/ (function(module, exports) {
  10889. var indexOf = [].indexOf;
  10890. module.exports = function(arr, obj){
  10891. if (indexOf) return arr.indexOf(obj);
  10892. for (var i = 0; i < arr.length; ++i) {
  10893. if (arr[i] === obj) return i;
  10894. }
  10895. return -1;
  10896. };
  10897. /***/ }),
  10898. /***/ "./node_modules/isarray/index.js":
  10899. /*!***************************************!*\
  10900. !*** ./node_modules/isarray/index.js ***!
  10901. \***************************************/
  10902. /*! no static exports found */
  10903. /***/ (function(module, exports) {
  10904. var toString = {}.toString;
  10905. module.exports = Array.isArray || function (arr) {
  10906. return toString.call(arr) == '[object Array]';
  10907. };
  10908. /***/ }),
  10909. /***/ "./node_modules/jquery/dist/jquery.js":
  10910. /*!********************************************!*\
  10911. !*** ./node_modules/jquery/dist/jquery.js ***!
  10912. \********************************************/
  10913. /*! no static exports found */
  10914. /***/ (function(module, exports, __webpack_require__) {
  10915. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  10916. * jQuery JavaScript Library v3.5.1
  10917. * https://jquery.com/
  10918. *
  10919. * Includes Sizzle.js
  10920. * https://sizzlejs.com/
  10921. *
  10922. * Copyright JS Foundation and other contributors
  10923. * Released under the MIT license
  10924. * https://jquery.org/license
  10925. *
  10926. * Date: 2020-05-04T22:49Z
  10927. */
  10928. ( function( global, factory ) {
  10929. "use strict";
  10930. if ( true && typeof module.exports === "object" ) {
  10931. // For CommonJS and CommonJS-like environments where a proper `window`
  10932. // is present, execute the factory and get jQuery.
  10933. // For environments that do not have a `window` with a `document`
  10934. // (such as Node.js), expose a factory as module.exports.
  10935. // This accentuates the need for the creation of a real `window`.
  10936. // e.g. var jQuery = require("jquery")(window);
  10937. // See ticket #14549 for more info.
  10938. module.exports = global.document ?
  10939. factory( global, true ) :
  10940. function( w ) {
  10941. if ( !w.document ) {
  10942. throw new Error( "jQuery requires a window with a document" );
  10943. }
  10944. return factory( w );
  10945. };
  10946. } else {
  10947. factory( global );
  10948. }
  10949. // Pass this if window is not defined yet
  10950. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  10951. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  10952. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  10953. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  10954. // enough that all such attempts are guarded in a try block.
  10955. "use strict";
  10956. var arr = [];
  10957. var getProto = Object.getPrototypeOf;
  10958. var slice = arr.slice;
  10959. var flat = arr.flat ? function( array ) {
  10960. return arr.flat.call( array );
  10961. } : function( array ) {
  10962. return arr.concat.apply( [], array );
  10963. };
  10964. var push = arr.push;
  10965. var indexOf = arr.indexOf;
  10966. var class2type = {};
  10967. var toString = class2type.toString;
  10968. var hasOwn = class2type.hasOwnProperty;
  10969. var fnToString = hasOwn.toString;
  10970. var ObjectFunctionString = fnToString.call( Object );
  10971. var support = {};
  10972. var isFunction = function isFunction( obj ) {
  10973. // Support: Chrome <=57, Firefox <=52
  10974. // In some browsers, typeof returns "function" for HTML <object> elements
  10975. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  10976. // We don't want to classify *any* DOM node as a function.
  10977. return typeof obj === "function" && typeof obj.nodeType !== "number";
  10978. };
  10979. var isWindow = function isWindow( obj ) {
  10980. return obj != null && obj === obj.window;
  10981. };
  10982. var document = window.document;
  10983. var preservedScriptAttributes = {
  10984. type: true,
  10985. src: true,
  10986. nonce: true,
  10987. noModule: true
  10988. };
  10989. function DOMEval( code, node, doc ) {
  10990. doc = doc || document;
  10991. var i, val,
  10992. script = doc.createElement( "script" );
  10993. script.text = code;
  10994. if ( node ) {
  10995. for ( i in preservedScriptAttributes ) {
  10996. // Support: Firefox 64+, Edge 18+
  10997. // Some browsers don't support the "nonce" property on scripts.
  10998. // On the other hand, just using `getAttribute` is not enough as
  10999. // the `nonce` attribute is reset to an empty string whenever it
  11000. // becomes browsing-context connected.
  11001. // See https://github.com/whatwg/html/issues/2369
  11002. // See https://html.spec.whatwg.org/#nonce-attributes
  11003. // The `node.getAttribute` check was added for the sake of
  11004. // `jQuery.globalEval` so that it can fake a nonce-containing node
  11005. // via an object.
  11006. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  11007. if ( val ) {
  11008. script.setAttribute( i, val );
  11009. }
  11010. }
  11011. }
  11012. doc.head.appendChild( script ).parentNode.removeChild( script );
  11013. }
  11014. function toType( obj ) {
  11015. if ( obj == null ) {
  11016. return obj + "";
  11017. }
  11018. // Support: Android <=2.3 only (functionish RegExp)
  11019. return typeof obj === "object" || typeof obj === "function" ?
  11020. class2type[ toString.call( obj ) ] || "object" :
  11021. typeof obj;
  11022. }
  11023. /* global Symbol */
  11024. // Defining this global in .eslintrc.json would create a danger of using the global
  11025. // unguarded in another place, it seems safer to define global only for this module
  11026. var
  11027. version = "3.5.1",
  11028. // Define a local copy of jQuery
  11029. jQuery = function( selector, context ) {
  11030. // The jQuery object is actually just the init constructor 'enhanced'
  11031. // Need init if jQuery is called (just allow error to be thrown if not included)
  11032. return new jQuery.fn.init( selector, context );
  11033. };
  11034. jQuery.fn = jQuery.prototype = {
  11035. // The current version of jQuery being used
  11036. jquery: version,
  11037. constructor: jQuery,
  11038. // The default length of a jQuery object is 0
  11039. length: 0,
  11040. toArray: function() {
  11041. return slice.call( this );
  11042. },
  11043. // Get the Nth element in the matched element set OR
  11044. // Get the whole matched element set as a clean array
  11045. get: function( num ) {
  11046. // Return all the elements in a clean array
  11047. if ( num == null ) {
  11048. return slice.call( this );
  11049. }
  11050. // Return just the one element from the set
  11051. return num < 0 ? this[ num + this.length ] : this[ num ];
  11052. },
  11053. // Take an array of elements and push it onto the stack
  11054. // (returning the new matched element set)
  11055. pushStack: function( elems ) {
  11056. // Build a new jQuery matched element set
  11057. var ret = jQuery.merge( this.constructor(), elems );
  11058. // Add the old object onto the stack (as a reference)
  11059. ret.prevObject = this;
  11060. // Return the newly-formed element set
  11061. return ret;
  11062. },
  11063. // Execute a callback for every element in the matched set.
  11064. each: function( callback ) {
  11065. return jQuery.each( this, callback );
  11066. },
  11067. map: function( callback ) {
  11068. return this.pushStack( jQuery.map( this, function( elem, i ) {
  11069. return callback.call( elem, i, elem );
  11070. } ) );
  11071. },
  11072. slice: function() {
  11073. return this.pushStack( slice.apply( this, arguments ) );
  11074. },
  11075. first: function() {
  11076. return this.eq( 0 );
  11077. },
  11078. last: function() {
  11079. return this.eq( -1 );
  11080. },
  11081. even: function() {
  11082. return this.pushStack( jQuery.grep( this, function( _elem, i ) {
  11083. return ( i + 1 ) % 2;
  11084. } ) );
  11085. },
  11086. odd: function() {
  11087. return this.pushStack( jQuery.grep( this, function( _elem, i ) {
  11088. return i % 2;
  11089. } ) );
  11090. },
  11091. eq: function( i ) {
  11092. var len = this.length,
  11093. j = +i + ( i < 0 ? len : 0 );
  11094. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  11095. },
  11096. end: function() {
  11097. return this.prevObject || this.constructor();
  11098. },
  11099. // For internal use only.
  11100. // Behaves like an Array's method, not like a jQuery method.
  11101. push: push,
  11102. sort: arr.sort,
  11103. splice: arr.splice
  11104. };
  11105. jQuery.extend = jQuery.fn.extend = function() {
  11106. var options, name, src, copy, copyIsArray, clone,
  11107. target = arguments[ 0 ] || {},
  11108. i = 1,
  11109. length = arguments.length,
  11110. deep = false;
  11111. // Handle a deep copy situation
  11112. if ( typeof target === "boolean" ) {
  11113. deep = target;
  11114. // Skip the boolean and the target
  11115. target = arguments[ i ] || {};
  11116. i++;
  11117. }
  11118. // Handle case when target is a string or something (possible in deep copy)
  11119. if ( typeof target !== "object" && !isFunction( target ) ) {
  11120. target = {};
  11121. }
  11122. // Extend jQuery itself if only one argument is passed
  11123. if ( i === length ) {
  11124. target = this;
  11125. i--;
  11126. }
  11127. for ( ; i < length; i++ ) {
  11128. // Only deal with non-null/undefined values
  11129. if ( ( options = arguments[ i ] ) != null ) {
  11130. // Extend the base object
  11131. for ( name in options ) {
  11132. copy = options[ name ];
  11133. // Prevent Object.prototype pollution
  11134. // Prevent never-ending loop
  11135. if ( name === "__proto__" || target === copy ) {
  11136. continue;
  11137. }
  11138. // Recurse if we're merging plain objects or arrays
  11139. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  11140. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  11141. src = target[ name ];
  11142. // Ensure proper type for the source value
  11143. if ( copyIsArray && !Array.isArray( src ) ) {
  11144. clone = [];
  11145. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  11146. clone = {};
  11147. } else {
  11148. clone = src;
  11149. }
  11150. copyIsArray = false;
  11151. // Never move original objects, clone them
  11152. target[ name ] = jQuery.extend( deep, clone, copy );
  11153. // Don't bring in undefined values
  11154. } else if ( copy !== undefined ) {
  11155. target[ name ] = copy;
  11156. }
  11157. }
  11158. }
  11159. }
  11160. // Return the modified object
  11161. return target;
  11162. };
  11163. jQuery.extend( {
  11164. // Unique for each copy of jQuery on the page
  11165. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  11166. // Assume jQuery is ready without the ready module
  11167. isReady: true,
  11168. error: function( msg ) {
  11169. throw new Error( msg );
  11170. },
  11171. noop: function() {},
  11172. isPlainObject: function( obj ) {
  11173. var proto, Ctor;
  11174. // Detect obvious negatives
  11175. // Use toString instead of jQuery.type to catch host objects
  11176. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  11177. return false;
  11178. }
  11179. proto = getProto( obj );
  11180. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  11181. if ( !proto ) {
  11182. return true;
  11183. }
  11184. // Objects with prototype are plain iff they were constructed by a global Object function
  11185. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  11186. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  11187. },
  11188. isEmptyObject: function( obj ) {
  11189. var name;
  11190. for ( name in obj ) {
  11191. return false;
  11192. }
  11193. return true;
  11194. },
  11195. // Evaluates a script in a provided context; falls back to the global one
  11196. // if not specified.
  11197. globalEval: function( code, options, doc ) {
  11198. DOMEval( code, { nonce: options && options.nonce }, doc );
  11199. },
  11200. each: function( obj, callback ) {
  11201. var length, i = 0;
  11202. if ( isArrayLike( obj ) ) {
  11203. length = obj.length;
  11204. for ( ; i < length; i++ ) {
  11205. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  11206. break;
  11207. }
  11208. }
  11209. } else {
  11210. for ( i in obj ) {
  11211. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  11212. break;
  11213. }
  11214. }
  11215. }
  11216. return obj;
  11217. },
  11218. // results is for internal usage only
  11219. makeArray: function( arr, results ) {
  11220. var ret = results || [];
  11221. if ( arr != null ) {
  11222. if ( isArrayLike( Object( arr ) ) ) {
  11223. jQuery.merge( ret,
  11224. typeof arr === "string" ?
  11225. [ arr ] : arr
  11226. );
  11227. } else {
  11228. push.call( ret, arr );
  11229. }
  11230. }
  11231. return ret;
  11232. },
  11233. inArray: function( elem, arr, i ) {
  11234. return arr == null ? -1 : indexOf.call( arr, elem, i );
  11235. },
  11236. // Support: Android <=4.0 only, PhantomJS 1 only
  11237. // push.apply(_, arraylike) throws on ancient WebKit
  11238. merge: function( first, second ) {
  11239. var len = +second.length,
  11240. j = 0,
  11241. i = first.length;
  11242. for ( ; j < len; j++ ) {
  11243. first[ i++ ] = second[ j ];
  11244. }
  11245. first.length = i;
  11246. return first;
  11247. },
  11248. grep: function( elems, callback, invert ) {
  11249. var callbackInverse,
  11250. matches = [],
  11251. i = 0,
  11252. length = elems.length,
  11253. callbackExpect = !invert;
  11254. // Go through the array, only saving the items
  11255. // that pass the validator function
  11256. for ( ; i < length; i++ ) {
  11257. callbackInverse = !callback( elems[ i ], i );
  11258. if ( callbackInverse !== callbackExpect ) {
  11259. matches.push( elems[ i ] );
  11260. }
  11261. }
  11262. return matches;
  11263. },
  11264. // arg is for internal usage only
  11265. map: function( elems, callback, arg ) {
  11266. var length, value,
  11267. i = 0,
  11268. ret = [];
  11269. // Go through the array, translating each of the items to their new values
  11270. if ( isArrayLike( elems ) ) {
  11271. length = elems.length;
  11272. for ( ; i < length; i++ ) {
  11273. value = callback( elems[ i ], i, arg );
  11274. if ( value != null ) {
  11275. ret.push( value );
  11276. }
  11277. }
  11278. // Go through every key on the object,
  11279. } else {
  11280. for ( i in elems ) {
  11281. value = callback( elems[ i ], i, arg );
  11282. if ( value != null ) {
  11283. ret.push( value );
  11284. }
  11285. }
  11286. }
  11287. // Flatten any nested arrays
  11288. return flat( ret );
  11289. },
  11290. // A global GUID counter for objects
  11291. guid: 1,
  11292. // jQuery.support is not used in Core but other projects attach their
  11293. // properties to it so it needs to exist.
  11294. support: support
  11295. } );
  11296. if ( typeof Symbol === "function" ) {
  11297. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  11298. }
  11299. // Populate the class2type map
  11300. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  11301. function( _i, name ) {
  11302. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  11303. } );
  11304. function isArrayLike( obj ) {
  11305. // Support: real iOS 8.2 only (not reproducible in simulator)
  11306. // `in` check used to prevent JIT error (gh-2145)
  11307. // hasOwn isn't used here due to false negatives
  11308. // regarding Nodelist length in IE
  11309. var length = !!obj && "length" in obj && obj.length,
  11310. type = toType( obj );
  11311. if ( isFunction( obj ) || isWindow( obj ) ) {
  11312. return false;
  11313. }
  11314. return type === "array" || length === 0 ||
  11315. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  11316. }
  11317. var Sizzle =
  11318. /*!
  11319. * Sizzle CSS Selector Engine v2.3.5
  11320. * https://sizzlejs.com/
  11321. *
  11322. * Copyright JS Foundation and other contributors
  11323. * Released under the MIT license
  11324. * https://js.foundation/
  11325. *
  11326. * Date: 2020-03-14
  11327. */
  11328. ( function( window ) {
  11329. var i,
  11330. support,
  11331. Expr,
  11332. getText,
  11333. isXML,
  11334. tokenize,
  11335. compile,
  11336. select,
  11337. outermostContext,
  11338. sortInput,
  11339. hasDuplicate,
  11340. // Local document vars
  11341. setDocument,
  11342. document,
  11343. docElem,
  11344. documentIsHTML,
  11345. rbuggyQSA,
  11346. rbuggyMatches,
  11347. matches,
  11348. contains,
  11349. // Instance-specific data
  11350. expando = "sizzle" + 1 * new Date(),
  11351. preferredDoc = window.document,
  11352. dirruns = 0,
  11353. done = 0,
  11354. classCache = createCache(),
  11355. tokenCache = createCache(),
  11356. compilerCache = createCache(),
  11357. nonnativeSelectorCache = createCache(),
  11358. sortOrder = function( a, b ) {
  11359. if ( a === b ) {
  11360. hasDuplicate = true;
  11361. }
  11362. return 0;
  11363. },
  11364. // Instance methods
  11365. hasOwn = ( {} ).hasOwnProperty,
  11366. arr = [],
  11367. pop = arr.pop,
  11368. pushNative = arr.push,
  11369. push = arr.push,
  11370. slice = arr.slice,
  11371. // Use a stripped-down indexOf as it's faster than native
  11372. // https://jsperf.com/thor-indexof-vs-for/5
  11373. indexOf = function( list, elem ) {
  11374. var i = 0,
  11375. len = list.length;
  11376. for ( ; i < len; i++ ) {
  11377. if ( list[ i ] === elem ) {
  11378. return i;
  11379. }
  11380. }
  11381. return -1;
  11382. },
  11383. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" +
  11384. "ismap|loop|multiple|open|readonly|required|scoped",
  11385. // Regular expressions
  11386. // http://www.w3.org/TR/css3-selectors/#whitespace
  11387. whitespace = "[\\x20\\t\\r\\n\\f]",
  11388. // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
  11389. identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
  11390. "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
  11391. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  11392. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  11393. // Operator (capture 2)
  11394. "*([*^$|!~]?=)" + whitespace +
  11395. // "Attribute values must be CSS identifiers [capture 5]
  11396. // or strings [capture 3 or capture 4]"
  11397. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
  11398. whitespace + "*\\]",
  11399. pseudos = ":(" + identifier + ")(?:\\((" +
  11400. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  11401. // 1. quoted (capture 3; capture 4 or capture 5)
  11402. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  11403. // 2. simple (capture 6)
  11404. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  11405. // 3. anything else (capture 2)
  11406. ".*" +
  11407. ")\\)|)",
  11408. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  11409. rwhitespace = new RegExp( whitespace + "+", "g" ),
  11410. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
  11411. whitespace + "+$", "g" ),
  11412. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  11413. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
  11414. "*" ),
  11415. rdescend = new RegExp( whitespace + "|>" ),
  11416. rpseudo = new RegExp( pseudos ),
  11417. ridentifier = new RegExp( "^" + identifier + "$" ),
  11418. matchExpr = {
  11419. "ID": new RegExp( "^#(" + identifier + ")" ),
  11420. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  11421. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  11422. "ATTR": new RegExp( "^" + attributes ),
  11423. "PSEUDO": new RegExp( "^" + pseudos ),
  11424. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
  11425. whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
  11426. whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  11427. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  11428. // For use in libraries implementing .is()
  11429. // We use this for POS matching in `select`
  11430. "needsContext": new RegExp( "^" + whitespace +
  11431. "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
  11432. "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  11433. },
  11434. rhtml = /HTML$/i,
  11435. rinputs = /^(?:input|select|textarea|button)$/i,
  11436. rheader = /^h\d$/i,
  11437. rnative = /^[^{]+\{\s*\[native \w/,
  11438. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  11439. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  11440. rsibling = /[+~]/,
  11441. // CSS escapes
  11442. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  11443. runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ),
  11444. funescape = function( escape, nonHex ) {
  11445. var high = "0x" + escape.slice( 1 ) - 0x10000;
  11446. return nonHex ?
  11447. // Strip the backslash prefix from a non-hex escape sequence
  11448. nonHex :
  11449. // Replace a hexadecimal escape sequence with the encoded Unicode code point
  11450. // Support: IE <=11+
  11451. // For values outside the Basic Multilingual Plane (BMP), manually construct a
  11452. // surrogate pair
  11453. high < 0 ?
  11454. String.fromCharCode( high + 0x10000 ) :
  11455. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  11456. },
  11457. // CSS string/identifier serialization
  11458. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  11459. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  11460. fcssescape = function( ch, asCodePoint ) {
  11461. if ( asCodePoint ) {
  11462. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  11463. if ( ch === "\0" ) {
  11464. return "\uFFFD";
  11465. }
  11466. // Control characters and (dependent upon position) numbers get escaped as code points
  11467. return ch.slice( 0, -1 ) + "\\" +
  11468. ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  11469. }
  11470. // Other potentially-special ASCII characters get backslash-escaped
  11471. return "\\" + ch;
  11472. },
  11473. // Used for iframes
  11474. // See setDocument()
  11475. // Removing the function wrapper causes a "Permission Denied"
  11476. // error in IE
  11477. unloadHandler = function() {
  11478. setDocument();
  11479. },
  11480. inDisabledFieldset = addCombinator(
  11481. function( elem ) {
  11482. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  11483. },
  11484. { dir: "parentNode", next: "legend" }
  11485. );
  11486. // Optimize for push.apply( _, NodeList )
  11487. try {
  11488. push.apply(
  11489. ( arr = slice.call( preferredDoc.childNodes ) ),
  11490. preferredDoc.childNodes
  11491. );
  11492. // Support: Android<4.0
  11493. // Detect silently failing push.apply
  11494. // eslint-disable-next-line no-unused-expressions
  11495. arr[ preferredDoc.childNodes.length ].nodeType;
  11496. } catch ( e ) {
  11497. push = { apply: arr.length ?
  11498. // Leverage slice if possible
  11499. function( target, els ) {
  11500. pushNative.apply( target, slice.call( els ) );
  11501. } :
  11502. // Support: IE<9
  11503. // Otherwise append directly
  11504. function( target, els ) {
  11505. var j = target.length,
  11506. i = 0;
  11507. // Can't trust NodeList.length
  11508. while ( ( target[ j++ ] = els[ i++ ] ) ) {}
  11509. target.length = j - 1;
  11510. }
  11511. };
  11512. }
  11513. function Sizzle( selector, context, results, seed ) {
  11514. var m, i, elem, nid, match, groups, newSelector,
  11515. newContext = context && context.ownerDocument,
  11516. // nodeType defaults to 9, since context defaults to document
  11517. nodeType = context ? context.nodeType : 9;
  11518. results = results || [];
  11519. // Return early from calls with invalid selector or context
  11520. if ( typeof selector !== "string" || !selector ||
  11521. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  11522. return results;
  11523. }
  11524. // Try to shortcut find operations (as opposed to filters) in HTML documents
  11525. if ( !seed ) {
  11526. setDocument( context );
  11527. context = context || document;
  11528. if ( documentIsHTML ) {
  11529. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  11530. // (excepting DocumentFragment context, where the methods don't exist)
  11531. if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
  11532. // ID selector
  11533. if ( ( m = match[ 1 ] ) ) {
  11534. // Document context
  11535. if ( nodeType === 9 ) {
  11536. if ( ( elem = context.getElementById( m ) ) ) {
  11537. // Support: IE, Opera, Webkit
  11538. // TODO: identify versions
  11539. // getElementById can match elements by name instead of ID
  11540. if ( elem.id === m ) {
  11541. results.push( elem );
  11542. return results;
  11543. }
  11544. } else {
  11545. return results;
  11546. }
  11547. // Element context
  11548. } else {
  11549. // Support: IE, Opera, Webkit
  11550. // TODO: identify versions
  11551. // getElementById can match elements by name instead of ID
  11552. if ( newContext && ( elem = newContext.getElementById( m ) ) &&
  11553. contains( context, elem ) &&
  11554. elem.id === m ) {
  11555. results.push( elem );
  11556. return results;
  11557. }
  11558. }
  11559. // Type selector
  11560. } else if ( match[ 2 ] ) {
  11561. push.apply( results, context.getElementsByTagName( selector ) );
  11562. return results;
  11563. // Class selector
  11564. } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName &&
  11565. context.getElementsByClassName ) {
  11566. push.apply( results, context.getElementsByClassName( m ) );
  11567. return results;
  11568. }
  11569. }
  11570. // Take advantage of querySelectorAll
  11571. if ( support.qsa &&
  11572. !nonnativeSelectorCache[ selector + " " ] &&
  11573. ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
  11574. // Support: IE 8 only
  11575. // Exclude object elements
  11576. ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {
  11577. newSelector = selector;
  11578. newContext = context;
  11579. // qSA considers elements outside a scoping root when evaluating child or
  11580. // descendant combinators, which is not what we want.
  11581. // In such cases, we work around the behavior by prefixing every selector in the
  11582. // list with an ID selector referencing the scope context.
  11583. // The technique has to be used as well when a leading combinator is used
  11584. // as such selectors are not recognized by querySelectorAll.
  11585. // Thanks to Andrew Dupont for this technique.
  11586. if ( nodeType === 1 &&
  11587. ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
  11588. // Expand context for sibling selectors
  11589. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  11590. context;
  11591. // We can use :scope instead of the ID hack if the browser
  11592. // supports it & if we're not changing the context.
  11593. if ( newContext !== context || !support.scope ) {
  11594. // Capture the context ID, setting it first if necessary
  11595. if ( ( nid = context.getAttribute( "id" ) ) ) {
  11596. nid = nid.replace( rcssescape, fcssescape );
  11597. } else {
  11598. context.setAttribute( "id", ( nid = expando ) );
  11599. }
  11600. }
  11601. // Prefix every selector in the list
  11602. groups = tokenize( selector );
  11603. i = groups.length;
  11604. while ( i-- ) {
  11605. groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
  11606. toSelector( groups[ i ] );
  11607. }
  11608. newSelector = groups.join( "," );
  11609. }
  11610. try {
  11611. push.apply( results,
  11612. newContext.querySelectorAll( newSelector )
  11613. );
  11614. return results;
  11615. } catch ( qsaError ) {
  11616. nonnativeSelectorCache( selector, true );
  11617. } finally {
  11618. if ( nid === expando ) {
  11619. context.removeAttribute( "id" );
  11620. }
  11621. }
  11622. }
  11623. }
  11624. }
  11625. // All others
  11626. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  11627. }
  11628. /**
  11629. * Create key-value caches of limited size
  11630. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  11631. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  11632. * deleting the oldest entry
  11633. */
  11634. function createCache() {
  11635. var keys = [];
  11636. function cache( key, value ) {
  11637. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  11638. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  11639. // Only keep the most recent entries
  11640. delete cache[ keys.shift() ];
  11641. }
  11642. return ( cache[ key + " " ] = value );
  11643. }
  11644. return cache;
  11645. }
  11646. /**
  11647. * Mark a function for special use by Sizzle
  11648. * @param {Function} fn The function to mark
  11649. */
  11650. function markFunction( fn ) {
  11651. fn[ expando ] = true;
  11652. return fn;
  11653. }
  11654. /**
  11655. * Support testing using an element
  11656. * @param {Function} fn Passed the created element and returns a boolean result
  11657. */
  11658. function assert( fn ) {
  11659. var el = document.createElement( "fieldset" );
  11660. try {
  11661. return !!fn( el );
  11662. } catch ( e ) {
  11663. return false;
  11664. } finally {
  11665. // Remove from its parent by default
  11666. if ( el.parentNode ) {
  11667. el.parentNode.removeChild( el );
  11668. }
  11669. // release memory in IE
  11670. el = null;
  11671. }
  11672. }
  11673. /**
  11674. * Adds the same handler for all of the specified attrs
  11675. * @param {String} attrs Pipe-separated list of attributes
  11676. * @param {Function} handler The method that will be applied
  11677. */
  11678. function addHandle( attrs, handler ) {
  11679. var arr = attrs.split( "|" ),
  11680. i = arr.length;
  11681. while ( i-- ) {
  11682. Expr.attrHandle[ arr[ i ] ] = handler;
  11683. }
  11684. }
  11685. /**
  11686. * Checks document order of two siblings
  11687. * @param {Element} a
  11688. * @param {Element} b
  11689. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  11690. */
  11691. function siblingCheck( a, b ) {
  11692. var cur = b && a,
  11693. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  11694. a.sourceIndex - b.sourceIndex;
  11695. // Use IE sourceIndex if available on both nodes
  11696. if ( diff ) {
  11697. return diff;
  11698. }
  11699. // Check if b follows a
  11700. if ( cur ) {
  11701. while ( ( cur = cur.nextSibling ) ) {
  11702. if ( cur === b ) {
  11703. return -1;
  11704. }
  11705. }
  11706. }
  11707. return a ? 1 : -1;
  11708. }
  11709. /**
  11710. * Returns a function to use in pseudos for input types
  11711. * @param {String} type
  11712. */
  11713. function createInputPseudo( type ) {
  11714. return function( elem ) {
  11715. var name = elem.nodeName.toLowerCase();
  11716. return name === "input" && elem.type === type;
  11717. };
  11718. }
  11719. /**
  11720. * Returns a function to use in pseudos for buttons
  11721. * @param {String} type
  11722. */
  11723. function createButtonPseudo( type ) {
  11724. return function( elem ) {
  11725. var name = elem.nodeName.toLowerCase();
  11726. return ( name === "input" || name === "button" ) && elem.type === type;
  11727. };
  11728. }
  11729. /**
  11730. * Returns a function to use in pseudos for :enabled/:disabled
  11731. * @param {Boolean} disabled true for :disabled; false for :enabled
  11732. */
  11733. function createDisabledPseudo( disabled ) {
  11734. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  11735. return function( elem ) {
  11736. // Only certain elements can match :enabled or :disabled
  11737. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  11738. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  11739. if ( "form" in elem ) {
  11740. // Check for inherited disabledness on relevant non-disabled elements:
  11741. // * listed form-associated elements in a disabled fieldset
  11742. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  11743. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  11744. // * option elements in a disabled optgroup
  11745. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  11746. // All such elements have a "form" property.
  11747. if ( elem.parentNode && elem.disabled === false ) {
  11748. // Option elements defer to a parent optgroup if present
  11749. if ( "label" in elem ) {
  11750. if ( "label" in elem.parentNode ) {
  11751. return elem.parentNode.disabled === disabled;
  11752. } else {
  11753. return elem.disabled === disabled;
  11754. }
  11755. }
  11756. // Support: IE 6 - 11
  11757. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  11758. return elem.isDisabled === disabled ||
  11759. // Where there is no isDisabled, check manually
  11760. /* jshint -W018 */
  11761. elem.isDisabled !== !disabled &&
  11762. inDisabledFieldset( elem ) === disabled;
  11763. }
  11764. return elem.disabled === disabled;
  11765. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  11766. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  11767. // even exist on them, let alone have a boolean value.
  11768. } else if ( "label" in elem ) {
  11769. return elem.disabled === disabled;
  11770. }
  11771. // Remaining elements are neither :enabled nor :disabled
  11772. return false;
  11773. };
  11774. }
  11775. /**
  11776. * Returns a function to use in pseudos for positionals
  11777. * @param {Function} fn
  11778. */
  11779. function createPositionalPseudo( fn ) {
  11780. return markFunction( function( argument ) {
  11781. argument = +argument;
  11782. return markFunction( function( seed, matches ) {
  11783. var j,
  11784. matchIndexes = fn( [], seed.length, argument ),
  11785. i = matchIndexes.length;
  11786. // Match elements found at the specified indexes
  11787. while ( i-- ) {
  11788. if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
  11789. seed[ j ] = !( matches[ j ] = seed[ j ] );
  11790. }
  11791. }
  11792. } );
  11793. } );
  11794. }
  11795. /**
  11796. * Checks a node for validity as a Sizzle context
  11797. * @param {Element|Object=} context
  11798. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  11799. */
  11800. function testContext( context ) {
  11801. return context && typeof context.getElementsByTagName !== "undefined" && context;
  11802. }
  11803. // Expose support vars for convenience
  11804. support = Sizzle.support = {};
  11805. /**
  11806. * Detects XML nodes
  11807. * @param {Element|Object} elem An element or a document
  11808. * @returns {Boolean} True iff elem is a non-HTML XML node
  11809. */
  11810. isXML = Sizzle.isXML = function( elem ) {
  11811. var namespace = elem.namespaceURI,
  11812. docElem = ( elem.ownerDocument || elem ).documentElement;
  11813. // Support: IE <=8
  11814. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  11815. // https://bugs.jquery.com/ticket/4833
  11816. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  11817. };
  11818. /**
  11819. * Sets document-related variables once based on the current document
  11820. * @param {Element|Object} [doc] An element or document object to use to set the document
  11821. * @returns {Object} Returns the current document
  11822. */
  11823. setDocument = Sizzle.setDocument = function( node ) {
  11824. var hasCompare, subWindow,
  11825. doc = node ? node.ownerDocument || node : preferredDoc;
  11826. // Return early if doc is invalid or already selected
  11827. // Support: IE 11+, Edge 17 - 18+
  11828. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  11829. // two documents; shallow comparisons work.
  11830. // eslint-disable-next-line eqeqeq
  11831. if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {
  11832. return document;
  11833. }
  11834. // Update global variables
  11835. document = doc;
  11836. docElem = document.documentElement;
  11837. documentIsHTML = !isXML( document );
  11838. // Support: IE 9 - 11+, Edge 12 - 18+
  11839. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  11840. // Support: IE 11+, Edge 17 - 18+
  11841. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  11842. // two documents; shallow comparisons work.
  11843. // eslint-disable-next-line eqeqeq
  11844. if ( preferredDoc != document &&
  11845. ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
  11846. // Support: IE 11, Edge
  11847. if ( subWindow.addEventListener ) {
  11848. subWindow.addEventListener( "unload", unloadHandler, false );
  11849. // Support: IE 9 - 10 only
  11850. } else if ( subWindow.attachEvent ) {
  11851. subWindow.attachEvent( "onunload", unloadHandler );
  11852. }
  11853. }
  11854. // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
  11855. // Safari 4 - 5 only, Opera <=11.6 - 12.x only
  11856. // IE/Edge & older browsers don't support the :scope pseudo-class.
  11857. // Support: Safari 6.0 only
  11858. // Safari 6.0 supports :scope but it's an alias of :root there.
  11859. support.scope = assert( function( el ) {
  11860. docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
  11861. return typeof el.querySelectorAll !== "undefined" &&
  11862. !el.querySelectorAll( ":scope fieldset div" ).length;
  11863. } );
  11864. /* Attributes
  11865. ---------------------------------------------------------------------- */
  11866. // Support: IE<8
  11867. // Verify that getAttribute really returns attributes and not properties
  11868. // (excepting IE8 booleans)
  11869. support.attributes = assert( function( el ) {
  11870. el.className = "i";
  11871. return !el.getAttribute( "className" );
  11872. } );
  11873. /* getElement(s)By*
  11874. ---------------------------------------------------------------------- */
  11875. // Check if getElementsByTagName("*") returns only elements
  11876. support.getElementsByTagName = assert( function( el ) {
  11877. el.appendChild( document.createComment( "" ) );
  11878. return !el.getElementsByTagName( "*" ).length;
  11879. } );
  11880. // Support: IE<9
  11881. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  11882. // Support: IE<10
  11883. // Check if getElementById returns elements by name
  11884. // The broken getElementById methods don't pick up programmatically-set names,
  11885. // so use a roundabout getElementsByName test
  11886. support.getById = assert( function( el ) {
  11887. docElem.appendChild( el ).id = expando;
  11888. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  11889. } );
  11890. // ID filter and find
  11891. if ( support.getById ) {
  11892. Expr.filter[ "ID" ] = function( id ) {
  11893. var attrId = id.replace( runescape, funescape );
  11894. return function( elem ) {
  11895. return elem.getAttribute( "id" ) === attrId;
  11896. };
  11897. };
  11898. Expr.find[ "ID" ] = function( id, context ) {
  11899. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  11900. var elem = context.getElementById( id );
  11901. return elem ? [ elem ] : [];
  11902. }
  11903. };
  11904. } else {
  11905. Expr.filter[ "ID" ] = function( id ) {
  11906. var attrId = id.replace( runescape, funescape );
  11907. return function( elem ) {
  11908. var node = typeof elem.getAttributeNode !== "undefined" &&
  11909. elem.getAttributeNode( "id" );
  11910. return node && node.value === attrId;
  11911. };
  11912. };
  11913. // Support: IE 6 - 7 only
  11914. // getElementById is not reliable as a find shortcut
  11915. Expr.find[ "ID" ] = function( id, context ) {
  11916. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  11917. var node, i, elems,
  11918. elem = context.getElementById( id );
  11919. if ( elem ) {
  11920. // Verify the id attribute
  11921. node = elem.getAttributeNode( "id" );
  11922. if ( node && node.value === id ) {
  11923. return [ elem ];
  11924. }
  11925. // Fall back on getElementsByName
  11926. elems = context.getElementsByName( id );
  11927. i = 0;
  11928. while ( ( elem = elems[ i++ ] ) ) {
  11929. node = elem.getAttributeNode( "id" );
  11930. if ( node && node.value === id ) {
  11931. return [ elem ];
  11932. }
  11933. }
  11934. }
  11935. return [];
  11936. }
  11937. };
  11938. }
  11939. // Tag
  11940. Expr.find[ "TAG" ] = support.getElementsByTagName ?
  11941. function( tag, context ) {
  11942. if ( typeof context.getElementsByTagName !== "undefined" ) {
  11943. return context.getElementsByTagName( tag );
  11944. // DocumentFragment nodes don't have gEBTN
  11945. } else if ( support.qsa ) {
  11946. return context.querySelectorAll( tag );
  11947. }
  11948. } :
  11949. function( tag, context ) {
  11950. var elem,
  11951. tmp = [],
  11952. i = 0,
  11953. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  11954. results = context.getElementsByTagName( tag );
  11955. // Filter out possible comments
  11956. if ( tag === "*" ) {
  11957. while ( ( elem = results[ i++ ] ) ) {
  11958. if ( elem.nodeType === 1 ) {
  11959. tmp.push( elem );
  11960. }
  11961. }
  11962. return tmp;
  11963. }
  11964. return results;
  11965. };
  11966. // Class
  11967. Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) {
  11968. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  11969. return context.getElementsByClassName( className );
  11970. }
  11971. };
  11972. /* QSA/matchesSelector
  11973. ---------------------------------------------------------------------- */
  11974. // QSA and matchesSelector support
  11975. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  11976. rbuggyMatches = [];
  11977. // qSa(:focus) reports false when true (Chrome 21)
  11978. // We allow this because of a bug in IE8/9 that throws an error
  11979. // whenever `document.activeElement` is accessed on an iframe
  11980. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  11981. // See https://bugs.jquery.com/ticket/13378
  11982. rbuggyQSA = [];
  11983. if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {
  11984. // Build QSA regex
  11985. // Regex strategy adopted from Diego Perini
  11986. assert( function( el ) {
  11987. var input;
  11988. // Select is set to empty string on purpose
  11989. // This is to test IE's treatment of not explicitly
  11990. // setting a boolean content attribute,
  11991. // since its presence should be enough
  11992. // https://bugs.jquery.com/ticket/12359
  11993. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  11994. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  11995. "<option selected=''></option></select>";
  11996. // Support: IE8, Opera 11-12.16
  11997. // Nothing should be selected when empty strings follow ^= or $= or *=
  11998. // The test attribute must be unknown in Opera but "safe" for WinRT
  11999. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  12000. if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) {
  12001. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  12002. }
  12003. // Support: IE8
  12004. // Boolean attributes and "value" are not treated correctly
  12005. if ( !el.querySelectorAll( "[selected]" ).length ) {
  12006. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  12007. }
  12008. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  12009. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  12010. rbuggyQSA.push( "~=" );
  12011. }
  12012. // Support: IE 11+, Edge 15 - 18+
  12013. // IE 11/Edge don't find elements on a `[name='']` query in some cases.
  12014. // Adding a temporary attribute to the document before the selection works
  12015. // around the issue.
  12016. // Interestingly, IE 10 & older don't seem to have the issue.
  12017. input = document.createElement( "input" );
  12018. input.setAttribute( "name", "" );
  12019. el.appendChild( input );
  12020. if ( !el.querySelectorAll( "[name='']" ).length ) {
  12021. rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
  12022. whitespace + "*(?:''|\"\")" );
  12023. }
  12024. // Webkit/Opera - :checked should return selected option elements
  12025. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  12026. // IE8 throws error here and will not see later tests
  12027. if ( !el.querySelectorAll( ":checked" ).length ) {
  12028. rbuggyQSA.push( ":checked" );
  12029. }
  12030. // Support: Safari 8+, iOS 8+
  12031. // https://bugs.webkit.org/show_bug.cgi?id=136851
  12032. // In-page `selector#id sibling-combinator selector` fails
  12033. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  12034. rbuggyQSA.push( ".#.+[+~]" );
  12035. }
  12036. // Support: Firefox <=3.6 - 5 only
  12037. // Old Firefox doesn't throw on a badly-escaped identifier.
  12038. el.querySelectorAll( "\\\f" );
  12039. rbuggyQSA.push( "[\\r\\n\\f]" );
  12040. } );
  12041. assert( function( el ) {
  12042. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  12043. "<select disabled='disabled'><option/></select>";
  12044. // Support: Windows 8 Native Apps
  12045. // The type and name attributes are restricted during .innerHTML assignment
  12046. var input = document.createElement( "input" );
  12047. input.setAttribute( "type", "hidden" );
  12048. el.appendChild( input ).setAttribute( "name", "D" );
  12049. // Support: IE8
  12050. // Enforce case-sensitivity of name attribute
  12051. if ( el.querySelectorAll( "[name=d]" ).length ) {
  12052. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  12053. }
  12054. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  12055. // IE8 throws error here and will not see later tests
  12056. if ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
  12057. rbuggyQSA.push( ":enabled", ":disabled" );
  12058. }
  12059. // Support: IE9-11+
  12060. // IE's :disabled selector does not pick up the children of disabled fieldsets
  12061. docElem.appendChild( el ).disabled = true;
  12062. if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
  12063. rbuggyQSA.push( ":enabled", ":disabled" );
  12064. }
  12065. // Support: Opera 10 - 11 only
  12066. // Opera 10-11 does not throw on post-comma invalid pseudos
  12067. el.querySelectorAll( "*,:x" );
  12068. rbuggyQSA.push( ",.*:" );
  12069. } );
  12070. }
  12071. if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
  12072. docElem.webkitMatchesSelector ||
  12073. docElem.mozMatchesSelector ||
  12074. docElem.oMatchesSelector ||
  12075. docElem.msMatchesSelector ) ) ) ) {
  12076. assert( function( el ) {
  12077. // Check to see if it's possible to do matchesSelector
  12078. // on a disconnected node (IE 9)
  12079. support.disconnectedMatch = matches.call( el, "*" );
  12080. // This should fail with an exception
  12081. // Gecko does not error, returns false instead
  12082. matches.call( el, "[s!='']:x" );
  12083. rbuggyMatches.push( "!=", pseudos );
  12084. } );
  12085. }
  12086. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
  12087. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) );
  12088. /* Contains
  12089. ---------------------------------------------------------------------- */
  12090. hasCompare = rnative.test( docElem.compareDocumentPosition );
  12091. // Element contains another
  12092. // Purposefully self-exclusive
  12093. // As in, an element does not contain itself
  12094. contains = hasCompare || rnative.test( docElem.contains ) ?
  12095. function( a, b ) {
  12096. var adown = a.nodeType === 9 ? a.documentElement : a,
  12097. bup = b && b.parentNode;
  12098. return a === bup || !!( bup && bup.nodeType === 1 && (
  12099. adown.contains ?
  12100. adown.contains( bup ) :
  12101. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  12102. ) );
  12103. } :
  12104. function( a, b ) {
  12105. if ( b ) {
  12106. while ( ( b = b.parentNode ) ) {
  12107. if ( b === a ) {
  12108. return true;
  12109. }
  12110. }
  12111. }
  12112. return false;
  12113. };
  12114. /* Sorting
  12115. ---------------------------------------------------------------------- */
  12116. // Document order sorting
  12117. sortOrder = hasCompare ?
  12118. function( a, b ) {
  12119. // Flag for duplicate removal
  12120. if ( a === b ) {
  12121. hasDuplicate = true;
  12122. return 0;
  12123. }
  12124. // Sort on method existence if only one input has compareDocumentPosition
  12125. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  12126. if ( compare ) {
  12127. return compare;
  12128. }
  12129. // Calculate position if both inputs belong to the same document
  12130. // Support: IE 11+, Edge 17 - 18+
  12131. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  12132. // two documents; shallow comparisons work.
  12133. // eslint-disable-next-line eqeqeq
  12134. compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
  12135. a.compareDocumentPosition( b ) :
  12136. // Otherwise we know they are disconnected
  12137. 1;
  12138. // Disconnected nodes
  12139. if ( compare & 1 ||
  12140. ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {
  12141. // Choose the first element that is related to our preferred document
  12142. // Support: IE 11+, Edge 17 - 18+
  12143. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  12144. // two documents; shallow comparisons work.
  12145. // eslint-disable-next-line eqeqeq
  12146. if ( a == document || a.ownerDocument == preferredDoc &&
  12147. contains( preferredDoc, a ) ) {
  12148. return -1;
  12149. }
  12150. // Support: IE 11+, Edge 17 - 18+
  12151. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  12152. // two documents; shallow comparisons work.
  12153. // eslint-disable-next-line eqeqeq
  12154. if ( b == document || b.ownerDocument == preferredDoc &&
  12155. contains( preferredDoc, b ) ) {
  12156. return 1;
  12157. }
  12158. // Maintain original order
  12159. return sortInput ?
  12160. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  12161. 0;
  12162. }
  12163. return compare & 4 ? -1 : 1;
  12164. } :
  12165. function( a, b ) {
  12166. // Exit early if the nodes are identical
  12167. if ( a === b ) {
  12168. hasDuplicate = true;
  12169. return 0;
  12170. }
  12171. var cur,
  12172. i = 0,
  12173. aup = a.parentNode,
  12174. bup = b.parentNode,
  12175. ap = [ a ],
  12176. bp = [ b ];
  12177. // Parentless nodes are either documents or disconnected
  12178. if ( !aup || !bup ) {
  12179. // Support: IE 11+, Edge 17 - 18+
  12180. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  12181. // two documents; shallow comparisons work.
  12182. /* eslint-disable eqeqeq */
  12183. return a == document ? -1 :
  12184. b == document ? 1 :
  12185. /* eslint-enable eqeqeq */
  12186. aup ? -1 :
  12187. bup ? 1 :
  12188. sortInput ?
  12189. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  12190. 0;
  12191. // If the nodes are siblings, we can do a quick check
  12192. } else if ( aup === bup ) {
  12193. return siblingCheck( a, b );
  12194. }
  12195. // Otherwise we need full lists of their ancestors for comparison
  12196. cur = a;
  12197. while ( ( cur = cur.parentNode ) ) {
  12198. ap.unshift( cur );
  12199. }
  12200. cur = b;
  12201. while ( ( cur = cur.parentNode ) ) {
  12202. bp.unshift( cur );
  12203. }
  12204. // Walk down the tree looking for a discrepancy
  12205. while ( ap[ i ] === bp[ i ] ) {
  12206. i++;
  12207. }
  12208. return i ?
  12209. // Do a sibling check if the nodes have a common ancestor
  12210. siblingCheck( ap[ i ], bp[ i ] ) :
  12211. // Otherwise nodes in our document sort first
  12212. // Support: IE 11+, Edge 17 - 18+
  12213. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  12214. // two documents; shallow comparisons work.
  12215. /* eslint-disable eqeqeq */
  12216. ap[ i ] == preferredDoc ? -1 :
  12217. bp[ i ] == preferredDoc ? 1 :
  12218. /* eslint-enable eqeqeq */
  12219. 0;
  12220. };
  12221. return document;
  12222. };
  12223. Sizzle.matches = function( expr, elements ) {
  12224. return Sizzle( expr, null, null, elements );
  12225. };
  12226. Sizzle.matchesSelector = function( elem, expr ) {
  12227. setDocument( elem );
  12228. if ( support.matchesSelector && documentIsHTML &&
  12229. !nonnativeSelectorCache[ expr + " " ] &&
  12230. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  12231. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  12232. try {
  12233. var ret = matches.call( elem, expr );
  12234. // IE 9's matchesSelector returns false on disconnected nodes
  12235. if ( ret || support.disconnectedMatch ||
  12236. // As well, disconnected nodes are said to be in a document
  12237. // fragment in IE 9
  12238. elem.document && elem.document.nodeType !== 11 ) {
  12239. return ret;
  12240. }
  12241. } catch ( e ) {
  12242. nonnativeSelectorCache( expr, true );
  12243. }
  12244. }
  12245. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  12246. };
  12247. Sizzle.contains = function( context, elem ) {
  12248. // Set document vars if needed
  12249. // Support: IE 11+, Edge 17 - 18+
  12250. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  12251. // two documents; shallow comparisons work.
  12252. // eslint-disable-next-line eqeqeq
  12253. if ( ( context.ownerDocument || context ) != document ) {
  12254. setDocument( context );
  12255. }
  12256. return contains( context, elem );
  12257. };
  12258. Sizzle.attr = function( elem, name ) {
  12259. // Set document vars if needed
  12260. // Support: IE 11+, Edge 17 - 18+
  12261. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  12262. // two documents; shallow comparisons work.
  12263. // eslint-disable-next-line eqeqeq
  12264. if ( ( elem.ownerDocument || elem ) != document ) {
  12265. setDocument( elem );
  12266. }
  12267. var fn = Expr.attrHandle[ name.toLowerCase() ],
  12268. // Don't get fooled by Object.prototype properties (jQuery #13807)
  12269. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  12270. fn( elem, name, !documentIsHTML ) :
  12271. undefined;
  12272. return val !== undefined ?
  12273. val :
  12274. support.attributes || !documentIsHTML ?
  12275. elem.getAttribute( name ) :
  12276. ( val = elem.getAttributeNode( name ) ) && val.specified ?
  12277. val.value :
  12278. null;
  12279. };
  12280. Sizzle.escape = function( sel ) {
  12281. return ( sel + "" ).replace( rcssescape, fcssescape );
  12282. };
  12283. Sizzle.error = function( msg ) {
  12284. throw new Error( "Syntax error, unrecognized expression: " + msg );
  12285. };
  12286. /**
  12287. * Document sorting and removing duplicates
  12288. * @param {ArrayLike} results
  12289. */
  12290. Sizzle.uniqueSort = function( results ) {
  12291. var elem,
  12292. duplicates = [],
  12293. j = 0,
  12294. i = 0;
  12295. // Unless we *know* we can detect duplicates, assume their presence
  12296. hasDuplicate = !support.detectDuplicates;
  12297. sortInput = !support.sortStable && results.slice( 0 );
  12298. results.sort( sortOrder );
  12299. if ( hasDuplicate ) {
  12300. while ( ( elem = results[ i++ ] ) ) {
  12301. if ( elem === results[ i ] ) {
  12302. j = duplicates.push( i );
  12303. }
  12304. }
  12305. while ( j-- ) {
  12306. results.splice( duplicates[ j ], 1 );
  12307. }
  12308. }
  12309. // Clear input after sorting to release objects
  12310. // See https://github.com/jquery/sizzle/pull/225
  12311. sortInput = null;
  12312. return results;
  12313. };
  12314. /**
  12315. * Utility function for retrieving the text value of an array of DOM nodes
  12316. * @param {Array|Element} elem
  12317. */
  12318. getText = Sizzle.getText = function( elem ) {
  12319. var node,
  12320. ret = "",
  12321. i = 0,
  12322. nodeType = elem.nodeType;
  12323. if ( !nodeType ) {
  12324. // If no nodeType, this is expected to be an array
  12325. while ( ( node = elem[ i++ ] ) ) {
  12326. // Do not traverse comment nodes
  12327. ret += getText( node );
  12328. }
  12329. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  12330. // Use textContent for elements
  12331. // innerText usage removed for consistency of new lines (jQuery #11153)
  12332. if ( typeof elem.textContent === "string" ) {
  12333. return elem.textContent;
  12334. } else {
  12335. // Traverse its children
  12336. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  12337. ret += getText( elem );
  12338. }
  12339. }
  12340. } else if ( nodeType === 3 || nodeType === 4 ) {
  12341. return elem.nodeValue;
  12342. }
  12343. // Do not include comment or processing instruction nodes
  12344. return ret;
  12345. };
  12346. Expr = Sizzle.selectors = {
  12347. // Can be adjusted by the user
  12348. cacheLength: 50,
  12349. createPseudo: markFunction,
  12350. match: matchExpr,
  12351. attrHandle: {},
  12352. find: {},
  12353. relative: {
  12354. ">": { dir: "parentNode", first: true },
  12355. " ": { dir: "parentNode" },
  12356. "+": { dir: "previousSibling", first: true },
  12357. "~": { dir: "previousSibling" }
  12358. },
  12359. preFilter: {
  12360. "ATTR": function( match ) {
  12361. match[ 1 ] = match[ 1 ].replace( runescape, funescape );
  12362. // Move the given value to match[3] whether quoted or unquoted
  12363. match[ 3 ] = ( match[ 3 ] || match[ 4 ] ||
  12364. match[ 5 ] || "" ).replace( runescape, funescape );
  12365. if ( match[ 2 ] === "~=" ) {
  12366. match[ 3 ] = " " + match[ 3 ] + " ";
  12367. }
  12368. return match.slice( 0, 4 );
  12369. },
  12370. "CHILD": function( match ) {
  12371. /* matches from matchExpr["CHILD"]
  12372. 1 type (only|nth|...)
  12373. 2 what (child|of-type)
  12374. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  12375. 4 xn-component of xn+y argument ([+-]?\d*n|)
  12376. 5 sign of xn-component
  12377. 6 x of xn-component
  12378. 7 sign of y-component
  12379. 8 y of y-component
  12380. */
  12381. match[ 1 ] = match[ 1 ].toLowerCase();
  12382. if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
  12383. // nth-* requires argument
  12384. if ( !match[ 3 ] ) {
  12385. Sizzle.error( match[ 0 ] );
  12386. }
  12387. // numeric x and y parameters for Expr.filter.CHILD
  12388. // remember that false/true cast respectively to 0/1
  12389. match[ 4 ] = +( match[ 4 ] ?
  12390. match[ 5 ] + ( match[ 6 ] || 1 ) :
  12391. 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) );
  12392. match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
  12393. // other types prohibit arguments
  12394. } else if ( match[ 3 ] ) {
  12395. Sizzle.error( match[ 0 ] );
  12396. }
  12397. return match;
  12398. },
  12399. "PSEUDO": function( match ) {
  12400. var excess,
  12401. unquoted = !match[ 6 ] && match[ 2 ];
  12402. if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
  12403. return null;
  12404. }
  12405. // Accept quoted arguments as-is
  12406. if ( match[ 3 ] ) {
  12407. match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
  12408. // Strip excess characters from unquoted arguments
  12409. } else if ( unquoted && rpseudo.test( unquoted ) &&
  12410. // Get excess from tokenize (recursively)
  12411. ( excess = tokenize( unquoted, true ) ) &&
  12412. // advance to the next closing parenthesis
  12413. ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
  12414. // excess is a negative index
  12415. match[ 0 ] = match[ 0 ].slice( 0, excess );
  12416. match[ 2 ] = unquoted.slice( 0, excess );
  12417. }
  12418. // Return only captures needed by the pseudo filter method (type and argument)
  12419. return match.slice( 0, 3 );
  12420. }
  12421. },
  12422. filter: {
  12423. "TAG": function( nodeNameSelector ) {
  12424. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  12425. return nodeNameSelector === "*" ?
  12426. function() {
  12427. return true;
  12428. } :
  12429. function( elem ) {
  12430. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  12431. };
  12432. },
  12433. "CLASS": function( className ) {
  12434. var pattern = classCache[ className + " " ];
  12435. return pattern ||
  12436. ( pattern = new RegExp( "(^|" + whitespace +
  12437. ")" + className + "(" + whitespace + "|$)" ) ) && classCache(
  12438. className, function( elem ) {
  12439. return pattern.test(
  12440. typeof elem.className === "string" && elem.className ||
  12441. typeof elem.getAttribute !== "undefined" &&
  12442. elem.getAttribute( "class" ) ||
  12443. ""
  12444. );
  12445. } );
  12446. },
  12447. "ATTR": function( name, operator, check ) {
  12448. return function( elem ) {
  12449. var result = Sizzle.attr( elem, name );
  12450. if ( result == null ) {
  12451. return operator === "!=";
  12452. }
  12453. if ( !operator ) {
  12454. return true;
  12455. }
  12456. result += "";
  12457. /* eslint-disable max-len */
  12458. return operator === "=" ? result === check :
  12459. operator === "!=" ? result !== check :
  12460. operator === "^=" ? check && result.indexOf( check ) === 0 :
  12461. operator === "*=" ? check && result.indexOf( check ) > -1 :
  12462. operator === "$=" ? check && result.slice( -check.length ) === check :
  12463. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  12464. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  12465. false;
  12466. /* eslint-enable max-len */
  12467. };
  12468. },
  12469. "CHILD": function( type, what, _argument, first, last ) {
  12470. var simple = type.slice( 0, 3 ) !== "nth",
  12471. forward = type.slice( -4 ) !== "last",
  12472. ofType = what === "of-type";
  12473. return first === 1 && last === 0 ?
  12474. // Shortcut for :nth-*(n)
  12475. function( elem ) {
  12476. return !!elem.parentNode;
  12477. } :
  12478. function( elem, _context, xml ) {
  12479. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  12480. dir = simple !== forward ? "nextSibling" : "previousSibling",
  12481. parent = elem.parentNode,
  12482. name = ofType && elem.nodeName.toLowerCase(),
  12483. useCache = !xml && !ofType,
  12484. diff = false;
  12485. if ( parent ) {
  12486. // :(first|last|only)-(child|of-type)
  12487. if ( simple ) {
  12488. while ( dir ) {
  12489. node = elem;
  12490. while ( ( node = node[ dir ] ) ) {
  12491. if ( ofType ?
  12492. node.nodeName.toLowerCase() === name :
  12493. node.nodeType === 1 ) {
  12494. return false;
  12495. }
  12496. }
  12497. // Reverse direction for :only-* (if we haven't yet done so)
  12498. start = dir = type === "only" && !start && "nextSibling";
  12499. }
  12500. return true;
  12501. }
  12502. start = [ forward ? parent.firstChild : parent.lastChild ];
  12503. // non-xml :nth-child(...) stores cache data on `parent`
  12504. if ( forward && useCache ) {
  12505. // Seek `elem` from a previously-cached index
  12506. // ...in a gzip-friendly way
  12507. node = parent;
  12508. outerCache = node[ expando ] || ( node[ expando ] = {} );
  12509. // Support: IE <9 only
  12510. // Defend against cloned attroperties (jQuery gh-1709)
  12511. uniqueCache = outerCache[ node.uniqueID ] ||
  12512. ( outerCache[ node.uniqueID ] = {} );
  12513. cache = uniqueCache[ type ] || [];
  12514. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  12515. diff = nodeIndex && cache[ 2 ];
  12516. node = nodeIndex && parent.childNodes[ nodeIndex ];
  12517. while ( ( node = ++nodeIndex && node && node[ dir ] ||
  12518. // Fallback to seeking `elem` from the start
  12519. ( diff = nodeIndex = 0 ) || start.pop() ) ) {
  12520. // When found, cache indexes on `parent` and break
  12521. if ( node.nodeType === 1 && ++diff && node === elem ) {
  12522. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  12523. break;
  12524. }
  12525. }
  12526. } else {
  12527. // Use previously-cached element index if available
  12528. if ( useCache ) {
  12529. // ...in a gzip-friendly way
  12530. node = elem;
  12531. outerCache = node[ expando ] || ( node[ expando ] = {} );
  12532. // Support: IE <9 only
  12533. // Defend against cloned attroperties (jQuery gh-1709)
  12534. uniqueCache = outerCache[ node.uniqueID ] ||
  12535. ( outerCache[ node.uniqueID ] = {} );
  12536. cache = uniqueCache[ type ] || [];
  12537. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  12538. diff = nodeIndex;
  12539. }
  12540. // xml :nth-child(...)
  12541. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  12542. if ( diff === false ) {
  12543. // Use the same loop as above to seek `elem` from the start
  12544. while ( ( node = ++nodeIndex && node && node[ dir ] ||
  12545. ( diff = nodeIndex = 0 ) || start.pop() ) ) {
  12546. if ( ( ofType ?
  12547. node.nodeName.toLowerCase() === name :
  12548. node.nodeType === 1 ) &&
  12549. ++diff ) {
  12550. // Cache the index of each encountered element
  12551. if ( useCache ) {
  12552. outerCache = node[ expando ] ||
  12553. ( node[ expando ] = {} );
  12554. // Support: IE <9 only
  12555. // Defend against cloned attroperties (jQuery gh-1709)
  12556. uniqueCache = outerCache[ node.uniqueID ] ||
  12557. ( outerCache[ node.uniqueID ] = {} );
  12558. uniqueCache[ type ] = [ dirruns, diff ];
  12559. }
  12560. if ( node === elem ) {
  12561. break;
  12562. }
  12563. }
  12564. }
  12565. }
  12566. }
  12567. // Incorporate the offset, then check against cycle size
  12568. diff -= last;
  12569. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  12570. }
  12571. };
  12572. },
  12573. "PSEUDO": function( pseudo, argument ) {
  12574. // pseudo-class names are case-insensitive
  12575. // http://www.w3.org/TR/selectors/#pseudo-classes
  12576. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  12577. // Remember that setFilters inherits from pseudos
  12578. var args,
  12579. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  12580. Sizzle.error( "unsupported pseudo: " + pseudo );
  12581. // The user may use createPseudo to indicate that
  12582. // arguments are needed to create the filter function
  12583. // just as Sizzle does
  12584. if ( fn[ expando ] ) {
  12585. return fn( argument );
  12586. }
  12587. // But maintain support for old signatures
  12588. if ( fn.length > 1 ) {
  12589. args = [ pseudo, pseudo, "", argument ];
  12590. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  12591. markFunction( function( seed, matches ) {
  12592. var idx,
  12593. matched = fn( seed, argument ),
  12594. i = matched.length;
  12595. while ( i-- ) {
  12596. idx = indexOf( seed, matched[ i ] );
  12597. seed[ idx ] = !( matches[ idx ] = matched[ i ] );
  12598. }
  12599. } ) :
  12600. function( elem ) {
  12601. return fn( elem, 0, args );
  12602. };
  12603. }
  12604. return fn;
  12605. }
  12606. },
  12607. pseudos: {
  12608. // Potentially complex pseudos
  12609. "not": markFunction( function( selector ) {
  12610. // Trim the selector passed to compile
  12611. // to avoid treating leading and trailing
  12612. // spaces as combinators
  12613. var input = [],
  12614. results = [],
  12615. matcher = compile( selector.replace( rtrim, "$1" ) );
  12616. return matcher[ expando ] ?
  12617. markFunction( function( seed, matches, _context, xml ) {
  12618. var elem,
  12619. unmatched = matcher( seed, null, xml, [] ),
  12620. i = seed.length;
  12621. // Match elements unmatched by `matcher`
  12622. while ( i-- ) {
  12623. if ( ( elem = unmatched[ i ] ) ) {
  12624. seed[ i ] = !( matches[ i ] = elem );
  12625. }
  12626. }
  12627. } ) :
  12628. function( elem, _context, xml ) {
  12629. input[ 0 ] = elem;
  12630. matcher( input, null, xml, results );
  12631. // Don't keep the element (issue #299)
  12632. input[ 0 ] = null;
  12633. return !results.pop();
  12634. };
  12635. } ),
  12636. "has": markFunction( function( selector ) {
  12637. return function( elem ) {
  12638. return Sizzle( selector, elem ).length > 0;
  12639. };
  12640. } ),
  12641. "contains": markFunction( function( text ) {
  12642. text = text.replace( runescape, funescape );
  12643. return function( elem ) {
  12644. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  12645. };
  12646. } ),
  12647. // "Whether an element is represented by a :lang() selector
  12648. // is based solely on the element's language value
  12649. // being equal to the identifier C,
  12650. // or beginning with the identifier C immediately followed by "-".
  12651. // The matching of C against the element's language value is performed case-insensitively.
  12652. // The identifier C does not have to be a valid language name."
  12653. // http://www.w3.org/TR/selectors/#lang-pseudo
  12654. "lang": markFunction( function( lang ) {
  12655. // lang value must be a valid identifier
  12656. if ( !ridentifier.test( lang || "" ) ) {
  12657. Sizzle.error( "unsupported lang: " + lang );
  12658. }
  12659. lang = lang.replace( runescape, funescape ).toLowerCase();
  12660. return function( elem ) {
  12661. var elemLang;
  12662. do {
  12663. if ( ( elemLang = documentIsHTML ?
  12664. elem.lang :
  12665. elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
  12666. elemLang = elemLang.toLowerCase();
  12667. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  12668. }
  12669. } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
  12670. return false;
  12671. };
  12672. } ),
  12673. // Miscellaneous
  12674. "target": function( elem ) {
  12675. var hash = window.location && window.location.hash;
  12676. return hash && hash.slice( 1 ) === elem.id;
  12677. },
  12678. "root": function( elem ) {
  12679. return elem === docElem;
  12680. },
  12681. "focus": function( elem ) {
  12682. return elem === document.activeElement &&
  12683. ( !document.hasFocus || document.hasFocus() ) &&
  12684. !!( elem.type || elem.href || ~elem.tabIndex );
  12685. },
  12686. // Boolean properties
  12687. "enabled": createDisabledPseudo( false ),
  12688. "disabled": createDisabledPseudo( true ),
  12689. "checked": function( elem ) {
  12690. // In CSS3, :checked should return both checked and selected elements
  12691. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  12692. var nodeName = elem.nodeName.toLowerCase();
  12693. return ( nodeName === "input" && !!elem.checked ) ||
  12694. ( nodeName === "option" && !!elem.selected );
  12695. },
  12696. "selected": function( elem ) {
  12697. // Accessing this property makes selected-by-default
  12698. // options in Safari work properly
  12699. if ( elem.parentNode ) {
  12700. // eslint-disable-next-line no-unused-expressions
  12701. elem.parentNode.selectedIndex;
  12702. }
  12703. return elem.selected === true;
  12704. },
  12705. // Contents
  12706. "empty": function( elem ) {
  12707. // http://www.w3.org/TR/selectors/#empty-pseudo
  12708. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  12709. // but not by others (comment: 8; processing instruction: 7; etc.)
  12710. // nodeType < 6 works because attributes (2) do not appear as children
  12711. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  12712. if ( elem.nodeType < 6 ) {
  12713. return false;
  12714. }
  12715. }
  12716. return true;
  12717. },
  12718. "parent": function( elem ) {
  12719. return !Expr.pseudos[ "empty" ]( elem );
  12720. },
  12721. // Element/input types
  12722. "header": function( elem ) {
  12723. return rheader.test( elem.nodeName );
  12724. },
  12725. "input": function( elem ) {
  12726. return rinputs.test( elem.nodeName );
  12727. },
  12728. "button": function( elem ) {
  12729. var name = elem.nodeName.toLowerCase();
  12730. return name === "input" && elem.type === "button" || name === "button";
  12731. },
  12732. "text": function( elem ) {
  12733. var attr;
  12734. return elem.nodeName.toLowerCase() === "input" &&
  12735. elem.type === "text" &&
  12736. // Support: IE<8
  12737. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  12738. ( ( attr = elem.getAttribute( "type" ) ) == null ||
  12739. attr.toLowerCase() === "text" );
  12740. },
  12741. // Position-in-collection
  12742. "first": createPositionalPseudo( function() {
  12743. return [ 0 ];
  12744. } ),
  12745. "last": createPositionalPseudo( function( _matchIndexes, length ) {
  12746. return [ length - 1 ];
  12747. } ),
  12748. "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) {
  12749. return [ argument < 0 ? argument + length : argument ];
  12750. } ),
  12751. "even": createPositionalPseudo( function( matchIndexes, length ) {
  12752. var i = 0;
  12753. for ( ; i < length; i += 2 ) {
  12754. matchIndexes.push( i );
  12755. }
  12756. return matchIndexes;
  12757. } ),
  12758. "odd": createPositionalPseudo( function( matchIndexes, length ) {
  12759. var i = 1;
  12760. for ( ; i < length; i += 2 ) {
  12761. matchIndexes.push( i );
  12762. }
  12763. return matchIndexes;
  12764. } ),
  12765. "lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
  12766. var i = argument < 0 ?
  12767. argument + length :
  12768. argument > length ?
  12769. length :
  12770. argument;
  12771. for ( ; --i >= 0; ) {
  12772. matchIndexes.push( i );
  12773. }
  12774. return matchIndexes;
  12775. } ),
  12776. "gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
  12777. var i = argument < 0 ? argument + length : argument;
  12778. for ( ; ++i < length; ) {
  12779. matchIndexes.push( i );
  12780. }
  12781. return matchIndexes;
  12782. } )
  12783. }
  12784. };
  12785. Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];
  12786. // Add button/input type pseudos
  12787. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  12788. Expr.pseudos[ i ] = createInputPseudo( i );
  12789. }
  12790. for ( i in { submit: true, reset: true } ) {
  12791. Expr.pseudos[ i ] = createButtonPseudo( i );
  12792. }
  12793. // Easy API for creating new setFilters
  12794. function setFilters() {}
  12795. setFilters.prototype = Expr.filters = Expr.pseudos;
  12796. Expr.setFilters = new setFilters();
  12797. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  12798. var matched, match, tokens, type,
  12799. soFar, groups, preFilters,
  12800. cached = tokenCache[ selector + " " ];
  12801. if ( cached ) {
  12802. return parseOnly ? 0 : cached.slice( 0 );
  12803. }
  12804. soFar = selector;
  12805. groups = [];
  12806. preFilters = Expr.preFilter;
  12807. while ( soFar ) {
  12808. // Comma and first run
  12809. if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
  12810. if ( match ) {
  12811. // Don't consume trailing commas as valid
  12812. soFar = soFar.slice( match[ 0 ].length ) || soFar;
  12813. }
  12814. groups.push( ( tokens = [] ) );
  12815. }
  12816. matched = false;
  12817. // Combinators
  12818. if ( ( match = rcombinators.exec( soFar ) ) ) {
  12819. matched = match.shift();
  12820. tokens.push( {
  12821. value: matched,
  12822. // Cast descendant combinators to space
  12823. type: match[ 0 ].replace( rtrim, " " )
  12824. } );
  12825. soFar = soFar.slice( matched.length );
  12826. }
  12827. // Filters
  12828. for ( type in Expr.filter ) {
  12829. if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
  12830. ( match = preFilters[ type ]( match ) ) ) ) {
  12831. matched = match.shift();
  12832. tokens.push( {
  12833. value: matched,
  12834. type: type,
  12835. matches: match
  12836. } );
  12837. soFar = soFar.slice( matched.length );
  12838. }
  12839. }
  12840. if ( !matched ) {
  12841. break;
  12842. }
  12843. }
  12844. // Return the length of the invalid excess
  12845. // if we're just parsing
  12846. // Otherwise, throw an error or return tokens
  12847. return parseOnly ?
  12848. soFar.length :
  12849. soFar ?
  12850. Sizzle.error( selector ) :
  12851. // Cache the tokens
  12852. tokenCache( selector, groups ).slice( 0 );
  12853. };
  12854. function toSelector( tokens ) {
  12855. var i = 0,
  12856. len = tokens.length,
  12857. selector = "";
  12858. for ( ; i < len; i++ ) {
  12859. selector += tokens[ i ].value;
  12860. }
  12861. return selector;
  12862. }
  12863. function addCombinator( matcher, combinator, base ) {
  12864. var dir = combinator.dir,
  12865. skip = combinator.next,
  12866. key = skip || dir,
  12867. checkNonElements = base && key === "parentNode",
  12868. doneName = done++;
  12869. return combinator.first ?
  12870. // Check against closest ancestor/preceding element
  12871. function( elem, context, xml ) {
  12872. while ( ( elem = elem[ dir ] ) ) {
  12873. if ( elem.nodeType === 1 || checkNonElements ) {
  12874. return matcher( elem, context, xml );
  12875. }
  12876. }
  12877. return false;
  12878. } :
  12879. // Check against all ancestor/preceding elements
  12880. function( elem, context, xml ) {
  12881. var oldCache, uniqueCache, outerCache,
  12882. newCache = [ dirruns, doneName ];
  12883. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  12884. if ( xml ) {
  12885. while ( ( elem = elem[ dir ] ) ) {
  12886. if ( elem.nodeType === 1 || checkNonElements ) {
  12887. if ( matcher( elem, context, xml ) ) {
  12888. return true;
  12889. }
  12890. }
  12891. }
  12892. } else {
  12893. while ( ( elem = elem[ dir ] ) ) {
  12894. if ( elem.nodeType === 1 || checkNonElements ) {
  12895. outerCache = elem[ expando ] || ( elem[ expando ] = {} );
  12896. // Support: IE <9 only
  12897. // Defend against cloned attroperties (jQuery gh-1709)
  12898. uniqueCache = outerCache[ elem.uniqueID ] ||
  12899. ( outerCache[ elem.uniqueID ] = {} );
  12900. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  12901. elem = elem[ dir ] || elem;
  12902. } else if ( ( oldCache = uniqueCache[ key ] ) &&
  12903. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  12904. // Assign to newCache so results back-propagate to previous elements
  12905. return ( newCache[ 2 ] = oldCache[ 2 ] );
  12906. } else {
  12907. // Reuse newcache so results back-propagate to previous elements
  12908. uniqueCache[ key ] = newCache;
  12909. // A match means we're done; a fail means we have to keep checking
  12910. if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
  12911. return true;
  12912. }
  12913. }
  12914. }
  12915. }
  12916. }
  12917. return false;
  12918. };
  12919. }
  12920. function elementMatcher( matchers ) {
  12921. return matchers.length > 1 ?
  12922. function( elem, context, xml ) {
  12923. var i = matchers.length;
  12924. while ( i-- ) {
  12925. if ( !matchers[ i ]( elem, context, xml ) ) {
  12926. return false;
  12927. }
  12928. }
  12929. return true;
  12930. } :
  12931. matchers[ 0 ];
  12932. }
  12933. function multipleContexts( selector, contexts, results ) {
  12934. var i = 0,
  12935. len = contexts.length;
  12936. for ( ; i < len; i++ ) {
  12937. Sizzle( selector, contexts[ i ], results );
  12938. }
  12939. return results;
  12940. }
  12941. function condense( unmatched, map, filter, context, xml ) {
  12942. var elem,
  12943. newUnmatched = [],
  12944. i = 0,
  12945. len = unmatched.length,
  12946. mapped = map != null;
  12947. for ( ; i < len; i++ ) {
  12948. if ( ( elem = unmatched[ i ] ) ) {
  12949. if ( !filter || filter( elem, context, xml ) ) {
  12950. newUnmatched.push( elem );
  12951. if ( mapped ) {
  12952. map.push( i );
  12953. }
  12954. }
  12955. }
  12956. }
  12957. return newUnmatched;
  12958. }
  12959. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  12960. if ( postFilter && !postFilter[ expando ] ) {
  12961. postFilter = setMatcher( postFilter );
  12962. }
  12963. if ( postFinder && !postFinder[ expando ] ) {
  12964. postFinder = setMatcher( postFinder, postSelector );
  12965. }
  12966. return markFunction( function( seed, results, context, xml ) {
  12967. var temp, i, elem,
  12968. preMap = [],
  12969. postMap = [],
  12970. preexisting = results.length,
  12971. // Get initial elements from seed or context
  12972. elems = seed || multipleContexts(
  12973. selector || "*",
  12974. context.nodeType ? [ context ] : context,
  12975. []
  12976. ),
  12977. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  12978. matcherIn = preFilter && ( seed || !selector ) ?
  12979. condense( elems, preMap, preFilter, context, xml ) :
  12980. elems,
  12981. matcherOut = matcher ?
  12982. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  12983. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  12984. // ...intermediate processing is necessary
  12985. [] :
  12986. // ...otherwise use results directly
  12987. results :
  12988. matcherIn;
  12989. // Find primary matches
  12990. if ( matcher ) {
  12991. matcher( matcherIn, matcherOut, context, xml );
  12992. }
  12993. // Apply postFilter
  12994. if ( postFilter ) {
  12995. temp = condense( matcherOut, postMap );
  12996. postFilter( temp, [], context, xml );
  12997. // Un-match failing elements by moving them back to matcherIn
  12998. i = temp.length;
  12999. while ( i-- ) {
  13000. if ( ( elem = temp[ i ] ) ) {
  13001. matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
  13002. }
  13003. }
  13004. }
  13005. if ( seed ) {
  13006. if ( postFinder || preFilter ) {
  13007. if ( postFinder ) {
  13008. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  13009. temp = [];
  13010. i = matcherOut.length;
  13011. while ( i-- ) {
  13012. if ( ( elem = matcherOut[ i ] ) ) {
  13013. // Restore matcherIn since elem is not yet a final match
  13014. temp.push( ( matcherIn[ i ] = elem ) );
  13015. }
  13016. }
  13017. postFinder( null, ( matcherOut = [] ), temp, xml );
  13018. }
  13019. // Move matched elements from seed to results to keep them synchronized
  13020. i = matcherOut.length;
  13021. while ( i-- ) {
  13022. if ( ( elem = matcherOut[ i ] ) &&
  13023. ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) {
  13024. seed[ temp ] = !( results[ temp ] = elem );
  13025. }
  13026. }
  13027. }
  13028. // Add elements to results, through postFinder if defined
  13029. } else {
  13030. matcherOut = condense(
  13031. matcherOut === results ?
  13032. matcherOut.splice( preexisting, matcherOut.length ) :
  13033. matcherOut
  13034. );
  13035. if ( postFinder ) {
  13036. postFinder( null, results, matcherOut, xml );
  13037. } else {
  13038. push.apply( results, matcherOut );
  13039. }
  13040. }
  13041. } );
  13042. }
  13043. function matcherFromTokens( tokens ) {
  13044. var checkContext, matcher, j,
  13045. len = tokens.length,
  13046. leadingRelative = Expr.relative[ tokens[ 0 ].type ],
  13047. implicitRelative = leadingRelative || Expr.relative[ " " ],
  13048. i = leadingRelative ? 1 : 0,
  13049. // The foundational matcher ensures that elements are reachable from top-level context(s)
  13050. matchContext = addCombinator( function( elem ) {
  13051. return elem === checkContext;
  13052. }, implicitRelative, true ),
  13053. matchAnyContext = addCombinator( function( elem ) {
  13054. return indexOf( checkContext, elem ) > -1;
  13055. }, implicitRelative, true ),
  13056. matchers = [ function( elem, context, xml ) {
  13057. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  13058. ( checkContext = context ).nodeType ?
  13059. matchContext( elem, context, xml ) :
  13060. matchAnyContext( elem, context, xml ) );
  13061. // Avoid hanging onto element (issue #299)
  13062. checkContext = null;
  13063. return ret;
  13064. } ];
  13065. for ( ; i < len; i++ ) {
  13066. if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
  13067. matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
  13068. } else {
  13069. matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
  13070. // Return special upon seeing a positional matcher
  13071. if ( matcher[ expando ] ) {
  13072. // Find the next relative operator (if any) for proper handling
  13073. j = ++i;
  13074. for ( ; j < len; j++ ) {
  13075. if ( Expr.relative[ tokens[ j ].type ] ) {
  13076. break;
  13077. }
  13078. }
  13079. return setMatcher(
  13080. i > 1 && elementMatcher( matchers ),
  13081. i > 1 && toSelector(
  13082. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  13083. tokens
  13084. .slice( 0, i - 1 )
  13085. .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
  13086. ).replace( rtrim, "$1" ),
  13087. matcher,
  13088. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  13089. j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
  13090. j < len && toSelector( tokens )
  13091. );
  13092. }
  13093. matchers.push( matcher );
  13094. }
  13095. }
  13096. return elementMatcher( matchers );
  13097. }
  13098. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  13099. var bySet = setMatchers.length > 0,
  13100. byElement = elementMatchers.length > 0,
  13101. superMatcher = function( seed, context, xml, results, outermost ) {
  13102. var elem, j, matcher,
  13103. matchedCount = 0,
  13104. i = "0",
  13105. unmatched = seed && [],
  13106. setMatched = [],
  13107. contextBackup = outermostContext,
  13108. // We must always have either seed elements or outermost context
  13109. elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ),
  13110. // Use integer dirruns iff this is the outermost matcher
  13111. dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
  13112. len = elems.length;
  13113. if ( outermost ) {
  13114. // Support: IE 11+, Edge 17 - 18+
  13115. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  13116. // two documents; shallow comparisons work.
  13117. // eslint-disable-next-line eqeqeq
  13118. outermostContext = context == document || context || outermost;
  13119. }
  13120. // Add elements passing elementMatchers directly to results
  13121. // Support: IE<9, Safari
  13122. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  13123. for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
  13124. if ( byElement && elem ) {
  13125. j = 0;
  13126. // Support: IE 11+, Edge 17 - 18+
  13127. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  13128. // two documents; shallow comparisons work.
  13129. // eslint-disable-next-line eqeqeq
  13130. if ( !context && elem.ownerDocument != document ) {
  13131. setDocument( elem );
  13132. xml = !documentIsHTML;
  13133. }
  13134. while ( ( matcher = elementMatchers[ j++ ] ) ) {
  13135. if ( matcher( elem, context || document, xml ) ) {
  13136. results.push( elem );
  13137. break;
  13138. }
  13139. }
  13140. if ( outermost ) {
  13141. dirruns = dirrunsUnique;
  13142. }
  13143. }
  13144. // Track unmatched elements for set filters
  13145. if ( bySet ) {
  13146. // They will have gone through all possible matchers
  13147. if ( ( elem = !matcher && elem ) ) {
  13148. matchedCount--;
  13149. }
  13150. // Lengthen the array for every element, matched or not
  13151. if ( seed ) {
  13152. unmatched.push( elem );
  13153. }
  13154. }
  13155. }
  13156. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  13157. // makes the latter nonnegative.
  13158. matchedCount += i;
  13159. // Apply set filters to unmatched elements
  13160. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  13161. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  13162. // no element matchers and no seed.
  13163. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  13164. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  13165. // numerically zero.
  13166. if ( bySet && i !== matchedCount ) {
  13167. j = 0;
  13168. while ( ( matcher = setMatchers[ j++ ] ) ) {
  13169. matcher( unmatched, setMatched, context, xml );
  13170. }
  13171. if ( seed ) {
  13172. // Reintegrate element matches to eliminate the need for sorting
  13173. if ( matchedCount > 0 ) {
  13174. while ( i-- ) {
  13175. if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
  13176. setMatched[ i ] = pop.call( results );
  13177. }
  13178. }
  13179. }
  13180. // Discard index placeholder values to get only actual matches
  13181. setMatched = condense( setMatched );
  13182. }
  13183. // Add matches to results
  13184. push.apply( results, setMatched );
  13185. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  13186. if ( outermost && !seed && setMatched.length > 0 &&
  13187. ( matchedCount + setMatchers.length ) > 1 ) {
  13188. Sizzle.uniqueSort( results );
  13189. }
  13190. }
  13191. // Override manipulation of globals by nested matchers
  13192. if ( outermost ) {
  13193. dirruns = dirrunsUnique;
  13194. outermostContext = contextBackup;
  13195. }
  13196. return unmatched;
  13197. };
  13198. return bySet ?
  13199. markFunction( superMatcher ) :
  13200. superMatcher;
  13201. }
  13202. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  13203. var i,
  13204. setMatchers = [],
  13205. elementMatchers = [],
  13206. cached = compilerCache[ selector + " " ];
  13207. if ( !cached ) {
  13208. // Generate a function of recursive functions that can be used to check each element
  13209. if ( !match ) {
  13210. match = tokenize( selector );
  13211. }
  13212. i = match.length;
  13213. while ( i-- ) {
  13214. cached = matcherFromTokens( match[ i ] );
  13215. if ( cached[ expando ] ) {
  13216. setMatchers.push( cached );
  13217. } else {
  13218. elementMatchers.push( cached );
  13219. }
  13220. }
  13221. // Cache the compiled function
  13222. cached = compilerCache(
  13223. selector,
  13224. matcherFromGroupMatchers( elementMatchers, setMatchers )
  13225. );
  13226. // Save selector and tokenization
  13227. cached.selector = selector;
  13228. }
  13229. return cached;
  13230. };
  13231. /**
  13232. * A low-level selection function that works with Sizzle's compiled
  13233. * selector functions
  13234. * @param {String|Function} selector A selector or a pre-compiled
  13235. * selector function built with Sizzle.compile
  13236. * @param {Element} context
  13237. * @param {Array} [results]
  13238. * @param {Array} [seed] A set of elements to match against
  13239. */
  13240. select = Sizzle.select = function( selector, context, results, seed ) {
  13241. var i, tokens, token, type, find,
  13242. compiled = typeof selector === "function" && selector,
  13243. match = !seed && tokenize( ( selector = compiled.selector || selector ) );
  13244. results = results || [];
  13245. // Try to minimize operations if there is only one selector in the list and no seed
  13246. // (the latter of which guarantees us context)
  13247. if ( match.length === 1 ) {
  13248. // Reduce context if the leading compound selector is an ID
  13249. tokens = match[ 0 ] = match[ 0 ].slice( 0 );
  13250. if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
  13251. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
  13252. context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
  13253. .replace( runescape, funescape ), context ) || [] )[ 0 ];
  13254. if ( !context ) {
  13255. return results;
  13256. // Precompiled matchers will still verify ancestry, so step up a level
  13257. } else if ( compiled ) {
  13258. context = context.parentNode;
  13259. }
  13260. selector = selector.slice( tokens.shift().value.length );
  13261. }
  13262. // Fetch a seed set for right-to-left matching
  13263. i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
  13264. while ( i-- ) {
  13265. token = tokens[ i ];
  13266. // Abort if we hit a combinator
  13267. if ( Expr.relative[ ( type = token.type ) ] ) {
  13268. break;
  13269. }
  13270. if ( ( find = Expr.find[ type ] ) ) {
  13271. // Search, expanding context for leading sibling combinators
  13272. if ( ( seed = find(
  13273. token.matches[ 0 ].replace( runescape, funescape ),
  13274. rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) ||
  13275. context
  13276. ) ) ) {
  13277. // If seed is empty or no tokens remain, we can return early
  13278. tokens.splice( i, 1 );
  13279. selector = seed.length && toSelector( tokens );
  13280. if ( !selector ) {
  13281. push.apply( results, seed );
  13282. return results;
  13283. }
  13284. break;
  13285. }
  13286. }
  13287. }
  13288. }
  13289. // Compile and execute a filtering function if one is not provided
  13290. // Provide `match` to avoid retokenization if we modified the selector above
  13291. ( compiled || compile( selector, match ) )(
  13292. seed,
  13293. context,
  13294. !documentIsHTML,
  13295. results,
  13296. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  13297. );
  13298. return results;
  13299. };
  13300. // One-time assignments
  13301. // Sort stability
  13302. support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
  13303. // Support: Chrome 14-35+
  13304. // Always assume duplicates if they aren't passed to the comparison function
  13305. support.detectDuplicates = !!hasDuplicate;
  13306. // Initialize against the default document
  13307. setDocument();
  13308. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  13309. // Detached nodes confoundingly follow *each other*
  13310. support.sortDetached = assert( function( el ) {
  13311. // Should return 1, but returns 4 (following)
  13312. return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
  13313. } );
  13314. // Support: IE<8
  13315. // Prevent attribute/property "interpolation"
  13316. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  13317. if ( !assert( function( el ) {
  13318. el.innerHTML = "<a href='#'></a>";
  13319. return el.firstChild.getAttribute( "href" ) === "#";
  13320. } ) ) {
  13321. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  13322. if ( !isXML ) {
  13323. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  13324. }
  13325. } );
  13326. }
  13327. // Support: IE<9
  13328. // Use defaultValue in place of getAttribute("value")
  13329. if ( !support.attributes || !assert( function( el ) {
  13330. el.innerHTML = "<input/>";
  13331. el.firstChild.setAttribute( "value", "" );
  13332. return el.firstChild.getAttribute( "value" ) === "";
  13333. } ) ) {
  13334. addHandle( "value", function( elem, _name, isXML ) {
  13335. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  13336. return elem.defaultValue;
  13337. }
  13338. } );
  13339. }
  13340. // Support: IE<9
  13341. // Use getAttributeNode to fetch booleans when getAttribute lies
  13342. if ( !assert( function( el ) {
  13343. return el.getAttribute( "disabled" ) == null;
  13344. } ) ) {
  13345. addHandle( booleans, function( elem, name, isXML ) {
  13346. var val;
  13347. if ( !isXML ) {
  13348. return elem[ name ] === true ? name.toLowerCase() :
  13349. ( val = elem.getAttributeNode( name ) ) && val.specified ?
  13350. val.value :
  13351. null;
  13352. }
  13353. } );
  13354. }
  13355. return Sizzle;
  13356. } )( window );
  13357. jQuery.find = Sizzle;
  13358. jQuery.expr = Sizzle.selectors;
  13359. // Deprecated
  13360. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  13361. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  13362. jQuery.text = Sizzle.getText;
  13363. jQuery.isXMLDoc = Sizzle.isXML;
  13364. jQuery.contains = Sizzle.contains;
  13365. jQuery.escapeSelector = Sizzle.escape;
  13366. var dir = function( elem, dir, until ) {
  13367. var matched = [],
  13368. truncate = until !== undefined;
  13369. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  13370. if ( elem.nodeType === 1 ) {
  13371. if ( truncate && jQuery( elem ).is( until ) ) {
  13372. break;
  13373. }
  13374. matched.push( elem );
  13375. }
  13376. }
  13377. return matched;
  13378. };
  13379. var siblings = function( n, elem ) {
  13380. var matched = [];
  13381. for ( ; n; n = n.nextSibling ) {
  13382. if ( n.nodeType === 1 && n !== elem ) {
  13383. matched.push( n );
  13384. }
  13385. }
  13386. return matched;
  13387. };
  13388. var rneedsContext = jQuery.expr.match.needsContext;
  13389. function nodeName( elem, name ) {
  13390. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  13391. };
  13392. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  13393. // Implement the identical functionality for filter and not
  13394. function winnow( elements, qualifier, not ) {
  13395. if ( isFunction( qualifier ) ) {
  13396. return jQuery.grep( elements, function( elem, i ) {
  13397. return !!qualifier.call( elem, i, elem ) !== not;
  13398. } );
  13399. }
  13400. // Single element
  13401. if ( qualifier.nodeType ) {
  13402. return jQuery.grep( elements, function( elem ) {
  13403. return ( elem === qualifier ) !== not;
  13404. } );
  13405. }
  13406. // Arraylike of elements (jQuery, arguments, Array)
  13407. if ( typeof qualifier !== "string" ) {
  13408. return jQuery.grep( elements, function( elem ) {
  13409. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  13410. } );
  13411. }
  13412. // Filtered directly for both simple and complex selectors
  13413. return jQuery.filter( qualifier, elements, not );
  13414. }
  13415. jQuery.filter = function( expr, elems, not ) {
  13416. var elem = elems[ 0 ];
  13417. if ( not ) {
  13418. expr = ":not(" + expr + ")";
  13419. }
  13420. if ( elems.length === 1 && elem.nodeType === 1 ) {
  13421. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  13422. }
  13423. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  13424. return elem.nodeType === 1;
  13425. } ) );
  13426. };
  13427. jQuery.fn.extend( {
  13428. find: function( selector ) {
  13429. var i, ret,
  13430. len = this.length,
  13431. self = this;
  13432. if ( typeof selector !== "string" ) {
  13433. return this.pushStack( jQuery( selector ).filter( function() {
  13434. for ( i = 0; i < len; i++ ) {
  13435. if ( jQuery.contains( self[ i ], this ) ) {
  13436. return true;
  13437. }
  13438. }
  13439. } ) );
  13440. }
  13441. ret = this.pushStack( [] );
  13442. for ( i = 0; i < len; i++ ) {
  13443. jQuery.find( selector, self[ i ], ret );
  13444. }
  13445. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  13446. },
  13447. filter: function( selector ) {
  13448. return this.pushStack( winnow( this, selector || [], false ) );
  13449. },
  13450. not: function( selector ) {
  13451. return this.pushStack( winnow( this, selector || [], true ) );
  13452. },
  13453. is: function( selector ) {
  13454. return !!winnow(
  13455. this,
  13456. // If this is a positional/relative selector, check membership in the returned set
  13457. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  13458. typeof selector === "string" && rneedsContext.test( selector ) ?
  13459. jQuery( selector ) :
  13460. selector || [],
  13461. false
  13462. ).length;
  13463. }
  13464. } );
  13465. // Initialize a jQuery object
  13466. // A central reference to the root jQuery(document)
  13467. var rootjQuery,
  13468. // A simple way to check for HTML strings
  13469. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  13470. // Strict HTML recognition (#11290: must start with <)
  13471. // Shortcut simple #id case for speed
  13472. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  13473. init = jQuery.fn.init = function( selector, context, root ) {
  13474. var match, elem;
  13475. // HANDLE: $(""), $(null), $(undefined), $(false)
  13476. if ( !selector ) {
  13477. return this;
  13478. }
  13479. // Method init() accepts an alternate rootjQuery
  13480. // so migrate can support jQuery.sub (gh-2101)
  13481. root = root || rootjQuery;
  13482. // Handle HTML strings
  13483. if ( typeof selector === "string" ) {
  13484. if ( selector[ 0 ] === "<" &&
  13485. selector[ selector.length - 1 ] === ">" &&
  13486. selector.length >= 3 ) {
  13487. // Assume that strings that start and end with <> are HTML and skip the regex check
  13488. match = [ null, selector, null ];
  13489. } else {
  13490. match = rquickExpr.exec( selector );
  13491. }
  13492. // Match html or make sure no context is specified for #id
  13493. if ( match && ( match[ 1 ] || !context ) ) {
  13494. // HANDLE: $(html) -> $(array)
  13495. if ( match[ 1 ] ) {
  13496. context = context instanceof jQuery ? context[ 0 ] : context;
  13497. // Option to run scripts is true for back-compat
  13498. // Intentionally let the error be thrown if parseHTML is not present
  13499. jQuery.merge( this, jQuery.parseHTML(
  13500. match[ 1 ],
  13501. context && context.nodeType ? context.ownerDocument || context : document,
  13502. true
  13503. ) );
  13504. // HANDLE: $(html, props)
  13505. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  13506. for ( match in context ) {
  13507. // Properties of context are called as methods if possible
  13508. if ( isFunction( this[ match ] ) ) {
  13509. this[ match ]( context[ match ] );
  13510. // ...and otherwise set as attributes
  13511. } else {
  13512. this.attr( match, context[ match ] );
  13513. }
  13514. }
  13515. }
  13516. return this;
  13517. // HANDLE: $(#id)
  13518. } else {
  13519. elem = document.getElementById( match[ 2 ] );
  13520. if ( elem ) {
  13521. // Inject the element directly into the jQuery object
  13522. this[ 0 ] = elem;
  13523. this.length = 1;
  13524. }
  13525. return this;
  13526. }
  13527. // HANDLE: $(expr, $(...))
  13528. } else if ( !context || context.jquery ) {
  13529. return ( context || root ).find( selector );
  13530. // HANDLE: $(expr, context)
  13531. // (which is just equivalent to: $(context).find(expr)
  13532. } else {
  13533. return this.constructor( context ).find( selector );
  13534. }
  13535. // HANDLE: $(DOMElement)
  13536. } else if ( selector.nodeType ) {
  13537. this[ 0 ] = selector;
  13538. this.length = 1;
  13539. return this;
  13540. // HANDLE: $(function)
  13541. // Shortcut for document ready
  13542. } else if ( isFunction( selector ) ) {
  13543. return root.ready !== undefined ?
  13544. root.ready( selector ) :
  13545. // Execute immediately if ready is not present
  13546. selector( jQuery );
  13547. }
  13548. return jQuery.makeArray( selector, this );
  13549. };
  13550. // Give the init function the jQuery prototype for later instantiation
  13551. init.prototype = jQuery.fn;
  13552. // Initialize central reference
  13553. rootjQuery = jQuery( document );
  13554. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  13555. // Methods guaranteed to produce a unique set when starting from a unique set
  13556. guaranteedUnique = {
  13557. children: true,
  13558. contents: true,
  13559. next: true,
  13560. prev: true
  13561. };
  13562. jQuery.fn.extend( {
  13563. has: function( target ) {
  13564. var targets = jQuery( target, this ),
  13565. l = targets.length;
  13566. return this.filter( function() {
  13567. var i = 0;
  13568. for ( ; i < l; i++ ) {
  13569. if ( jQuery.contains( this, targets[ i ] ) ) {
  13570. return true;
  13571. }
  13572. }
  13573. } );
  13574. },
  13575. closest: function( selectors, context ) {
  13576. var cur,
  13577. i = 0,
  13578. l = this.length,
  13579. matched = [],
  13580. targets = typeof selectors !== "string" && jQuery( selectors );
  13581. // Positional selectors never match, since there's no _selection_ context
  13582. if ( !rneedsContext.test( selectors ) ) {
  13583. for ( ; i < l; i++ ) {
  13584. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  13585. // Always skip document fragments
  13586. if ( cur.nodeType < 11 && ( targets ?
  13587. targets.index( cur ) > -1 :
  13588. // Don't pass non-elements to Sizzle
  13589. cur.nodeType === 1 &&
  13590. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  13591. matched.push( cur );
  13592. break;
  13593. }
  13594. }
  13595. }
  13596. }
  13597. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  13598. },
  13599. // Determine the position of an element within the set
  13600. index: function( elem ) {
  13601. // No argument, return index in parent
  13602. if ( !elem ) {
  13603. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  13604. }
  13605. // Index in selector
  13606. if ( typeof elem === "string" ) {
  13607. return indexOf.call( jQuery( elem ), this[ 0 ] );
  13608. }
  13609. // Locate the position of the desired element
  13610. return indexOf.call( this,
  13611. // If it receives a jQuery object, the first element is used
  13612. elem.jquery ? elem[ 0 ] : elem
  13613. );
  13614. },
  13615. add: function( selector, context ) {
  13616. return this.pushStack(
  13617. jQuery.uniqueSort(
  13618. jQuery.merge( this.get(), jQuery( selector, context ) )
  13619. )
  13620. );
  13621. },
  13622. addBack: function( selector ) {
  13623. return this.add( selector == null ?
  13624. this.prevObject : this.prevObject.filter( selector )
  13625. );
  13626. }
  13627. } );
  13628. function sibling( cur, dir ) {
  13629. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  13630. return cur;
  13631. }
  13632. jQuery.each( {
  13633. parent: function( elem ) {
  13634. var parent = elem.parentNode;
  13635. return parent && parent.nodeType !== 11 ? parent : null;
  13636. },
  13637. parents: function( elem ) {
  13638. return dir( elem, "parentNode" );
  13639. },
  13640. parentsUntil: function( elem, _i, until ) {
  13641. return dir( elem, "parentNode", until );
  13642. },
  13643. next: function( elem ) {
  13644. return sibling( elem, "nextSibling" );
  13645. },
  13646. prev: function( elem ) {
  13647. return sibling( elem, "previousSibling" );
  13648. },
  13649. nextAll: function( elem ) {
  13650. return dir( elem, "nextSibling" );
  13651. },
  13652. prevAll: function( elem ) {
  13653. return dir( elem, "previousSibling" );
  13654. },
  13655. nextUntil: function( elem, _i, until ) {
  13656. return dir( elem, "nextSibling", until );
  13657. },
  13658. prevUntil: function( elem, _i, until ) {
  13659. return dir( elem, "previousSibling", until );
  13660. },
  13661. siblings: function( elem ) {
  13662. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  13663. },
  13664. children: function( elem ) {
  13665. return siblings( elem.firstChild );
  13666. },
  13667. contents: function( elem ) {
  13668. if ( elem.contentDocument != null &&
  13669. // Support: IE 11+
  13670. // <object> elements with no `data` attribute has an object
  13671. // `contentDocument` with a `null` prototype.
  13672. getProto( elem.contentDocument ) ) {
  13673. return elem.contentDocument;
  13674. }
  13675. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  13676. // Treat the template element as a regular one in browsers that
  13677. // don't support it.
  13678. if ( nodeName( elem, "template" ) ) {
  13679. elem = elem.content || elem;
  13680. }
  13681. return jQuery.merge( [], elem.childNodes );
  13682. }
  13683. }, function( name, fn ) {
  13684. jQuery.fn[ name ] = function( until, selector ) {
  13685. var matched = jQuery.map( this, fn, until );
  13686. if ( name.slice( -5 ) !== "Until" ) {
  13687. selector = until;
  13688. }
  13689. if ( selector && typeof selector === "string" ) {
  13690. matched = jQuery.filter( selector, matched );
  13691. }
  13692. if ( this.length > 1 ) {
  13693. // Remove duplicates
  13694. if ( !guaranteedUnique[ name ] ) {
  13695. jQuery.uniqueSort( matched );
  13696. }
  13697. // Reverse order for parents* and prev-derivatives
  13698. if ( rparentsprev.test( name ) ) {
  13699. matched.reverse();
  13700. }
  13701. }
  13702. return this.pushStack( matched );
  13703. };
  13704. } );
  13705. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  13706. // Convert String-formatted options into Object-formatted ones
  13707. function createOptions( options ) {
  13708. var object = {};
  13709. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  13710. object[ flag ] = true;
  13711. } );
  13712. return object;
  13713. }
  13714. /*
  13715. * Create a callback list using the following parameters:
  13716. *
  13717. * options: an optional list of space-separated options that will change how
  13718. * the callback list behaves or a more traditional option object
  13719. *
  13720. * By default a callback list will act like an event callback list and can be
  13721. * "fired" multiple times.
  13722. *
  13723. * Possible options:
  13724. *
  13725. * once: will ensure the callback list can only be fired once (like a Deferred)
  13726. *
  13727. * memory: will keep track of previous values and will call any callback added
  13728. * after the list has been fired right away with the latest "memorized"
  13729. * values (like a Deferred)
  13730. *
  13731. * unique: will ensure a callback can only be added once (no duplicate in the list)
  13732. *
  13733. * stopOnFalse: interrupt callings when a callback returns false
  13734. *
  13735. */
  13736. jQuery.Callbacks = function( options ) {
  13737. // Convert options from String-formatted to Object-formatted if needed
  13738. // (we check in cache first)
  13739. options = typeof options === "string" ?
  13740. createOptions( options ) :
  13741. jQuery.extend( {}, options );
  13742. var // Flag to know if list is currently firing
  13743. firing,
  13744. // Last fire value for non-forgettable lists
  13745. memory,
  13746. // Flag to know if list was already fired
  13747. fired,
  13748. // Flag to prevent firing
  13749. locked,
  13750. // Actual callback list
  13751. list = [],
  13752. // Queue of execution data for repeatable lists
  13753. queue = [],
  13754. // Index of currently firing callback (modified by add/remove as needed)
  13755. firingIndex = -1,
  13756. // Fire callbacks
  13757. fire = function() {
  13758. // Enforce single-firing
  13759. locked = locked || options.once;
  13760. // Execute callbacks for all pending executions,
  13761. // respecting firingIndex overrides and runtime changes
  13762. fired = firing = true;
  13763. for ( ; queue.length; firingIndex = -1 ) {
  13764. memory = queue.shift();
  13765. while ( ++firingIndex < list.length ) {
  13766. // Run callback and check for early termination
  13767. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  13768. options.stopOnFalse ) {
  13769. // Jump to end and forget the data so .add doesn't re-fire
  13770. firingIndex = list.length;
  13771. memory = false;
  13772. }
  13773. }
  13774. }
  13775. // Forget the data if we're done with it
  13776. if ( !options.memory ) {
  13777. memory = false;
  13778. }
  13779. firing = false;
  13780. // Clean up if we're done firing for good
  13781. if ( locked ) {
  13782. // Keep an empty list if we have data for future add calls
  13783. if ( memory ) {
  13784. list = [];
  13785. // Otherwise, this object is spent
  13786. } else {
  13787. list = "";
  13788. }
  13789. }
  13790. },
  13791. // Actual Callbacks object
  13792. self = {
  13793. // Add a callback or a collection of callbacks to the list
  13794. add: function() {
  13795. if ( list ) {
  13796. // If we have memory from a past run, we should fire after adding
  13797. if ( memory && !firing ) {
  13798. firingIndex = list.length - 1;
  13799. queue.push( memory );
  13800. }
  13801. ( function add( args ) {
  13802. jQuery.each( args, function( _, arg ) {
  13803. if ( isFunction( arg ) ) {
  13804. if ( !options.unique || !self.has( arg ) ) {
  13805. list.push( arg );
  13806. }
  13807. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  13808. // Inspect recursively
  13809. add( arg );
  13810. }
  13811. } );
  13812. } )( arguments );
  13813. if ( memory && !firing ) {
  13814. fire();
  13815. }
  13816. }
  13817. return this;
  13818. },
  13819. // Remove a callback from the list
  13820. remove: function() {
  13821. jQuery.each( arguments, function( _, arg ) {
  13822. var index;
  13823. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  13824. list.splice( index, 1 );
  13825. // Handle firing indexes
  13826. if ( index <= firingIndex ) {
  13827. firingIndex--;
  13828. }
  13829. }
  13830. } );
  13831. return this;
  13832. },
  13833. // Check if a given callback is in the list.
  13834. // If no argument is given, return whether or not list has callbacks attached.
  13835. has: function( fn ) {
  13836. return fn ?
  13837. jQuery.inArray( fn, list ) > -1 :
  13838. list.length > 0;
  13839. },
  13840. // Remove all callbacks from the list
  13841. empty: function() {
  13842. if ( list ) {
  13843. list = [];
  13844. }
  13845. return this;
  13846. },
  13847. // Disable .fire and .add
  13848. // Abort any current/pending executions
  13849. // Clear all callbacks and values
  13850. disable: function() {
  13851. locked = queue = [];
  13852. list = memory = "";
  13853. return this;
  13854. },
  13855. disabled: function() {
  13856. return !list;
  13857. },
  13858. // Disable .fire
  13859. // Also disable .add unless we have memory (since it would have no effect)
  13860. // Abort any pending executions
  13861. lock: function() {
  13862. locked = queue = [];
  13863. if ( !memory && !firing ) {
  13864. list = memory = "";
  13865. }
  13866. return this;
  13867. },
  13868. locked: function() {
  13869. return !!locked;
  13870. },
  13871. // Call all callbacks with the given context and arguments
  13872. fireWith: function( context, args ) {
  13873. if ( !locked ) {
  13874. args = args || [];
  13875. args = [ context, args.slice ? args.slice() : args ];
  13876. queue.push( args );
  13877. if ( !firing ) {
  13878. fire();
  13879. }
  13880. }
  13881. return this;
  13882. },
  13883. // Call all the callbacks with the given arguments
  13884. fire: function() {
  13885. self.fireWith( this, arguments );
  13886. return this;
  13887. },
  13888. // To know if the callbacks have already been called at least once
  13889. fired: function() {
  13890. return !!fired;
  13891. }
  13892. };
  13893. return self;
  13894. };
  13895. function Identity( v ) {
  13896. return v;
  13897. }
  13898. function Thrower( ex ) {
  13899. throw ex;
  13900. }
  13901. function adoptValue( value, resolve, reject, noValue ) {
  13902. var method;
  13903. try {
  13904. // Check for promise aspect first to privilege synchronous behavior
  13905. if ( value && isFunction( ( method = value.promise ) ) ) {
  13906. method.call( value ).done( resolve ).fail( reject );
  13907. // Other thenables
  13908. } else if ( value && isFunction( ( method = value.then ) ) ) {
  13909. method.call( value, resolve, reject );
  13910. // Other non-thenables
  13911. } else {
  13912. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  13913. // * false: [ value ].slice( 0 ) => resolve( value )
  13914. // * true: [ value ].slice( 1 ) => resolve()
  13915. resolve.apply( undefined, [ value ].slice( noValue ) );
  13916. }
  13917. // For Promises/A+, convert exceptions into rejections
  13918. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  13919. // Deferred#then to conditionally suppress rejection.
  13920. } catch ( value ) {
  13921. // Support: Android 4.0 only
  13922. // Strict mode functions invoked without .call/.apply get global-object context
  13923. reject.apply( undefined, [ value ] );
  13924. }
  13925. }
  13926. jQuery.extend( {
  13927. Deferred: function( func ) {
  13928. var tuples = [
  13929. // action, add listener, callbacks,
  13930. // ... .then handlers, argument index, [final state]
  13931. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  13932. jQuery.Callbacks( "memory" ), 2 ],
  13933. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  13934. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  13935. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  13936. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  13937. ],
  13938. state = "pending",
  13939. promise = {
  13940. state: function() {
  13941. return state;
  13942. },
  13943. always: function() {
  13944. deferred.done( arguments ).fail( arguments );
  13945. return this;
  13946. },
  13947. "catch": function( fn ) {
  13948. return promise.then( null, fn );
  13949. },
  13950. // Keep pipe for back-compat
  13951. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  13952. var fns = arguments;
  13953. return jQuery.Deferred( function( newDefer ) {
  13954. jQuery.each( tuples, function( _i, tuple ) {
  13955. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  13956. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  13957. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  13958. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  13959. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  13960. deferred[ tuple[ 1 ] ]( function() {
  13961. var returned = fn && fn.apply( this, arguments );
  13962. if ( returned && isFunction( returned.promise ) ) {
  13963. returned.promise()
  13964. .progress( newDefer.notify )
  13965. .done( newDefer.resolve )
  13966. .fail( newDefer.reject );
  13967. } else {
  13968. newDefer[ tuple[ 0 ] + "With" ](
  13969. this,
  13970. fn ? [ returned ] : arguments
  13971. );
  13972. }
  13973. } );
  13974. } );
  13975. fns = null;
  13976. } ).promise();
  13977. },
  13978. then: function( onFulfilled, onRejected, onProgress ) {
  13979. var maxDepth = 0;
  13980. function resolve( depth, deferred, handler, special ) {
  13981. return function() {
  13982. var that = this,
  13983. args = arguments,
  13984. mightThrow = function() {
  13985. var returned, then;
  13986. // Support: Promises/A+ section 2.3.3.3.3
  13987. // https://promisesaplus.com/#point-59
  13988. // Ignore double-resolution attempts
  13989. if ( depth < maxDepth ) {
  13990. return;
  13991. }
  13992. returned = handler.apply( that, args );
  13993. // Support: Promises/A+ section 2.3.1
  13994. // https://promisesaplus.com/#point-48
  13995. if ( returned === deferred.promise() ) {
  13996. throw new TypeError( "Thenable self-resolution" );
  13997. }
  13998. // Support: Promises/A+ sections 2.3.3.1, 3.5
  13999. // https://promisesaplus.com/#point-54
  14000. // https://promisesaplus.com/#point-75
  14001. // Retrieve `then` only once
  14002. then = returned &&
  14003. // Support: Promises/A+ section 2.3.4
  14004. // https://promisesaplus.com/#point-64
  14005. // Only check objects and functions for thenability
  14006. ( typeof returned === "object" ||
  14007. typeof returned === "function" ) &&
  14008. returned.then;
  14009. // Handle a returned thenable
  14010. if ( isFunction( then ) ) {
  14011. // Special processors (notify) just wait for resolution
  14012. if ( special ) {
  14013. then.call(
  14014. returned,
  14015. resolve( maxDepth, deferred, Identity, special ),
  14016. resolve( maxDepth, deferred, Thrower, special )
  14017. );
  14018. // Normal processors (resolve) also hook into progress
  14019. } else {
  14020. // ...and disregard older resolution values
  14021. maxDepth++;
  14022. then.call(
  14023. returned,
  14024. resolve( maxDepth, deferred, Identity, special ),
  14025. resolve( maxDepth, deferred, Thrower, special ),
  14026. resolve( maxDepth, deferred, Identity,
  14027. deferred.notifyWith )
  14028. );
  14029. }
  14030. // Handle all other returned values
  14031. } else {
  14032. // Only substitute handlers pass on context
  14033. // and multiple values (non-spec behavior)
  14034. if ( handler !== Identity ) {
  14035. that = undefined;
  14036. args = [ returned ];
  14037. }
  14038. // Process the value(s)
  14039. // Default process is resolve
  14040. ( special || deferred.resolveWith )( that, args );
  14041. }
  14042. },
  14043. // Only normal processors (resolve) catch and reject exceptions
  14044. process = special ?
  14045. mightThrow :
  14046. function() {
  14047. try {
  14048. mightThrow();
  14049. } catch ( e ) {
  14050. if ( jQuery.Deferred.exceptionHook ) {
  14051. jQuery.Deferred.exceptionHook( e,
  14052. process.stackTrace );
  14053. }
  14054. // Support: Promises/A+ section 2.3.3.3.4.1
  14055. // https://promisesaplus.com/#point-61
  14056. // Ignore post-resolution exceptions
  14057. if ( depth + 1 >= maxDepth ) {
  14058. // Only substitute handlers pass on context
  14059. // and multiple values (non-spec behavior)
  14060. if ( handler !== Thrower ) {
  14061. that = undefined;
  14062. args = [ e ];
  14063. }
  14064. deferred.rejectWith( that, args );
  14065. }
  14066. }
  14067. };
  14068. // Support: Promises/A+ section 2.3.3.3.1
  14069. // https://promisesaplus.com/#point-57
  14070. // Re-resolve promises immediately to dodge false rejection from
  14071. // subsequent errors
  14072. if ( depth ) {
  14073. process();
  14074. } else {
  14075. // Call an optional hook to record the stack, in case of exception
  14076. // since it's otherwise lost when execution goes async
  14077. if ( jQuery.Deferred.getStackHook ) {
  14078. process.stackTrace = jQuery.Deferred.getStackHook();
  14079. }
  14080. window.setTimeout( process );
  14081. }
  14082. };
  14083. }
  14084. return jQuery.Deferred( function( newDefer ) {
  14085. // progress_handlers.add( ... )
  14086. tuples[ 0 ][ 3 ].add(
  14087. resolve(
  14088. 0,
  14089. newDefer,
  14090. isFunction( onProgress ) ?
  14091. onProgress :
  14092. Identity,
  14093. newDefer.notifyWith
  14094. )
  14095. );
  14096. // fulfilled_handlers.add( ... )
  14097. tuples[ 1 ][ 3 ].add(
  14098. resolve(
  14099. 0,
  14100. newDefer,
  14101. isFunction( onFulfilled ) ?
  14102. onFulfilled :
  14103. Identity
  14104. )
  14105. );
  14106. // rejected_handlers.add( ... )
  14107. tuples[ 2 ][ 3 ].add(
  14108. resolve(
  14109. 0,
  14110. newDefer,
  14111. isFunction( onRejected ) ?
  14112. onRejected :
  14113. Thrower
  14114. )
  14115. );
  14116. } ).promise();
  14117. },
  14118. // Get a promise for this deferred
  14119. // If obj is provided, the promise aspect is added to the object
  14120. promise: function( obj ) {
  14121. return obj != null ? jQuery.extend( obj, promise ) : promise;
  14122. }
  14123. },
  14124. deferred = {};
  14125. // Add list-specific methods
  14126. jQuery.each( tuples, function( i, tuple ) {
  14127. var list = tuple[ 2 ],
  14128. stateString = tuple[ 5 ];
  14129. // promise.progress = list.add
  14130. // promise.done = list.add
  14131. // promise.fail = list.add
  14132. promise[ tuple[ 1 ] ] = list.add;
  14133. // Handle state
  14134. if ( stateString ) {
  14135. list.add(
  14136. function() {
  14137. // state = "resolved" (i.e., fulfilled)
  14138. // state = "rejected"
  14139. state = stateString;
  14140. },
  14141. // rejected_callbacks.disable
  14142. // fulfilled_callbacks.disable
  14143. tuples[ 3 - i ][ 2 ].disable,
  14144. // rejected_handlers.disable
  14145. // fulfilled_handlers.disable
  14146. tuples[ 3 - i ][ 3 ].disable,
  14147. // progress_callbacks.lock
  14148. tuples[ 0 ][ 2 ].lock,
  14149. // progress_handlers.lock
  14150. tuples[ 0 ][ 3 ].lock
  14151. );
  14152. }
  14153. // progress_handlers.fire
  14154. // fulfilled_handlers.fire
  14155. // rejected_handlers.fire
  14156. list.add( tuple[ 3 ].fire );
  14157. // deferred.notify = function() { deferred.notifyWith(...) }
  14158. // deferred.resolve = function() { deferred.resolveWith(...) }
  14159. // deferred.reject = function() { deferred.rejectWith(...) }
  14160. deferred[ tuple[ 0 ] ] = function() {
  14161. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  14162. return this;
  14163. };
  14164. // deferred.notifyWith = list.fireWith
  14165. // deferred.resolveWith = list.fireWith
  14166. // deferred.rejectWith = list.fireWith
  14167. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  14168. } );
  14169. // Make the deferred a promise
  14170. promise.promise( deferred );
  14171. // Call given func if any
  14172. if ( func ) {
  14173. func.call( deferred, deferred );
  14174. }
  14175. // All done!
  14176. return deferred;
  14177. },
  14178. // Deferred helper
  14179. when: function( singleValue ) {
  14180. var
  14181. // count of uncompleted subordinates
  14182. remaining = arguments.length,
  14183. // count of unprocessed arguments
  14184. i = remaining,
  14185. // subordinate fulfillment data
  14186. resolveContexts = Array( i ),
  14187. resolveValues = slice.call( arguments ),
  14188. // the master Deferred
  14189. master = jQuery.Deferred(),
  14190. // subordinate callback factory
  14191. updateFunc = function( i ) {
  14192. return function( value ) {
  14193. resolveContexts[ i ] = this;
  14194. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  14195. if ( !( --remaining ) ) {
  14196. master.resolveWith( resolveContexts, resolveValues );
  14197. }
  14198. };
  14199. };
  14200. // Single- and empty arguments are adopted like Promise.resolve
  14201. if ( remaining <= 1 ) {
  14202. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  14203. !remaining );
  14204. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  14205. if ( master.state() === "pending" ||
  14206. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  14207. return master.then();
  14208. }
  14209. }
  14210. // Multiple arguments are aggregated like Promise.all array elements
  14211. while ( i-- ) {
  14212. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  14213. }
  14214. return master.promise();
  14215. }
  14216. } );
  14217. // These usually indicate a programmer mistake during development,
  14218. // warn about them ASAP rather than swallowing them by default.
  14219. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  14220. jQuery.Deferred.exceptionHook = function( error, stack ) {
  14221. // Support: IE 8 - 9 only
  14222. // Console exists when dev tools are open, which can happen at any time
  14223. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  14224. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  14225. }
  14226. };
  14227. jQuery.readyException = function( error ) {
  14228. window.setTimeout( function() {
  14229. throw error;
  14230. } );
  14231. };
  14232. // The deferred used on DOM ready
  14233. var readyList = jQuery.Deferred();
  14234. jQuery.fn.ready = function( fn ) {
  14235. readyList
  14236. .then( fn )
  14237. // Wrap jQuery.readyException in a function so that the lookup
  14238. // happens at the time of error handling instead of callback
  14239. // registration.
  14240. .catch( function( error ) {
  14241. jQuery.readyException( error );
  14242. } );
  14243. return this;
  14244. };
  14245. jQuery.extend( {
  14246. // Is the DOM ready to be used? Set to true once it occurs.
  14247. isReady: false,
  14248. // A counter to track how many items to wait for before
  14249. // the ready event fires. See #6781
  14250. readyWait: 1,
  14251. // Handle when the DOM is ready
  14252. ready: function( wait ) {
  14253. // Abort if there are pending holds or we're already ready
  14254. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  14255. return;
  14256. }
  14257. // Remember that the DOM is ready
  14258. jQuery.isReady = true;
  14259. // If a normal DOM Ready event fired, decrement, and wait if need be
  14260. if ( wait !== true && --jQuery.readyWait > 0 ) {
  14261. return;
  14262. }
  14263. // If there are functions bound, to execute
  14264. readyList.resolveWith( document, [ jQuery ] );
  14265. }
  14266. } );
  14267. jQuery.ready.then = readyList.then;
  14268. // The ready event handler and self cleanup method
  14269. function completed() {
  14270. document.removeEventListener( "DOMContentLoaded", completed );
  14271. window.removeEventListener( "load", completed );
  14272. jQuery.ready();
  14273. }
  14274. // Catch cases where $(document).ready() is called
  14275. // after the browser event has already occurred.
  14276. // Support: IE <=9 - 10 only
  14277. // Older IE sometimes signals "interactive" too soon
  14278. if ( document.readyState === "complete" ||
  14279. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  14280. // Handle it asynchronously to allow scripts the opportunity to delay ready
  14281. window.setTimeout( jQuery.ready );
  14282. } else {
  14283. // Use the handy event callback
  14284. document.addEventListener( "DOMContentLoaded", completed );
  14285. // A fallback to window.onload, that will always work
  14286. window.addEventListener( "load", completed );
  14287. }
  14288. // Multifunctional method to get and set values of a collection
  14289. // The value/s can optionally be executed if it's a function
  14290. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  14291. var i = 0,
  14292. len = elems.length,
  14293. bulk = key == null;
  14294. // Sets many values
  14295. if ( toType( key ) === "object" ) {
  14296. chainable = true;
  14297. for ( i in key ) {
  14298. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  14299. }
  14300. // Sets one value
  14301. } else if ( value !== undefined ) {
  14302. chainable = true;
  14303. if ( !isFunction( value ) ) {
  14304. raw = true;
  14305. }
  14306. if ( bulk ) {
  14307. // Bulk operations run against the entire set
  14308. if ( raw ) {
  14309. fn.call( elems, value );
  14310. fn = null;
  14311. // ...except when executing function values
  14312. } else {
  14313. bulk = fn;
  14314. fn = function( elem, _key, value ) {
  14315. return bulk.call( jQuery( elem ), value );
  14316. };
  14317. }
  14318. }
  14319. if ( fn ) {
  14320. for ( ; i < len; i++ ) {
  14321. fn(
  14322. elems[ i ], key, raw ?
  14323. value :
  14324. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  14325. );
  14326. }
  14327. }
  14328. }
  14329. if ( chainable ) {
  14330. return elems;
  14331. }
  14332. // Gets
  14333. if ( bulk ) {
  14334. return fn.call( elems );
  14335. }
  14336. return len ? fn( elems[ 0 ], key ) : emptyGet;
  14337. };
  14338. // Matches dashed string for camelizing
  14339. var rmsPrefix = /^-ms-/,
  14340. rdashAlpha = /-([a-z])/g;
  14341. // Used by camelCase as callback to replace()
  14342. function fcamelCase( _all, letter ) {
  14343. return letter.toUpperCase();
  14344. }
  14345. // Convert dashed to camelCase; used by the css and data modules
  14346. // Support: IE <=9 - 11, Edge 12 - 15
  14347. // Microsoft forgot to hump their vendor prefix (#9572)
  14348. function camelCase( string ) {
  14349. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  14350. }
  14351. var acceptData = function( owner ) {
  14352. // Accepts only:
  14353. // - Node
  14354. // - Node.ELEMENT_NODE
  14355. // - Node.DOCUMENT_NODE
  14356. // - Object
  14357. // - Any
  14358. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  14359. };
  14360. function Data() {
  14361. this.expando = jQuery.expando + Data.uid++;
  14362. }
  14363. Data.uid = 1;
  14364. Data.prototype = {
  14365. cache: function( owner ) {
  14366. // Check if the owner object already has a cache
  14367. var value = owner[ this.expando ];
  14368. // If not, create one
  14369. if ( !value ) {
  14370. value = {};
  14371. // We can accept data for non-element nodes in modern browsers,
  14372. // but we should not, see #8335.
  14373. // Always return an empty object.
  14374. if ( acceptData( owner ) ) {
  14375. // If it is a node unlikely to be stringify-ed or looped over
  14376. // use plain assignment
  14377. if ( owner.nodeType ) {
  14378. owner[ this.expando ] = value;
  14379. // Otherwise secure it in a non-enumerable property
  14380. // configurable must be true to allow the property to be
  14381. // deleted when data is removed
  14382. } else {
  14383. Object.defineProperty( owner, this.expando, {
  14384. value: value,
  14385. configurable: true
  14386. } );
  14387. }
  14388. }
  14389. }
  14390. return value;
  14391. },
  14392. set: function( owner, data, value ) {
  14393. var prop,
  14394. cache = this.cache( owner );
  14395. // Handle: [ owner, key, value ] args
  14396. // Always use camelCase key (gh-2257)
  14397. if ( typeof data === "string" ) {
  14398. cache[ camelCase( data ) ] = value;
  14399. // Handle: [ owner, { properties } ] args
  14400. } else {
  14401. // Copy the properties one-by-one to the cache object
  14402. for ( prop in data ) {
  14403. cache[ camelCase( prop ) ] = data[ prop ];
  14404. }
  14405. }
  14406. return cache;
  14407. },
  14408. get: function( owner, key ) {
  14409. return key === undefined ?
  14410. this.cache( owner ) :
  14411. // Always use camelCase key (gh-2257)
  14412. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  14413. },
  14414. access: function( owner, key, value ) {
  14415. // In cases where either:
  14416. //
  14417. // 1. No key was specified
  14418. // 2. A string key was specified, but no value provided
  14419. //
  14420. // Take the "read" path and allow the get method to determine
  14421. // which value to return, respectively either:
  14422. //
  14423. // 1. The entire cache object
  14424. // 2. The data stored at the key
  14425. //
  14426. if ( key === undefined ||
  14427. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  14428. return this.get( owner, key );
  14429. }
  14430. // When the key is not a string, or both a key and value
  14431. // are specified, set or extend (existing objects) with either:
  14432. //
  14433. // 1. An object of properties
  14434. // 2. A key and value
  14435. //
  14436. this.set( owner, key, value );
  14437. // Since the "set" path can have two possible entry points
  14438. // return the expected data based on which path was taken[*]
  14439. return value !== undefined ? value : key;
  14440. },
  14441. remove: function( owner, key ) {
  14442. var i,
  14443. cache = owner[ this.expando ];
  14444. if ( cache === undefined ) {
  14445. return;
  14446. }
  14447. if ( key !== undefined ) {
  14448. // Support array or space separated string of keys
  14449. if ( Array.isArray( key ) ) {
  14450. // If key is an array of keys...
  14451. // We always set camelCase keys, so remove that.
  14452. key = key.map( camelCase );
  14453. } else {
  14454. key = camelCase( key );
  14455. // If a key with the spaces exists, use it.
  14456. // Otherwise, create an array by matching non-whitespace
  14457. key = key in cache ?
  14458. [ key ] :
  14459. ( key.match( rnothtmlwhite ) || [] );
  14460. }
  14461. i = key.length;
  14462. while ( i-- ) {
  14463. delete cache[ key[ i ] ];
  14464. }
  14465. }
  14466. // Remove the expando if there's no more data
  14467. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  14468. // Support: Chrome <=35 - 45
  14469. // Webkit & Blink performance suffers when deleting properties
  14470. // from DOM nodes, so set to undefined instead
  14471. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  14472. if ( owner.nodeType ) {
  14473. owner[ this.expando ] = undefined;
  14474. } else {
  14475. delete owner[ this.expando ];
  14476. }
  14477. }
  14478. },
  14479. hasData: function( owner ) {
  14480. var cache = owner[ this.expando ];
  14481. return cache !== undefined && !jQuery.isEmptyObject( cache );
  14482. }
  14483. };
  14484. var dataPriv = new Data();
  14485. var dataUser = new Data();
  14486. // Implementation Summary
  14487. //
  14488. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  14489. // 2. Improve the module's maintainability by reducing the storage
  14490. // paths to a single mechanism.
  14491. // 3. Use the same single mechanism to support "private" and "user" data.
  14492. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  14493. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  14494. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  14495. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  14496. rmultiDash = /[A-Z]/g;
  14497. function getData( data ) {
  14498. if ( data === "true" ) {
  14499. return true;
  14500. }
  14501. if ( data === "false" ) {
  14502. return false;
  14503. }
  14504. if ( data === "null" ) {
  14505. return null;
  14506. }
  14507. // Only convert to a number if it doesn't change the string
  14508. if ( data === +data + "" ) {
  14509. return +data;
  14510. }
  14511. if ( rbrace.test( data ) ) {
  14512. return JSON.parse( data );
  14513. }
  14514. return data;
  14515. }
  14516. function dataAttr( elem, key, data ) {
  14517. var name;
  14518. // If nothing was found internally, try to fetch any
  14519. // data from the HTML5 data-* attribute
  14520. if ( data === undefined && elem.nodeType === 1 ) {
  14521. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  14522. data = elem.getAttribute( name );
  14523. if ( typeof data === "string" ) {
  14524. try {
  14525. data = getData( data );
  14526. } catch ( e ) {}
  14527. // Make sure we set the data so it isn't changed later
  14528. dataUser.set( elem, key, data );
  14529. } else {
  14530. data = undefined;
  14531. }
  14532. }
  14533. return data;
  14534. }
  14535. jQuery.extend( {
  14536. hasData: function( elem ) {
  14537. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  14538. },
  14539. data: function( elem, name, data ) {
  14540. return dataUser.access( elem, name, data );
  14541. },
  14542. removeData: function( elem, name ) {
  14543. dataUser.remove( elem, name );
  14544. },
  14545. // TODO: Now that all calls to _data and _removeData have been replaced
  14546. // with direct calls to dataPriv methods, these can be deprecated.
  14547. _data: function( elem, name, data ) {
  14548. return dataPriv.access( elem, name, data );
  14549. },
  14550. _removeData: function( elem, name ) {
  14551. dataPriv.remove( elem, name );
  14552. }
  14553. } );
  14554. jQuery.fn.extend( {
  14555. data: function( key, value ) {
  14556. var i, name, data,
  14557. elem = this[ 0 ],
  14558. attrs = elem && elem.attributes;
  14559. // Gets all values
  14560. if ( key === undefined ) {
  14561. if ( this.length ) {
  14562. data = dataUser.get( elem );
  14563. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  14564. i = attrs.length;
  14565. while ( i-- ) {
  14566. // Support: IE 11 only
  14567. // The attrs elements can be null (#14894)
  14568. if ( attrs[ i ] ) {
  14569. name = attrs[ i ].name;
  14570. if ( name.indexOf( "data-" ) === 0 ) {
  14571. name = camelCase( name.slice( 5 ) );
  14572. dataAttr( elem, name, data[ name ] );
  14573. }
  14574. }
  14575. }
  14576. dataPriv.set( elem, "hasDataAttrs", true );
  14577. }
  14578. }
  14579. return data;
  14580. }
  14581. // Sets multiple values
  14582. if ( typeof key === "object" ) {
  14583. return this.each( function() {
  14584. dataUser.set( this, key );
  14585. } );
  14586. }
  14587. return access( this, function( value ) {
  14588. var data;
  14589. // The calling jQuery object (element matches) is not empty
  14590. // (and therefore has an element appears at this[ 0 ]) and the
  14591. // `value` parameter was not undefined. An empty jQuery object
  14592. // will result in `undefined` for elem = this[ 0 ] which will
  14593. // throw an exception if an attempt to read a data cache is made.
  14594. if ( elem && value === undefined ) {
  14595. // Attempt to get data from the cache
  14596. // The key will always be camelCased in Data
  14597. data = dataUser.get( elem, key );
  14598. if ( data !== undefined ) {
  14599. return data;
  14600. }
  14601. // Attempt to "discover" the data in
  14602. // HTML5 custom data-* attrs
  14603. data = dataAttr( elem, key );
  14604. if ( data !== undefined ) {
  14605. return data;
  14606. }
  14607. // We tried really hard, but the data doesn't exist.
  14608. return;
  14609. }
  14610. // Set the data...
  14611. this.each( function() {
  14612. // We always store the camelCased key
  14613. dataUser.set( this, key, value );
  14614. } );
  14615. }, null, value, arguments.length > 1, null, true );
  14616. },
  14617. removeData: function( key ) {
  14618. return this.each( function() {
  14619. dataUser.remove( this, key );
  14620. } );
  14621. }
  14622. } );
  14623. jQuery.extend( {
  14624. queue: function( elem, type, data ) {
  14625. var queue;
  14626. if ( elem ) {
  14627. type = ( type || "fx" ) + "queue";
  14628. queue = dataPriv.get( elem, type );
  14629. // Speed up dequeue by getting out quickly if this is just a lookup
  14630. if ( data ) {
  14631. if ( !queue || Array.isArray( data ) ) {
  14632. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  14633. } else {
  14634. queue.push( data );
  14635. }
  14636. }
  14637. return queue || [];
  14638. }
  14639. },
  14640. dequeue: function( elem, type ) {
  14641. type = type || "fx";
  14642. var queue = jQuery.queue( elem, type ),
  14643. startLength = queue.length,
  14644. fn = queue.shift(),
  14645. hooks = jQuery._queueHooks( elem, type ),
  14646. next = function() {
  14647. jQuery.dequeue( elem, type );
  14648. };
  14649. // If the fx queue is dequeued, always remove the progress sentinel
  14650. if ( fn === "inprogress" ) {
  14651. fn = queue.shift();
  14652. startLength--;
  14653. }
  14654. if ( fn ) {
  14655. // Add a progress sentinel to prevent the fx queue from being
  14656. // automatically dequeued
  14657. if ( type === "fx" ) {
  14658. queue.unshift( "inprogress" );
  14659. }
  14660. // Clear up the last queue stop function
  14661. delete hooks.stop;
  14662. fn.call( elem, next, hooks );
  14663. }
  14664. if ( !startLength && hooks ) {
  14665. hooks.empty.fire();
  14666. }
  14667. },
  14668. // Not public - generate a queueHooks object, or return the current one
  14669. _queueHooks: function( elem, type ) {
  14670. var key = type + "queueHooks";
  14671. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  14672. empty: jQuery.Callbacks( "once memory" ).add( function() {
  14673. dataPriv.remove( elem, [ type + "queue", key ] );
  14674. } )
  14675. } );
  14676. }
  14677. } );
  14678. jQuery.fn.extend( {
  14679. queue: function( type, data ) {
  14680. var setter = 2;
  14681. if ( typeof type !== "string" ) {
  14682. data = type;
  14683. type = "fx";
  14684. setter--;
  14685. }
  14686. if ( arguments.length < setter ) {
  14687. return jQuery.queue( this[ 0 ], type );
  14688. }
  14689. return data === undefined ?
  14690. this :
  14691. this.each( function() {
  14692. var queue = jQuery.queue( this, type, data );
  14693. // Ensure a hooks for this queue
  14694. jQuery._queueHooks( this, type );
  14695. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  14696. jQuery.dequeue( this, type );
  14697. }
  14698. } );
  14699. },
  14700. dequeue: function( type ) {
  14701. return this.each( function() {
  14702. jQuery.dequeue( this, type );
  14703. } );
  14704. },
  14705. clearQueue: function( type ) {
  14706. return this.queue( type || "fx", [] );
  14707. },
  14708. // Get a promise resolved when queues of a certain type
  14709. // are emptied (fx is the type by default)
  14710. promise: function( type, obj ) {
  14711. var tmp,
  14712. count = 1,
  14713. defer = jQuery.Deferred(),
  14714. elements = this,
  14715. i = this.length,
  14716. resolve = function() {
  14717. if ( !( --count ) ) {
  14718. defer.resolveWith( elements, [ elements ] );
  14719. }
  14720. };
  14721. if ( typeof type !== "string" ) {
  14722. obj = type;
  14723. type = undefined;
  14724. }
  14725. type = type || "fx";
  14726. while ( i-- ) {
  14727. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  14728. if ( tmp && tmp.empty ) {
  14729. count++;
  14730. tmp.empty.add( resolve );
  14731. }
  14732. }
  14733. resolve();
  14734. return defer.promise( obj );
  14735. }
  14736. } );
  14737. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  14738. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  14739. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  14740. var documentElement = document.documentElement;
  14741. var isAttached = function( elem ) {
  14742. return jQuery.contains( elem.ownerDocument, elem );
  14743. },
  14744. composed = { composed: true };
  14745. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  14746. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  14747. // Support: iOS 10.0-10.2 only
  14748. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  14749. // leading to errors. We need to check for `getRootNode`.
  14750. if ( documentElement.getRootNode ) {
  14751. isAttached = function( elem ) {
  14752. return jQuery.contains( elem.ownerDocument, elem ) ||
  14753. elem.getRootNode( composed ) === elem.ownerDocument;
  14754. };
  14755. }
  14756. var isHiddenWithinTree = function( elem, el ) {
  14757. // isHiddenWithinTree might be called from jQuery#filter function;
  14758. // in that case, element will be second argument
  14759. elem = el || elem;
  14760. // Inline style trumps all
  14761. return elem.style.display === "none" ||
  14762. elem.style.display === "" &&
  14763. // Otherwise, check computed style
  14764. // Support: Firefox <=43 - 45
  14765. // Disconnected elements can have computed display: none, so first confirm that elem is
  14766. // in the document.
  14767. isAttached( elem ) &&
  14768. jQuery.css( elem, "display" ) === "none";
  14769. };
  14770. function adjustCSS( elem, prop, valueParts, tween ) {
  14771. var adjusted, scale,
  14772. maxIterations = 20,
  14773. currentValue = tween ?
  14774. function() {
  14775. return tween.cur();
  14776. } :
  14777. function() {
  14778. return jQuery.css( elem, prop, "" );
  14779. },
  14780. initial = currentValue(),
  14781. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  14782. // Starting value computation is required for potential unit mismatches
  14783. initialInUnit = elem.nodeType &&
  14784. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  14785. rcssNum.exec( jQuery.css( elem, prop ) );
  14786. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  14787. // Support: Firefox <=54
  14788. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  14789. initial = initial / 2;
  14790. // Trust units reported by jQuery.css
  14791. unit = unit || initialInUnit[ 3 ];
  14792. // Iteratively approximate from a nonzero starting point
  14793. initialInUnit = +initial || 1;
  14794. while ( maxIterations-- ) {
  14795. // Evaluate and update our best guess (doubling guesses that zero out).
  14796. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  14797. jQuery.style( elem, prop, initialInUnit + unit );
  14798. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  14799. maxIterations = 0;
  14800. }
  14801. initialInUnit = initialInUnit / scale;
  14802. }
  14803. initialInUnit = initialInUnit * 2;
  14804. jQuery.style( elem, prop, initialInUnit + unit );
  14805. // Make sure we update the tween properties later on
  14806. valueParts = valueParts || [];
  14807. }
  14808. if ( valueParts ) {
  14809. initialInUnit = +initialInUnit || +initial || 0;
  14810. // Apply relative offset (+=/-=) if specified
  14811. adjusted = valueParts[ 1 ] ?
  14812. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  14813. +valueParts[ 2 ];
  14814. if ( tween ) {
  14815. tween.unit = unit;
  14816. tween.start = initialInUnit;
  14817. tween.end = adjusted;
  14818. }
  14819. }
  14820. return adjusted;
  14821. }
  14822. var defaultDisplayMap = {};
  14823. function getDefaultDisplay( elem ) {
  14824. var temp,
  14825. doc = elem.ownerDocument,
  14826. nodeName = elem.nodeName,
  14827. display = defaultDisplayMap[ nodeName ];
  14828. if ( display ) {
  14829. return display;
  14830. }
  14831. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  14832. display = jQuery.css( temp, "display" );
  14833. temp.parentNode.removeChild( temp );
  14834. if ( display === "none" ) {
  14835. display = "block";
  14836. }
  14837. defaultDisplayMap[ nodeName ] = display;
  14838. return display;
  14839. }
  14840. function showHide( elements, show ) {
  14841. var display, elem,
  14842. values = [],
  14843. index = 0,
  14844. length = elements.length;
  14845. // Determine new display value for elements that need to change
  14846. for ( ; index < length; index++ ) {
  14847. elem = elements[ index ];
  14848. if ( !elem.style ) {
  14849. continue;
  14850. }
  14851. display = elem.style.display;
  14852. if ( show ) {
  14853. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  14854. // check is required in this first loop unless we have a nonempty display value (either
  14855. // inline or about-to-be-restored)
  14856. if ( display === "none" ) {
  14857. values[ index ] = dataPriv.get( elem, "display" ) || null;
  14858. if ( !values[ index ] ) {
  14859. elem.style.display = "";
  14860. }
  14861. }
  14862. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  14863. values[ index ] = getDefaultDisplay( elem );
  14864. }
  14865. } else {
  14866. if ( display !== "none" ) {
  14867. values[ index ] = "none";
  14868. // Remember what we're overwriting
  14869. dataPriv.set( elem, "display", display );
  14870. }
  14871. }
  14872. }
  14873. // Set the display of the elements in a second loop to avoid constant reflow
  14874. for ( index = 0; index < length; index++ ) {
  14875. if ( values[ index ] != null ) {
  14876. elements[ index ].style.display = values[ index ];
  14877. }
  14878. }
  14879. return elements;
  14880. }
  14881. jQuery.fn.extend( {
  14882. show: function() {
  14883. return showHide( this, true );
  14884. },
  14885. hide: function() {
  14886. return showHide( this );
  14887. },
  14888. toggle: function( state ) {
  14889. if ( typeof state === "boolean" ) {
  14890. return state ? this.show() : this.hide();
  14891. }
  14892. return this.each( function() {
  14893. if ( isHiddenWithinTree( this ) ) {
  14894. jQuery( this ).show();
  14895. } else {
  14896. jQuery( this ).hide();
  14897. }
  14898. } );
  14899. }
  14900. } );
  14901. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  14902. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  14903. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  14904. ( function() {
  14905. var fragment = document.createDocumentFragment(),
  14906. div = fragment.appendChild( document.createElement( "div" ) ),
  14907. input = document.createElement( "input" );
  14908. // Support: Android 4.0 - 4.3 only
  14909. // Check state lost if the name is set (#11217)
  14910. // Support: Windows Web Apps (WWA)
  14911. // `name` and `type` must use .setAttribute for WWA (#14901)
  14912. input.setAttribute( "type", "radio" );
  14913. input.setAttribute( "checked", "checked" );
  14914. input.setAttribute( "name", "t" );
  14915. div.appendChild( input );
  14916. // Support: Android <=4.1 only
  14917. // Older WebKit doesn't clone checked state correctly in fragments
  14918. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  14919. // Support: IE <=11 only
  14920. // Make sure textarea (and checkbox) defaultValue is properly cloned
  14921. div.innerHTML = "<textarea>x</textarea>";
  14922. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  14923. // Support: IE <=9 only
  14924. // IE <=9 replaces <option> tags with their contents when inserted outside of
  14925. // the select element.
  14926. div.innerHTML = "<option></option>";
  14927. support.option = !!div.lastChild;
  14928. } )();
  14929. // We have to close these tags to support XHTML (#13200)
  14930. var wrapMap = {
  14931. // XHTML parsers do not magically insert elements in the
  14932. // same way that tag soup parsers do. So we cannot shorten
  14933. // this by omitting <tbody> or other required elements.
  14934. thead: [ 1, "<table>", "</table>" ],
  14935. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  14936. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  14937. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  14938. _default: [ 0, "", "" ]
  14939. };
  14940. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  14941. wrapMap.th = wrapMap.td;
  14942. // Support: IE <=9 only
  14943. if ( !support.option ) {
  14944. wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
  14945. }
  14946. function getAll( context, tag ) {
  14947. // Support: IE <=9 - 11 only
  14948. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  14949. var ret;
  14950. if ( typeof context.getElementsByTagName !== "undefined" ) {
  14951. ret = context.getElementsByTagName( tag || "*" );
  14952. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  14953. ret = context.querySelectorAll( tag || "*" );
  14954. } else {
  14955. ret = [];
  14956. }
  14957. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  14958. return jQuery.merge( [ context ], ret );
  14959. }
  14960. return ret;
  14961. }
  14962. // Mark scripts as having already been evaluated
  14963. function setGlobalEval( elems, refElements ) {
  14964. var i = 0,
  14965. l = elems.length;
  14966. for ( ; i < l; i++ ) {
  14967. dataPriv.set(
  14968. elems[ i ],
  14969. "globalEval",
  14970. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  14971. );
  14972. }
  14973. }
  14974. var rhtml = /<|&#?\w+;/;
  14975. function buildFragment( elems, context, scripts, selection, ignored ) {
  14976. var elem, tmp, tag, wrap, attached, j,
  14977. fragment = context.createDocumentFragment(),
  14978. nodes = [],
  14979. i = 0,
  14980. l = elems.length;
  14981. for ( ; i < l; i++ ) {
  14982. elem = elems[ i ];
  14983. if ( elem || elem === 0 ) {
  14984. // Add nodes directly
  14985. if ( toType( elem ) === "object" ) {
  14986. // Support: Android <=4.0 only, PhantomJS 1 only
  14987. // push.apply(_, arraylike) throws on ancient WebKit
  14988. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  14989. // Convert non-html into a text node
  14990. } else if ( !rhtml.test( elem ) ) {
  14991. nodes.push( context.createTextNode( elem ) );
  14992. // Convert html into DOM nodes
  14993. } else {
  14994. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  14995. // Deserialize a standard representation
  14996. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  14997. wrap = wrapMap[ tag ] || wrapMap._default;
  14998. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  14999. // Descend through wrappers to the right content
  15000. j = wrap[ 0 ];
  15001. while ( j-- ) {
  15002. tmp = tmp.lastChild;
  15003. }
  15004. // Support: Android <=4.0 only, PhantomJS 1 only
  15005. // push.apply(_, arraylike) throws on ancient WebKit
  15006. jQuery.merge( nodes, tmp.childNodes );
  15007. // Remember the top-level container
  15008. tmp = fragment.firstChild;
  15009. // Ensure the created nodes are orphaned (#12392)
  15010. tmp.textContent = "";
  15011. }
  15012. }
  15013. }
  15014. // Remove wrapper from fragment
  15015. fragment.textContent = "";
  15016. i = 0;
  15017. while ( ( elem = nodes[ i++ ] ) ) {
  15018. // Skip elements already in the context collection (trac-4087)
  15019. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  15020. if ( ignored ) {
  15021. ignored.push( elem );
  15022. }
  15023. continue;
  15024. }
  15025. attached = isAttached( elem );
  15026. // Append to fragment
  15027. tmp = getAll( fragment.appendChild( elem ), "script" );
  15028. // Preserve script evaluation history
  15029. if ( attached ) {
  15030. setGlobalEval( tmp );
  15031. }
  15032. // Capture executables
  15033. if ( scripts ) {
  15034. j = 0;
  15035. while ( ( elem = tmp[ j++ ] ) ) {
  15036. if ( rscriptType.test( elem.type || "" ) ) {
  15037. scripts.push( elem );
  15038. }
  15039. }
  15040. }
  15041. }
  15042. return fragment;
  15043. }
  15044. var
  15045. rkeyEvent = /^key/,
  15046. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  15047. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  15048. function returnTrue() {
  15049. return true;
  15050. }
  15051. function returnFalse() {
  15052. return false;
  15053. }
  15054. // Support: IE <=9 - 11+
  15055. // focus() and blur() are asynchronous, except when they are no-op.
  15056. // So expect focus to be synchronous when the element is already active,
  15057. // and blur to be synchronous when the element is not already active.
  15058. // (focus and blur are always synchronous in other supported browsers,
  15059. // this just defines when we can count on it).
  15060. function expectSync( elem, type ) {
  15061. return ( elem === safeActiveElement() ) === ( type === "focus" );
  15062. }
  15063. // Support: IE <=9 only
  15064. // Accessing document.activeElement can throw unexpectedly
  15065. // https://bugs.jquery.com/ticket/13393
  15066. function safeActiveElement() {
  15067. try {
  15068. return document.activeElement;
  15069. } catch ( err ) { }
  15070. }
  15071. function on( elem, types, selector, data, fn, one ) {
  15072. var origFn, type;
  15073. // Types can be a map of types/handlers
  15074. if ( typeof types === "object" ) {
  15075. // ( types-Object, selector, data )
  15076. if ( typeof selector !== "string" ) {
  15077. // ( types-Object, data )
  15078. data = data || selector;
  15079. selector = undefined;
  15080. }
  15081. for ( type in types ) {
  15082. on( elem, type, selector, data, types[ type ], one );
  15083. }
  15084. return elem;
  15085. }
  15086. if ( data == null && fn == null ) {
  15087. // ( types, fn )
  15088. fn = selector;
  15089. data = selector = undefined;
  15090. } else if ( fn == null ) {
  15091. if ( typeof selector === "string" ) {
  15092. // ( types, selector, fn )
  15093. fn = data;
  15094. data = undefined;
  15095. } else {
  15096. // ( types, data, fn )
  15097. fn = data;
  15098. data = selector;
  15099. selector = undefined;
  15100. }
  15101. }
  15102. if ( fn === false ) {
  15103. fn = returnFalse;
  15104. } else if ( !fn ) {
  15105. return elem;
  15106. }
  15107. if ( one === 1 ) {
  15108. origFn = fn;
  15109. fn = function( event ) {
  15110. // Can use an empty set, since event contains the info
  15111. jQuery().off( event );
  15112. return origFn.apply( this, arguments );
  15113. };
  15114. // Use same guid so caller can remove using origFn
  15115. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  15116. }
  15117. return elem.each( function() {
  15118. jQuery.event.add( this, types, fn, data, selector );
  15119. } );
  15120. }
  15121. /*
  15122. * Helper functions for managing events -- not part of the public interface.
  15123. * Props to Dean Edwards' addEvent library for many of the ideas.
  15124. */
  15125. jQuery.event = {
  15126. global: {},
  15127. add: function( elem, types, handler, data, selector ) {
  15128. var handleObjIn, eventHandle, tmp,
  15129. events, t, handleObj,
  15130. special, handlers, type, namespaces, origType,
  15131. elemData = dataPriv.get( elem );
  15132. // Only attach events to objects that accept data
  15133. if ( !acceptData( elem ) ) {
  15134. return;
  15135. }
  15136. // Caller can pass in an object of custom data in lieu of the handler
  15137. if ( handler.handler ) {
  15138. handleObjIn = handler;
  15139. handler = handleObjIn.handler;
  15140. selector = handleObjIn.selector;
  15141. }
  15142. // Ensure that invalid selectors throw exceptions at attach time
  15143. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  15144. if ( selector ) {
  15145. jQuery.find.matchesSelector( documentElement, selector );
  15146. }
  15147. // Make sure that the handler has a unique ID, used to find/remove it later
  15148. if ( !handler.guid ) {
  15149. handler.guid = jQuery.guid++;
  15150. }
  15151. // Init the element's event structure and main handler, if this is the first
  15152. if ( !( events = elemData.events ) ) {
  15153. events = elemData.events = Object.create( null );
  15154. }
  15155. if ( !( eventHandle = elemData.handle ) ) {
  15156. eventHandle = elemData.handle = function( e ) {
  15157. // Discard the second event of a jQuery.event.trigger() and
  15158. // when an event is called after a page has unloaded
  15159. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  15160. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  15161. };
  15162. }
  15163. // Handle multiple events separated by a space
  15164. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  15165. t = types.length;
  15166. while ( t-- ) {
  15167. tmp = rtypenamespace.exec( types[ t ] ) || [];
  15168. type = origType = tmp[ 1 ];
  15169. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  15170. // There *must* be a type, no attaching namespace-only handlers
  15171. if ( !type ) {
  15172. continue;
  15173. }
  15174. // If event changes its type, use the special event handlers for the changed type
  15175. special = jQuery.event.special[ type ] || {};
  15176. // If selector defined, determine special event api type, otherwise given type
  15177. type = ( selector ? special.delegateType : special.bindType ) || type;
  15178. // Update special based on newly reset type
  15179. special = jQuery.event.special[ type ] || {};
  15180. // handleObj is passed to all event handlers
  15181. handleObj = jQuery.extend( {
  15182. type: type,
  15183. origType: origType,
  15184. data: data,
  15185. handler: handler,
  15186. guid: handler.guid,
  15187. selector: selector,
  15188. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  15189. namespace: namespaces.join( "." )
  15190. }, handleObjIn );
  15191. // Init the event handler queue if we're the first
  15192. if ( !( handlers = events[ type ] ) ) {
  15193. handlers = events[ type ] = [];
  15194. handlers.delegateCount = 0;
  15195. // Only use addEventListener if the special events handler returns false
  15196. if ( !special.setup ||
  15197. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  15198. if ( elem.addEventListener ) {
  15199. elem.addEventListener( type, eventHandle );
  15200. }
  15201. }
  15202. }
  15203. if ( special.add ) {
  15204. special.add.call( elem, handleObj );
  15205. if ( !handleObj.handler.guid ) {
  15206. handleObj.handler.guid = handler.guid;
  15207. }
  15208. }
  15209. // Add to the element's handler list, delegates in front
  15210. if ( selector ) {
  15211. handlers.splice( handlers.delegateCount++, 0, handleObj );
  15212. } else {
  15213. handlers.push( handleObj );
  15214. }
  15215. // Keep track of which events have ever been used, for event optimization
  15216. jQuery.event.global[ type ] = true;
  15217. }
  15218. },
  15219. // Detach an event or set of events from an element
  15220. remove: function( elem, types, handler, selector, mappedTypes ) {
  15221. var j, origCount, tmp,
  15222. events, t, handleObj,
  15223. special, handlers, type, namespaces, origType,
  15224. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  15225. if ( !elemData || !( events = elemData.events ) ) {
  15226. return;
  15227. }
  15228. // Once for each type.namespace in types; type may be omitted
  15229. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  15230. t = types.length;
  15231. while ( t-- ) {
  15232. tmp = rtypenamespace.exec( types[ t ] ) || [];
  15233. type = origType = tmp[ 1 ];
  15234. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  15235. // Unbind all events (on this namespace, if provided) for the element
  15236. if ( !type ) {
  15237. for ( type in events ) {
  15238. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  15239. }
  15240. continue;
  15241. }
  15242. special = jQuery.event.special[ type ] || {};
  15243. type = ( selector ? special.delegateType : special.bindType ) || type;
  15244. handlers = events[ type ] || [];
  15245. tmp = tmp[ 2 ] &&
  15246. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  15247. // Remove matching events
  15248. origCount = j = handlers.length;
  15249. while ( j-- ) {
  15250. handleObj = handlers[ j ];
  15251. if ( ( mappedTypes || origType === handleObj.origType ) &&
  15252. ( !handler || handler.guid === handleObj.guid ) &&
  15253. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  15254. ( !selector || selector === handleObj.selector ||
  15255. selector === "**" && handleObj.selector ) ) {
  15256. handlers.splice( j, 1 );
  15257. if ( handleObj.selector ) {
  15258. handlers.delegateCount--;
  15259. }
  15260. if ( special.remove ) {
  15261. special.remove.call( elem, handleObj );
  15262. }
  15263. }
  15264. }
  15265. // Remove generic event handler if we removed something and no more handlers exist
  15266. // (avoids potential for endless recursion during removal of special event handlers)
  15267. if ( origCount && !handlers.length ) {
  15268. if ( !special.teardown ||
  15269. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  15270. jQuery.removeEvent( elem, type, elemData.handle );
  15271. }
  15272. delete events[ type ];
  15273. }
  15274. }
  15275. // Remove data and the expando if it's no longer used
  15276. if ( jQuery.isEmptyObject( events ) ) {
  15277. dataPriv.remove( elem, "handle events" );
  15278. }
  15279. },
  15280. dispatch: function( nativeEvent ) {
  15281. var i, j, ret, matched, handleObj, handlerQueue,
  15282. args = new Array( arguments.length ),
  15283. // Make a writable jQuery.Event from the native event object
  15284. event = jQuery.event.fix( nativeEvent ),
  15285. handlers = (
  15286. dataPriv.get( this, "events" ) || Object.create( null )
  15287. )[ event.type ] || [],
  15288. special = jQuery.event.special[ event.type ] || {};
  15289. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  15290. args[ 0 ] = event;
  15291. for ( i = 1; i < arguments.length; i++ ) {
  15292. args[ i ] = arguments[ i ];
  15293. }
  15294. event.delegateTarget = this;
  15295. // Call the preDispatch hook for the mapped type, and let it bail if desired
  15296. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  15297. return;
  15298. }
  15299. // Determine handlers
  15300. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  15301. // Run delegates first; they may want to stop propagation beneath us
  15302. i = 0;
  15303. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  15304. event.currentTarget = matched.elem;
  15305. j = 0;
  15306. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  15307. !event.isImmediatePropagationStopped() ) {
  15308. // If the event is namespaced, then each handler is only invoked if it is
  15309. // specially universal or its namespaces are a superset of the event's.
  15310. if ( !event.rnamespace || handleObj.namespace === false ||
  15311. event.rnamespace.test( handleObj.namespace ) ) {
  15312. event.handleObj = handleObj;
  15313. event.data = handleObj.data;
  15314. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  15315. handleObj.handler ).apply( matched.elem, args );
  15316. if ( ret !== undefined ) {
  15317. if ( ( event.result = ret ) === false ) {
  15318. event.preventDefault();
  15319. event.stopPropagation();
  15320. }
  15321. }
  15322. }
  15323. }
  15324. }
  15325. // Call the postDispatch hook for the mapped type
  15326. if ( special.postDispatch ) {
  15327. special.postDispatch.call( this, event );
  15328. }
  15329. return event.result;
  15330. },
  15331. handlers: function( event, handlers ) {
  15332. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  15333. handlerQueue = [],
  15334. delegateCount = handlers.delegateCount,
  15335. cur = event.target;
  15336. // Find delegate handlers
  15337. if ( delegateCount &&
  15338. // Support: IE <=9
  15339. // Black-hole SVG <use> instance trees (trac-13180)
  15340. cur.nodeType &&
  15341. // Support: Firefox <=42
  15342. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  15343. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  15344. // Support: IE 11 only
  15345. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  15346. !( event.type === "click" && event.button >= 1 ) ) {
  15347. for ( ; cur !== this; cur = cur.parentNode || this ) {
  15348. // Don't check non-elements (#13208)
  15349. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  15350. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  15351. matchedHandlers = [];
  15352. matchedSelectors = {};
  15353. for ( i = 0; i < delegateCount; i++ ) {
  15354. handleObj = handlers[ i ];
  15355. // Don't conflict with Object.prototype properties (#13203)
  15356. sel = handleObj.selector + " ";
  15357. if ( matchedSelectors[ sel ] === undefined ) {
  15358. matchedSelectors[ sel ] = handleObj.needsContext ?
  15359. jQuery( sel, this ).index( cur ) > -1 :
  15360. jQuery.find( sel, this, null, [ cur ] ).length;
  15361. }
  15362. if ( matchedSelectors[ sel ] ) {
  15363. matchedHandlers.push( handleObj );
  15364. }
  15365. }
  15366. if ( matchedHandlers.length ) {
  15367. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  15368. }
  15369. }
  15370. }
  15371. }
  15372. // Add the remaining (directly-bound) handlers
  15373. cur = this;
  15374. if ( delegateCount < handlers.length ) {
  15375. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  15376. }
  15377. return handlerQueue;
  15378. },
  15379. addProp: function( name, hook ) {
  15380. Object.defineProperty( jQuery.Event.prototype, name, {
  15381. enumerable: true,
  15382. configurable: true,
  15383. get: isFunction( hook ) ?
  15384. function() {
  15385. if ( this.originalEvent ) {
  15386. return hook( this.originalEvent );
  15387. }
  15388. } :
  15389. function() {
  15390. if ( this.originalEvent ) {
  15391. return this.originalEvent[ name ];
  15392. }
  15393. },
  15394. set: function( value ) {
  15395. Object.defineProperty( this, name, {
  15396. enumerable: true,
  15397. configurable: true,
  15398. writable: true,
  15399. value: value
  15400. } );
  15401. }
  15402. } );
  15403. },
  15404. fix: function( originalEvent ) {
  15405. return originalEvent[ jQuery.expando ] ?
  15406. originalEvent :
  15407. new jQuery.Event( originalEvent );
  15408. },
  15409. special: {
  15410. load: {
  15411. // Prevent triggered image.load events from bubbling to window.load
  15412. noBubble: true
  15413. },
  15414. click: {
  15415. // Utilize native event to ensure correct state for checkable inputs
  15416. setup: function( data ) {
  15417. // For mutual compressibility with _default, replace `this` access with a local var.
  15418. // `|| data` is dead code meant only to preserve the variable through minification.
  15419. var el = this || data;
  15420. // Claim the first handler
  15421. if ( rcheckableType.test( el.type ) &&
  15422. el.click && nodeName( el, "input" ) ) {
  15423. // dataPriv.set( el, "click", ... )
  15424. leverageNative( el, "click", returnTrue );
  15425. }
  15426. // Return false to allow normal processing in the caller
  15427. return false;
  15428. },
  15429. trigger: function( data ) {
  15430. // For mutual compressibility with _default, replace `this` access with a local var.
  15431. // `|| data` is dead code meant only to preserve the variable through minification.
  15432. var el = this || data;
  15433. // Force setup before triggering a click
  15434. if ( rcheckableType.test( el.type ) &&
  15435. el.click && nodeName( el, "input" ) ) {
  15436. leverageNative( el, "click" );
  15437. }
  15438. // Return non-false to allow normal event-path propagation
  15439. return true;
  15440. },
  15441. // For cross-browser consistency, suppress native .click() on links
  15442. // Also prevent it if we're currently inside a leveraged native-event stack
  15443. _default: function( event ) {
  15444. var target = event.target;
  15445. return rcheckableType.test( target.type ) &&
  15446. target.click && nodeName( target, "input" ) &&
  15447. dataPriv.get( target, "click" ) ||
  15448. nodeName( target, "a" );
  15449. }
  15450. },
  15451. beforeunload: {
  15452. postDispatch: function( event ) {
  15453. // Support: Firefox 20+
  15454. // Firefox doesn't alert if the returnValue field is not set.
  15455. if ( event.result !== undefined && event.originalEvent ) {
  15456. event.originalEvent.returnValue = event.result;
  15457. }
  15458. }
  15459. }
  15460. }
  15461. };
  15462. // Ensure the presence of an event listener that handles manually-triggered
  15463. // synthetic events by interrupting progress until reinvoked in response to
  15464. // *native* events that it fires directly, ensuring that state changes have
  15465. // already occurred before other listeners are invoked.
  15466. function leverageNative( el, type, expectSync ) {
  15467. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  15468. if ( !expectSync ) {
  15469. if ( dataPriv.get( el, type ) === undefined ) {
  15470. jQuery.event.add( el, type, returnTrue );
  15471. }
  15472. return;
  15473. }
  15474. // Register the controller as a special universal handler for all event namespaces
  15475. dataPriv.set( el, type, false );
  15476. jQuery.event.add( el, type, {
  15477. namespace: false,
  15478. handler: function( event ) {
  15479. var notAsync, result,
  15480. saved = dataPriv.get( this, type );
  15481. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  15482. // Interrupt processing of the outer synthetic .trigger()ed event
  15483. // Saved data should be false in such cases, but might be a leftover capture object
  15484. // from an async native handler (gh-4350)
  15485. if ( !saved.length ) {
  15486. // Store arguments for use when handling the inner native event
  15487. // There will always be at least one argument (an event object), so this array
  15488. // will not be confused with a leftover capture object.
  15489. saved = slice.call( arguments );
  15490. dataPriv.set( this, type, saved );
  15491. // Trigger the native event and capture its result
  15492. // Support: IE <=9 - 11+
  15493. // focus() and blur() are asynchronous
  15494. notAsync = expectSync( this, type );
  15495. this[ type ]();
  15496. result = dataPriv.get( this, type );
  15497. if ( saved !== result || notAsync ) {
  15498. dataPriv.set( this, type, false );
  15499. } else {
  15500. result = {};
  15501. }
  15502. if ( saved !== result ) {
  15503. // Cancel the outer synthetic event
  15504. event.stopImmediatePropagation();
  15505. event.preventDefault();
  15506. return result.value;
  15507. }
  15508. // If this is an inner synthetic event for an event with a bubbling surrogate
  15509. // (focus or blur), assume that the surrogate already propagated from triggering the
  15510. // native event and prevent that from happening again here.
  15511. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  15512. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  15513. // less bad than duplication.
  15514. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  15515. event.stopPropagation();
  15516. }
  15517. // If this is a native event triggered above, everything is now in order
  15518. // Fire an inner synthetic event with the original arguments
  15519. } else if ( saved.length ) {
  15520. // ...and capture the result
  15521. dataPriv.set( this, type, {
  15522. value: jQuery.event.trigger(
  15523. // Support: IE <=9 - 11+
  15524. // Extend with the prototype to reset the above stopImmediatePropagation()
  15525. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  15526. saved.slice( 1 ),
  15527. this
  15528. )
  15529. } );
  15530. // Abort handling of the native event
  15531. event.stopImmediatePropagation();
  15532. }
  15533. }
  15534. } );
  15535. }
  15536. jQuery.removeEvent = function( elem, type, handle ) {
  15537. // This "if" is needed for plain objects
  15538. if ( elem.removeEventListener ) {
  15539. elem.removeEventListener( type, handle );
  15540. }
  15541. };
  15542. jQuery.Event = function( src, props ) {
  15543. // Allow instantiation without the 'new' keyword
  15544. if ( !( this instanceof jQuery.Event ) ) {
  15545. return new jQuery.Event( src, props );
  15546. }
  15547. // Event object
  15548. if ( src && src.type ) {
  15549. this.originalEvent = src;
  15550. this.type = src.type;
  15551. // Events bubbling up the document may have been marked as prevented
  15552. // by a handler lower down the tree; reflect the correct value.
  15553. this.isDefaultPrevented = src.defaultPrevented ||
  15554. src.defaultPrevented === undefined &&
  15555. // Support: Android <=2.3 only
  15556. src.returnValue === false ?
  15557. returnTrue :
  15558. returnFalse;
  15559. // Create target properties
  15560. // Support: Safari <=6 - 7 only
  15561. // Target should not be a text node (#504, #13143)
  15562. this.target = ( src.target && src.target.nodeType === 3 ) ?
  15563. src.target.parentNode :
  15564. src.target;
  15565. this.currentTarget = src.currentTarget;
  15566. this.relatedTarget = src.relatedTarget;
  15567. // Event type
  15568. } else {
  15569. this.type = src;
  15570. }
  15571. // Put explicitly provided properties onto the event object
  15572. if ( props ) {
  15573. jQuery.extend( this, props );
  15574. }
  15575. // Create a timestamp if incoming event doesn't have one
  15576. this.timeStamp = src && src.timeStamp || Date.now();
  15577. // Mark it as fixed
  15578. this[ jQuery.expando ] = true;
  15579. };
  15580. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  15581. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  15582. jQuery.Event.prototype = {
  15583. constructor: jQuery.Event,
  15584. isDefaultPrevented: returnFalse,
  15585. isPropagationStopped: returnFalse,
  15586. isImmediatePropagationStopped: returnFalse,
  15587. isSimulated: false,
  15588. preventDefault: function() {
  15589. var e = this.originalEvent;
  15590. this.isDefaultPrevented = returnTrue;
  15591. if ( e && !this.isSimulated ) {
  15592. e.preventDefault();
  15593. }
  15594. },
  15595. stopPropagation: function() {
  15596. var e = this.originalEvent;
  15597. this.isPropagationStopped = returnTrue;
  15598. if ( e && !this.isSimulated ) {
  15599. e.stopPropagation();
  15600. }
  15601. },
  15602. stopImmediatePropagation: function() {
  15603. var e = this.originalEvent;
  15604. this.isImmediatePropagationStopped = returnTrue;
  15605. if ( e && !this.isSimulated ) {
  15606. e.stopImmediatePropagation();
  15607. }
  15608. this.stopPropagation();
  15609. }
  15610. };
  15611. // Includes all common event props including KeyEvent and MouseEvent specific props
  15612. jQuery.each( {
  15613. altKey: true,
  15614. bubbles: true,
  15615. cancelable: true,
  15616. changedTouches: true,
  15617. ctrlKey: true,
  15618. detail: true,
  15619. eventPhase: true,
  15620. metaKey: true,
  15621. pageX: true,
  15622. pageY: true,
  15623. shiftKey: true,
  15624. view: true,
  15625. "char": true,
  15626. code: true,
  15627. charCode: true,
  15628. key: true,
  15629. keyCode: true,
  15630. button: true,
  15631. buttons: true,
  15632. clientX: true,
  15633. clientY: true,
  15634. offsetX: true,
  15635. offsetY: true,
  15636. pointerId: true,
  15637. pointerType: true,
  15638. screenX: true,
  15639. screenY: true,
  15640. targetTouches: true,
  15641. toElement: true,
  15642. touches: true,
  15643. which: function( event ) {
  15644. var button = event.button;
  15645. // Add which for key events
  15646. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  15647. return event.charCode != null ? event.charCode : event.keyCode;
  15648. }
  15649. // Add which for click: 1 === left; 2 === middle; 3 === right
  15650. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  15651. if ( button & 1 ) {
  15652. return 1;
  15653. }
  15654. if ( button & 2 ) {
  15655. return 3;
  15656. }
  15657. if ( button & 4 ) {
  15658. return 2;
  15659. }
  15660. return 0;
  15661. }
  15662. return event.which;
  15663. }
  15664. }, jQuery.event.addProp );
  15665. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  15666. jQuery.event.special[ type ] = {
  15667. // Utilize native event if possible so blur/focus sequence is correct
  15668. setup: function() {
  15669. // Claim the first handler
  15670. // dataPriv.set( this, "focus", ... )
  15671. // dataPriv.set( this, "blur", ... )
  15672. leverageNative( this, type, expectSync );
  15673. // Return false to allow normal processing in the caller
  15674. return false;
  15675. },
  15676. trigger: function() {
  15677. // Force setup before trigger
  15678. leverageNative( this, type );
  15679. // Return non-false to allow normal event-path propagation
  15680. return true;
  15681. },
  15682. delegateType: delegateType
  15683. };
  15684. } );
  15685. // Create mouseenter/leave events using mouseover/out and event-time checks
  15686. // so that event delegation works in jQuery.
  15687. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  15688. //
  15689. // Support: Safari 7 only
  15690. // Safari sends mouseenter too often; see:
  15691. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  15692. // for the description of the bug (it existed in older Chrome versions as well).
  15693. jQuery.each( {
  15694. mouseenter: "mouseover",
  15695. mouseleave: "mouseout",
  15696. pointerenter: "pointerover",
  15697. pointerleave: "pointerout"
  15698. }, function( orig, fix ) {
  15699. jQuery.event.special[ orig ] = {
  15700. delegateType: fix,
  15701. bindType: fix,
  15702. handle: function( event ) {
  15703. var ret,
  15704. target = this,
  15705. related = event.relatedTarget,
  15706. handleObj = event.handleObj;
  15707. // For mouseenter/leave call the handler if related is outside the target.
  15708. // NB: No relatedTarget if the mouse left/entered the browser window
  15709. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  15710. event.type = handleObj.origType;
  15711. ret = handleObj.handler.apply( this, arguments );
  15712. event.type = fix;
  15713. }
  15714. return ret;
  15715. }
  15716. };
  15717. } );
  15718. jQuery.fn.extend( {
  15719. on: function( types, selector, data, fn ) {
  15720. return on( this, types, selector, data, fn );
  15721. },
  15722. one: function( types, selector, data, fn ) {
  15723. return on( this, types, selector, data, fn, 1 );
  15724. },
  15725. off: function( types, selector, fn ) {
  15726. var handleObj, type;
  15727. if ( types && types.preventDefault && types.handleObj ) {
  15728. // ( event ) dispatched jQuery.Event
  15729. handleObj = types.handleObj;
  15730. jQuery( types.delegateTarget ).off(
  15731. handleObj.namespace ?
  15732. handleObj.origType + "." + handleObj.namespace :
  15733. handleObj.origType,
  15734. handleObj.selector,
  15735. handleObj.handler
  15736. );
  15737. return this;
  15738. }
  15739. if ( typeof types === "object" ) {
  15740. // ( types-object [, selector] )
  15741. for ( type in types ) {
  15742. this.off( type, selector, types[ type ] );
  15743. }
  15744. return this;
  15745. }
  15746. if ( selector === false || typeof selector === "function" ) {
  15747. // ( types [, fn] )
  15748. fn = selector;
  15749. selector = undefined;
  15750. }
  15751. if ( fn === false ) {
  15752. fn = returnFalse;
  15753. }
  15754. return this.each( function() {
  15755. jQuery.event.remove( this, types, fn, selector );
  15756. } );
  15757. }
  15758. } );
  15759. var
  15760. // Support: IE <=10 - 11, Edge 12 - 13 only
  15761. // In IE/Edge using regex groups here causes severe slowdowns.
  15762. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  15763. rnoInnerhtml = /<script|<style|<link/i,
  15764. // checked="checked" or checked
  15765. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  15766. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  15767. // Prefer a tbody over its parent table for containing new rows
  15768. function manipulationTarget( elem, content ) {
  15769. if ( nodeName( elem, "table" ) &&
  15770. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  15771. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  15772. }
  15773. return elem;
  15774. }
  15775. // Replace/restore the type attribute of script elements for safe DOM manipulation
  15776. function disableScript( elem ) {
  15777. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  15778. return elem;
  15779. }
  15780. function restoreScript( elem ) {
  15781. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  15782. elem.type = elem.type.slice( 5 );
  15783. } else {
  15784. elem.removeAttribute( "type" );
  15785. }
  15786. return elem;
  15787. }
  15788. function cloneCopyEvent( src, dest ) {
  15789. var i, l, type, pdataOld, udataOld, udataCur, events;
  15790. if ( dest.nodeType !== 1 ) {
  15791. return;
  15792. }
  15793. // 1. Copy private data: events, handlers, etc.
  15794. if ( dataPriv.hasData( src ) ) {
  15795. pdataOld = dataPriv.get( src );
  15796. events = pdataOld.events;
  15797. if ( events ) {
  15798. dataPriv.remove( dest, "handle events" );
  15799. for ( type in events ) {
  15800. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  15801. jQuery.event.add( dest, type, events[ type ][ i ] );
  15802. }
  15803. }
  15804. }
  15805. }
  15806. // 2. Copy user data
  15807. if ( dataUser.hasData( src ) ) {
  15808. udataOld = dataUser.access( src );
  15809. udataCur = jQuery.extend( {}, udataOld );
  15810. dataUser.set( dest, udataCur );
  15811. }
  15812. }
  15813. // Fix IE bugs, see support tests
  15814. function fixInput( src, dest ) {
  15815. var nodeName = dest.nodeName.toLowerCase();
  15816. // Fails to persist the checked state of a cloned checkbox or radio button.
  15817. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  15818. dest.checked = src.checked;
  15819. // Fails to return the selected option to the default selected state when cloning options
  15820. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  15821. dest.defaultValue = src.defaultValue;
  15822. }
  15823. }
  15824. function domManip( collection, args, callback, ignored ) {
  15825. // Flatten any nested arrays
  15826. args = flat( args );
  15827. var fragment, first, scripts, hasScripts, node, doc,
  15828. i = 0,
  15829. l = collection.length,
  15830. iNoClone = l - 1,
  15831. value = args[ 0 ],
  15832. valueIsFunction = isFunction( value );
  15833. // We can't cloneNode fragments that contain checked, in WebKit
  15834. if ( valueIsFunction ||
  15835. ( l > 1 && typeof value === "string" &&
  15836. !support.checkClone && rchecked.test( value ) ) ) {
  15837. return collection.each( function( index ) {
  15838. var self = collection.eq( index );
  15839. if ( valueIsFunction ) {
  15840. args[ 0 ] = value.call( this, index, self.html() );
  15841. }
  15842. domManip( self, args, callback, ignored );
  15843. } );
  15844. }
  15845. if ( l ) {
  15846. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  15847. first = fragment.firstChild;
  15848. if ( fragment.childNodes.length === 1 ) {
  15849. fragment = first;
  15850. }
  15851. // Require either new content or an interest in ignored elements to invoke the callback
  15852. if ( first || ignored ) {
  15853. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  15854. hasScripts = scripts.length;
  15855. // Use the original fragment for the last item
  15856. // instead of the first because it can end up
  15857. // being emptied incorrectly in certain situations (#8070).
  15858. for ( ; i < l; i++ ) {
  15859. node = fragment;
  15860. if ( i !== iNoClone ) {
  15861. node = jQuery.clone( node, true, true );
  15862. // Keep references to cloned scripts for later restoration
  15863. if ( hasScripts ) {
  15864. // Support: Android <=4.0 only, PhantomJS 1 only
  15865. // push.apply(_, arraylike) throws on ancient WebKit
  15866. jQuery.merge( scripts, getAll( node, "script" ) );
  15867. }
  15868. }
  15869. callback.call( collection[ i ], node, i );
  15870. }
  15871. if ( hasScripts ) {
  15872. doc = scripts[ scripts.length - 1 ].ownerDocument;
  15873. // Reenable scripts
  15874. jQuery.map( scripts, restoreScript );
  15875. // Evaluate executable scripts on first document insertion
  15876. for ( i = 0; i < hasScripts; i++ ) {
  15877. node = scripts[ i ];
  15878. if ( rscriptType.test( node.type || "" ) &&
  15879. !dataPriv.access( node, "globalEval" ) &&
  15880. jQuery.contains( doc, node ) ) {
  15881. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  15882. // Optional AJAX dependency, but won't run scripts if not present
  15883. if ( jQuery._evalUrl && !node.noModule ) {
  15884. jQuery._evalUrl( node.src, {
  15885. nonce: node.nonce || node.getAttribute( "nonce" )
  15886. }, doc );
  15887. }
  15888. } else {
  15889. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  15890. }
  15891. }
  15892. }
  15893. }
  15894. }
  15895. }
  15896. return collection;
  15897. }
  15898. function remove( elem, selector, keepData ) {
  15899. var node,
  15900. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  15901. i = 0;
  15902. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  15903. if ( !keepData && node.nodeType === 1 ) {
  15904. jQuery.cleanData( getAll( node ) );
  15905. }
  15906. if ( node.parentNode ) {
  15907. if ( keepData && isAttached( node ) ) {
  15908. setGlobalEval( getAll( node, "script" ) );
  15909. }
  15910. node.parentNode.removeChild( node );
  15911. }
  15912. }
  15913. return elem;
  15914. }
  15915. jQuery.extend( {
  15916. htmlPrefilter: function( html ) {
  15917. return html;
  15918. },
  15919. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  15920. var i, l, srcElements, destElements,
  15921. clone = elem.cloneNode( true ),
  15922. inPage = isAttached( elem );
  15923. // Fix IE cloning issues
  15924. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  15925. !jQuery.isXMLDoc( elem ) ) {
  15926. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  15927. destElements = getAll( clone );
  15928. srcElements = getAll( elem );
  15929. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  15930. fixInput( srcElements[ i ], destElements[ i ] );
  15931. }
  15932. }
  15933. // Copy the events from the original to the clone
  15934. if ( dataAndEvents ) {
  15935. if ( deepDataAndEvents ) {
  15936. srcElements = srcElements || getAll( elem );
  15937. destElements = destElements || getAll( clone );
  15938. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  15939. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  15940. }
  15941. } else {
  15942. cloneCopyEvent( elem, clone );
  15943. }
  15944. }
  15945. // Preserve script evaluation history
  15946. destElements = getAll( clone, "script" );
  15947. if ( destElements.length > 0 ) {
  15948. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  15949. }
  15950. // Return the cloned set
  15951. return clone;
  15952. },
  15953. cleanData: function( elems ) {
  15954. var data, elem, type,
  15955. special = jQuery.event.special,
  15956. i = 0;
  15957. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  15958. if ( acceptData( elem ) ) {
  15959. if ( ( data = elem[ dataPriv.expando ] ) ) {
  15960. if ( data.events ) {
  15961. for ( type in data.events ) {
  15962. if ( special[ type ] ) {
  15963. jQuery.event.remove( elem, type );
  15964. // This is a shortcut to avoid jQuery.event.remove's overhead
  15965. } else {
  15966. jQuery.removeEvent( elem, type, data.handle );
  15967. }
  15968. }
  15969. }
  15970. // Support: Chrome <=35 - 45+
  15971. // Assign undefined instead of using delete, see Data#remove
  15972. elem[ dataPriv.expando ] = undefined;
  15973. }
  15974. if ( elem[ dataUser.expando ] ) {
  15975. // Support: Chrome <=35 - 45+
  15976. // Assign undefined instead of using delete, see Data#remove
  15977. elem[ dataUser.expando ] = undefined;
  15978. }
  15979. }
  15980. }
  15981. }
  15982. } );
  15983. jQuery.fn.extend( {
  15984. detach: function( selector ) {
  15985. return remove( this, selector, true );
  15986. },
  15987. remove: function( selector ) {
  15988. return remove( this, selector );
  15989. },
  15990. text: function( value ) {
  15991. return access( this, function( value ) {
  15992. return value === undefined ?
  15993. jQuery.text( this ) :
  15994. this.empty().each( function() {
  15995. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  15996. this.textContent = value;
  15997. }
  15998. } );
  15999. }, null, value, arguments.length );
  16000. },
  16001. append: function() {
  16002. return domManip( this, arguments, function( elem ) {
  16003. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  16004. var target = manipulationTarget( this, elem );
  16005. target.appendChild( elem );
  16006. }
  16007. } );
  16008. },
  16009. prepend: function() {
  16010. return domManip( this, arguments, function( elem ) {
  16011. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  16012. var target = manipulationTarget( this, elem );
  16013. target.insertBefore( elem, target.firstChild );
  16014. }
  16015. } );
  16016. },
  16017. before: function() {
  16018. return domManip( this, arguments, function( elem ) {
  16019. if ( this.parentNode ) {
  16020. this.parentNode.insertBefore( elem, this );
  16021. }
  16022. } );
  16023. },
  16024. after: function() {
  16025. return domManip( this, arguments, function( elem ) {
  16026. if ( this.parentNode ) {
  16027. this.parentNode.insertBefore( elem, this.nextSibling );
  16028. }
  16029. } );
  16030. },
  16031. empty: function() {
  16032. var elem,
  16033. i = 0;
  16034. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  16035. if ( elem.nodeType === 1 ) {
  16036. // Prevent memory leaks
  16037. jQuery.cleanData( getAll( elem, false ) );
  16038. // Remove any remaining nodes
  16039. elem.textContent = "";
  16040. }
  16041. }
  16042. return this;
  16043. },
  16044. clone: function( dataAndEvents, deepDataAndEvents ) {
  16045. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  16046. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  16047. return this.map( function() {
  16048. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  16049. } );
  16050. },
  16051. html: function( value ) {
  16052. return access( this, function( value ) {
  16053. var elem = this[ 0 ] || {},
  16054. i = 0,
  16055. l = this.length;
  16056. if ( value === undefined && elem.nodeType === 1 ) {
  16057. return elem.innerHTML;
  16058. }
  16059. // See if we can take a shortcut and just use innerHTML
  16060. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  16061. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  16062. value = jQuery.htmlPrefilter( value );
  16063. try {
  16064. for ( ; i < l; i++ ) {
  16065. elem = this[ i ] || {};
  16066. // Remove element nodes and prevent memory leaks
  16067. if ( elem.nodeType === 1 ) {
  16068. jQuery.cleanData( getAll( elem, false ) );
  16069. elem.innerHTML = value;
  16070. }
  16071. }
  16072. elem = 0;
  16073. // If using innerHTML throws an exception, use the fallback method
  16074. } catch ( e ) {}
  16075. }
  16076. if ( elem ) {
  16077. this.empty().append( value );
  16078. }
  16079. }, null, value, arguments.length );
  16080. },
  16081. replaceWith: function() {
  16082. var ignored = [];
  16083. // Make the changes, replacing each non-ignored context element with the new content
  16084. return domManip( this, arguments, function( elem ) {
  16085. var parent = this.parentNode;
  16086. if ( jQuery.inArray( this, ignored ) < 0 ) {
  16087. jQuery.cleanData( getAll( this ) );
  16088. if ( parent ) {
  16089. parent.replaceChild( elem, this );
  16090. }
  16091. }
  16092. // Force callback invocation
  16093. }, ignored );
  16094. }
  16095. } );
  16096. jQuery.each( {
  16097. appendTo: "append",
  16098. prependTo: "prepend",
  16099. insertBefore: "before",
  16100. insertAfter: "after",
  16101. replaceAll: "replaceWith"
  16102. }, function( name, original ) {
  16103. jQuery.fn[ name ] = function( selector ) {
  16104. var elems,
  16105. ret = [],
  16106. insert = jQuery( selector ),
  16107. last = insert.length - 1,
  16108. i = 0;
  16109. for ( ; i <= last; i++ ) {
  16110. elems = i === last ? this : this.clone( true );
  16111. jQuery( insert[ i ] )[ original ]( elems );
  16112. // Support: Android <=4.0 only, PhantomJS 1 only
  16113. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  16114. push.apply( ret, elems.get() );
  16115. }
  16116. return this.pushStack( ret );
  16117. };
  16118. } );
  16119. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  16120. var getStyles = function( elem ) {
  16121. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  16122. // IE throws on elements created in popups
  16123. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  16124. var view = elem.ownerDocument.defaultView;
  16125. if ( !view || !view.opener ) {
  16126. view = window;
  16127. }
  16128. return view.getComputedStyle( elem );
  16129. };
  16130. var swap = function( elem, options, callback ) {
  16131. var ret, name,
  16132. old = {};
  16133. // Remember the old values, and insert the new ones
  16134. for ( name in options ) {
  16135. old[ name ] = elem.style[ name ];
  16136. elem.style[ name ] = options[ name ];
  16137. }
  16138. ret = callback.call( elem );
  16139. // Revert the old values
  16140. for ( name in options ) {
  16141. elem.style[ name ] = old[ name ];
  16142. }
  16143. return ret;
  16144. };
  16145. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  16146. ( function() {
  16147. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  16148. // so they're executed at the same time to save the second computation.
  16149. function computeStyleTests() {
  16150. // This is a singleton, we need to execute it only once
  16151. if ( !div ) {
  16152. return;
  16153. }
  16154. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  16155. "margin-top:1px;padding:0;border:0";
  16156. div.style.cssText =
  16157. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  16158. "margin:auto;border:1px;padding:1px;" +
  16159. "width:60%;top:1%";
  16160. documentElement.appendChild( container ).appendChild( div );
  16161. var divStyle = window.getComputedStyle( div );
  16162. pixelPositionVal = divStyle.top !== "1%";
  16163. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  16164. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  16165. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  16166. // Some styles come back with percentage values, even though they shouldn't
  16167. div.style.right = "60%";
  16168. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  16169. // Support: IE 9 - 11 only
  16170. // Detect misreporting of content dimensions for box-sizing:border-box elements
  16171. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  16172. // Support: IE 9 only
  16173. // Detect overflow:scroll screwiness (gh-3699)
  16174. // Support: Chrome <=64
  16175. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  16176. div.style.position = "absolute";
  16177. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  16178. documentElement.removeChild( container );
  16179. // Nullify the div so it wouldn't be stored in the memory and
  16180. // it will also be a sign that checks already performed
  16181. div = null;
  16182. }
  16183. function roundPixelMeasures( measure ) {
  16184. return Math.round( parseFloat( measure ) );
  16185. }
  16186. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  16187. reliableTrDimensionsVal, reliableMarginLeftVal,
  16188. container = document.createElement( "div" ),
  16189. div = document.createElement( "div" );
  16190. // Finish early in limited (non-browser) environments
  16191. if ( !div.style ) {
  16192. return;
  16193. }
  16194. // Support: IE <=9 - 11 only
  16195. // Style of cloned element affects source element cloned (#8908)
  16196. div.style.backgroundClip = "content-box";
  16197. div.cloneNode( true ).style.backgroundClip = "";
  16198. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  16199. jQuery.extend( support, {
  16200. boxSizingReliable: function() {
  16201. computeStyleTests();
  16202. return boxSizingReliableVal;
  16203. },
  16204. pixelBoxStyles: function() {
  16205. computeStyleTests();
  16206. return pixelBoxStylesVal;
  16207. },
  16208. pixelPosition: function() {
  16209. computeStyleTests();
  16210. return pixelPositionVal;
  16211. },
  16212. reliableMarginLeft: function() {
  16213. computeStyleTests();
  16214. return reliableMarginLeftVal;
  16215. },
  16216. scrollboxSize: function() {
  16217. computeStyleTests();
  16218. return scrollboxSizeVal;
  16219. },
  16220. // Support: IE 9 - 11+, Edge 15 - 18+
  16221. // IE/Edge misreport `getComputedStyle` of table rows with width/height
  16222. // set in CSS while `offset*` properties report correct values.
  16223. // Behavior in IE 9 is more subtle than in newer versions & it passes
  16224. // some versions of this test; make sure not to make it pass there!
  16225. reliableTrDimensions: function() {
  16226. var table, tr, trChild, trStyle;
  16227. if ( reliableTrDimensionsVal == null ) {
  16228. table = document.createElement( "table" );
  16229. tr = document.createElement( "tr" );
  16230. trChild = document.createElement( "div" );
  16231. table.style.cssText = "position:absolute;left:-11111px";
  16232. tr.style.height = "1px";
  16233. trChild.style.height = "9px";
  16234. documentElement
  16235. .appendChild( table )
  16236. .appendChild( tr )
  16237. .appendChild( trChild );
  16238. trStyle = window.getComputedStyle( tr );
  16239. reliableTrDimensionsVal = parseInt( trStyle.height ) > 3;
  16240. documentElement.removeChild( table );
  16241. }
  16242. return reliableTrDimensionsVal;
  16243. }
  16244. } );
  16245. } )();
  16246. function curCSS( elem, name, computed ) {
  16247. var width, minWidth, maxWidth, ret,
  16248. // Support: Firefox 51+
  16249. // Retrieving style before computed somehow
  16250. // fixes an issue with getting wrong values
  16251. // on detached elements
  16252. style = elem.style;
  16253. computed = computed || getStyles( elem );
  16254. // getPropertyValue is needed for:
  16255. // .css('filter') (IE 9 only, #12537)
  16256. // .css('--customProperty) (#3144)
  16257. if ( computed ) {
  16258. ret = computed.getPropertyValue( name ) || computed[ name ];
  16259. if ( ret === "" && !isAttached( elem ) ) {
  16260. ret = jQuery.style( elem, name );
  16261. }
  16262. // A tribute to the "awesome hack by Dean Edwards"
  16263. // Android Browser returns percentage for some values,
  16264. // but width seems to be reliably pixels.
  16265. // This is against the CSSOM draft spec:
  16266. // https://drafts.csswg.org/cssom/#resolved-values
  16267. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  16268. // Remember the original values
  16269. width = style.width;
  16270. minWidth = style.minWidth;
  16271. maxWidth = style.maxWidth;
  16272. // Put in the new values to get a computed value out
  16273. style.minWidth = style.maxWidth = style.width = ret;
  16274. ret = computed.width;
  16275. // Revert the changed values
  16276. style.width = width;
  16277. style.minWidth = minWidth;
  16278. style.maxWidth = maxWidth;
  16279. }
  16280. }
  16281. return ret !== undefined ?
  16282. // Support: IE <=9 - 11 only
  16283. // IE returns zIndex value as an integer.
  16284. ret + "" :
  16285. ret;
  16286. }
  16287. function addGetHookIf( conditionFn, hookFn ) {
  16288. // Define the hook, we'll check on the first run if it's really needed.
  16289. return {
  16290. get: function() {
  16291. if ( conditionFn() ) {
  16292. // Hook not needed (or it's not possible to use it due
  16293. // to missing dependency), remove it.
  16294. delete this.get;
  16295. return;
  16296. }
  16297. // Hook needed; redefine it so that the support test is not executed again.
  16298. return ( this.get = hookFn ).apply( this, arguments );
  16299. }
  16300. };
  16301. }
  16302. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  16303. emptyStyle = document.createElement( "div" ).style,
  16304. vendorProps = {};
  16305. // Return a vendor-prefixed property or undefined
  16306. function vendorPropName( name ) {
  16307. // Check for vendor prefixed names
  16308. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  16309. i = cssPrefixes.length;
  16310. while ( i-- ) {
  16311. name = cssPrefixes[ i ] + capName;
  16312. if ( name in emptyStyle ) {
  16313. return name;
  16314. }
  16315. }
  16316. }
  16317. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  16318. function finalPropName( name ) {
  16319. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  16320. if ( final ) {
  16321. return final;
  16322. }
  16323. if ( name in emptyStyle ) {
  16324. return name;
  16325. }
  16326. return vendorProps[ name ] = vendorPropName( name ) || name;
  16327. }
  16328. var
  16329. // Swappable if display is none or starts with table
  16330. // except "table", "table-cell", or "table-caption"
  16331. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  16332. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  16333. rcustomProp = /^--/,
  16334. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  16335. cssNormalTransform = {
  16336. letterSpacing: "0",
  16337. fontWeight: "400"
  16338. };
  16339. function setPositiveNumber( _elem, value, subtract ) {
  16340. // Any relative (+/-) values have already been
  16341. // normalized at this point
  16342. var matches = rcssNum.exec( value );
  16343. return matches ?
  16344. // Guard against undefined "subtract", e.g., when used as in cssHooks
  16345. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  16346. value;
  16347. }
  16348. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  16349. var i = dimension === "width" ? 1 : 0,
  16350. extra = 0,
  16351. delta = 0;
  16352. // Adjustment may not be necessary
  16353. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  16354. return 0;
  16355. }
  16356. for ( ; i < 4; i += 2 ) {
  16357. // Both box models exclude margin
  16358. if ( box === "margin" ) {
  16359. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  16360. }
  16361. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  16362. if ( !isBorderBox ) {
  16363. // Add padding
  16364. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  16365. // For "border" or "margin", add border
  16366. if ( box !== "padding" ) {
  16367. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  16368. // But still keep track of it otherwise
  16369. } else {
  16370. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  16371. }
  16372. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  16373. // "padding" or "margin"
  16374. } else {
  16375. // For "content", subtract padding
  16376. if ( box === "content" ) {
  16377. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  16378. }
  16379. // For "content" or "padding", subtract border
  16380. if ( box !== "margin" ) {
  16381. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  16382. }
  16383. }
  16384. }
  16385. // Account for positive content-box scroll gutter when requested by providing computedVal
  16386. if ( !isBorderBox && computedVal >= 0 ) {
  16387. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  16388. // Assuming integer scroll gutter, subtract the rest and round down
  16389. delta += Math.max( 0, Math.ceil(
  16390. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  16391. computedVal -
  16392. delta -
  16393. extra -
  16394. 0.5
  16395. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  16396. // Use an explicit zero to avoid NaN (gh-3964)
  16397. ) ) || 0;
  16398. }
  16399. return delta;
  16400. }
  16401. function getWidthOrHeight( elem, dimension, extra ) {
  16402. // Start with computed style
  16403. var styles = getStyles( elem ),
  16404. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  16405. // Fake content-box until we know it's needed to know the true value.
  16406. boxSizingNeeded = !support.boxSizingReliable() || extra,
  16407. isBorderBox = boxSizingNeeded &&
  16408. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  16409. valueIsBorderBox = isBorderBox,
  16410. val = curCSS( elem, dimension, styles ),
  16411. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  16412. // Support: Firefox <=54
  16413. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  16414. if ( rnumnonpx.test( val ) ) {
  16415. if ( !extra ) {
  16416. return val;
  16417. }
  16418. val = "auto";
  16419. }
  16420. // Support: IE 9 - 11 only
  16421. // Use offsetWidth/offsetHeight for when box sizing is unreliable.
  16422. // In those cases, the computed value can be trusted to be border-box.
  16423. if ( ( !support.boxSizingReliable() && isBorderBox ||
  16424. // Support: IE 10 - 11+, Edge 15 - 18+
  16425. // IE/Edge misreport `getComputedStyle` of table rows with width/height
  16426. // set in CSS while `offset*` properties report correct values.
  16427. // Interestingly, in some cases IE 9 doesn't suffer from this issue.
  16428. !support.reliableTrDimensions() && nodeName( elem, "tr" ) ||
  16429. // Fall back to offsetWidth/offsetHeight when value is "auto"
  16430. // This happens for inline elements with no explicit setting (gh-3571)
  16431. val === "auto" ||
  16432. // Support: Android <=4.1 - 4.3 only
  16433. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  16434. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  16435. // Make sure the element is visible & connected
  16436. elem.getClientRects().length ) {
  16437. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  16438. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  16439. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  16440. // retrieved value as a content box dimension.
  16441. valueIsBorderBox = offsetProp in elem;
  16442. if ( valueIsBorderBox ) {
  16443. val = elem[ offsetProp ];
  16444. }
  16445. }
  16446. // Normalize "" and auto
  16447. val = parseFloat( val ) || 0;
  16448. // Adjust for the element's box model
  16449. return ( val +
  16450. boxModelAdjustment(
  16451. elem,
  16452. dimension,
  16453. extra || ( isBorderBox ? "border" : "content" ),
  16454. valueIsBorderBox,
  16455. styles,
  16456. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  16457. val
  16458. )
  16459. ) + "px";
  16460. }
  16461. jQuery.extend( {
  16462. // Add in style property hooks for overriding the default
  16463. // behavior of getting and setting a style property
  16464. cssHooks: {
  16465. opacity: {
  16466. get: function( elem, computed ) {
  16467. if ( computed ) {
  16468. // We should always get a number back from opacity
  16469. var ret = curCSS( elem, "opacity" );
  16470. return ret === "" ? "1" : ret;
  16471. }
  16472. }
  16473. }
  16474. },
  16475. // Don't automatically add "px" to these possibly-unitless properties
  16476. cssNumber: {
  16477. "animationIterationCount": true,
  16478. "columnCount": true,
  16479. "fillOpacity": true,
  16480. "flexGrow": true,
  16481. "flexShrink": true,
  16482. "fontWeight": true,
  16483. "gridArea": true,
  16484. "gridColumn": true,
  16485. "gridColumnEnd": true,
  16486. "gridColumnStart": true,
  16487. "gridRow": true,
  16488. "gridRowEnd": true,
  16489. "gridRowStart": true,
  16490. "lineHeight": true,
  16491. "opacity": true,
  16492. "order": true,
  16493. "orphans": true,
  16494. "widows": true,
  16495. "zIndex": true,
  16496. "zoom": true
  16497. },
  16498. // Add in properties whose names you wish to fix before
  16499. // setting or getting the value
  16500. cssProps: {},
  16501. // Get and set the style property on a DOM Node
  16502. style: function( elem, name, value, extra ) {
  16503. // Don't set styles on text and comment nodes
  16504. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  16505. return;
  16506. }
  16507. // Make sure that we're working with the right name
  16508. var ret, type, hooks,
  16509. origName = camelCase( name ),
  16510. isCustomProp = rcustomProp.test( name ),
  16511. style = elem.style;
  16512. // Make sure that we're working with the right name. We don't
  16513. // want to query the value if it is a CSS custom property
  16514. // since they are user-defined.
  16515. if ( !isCustomProp ) {
  16516. name = finalPropName( origName );
  16517. }
  16518. // Gets hook for the prefixed version, then unprefixed version
  16519. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  16520. // Check if we're setting a value
  16521. if ( value !== undefined ) {
  16522. type = typeof value;
  16523. // Convert "+=" or "-=" to relative numbers (#7345)
  16524. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  16525. value = adjustCSS( elem, name, ret );
  16526. // Fixes bug #9237
  16527. type = "number";
  16528. }
  16529. // Make sure that null and NaN values aren't set (#7116)
  16530. if ( value == null || value !== value ) {
  16531. return;
  16532. }
  16533. // If a number was passed in, add the unit (except for certain CSS properties)
  16534. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  16535. // "px" to a few hardcoded values.
  16536. if ( type === "number" && !isCustomProp ) {
  16537. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  16538. }
  16539. // background-* props affect original clone's values
  16540. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  16541. style[ name ] = "inherit";
  16542. }
  16543. // If a hook was provided, use that value, otherwise just set the specified value
  16544. if ( !hooks || !( "set" in hooks ) ||
  16545. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  16546. if ( isCustomProp ) {
  16547. style.setProperty( name, value );
  16548. } else {
  16549. style[ name ] = value;
  16550. }
  16551. }
  16552. } else {
  16553. // If a hook was provided get the non-computed value from there
  16554. if ( hooks && "get" in hooks &&
  16555. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  16556. return ret;
  16557. }
  16558. // Otherwise just get the value from the style object
  16559. return style[ name ];
  16560. }
  16561. },
  16562. css: function( elem, name, extra, styles ) {
  16563. var val, num, hooks,
  16564. origName = camelCase( name ),
  16565. isCustomProp = rcustomProp.test( name );
  16566. // Make sure that we're working with the right name. We don't
  16567. // want to modify the value if it is a CSS custom property
  16568. // since they are user-defined.
  16569. if ( !isCustomProp ) {
  16570. name = finalPropName( origName );
  16571. }
  16572. // Try prefixed name followed by the unprefixed name
  16573. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  16574. // If a hook was provided get the computed value from there
  16575. if ( hooks && "get" in hooks ) {
  16576. val = hooks.get( elem, true, extra );
  16577. }
  16578. // Otherwise, if a way to get the computed value exists, use that
  16579. if ( val === undefined ) {
  16580. val = curCSS( elem, name, styles );
  16581. }
  16582. // Convert "normal" to computed value
  16583. if ( val === "normal" && name in cssNormalTransform ) {
  16584. val = cssNormalTransform[ name ];
  16585. }
  16586. // Make numeric if forced or a qualifier was provided and val looks numeric
  16587. if ( extra === "" || extra ) {
  16588. num = parseFloat( val );
  16589. return extra === true || isFinite( num ) ? num || 0 : val;
  16590. }
  16591. return val;
  16592. }
  16593. } );
  16594. jQuery.each( [ "height", "width" ], function( _i, dimension ) {
  16595. jQuery.cssHooks[ dimension ] = {
  16596. get: function( elem, computed, extra ) {
  16597. if ( computed ) {
  16598. // Certain elements can have dimension info if we invisibly show them
  16599. // but it must have a current display style that would benefit
  16600. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  16601. // Support: Safari 8+
  16602. // Table columns in Safari have non-zero offsetWidth & zero
  16603. // getBoundingClientRect().width unless display is changed.
  16604. // Support: IE <=11 only
  16605. // Running getBoundingClientRect on a disconnected node
  16606. // in IE throws an error.
  16607. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  16608. swap( elem, cssShow, function() {
  16609. return getWidthOrHeight( elem, dimension, extra );
  16610. } ) :
  16611. getWidthOrHeight( elem, dimension, extra );
  16612. }
  16613. },
  16614. set: function( elem, value, extra ) {
  16615. var matches,
  16616. styles = getStyles( elem ),
  16617. // Only read styles.position if the test has a chance to fail
  16618. // to avoid forcing a reflow.
  16619. scrollboxSizeBuggy = !support.scrollboxSize() &&
  16620. styles.position === "absolute",
  16621. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  16622. boxSizingNeeded = scrollboxSizeBuggy || extra,
  16623. isBorderBox = boxSizingNeeded &&
  16624. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  16625. subtract = extra ?
  16626. boxModelAdjustment(
  16627. elem,
  16628. dimension,
  16629. extra,
  16630. isBorderBox,
  16631. styles
  16632. ) :
  16633. 0;
  16634. // Account for unreliable border-box dimensions by comparing offset* to computed and
  16635. // faking a content-box to get border and padding (gh-3699)
  16636. if ( isBorderBox && scrollboxSizeBuggy ) {
  16637. subtract -= Math.ceil(
  16638. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  16639. parseFloat( styles[ dimension ] ) -
  16640. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  16641. 0.5
  16642. );
  16643. }
  16644. // Convert to pixels if value adjustment is needed
  16645. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  16646. ( matches[ 3 ] || "px" ) !== "px" ) {
  16647. elem.style[ dimension ] = value;
  16648. value = jQuery.css( elem, dimension );
  16649. }
  16650. return setPositiveNumber( elem, value, subtract );
  16651. }
  16652. };
  16653. } );
  16654. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  16655. function( elem, computed ) {
  16656. if ( computed ) {
  16657. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  16658. elem.getBoundingClientRect().left -
  16659. swap( elem, { marginLeft: 0 }, function() {
  16660. return elem.getBoundingClientRect().left;
  16661. } )
  16662. ) + "px";
  16663. }
  16664. }
  16665. );
  16666. // These hooks are used by animate to expand properties
  16667. jQuery.each( {
  16668. margin: "",
  16669. padding: "",
  16670. border: "Width"
  16671. }, function( prefix, suffix ) {
  16672. jQuery.cssHooks[ prefix + suffix ] = {
  16673. expand: function( value ) {
  16674. var i = 0,
  16675. expanded = {},
  16676. // Assumes a single number if not a string
  16677. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  16678. for ( ; i < 4; i++ ) {
  16679. expanded[ prefix + cssExpand[ i ] + suffix ] =
  16680. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  16681. }
  16682. return expanded;
  16683. }
  16684. };
  16685. if ( prefix !== "margin" ) {
  16686. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  16687. }
  16688. } );
  16689. jQuery.fn.extend( {
  16690. css: function( name, value ) {
  16691. return access( this, function( elem, name, value ) {
  16692. var styles, len,
  16693. map = {},
  16694. i = 0;
  16695. if ( Array.isArray( name ) ) {
  16696. styles = getStyles( elem );
  16697. len = name.length;
  16698. for ( ; i < len; i++ ) {
  16699. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  16700. }
  16701. return map;
  16702. }
  16703. return value !== undefined ?
  16704. jQuery.style( elem, name, value ) :
  16705. jQuery.css( elem, name );
  16706. }, name, value, arguments.length > 1 );
  16707. }
  16708. } );
  16709. function Tween( elem, options, prop, end, easing ) {
  16710. return new Tween.prototype.init( elem, options, prop, end, easing );
  16711. }
  16712. jQuery.Tween = Tween;
  16713. Tween.prototype = {
  16714. constructor: Tween,
  16715. init: function( elem, options, prop, end, easing, unit ) {
  16716. this.elem = elem;
  16717. this.prop = prop;
  16718. this.easing = easing || jQuery.easing._default;
  16719. this.options = options;
  16720. this.start = this.now = this.cur();
  16721. this.end = end;
  16722. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  16723. },
  16724. cur: function() {
  16725. var hooks = Tween.propHooks[ this.prop ];
  16726. return hooks && hooks.get ?
  16727. hooks.get( this ) :
  16728. Tween.propHooks._default.get( this );
  16729. },
  16730. run: function( percent ) {
  16731. var eased,
  16732. hooks = Tween.propHooks[ this.prop ];
  16733. if ( this.options.duration ) {
  16734. this.pos = eased = jQuery.easing[ this.easing ](
  16735. percent, this.options.duration * percent, 0, 1, this.options.duration
  16736. );
  16737. } else {
  16738. this.pos = eased = percent;
  16739. }
  16740. this.now = ( this.end - this.start ) * eased + this.start;
  16741. if ( this.options.step ) {
  16742. this.options.step.call( this.elem, this.now, this );
  16743. }
  16744. if ( hooks && hooks.set ) {
  16745. hooks.set( this );
  16746. } else {
  16747. Tween.propHooks._default.set( this );
  16748. }
  16749. return this;
  16750. }
  16751. };
  16752. Tween.prototype.init.prototype = Tween.prototype;
  16753. Tween.propHooks = {
  16754. _default: {
  16755. get: function( tween ) {
  16756. var result;
  16757. // Use a property on the element directly when it is not a DOM element,
  16758. // or when there is no matching style property that exists.
  16759. if ( tween.elem.nodeType !== 1 ||
  16760. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  16761. return tween.elem[ tween.prop ];
  16762. }
  16763. // Passing an empty string as a 3rd parameter to .css will automatically
  16764. // attempt a parseFloat and fallback to a string if the parse fails.
  16765. // Simple values such as "10px" are parsed to Float;
  16766. // complex values such as "rotate(1rad)" are returned as-is.
  16767. result = jQuery.css( tween.elem, tween.prop, "" );
  16768. // Empty strings, null, undefined and "auto" are converted to 0.
  16769. return !result || result === "auto" ? 0 : result;
  16770. },
  16771. set: function( tween ) {
  16772. // Use step hook for back compat.
  16773. // Use cssHook if its there.
  16774. // Use .style if available and use plain properties where available.
  16775. if ( jQuery.fx.step[ tween.prop ] ) {
  16776. jQuery.fx.step[ tween.prop ]( tween );
  16777. } else if ( tween.elem.nodeType === 1 && (
  16778. jQuery.cssHooks[ tween.prop ] ||
  16779. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  16780. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  16781. } else {
  16782. tween.elem[ tween.prop ] = tween.now;
  16783. }
  16784. }
  16785. }
  16786. };
  16787. // Support: IE <=9 only
  16788. // Panic based approach to setting things on disconnected nodes
  16789. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  16790. set: function( tween ) {
  16791. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  16792. tween.elem[ tween.prop ] = tween.now;
  16793. }
  16794. }
  16795. };
  16796. jQuery.easing = {
  16797. linear: function( p ) {
  16798. return p;
  16799. },
  16800. swing: function( p ) {
  16801. return 0.5 - Math.cos( p * Math.PI ) / 2;
  16802. },
  16803. _default: "swing"
  16804. };
  16805. jQuery.fx = Tween.prototype.init;
  16806. // Back compat <1.8 extension point
  16807. jQuery.fx.step = {};
  16808. var
  16809. fxNow, inProgress,
  16810. rfxtypes = /^(?:toggle|show|hide)$/,
  16811. rrun = /queueHooks$/;
  16812. function schedule() {
  16813. if ( inProgress ) {
  16814. if ( document.hidden === false && window.requestAnimationFrame ) {
  16815. window.requestAnimationFrame( schedule );
  16816. } else {
  16817. window.setTimeout( schedule, jQuery.fx.interval );
  16818. }
  16819. jQuery.fx.tick();
  16820. }
  16821. }
  16822. // Animations created synchronously will run synchronously
  16823. function createFxNow() {
  16824. window.setTimeout( function() {
  16825. fxNow = undefined;
  16826. } );
  16827. return ( fxNow = Date.now() );
  16828. }
  16829. // Generate parameters to create a standard animation
  16830. function genFx( type, includeWidth ) {
  16831. var which,
  16832. i = 0,
  16833. attrs = { height: type };
  16834. // If we include width, step value is 1 to do all cssExpand values,
  16835. // otherwise step value is 2 to skip over Left and Right
  16836. includeWidth = includeWidth ? 1 : 0;
  16837. for ( ; i < 4; i += 2 - includeWidth ) {
  16838. which = cssExpand[ i ];
  16839. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  16840. }
  16841. if ( includeWidth ) {
  16842. attrs.opacity = attrs.width = type;
  16843. }
  16844. return attrs;
  16845. }
  16846. function createTween( value, prop, animation ) {
  16847. var tween,
  16848. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  16849. index = 0,
  16850. length = collection.length;
  16851. for ( ; index < length; index++ ) {
  16852. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  16853. // We're done with this property
  16854. return tween;
  16855. }
  16856. }
  16857. }
  16858. function defaultPrefilter( elem, props, opts ) {
  16859. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  16860. isBox = "width" in props || "height" in props,
  16861. anim = this,
  16862. orig = {},
  16863. style = elem.style,
  16864. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  16865. dataShow = dataPriv.get( elem, "fxshow" );
  16866. // Queue-skipping animations hijack the fx hooks
  16867. if ( !opts.queue ) {
  16868. hooks = jQuery._queueHooks( elem, "fx" );
  16869. if ( hooks.unqueued == null ) {
  16870. hooks.unqueued = 0;
  16871. oldfire = hooks.empty.fire;
  16872. hooks.empty.fire = function() {
  16873. if ( !hooks.unqueued ) {
  16874. oldfire();
  16875. }
  16876. };
  16877. }
  16878. hooks.unqueued++;
  16879. anim.always( function() {
  16880. // Ensure the complete handler is called before this completes
  16881. anim.always( function() {
  16882. hooks.unqueued--;
  16883. if ( !jQuery.queue( elem, "fx" ).length ) {
  16884. hooks.empty.fire();
  16885. }
  16886. } );
  16887. } );
  16888. }
  16889. // Detect show/hide animations
  16890. for ( prop in props ) {
  16891. value = props[ prop ];
  16892. if ( rfxtypes.test( value ) ) {
  16893. delete props[ prop ];
  16894. toggle = toggle || value === "toggle";
  16895. if ( value === ( hidden ? "hide" : "show" ) ) {
  16896. // Pretend to be hidden if this is a "show" and
  16897. // there is still data from a stopped show/hide
  16898. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  16899. hidden = true;
  16900. // Ignore all other no-op show/hide data
  16901. } else {
  16902. continue;
  16903. }
  16904. }
  16905. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  16906. }
  16907. }
  16908. // Bail out if this is a no-op like .hide().hide()
  16909. propTween = !jQuery.isEmptyObject( props );
  16910. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  16911. return;
  16912. }
  16913. // Restrict "overflow" and "display" styles during box animations
  16914. if ( isBox && elem.nodeType === 1 ) {
  16915. // Support: IE <=9 - 11, Edge 12 - 15
  16916. // Record all 3 overflow attributes because IE does not infer the shorthand
  16917. // from identically-valued overflowX and overflowY and Edge just mirrors
  16918. // the overflowX value there.
  16919. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  16920. // Identify a display type, preferring old show/hide data over the CSS cascade
  16921. restoreDisplay = dataShow && dataShow.display;
  16922. if ( restoreDisplay == null ) {
  16923. restoreDisplay = dataPriv.get( elem, "display" );
  16924. }
  16925. display = jQuery.css( elem, "display" );
  16926. if ( display === "none" ) {
  16927. if ( restoreDisplay ) {
  16928. display = restoreDisplay;
  16929. } else {
  16930. // Get nonempty value(s) by temporarily forcing visibility
  16931. showHide( [ elem ], true );
  16932. restoreDisplay = elem.style.display || restoreDisplay;
  16933. display = jQuery.css( elem, "display" );
  16934. showHide( [ elem ] );
  16935. }
  16936. }
  16937. // Animate inline elements as inline-block
  16938. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  16939. if ( jQuery.css( elem, "float" ) === "none" ) {
  16940. // Restore the original display value at the end of pure show/hide animations
  16941. if ( !propTween ) {
  16942. anim.done( function() {
  16943. style.display = restoreDisplay;
  16944. } );
  16945. if ( restoreDisplay == null ) {
  16946. display = style.display;
  16947. restoreDisplay = display === "none" ? "" : display;
  16948. }
  16949. }
  16950. style.display = "inline-block";
  16951. }
  16952. }
  16953. }
  16954. if ( opts.overflow ) {
  16955. style.overflow = "hidden";
  16956. anim.always( function() {
  16957. style.overflow = opts.overflow[ 0 ];
  16958. style.overflowX = opts.overflow[ 1 ];
  16959. style.overflowY = opts.overflow[ 2 ];
  16960. } );
  16961. }
  16962. // Implement show/hide animations
  16963. propTween = false;
  16964. for ( prop in orig ) {
  16965. // General show/hide setup for this element animation
  16966. if ( !propTween ) {
  16967. if ( dataShow ) {
  16968. if ( "hidden" in dataShow ) {
  16969. hidden = dataShow.hidden;
  16970. }
  16971. } else {
  16972. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  16973. }
  16974. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  16975. if ( toggle ) {
  16976. dataShow.hidden = !hidden;
  16977. }
  16978. // Show elements before animating them
  16979. if ( hidden ) {
  16980. showHide( [ elem ], true );
  16981. }
  16982. /* eslint-disable no-loop-func */
  16983. anim.done( function() {
  16984. /* eslint-enable no-loop-func */
  16985. // The final step of a "hide" animation is actually hiding the element
  16986. if ( !hidden ) {
  16987. showHide( [ elem ] );
  16988. }
  16989. dataPriv.remove( elem, "fxshow" );
  16990. for ( prop in orig ) {
  16991. jQuery.style( elem, prop, orig[ prop ] );
  16992. }
  16993. } );
  16994. }
  16995. // Per-property setup
  16996. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  16997. if ( !( prop in dataShow ) ) {
  16998. dataShow[ prop ] = propTween.start;
  16999. if ( hidden ) {
  17000. propTween.end = propTween.start;
  17001. propTween.start = 0;
  17002. }
  17003. }
  17004. }
  17005. }
  17006. function propFilter( props, specialEasing ) {
  17007. var index, name, easing, value, hooks;
  17008. // camelCase, specialEasing and expand cssHook pass
  17009. for ( index in props ) {
  17010. name = camelCase( index );
  17011. easing = specialEasing[ name ];
  17012. value = props[ index ];
  17013. if ( Array.isArray( value ) ) {
  17014. easing = value[ 1 ];
  17015. value = props[ index ] = value[ 0 ];
  17016. }
  17017. if ( index !== name ) {
  17018. props[ name ] = value;
  17019. delete props[ index ];
  17020. }
  17021. hooks = jQuery.cssHooks[ name ];
  17022. if ( hooks && "expand" in hooks ) {
  17023. value = hooks.expand( value );
  17024. delete props[ name ];
  17025. // Not quite $.extend, this won't overwrite existing keys.
  17026. // Reusing 'index' because we have the correct "name"
  17027. for ( index in value ) {
  17028. if ( !( index in props ) ) {
  17029. props[ index ] = value[ index ];
  17030. specialEasing[ index ] = easing;
  17031. }
  17032. }
  17033. } else {
  17034. specialEasing[ name ] = easing;
  17035. }
  17036. }
  17037. }
  17038. function Animation( elem, properties, options ) {
  17039. var result,
  17040. stopped,
  17041. index = 0,
  17042. length = Animation.prefilters.length,
  17043. deferred = jQuery.Deferred().always( function() {
  17044. // Don't match elem in the :animated selector
  17045. delete tick.elem;
  17046. } ),
  17047. tick = function() {
  17048. if ( stopped ) {
  17049. return false;
  17050. }
  17051. var currentTime = fxNow || createFxNow(),
  17052. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  17053. // Support: Android 2.3 only
  17054. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  17055. temp = remaining / animation.duration || 0,
  17056. percent = 1 - temp,
  17057. index = 0,
  17058. length = animation.tweens.length;
  17059. for ( ; index < length; index++ ) {
  17060. animation.tweens[ index ].run( percent );
  17061. }
  17062. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  17063. // If there's more to do, yield
  17064. if ( percent < 1 && length ) {
  17065. return remaining;
  17066. }
  17067. // If this was an empty animation, synthesize a final progress notification
  17068. if ( !length ) {
  17069. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  17070. }
  17071. // Resolve the animation and report its conclusion
  17072. deferred.resolveWith( elem, [ animation ] );
  17073. return false;
  17074. },
  17075. animation = deferred.promise( {
  17076. elem: elem,
  17077. props: jQuery.extend( {}, properties ),
  17078. opts: jQuery.extend( true, {
  17079. specialEasing: {},
  17080. easing: jQuery.easing._default
  17081. }, options ),
  17082. originalProperties: properties,
  17083. originalOptions: options,
  17084. startTime: fxNow || createFxNow(),
  17085. duration: options.duration,
  17086. tweens: [],
  17087. createTween: function( prop, end ) {
  17088. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  17089. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  17090. animation.tweens.push( tween );
  17091. return tween;
  17092. },
  17093. stop: function( gotoEnd ) {
  17094. var index = 0,
  17095. // If we are going to the end, we want to run all the tweens
  17096. // otherwise we skip this part
  17097. length = gotoEnd ? animation.tweens.length : 0;
  17098. if ( stopped ) {
  17099. return this;
  17100. }
  17101. stopped = true;
  17102. for ( ; index < length; index++ ) {
  17103. animation.tweens[ index ].run( 1 );
  17104. }
  17105. // Resolve when we played the last frame; otherwise, reject
  17106. if ( gotoEnd ) {
  17107. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  17108. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  17109. } else {
  17110. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  17111. }
  17112. return this;
  17113. }
  17114. } ),
  17115. props = animation.props;
  17116. propFilter( props, animation.opts.specialEasing );
  17117. for ( ; index < length; index++ ) {
  17118. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  17119. if ( result ) {
  17120. if ( isFunction( result.stop ) ) {
  17121. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  17122. result.stop.bind( result );
  17123. }
  17124. return result;
  17125. }
  17126. }
  17127. jQuery.map( props, createTween, animation );
  17128. if ( isFunction( animation.opts.start ) ) {
  17129. animation.opts.start.call( elem, animation );
  17130. }
  17131. // Attach callbacks from options
  17132. animation
  17133. .progress( animation.opts.progress )
  17134. .done( animation.opts.done, animation.opts.complete )
  17135. .fail( animation.opts.fail )
  17136. .always( animation.opts.always );
  17137. jQuery.fx.timer(
  17138. jQuery.extend( tick, {
  17139. elem: elem,
  17140. anim: animation,
  17141. queue: animation.opts.queue
  17142. } )
  17143. );
  17144. return animation;
  17145. }
  17146. jQuery.Animation = jQuery.extend( Animation, {
  17147. tweeners: {
  17148. "*": [ function( prop, value ) {
  17149. var tween = this.createTween( prop, value );
  17150. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  17151. return tween;
  17152. } ]
  17153. },
  17154. tweener: function( props, callback ) {
  17155. if ( isFunction( props ) ) {
  17156. callback = props;
  17157. props = [ "*" ];
  17158. } else {
  17159. props = props.match( rnothtmlwhite );
  17160. }
  17161. var prop,
  17162. index = 0,
  17163. length = props.length;
  17164. for ( ; index < length; index++ ) {
  17165. prop = props[ index ];
  17166. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  17167. Animation.tweeners[ prop ].unshift( callback );
  17168. }
  17169. },
  17170. prefilters: [ defaultPrefilter ],
  17171. prefilter: function( callback, prepend ) {
  17172. if ( prepend ) {
  17173. Animation.prefilters.unshift( callback );
  17174. } else {
  17175. Animation.prefilters.push( callback );
  17176. }
  17177. }
  17178. } );
  17179. jQuery.speed = function( speed, easing, fn ) {
  17180. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  17181. complete: fn || !fn && easing ||
  17182. isFunction( speed ) && speed,
  17183. duration: speed,
  17184. easing: fn && easing || easing && !isFunction( easing ) && easing
  17185. };
  17186. // Go to the end state if fx are off
  17187. if ( jQuery.fx.off ) {
  17188. opt.duration = 0;
  17189. } else {
  17190. if ( typeof opt.duration !== "number" ) {
  17191. if ( opt.duration in jQuery.fx.speeds ) {
  17192. opt.duration = jQuery.fx.speeds[ opt.duration ];
  17193. } else {
  17194. opt.duration = jQuery.fx.speeds._default;
  17195. }
  17196. }
  17197. }
  17198. // Normalize opt.queue - true/undefined/null -> "fx"
  17199. if ( opt.queue == null || opt.queue === true ) {
  17200. opt.queue = "fx";
  17201. }
  17202. // Queueing
  17203. opt.old = opt.complete;
  17204. opt.complete = function() {
  17205. if ( isFunction( opt.old ) ) {
  17206. opt.old.call( this );
  17207. }
  17208. if ( opt.queue ) {
  17209. jQuery.dequeue( this, opt.queue );
  17210. }
  17211. };
  17212. return opt;
  17213. };
  17214. jQuery.fn.extend( {
  17215. fadeTo: function( speed, to, easing, callback ) {
  17216. // Show any hidden elements after setting opacity to 0
  17217. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  17218. // Animate to the value specified
  17219. .end().animate( { opacity: to }, speed, easing, callback );
  17220. },
  17221. animate: function( prop, speed, easing, callback ) {
  17222. var empty = jQuery.isEmptyObject( prop ),
  17223. optall = jQuery.speed( speed, easing, callback ),
  17224. doAnimation = function() {
  17225. // Operate on a copy of prop so per-property easing won't be lost
  17226. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  17227. // Empty animations, or finishing resolves immediately
  17228. if ( empty || dataPriv.get( this, "finish" ) ) {
  17229. anim.stop( true );
  17230. }
  17231. };
  17232. doAnimation.finish = doAnimation;
  17233. return empty || optall.queue === false ?
  17234. this.each( doAnimation ) :
  17235. this.queue( optall.queue, doAnimation );
  17236. },
  17237. stop: function( type, clearQueue, gotoEnd ) {
  17238. var stopQueue = function( hooks ) {
  17239. var stop = hooks.stop;
  17240. delete hooks.stop;
  17241. stop( gotoEnd );
  17242. };
  17243. if ( typeof type !== "string" ) {
  17244. gotoEnd = clearQueue;
  17245. clearQueue = type;
  17246. type = undefined;
  17247. }
  17248. if ( clearQueue ) {
  17249. this.queue( type || "fx", [] );
  17250. }
  17251. return this.each( function() {
  17252. var dequeue = true,
  17253. index = type != null && type + "queueHooks",
  17254. timers = jQuery.timers,
  17255. data = dataPriv.get( this );
  17256. if ( index ) {
  17257. if ( data[ index ] && data[ index ].stop ) {
  17258. stopQueue( data[ index ] );
  17259. }
  17260. } else {
  17261. for ( index in data ) {
  17262. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  17263. stopQueue( data[ index ] );
  17264. }
  17265. }
  17266. }
  17267. for ( index = timers.length; index--; ) {
  17268. if ( timers[ index ].elem === this &&
  17269. ( type == null || timers[ index ].queue === type ) ) {
  17270. timers[ index ].anim.stop( gotoEnd );
  17271. dequeue = false;
  17272. timers.splice( index, 1 );
  17273. }
  17274. }
  17275. // Start the next in the queue if the last step wasn't forced.
  17276. // Timers currently will call their complete callbacks, which
  17277. // will dequeue but only if they were gotoEnd.
  17278. if ( dequeue || !gotoEnd ) {
  17279. jQuery.dequeue( this, type );
  17280. }
  17281. } );
  17282. },
  17283. finish: function( type ) {
  17284. if ( type !== false ) {
  17285. type = type || "fx";
  17286. }
  17287. return this.each( function() {
  17288. var index,
  17289. data = dataPriv.get( this ),
  17290. queue = data[ type + "queue" ],
  17291. hooks = data[ type + "queueHooks" ],
  17292. timers = jQuery.timers,
  17293. length = queue ? queue.length : 0;
  17294. // Enable finishing flag on private data
  17295. data.finish = true;
  17296. // Empty the queue first
  17297. jQuery.queue( this, type, [] );
  17298. if ( hooks && hooks.stop ) {
  17299. hooks.stop.call( this, true );
  17300. }
  17301. // Look for any active animations, and finish them
  17302. for ( index = timers.length; index--; ) {
  17303. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  17304. timers[ index ].anim.stop( true );
  17305. timers.splice( index, 1 );
  17306. }
  17307. }
  17308. // Look for any animations in the old queue and finish them
  17309. for ( index = 0; index < length; index++ ) {
  17310. if ( queue[ index ] && queue[ index ].finish ) {
  17311. queue[ index ].finish.call( this );
  17312. }
  17313. }
  17314. // Turn off finishing flag
  17315. delete data.finish;
  17316. } );
  17317. }
  17318. } );
  17319. jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) {
  17320. var cssFn = jQuery.fn[ name ];
  17321. jQuery.fn[ name ] = function( speed, easing, callback ) {
  17322. return speed == null || typeof speed === "boolean" ?
  17323. cssFn.apply( this, arguments ) :
  17324. this.animate( genFx( name, true ), speed, easing, callback );
  17325. };
  17326. } );
  17327. // Generate shortcuts for custom animations
  17328. jQuery.each( {
  17329. slideDown: genFx( "show" ),
  17330. slideUp: genFx( "hide" ),
  17331. slideToggle: genFx( "toggle" ),
  17332. fadeIn: { opacity: "show" },
  17333. fadeOut: { opacity: "hide" },
  17334. fadeToggle: { opacity: "toggle" }
  17335. }, function( name, props ) {
  17336. jQuery.fn[ name ] = function( speed, easing, callback ) {
  17337. return this.animate( props, speed, easing, callback );
  17338. };
  17339. } );
  17340. jQuery.timers = [];
  17341. jQuery.fx.tick = function() {
  17342. var timer,
  17343. i = 0,
  17344. timers = jQuery.timers;
  17345. fxNow = Date.now();
  17346. for ( ; i < timers.length; i++ ) {
  17347. timer = timers[ i ];
  17348. // Run the timer and safely remove it when done (allowing for external removal)
  17349. if ( !timer() && timers[ i ] === timer ) {
  17350. timers.splice( i--, 1 );
  17351. }
  17352. }
  17353. if ( !timers.length ) {
  17354. jQuery.fx.stop();
  17355. }
  17356. fxNow = undefined;
  17357. };
  17358. jQuery.fx.timer = function( timer ) {
  17359. jQuery.timers.push( timer );
  17360. jQuery.fx.start();
  17361. };
  17362. jQuery.fx.interval = 13;
  17363. jQuery.fx.start = function() {
  17364. if ( inProgress ) {
  17365. return;
  17366. }
  17367. inProgress = true;
  17368. schedule();
  17369. };
  17370. jQuery.fx.stop = function() {
  17371. inProgress = null;
  17372. };
  17373. jQuery.fx.speeds = {
  17374. slow: 600,
  17375. fast: 200,
  17376. // Default speed
  17377. _default: 400
  17378. };
  17379. // Based off of the plugin by Clint Helfers, with permission.
  17380. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  17381. jQuery.fn.delay = function( time, type ) {
  17382. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  17383. type = type || "fx";
  17384. return this.queue( type, function( next, hooks ) {
  17385. var timeout = window.setTimeout( next, time );
  17386. hooks.stop = function() {
  17387. window.clearTimeout( timeout );
  17388. };
  17389. } );
  17390. };
  17391. ( function() {
  17392. var input = document.createElement( "input" ),
  17393. select = document.createElement( "select" ),
  17394. opt = select.appendChild( document.createElement( "option" ) );
  17395. input.type = "checkbox";
  17396. // Support: Android <=4.3 only
  17397. // Default value for a checkbox should be "on"
  17398. support.checkOn = input.value !== "";
  17399. // Support: IE <=11 only
  17400. // Must access selectedIndex to make default options select
  17401. support.optSelected = opt.selected;
  17402. // Support: IE <=11 only
  17403. // An input loses its value after becoming a radio
  17404. input = document.createElement( "input" );
  17405. input.value = "t";
  17406. input.type = "radio";
  17407. support.radioValue = input.value === "t";
  17408. } )();
  17409. var boolHook,
  17410. attrHandle = jQuery.expr.attrHandle;
  17411. jQuery.fn.extend( {
  17412. attr: function( name, value ) {
  17413. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  17414. },
  17415. removeAttr: function( name ) {
  17416. return this.each( function() {
  17417. jQuery.removeAttr( this, name );
  17418. } );
  17419. }
  17420. } );
  17421. jQuery.extend( {
  17422. attr: function( elem, name, value ) {
  17423. var ret, hooks,
  17424. nType = elem.nodeType;
  17425. // Don't get/set attributes on text, comment and attribute nodes
  17426. if ( nType === 3 || nType === 8 || nType === 2 ) {
  17427. return;
  17428. }
  17429. // Fallback to prop when attributes are not supported
  17430. if ( typeof elem.getAttribute === "undefined" ) {
  17431. return jQuery.prop( elem, name, value );
  17432. }
  17433. // Attribute hooks are determined by the lowercase version
  17434. // Grab necessary hook if one is defined
  17435. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  17436. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  17437. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  17438. }
  17439. if ( value !== undefined ) {
  17440. if ( value === null ) {
  17441. jQuery.removeAttr( elem, name );
  17442. return;
  17443. }
  17444. if ( hooks && "set" in hooks &&
  17445. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  17446. return ret;
  17447. }
  17448. elem.setAttribute( name, value + "" );
  17449. return value;
  17450. }
  17451. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  17452. return ret;
  17453. }
  17454. ret = jQuery.find.attr( elem, name );
  17455. // Non-existent attributes return null, we normalize to undefined
  17456. return ret == null ? undefined : ret;
  17457. },
  17458. attrHooks: {
  17459. type: {
  17460. set: function( elem, value ) {
  17461. if ( !support.radioValue && value === "radio" &&
  17462. nodeName( elem, "input" ) ) {
  17463. var val = elem.value;
  17464. elem.setAttribute( "type", value );
  17465. if ( val ) {
  17466. elem.value = val;
  17467. }
  17468. return value;
  17469. }
  17470. }
  17471. }
  17472. },
  17473. removeAttr: function( elem, value ) {
  17474. var name,
  17475. i = 0,
  17476. // Attribute names can contain non-HTML whitespace characters
  17477. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  17478. attrNames = value && value.match( rnothtmlwhite );
  17479. if ( attrNames && elem.nodeType === 1 ) {
  17480. while ( ( name = attrNames[ i++ ] ) ) {
  17481. elem.removeAttribute( name );
  17482. }
  17483. }
  17484. }
  17485. } );
  17486. // Hooks for boolean attributes
  17487. boolHook = {
  17488. set: function( elem, value, name ) {
  17489. if ( value === false ) {
  17490. // Remove boolean attributes when set to false
  17491. jQuery.removeAttr( elem, name );
  17492. } else {
  17493. elem.setAttribute( name, name );
  17494. }
  17495. return name;
  17496. }
  17497. };
  17498. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
  17499. var getter = attrHandle[ name ] || jQuery.find.attr;
  17500. attrHandle[ name ] = function( elem, name, isXML ) {
  17501. var ret, handle,
  17502. lowercaseName = name.toLowerCase();
  17503. if ( !isXML ) {
  17504. // Avoid an infinite loop by temporarily removing this function from the getter
  17505. handle = attrHandle[ lowercaseName ];
  17506. attrHandle[ lowercaseName ] = ret;
  17507. ret = getter( elem, name, isXML ) != null ?
  17508. lowercaseName :
  17509. null;
  17510. attrHandle[ lowercaseName ] = handle;
  17511. }
  17512. return ret;
  17513. };
  17514. } );
  17515. var rfocusable = /^(?:input|select|textarea|button)$/i,
  17516. rclickable = /^(?:a|area)$/i;
  17517. jQuery.fn.extend( {
  17518. prop: function( name, value ) {
  17519. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  17520. },
  17521. removeProp: function( name ) {
  17522. return this.each( function() {
  17523. delete this[ jQuery.propFix[ name ] || name ];
  17524. } );
  17525. }
  17526. } );
  17527. jQuery.extend( {
  17528. prop: function( elem, name, value ) {
  17529. var ret, hooks,
  17530. nType = elem.nodeType;
  17531. // Don't get/set properties on text, comment and attribute nodes
  17532. if ( nType === 3 || nType === 8 || nType === 2 ) {
  17533. return;
  17534. }
  17535. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  17536. // Fix name and attach hooks
  17537. name = jQuery.propFix[ name ] || name;
  17538. hooks = jQuery.propHooks[ name ];
  17539. }
  17540. if ( value !== undefined ) {
  17541. if ( hooks && "set" in hooks &&
  17542. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  17543. return ret;
  17544. }
  17545. return ( elem[ name ] = value );
  17546. }
  17547. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  17548. return ret;
  17549. }
  17550. return elem[ name ];
  17551. },
  17552. propHooks: {
  17553. tabIndex: {
  17554. get: function( elem ) {
  17555. // Support: IE <=9 - 11 only
  17556. // elem.tabIndex doesn't always return the
  17557. // correct value when it hasn't been explicitly set
  17558. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  17559. // Use proper attribute retrieval(#12072)
  17560. var tabindex = jQuery.find.attr( elem, "tabindex" );
  17561. if ( tabindex ) {
  17562. return parseInt( tabindex, 10 );
  17563. }
  17564. if (
  17565. rfocusable.test( elem.nodeName ) ||
  17566. rclickable.test( elem.nodeName ) &&
  17567. elem.href
  17568. ) {
  17569. return 0;
  17570. }
  17571. return -1;
  17572. }
  17573. }
  17574. },
  17575. propFix: {
  17576. "for": "htmlFor",
  17577. "class": "className"
  17578. }
  17579. } );
  17580. // Support: IE <=11 only
  17581. // Accessing the selectedIndex property
  17582. // forces the browser to respect setting selected
  17583. // on the option
  17584. // The getter ensures a default option is selected
  17585. // when in an optgroup
  17586. // eslint rule "no-unused-expressions" is disabled for this code
  17587. // since it considers such accessions noop
  17588. if ( !support.optSelected ) {
  17589. jQuery.propHooks.selected = {
  17590. get: function( elem ) {
  17591. /* eslint no-unused-expressions: "off" */
  17592. var parent = elem.parentNode;
  17593. if ( parent && parent.parentNode ) {
  17594. parent.parentNode.selectedIndex;
  17595. }
  17596. return null;
  17597. },
  17598. set: function( elem ) {
  17599. /* eslint no-unused-expressions: "off" */
  17600. var parent = elem.parentNode;
  17601. if ( parent ) {
  17602. parent.selectedIndex;
  17603. if ( parent.parentNode ) {
  17604. parent.parentNode.selectedIndex;
  17605. }
  17606. }
  17607. }
  17608. };
  17609. }
  17610. jQuery.each( [
  17611. "tabIndex",
  17612. "readOnly",
  17613. "maxLength",
  17614. "cellSpacing",
  17615. "cellPadding",
  17616. "rowSpan",
  17617. "colSpan",
  17618. "useMap",
  17619. "frameBorder",
  17620. "contentEditable"
  17621. ], function() {
  17622. jQuery.propFix[ this.toLowerCase() ] = this;
  17623. } );
  17624. // Strip and collapse whitespace according to HTML spec
  17625. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  17626. function stripAndCollapse( value ) {
  17627. var tokens = value.match( rnothtmlwhite ) || [];
  17628. return tokens.join( " " );
  17629. }
  17630. function getClass( elem ) {
  17631. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  17632. }
  17633. function classesToArray( value ) {
  17634. if ( Array.isArray( value ) ) {
  17635. return value;
  17636. }
  17637. if ( typeof value === "string" ) {
  17638. return value.match( rnothtmlwhite ) || [];
  17639. }
  17640. return [];
  17641. }
  17642. jQuery.fn.extend( {
  17643. addClass: function( value ) {
  17644. var classes, elem, cur, curValue, clazz, j, finalValue,
  17645. i = 0;
  17646. if ( isFunction( value ) ) {
  17647. return this.each( function( j ) {
  17648. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  17649. } );
  17650. }
  17651. classes = classesToArray( value );
  17652. if ( classes.length ) {
  17653. while ( ( elem = this[ i++ ] ) ) {
  17654. curValue = getClass( elem );
  17655. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  17656. if ( cur ) {
  17657. j = 0;
  17658. while ( ( clazz = classes[ j++ ] ) ) {
  17659. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  17660. cur += clazz + " ";
  17661. }
  17662. }
  17663. // Only assign if different to avoid unneeded rendering.
  17664. finalValue = stripAndCollapse( cur );
  17665. if ( curValue !== finalValue ) {
  17666. elem.setAttribute( "class", finalValue );
  17667. }
  17668. }
  17669. }
  17670. }
  17671. return this;
  17672. },
  17673. removeClass: function( value ) {
  17674. var classes, elem, cur, curValue, clazz, j, finalValue,
  17675. i = 0;
  17676. if ( isFunction( value ) ) {
  17677. return this.each( function( j ) {
  17678. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  17679. } );
  17680. }
  17681. if ( !arguments.length ) {
  17682. return this.attr( "class", "" );
  17683. }
  17684. classes = classesToArray( value );
  17685. if ( classes.length ) {
  17686. while ( ( elem = this[ i++ ] ) ) {
  17687. curValue = getClass( elem );
  17688. // This expression is here for better compressibility (see addClass)
  17689. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  17690. if ( cur ) {
  17691. j = 0;
  17692. while ( ( clazz = classes[ j++ ] ) ) {
  17693. // Remove *all* instances
  17694. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  17695. cur = cur.replace( " " + clazz + " ", " " );
  17696. }
  17697. }
  17698. // Only assign if different to avoid unneeded rendering.
  17699. finalValue = stripAndCollapse( cur );
  17700. if ( curValue !== finalValue ) {
  17701. elem.setAttribute( "class", finalValue );
  17702. }
  17703. }
  17704. }
  17705. }
  17706. return this;
  17707. },
  17708. toggleClass: function( value, stateVal ) {
  17709. var type = typeof value,
  17710. isValidValue = type === "string" || Array.isArray( value );
  17711. if ( typeof stateVal === "boolean" && isValidValue ) {
  17712. return stateVal ? this.addClass( value ) : this.removeClass( value );
  17713. }
  17714. if ( isFunction( value ) ) {
  17715. return this.each( function( i ) {
  17716. jQuery( this ).toggleClass(
  17717. value.call( this, i, getClass( this ), stateVal ),
  17718. stateVal
  17719. );
  17720. } );
  17721. }
  17722. return this.each( function() {
  17723. var className, i, self, classNames;
  17724. if ( isValidValue ) {
  17725. // Toggle individual class names
  17726. i = 0;
  17727. self = jQuery( this );
  17728. classNames = classesToArray( value );
  17729. while ( ( className = classNames[ i++ ] ) ) {
  17730. // Check each className given, space separated list
  17731. if ( self.hasClass( className ) ) {
  17732. self.removeClass( className );
  17733. } else {
  17734. self.addClass( className );
  17735. }
  17736. }
  17737. // Toggle whole class name
  17738. } else if ( value === undefined || type === "boolean" ) {
  17739. className = getClass( this );
  17740. if ( className ) {
  17741. // Store className if set
  17742. dataPriv.set( this, "__className__", className );
  17743. }
  17744. // If the element has a class name or if we're passed `false`,
  17745. // then remove the whole classname (if there was one, the above saved it).
  17746. // Otherwise bring back whatever was previously saved (if anything),
  17747. // falling back to the empty string if nothing was stored.
  17748. if ( this.setAttribute ) {
  17749. this.setAttribute( "class",
  17750. className || value === false ?
  17751. "" :
  17752. dataPriv.get( this, "__className__" ) || ""
  17753. );
  17754. }
  17755. }
  17756. } );
  17757. },
  17758. hasClass: function( selector ) {
  17759. var className, elem,
  17760. i = 0;
  17761. className = " " + selector + " ";
  17762. while ( ( elem = this[ i++ ] ) ) {
  17763. if ( elem.nodeType === 1 &&
  17764. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  17765. return true;
  17766. }
  17767. }
  17768. return false;
  17769. }
  17770. } );
  17771. var rreturn = /\r/g;
  17772. jQuery.fn.extend( {
  17773. val: function( value ) {
  17774. var hooks, ret, valueIsFunction,
  17775. elem = this[ 0 ];
  17776. if ( !arguments.length ) {
  17777. if ( elem ) {
  17778. hooks = jQuery.valHooks[ elem.type ] ||
  17779. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  17780. if ( hooks &&
  17781. "get" in hooks &&
  17782. ( ret = hooks.get( elem, "value" ) ) !== undefined
  17783. ) {
  17784. return ret;
  17785. }
  17786. ret = elem.value;
  17787. // Handle most common string cases
  17788. if ( typeof ret === "string" ) {
  17789. return ret.replace( rreturn, "" );
  17790. }
  17791. // Handle cases where value is null/undef or number
  17792. return ret == null ? "" : ret;
  17793. }
  17794. return;
  17795. }
  17796. valueIsFunction = isFunction( value );
  17797. return this.each( function( i ) {
  17798. var val;
  17799. if ( this.nodeType !== 1 ) {
  17800. return;
  17801. }
  17802. if ( valueIsFunction ) {
  17803. val = value.call( this, i, jQuery( this ).val() );
  17804. } else {
  17805. val = value;
  17806. }
  17807. // Treat null/undefined as ""; convert numbers to string
  17808. if ( val == null ) {
  17809. val = "";
  17810. } else if ( typeof val === "number" ) {
  17811. val += "";
  17812. } else if ( Array.isArray( val ) ) {
  17813. val = jQuery.map( val, function( value ) {
  17814. return value == null ? "" : value + "";
  17815. } );
  17816. }
  17817. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  17818. // If set returns undefined, fall back to normal setting
  17819. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  17820. this.value = val;
  17821. }
  17822. } );
  17823. }
  17824. } );
  17825. jQuery.extend( {
  17826. valHooks: {
  17827. option: {
  17828. get: function( elem ) {
  17829. var val = jQuery.find.attr( elem, "value" );
  17830. return val != null ?
  17831. val :
  17832. // Support: IE <=10 - 11 only
  17833. // option.text throws exceptions (#14686, #14858)
  17834. // Strip and collapse whitespace
  17835. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  17836. stripAndCollapse( jQuery.text( elem ) );
  17837. }
  17838. },
  17839. select: {
  17840. get: function( elem ) {
  17841. var value, option, i,
  17842. options = elem.options,
  17843. index = elem.selectedIndex,
  17844. one = elem.type === "select-one",
  17845. values = one ? null : [],
  17846. max = one ? index + 1 : options.length;
  17847. if ( index < 0 ) {
  17848. i = max;
  17849. } else {
  17850. i = one ? index : 0;
  17851. }
  17852. // Loop through all the selected options
  17853. for ( ; i < max; i++ ) {
  17854. option = options[ i ];
  17855. // Support: IE <=9 only
  17856. // IE8-9 doesn't update selected after form reset (#2551)
  17857. if ( ( option.selected || i === index ) &&
  17858. // Don't return options that are disabled or in a disabled optgroup
  17859. !option.disabled &&
  17860. ( !option.parentNode.disabled ||
  17861. !nodeName( option.parentNode, "optgroup" ) ) ) {
  17862. // Get the specific value for the option
  17863. value = jQuery( option ).val();
  17864. // We don't need an array for one selects
  17865. if ( one ) {
  17866. return value;
  17867. }
  17868. // Multi-Selects return an array
  17869. values.push( value );
  17870. }
  17871. }
  17872. return values;
  17873. },
  17874. set: function( elem, value ) {
  17875. var optionSet, option,
  17876. options = elem.options,
  17877. values = jQuery.makeArray( value ),
  17878. i = options.length;
  17879. while ( i-- ) {
  17880. option = options[ i ];
  17881. /* eslint-disable no-cond-assign */
  17882. if ( option.selected =
  17883. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  17884. ) {
  17885. optionSet = true;
  17886. }
  17887. /* eslint-enable no-cond-assign */
  17888. }
  17889. // Force browsers to behave consistently when non-matching value is set
  17890. if ( !optionSet ) {
  17891. elem.selectedIndex = -1;
  17892. }
  17893. return values;
  17894. }
  17895. }
  17896. }
  17897. } );
  17898. // Radios and checkboxes getter/setter
  17899. jQuery.each( [ "radio", "checkbox" ], function() {
  17900. jQuery.valHooks[ this ] = {
  17901. set: function( elem, value ) {
  17902. if ( Array.isArray( value ) ) {
  17903. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  17904. }
  17905. }
  17906. };
  17907. if ( !support.checkOn ) {
  17908. jQuery.valHooks[ this ].get = function( elem ) {
  17909. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  17910. };
  17911. }
  17912. } );
  17913. // Return jQuery for attributes-only inclusion
  17914. support.focusin = "onfocusin" in window;
  17915. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  17916. stopPropagationCallback = function( e ) {
  17917. e.stopPropagation();
  17918. };
  17919. jQuery.extend( jQuery.event, {
  17920. trigger: function( event, data, elem, onlyHandlers ) {
  17921. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  17922. eventPath = [ elem || document ],
  17923. type = hasOwn.call( event, "type" ) ? event.type : event,
  17924. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  17925. cur = lastElement = tmp = elem = elem || document;
  17926. // Don't do events on text and comment nodes
  17927. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  17928. return;
  17929. }
  17930. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  17931. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  17932. return;
  17933. }
  17934. if ( type.indexOf( "." ) > -1 ) {
  17935. // Namespaced trigger; create a regexp to match event type in handle()
  17936. namespaces = type.split( "." );
  17937. type = namespaces.shift();
  17938. namespaces.sort();
  17939. }
  17940. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  17941. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  17942. event = event[ jQuery.expando ] ?
  17943. event :
  17944. new jQuery.Event( type, typeof event === "object" && event );
  17945. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  17946. event.isTrigger = onlyHandlers ? 2 : 3;
  17947. event.namespace = namespaces.join( "." );
  17948. event.rnamespace = event.namespace ?
  17949. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  17950. null;
  17951. // Clean up the event in case it is being reused
  17952. event.result = undefined;
  17953. if ( !event.target ) {
  17954. event.target = elem;
  17955. }
  17956. // Clone any incoming data and prepend the event, creating the handler arg list
  17957. data = data == null ?
  17958. [ event ] :
  17959. jQuery.makeArray( data, [ event ] );
  17960. // Allow special events to draw outside the lines
  17961. special = jQuery.event.special[ type ] || {};
  17962. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  17963. return;
  17964. }
  17965. // Determine event propagation path in advance, per W3C events spec (#9951)
  17966. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  17967. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  17968. bubbleType = special.delegateType || type;
  17969. if ( !rfocusMorph.test( bubbleType + type ) ) {
  17970. cur = cur.parentNode;
  17971. }
  17972. for ( ; cur; cur = cur.parentNode ) {
  17973. eventPath.push( cur );
  17974. tmp = cur;
  17975. }
  17976. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  17977. if ( tmp === ( elem.ownerDocument || document ) ) {
  17978. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  17979. }
  17980. }
  17981. // Fire handlers on the event path
  17982. i = 0;
  17983. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  17984. lastElement = cur;
  17985. event.type = i > 1 ?
  17986. bubbleType :
  17987. special.bindType || type;
  17988. // jQuery handler
  17989. handle = (
  17990. dataPriv.get( cur, "events" ) || Object.create( null )
  17991. )[ event.type ] &&
  17992. dataPriv.get( cur, "handle" );
  17993. if ( handle ) {
  17994. handle.apply( cur, data );
  17995. }
  17996. // Native handler
  17997. handle = ontype && cur[ ontype ];
  17998. if ( handle && handle.apply && acceptData( cur ) ) {
  17999. event.result = handle.apply( cur, data );
  18000. if ( event.result === false ) {
  18001. event.preventDefault();
  18002. }
  18003. }
  18004. }
  18005. event.type = type;
  18006. // If nobody prevented the default action, do it now
  18007. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  18008. if ( ( !special._default ||
  18009. special._default.apply( eventPath.pop(), data ) === false ) &&
  18010. acceptData( elem ) ) {
  18011. // Call a native DOM method on the target with the same name as the event.
  18012. // Don't do default actions on window, that's where global variables be (#6170)
  18013. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  18014. // Don't re-trigger an onFOO event when we call its FOO() method
  18015. tmp = elem[ ontype ];
  18016. if ( tmp ) {
  18017. elem[ ontype ] = null;
  18018. }
  18019. // Prevent re-triggering of the same event, since we already bubbled it above
  18020. jQuery.event.triggered = type;
  18021. if ( event.isPropagationStopped() ) {
  18022. lastElement.addEventListener( type, stopPropagationCallback );
  18023. }
  18024. elem[ type ]();
  18025. if ( event.isPropagationStopped() ) {
  18026. lastElement.removeEventListener( type, stopPropagationCallback );
  18027. }
  18028. jQuery.event.triggered = undefined;
  18029. if ( tmp ) {
  18030. elem[ ontype ] = tmp;
  18031. }
  18032. }
  18033. }
  18034. }
  18035. return event.result;
  18036. },
  18037. // Piggyback on a donor event to simulate a different one
  18038. // Used only for `focus(in | out)` events
  18039. simulate: function( type, elem, event ) {
  18040. var e = jQuery.extend(
  18041. new jQuery.Event(),
  18042. event,
  18043. {
  18044. type: type,
  18045. isSimulated: true
  18046. }
  18047. );
  18048. jQuery.event.trigger( e, null, elem );
  18049. }
  18050. } );
  18051. jQuery.fn.extend( {
  18052. trigger: function( type, data ) {
  18053. return this.each( function() {
  18054. jQuery.event.trigger( type, data, this );
  18055. } );
  18056. },
  18057. triggerHandler: function( type, data ) {
  18058. var elem = this[ 0 ];
  18059. if ( elem ) {
  18060. return jQuery.event.trigger( type, data, elem, true );
  18061. }
  18062. }
  18063. } );
  18064. // Support: Firefox <=44
  18065. // Firefox doesn't have focus(in | out) events
  18066. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  18067. //
  18068. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  18069. // focus(in | out) events fire after focus & blur events,
  18070. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  18071. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  18072. if ( !support.focusin ) {
  18073. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  18074. // Attach a single capturing handler on the document while someone wants focusin/focusout
  18075. var handler = function( event ) {
  18076. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  18077. };
  18078. jQuery.event.special[ fix ] = {
  18079. setup: function() {
  18080. // Handle: regular nodes (via `this.ownerDocument`), window
  18081. // (via `this.document`) & document (via `this`).
  18082. var doc = this.ownerDocument || this.document || this,
  18083. attaches = dataPriv.access( doc, fix );
  18084. if ( !attaches ) {
  18085. doc.addEventListener( orig, handler, true );
  18086. }
  18087. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  18088. },
  18089. teardown: function() {
  18090. var doc = this.ownerDocument || this.document || this,
  18091. attaches = dataPriv.access( doc, fix ) - 1;
  18092. if ( !attaches ) {
  18093. doc.removeEventListener( orig, handler, true );
  18094. dataPriv.remove( doc, fix );
  18095. } else {
  18096. dataPriv.access( doc, fix, attaches );
  18097. }
  18098. }
  18099. };
  18100. } );
  18101. }
  18102. var location = window.location;
  18103. var nonce = { guid: Date.now() };
  18104. var rquery = ( /\?/ );
  18105. // Cross-browser xml parsing
  18106. jQuery.parseXML = function( data ) {
  18107. var xml;
  18108. if ( !data || typeof data !== "string" ) {
  18109. return null;
  18110. }
  18111. // Support: IE 9 - 11 only
  18112. // IE throws on parseFromString with invalid input.
  18113. try {
  18114. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  18115. } catch ( e ) {
  18116. xml = undefined;
  18117. }
  18118. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  18119. jQuery.error( "Invalid XML: " + data );
  18120. }
  18121. return xml;
  18122. };
  18123. var
  18124. rbracket = /\[\]$/,
  18125. rCRLF = /\r?\n/g,
  18126. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  18127. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  18128. function buildParams( prefix, obj, traditional, add ) {
  18129. var name;
  18130. if ( Array.isArray( obj ) ) {
  18131. // Serialize array item.
  18132. jQuery.each( obj, function( i, v ) {
  18133. if ( traditional || rbracket.test( prefix ) ) {
  18134. // Treat each array item as a scalar.
  18135. add( prefix, v );
  18136. } else {
  18137. // Item is non-scalar (array or object), encode its numeric index.
  18138. buildParams(
  18139. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  18140. v,
  18141. traditional,
  18142. add
  18143. );
  18144. }
  18145. } );
  18146. } else if ( !traditional && toType( obj ) === "object" ) {
  18147. // Serialize object item.
  18148. for ( name in obj ) {
  18149. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  18150. }
  18151. } else {
  18152. // Serialize scalar item.
  18153. add( prefix, obj );
  18154. }
  18155. }
  18156. // Serialize an array of form elements or a set of
  18157. // key/values into a query string
  18158. jQuery.param = function( a, traditional ) {
  18159. var prefix,
  18160. s = [],
  18161. add = function( key, valueOrFunction ) {
  18162. // If value is a function, invoke it and use its return value
  18163. var value = isFunction( valueOrFunction ) ?
  18164. valueOrFunction() :
  18165. valueOrFunction;
  18166. s[ s.length ] = encodeURIComponent( key ) + "=" +
  18167. encodeURIComponent( value == null ? "" : value );
  18168. };
  18169. if ( a == null ) {
  18170. return "";
  18171. }
  18172. // If an array was passed in, assume that it is an array of form elements.
  18173. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  18174. // Serialize the form elements
  18175. jQuery.each( a, function() {
  18176. add( this.name, this.value );
  18177. } );
  18178. } else {
  18179. // If traditional, encode the "old" way (the way 1.3.2 or older
  18180. // did it), otherwise encode params recursively.
  18181. for ( prefix in a ) {
  18182. buildParams( prefix, a[ prefix ], traditional, add );
  18183. }
  18184. }
  18185. // Return the resulting serialization
  18186. return s.join( "&" );
  18187. };
  18188. jQuery.fn.extend( {
  18189. serialize: function() {
  18190. return jQuery.param( this.serializeArray() );
  18191. },
  18192. serializeArray: function() {
  18193. return this.map( function() {
  18194. // Can add propHook for "elements" to filter or add form elements
  18195. var elements = jQuery.prop( this, "elements" );
  18196. return elements ? jQuery.makeArray( elements ) : this;
  18197. } )
  18198. .filter( function() {
  18199. var type = this.type;
  18200. // Use .is( ":disabled" ) so that fieldset[disabled] works
  18201. return this.name && !jQuery( this ).is( ":disabled" ) &&
  18202. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  18203. ( this.checked || !rcheckableType.test( type ) );
  18204. } )
  18205. .map( function( _i, elem ) {
  18206. var val = jQuery( this ).val();
  18207. if ( val == null ) {
  18208. return null;
  18209. }
  18210. if ( Array.isArray( val ) ) {
  18211. return jQuery.map( val, function( val ) {
  18212. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  18213. } );
  18214. }
  18215. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  18216. } ).get();
  18217. }
  18218. } );
  18219. var
  18220. r20 = /%20/g,
  18221. rhash = /#.*$/,
  18222. rantiCache = /([?&])_=[^&]*/,
  18223. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  18224. // #7653, #8125, #8152: local protocol detection
  18225. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  18226. rnoContent = /^(?:GET|HEAD)$/,
  18227. rprotocol = /^\/\//,
  18228. /* Prefilters
  18229. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  18230. * 2) These are called:
  18231. * - BEFORE asking for a transport
  18232. * - AFTER param serialization (s.data is a string if s.processData is true)
  18233. * 3) key is the dataType
  18234. * 4) the catchall symbol "*" can be used
  18235. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  18236. */
  18237. prefilters = {},
  18238. /* Transports bindings
  18239. * 1) key is the dataType
  18240. * 2) the catchall symbol "*" can be used
  18241. * 3) selection will start with transport dataType and THEN go to "*" if needed
  18242. */
  18243. transports = {},
  18244. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  18245. allTypes = "*/".concat( "*" ),
  18246. // Anchor tag for parsing the document origin
  18247. originAnchor = document.createElement( "a" );
  18248. originAnchor.href = location.href;
  18249. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  18250. function addToPrefiltersOrTransports( structure ) {
  18251. // dataTypeExpression is optional and defaults to "*"
  18252. return function( dataTypeExpression, func ) {
  18253. if ( typeof dataTypeExpression !== "string" ) {
  18254. func = dataTypeExpression;
  18255. dataTypeExpression = "*";
  18256. }
  18257. var dataType,
  18258. i = 0,
  18259. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  18260. if ( isFunction( func ) ) {
  18261. // For each dataType in the dataTypeExpression
  18262. while ( ( dataType = dataTypes[ i++ ] ) ) {
  18263. // Prepend if requested
  18264. if ( dataType[ 0 ] === "+" ) {
  18265. dataType = dataType.slice( 1 ) || "*";
  18266. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  18267. // Otherwise append
  18268. } else {
  18269. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  18270. }
  18271. }
  18272. }
  18273. };
  18274. }
  18275. // Base inspection function for prefilters and transports
  18276. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  18277. var inspected = {},
  18278. seekingTransport = ( structure === transports );
  18279. function inspect( dataType ) {
  18280. var selected;
  18281. inspected[ dataType ] = true;
  18282. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  18283. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  18284. if ( typeof dataTypeOrTransport === "string" &&
  18285. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  18286. options.dataTypes.unshift( dataTypeOrTransport );
  18287. inspect( dataTypeOrTransport );
  18288. return false;
  18289. } else if ( seekingTransport ) {
  18290. return !( selected = dataTypeOrTransport );
  18291. }
  18292. } );
  18293. return selected;
  18294. }
  18295. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  18296. }
  18297. // A special extend for ajax options
  18298. // that takes "flat" options (not to be deep extended)
  18299. // Fixes #9887
  18300. function ajaxExtend( target, src ) {
  18301. var key, deep,
  18302. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  18303. for ( key in src ) {
  18304. if ( src[ key ] !== undefined ) {
  18305. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  18306. }
  18307. }
  18308. if ( deep ) {
  18309. jQuery.extend( true, target, deep );
  18310. }
  18311. return target;
  18312. }
  18313. /* Handles responses to an ajax request:
  18314. * - finds the right dataType (mediates between content-type and expected dataType)
  18315. * - returns the corresponding response
  18316. */
  18317. function ajaxHandleResponses( s, jqXHR, responses ) {
  18318. var ct, type, finalDataType, firstDataType,
  18319. contents = s.contents,
  18320. dataTypes = s.dataTypes;
  18321. // Remove auto dataType and get content-type in the process
  18322. while ( dataTypes[ 0 ] === "*" ) {
  18323. dataTypes.shift();
  18324. if ( ct === undefined ) {
  18325. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  18326. }
  18327. }
  18328. // Check if we're dealing with a known content-type
  18329. if ( ct ) {
  18330. for ( type in contents ) {
  18331. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  18332. dataTypes.unshift( type );
  18333. break;
  18334. }
  18335. }
  18336. }
  18337. // Check to see if we have a response for the expected dataType
  18338. if ( dataTypes[ 0 ] in responses ) {
  18339. finalDataType = dataTypes[ 0 ];
  18340. } else {
  18341. // Try convertible dataTypes
  18342. for ( type in responses ) {
  18343. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  18344. finalDataType = type;
  18345. break;
  18346. }
  18347. if ( !firstDataType ) {
  18348. firstDataType = type;
  18349. }
  18350. }
  18351. // Or just use first one
  18352. finalDataType = finalDataType || firstDataType;
  18353. }
  18354. // If we found a dataType
  18355. // We add the dataType to the list if needed
  18356. // and return the corresponding response
  18357. if ( finalDataType ) {
  18358. if ( finalDataType !== dataTypes[ 0 ] ) {
  18359. dataTypes.unshift( finalDataType );
  18360. }
  18361. return responses[ finalDataType ];
  18362. }
  18363. }
  18364. /* Chain conversions given the request and the original response
  18365. * Also sets the responseXXX fields on the jqXHR instance
  18366. */
  18367. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  18368. var conv2, current, conv, tmp, prev,
  18369. converters = {},
  18370. // Work with a copy of dataTypes in case we need to modify it for conversion
  18371. dataTypes = s.dataTypes.slice();
  18372. // Create converters map with lowercased keys
  18373. if ( dataTypes[ 1 ] ) {
  18374. for ( conv in s.converters ) {
  18375. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  18376. }
  18377. }
  18378. current = dataTypes.shift();
  18379. // Convert to each sequential dataType
  18380. while ( current ) {
  18381. if ( s.responseFields[ current ] ) {
  18382. jqXHR[ s.responseFields[ current ] ] = response;
  18383. }
  18384. // Apply the dataFilter if provided
  18385. if ( !prev && isSuccess && s.dataFilter ) {
  18386. response = s.dataFilter( response, s.dataType );
  18387. }
  18388. prev = current;
  18389. current = dataTypes.shift();
  18390. if ( current ) {
  18391. // There's only work to do if current dataType is non-auto
  18392. if ( current === "*" ) {
  18393. current = prev;
  18394. // Convert response if prev dataType is non-auto and differs from current
  18395. } else if ( prev !== "*" && prev !== current ) {
  18396. // Seek a direct converter
  18397. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  18398. // If none found, seek a pair
  18399. if ( !conv ) {
  18400. for ( conv2 in converters ) {
  18401. // If conv2 outputs current
  18402. tmp = conv2.split( " " );
  18403. if ( tmp[ 1 ] === current ) {
  18404. // If prev can be converted to accepted input
  18405. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  18406. converters[ "* " + tmp[ 0 ] ];
  18407. if ( conv ) {
  18408. // Condense equivalence converters
  18409. if ( conv === true ) {
  18410. conv = converters[ conv2 ];
  18411. // Otherwise, insert the intermediate dataType
  18412. } else if ( converters[ conv2 ] !== true ) {
  18413. current = tmp[ 0 ];
  18414. dataTypes.unshift( tmp[ 1 ] );
  18415. }
  18416. break;
  18417. }
  18418. }
  18419. }
  18420. }
  18421. // Apply converter (if not an equivalence)
  18422. if ( conv !== true ) {
  18423. // Unless errors are allowed to bubble, catch and return them
  18424. if ( conv && s.throws ) {
  18425. response = conv( response );
  18426. } else {
  18427. try {
  18428. response = conv( response );
  18429. } catch ( e ) {
  18430. return {
  18431. state: "parsererror",
  18432. error: conv ? e : "No conversion from " + prev + " to " + current
  18433. };
  18434. }
  18435. }
  18436. }
  18437. }
  18438. }
  18439. }
  18440. return { state: "success", data: response };
  18441. }
  18442. jQuery.extend( {
  18443. // Counter for holding the number of active queries
  18444. active: 0,
  18445. // Last-Modified header cache for next request
  18446. lastModified: {},
  18447. etag: {},
  18448. ajaxSettings: {
  18449. url: location.href,
  18450. type: "GET",
  18451. isLocal: rlocalProtocol.test( location.protocol ),
  18452. global: true,
  18453. processData: true,
  18454. async: true,
  18455. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  18456. /*
  18457. timeout: 0,
  18458. data: null,
  18459. dataType: null,
  18460. username: null,
  18461. password: null,
  18462. cache: null,
  18463. throws: false,
  18464. traditional: false,
  18465. headers: {},
  18466. */
  18467. accepts: {
  18468. "*": allTypes,
  18469. text: "text/plain",
  18470. html: "text/html",
  18471. xml: "application/xml, text/xml",
  18472. json: "application/json, text/javascript"
  18473. },
  18474. contents: {
  18475. xml: /\bxml\b/,
  18476. html: /\bhtml/,
  18477. json: /\bjson\b/
  18478. },
  18479. responseFields: {
  18480. xml: "responseXML",
  18481. text: "responseText",
  18482. json: "responseJSON"
  18483. },
  18484. // Data converters
  18485. // Keys separate source (or catchall "*") and destination types with a single space
  18486. converters: {
  18487. // Convert anything to text
  18488. "* text": String,
  18489. // Text to html (true = no transformation)
  18490. "text html": true,
  18491. // Evaluate text as a json expression
  18492. "text json": JSON.parse,
  18493. // Parse text as xml
  18494. "text xml": jQuery.parseXML
  18495. },
  18496. // For options that shouldn't be deep extended:
  18497. // you can add your own custom options here if
  18498. // and when you create one that shouldn't be
  18499. // deep extended (see ajaxExtend)
  18500. flatOptions: {
  18501. url: true,
  18502. context: true
  18503. }
  18504. },
  18505. // Creates a full fledged settings object into target
  18506. // with both ajaxSettings and settings fields.
  18507. // If target is omitted, writes into ajaxSettings.
  18508. ajaxSetup: function( target, settings ) {
  18509. return settings ?
  18510. // Building a settings object
  18511. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  18512. // Extending ajaxSettings
  18513. ajaxExtend( jQuery.ajaxSettings, target );
  18514. },
  18515. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  18516. ajaxTransport: addToPrefiltersOrTransports( transports ),
  18517. // Main method
  18518. ajax: function( url, options ) {
  18519. // If url is an object, simulate pre-1.5 signature
  18520. if ( typeof url === "object" ) {
  18521. options = url;
  18522. url = undefined;
  18523. }
  18524. // Force options to be an object
  18525. options = options || {};
  18526. var transport,
  18527. // URL without anti-cache param
  18528. cacheURL,
  18529. // Response headers
  18530. responseHeadersString,
  18531. responseHeaders,
  18532. // timeout handle
  18533. timeoutTimer,
  18534. // Url cleanup var
  18535. urlAnchor,
  18536. // Request state (becomes false upon send and true upon completion)
  18537. completed,
  18538. // To know if global events are to be dispatched
  18539. fireGlobals,
  18540. // Loop variable
  18541. i,
  18542. // uncached part of the url
  18543. uncached,
  18544. // Create the final options object
  18545. s = jQuery.ajaxSetup( {}, options ),
  18546. // Callbacks context
  18547. callbackContext = s.context || s,
  18548. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  18549. globalEventContext = s.context &&
  18550. ( callbackContext.nodeType || callbackContext.jquery ) ?
  18551. jQuery( callbackContext ) :
  18552. jQuery.event,
  18553. // Deferreds
  18554. deferred = jQuery.Deferred(),
  18555. completeDeferred = jQuery.Callbacks( "once memory" ),
  18556. // Status-dependent callbacks
  18557. statusCode = s.statusCode || {},
  18558. // Headers (they are sent all at once)
  18559. requestHeaders = {},
  18560. requestHeadersNames = {},
  18561. // Default abort message
  18562. strAbort = "canceled",
  18563. // Fake xhr
  18564. jqXHR = {
  18565. readyState: 0,
  18566. // Builds headers hashtable if needed
  18567. getResponseHeader: function( key ) {
  18568. var match;
  18569. if ( completed ) {
  18570. if ( !responseHeaders ) {
  18571. responseHeaders = {};
  18572. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  18573. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  18574. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  18575. .concat( match[ 2 ] );
  18576. }
  18577. }
  18578. match = responseHeaders[ key.toLowerCase() + " " ];
  18579. }
  18580. return match == null ? null : match.join( ", " );
  18581. },
  18582. // Raw string
  18583. getAllResponseHeaders: function() {
  18584. return completed ? responseHeadersString : null;
  18585. },
  18586. // Caches the header
  18587. setRequestHeader: function( name, value ) {
  18588. if ( completed == null ) {
  18589. name = requestHeadersNames[ name.toLowerCase() ] =
  18590. requestHeadersNames[ name.toLowerCase() ] || name;
  18591. requestHeaders[ name ] = value;
  18592. }
  18593. return this;
  18594. },
  18595. // Overrides response content-type header
  18596. overrideMimeType: function( type ) {
  18597. if ( completed == null ) {
  18598. s.mimeType = type;
  18599. }
  18600. return this;
  18601. },
  18602. // Status-dependent callbacks
  18603. statusCode: function( map ) {
  18604. var code;
  18605. if ( map ) {
  18606. if ( completed ) {
  18607. // Execute the appropriate callbacks
  18608. jqXHR.always( map[ jqXHR.status ] );
  18609. } else {
  18610. // Lazy-add the new callbacks in a way that preserves old ones
  18611. for ( code in map ) {
  18612. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  18613. }
  18614. }
  18615. }
  18616. return this;
  18617. },
  18618. // Cancel the request
  18619. abort: function( statusText ) {
  18620. var finalText = statusText || strAbort;
  18621. if ( transport ) {
  18622. transport.abort( finalText );
  18623. }
  18624. done( 0, finalText );
  18625. return this;
  18626. }
  18627. };
  18628. // Attach deferreds
  18629. deferred.promise( jqXHR );
  18630. // Add protocol if not provided (prefilters might expect it)
  18631. // Handle falsy url in the settings object (#10093: consistency with old signature)
  18632. // We also use the url parameter if available
  18633. s.url = ( ( url || s.url || location.href ) + "" )
  18634. .replace( rprotocol, location.protocol + "//" );
  18635. // Alias method option to type as per ticket #12004
  18636. s.type = options.method || options.type || s.method || s.type;
  18637. // Extract dataTypes list
  18638. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  18639. // A cross-domain request is in order when the origin doesn't match the current origin.
  18640. if ( s.crossDomain == null ) {
  18641. urlAnchor = document.createElement( "a" );
  18642. // Support: IE <=8 - 11, Edge 12 - 15
  18643. // IE throws exception on accessing the href property if url is malformed,
  18644. // e.g. http://example.com:80x/
  18645. try {
  18646. urlAnchor.href = s.url;
  18647. // Support: IE <=8 - 11 only
  18648. // Anchor's host property isn't correctly set when s.url is relative
  18649. urlAnchor.href = urlAnchor.href;
  18650. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  18651. urlAnchor.protocol + "//" + urlAnchor.host;
  18652. } catch ( e ) {
  18653. // If there is an error parsing the URL, assume it is crossDomain,
  18654. // it can be rejected by the transport if it is invalid
  18655. s.crossDomain = true;
  18656. }
  18657. }
  18658. // Convert data if not already a string
  18659. if ( s.data && s.processData && typeof s.data !== "string" ) {
  18660. s.data = jQuery.param( s.data, s.traditional );
  18661. }
  18662. // Apply prefilters
  18663. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  18664. // If request was aborted inside a prefilter, stop there
  18665. if ( completed ) {
  18666. return jqXHR;
  18667. }
  18668. // We can fire global events as of now if asked to
  18669. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  18670. fireGlobals = jQuery.event && s.global;
  18671. // Watch for a new set of requests
  18672. if ( fireGlobals && jQuery.active++ === 0 ) {
  18673. jQuery.event.trigger( "ajaxStart" );
  18674. }
  18675. // Uppercase the type
  18676. s.type = s.type.toUpperCase();
  18677. // Determine if request has content
  18678. s.hasContent = !rnoContent.test( s.type );
  18679. // Save the URL in case we're toying with the If-Modified-Since
  18680. // and/or If-None-Match header later on
  18681. // Remove hash to simplify url manipulation
  18682. cacheURL = s.url.replace( rhash, "" );
  18683. // More options handling for requests with no content
  18684. if ( !s.hasContent ) {
  18685. // Remember the hash so we can put it back
  18686. uncached = s.url.slice( cacheURL.length );
  18687. // If data is available and should be processed, append data to url
  18688. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  18689. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  18690. // #9682: remove data so that it's not used in an eventual retry
  18691. delete s.data;
  18692. }
  18693. // Add or update anti-cache param if needed
  18694. if ( s.cache === false ) {
  18695. cacheURL = cacheURL.replace( rantiCache, "$1" );
  18696. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +
  18697. uncached;
  18698. }
  18699. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  18700. s.url = cacheURL + uncached;
  18701. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  18702. } else if ( s.data && s.processData &&
  18703. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  18704. s.data = s.data.replace( r20, "+" );
  18705. }
  18706. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  18707. if ( s.ifModified ) {
  18708. if ( jQuery.lastModified[ cacheURL ] ) {
  18709. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  18710. }
  18711. if ( jQuery.etag[ cacheURL ] ) {
  18712. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  18713. }
  18714. }
  18715. // Set the correct header, if data is being sent
  18716. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  18717. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  18718. }
  18719. // Set the Accepts header for the server, depending on the dataType
  18720. jqXHR.setRequestHeader(
  18721. "Accept",
  18722. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  18723. s.accepts[ s.dataTypes[ 0 ] ] +
  18724. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  18725. s.accepts[ "*" ]
  18726. );
  18727. // Check for headers option
  18728. for ( i in s.headers ) {
  18729. jqXHR.setRequestHeader( i, s.headers[ i ] );
  18730. }
  18731. // Allow custom headers/mimetypes and early abort
  18732. if ( s.beforeSend &&
  18733. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  18734. // Abort if not done already and return
  18735. return jqXHR.abort();
  18736. }
  18737. // Aborting is no longer a cancellation
  18738. strAbort = "abort";
  18739. // Install callbacks on deferreds
  18740. completeDeferred.add( s.complete );
  18741. jqXHR.done( s.success );
  18742. jqXHR.fail( s.error );
  18743. // Get transport
  18744. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  18745. // If no transport, we auto-abort
  18746. if ( !transport ) {
  18747. done( -1, "No Transport" );
  18748. } else {
  18749. jqXHR.readyState = 1;
  18750. // Send global event
  18751. if ( fireGlobals ) {
  18752. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  18753. }
  18754. // If request was aborted inside ajaxSend, stop there
  18755. if ( completed ) {
  18756. return jqXHR;
  18757. }
  18758. // Timeout
  18759. if ( s.async && s.timeout > 0 ) {
  18760. timeoutTimer = window.setTimeout( function() {
  18761. jqXHR.abort( "timeout" );
  18762. }, s.timeout );
  18763. }
  18764. try {
  18765. completed = false;
  18766. transport.send( requestHeaders, done );
  18767. } catch ( e ) {
  18768. // Rethrow post-completion exceptions
  18769. if ( completed ) {
  18770. throw e;
  18771. }
  18772. // Propagate others as results
  18773. done( -1, e );
  18774. }
  18775. }
  18776. // Callback for when everything is done
  18777. function done( status, nativeStatusText, responses, headers ) {
  18778. var isSuccess, success, error, response, modified,
  18779. statusText = nativeStatusText;
  18780. // Ignore repeat invocations
  18781. if ( completed ) {
  18782. return;
  18783. }
  18784. completed = true;
  18785. // Clear timeout if it exists
  18786. if ( timeoutTimer ) {
  18787. window.clearTimeout( timeoutTimer );
  18788. }
  18789. // Dereference transport for early garbage collection
  18790. // (no matter how long the jqXHR object will be used)
  18791. transport = undefined;
  18792. // Cache response headers
  18793. responseHeadersString = headers || "";
  18794. // Set readyState
  18795. jqXHR.readyState = status > 0 ? 4 : 0;
  18796. // Determine if successful
  18797. isSuccess = status >= 200 && status < 300 || status === 304;
  18798. // Get response data
  18799. if ( responses ) {
  18800. response = ajaxHandleResponses( s, jqXHR, responses );
  18801. }
  18802. // Use a noop converter for missing script
  18803. if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) {
  18804. s.converters[ "text script" ] = function() {};
  18805. }
  18806. // Convert no matter what (that way responseXXX fields are always set)
  18807. response = ajaxConvert( s, response, jqXHR, isSuccess );
  18808. // If successful, handle type chaining
  18809. if ( isSuccess ) {
  18810. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  18811. if ( s.ifModified ) {
  18812. modified = jqXHR.getResponseHeader( "Last-Modified" );
  18813. if ( modified ) {
  18814. jQuery.lastModified[ cacheURL ] = modified;
  18815. }
  18816. modified = jqXHR.getResponseHeader( "etag" );
  18817. if ( modified ) {
  18818. jQuery.etag[ cacheURL ] = modified;
  18819. }
  18820. }
  18821. // if no content
  18822. if ( status === 204 || s.type === "HEAD" ) {
  18823. statusText = "nocontent";
  18824. // if not modified
  18825. } else if ( status === 304 ) {
  18826. statusText = "notmodified";
  18827. // If we have data, let's convert it
  18828. } else {
  18829. statusText = response.state;
  18830. success = response.data;
  18831. error = response.error;
  18832. isSuccess = !error;
  18833. }
  18834. } else {
  18835. // Extract error from statusText and normalize for non-aborts
  18836. error = statusText;
  18837. if ( status || !statusText ) {
  18838. statusText = "error";
  18839. if ( status < 0 ) {
  18840. status = 0;
  18841. }
  18842. }
  18843. }
  18844. // Set data for the fake xhr object
  18845. jqXHR.status = status;
  18846. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  18847. // Success/Error
  18848. if ( isSuccess ) {
  18849. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  18850. } else {
  18851. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  18852. }
  18853. // Status-dependent callbacks
  18854. jqXHR.statusCode( statusCode );
  18855. statusCode = undefined;
  18856. if ( fireGlobals ) {
  18857. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  18858. [ jqXHR, s, isSuccess ? success : error ] );
  18859. }
  18860. // Complete
  18861. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  18862. if ( fireGlobals ) {
  18863. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  18864. // Handle the global AJAX counter
  18865. if ( !( --jQuery.active ) ) {
  18866. jQuery.event.trigger( "ajaxStop" );
  18867. }
  18868. }
  18869. }
  18870. return jqXHR;
  18871. },
  18872. getJSON: function( url, data, callback ) {
  18873. return jQuery.get( url, data, callback, "json" );
  18874. },
  18875. getScript: function( url, callback ) {
  18876. return jQuery.get( url, undefined, callback, "script" );
  18877. }
  18878. } );
  18879. jQuery.each( [ "get", "post" ], function( _i, method ) {
  18880. jQuery[ method ] = function( url, data, callback, type ) {
  18881. // Shift arguments if data argument was omitted
  18882. if ( isFunction( data ) ) {
  18883. type = type || callback;
  18884. callback = data;
  18885. data = undefined;
  18886. }
  18887. // The url can be an options object (which then must have .url)
  18888. return jQuery.ajax( jQuery.extend( {
  18889. url: url,
  18890. type: method,
  18891. dataType: type,
  18892. data: data,
  18893. success: callback
  18894. }, jQuery.isPlainObject( url ) && url ) );
  18895. };
  18896. } );
  18897. jQuery.ajaxPrefilter( function( s ) {
  18898. var i;
  18899. for ( i in s.headers ) {
  18900. if ( i.toLowerCase() === "content-type" ) {
  18901. s.contentType = s.headers[ i ] || "";
  18902. }
  18903. }
  18904. } );
  18905. jQuery._evalUrl = function( url, options, doc ) {
  18906. return jQuery.ajax( {
  18907. url: url,
  18908. // Make this explicit, since user can override this through ajaxSetup (#11264)
  18909. type: "GET",
  18910. dataType: "script",
  18911. cache: true,
  18912. async: false,
  18913. global: false,
  18914. // Only evaluate the response if it is successful (gh-4126)
  18915. // dataFilter is not invoked for failure responses, so using it instead
  18916. // of the default converter is kludgy but it works.
  18917. converters: {
  18918. "text script": function() {}
  18919. },
  18920. dataFilter: function( response ) {
  18921. jQuery.globalEval( response, options, doc );
  18922. }
  18923. } );
  18924. };
  18925. jQuery.fn.extend( {
  18926. wrapAll: function( html ) {
  18927. var wrap;
  18928. if ( this[ 0 ] ) {
  18929. if ( isFunction( html ) ) {
  18930. html = html.call( this[ 0 ] );
  18931. }
  18932. // The elements to wrap the target around
  18933. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  18934. if ( this[ 0 ].parentNode ) {
  18935. wrap.insertBefore( this[ 0 ] );
  18936. }
  18937. wrap.map( function() {
  18938. var elem = this;
  18939. while ( elem.firstElementChild ) {
  18940. elem = elem.firstElementChild;
  18941. }
  18942. return elem;
  18943. } ).append( this );
  18944. }
  18945. return this;
  18946. },
  18947. wrapInner: function( html ) {
  18948. if ( isFunction( html ) ) {
  18949. return this.each( function( i ) {
  18950. jQuery( this ).wrapInner( html.call( this, i ) );
  18951. } );
  18952. }
  18953. return this.each( function() {
  18954. var self = jQuery( this ),
  18955. contents = self.contents();
  18956. if ( contents.length ) {
  18957. contents.wrapAll( html );
  18958. } else {
  18959. self.append( html );
  18960. }
  18961. } );
  18962. },
  18963. wrap: function( html ) {
  18964. var htmlIsFunction = isFunction( html );
  18965. return this.each( function( i ) {
  18966. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  18967. } );
  18968. },
  18969. unwrap: function( selector ) {
  18970. this.parent( selector ).not( "body" ).each( function() {
  18971. jQuery( this ).replaceWith( this.childNodes );
  18972. } );
  18973. return this;
  18974. }
  18975. } );
  18976. jQuery.expr.pseudos.hidden = function( elem ) {
  18977. return !jQuery.expr.pseudos.visible( elem );
  18978. };
  18979. jQuery.expr.pseudos.visible = function( elem ) {
  18980. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  18981. };
  18982. jQuery.ajaxSettings.xhr = function() {
  18983. try {
  18984. return new window.XMLHttpRequest();
  18985. } catch ( e ) {}
  18986. };
  18987. var xhrSuccessStatus = {
  18988. // File protocol always yields status code 0, assume 200
  18989. 0: 200,
  18990. // Support: IE <=9 only
  18991. // #1450: sometimes IE returns 1223 when it should be 204
  18992. 1223: 204
  18993. },
  18994. xhrSupported = jQuery.ajaxSettings.xhr();
  18995. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  18996. support.ajax = xhrSupported = !!xhrSupported;
  18997. jQuery.ajaxTransport( function( options ) {
  18998. var callback, errorCallback;
  18999. // Cross domain only allowed if supported through XMLHttpRequest
  19000. if ( support.cors || xhrSupported && !options.crossDomain ) {
  19001. return {
  19002. send: function( headers, complete ) {
  19003. var i,
  19004. xhr = options.xhr();
  19005. xhr.open(
  19006. options.type,
  19007. options.url,
  19008. options.async,
  19009. options.username,
  19010. options.password
  19011. );
  19012. // Apply custom fields if provided
  19013. if ( options.xhrFields ) {
  19014. for ( i in options.xhrFields ) {
  19015. xhr[ i ] = options.xhrFields[ i ];
  19016. }
  19017. }
  19018. // Override mime type if needed
  19019. if ( options.mimeType && xhr.overrideMimeType ) {
  19020. xhr.overrideMimeType( options.mimeType );
  19021. }
  19022. // X-Requested-With header
  19023. // For cross-domain requests, seeing as conditions for a preflight are
  19024. // akin to a jigsaw puzzle, we simply never set it to be sure.
  19025. // (it can always be set on a per-request basis or even using ajaxSetup)
  19026. // For same-domain requests, won't change header if already provided.
  19027. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  19028. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  19029. }
  19030. // Set headers
  19031. for ( i in headers ) {
  19032. xhr.setRequestHeader( i, headers[ i ] );
  19033. }
  19034. // Callback
  19035. callback = function( type ) {
  19036. return function() {
  19037. if ( callback ) {
  19038. callback = errorCallback = xhr.onload =
  19039. xhr.onerror = xhr.onabort = xhr.ontimeout =
  19040. xhr.onreadystatechange = null;
  19041. if ( type === "abort" ) {
  19042. xhr.abort();
  19043. } else if ( type === "error" ) {
  19044. // Support: IE <=9 only
  19045. // On a manual native abort, IE9 throws
  19046. // errors on any property access that is not readyState
  19047. if ( typeof xhr.status !== "number" ) {
  19048. complete( 0, "error" );
  19049. } else {
  19050. complete(
  19051. // File: protocol always yields status 0; see #8605, #14207
  19052. xhr.status,
  19053. xhr.statusText
  19054. );
  19055. }
  19056. } else {
  19057. complete(
  19058. xhrSuccessStatus[ xhr.status ] || xhr.status,
  19059. xhr.statusText,
  19060. // Support: IE <=9 only
  19061. // IE9 has no XHR2 but throws on binary (trac-11426)
  19062. // For XHR2 non-text, let the caller handle it (gh-2498)
  19063. ( xhr.responseType || "text" ) !== "text" ||
  19064. typeof xhr.responseText !== "string" ?
  19065. { binary: xhr.response } :
  19066. { text: xhr.responseText },
  19067. xhr.getAllResponseHeaders()
  19068. );
  19069. }
  19070. }
  19071. };
  19072. };
  19073. // Listen to events
  19074. xhr.onload = callback();
  19075. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  19076. // Support: IE 9 only
  19077. // Use onreadystatechange to replace onabort
  19078. // to handle uncaught aborts
  19079. if ( xhr.onabort !== undefined ) {
  19080. xhr.onabort = errorCallback;
  19081. } else {
  19082. xhr.onreadystatechange = function() {
  19083. // Check readyState before timeout as it changes
  19084. if ( xhr.readyState === 4 ) {
  19085. // Allow onerror to be called first,
  19086. // but that will not handle a native abort
  19087. // Also, save errorCallback to a variable
  19088. // as xhr.onerror cannot be accessed
  19089. window.setTimeout( function() {
  19090. if ( callback ) {
  19091. errorCallback();
  19092. }
  19093. } );
  19094. }
  19095. };
  19096. }
  19097. // Create the abort callback
  19098. callback = callback( "abort" );
  19099. try {
  19100. // Do send the request (this may raise an exception)
  19101. xhr.send( options.hasContent && options.data || null );
  19102. } catch ( e ) {
  19103. // #14683: Only rethrow if this hasn't been notified as an error yet
  19104. if ( callback ) {
  19105. throw e;
  19106. }
  19107. }
  19108. },
  19109. abort: function() {
  19110. if ( callback ) {
  19111. callback();
  19112. }
  19113. }
  19114. };
  19115. }
  19116. } );
  19117. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  19118. jQuery.ajaxPrefilter( function( s ) {
  19119. if ( s.crossDomain ) {
  19120. s.contents.script = false;
  19121. }
  19122. } );
  19123. // Install script dataType
  19124. jQuery.ajaxSetup( {
  19125. accepts: {
  19126. script: "text/javascript, application/javascript, " +
  19127. "application/ecmascript, application/x-ecmascript"
  19128. },
  19129. contents: {
  19130. script: /\b(?:java|ecma)script\b/
  19131. },
  19132. converters: {
  19133. "text script": function( text ) {
  19134. jQuery.globalEval( text );
  19135. return text;
  19136. }
  19137. }
  19138. } );
  19139. // Handle cache's special case and crossDomain
  19140. jQuery.ajaxPrefilter( "script", function( s ) {
  19141. if ( s.cache === undefined ) {
  19142. s.cache = false;
  19143. }
  19144. if ( s.crossDomain ) {
  19145. s.type = "GET";
  19146. }
  19147. } );
  19148. // Bind script tag hack transport
  19149. jQuery.ajaxTransport( "script", function( s ) {
  19150. // This transport only deals with cross domain or forced-by-attrs requests
  19151. if ( s.crossDomain || s.scriptAttrs ) {
  19152. var script, callback;
  19153. return {
  19154. send: function( _, complete ) {
  19155. script = jQuery( "<script>" )
  19156. .attr( s.scriptAttrs || {} )
  19157. .prop( { charset: s.scriptCharset, src: s.url } )
  19158. .on( "load error", callback = function( evt ) {
  19159. script.remove();
  19160. callback = null;
  19161. if ( evt ) {
  19162. complete( evt.type === "error" ? 404 : 200, evt.type );
  19163. }
  19164. } );
  19165. // Use native DOM manipulation to avoid our domManip AJAX trickery
  19166. document.head.appendChild( script[ 0 ] );
  19167. },
  19168. abort: function() {
  19169. if ( callback ) {
  19170. callback();
  19171. }
  19172. }
  19173. };
  19174. }
  19175. } );
  19176. var oldCallbacks = [],
  19177. rjsonp = /(=)\?(?=&|$)|\?\?/;
  19178. // Default jsonp settings
  19179. jQuery.ajaxSetup( {
  19180. jsonp: "callback",
  19181. jsonpCallback: function() {
  19182. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) );
  19183. this[ callback ] = true;
  19184. return callback;
  19185. }
  19186. } );
  19187. // Detect, normalize options and install callbacks for jsonp requests
  19188. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  19189. var callbackName, overwritten, responseContainer,
  19190. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  19191. "url" :
  19192. typeof s.data === "string" &&
  19193. ( s.contentType || "" )
  19194. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  19195. rjsonp.test( s.data ) && "data"
  19196. );
  19197. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  19198. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  19199. // Get callback name, remembering preexisting value associated with it
  19200. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  19201. s.jsonpCallback() :
  19202. s.jsonpCallback;
  19203. // Insert callback into url or form data
  19204. if ( jsonProp ) {
  19205. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  19206. } else if ( s.jsonp !== false ) {
  19207. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  19208. }
  19209. // Use data converter to retrieve json after script execution
  19210. s.converters[ "script json" ] = function() {
  19211. if ( !responseContainer ) {
  19212. jQuery.error( callbackName + " was not called" );
  19213. }
  19214. return responseContainer[ 0 ];
  19215. };
  19216. // Force json dataType
  19217. s.dataTypes[ 0 ] = "json";
  19218. // Install callback
  19219. overwritten = window[ callbackName ];
  19220. window[ callbackName ] = function() {
  19221. responseContainer = arguments;
  19222. };
  19223. // Clean-up function (fires after converters)
  19224. jqXHR.always( function() {
  19225. // If previous value didn't exist - remove it
  19226. if ( overwritten === undefined ) {
  19227. jQuery( window ).removeProp( callbackName );
  19228. // Otherwise restore preexisting value
  19229. } else {
  19230. window[ callbackName ] = overwritten;
  19231. }
  19232. // Save back as free
  19233. if ( s[ callbackName ] ) {
  19234. // Make sure that re-using the options doesn't screw things around
  19235. s.jsonpCallback = originalSettings.jsonpCallback;
  19236. // Save the callback name for future use
  19237. oldCallbacks.push( callbackName );
  19238. }
  19239. // Call if it was a function and we have a response
  19240. if ( responseContainer && isFunction( overwritten ) ) {
  19241. overwritten( responseContainer[ 0 ] );
  19242. }
  19243. responseContainer = overwritten = undefined;
  19244. } );
  19245. // Delegate to script
  19246. return "script";
  19247. }
  19248. } );
  19249. // Support: Safari 8 only
  19250. // In Safari 8 documents created via document.implementation.createHTMLDocument
  19251. // collapse sibling forms: the second one becomes a child of the first one.
  19252. // Because of that, this security measure has to be disabled in Safari 8.
  19253. // https://bugs.webkit.org/show_bug.cgi?id=137337
  19254. support.createHTMLDocument = ( function() {
  19255. var body = document.implementation.createHTMLDocument( "" ).body;
  19256. body.innerHTML = "<form></form><form></form>";
  19257. return body.childNodes.length === 2;
  19258. } )();
  19259. // Argument "data" should be string of html
  19260. // context (optional): If specified, the fragment will be created in this context,
  19261. // defaults to document
  19262. // keepScripts (optional): If true, will include scripts passed in the html string
  19263. jQuery.parseHTML = function( data, context, keepScripts ) {
  19264. if ( typeof data !== "string" ) {
  19265. return [];
  19266. }
  19267. if ( typeof context === "boolean" ) {
  19268. keepScripts = context;
  19269. context = false;
  19270. }
  19271. var base, parsed, scripts;
  19272. if ( !context ) {
  19273. // Stop scripts or inline event handlers from being executed immediately
  19274. // by using document.implementation
  19275. if ( support.createHTMLDocument ) {
  19276. context = document.implementation.createHTMLDocument( "" );
  19277. // Set the base href for the created document
  19278. // so any parsed elements with URLs
  19279. // are based on the document's URL (gh-2965)
  19280. base = context.createElement( "base" );
  19281. base.href = document.location.href;
  19282. context.head.appendChild( base );
  19283. } else {
  19284. context = document;
  19285. }
  19286. }
  19287. parsed = rsingleTag.exec( data );
  19288. scripts = !keepScripts && [];
  19289. // Single tag
  19290. if ( parsed ) {
  19291. return [ context.createElement( parsed[ 1 ] ) ];
  19292. }
  19293. parsed = buildFragment( [ data ], context, scripts );
  19294. if ( scripts && scripts.length ) {
  19295. jQuery( scripts ).remove();
  19296. }
  19297. return jQuery.merge( [], parsed.childNodes );
  19298. };
  19299. /**
  19300. * Load a url into a page
  19301. */
  19302. jQuery.fn.load = function( url, params, callback ) {
  19303. var selector, type, response,
  19304. self = this,
  19305. off = url.indexOf( " " );
  19306. if ( off > -1 ) {
  19307. selector = stripAndCollapse( url.slice( off ) );
  19308. url = url.slice( 0, off );
  19309. }
  19310. // If it's a function
  19311. if ( isFunction( params ) ) {
  19312. // We assume that it's the callback
  19313. callback = params;
  19314. params = undefined;
  19315. // Otherwise, build a param string
  19316. } else if ( params && typeof params === "object" ) {
  19317. type = "POST";
  19318. }
  19319. // If we have elements to modify, make the request
  19320. if ( self.length > 0 ) {
  19321. jQuery.ajax( {
  19322. url: url,
  19323. // If "type" variable is undefined, then "GET" method will be used.
  19324. // Make value of this field explicit since
  19325. // user can override it through ajaxSetup method
  19326. type: type || "GET",
  19327. dataType: "html",
  19328. data: params
  19329. } ).done( function( responseText ) {
  19330. // Save response for use in complete callback
  19331. response = arguments;
  19332. self.html( selector ?
  19333. // If a selector was specified, locate the right elements in a dummy div
  19334. // Exclude scripts to avoid IE 'Permission Denied' errors
  19335. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  19336. // Otherwise use the full result
  19337. responseText );
  19338. // If the request succeeds, this function gets "data", "status", "jqXHR"
  19339. // but they are ignored because response was set above.
  19340. // If it fails, this function gets "jqXHR", "status", "error"
  19341. } ).always( callback && function( jqXHR, status ) {
  19342. self.each( function() {
  19343. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  19344. } );
  19345. } );
  19346. }
  19347. return this;
  19348. };
  19349. jQuery.expr.pseudos.animated = function( elem ) {
  19350. return jQuery.grep( jQuery.timers, function( fn ) {
  19351. return elem === fn.elem;
  19352. } ).length;
  19353. };
  19354. jQuery.offset = {
  19355. setOffset: function( elem, options, i ) {
  19356. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  19357. position = jQuery.css( elem, "position" ),
  19358. curElem = jQuery( elem ),
  19359. props = {};
  19360. // Set position first, in-case top/left are set even on static elem
  19361. if ( position === "static" ) {
  19362. elem.style.position = "relative";
  19363. }
  19364. curOffset = curElem.offset();
  19365. curCSSTop = jQuery.css( elem, "top" );
  19366. curCSSLeft = jQuery.css( elem, "left" );
  19367. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  19368. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  19369. // Need to be able to calculate position if either
  19370. // top or left is auto and position is either absolute or fixed
  19371. if ( calculatePosition ) {
  19372. curPosition = curElem.position();
  19373. curTop = curPosition.top;
  19374. curLeft = curPosition.left;
  19375. } else {
  19376. curTop = parseFloat( curCSSTop ) || 0;
  19377. curLeft = parseFloat( curCSSLeft ) || 0;
  19378. }
  19379. if ( isFunction( options ) ) {
  19380. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  19381. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  19382. }
  19383. if ( options.top != null ) {
  19384. props.top = ( options.top - curOffset.top ) + curTop;
  19385. }
  19386. if ( options.left != null ) {
  19387. props.left = ( options.left - curOffset.left ) + curLeft;
  19388. }
  19389. if ( "using" in options ) {
  19390. options.using.call( elem, props );
  19391. } else {
  19392. if ( typeof props.top === "number" ) {
  19393. props.top += "px";
  19394. }
  19395. if ( typeof props.left === "number" ) {
  19396. props.left += "px";
  19397. }
  19398. curElem.css( props );
  19399. }
  19400. }
  19401. };
  19402. jQuery.fn.extend( {
  19403. // offset() relates an element's border box to the document origin
  19404. offset: function( options ) {
  19405. // Preserve chaining for setter
  19406. if ( arguments.length ) {
  19407. return options === undefined ?
  19408. this :
  19409. this.each( function( i ) {
  19410. jQuery.offset.setOffset( this, options, i );
  19411. } );
  19412. }
  19413. var rect, win,
  19414. elem = this[ 0 ];
  19415. if ( !elem ) {
  19416. return;
  19417. }
  19418. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  19419. // Support: IE <=11 only
  19420. // Running getBoundingClientRect on a
  19421. // disconnected node in IE throws an error
  19422. if ( !elem.getClientRects().length ) {
  19423. return { top: 0, left: 0 };
  19424. }
  19425. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  19426. rect = elem.getBoundingClientRect();
  19427. win = elem.ownerDocument.defaultView;
  19428. return {
  19429. top: rect.top + win.pageYOffset,
  19430. left: rect.left + win.pageXOffset
  19431. };
  19432. },
  19433. // position() relates an element's margin box to its offset parent's padding box
  19434. // This corresponds to the behavior of CSS absolute positioning
  19435. position: function() {
  19436. if ( !this[ 0 ] ) {
  19437. return;
  19438. }
  19439. var offsetParent, offset, doc,
  19440. elem = this[ 0 ],
  19441. parentOffset = { top: 0, left: 0 };
  19442. // position:fixed elements are offset from the viewport, which itself always has zero offset
  19443. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  19444. // Assume position:fixed implies availability of getBoundingClientRect
  19445. offset = elem.getBoundingClientRect();
  19446. } else {
  19447. offset = this.offset();
  19448. // Account for the *real* offset parent, which can be the document or its root element
  19449. // when a statically positioned element is identified
  19450. doc = elem.ownerDocument;
  19451. offsetParent = elem.offsetParent || doc.documentElement;
  19452. while ( offsetParent &&
  19453. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  19454. jQuery.css( offsetParent, "position" ) === "static" ) {
  19455. offsetParent = offsetParent.parentNode;
  19456. }
  19457. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  19458. // Incorporate borders into its offset, since they are outside its content origin
  19459. parentOffset = jQuery( offsetParent ).offset();
  19460. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  19461. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  19462. }
  19463. }
  19464. // Subtract parent offsets and element margins
  19465. return {
  19466. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  19467. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  19468. };
  19469. },
  19470. // This method will return documentElement in the following cases:
  19471. // 1) For the element inside the iframe without offsetParent, this method will return
  19472. // documentElement of the parent window
  19473. // 2) For the hidden or detached element
  19474. // 3) For body or html element, i.e. in case of the html node - it will return itself
  19475. //
  19476. // but those exceptions were never presented as a real life use-cases
  19477. // and might be considered as more preferable results.
  19478. //
  19479. // This logic, however, is not guaranteed and can change at any point in the future
  19480. offsetParent: function() {
  19481. return this.map( function() {
  19482. var offsetParent = this.offsetParent;
  19483. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  19484. offsetParent = offsetParent.offsetParent;
  19485. }
  19486. return offsetParent || documentElement;
  19487. } );
  19488. }
  19489. } );
  19490. // Create scrollLeft and scrollTop methods
  19491. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  19492. var top = "pageYOffset" === prop;
  19493. jQuery.fn[ method ] = function( val ) {
  19494. return access( this, function( elem, method, val ) {
  19495. // Coalesce documents and windows
  19496. var win;
  19497. if ( isWindow( elem ) ) {
  19498. win = elem;
  19499. } else if ( elem.nodeType === 9 ) {
  19500. win = elem.defaultView;
  19501. }
  19502. if ( val === undefined ) {
  19503. return win ? win[ prop ] : elem[ method ];
  19504. }
  19505. if ( win ) {
  19506. win.scrollTo(
  19507. !top ? val : win.pageXOffset,
  19508. top ? val : win.pageYOffset
  19509. );
  19510. } else {
  19511. elem[ method ] = val;
  19512. }
  19513. }, method, val, arguments.length );
  19514. };
  19515. } );
  19516. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  19517. // Add the top/left cssHooks using jQuery.fn.position
  19518. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  19519. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  19520. // getComputedStyle returns percent when specified for top/left/bottom/right;
  19521. // rather than make the css module depend on the offset module, just check for it here
  19522. jQuery.each( [ "top", "left" ], function( _i, prop ) {
  19523. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  19524. function( elem, computed ) {
  19525. if ( computed ) {
  19526. computed = curCSS( elem, prop );
  19527. // If curCSS returns percentage, fallback to offset
  19528. return rnumnonpx.test( computed ) ?
  19529. jQuery( elem ).position()[ prop ] + "px" :
  19530. computed;
  19531. }
  19532. }
  19533. );
  19534. } );
  19535. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  19536. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  19537. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  19538. function( defaultExtra, funcName ) {
  19539. // Margin is only for outerHeight, outerWidth
  19540. jQuery.fn[ funcName ] = function( margin, value ) {
  19541. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  19542. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  19543. return access( this, function( elem, type, value ) {
  19544. var doc;
  19545. if ( isWindow( elem ) ) {
  19546. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  19547. return funcName.indexOf( "outer" ) === 0 ?
  19548. elem[ "inner" + name ] :
  19549. elem.document.documentElement[ "client" + name ];
  19550. }
  19551. // Get document width or height
  19552. if ( elem.nodeType === 9 ) {
  19553. doc = elem.documentElement;
  19554. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  19555. // whichever is greatest
  19556. return Math.max(
  19557. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  19558. elem.body[ "offset" + name ], doc[ "offset" + name ],
  19559. doc[ "client" + name ]
  19560. );
  19561. }
  19562. return value === undefined ?
  19563. // Get width or height on the element, requesting but not forcing parseFloat
  19564. jQuery.css( elem, type, extra ) :
  19565. // Set width or height on the element
  19566. jQuery.style( elem, type, value, extra );
  19567. }, type, chainable ? margin : undefined, chainable );
  19568. };
  19569. } );
  19570. } );
  19571. jQuery.each( [
  19572. "ajaxStart",
  19573. "ajaxStop",
  19574. "ajaxComplete",
  19575. "ajaxError",
  19576. "ajaxSuccess",
  19577. "ajaxSend"
  19578. ], function( _i, type ) {
  19579. jQuery.fn[ type ] = function( fn ) {
  19580. return this.on( type, fn );
  19581. };
  19582. } );
  19583. jQuery.fn.extend( {
  19584. bind: function( types, data, fn ) {
  19585. return this.on( types, null, data, fn );
  19586. },
  19587. unbind: function( types, fn ) {
  19588. return this.off( types, null, fn );
  19589. },
  19590. delegate: function( selector, types, data, fn ) {
  19591. return this.on( types, selector, data, fn );
  19592. },
  19593. undelegate: function( selector, types, fn ) {
  19594. // ( namespace ) or ( selector, types [, fn] )
  19595. return arguments.length === 1 ?
  19596. this.off( selector, "**" ) :
  19597. this.off( types, selector || "**", fn );
  19598. },
  19599. hover: function( fnOver, fnOut ) {
  19600. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  19601. }
  19602. } );
  19603. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  19604. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  19605. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  19606. function( _i, name ) {
  19607. // Handle event binding
  19608. jQuery.fn[ name ] = function( data, fn ) {
  19609. return arguments.length > 0 ?
  19610. this.on( name, null, data, fn ) :
  19611. this.trigger( name );
  19612. };
  19613. } );
  19614. // Support: Android <=4.0 only
  19615. // Make sure we trim BOM and NBSP
  19616. var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  19617. // Bind a function to a context, optionally partially applying any
  19618. // arguments.
  19619. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  19620. // However, it is not slated for removal any time soon
  19621. jQuery.proxy = function( fn, context ) {
  19622. var tmp, args, proxy;
  19623. if ( typeof context === "string" ) {
  19624. tmp = fn[ context ];
  19625. context = fn;
  19626. fn = tmp;
  19627. }
  19628. // Quick check to determine if target is callable, in the spec
  19629. // this throws a TypeError, but we will just return undefined.
  19630. if ( !isFunction( fn ) ) {
  19631. return undefined;
  19632. }
  19633. // Simulated bind
  19634. args = slice.call( arguments, 2 );
  19635. proxy = function() {
  19636. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  19637. };
  19638. // Set the guid of unique handler to the same of original handler, so it can be removed
  19639. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  19640. return proxy;
  19641. };
  19642. jQuery.holdReady = function( hold ) {
  19643. if ( hold ) {
  19644. jQuery.readyWait++;
  19645. } else {
  19646. jQuery.ready( true );
  19647. }
  19648. };
  19649. jQuery.isArray = Array.isArray;
  19650. jQuery.parseJSON = JSON.parse;
  19651. jQuery.nodeName = nodeName;
  19652. jQuery.isFunction = isFunction;
  19653. jQuery.isWindow = isWindow;
  19654. jQuery.camelCase = camelCase;
  19655. jQuery.type = toType;
  19656. jQuery.now = Date.now;
  19657. jQuery.isNumeric = function( obj ) {
  19658. // As of jQuery 3.0, isNumeric is limited to
  19659. // strings and numbers (primitives or objects)
  19660. // that can be coerced to finite numbers (gh-2662)
  19661. var type = jQuery.type( obj );
  19662. return ( type === "number" || type === "string" ) &&
  19663. // parseFloat NaNs numeric-cast false positives ("")
  19664. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  19665. // subtraction forces infinities to NaN
  19666. !isNaN( obj - parseFloat( obj ) );
  19667. };
  19668. jQuery.trim = function( text ) {
  19669. return text == null ?
  19670. "" :
  19671. ( text + "" ).replace( rtrim, "" );
  19672. };
  19673. // Register as a named AMD module, since jQuery can be concatenated with other
  19674. // files that may use define, but not via a proper concatenation script that
  19675. // understands anonymous AMD modules. A named AMD is safest and most robust
  19676. // way to register. Lowercase jquery is used because AMD module names are
  19677. // derived from file names, and jQuery is normally delivered in a lowercase
  19678. // file name. Do this after creating the global so that if an AMD module wants
  19679. // to call noConflict to hide this version of jQuery, it will work.
  19680. // Note that for maximum portability, libraries that are not jQuery should
  19681. // declare themselves as anonymous modules, and avoid setting a global if an
  19682. // AMD loader is present. jQuery is a special case. For more information, see
  19683. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  19684. if ( true ) {
  19685. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  19686. return jQuery;
  19687. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  19688. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  19689. }
  19690. var
  19691. // Map over jQuery in case of overwrite
  19692. _jQuery = window.jQuery,
  19693. // Map over the $ in case of overwrite
  19694. _$ = window.$;
  19695. jQuery.noConflict = function( deep ) {
  19696. if ( window.$ === jQuery ) {
  19697. window.$ = _$;
  19698. }
  19699. if ( deep && window.jQuery === jQuery ) {
  19700. window.jQuery = _jQuery;
  19701. }
  19702. return jQuery;
  19703. };
  19704. // Expose jQuery and $ identifiers, even in AMD
  19705. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  19706. // and CommonJS for browser emulators (#13566)
  19707. if ( typeof noGlobal === "undefined" ) {
  19708. window.jQuery = window.$ = jQuery;
  19709. }
  19710. return jQuery;
  19711. } );
  19712. /***/ }),
  19713. /***/ "./node_modules/js-cookie/src/js.cookie.js":
  19714. /*!*************************************************!*\
  19715. !*** ./node_modules/js-cookie/src/js.cookie.js ***!
  19716. \*************************************************/
  19717. /*! no static exports found */
  19718. /***/ (function(module, exports, __webpack_require__) {
  19719. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  19720. * JavaScript Cookie v2.2.1
  19721. * https://github.com/js-cookie/js-cookie
  19722. *
  19723. * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
  19724. * Released under the MIT license
  19725. */
  19726. ;(function (factory) {
  19727. var registeredInModuleLoader;
  19728. if (true) {
  19729. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  19730. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  19731. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  19732. __WEBPACK_AMD_DEFINE_FACTORY__),
  19733. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  19734. registeredInModuleLoader = true;
  19735. }
  19736. if (true) {
  19737. module.exports = factory();
  19738. registeredInModuleLoader = true;
  19739. }
  19740. if (!registeredInModuleLoader) {
  19741. var OldCookies = window.Cookies;
  19742. var api = window.Cookies = factory();
  19743. api.noConflict = function () {
  19744. window.Cookies = OldCookies;
  19745. return api;
  19746. };
  19747. }
  19748. }(function () {
  19749. function extend () {
  19750. var i = 0;
  19751. var result = {};
  19752. for (; i < arguments.length; i++) {
  19753. var attributes = arguments[ i ];
  19754. for (var key in attributes) {
  19755. result[key] = attributes[key];
  19756. }
  19757. }
  19758. return result;
  19759. }
  19760. function decode (s) {
  19761. return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
  19762. }
  19763. function init (converter) {
  19764. function api() {}
  19765. function set (key, value, attributes) {
  19766. if (typeof document === 'undefined') {
  19767. return;
  19768. }
  19769. attributes = extend({
  19770. path: '/'
  19771. }, api.defaults, attributes);
  19772. if (typeof attributes.expires === 'number') {
  19773. attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);
  19774. }
  19775. // We're using "expires" because "max-age" is not supported by IE
  19776. attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
  19777. try {
  19778. var result = JSON.stringify(value);
  19779. if (/^[\{\[]/.test(result)) {
  19780. value = result;
  19781. }
  19782. } catch (e) {}
  19783. value = converter.write ?
  19784. converter.write(value, key) :
  19785. encodeURIComponent(String(value))
  19786. .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
  19787. key = encodeURIComponent(String(key))
  19788. .replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)
  19789. .replace(/[\(\)]/g, escape);
  19790. var stringifiedAttributes = '';
  19791. for (var attributeName in attributes) {
  19792. if (!attributes[attributeName]) {
  19793. continue;
  19794. }
  19795. stringifiedAttributes += '; ' + attributeName;
  19796. if (attributes[attributeName] === true) {
  19797. continue;
  19798. }
  19799. // Considers RFC 6265 section 5.2:
  19800. // ...
  19801. // 3. If the remaining unparsed-attributes contains a %x3B (";")
  19802. // character:
  19803. // Consume the characters of the unparsed-attributes up to,
  19804. // not including, the first %x3B (";") character.
  19805. // ...
  19806. stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
  19807. }
  19808. return (document.cookie = key + '=' + value + stringifiedAttributes);
  19809. }
  19810. function get (key, json) {
  19811. if (typeof document === 'undefined') {
  19812. return;
  19813. }
  19814. var jar = {};
  19815. // To prevent the for loop in the first place assign an empty array
  19816. // in case there are no cookies at all.
  19817. var cookies = document.cookie ? document.cookie.split('; ') : [];
  19818. var i = 0;
  19819. for (; i < cookies.length; i++) {
  19820. var parts = cookies[i].split('=');
  19821. var cookie = parts.slice(1).join('=');
  19822. if (!json && cookie.charAt(0) === '"') {
  19823. cookie = cookie.slice(1, -1);
  19824. }
  19825. try {
  19826. var name = decode(parts[0]);
  19827. cookie = (converter.read || converter)(cookie, name) ||
  19828. decode(cookie);
  19829. if (json) {
  19830. try {
  19831. cookie = JSON.parse(cookie);
  19832. } catch (e) {}
  19833. }
  19834. jar[name] = cookie;
  19835. if (key === name) {
  19836. break;
  19837. }
  19838. } catch (e) {}
  19839. }
  19840. return key ? jar[key] : jar;
  19841. }
  19842. api.set = set;
  19843. api.get = function (key) {
  19844. return get(key, false /* read as raw */);
  19845. };
  19846. api.getJSON = function (key) {
  19847. return get(key, true /* read as json */);
  19848. };
  19849. api.remove = function (key, attributes) {
  19850. set(key, '', extend(attributes, {
  19851. expires: -1
  19852. }));
  19853. };
  19854. api.defaults = {};
  19855. api.withConverter = init;
  19856. return api;
  19857. }
  19858. return init(function () {});
  19859. }));
  19860. /***/ }),
  19861. /***/ "./node_modules/laravel-echo/dist/echo.js":
  19862. /*!************************************************!*\
  19863. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  19864. \************************************************/
  19865. /*! exports provided: default */
  19866. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19867. "use strict";
  19868. __webpack_require__.r(__webpack_exports__);
  19869. function _classCallCheck(instance, Constructor) {
  19870. if (!(instance instanceof Constructor)) {
  19871. throw new TypeError("Cannot call a class as a function");
  19872. }
  19873. }
  19874. function _defineProperties(target, props) {
  19875. for (var i = 0; i < props.length; i++) {
  19876. var descriptor = props[i];
  19877. descriptor.enumerable = descriptor.enumerable || false;
  19878. descriptor.configurable = true;
  19879. if ("value" in descriptor) descriptor.writable = true;
  19880. Object.defineProperty(target, descriptor.key, descriptor);
  19881. }
  19882. }
  19883. function _createClass(Constructor, protoProps, staticProps) {
  19884. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  19885. if (staticProps) _defineProperties(Constructor, staticProps);
  19886. return Constructor;
  19887. }
  19888. function _extends() {
  19889. _extends = Object.assign || function (target) {
  19890. for (var i = 1; i < arguments.length; i++) {
  19891. var source = arguments[i];
  19892. for (var key in source) {
  19893. if (Object.prototype.hasOwnProperty.call(source, key)) {
  19894. target[key] = source[key];
  19895. }
  19896. }
  19897. }
  19898. return target;
  19899. };
  19900. return _extends.apply(this, arguments);
  19901. }
  19902. function _inherits(subClass, superClass) {
  19903. if (typeof superClass !== "function" && superClass !== null) {
  19904. throw new TypeError("Super expression must either be null or a function");
  19905. }
  19906. subClass.prototype = Object.create(superClass && superClass.prototype, {
  19907. constructor: {
  19908. value: subClass,
  19909. writable: true,
  19910. configurable: true
  19911. }
  19912. });
  19913. if (superClass) _setPrototypeOf(subClass, superClass);
  19914. }
  19915. function _getPrototypeOf(o) {
  19916. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
  19917. return o.__proto__ || Object.getPrototypeOf(o);
  19918. };
  19919. return _getPrototypeOf(o);
  19920. }
  19921. function _setPrototypeOf(o, p) {
  19922. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  19923. o.__proto__ = p;
  19924. return o;
  19925. };
  19926. return _setPrototypeOf(o, p);
  19927. }
  19928. function _isNativeReflectConstruct() {
  19929. if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  19930. if (Reflect.construct.sham) return false;
  19931. if (typeof Proxy === "function") return true;
  19932. try {
  19933. Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
  19934. return true;
  19935. } catch (e) {
  19936. return false;
  19937. }
  19938. }
  19939. function _assertThisInitialized(self) {
  19940. if (self === void 0) {
  19941. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  19942. }
  19943. return self;
  19944. }
  19945. function _possibleConstructorReturn(self, call) {
  19946. if (call && (typeof call === "object" || typeof call === "function")) {
  19947. return call;
  19948. }
  19949. return _assertThisInitialized(self);
  19950. }
  19951. function _createSuper(Derived) {
  19952. var hasNativeReflectConstruct = _isNativeReflectConstruct();
  19953. return function () {
  19954. var Super = _getPrototypeOf(Derived),
  19955. result;
  19956. if (hasNativeReflectConstruct) {
  19957. var NewTarget = _getPrototypeOf(this).constructor;
  19958. result = Reflect.construct(Super, arguments, NewTarget);
  19959. } else {
  19960. result = Super.apply(this, arguments);
  19961. }
  19962. return _possibleConstructorReturn(this, result);
  19963. };
  19964. }
  19965. var Connector = /*#__PURE__*/function () {
  19966. /**
  19967. * Create a new class instance.
  19968. */
  19969. function Connector(options) {
  19970. _classCallCheck(this, Connector);
  19971. /**
  19972. * Default connector options.
  19973. */
  19974. this._defaultOptions = {
  19975. auth: {
  19976. headers: {}
  19977. },
  19978. authEndpoint: '/broadcasting/auth',
  19979. broadcaster: 'pusher',
  19980. csrfToken: null,
  19981. host: null,
  19982. key: null,
  19983. namespace: 'App.Events'
  19984. };
  19985. this.setOptions(options);
  19986. this.connect();
  19987. }
  19988. /**
  19989. * Merge the custom options with the defaults.
  19990. */
  19991. _createClass(Connector, [{
  19992. key: "setOptions",
  19993. value: function setOptions(options) {
  19994. this.options = _extends(this._defaultOptions, options);
  19995. if (this.csrfToken()) {
  19996. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  19997. }
  19998. return options;
  19999. }
  20000. /**
  20001. * Extract the CSRF token from the page.
  20002. */
  20003. }, {
  20004. key: "csrfToken",
  20005. value: function csrfToken() {
  20006. var selector;
  20007. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  20008. return window['Laravel'].csrfToken;
  20009. } else if (this.options.csrfToken) {
  20010. return this.options.csrfToken;
  20011. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  20012. return selector.getAttribute('content');
  20013. }
  20014. return null;
  20015. }
  20016. }]);
  20017. return Connector;
  20018. }();
  20019. /**
  20020. * This class represents a basic channel.
  20021. */
  20022. var Channel = /*#__PURE__*/function () {
  20023. function Channel() {
  20024. _classCallCheck(this, Channel);
  20025. }
  20026. _createClass(Channel, [{
  20027. key: "listenForWhisper",
  20028. /**
  20029. * Listen for a whisper event on the channel instance.
  20030. */
  20031. value: function listenForWhisper(event, callback) {
  20032. return this.listen('.client-' + event, callback);
  20033. }
  20034. /**
  20035. * Listen for an event on the channel instance.
  20036. */
  20037. }, {
  20038. key: "notification",
  20039. value: function notification(callback) {
  20040. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  20041. }
  20042. /**
  20043. * Stop listening for a whispser event on the channel instance.
  20044. */
  20045. }, {
  20046. key: "stopListeningForWhisper",
  20047. value: function stopListeningForWhisper(event) {
  20048. return this.stopListening('.client-' + event);
  20049. }
  20050. }]);
  20051. return Channel;
  20052. }();
  20053. /**
  20054. * Event name formatter
  20055. */
  20056. var EventFormatter = /*#__PURE__*/function () {
  20057. /**
  20058. * Create a new class instance.
  20059. */
  20060. function EventFormatter(namespace) {
  20061. _classCallCheck(this, EventFormatter);
  20062. this.setNamespace(namespace);
  20063. }
  20064. /**
  20065. * Format the given event name.
  20066. */
  20067. _createClass(EventFormatter, [{
  20068. key: "format",
  20069. value: function format(event) {
  20070. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  20071. return event.substr(1);
  20072. } else if (this.namespace) {
  20073. event = this.namespace + '.' + event;
  20074. }
  20075. return event.replace(/\./g, '\\');
  20076. }
  20077. /**
  20078. * Set the event namespace.
  20079. */
  20080. }, {
  20081. key: "setNamespace",
  20082. value: function setNamespace(value) {
  20083. this.namespace = value;
  20084. }
  20085. }]);
  20086. return EventFormatter;
  20087. }();
  20088. /**
  20089. * This class represents a Pusher channel.
  20090. */
  20091. var PusherChannel = /*#__PURE__*/function (_Channel) {
  20092. _inherits(PusherChannel, _Channel);
  20093. var _super = _createSuper(PusherChannel);
  20094. /**
  20095. * Create a new class instance.
  20096. */
  20097. function PusherChannel(pusher, name, options) {
  20098. var _this;
  20099. _classCallCheck(this, PusherChannel);
  20100. _this = _super.call(this);
  20101. _this.name = name;
  20102. _this.pusher = pusher;
  20103. _this.options = options;
  20104. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  20105. _this.subscribe();
  20106. return _this;
  20107. }
  20108. /**
  20109. * Subscribe to a Pusher channel.
  20110. */
  20111. _createClass(PusherChannel, [{
  20112. key: "subscribe",
  20113. value: function subscribe() {
  20114. this.subscription = this.pusher.subscribe(this.name);
  20115. }
  20116. /**
  20117. * Unsubscribe from a Pusher channel.
  20118. */
  20119. }, {
  20120. key: "unsubscribe",
  20121. value: function unsubscribe() {
  20122. this.pusher.unsubscribe(this.name);
  20123. }
  20124. /**
  20125. * Listen for an event on the channel instance.
  20126. */
  20127. }, {
  20128. key: "listen",
  20129. value: function listen(event, callback) {
  20130. this.on(this.eventFormatter.format(event), callback);
  20131. return this;
  20132. }
  20133. /**
  20134. * Stop listening for an event on the channel instance.
  20135. */
  20136. }, {
  20137. key: "stopListening",
  20138. value: function stopListening(event) {
  20139. this.subscription.unbind(this.eventFormatter.format(event));
  20140. return this;
  20141. }
  20142. /**
  20143. * Bind a channel to an event.
  20144. */
  20145. }, {
  20146. key: "on",
  20147. value: function on(event, callback) {
  20148. this.subscription.bind(event, callback);
  20149. return this;
  20150. }
  20151. }]);
  20152. return PusherChannel;
  20153. }(Channel);
  20154. /**
  20155. * This class represents a Pusher private channel.
  20156. */
  20157. var PusherPrivateChannel = /*#__PURE__*/function (_PusherChannel) {
  20158. _inherits(PusherPrivateChannel, _PusherChannel);
  20159. var _super = _createSuper(PusherPrivateChannel);
  20160. function PusherPrivateChannel() {
  20161. _classCallCheck(this, PusherPrivateChannel);
  20162. return _super.apply(this, arguments);
  20163. }
  20164. _createClass(PusherPrivateChannel, [{
  20165. key: "whisper",
  20166. /**
  20167. * Trigger client event on the channel.
  20168. */
  20169. value: function whisper(eventName, data) {
  20170. this.pusher.channels.channels[this.name].trigger("client-".concat(eventName), data);
  20171. return this;
  20172. }
  20173. }]);
  20174. return PusherPrivateChannel;
  20175. }(PusherChannel);
  20176. /**
  20177. * This class represents a Pusher private channel.
  20178. */
  20179. var PusherEncryptedPrivateChannel = /*#__PURE__*/function (_PusherChannel) {
  20180. _inherits(PusherEncryptedPrivateChannel, _PusherChannel);
  20181. var _super = _createSuper(PusherEncryptedPrivateChannel);
  20182. function PusherEncryptedPrivateChannel() {
  20183. _classCallCheck(this, PusherEncryptedPrivateChannel);
  20184. return _super.apply(this, arguments);
  20185. }
  20186. _createClass(PusherEncryptedPrivateChannel, [{
  20187. key: "whisper",
  20188. /**
  20189. * Trigger client event on the channel.
  20190. */
  20191. value: function whisper(eventName, data) {
  20192. this.pusher.channels.channels[this.name].trigger("client-".concat(eventName), data);
  20193. return this;
  20194. }
  20195. }]);
  20196. return PusherEncryptedPrivateChannel;
  20197. }(PusherChannel);
  20198. /**
  20199. * This class represents a Pusher presence channel.
  20200. */
  20201. var PusherPresenceChannel = /*#__PURE__*/function (_PusherChannel) {
  20202. _inherits(PusherPresenceChannel, _PusherChannel);
  20203. var _super = _createSuper(PusherPresenceChannel);
  20204. function PusherPresenceChannel() {
  20205. _classCallCheck(this, PusherPresenceChannel);
  20206. return _super.apply(this, arguments);
  20207. }
  20208. _createClass(PusherPresenceChannel, [{
  20209. key: "here",
  20210. /**
  20211. * Register a callback to be called anytime the member list changes.
  20212. */
  20213. value: function here(callback) {
  20214. this.on('pusher:subscription_succeeded', function (data) {
  20215. callback(Object.keys(data.members).map(function (k) {
  20216. return data.members[k];
  20217. }));
  20218. });
  20219. return this;
  20220. }
  20221. /**
  20222. * Listen for someone joining the channel.
  20223. */
  20224. }, {
  20225. key: "joining",
  20226. value: function joining(callback) {
  20227. this.on('pusher:member_added', function (member) {
  20228. callback(member.info);
  20229. });
  20230. return this;
  20231. }
  20232. /**
  20233. * Listen for someone leaving the channel.
  20234. */
  20235. }, {
  20236. key: "leaving",
  20237. value: function leaving(callback) {
  20238. this.on('pusher:member_removed', function (member) {
  20239. callback(member.info);
  20240. });
  20241. return this;
  20242. }
  20243. /**
  20244. * Trigger client event on the channel.
  20245. */
  20246. }, {
  20247. key: "whisper",
  20248. value: function whisper(eventName, data) {
  20249. this.pusher.channels.channels[this.name].trigger("client-".concat(eventName), data);
  20250. return this;
  20251. }
  20252. }]);
  20253. return PusherPresenceChannel;
  20254. }(PusherChannel);
  20255. /**
  20256. * This class represents a Socket.io channel.
  20257. */
  20258. var SocketIoChannel = /*#__PURE__*/function (_Channel) {
  20259. _inherits(SocketIoChannel, _Channel);
  20260. var _super = _createSuper(SocketIoChannel);
  20261. /**
  20262. * Create a new class instance.
  20263. */
  20264. function SocketIoChannel(socket, name, options) {
  20265. var _this;
  20266. _classCallCheck(this, SocketIoChannel);
  20267. _this = _super.call(this);
  20268. /**
  20269. * The event callbacks applied to the channel.
  20270. */
  20271. _this.events = {};
  20272. _this.name = name;
  20273. _this.socket = socket;
  20274. _this.options = options;
  20275. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  20276. _this.subscribe();
  20277. _this.configureReconnector();
  20278. return _this;
  20279. }
  20280. /**
  20281. * Subscribe to a Socket.io channel.
  20282. */
  20283. _createClass(SocketIoChannel, [{
  20284. key: "subscribe",
  20285. value: function subscribe() {
  20286. this.socket.emit('subscribe', {
  20287. channel: this.name,
  20288. auth: this.options.auth || {}
  20289. });
  20290. }
  20291. /**
  20292. * Unsubscribe from channel and ubind event callbacks.
  20293. */
  20294. }, {
  20295. key: "unsubscribe",
  20296. value: function unsubscribe() {
  20297. this.unbind();
  20298. this.socket.emit('unsubscribe', {
  20299. channel: this.name,
  20300. auth: this.options.auth || {}
  20301. });
  20302. }
  20303. /**
  20304. * Listen for an event on the channel instance.
  20305. */
  20306. }, {
  20307. key: "listen",
  20308. value: function listen(event, callback) {
  20309. this.on(this.eventFormatter.format(event), callback);
  20310. return this;
  20311. }
  20312. /**
  20313. * Stop listening for an event on the channel instance.
  20314. */
  20315. }, {
  20316. key: "stopListening",
  20317. value: function stopListening(event) {
  20318. var name = this.eventFormatter.format(event);
  20319. this.socket.removeListener(name);
  20320. delete this.events[name];
  20321. return this;
  20322. }
  20323. /**
  20324. * Bind the channel's socket to an event and store the callback.
  20325. */
  20326. }, {
  20327. key: "on",
  20328. value: function on(event, callback) {
  20329. var _this2 = this;
  20330. var listener = function listener(channel, data) {
  20331. if (_this2.name == channel) {
  20332. callback(data);
  20333. }
  20334. };
  20335. this.socket.on(event, listener);
  20336. this.bind(event, listener);
  20337. }
  20338. /**
  20339. * Attach a 'reconnect' listener and bind the event.
  20340. */
  20341. }, {
  20342. key: "configureReconnector",
  20343. value: function configureReconnector() {
  20344. var _this3 = this;
  20345. var listener = function listener() {
  20346. _this3.subscribe();
  20347. };
  20348. this.socket.on('reconnect', listener);
  20349. this.bind('reconnect', listener);
  20350. }
  20351. /**
  20352. * Bind the channel's socket to an event and store the callback.
  20353. */
  20354. }, {
  20355. key: "bind",
  20356. value: function bind(event, callback) {
  20357. this.events[event] = this.events[event] || [];
  20358. this.events[event].push(callback);
  20359. }
  20360. /**
  20361. * Unbind the channel's socket from all stored event callbacks.
  20362. */
  20363. }, {
  20364. key: "unbind",
  20365. value: function unbind() {
  20366. var _this4 = this;
  20367. Object.keys(this.events).forEach(function (event) {
  20368. _this4.events[event].forEach(function (callback) {
  20369. _this4.socket.removeListener(event, callback);
  20370. });
  20371. delete _this4.events[event];
  20372. });
  20373. }
  20374. }]);
  20375. return SocketIoChannel;
  20376. }(Channel);
  20377. /**
  20378. * This class represents a Socket.io presence channel.
  20379. */
  20380. var SocketIoPrivateChannel = /*#__PURE__*/function (_SocketIoChannel) {
  20381. _inherits(SocketIoPrivateChannel, _SocketIoChannel);
  20382. var _super = _createSuper(SocketIoPrivateChannel);
  20383. function SocketIoPrivateChannel() {
  20384. _classCallCheck(this, SocketIoPrivateChannel);
  20385. return _super.apply(this, arguments);
  20386. }
  20387. _createClass(SocketIoPrivateChannel, [{
  20388. key: "whisper",
  20389. /**
  20390. * Trigger client event on the channel.
  20391. */
  20392. value: function whisper(eventName, data) {
  20393. this.socket.emit('client event', {
  20394. channel: this.name,
  20395. event: "client-".concat(eventName),
  20396. data: data
  20397. });
  20398. return this;
  20399. }
  20400. }]);
  20401. return SocketIoPrivateChannel;
  20402. }(SocketIoChannel);
  20403. /**
  20404. * This class represents a Socket.io presence channel.
  20405. */
  20406. var SocketIoPresenceChannel = /*#__PURE__*/function (_SocketIoPrivateChann) {
  20407. _inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  20408. var _super = _createSuper(SocketIoPresenceChannel);
  20409. function SocketIoPresenceChannel() {
  20410. _classCallCheck(this, SocketIoPresenceChannel);
  20411. return _super.apply(this, arguments);
  20412. }
  20413. _createClass(SocketIoPresenceChannel, [{
  20414. key: "here",
  20415. /**
  20416. * Register a callback to be called anytime the member list changes.
  20417. */
  20418. value: function here(callback) {
  20419. this.on('presence:subscribed', function (members) {
  20420. callback(members.map(function (m) {
  20421. return m.user_info;
  20422. }));
  20423. });
  20424. return this;
  20425. }
  20426. /**
  20427. * Listen for someone joining the channel.
  20428. */
  20429. }, {
  20430. key: "joining",
  20431. value: function joining(callback) {
  20432. this.on('presence:joining', function (member) {
  20433. return callback(member.user_info);
  20434. });
  20435. return this;
  20436. }
  20437. /**
  20438. * Listen for someone leaving the channel.
  20439. */
  20440. }, {
  20441. key: "leaving",
  20442. value: function leaving(callback) {
  20443. this.on('presence:leaving', function (member) {
  20444. return callback(member.user_info);
  20445. });
  20446. return this;
  20447. }
  20448. }]);
  20449. return SocketIoPresenceChannel;
  20450. }(SocketIoPrivateChannel);
  20451. /**
  20452. * This class represents a null channel.
  20453. */
  20454. var NullChannel = /*#__PURE__*/function (_Channel) {
  20455. _inherits(NullChannel, _Channel);
  20456. var _super = _createSuper(NullChannel);
  20457. function NullChannel() {
  20458. _classCallCheck(this, NullChannel);
  20459. return _super.apply(this, arguments);
  20460. }
  20461. _createClass(NullChannel, [{
  20462. key: "subscribe",
  20463. /**
  20464. * Subscribe to a channel.
  20465. */
  20466. value: function subscribe() {} //
  20467. /**
  20468. * Unsubscribe from a channel.
  20469. */
  20470. }, {
  20471. key: "unsubscribe",
  20472. value: function unsubscribe() {} //
  20473. /**
  20474. * Listen for an event on the channel instance.
  20475. */
  20476. }, {
  20477. key: "listen",
  20478. value: function listen(event, callback) {
  20479. return this;
  20480. }
  20481. /**
  20482. * Stop listening for an event on the channel instance.
  20483. */
  20484. }, {
  20485. key: "stopListening",
  20486. value: function stopListening(event) {
  20487. return this;
  20488. }
  20489. /**
  20490. * Bind a channel to an event.
  20491. */
  20492. }, {
  20493. key: "on",
  20494. value: function on(event, callback) {
  20495. return this;
  20496. }
  20497. }]);
  20498. return NullChannel;
  20499. }(Channel);
  20500. /**
  20501. * This class represents a null private channel.
  20502. */
  20503. var NullPrivateChannel = /*#__PURE__*/function (_NullChannel) {
  20504. _inherits(NullPrivateChannel, _NullChannel);
  20505. var _super = _createSuper(NullPrivateChannel);
  20506. function NullPrivateChannel() {
  20507. _classCallCheck(this, NullPrivateChannel);
  20508. return _super.apply(this, arguments);
  20509. }
  20510. _createClass(NullPrivateChannel, [{
  20511. key: "whisper",
  20512. /**
  20513. * Trigger client event on the channel.
  20514. */
  20515. value: function whisper(eventName, data) {
  20516. return this;
  20517. }
  20518. }]);
  20519. return NullPrivateChannel;
  20520. }(NullChannel);
  20521. /**
  20522. * This class represents a null presence channel.
  20523. */
  20524. var NullPresenceChannel = /*#__PURE__*/function (_NullChannel) {
  20525. _inherits(NullPresenceChannel, _NullChannel);
  20526. var _super = _createSuper(NullPresenceChannel);
  20527. function NullPresenceChannel() {
  20528. _classCallCheck(this, NullPresenceChannel);
  20529. return _super.apply(this, arguments);
  20530. }
  20531. _createClass(NullPresenceChannel, [{
  20532. key: "here",
  20533. /**
  20534. * Register a callback to be called anytime the member list changes.
  20535. */
  20536. value: function here(callback) {
  20537. return this;
  20538. }
  20539. /**
  20540. * Listen for someone joining the channel.
  20541. */
  20542. }, {
  20543. key: "joining",
  20544. value: function joining(callback) {
  20545. return this;
  20546. }
  20547. /**
  20548. * Listen for someone leaving the channel.
  20549. */
  20550. }, {
  20551. key: "leaving",
  20552. value: function leaving(callback) {
  20553. return this;
  20554. }
  20555. /**
  20556. * Trigger client event on the channel.
  20557. */
  20558. }, {
  20559. key: "whisper",
  20560. value: function whisper(eventName, data) {
  20561. return this;
  20562. }
  20563. }]);
  20564. return NullPresenceChannel;
  20565. }(NullChannel);
  20566. /**
  20567. * This class creates a connector to Pusher.
  20568. */
  20569. var PusherConnector = /*#__PURE__*/function (_Connector) {
  20570. _inherits(PusherConnector, _Connector);
  20571. var _super = _createSuper(PusherConnector);
  20572. function PusherConnector() {
  20573. var _this;
  20574. _classCallCheck(this, PusherConnector);
  20575. _this = _super.apply(this, arguments);
  20576. /**
  20577. * All of the subscribed channel names.
  20578. */
  20579. _this.channels = {};
  20580. return _this;
  20581. }
  20582. /**
  20583. * Create a fresh Pusher connection.
  20584. */
  20585. _createClass(PusherConnector, [{
  20586. key: "connect",
  20587. value: function connect() {
  20588. if (typeof this.options.client !== 'undefined') {
  20589. this.pusher = this.options.client;
  20590. } else {
  20591. this.pusher = new Pusher(this.options.key, this.options);
  20592. }
  20593. }
  20594. /**
  20595. * Listen for an event on a channel instance.
  20596. */
  20597. }, {
  20598. key: "listen",
  20599. value: function listen(name, event, callback) {
  20600. return this.channel(name).listen(event, callback);
  20601. }
  20602. /**
  20603. * Get a channel instance by name.
  20604. */
  20605. }, {
  20606. key: "channel",
  20607. value: function channel(name) {
  20608. if (!this.channels[name]) {
  20609. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  20610. }
  20611. return this.channels[name];
  20612. }
  20613. /**
  20614. * Get a private channel instance by name.
  20615. */
  20616. }, {
  20617. key: "privateChannel",
  20618. value: function privateChannel(name) {
  20619. if (!this.channels['private-' + name]) {
  20620. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  20621. }
  20622. return this.channels['private-' + name];
  20623. }
  20624. /**
  20625. * Get a private encrypted channel instance by name.
  20626. */
  20627. }, {
  20628. key: "encryptedPrivateChannel",
  20629. value: function encryptedPrivateChannel(name) {
  20630. if (!this.channels['private-encrypted-' + name]) {
  20631. this.channels['private-encrypted-' + name] = new PusherEncryptedPrivateChannel(this.pusher, 'private-encrypted-' + name, this.options);
  20632. }
  20633. return this.channels['private-encrypted-' + name];
  20634. }
  20635. /**
  20636. * Get a presence channel instance by name.
  20637. */
  20638. }, {
  20639. key: "presenceChannel",
  20640. value: function presenceChannel(name) {
  20641. if (!this.channels['presence-' + name]) {
  20642. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  20643. }
  20644. return this.channels['presence-' + name];
  20645. }
  20646. /**
  20647. * Leave the given channel, as well as its private and presence variants.
  20648. */
  20649. }, {
  20650. key: "leave",
  20651. value: function leave(name) {
  20652. var _this2 = this;
  20653. var channels = [name, 'private-' + name, 'presence-' + name];
  20654. channels.forEach(function (name, index) {
  20655. _this2.leaveChannel(name);
  20656. });
  20657. }
  20658. /**
  20659. * Leave the given channel.
  20660. */
  20661. }, {
  20662. key: "leaveChannel",
  20663. value: function leaveChannel(name) {
  20664. if (this.channels[name]) {
  20665. this.channels[name].unsubscribe();
  20666. delete this.channels[name];
  20667. }
  20668. }
  20669. /**
  20670. * Get the socket ID for the connection.
  20671. */
  20672. }, {
  20673. key: "socketId",
  20674. value: function socketId() {
  20675. return this.pusher.connection.socket_id;
  20676. }
  20677. /**
  20678. * Disconnect Pusher connection.
  20679. */
  20680. }, {
  20681. key: "disconnect",
  20682. value: function disconnect() {
  20683. this.pusher.disconnect();
  20684. }
  20685. }]);
  20686. return PusherConnector;
  20687. }(Connector);
  20688. /**
  20689. * This class creates a connnector to a Socket.io server.
  20690. */
  20691. var SocketIoConnector = /*#__PURE__*/function (_Connector) {
  20692. _inherits(SocketIoConnector, _Connector);
  20693. var _super = _createSuper(SocketIoConnector);
  20694. function SocketIoConnector() {
  20695. var _this;
  20696. _classCallCheck(this, SocketIoConnector);
  20697. _this = _super.apply(this, arguments);
  20698. /**
  20699. * All of the subscribed channel names.
  20700. */
  20701. _this.channels = {};
  20702. return _this;
  20703. }
  20704. /**
  20705. * Create a fresh Socket.io connection.
  20706. */
  20707. _createClass(SocketIoConnector, [{
  20708. key: "connect",
  20709. value: function connect() {
  20710. var io = this.getSocketIO();
  20711. this.socket = io(this.options.host, this.options);
  20712. return this.socket;
  20713. }
  20714. /**
  20715. * Get socket.io module from global scope or options.
  20716. */
  20717. }, {
  20718. key: "getSocketIO",
  20719. value: function getSocketIO() {
  20720. if (typeof this.options.client !== 'undefined') {
  20721. return this.options.client;
  20722. }
  20723. if (typeof io !== 'undefined') {
  20724. return io;
  20725. }
  20726. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  20727. }
  20728. /**
  20729. * Listen for an event on a channel instance.
  20730. */
  20731. }, {
  20732. key: "listen",
  20733. value: function listen(name, event, callback) {
  20734. return this.channel(name).listen(event, callback);
  20735. }
  20736. /**
  20737. * Get a channel instance by name.
  20738. */
  20739. }, {
  20740. key: "channel",
  20741. value: function channel(name) {
  20742. if (!this.channels[name]) {
  20743. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  20744. }
  20745. return this.channels[name];
  20746. }
  20747. /**
  20748. * Get a private channel instance by name.
  20749. */
  20750. }, {
  20751. key: "privateChannel",
  20752. value: function privateChannel(name) {
  20753. if (!this.channels['private-' + name]) {
  20754. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  20755. }
  20756. return this.channels['private-' + name];
  20757. }
  20758. /**
  20759. * Get a presence channel instance by name.
  20760. */
  20761. }, {
  20762. key: "presenceChannel",
  20763. value: function presenceChannel(name) {
  20764. if (!this.channels['presence-' + name]) {
  20765. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  20766. }
  20767. return this.channels['presence-' + name];
  20768. }
  20769. /**
  20770. * Leave the given channel, as well as its private and presence variants.
  20771. */
  20772. }, {
  20773. key: "leave",
  20774. value: function leave(name) {
  20775. var _this2 = this;
  20776. var channels = [name, 'private-' + name, 'presence-' + name];
  20777. channels.forEach(function (name) {
  20778. _this2.leaveChannel(name);
  20779. });
  20780. }
  20781. /**
  20782. * Leave the given channel.
  20783. */
  20784. }, {
  20785. key: "leaveChannel",
  20786. value: function leaveChannel(name) {
  20787. if (this.channels[name]) {
  20788. this.channels[name].unsubscribe();
  20789. delete this.channels[name];
  20790. }
  20791. }
  20792. /**
  20793. * Get the socket ID for the connection.
  20794. */
  20795. }, {
  20796. key: "socketId",
  20797. value: function socketId() {
  20798. return this.socket.id;
  20799. }
  20800. /**
  20801. * Disconnect Socketio connection.
  20802. */
  20803. }, {
  20804. key: "disconnect",
  20805. value: function disconnect() {
  20806. this.socket.disconnect();
  20807. }
  20808. }]);
  20809. return SocketIoConnector;
  20810. }(Connector);
  20811. /**
  20812. * This class creates a null connector.
  20813. */
  20814. var NullConnector = /*#__PURE__*/function (_Connector) {
  20815. _inherits(NullConnector, _Connector);
  20816. var _super = _createSuper(NullConnector);
  20817. function NullConnector() {
  20818. var _this;
  20819. _classCallCheck(this, NullConnector);
  20820. _this = _super.apply(this, arguments);
  20821. /**
  20822. * All of the subscribed channel names.
  20823. */
  20824. _this.channels = {};
  20825. return _this;
  20826. }
  20827. /**
  20828. * Create a fresh connection.
  20829. */
  20830. _createClass(NullConnector, [{
  20831. key: "connect",
  20832. value: function connect() {} //
  20833. /**
  20834. * Listen for an event on a channel instance.
  20835. */
  20836. }, {
  20837. key: "listen",
  20838. value: function listen(name, event, callback) {
  20839. return new NullChannel();
  20840. }
  20841. /**
  20842. * Get a channel instance by name.
  20843. */
  20844. }, {
  20845. key: "channel",
  20846. value: function channel(name) {
  20847. return new NullChannel();
  20848. }
  20849. /**
  20850. * Get a private channel instance by name.
  20851. */
  20852. }, {
  20853. key: "privateChannel",
  20854. value: function privateChannel(name) {
  20855. return new NullPrivateChannel();
  20856. }
  20857. /**
  20858. * Get a presence channel instance by name.
  20859. */
  20860. }, {
  20861. key: "presenceChannel",
  20862. value: function presenceChannel(name) {
  20863. return new NullPresenceChannel();
  20864. }
  20865. /**
  20866. * Leave the given channel, as well as its private and presence variants.
  20867. */
  20868. }, {
  20869. key: "leave",
  20870. value: function leave(name) {} //
  20871. /**
  20872. * Leave the given channel.
  20873. */
  20874. }, {
  20875. key: "leaveChannel",
  20876. value: function leaveChannel(name) {} //
  20877. /**
  20878. * Get the socket ID for the connection.
  20879. */
  20880. }, {
  20881. key: "socketId",
  20882. value: function socketId() {
  20883. return 'fake-socket-id';
  20884. }
  20885. /**
  20886. * Disconnect the connection.
  20887. */
  20888. }, {
  20889. key: "disconnect",
  20890. value: function disconnect() {//
  20891. }
  20892. }]);
  20893. return NullConnector;
  20894. }(Connector);
  20895. /**
  20896. * This class is the primary API for interacting with broadcasting.
  20897. */
  20898. var Echo = /*#__PURE__*/function () {
  20899. /**
  20900. * Create a new class instance.
  20901. */
  20902. function Echo(options) {
  20903. _classCallCheck(this, Echo);
  20904. this.options = options;
  20905. this.connect();
  20906. if (!this.options.withoutInterceptors) {
  20907. this.registerInterceptors();
  20908. }
  20909. }
  20910. /**
  20911. * Get a channel instance by name.
  20912. */
  20913. _createClass(Echo, [{
  20914. key: "channel",
  20915. value: function channel(_channel) {
  20916. return this.connector.channel(_channel);
  20917. }
  20918. /**
  20919. * Create a new connection.
  20920. */
  20921. }, {
  20922. key: "connect",
  20923. value: function connect() {
  20924. if (this.options.broadcaster == 'pusher') {
  20925. this.connector = new PusherConnector(this.options);
  20926. } else if (this.options.broadcaster == 'socket.io') {
  20927. this.connector = new SocketIoConnector(this.options);
  20928. } else if (this.options.broadcaster == 'null') {
  20929. this.connector = new NullConnector(this.options);
  20930. } else if (typeof this.options.broadcaster == 'function') {
  20931. this.connector = new this.options.broadcaster(this.options);
  20932. }
  20933. }
  20934. /**
  20935. * Disconnect from the Echo server.
  20936. */
  20937. }, {
  20938. key: "disconnect",
  20939. value: function disconnect() {
  20940. this.connector.disconnect();
  20941. }
  20942. /**
  20943. * Get a presence channel instance by name.
  20944. */
  20945. }, {
  20946. key: "join",
  20947. value: function join(channel) {
  20948. return this.connector.presenceChannel(channel);
  20949. }
  20950. /**
  20951. * Leave the given channel, as well as its private and presence variants.
  20952. */
  20953. }, {
  20954. key: "leave",
  20955. value: function leave(channel) {
  20956. this.connector.leave(channel);
  20957. }
  20958. /**
  20959. * Leave the given channel.
  20960. */
  20961. }, {
  20962. key: "leaveChannel",
  20963. value: function leaveChannel(channel) {
  20964. this.connector.leaveChannel(channel);
  20965. }
  20966. /**
  20967. * Listen for an event on a channel instance.
  20968. */
  20969. }, {
  20970. key: "listen",
  20971. value: function listen(channel, event, callback) {
  20972. return this.connector.listen(channel, event, callback);
  20973. }
  20974. /**
  20975. * Get a private channel instance by name.
  20976. */
  20977. }, {
  20978. key: "private",
  20979. value: function _private(channel) {
  20980. return this.connector.privateChannel(channel);
  20981. }
  20982. /**
  20983. * Get a private encrypted channel instance by name.
  20984. */
  20985. }, {
  20986. key: "encryptedPrivate",
  20987. value: function encryptedPrivate(channel) {
  20988. return this.connector.encryptedPrivateChannel(channel);
  20989. }
  20990. /**
  20991. * Get the Socket ID for the connection.
  20992. */
  20993. }, {
  20994. key: "socketId",
  20995. value: function socketId() {
  20996. return this.connector.socketId();
  20997. }
  20998. /**
  20999. * Register 3rd party request interceptiors. These are used to automatically
  21000. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  21001. */
  21002. }, {
  21003. key: "registerInterceptors",
  21004. value: function registerInterceptors() {
  21005. if (typeof Vue === 'function' && Vue.http) {
  21006. this.registerVueRequestInterceptor();
  21007. }
  21008. if (typeof axios === 'function') {
  21009. this.registerAxiosRequestInterceptor();
  21010. }
  21011. if (typeof jQuery === 'function') {
  21012. this.registerjQueryAjaxSetup();
  21013. }
  21014. }
  21015. /**
  21016. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  21017. */
  21018. }, {
  21019. key: "registerVueRequestInterceptor",
  21020. value: function registerVueRequestInterceptor() {
  21021. var _this = this;
  21022. Vue.http.interceptors.push(function (request, next) {
  21023. if (_this.socketId()) {
  21024. request.headers.set('X-Socket-ID', _this.socketId());
  21025. }
  21026. next();
  21027. });
  21028. }
  21029. /**
  21030. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  21031. */
  21032. }, {
  21033. key: "registerAxiosRequestInterceptor",
  21034. value: function registerAxiosRequestInterceptor() {
  21035. var _this2 = this;
  21036. axios.interceptors.request.use(function (config) {
  21037. if (_this2.socketId()) {
  21038. config.headers['X-Socket-Id'] = _this2.socketId();
  21039. }
  21040. return config;
  21041. });
  21042. }
  21043. /**
  21044. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  21045. */
  21046. }, {
  21047. key: "registerjQueryAjaxSetup",
  21048. value: function registerjQueryAjaxSetup() {
  21049. var _this3 = this;
  21050. if (typeof jQuery.ajax != 'undefined') {
  21051. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  21052. if (_this3.socketId()) {
  21053. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  21054. }
  21055. });
  21056. }
  21057. }
  21058. }]);
  21059. return Echo;
  21060. }();
  21061. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  21062. /***/ }),
  21063. /***/ "./node_modules/lodash/lodash.js":
  21064. /*!***************************************!*\
  21065. !*** ./node_modules/lodash/lodash.js ***!
  21066. \***************************************/
  21067. /*! no static exports found */
  21068. /***/ (function(module, exports, __webpack_require__) {
  21069. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  21070. * @license
  21071. * Lodash <https://lodash.com/>
  21072. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  21073. * Released under MIT license <https://lodash.com/license>
  21074. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  21075. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  21076. */
  21077. ;(function() {
  21078. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  21079. var undefined;
  21080. /** Used as the semantic version number. */
  21081. var VERSION = '4.17.15';
  21082. /** Used as the size to enable large array optimizations. */
  21083. var LARGE_ARRAY_SIZE = 200;
  21084. /** Error message constants. */
  21085. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  21086. FUNC_ERROR_TEXT = 'Expected a function';
  21087. /** Used to stand-in for `undefined` hash values. */
  21088. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  21089. /** Used as the maximum memoize cache size. */
  21090. var MAX_MEMOIZE_SIZE = 500;
  21091. /** Used as the internal argument placeholder. */
  21092. var PLACEHOLDER = '__lodash_placeholder__';
  21093. /** Used to compose bitmasks for cloning. */
  21094. var CLONE_DEEP_FLAG = 1,
  21095. CLONE_FLAT_FLAG = 2,
  21096. CLONE_SYMBOLS_FLAG = 4;
  21097. /** Used to compose bitmasks for value comparisons. */
  21098. var COMPARE_PARTIAL_FLAG = 1,
  21099. COMPARE_UNORDERED_FLAG = 2;
  21100. /** Used to compose bitmasks for function metadata. */
  21101. var WRAP_BIND_FLAG = 1,
  21102. WRAP_BIND_KEY_FLAG = 2,
  21103. WRAP_CURRY_BOUND_FLAG = 4,
  21104. WRAP_CURRY_FLAG = 8,
  21105. WRAP_CURRY_RIGHT_FLAG = 16,
  21106. WRAP_PARTIAL_FLAG = 32,
  21107. WRAP_PARTIAL_RIGHT_FLAG = 64,
  21108. WRAP_ARY_FLAG = 128,
  21109. WRAP_REARG_FLAG = 256,
  21110. WRAP_FLIP_FLAG = 512;
  21111. /** Used as default options for `_.truncate`. */
  21112. var DEFAULT_TRUNC_LENGTH = 30,
  21113. DEFAULT_TRUNC_OMISSION = '...';
  21114. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  21115. var HOT_COUNT = 800,
  21116. HOT_SPAN = 16;
  21117. /** Used to indicate the type of lazy iteratees. */
  21118. var LAZY_FILTER_FLAG = 1,
  21119. LAZY_MAP_FLAG = 2,
  21120. LAZY_WHILE_FLAG = 3;
  21121. /** Used as references for various `Number` constants. */
  21122. var INFINITY = 1 / 0,
  21123. MAX_SAFE_INTEGER = 9007199254740991,
  21124. MAX_INTEGER = 1.7976931348623157e+308,
  21125. NAN = 0 / 0;
  21126. /** Used as references for the maximum length and index of an array. */
  21127. var MAX_ARRAY_LENGTH = 4294967295,
  21128. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  21129. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  21130. /** Used to associate wrap methods with their bit flags. */
  21131. var wrapFlags = [
  21132. ['ary', WRAP_ARY_FLAG],
  21133. ['bind', WRAP_BIND_FLAG],
  21134. ['bindKey', WRAP_BIND_KEY_FLAG],
  21135. ['curry', WRAP_CURRY_FLAG],
  21136. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  21137. ['flip', WRAP_FLIP_FLAG],
  21138. ['partial', WRAP_PARTIAL_FLAG],
  21139. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  21140. ['rearg', WRAP_REARG_FLAG]
  21141. ];
  21142. /** `Object#toString` result references. */
  21143. var argsTag = '[object Arguments]',
  21144. arrayTag = '[object Array]',
  21145. asyncTag = '[object AsyncFunction]',
  21146. boolTag = '[object Boolean]',
  21147. dateTag = '[object Date]',
  21148. domExcTag = '[object DOMException]',
  21149. errorTag = '[object Error]',
  21150. funcTag = '[object Function]',
  21151. genTag = '[object GeneratorFunction]',
  21152. mapTag = '[object Map]',
  21153. numberTag = '[object Number]',
  21154. nullTag = '[object Null]',
  21155. objectTag = '[object Object]',
  21156. promiseTag = '[object Promise]',
  21157. proxyTag = '[object Proxy]',
  21158. regexpTag = '[object RegExp]',
  21159. setTag = '[object Set]',
  21160. stringTag = '[object String]',
  21161. symbolTag = '[object Symbol]',
  21162. undefinedTag = '[object Undefined]',
  21163. weakMapTag = '[object WeakMap]',
  21164. weakSetTag = '[object WeakSet]';
  21165. var arrayBufferTag = '[object ArrayBuffer]',
  21166. dataViewTag = '[object DataView]',
  21167. float32Tag = '[object Float32Array]',
  21168. float64Tag = '[object Float64Array]',
  21169. int8Tag = '[object Int8Array]',
  21170. int16Tag = '[object Int16Array]',
  21171. int32Tag = '[object Int32Array]',
  21172. uint8Tag = '[object Uint8Array]',
  21173. uint8ClampedTag = '[object Uint8ClampedArray]',
  21174. uint16Tag = '[object Uint16Array]',
  21175. uint32Tag = '[object Uint32Array]';
  21176. /** Used to match empty string literals in compiled template source. */
  21177. var reEmptyStringLeading = /\b__p \+= '';/g,
  21178. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  21179. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  21180. /** Used to match HTML entities and HTML characters. */
  21181. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  21182. reUnescapedHtml = /[&<>"']/g,
  21183. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  21184. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  21185. /** Used to match template delimiters. */
  21186. var reEscape = /<%-([\s\S]+?)%>/g,
  21187. reEvaluate = /<%([\s\S]+?)%>/g,
  21188. reInterpolate = /<%=([\s\S]+?)%>/g;
  21189. /** Used to match property names within property paths. */
  21190. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  21191. reIsPlainProp = /^\w*$/,
  21192. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  21193. /**
  21194. * Used to match `RegExp`
  21195. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  21196. */
  21197. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  21198. reHasRegExpChar = RegExp(reRegExpChar.source);
  21199. /** Used to match leading and trailing whitespace. */
  21200. var reTrim = /^\s+|\s+$/g,
  21201. reTrimStart = /^\s+/,
  21202. reTrimEnd = /\s+$/;
  21203. /** Used to match wrap detail comments. */
  21204. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  21205. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  21206. reSplitDetails = /,? & /;
  21207. /** Used to match words composed of alphanumeric characters. */
  21208. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  21209. /** Used to match backslashes in property paths. */
  21210. var reEscapeChar = /\\(\\)?/g;
  21211. /**
  21212. * Used to match
  21213. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  21214. */
  21215. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  21216. /** Used to match `RegExp` flags from their coerced string values. */
  21217. var reFlags = /\w*$/;
  21218. /** Used to detect bad signed hexadecimal string values. */
  21219. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  21220. /** Used to detect binary string values. */
  21221. var reIsBinary = /^0b[01]+$/i;
  21222. /** Used to detect host constructors (Safari). */
  21223. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  21224. /** Used to detect octal string values. */
  21225. var reIsOctal = /^0o[0-7]+$/i;
  21226. /** Used to detect unsigned integer values. */
  21227. var reIsUint = /^(?:0|[1-9]\d*)$/;
  21228. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  21229. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  21230. /** Used to ensure capturing order of template delimiters. */
  21231. var reNoMatch = /($^)/;
  21232. /** Used to match unescaped characters in compiled string literals. */
  21233. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  21234. /** Used to compose unicode character classes. */
  21235. var rsAstralRange = '\\ud800-\\udfff',
  21236. rsComboMarksRange = '\\u0300-\\u036f',
  21237. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  21238. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  21239. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  21240. rsDingbatRange = '\\u2700-\\u27bf',
  21241. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  21242. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  21243. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  21244. rsPunctuationRange = '\\u2000-\\u206f',
  21245. 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',
  21246. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  21247. rsVarRange = '\\ufe0e\\ufe0f',
  21248. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  21249. /** Used to compose unicode capture groups. */
  21250. var rsApos = "['\u2019]",
  21251. rsAstral = '[' + rsAstralRange + ']',
  21252. rsBreak = '[' + rsBreakRange + ']',
  21253. rsCombo = '[' + rsComboRange + ']',
  21254. rsDigits = '\\d+',
  21255. rsDingbat = '[' + rsDingbatRange + ']',
  21256. rsLower = '[' + rsLowerRange + ']',
  21257. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  21258. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  21259. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  21260. rsNonAstral = '[^' + rsAstralRange + ']',
  21261. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  21262. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  21263. rsUpper = '[' + rsUpperRange + ']',
  21264. rsZWJ = '\\u200d';
  21265. /** Used to compose unicode regexes. */
  21266. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  21267. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  21268. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  21269. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  21270. reOptMod = rsModifier + '?',
  21271. rsOptVar = '[' + rsVarRange + ']?',
  21272. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  21273. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  21274. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  21275. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  21276. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  21277. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  21278. /** Used to match apostrophes. */
  21279. var reApos = RegExp(rsApos, 'g');
  21280. /**
  21281. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  21282. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  21283. */
  21284. var reComboMark = RegExp(rsCombo, 'g');
  21285. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  21286. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  21287. /** Used to match complex or compound words. */
  21288. var reUnicodeWord = RegExp([
  21289. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  21290. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  21291. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  21292. rsUpper + '+' + rsOptContrUpper,
  21293. rsOrdUpper,
  21294. rsOrdLower,
  21295. rsDigits,
  21296. rsEmoji
  21297. ].join('|'), 'g');
  21298. /** 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/). */
  21299. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  21300. /** Used to detect strings that need a more robust regexp to match words. */
  21301. 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 ]/;
  21302. /** Used to assign default `context` object properties. */
  21303. var contextProps = [
  21304. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  21305. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  21306. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  21307. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  21308. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  21309. ];
  21310. /** Used to make template sourceURLs easier to identify. */
  21311. var templateCounter = -1;
  21312. /** Used to identify `toStringTag` values of typed arrays. */
  21313. var typedArrayTags = {};
  21314. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  21315. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  21316. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  21317. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  21318. typedArrayTags[uint32Tag] = true;
  21319. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  21320. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  21321. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  21322. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  21323. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  21324. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  21325. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  21326. typedArrayTags[weakMapTag] = false;
  21327. /** Used to identify `toStringTag` values supported by `_.clone`. */
  21328. var cloneableTags = {};
  21329. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  21330. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  21331. cloneableTags[boolTag] = cloneableTags[dateTag] =
  21332. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  21333. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  21334. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  21335. cloneableTags[numberTag] = cloneableTags[objectTag] =
  21336. cloneableTags[regexpTag] = cloneableTags[setTag] =
  21337. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  21338. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  21339. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  21340. cloneableTags[errorTag] = cloneableTags[funcTag] =
  21341. cloneableTags[weakMapTag] = false;
  21342. /** Used to map Latin Unicode letters to basic Latin letters. */
  21343. var deburredLetters = {
  21344. // Latin-1 Supplement block.
  21345. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  21346. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  21347. '\xc7': 'C', '\xe7': 'c',
  21348. '\xd0': 'D', '\xf0': 'd',
  21349. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  21350. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  21351. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  21352. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  21353. '\xd1': 'N', '\xf1': 'n',
  21354. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  21355. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  21356. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  21357. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  21358. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  21359. '\xc6': 'Ae', '\xe6': 'ae',
  21360. '\xde': 'Th', '\xfe': 'th',
  21361. '\xdf': 'ss',
  21362. // Latin Extended-A block.
  21363. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  21364. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  21365. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  21366. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  21367. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  21368. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  21369. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  21370. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  21371. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  21372. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  21373. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  21374. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  21375. '\u0134': 'J', '\u0135': 'j',
  21376. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  21377. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  21378. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  21379. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  21380. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  21381. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  21382. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  21383. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  21384. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  21385. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  21386. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  21387. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  21388. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  21389. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  21390. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  21391. '\u0174': 'W', '\u0175': 'w',
  21392. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  21393. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  21394. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  21395. '\u0132': 'IJ', '\u0133': 'ij',
  21396. '\u0152': 'Oe', '\u0153': 'oe',
  21397. '\u0149': "'n", '\u017f': 's'
  21398. };
  21399. /** Used to map characters to HTML entities. */
  21400. var htmlEscapes = {
  21401. '&': '&amp;',
  21402. '<': '&lt;',
  21403. '>': '&gt;',
  21404. '"': '&quot;',
  21405. "'": '&#39;'
  21406. };
  21407. /** Used to map HTML entities to characters. */
  21408. var htmlUnescapes = {
  21409. '&amp;': '&',
  21410. '&lt;': '<',
  21411. '&gt;': '>',
  21412. '&quot;': '"',
  21413. '&#39;': "'"
  21414. };
  21415. /** Used to escape characters for inclusion in compiled string literals. */
  21416. var stringEscapes = {
  21417. '\\': '\\',
  21418. "'": "'",
  21419. '\n': 'n',
  21420. '\r': 'r',
  21421. '\u2028': 'u2028',
  21422. '\u2029': 'u2029'
  21423. };
  21424. /** Built-in method references without a dependency on `root`. */
  21425. var freeParseFloat = parseFloat,
  21426. freeParseInt = parseInt;
  21427. /** Detect free variable `global` from Node.js. */
  21428. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  21429. /** Detect free variable `self`. */
  21430. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  21431. /** Used as a reference to the global object. */
  21432. var root = freeGlobal || freeSelf || Function('return this')();
  21433. /** Detect free variable `exports`. */
  21434. var freeExports = true && exports && !exports.nodeType && exports;
  21435. /** Detect free variable `module`. */
  21436. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  21437. /** Detect the popular CommonJS extension `module.exports`. */
  21438. var moduleExports = freeModule && freeModule.exports === freeExports;
  21439. /** Detect free variable `process` from Node.js. */
  21440. var freeProcess = moduleExports && freeGlobal.process;
  21441. /** Used to access faster Node.js helpers. */
  21442. var nodeUtil = (function() {
  21443. try {
  21444. // Use `util.types` for Node.js 10+.
  21445. var types = freeModule && freeModule.require && freeModule.require('util').types;
  21446. if (types) {
  21447. return types;
  21448. }
  21449. // Legacy `process.binding('util')` for Node.js < 10.
  21450. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  21451. } catch (e) {}
  21452. }());
  21453. /* Node.js helper references. */
  21454. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  21455. nodeIsDate = nodeUtil && nodeUtil.isDate,
  21456. nodeIsMap = nodeUtil && nodeUtil.isMap,
  21457. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  21458. nodeIsSet = nodeUtil && nodeUtil.isSet,
  21459. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  21460. /*--------------------------------------------------------------------------*/
  21461. /**
  21462. * A faster alternative to `Function#apply`, this function invokes `func`
  21463. * with the `this` binding of `thisArg` and the arguments of `args`.
  21464. *
  21465. * @private
  21466. * @param {Function} func The function to invoke.
  21467. * @param {*} thisArg The `this` binding of `func`.
  21468. * @param {Array} args The arguments to invoke `func` with.
  21469. * @returns {*} Returns the result of `func`.
  21470. */
  21471. function apply(func, thisArg, args) {
  21472. switch (args.length) {
  21473. case 0: return func.call(thisArg);
  21474. case 1: return func.call(thisArg, args[0]);
  21475. case 2: return func.call(thisArg, args[0], args[1]);
  21476. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  21477. }
  21478. return func.apply(thisArg, args);
  21479. }
  21480. /**
  21481. * A specialized version of `baseAggregator` for arrays.
  21482. *
  21483. * @private
  21484. * @param {Array} [array] The array to iterate over.
  21485. * @param {Function} setter The function to set `accumulator` values.
  21486. * @param {Function} iteratee The iteratee to transform keys.
  21487. * @param {Object} accumulator The initial aggregated object.
  21488. * @returns {Function} Returns `accumulator`.
  21489. */
  21490. function arrayAggregator(array, setter, iteratee, accumulator) {
  21491. var index = -1,
  21492. length = array == null ? 0 : array.length;
  21493. while (++index < length) {
  21494. var value = array[index];
  21495. setter(accumulator, value, iteratee(value), array);
  21496. }
  21497. return accumulator;
  21498. }
  21499. /**
  21500. * A specialized version of `_.forEach` for arrays without support for
  21501. * iteratee shorthands.
  21502. *
  21503. * @private
  21504. * @param {Array} [array] The array to iterate over.
  21505. * @param {Function} iteratee The function invoked per iteration.
  21506. * @returns {Array} Returns `array`.
  21507. */
  21508. function arrayEach(array, iteratee) {
  21509. var index = -1,
  21510. length = array == null ? 0 : array.length;
  21511. while (++index < length) {
  21512. if (iteratee(array[index], index, array) === false) {
  21513. break;
  21514. }
  21515. }
  21516. return array;
  21517. }
  21518. /**
  21519. * A specialized version of `_.forEachRight` for arrays without support for
  21520. * iteratee shorthands.
  21521. *
  21522. * @private
  21523. * @param {Array} [array] The array to iterate over.
  21524. * @param {Function} iteratee The function invoked per iteration.
  21525. * @returns {Array} Returns `array`.
  21526. */
  21527. function arrayEachRight(array, iteratee) {
  21528. var length = array == null ? 0 : array.length;
  21529. while (length--) {
  21530. if (iteratee(array[length], length, array) === false) {
  21531. break;
  21532. }
  21533. }
  21534. return array;
  21535. }
  21536. /**
  21537. * A specialized version of `_.every` for arrays without support for
  21538. * iteratee shorthands.
  21539. *
  21540. * @private
  21541. * @param {Array} [array] The array to iterate over.
  21542. * @param {Function} predicate The function invoked per iteration.
  21543. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  21544. * else `false`.
  21545. */
  21546. function arrayEvery(array, predicate) {
  21547. var index = -1,
  21548. length = array == null ? 0 : array.length;
  21549. while (++index < length) {
  21550. if (!predicate(array[index], index, array)) {
  21551. return false;
  21552. }
  21553. }
  21554. return true;
  21555. }
  21556. /**
  21557. * A specialized version of `_.filter` for arrays without support for
  21558. * iteratee shorthands.
  21559. *
  21560. * @private
  21561. * @param {Array} [array] The array to iterate over.
  21562. * @param {Function} predicate The function invoked per iteration.
  21563. * @returns {Array} Returns the new filtered array.
  21564. */
  21565. function arrayFilter(array, predicate) {
  21566. var index = -1,
  21567. length = array == null ? 0 : array.length,
  21568. resIndex = 0,
  21569. result = [];
  21570. while (++index < length) {
  21571. var value = array[index];
  21572. if (predicate(value, index, array)) {
  21573. result[resIndex++] = value;
  21574. }
  21575. }
  21576. return result;
  21577. }
  21578. /**
  21579. * A specialized version of `_.includes` for arrays without support for
  21580. * specifying an index to search from.
  21581. *
  21582. * @private
  21583. * @param {Array} [array] The array to inspect.
  21584. * @param {*} target The value to search for.
  21585. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  21586. */
  21587. function arrayIncludes(array, value) {
  21588. var length = array == null ? 0 : array.length;
  21589. return !!length && baseIndexOf(array, value, 0) > -1;
  21590. }
  21591. /**
  21592. * This function is like `arrayIncludes` except that it accepts a comparator.
  21593. *
  21594. * @private
  21595. * @param {Array} [array] The array to inspect.
  21596. * @param {*} target The value to search for.
  21597. * @param {Function} comparator The comparator invoked per element.
  21598. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  21599. */
  21600. function arrayIncludesWith(array, value, comparator) {
  21601. var index = -1,
  21602. length = array == null ? 0 : array.length;
  21603. while (++index < length) {
  21604. if (comparator(value, array[index])) {
  21605. return true;
  21606. }
  21607. }
  21608. return false;
  21609. }
  21610. /**
  21611. * A specialized version of `_.map` for arrays without support for iteratee
  21612. * shorthands.
  21613. *
  21614. * @private
  21615. * @param {Array} [array] The array to iterate over.
  21616. * @param {Function} iteratee The function invoked per iteration.
  21617. * @returns {Array} Returns the new mapped array.
  21618. */
  21619. function arrayMap(array, iteratee) {
  21620. var index = -1,
  21621. length = array == null ? 0 : array.length,
  21622. result = Array(length);
  21623. while (++index < length) {
  21624. result[index] = iteratee(array[index], index, array);
  21625. }
  21626. return result;
  21627. }
  21628. /**
  21629. * Appends the elements of `values` to `array`.
  21630. *
  21631. * @private
  21632. * @param {Array} array The array to modify.
  21633. * @param {Array} values The values to append.
  21634. * @returns {Array} Returns `array`.
  21635. */
  21636. function arrayPush(array, values) {
  21637. var index = -1,
  21638. length = values.length,
  21639. offset = array.length;
  21640. while (++index < length) {
  21641. array[offset + index] = values[index];
  21642. }
  21643. return array;
  21644. }
  21645. /**
  21646. * A specialized version of `_.reduce` for arrays without support for
  21647. * iteratee shorthands.
  21648. *
  21649. * @private
  21650. * @param {Array} [array] The array to iterate over.
  21651. * @param {Function} iteratee The function invoked per iteration.
  21652. * @param {*} [accumulator] The initial value.
  21653. * @param {boolean} [initAccum] Specify using the first element of `array` as
  21654. * the initial value.
  21655. * @returns {*} Returns the accumulated value.
  21656. */
  21657. function arrayReduce(array, iteratee, accumulator, initAccum) {
  21658. var index = -1,
  21659. length = array == null ? 0 : array.length;
  21660. if (initAccum && length) {
  21661. accumulator = array[++index];
  21662. }
  21663. while (++index < length) {
  21664. accumulator = iteratee(accumulator, array[index], index, array);
  21665. }
  21666. return accumulator;
  21667. }
  21668. /**
  21669. * A specialized version of `_.reduceRight` for arrays without support for
  21670. * iteratee shorthands.
  21671. *
  21672. * @private
  21673. * @param {Array} [array] The array to iterate over.
  21674. * @param {Function} iteratee The function invoked per iteration.
  21675. * @param {*} [accumulator] The initial value.
  21676. * @param {boolean} [initAccum] Specify using the last element of `array` as
  21677. * the initial value.
  21678. * @returns {*} Returns the accumulated value.
  21679. */
  21680. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  21681. var length = array == null ? 0 : array.length;
  21682. if (initAccum && length) {
  21683. accumulator = array[--length];
  21684. }
  21685. while (length--) {
  21686. accumulator = iteratee(accumulator, array[length], length, array);
  21687. }
  21688. return accumulator;
  21689. }
  21690. /**
  21691. * A specialized version of `_.some` for arrays without support for iteratee
  21692. * shorthands.
  21693. *
  21694. * @private
  21695. * @param {Array} [array] The array to iterate over.
  21696. * @param {Function} predicate The function invoked per iteration.
  21697. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21698. * else `false`.
  21699. */
  21700. function arraySome(array, predicate) {
  21701. var index = -1,
  21702. length = array == null ? 0 : array.length;
  21703. while (++index < length) {
  21704. if (predicate(array[index], index, array)) {
  21705. return true;
  21706. }
  21707. }
  21708. return false;
  21709. }
  21710. /**
  21711. * Gets the size of an ASCII `string`.
  21712. *
  21713. * @private
  21714. * @param {string} string The string inspect.
  21715. * @returns {number} Returns the string size.
  21716. */
  21717. var asciiSize = baseProperty('length');
  21718. /**
  21719. * Converts an ASCII `string` to an array.
  21720. *
  21721. * @private
  21722. * @param {string} string The string to convert.
  21723. * @returns {Array} Returns the converted array.
  21724. */
  21725. function asciiToArray(string) {
  21726. return string.split('');
  21727. }
  21728. /**
  21729. * Splits an ASCII `string` into an array of its words.
  21730. *
  21731. * @private
  21732. * @param {string} The string to inspect.
  21733. * @returns {Array} Returns the words of `string`.
  21734. */
  21735. function asciiWords(string) {
  21736. return string.match(reAsciiWord) || [];
  21737. }
  21738. /**
  21739. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  21740. * without support for iteratee shorthands, which iterates over `collection`
  21741. * using `eachFunc`.
  21742. *
  21743. * @private
  21744. * @param {Array|Object} collection The collection to inspect.
  21745. * @param {Function} predicate The function invoked per iteration.
  21746. * @param {Function} eachFunc The function to iterate over `collection`.
  21747. * @returns {*} Returns the found element or its key, else `undefined`.
  21748. */
  21749. function baseFindKey(collection, predicate, eachFunc) {
  21750. var result;
  21751. eachFunc(collection, function(value, key, collection) {
  21752. if (predicate(value, key, collection)) {
  21753. result = key;
  21754. return false;
  21755. }
  21756. });
  21757. return result;
  21758. }
  21759. /**
  21760. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  21761. * support for iteratee shorthands.
  21762. *
  21763. * @private
  21764. * @param {Array} array The array to inspect.
  21765. * @param {Function} predicate The function invoked per iteration.
  21766. * @param {number} fromIndex The index to search from.
  21767. * @param {boolean} [fromRight] Specify iterating from right to left.
  21768. * @returns {number} Returns the index of the matched value, else `-1`.
  21769. */
  21770. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  21771. var length = array.length,
  21772. index = fromIndex + (fromRight ? 1 : -1);
  21773. while ((fromRight ? index-- : ++index < length)) {
  21774. if (predicate(array[index], index, array)) {
  21775. return index;
  21776. }
  21777. }
  21778. return -1;
  21779. }
  21780. /**
  21781. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  21782. *
  21783. * @private
  21784. * @param {Array} array The array to inspect.
  21785. * @param {*} value The value to search for.
  21786. * @param {number} fromIndex The index to search from.
  21787. * @returns {number} Returns the index of the matched value, else `-1`.
  21788. */
  21789. function baseIndexOf(array, value, fromIndex) {
  21790. return value === value
  21791. ? strictIndexOf(array, value, fromIndex)
  21792. : baseFindIndex(array, baseIsNaN, fromIndex);
  21793. }
  21794. /**
  21795. * This function is like `baseIndexOf` except that it accepts a comparator.
  21796. *
  21797. * @private
  21798. * @param {Array} array The array to inspect.
  21799. * @param {*} value The value to search for.
  21800. * @param {number} fromIndex The index to search from.
  21801. * @param {Function} comparator The comparator invoked per element.
  21802. * @returns {number} Returns the index of the matched value, else `-1`.
  21803. */
  21804. function baseIndexOfWith(array, value, fromIndex, comparator) {
  21805. var index = fromIndex - 1,
  21806. length = array.length;
  21807. while (++index < length) {
  21808. if (comparator(array[index], value)) {
  21809. return index;
  21810. }
  21811. }
  21812. return -1;
  21813. }
  21814. /**
  21815. * The base implementation of `_.isNaN` without support for number objects.
  21816. *
  21817. * @private
  21818. * @param {*} value The value to check.
  21819. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  21820. */
  21821. function baseIsNaN(value) {
  21822. return value !== value;
  21823. }
  21824. /**
  21825. * The base implementation of `_.mean` and `_.meanBy` without support for
  21826. * iteratee shorthands.
  21827. *
  21828. * @private
  21829. * @param {Array} array The array to iterate over.
  21830. * @param {Function} iteratee The function invoked per iteration.
  21831. * @returns {number} Returns the mean.
  21832. */
  21833. function baseMean(array, iteratee) {
  21834. var length = array == null ? 0 : array.length;
  21835. return length ? (baseSum(array, iteratee) / length) : NAN;
  21836. }
  21837. /**
  21838. * The base implementation of `_.property` without support for deep paths.
  21839. *
  21840. * @private
  21841. * @param {string} key The key of the property to get.
  21842. * @returns {Function} Returns the new accessor function.
  21843. */
  21844. function baseProperty(key) {
  21845. return function(object) {
  21846. return object == null ? undefined : object[key];
  21847. };
  21848. }
  21849. /**
  21850. * The base implementation of `_.propertyOf` without support for deep paths.
  21851. *
  21852. * @private
  21853. * @param {Object} object The object to query.
  21854. * @returns {Function} Returns the new accessor function.
  21855. */
  21856. function basePropertyOf(object) {
  21857. return function(key) {
  21858. return object == null ? undefined : object[key];
  21859. };
  21860. }
  21861. /**
  21862. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  21863. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  21864. *
  21865. * @private
  21866. * @param {Array|Object} collection The collection to iterate over.
  21867. * @param {Function} iteratee The function invoked per iteration.
  21868. * @param {*} accumulator The initial value.
  21869. * @param {boolean} initAccum Specify using the first or last element of
  21870. * `collection` as the initial value.
  21871. * @param {Function} eachFunc The function to iterate over `collection`.
  21872. * @returns {*} Returns the accumulated value.
  21873. */
  21874. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  21875. eachFunc(collection, function(value, index, collection) {
  21876. accumulator = initAccum
  21877. ? (initAccum = false, value)
  21878. : iteratee(accumulator, value, index, collection);
  21879. });
  21880. return accumulator;
  21881. }
  21882. /**
  21883. * The base implementation of `_.sortBy` which uses `comparer` to define the
  21884. * sort order of `array` and replaces criteria objects with their corresponding
  21885. * values.
  21886. *
  21887. * @private
  21888. * @param {Array} array The array to sort.
  21889. * @param {Function} comparer The function to define sort order.
  21890. * @returns {Array} Returns `array`.
  21891. */
  21892. function baseSortBy(array, comparer) {
  21893. var length = array.length;
  21894. array.sort(comparer);
  21895. while (length--) {
  21896. array[length] = array[length].value;
  21897. }
  21898. return array;
  21899. }
  21900. /**
  21901. * The base implementation of `_.sum` and `_.sumBy` without support for
  21902. * iteratee shorthands.
  21903. *
  21904. * @private
  21905. * @param {Array} array The array to iterate over.
  21906. * @param {Function} iteratee The function invoked per iteration.
  21907. * @returns {number} Returns the sum.
  21908. */
  21909. function baseSum(array, iteratee) {
  21910. var result,
  21911. index = -1,
  21912. length = array.length;
  21913. while (++index < length) {
  21914. var current = iteratee(array[index]);
  21915. if (current !== undefined) {
  21916. result = result === undefined ? current : (result + current);
  21917. }
  21918. }
  21919. return result;
  21920. }
  21921. /**
  21922. * The base implementation of `_.times` without support for iteratee shorthands
  21923. * or max array length checks.
  21924. *
  21925. * @private
  21926. * @param {number} n The number of times to invoke `iteratee`.
  21927. * @param {Function} iteratee The function invoked per iteration.
  21928. * @returns {Array} Returns the array of results.
  21929. */
  21930. function baseTimes(n, iteratee) {
  21931. var index = -1,
  21932. result = Array(n);
  21933. while (++index < n) {
  21934. result[index] = iteratee(index);
  21935. }
  21936. return result;
  21937. }
  21938. /**
  21939. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  21940. * of key-value pairs for `object` corresponding to the property names of `props`.
  21941. *
  21942. * @private
  21943. * @param {Object} object The object to query.
  21944. * @param {Array} props The property names to get values for.
  21945. * @returns {Object} Returns the key-value pairs.
  21946. */
  21947. function baseToPairs(object, props) {
  21948. return arrayMap(props, function(key) {
  21949. return [key, object[key]];
  21950. });
  21951. }
  21952. /**
  21953. * The base implementation of `_.unary` without support for storing metadata.
  21954. *
  21955. * @private
  21956. * @param {Function} func The function to cap arguments for.
  21957. * @returns {Function} Returns the new capped function.
  21958. */
  21959. function baseUnary(func) {
  21960. return function(value) {
  21961. return func(value);
  21962. };
  21963. }
  21964. /**
  21965. * The base implementation of `_.values` and `_.valuesIn` which creates an
  21966. * array of `object` property values corresponding to the property names
  21967. * of `props`.
  21968. *
  21969. * @private
  21970. * @param {Object} object The object to query.
  21971. * @param {Array} props The property names to get values for.
  21972. * @returns {Object} Returns the array of property values.
  21973. */
  21974. function baseValues(object, props) {
  21975. return arrayMap(props, function(key) {
  21976. return object[key];
  21977. });
  21978. }
  21979. /**
  21980. * Checks if a `cache` value for `key` exists.
  21981. *
  21982. * @private
  21983. * @param {Object} cache The cache to query.
  21984. * @param {string} key The key of the entry to check.
  21985. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21986. */
  21987. function cacheHas(cache, key) {
  21988. return cache.has(key);
  21989. }
  21990. /**
  21991. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  21992. * that is not found in the character symbols.
  21993. *
  21994. * @private
  21995. * @param {Array} strSymbols The string symbols to inspect.
  21996. * @param {Array} chrSymbols The character symbols to find.
  21997. * @returns {number} Returns the index of the first unmatched string symbol.
  21998. */
  21999. function charsStartIndex(strSymbols, chrSymbols) {
  22000. var index = -1,
  22001. length = strSymbols.length;
  22002. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  22003. return index;
  22004. }
  22005. /**
  22006. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  22007. * that is not found in the character symbols.
  22008. *
  22009. * @private
  22010. * @param {Array} strSymbols The string symbols to inspect.
  22011. * @param {Array} chrSymbols The character symbols to find.
  22012. * @returns {number} Returns the index of the last unmatched string symbol.
  22013. */
  22014. function charsEndIndex(strSymbols, chrSymbols) {
  22015. var index = strSymbols.length;
  22016. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  22017. return index;
  22018. }
  22019. /**
  22020. * Gets the number of `placeholder` occurrences in `array`.
  22021. *
  22022. * @private
  22023. * @param {Array} array The array to inspect.
  22024. * @param {*} placeholder The placeholder to search for.
  22025. * @returns {number} Returns the placeholder count.
  22026. */
  22027. function countHolders(array, placeholder) {
  22028. var length = array.length,
  22029. result = 0;
  22030. while (length--) {
  22031. if (array[length] === placeholder) {
  22032. ++result;
  22033. }
  22034. }
  22035. return result;
  22036. }
  22037. /**
  22038. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  22039. * letters to basic Latin letters.
  22040. *
  22041. * @private
  22042. * @param {string} letter The matched letter to deburr.
  22043. * @returns {string} Returns the deburred letter.
  22044. */
  22045. var deburrLetter = basePropertyOf(deburredLetters);
  22046. /**
  22047. * Used by `_.escape` to convert characters to HTML entities.
  22048. *
  22049. * @private
  22050. * @param {string} chr The matched character to escape.
  22051. * @returns {string} Returns the escaped character.
  22052. */
  22053. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  22054. /**
  22055. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  22056. *
  22057. * @private
  22058. * @param {string} chr The matched character to escape.
  22059. * @returns {string} Returns the escaped character.
  22060. */
  22061. function escapeStringChar(chr) {
  22062. return '\\' + stringEscapes[chr];
  22063. }
  22064. /**
  22065. * Gets the value at `key` of `object`.
  22066. *
  22067. * @private
  22068. * @param {Object} [object] The object to query.
  22069. * @param {string} key The key of the property to get.
  22070. * @returns {*} Returns the property value.
  22071. */
  22072. function getValue(object, key) {
  22073. return object == null ? undefined : object[key];
  22074. }
  22075. /**
  22076. * Checks if `string` contains Unicode symbols.
  22077. *
  22078. * @private
  22079. * @param {string} string The string to inspect.
  22080. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  22081. */
  22082. function hasUnicode(string) {
  22083. return reHasUnicode.test(string);
  22084. }
  22085. /**
  22086. * Checks if `string` contains a word composed of Unicode symbols.
  22087. *
  22088. * @private
  22089. * @param {string} string The string to inspect.
  22090. * @returns {boolean} Returns `true` if a word is found, else `false`.
  22091. */
  22092. function hasUnicodeWord(string) {
  22093. return reHasUnicodeWord.test(string);
  22094. }
  22095. /**
  22096. * Converts `iterator` to an array.
  22097. *
  22098. * @private
  22099. * @param {Object} iterator The iterator to convert.
  22100. * @returns {Array} Returns the converted array.
  22101. */
  22102. function iteratorToArray(iterator) {
  22103. var data,
  22104. result = [];
  22105. while (!(data = iterator.next()).done) {
  22106. result.push(data.value);
  22107. }
  22108. return result;
  22109. }
  22110. /**
  22111. * Converts `map` to its key-value pairs.
  22112. *
  22113. * @private
  22114. * @param {Object} map The map to convert.
  22115. * @returns {Array} Returns the key-value pairs.
  22116. */
  22117. function mapToArray(map) {
  22118. var index = -1,
  22119. result = Array(map.size);
  22120. map.forEach(function(value, key) {
  22121. result[++index] = [key, value];
  22122. });
  22123. return result;
  22124. }
  22125. /**
  22126. * Creates a unary function that invokes `func` with its argument transformed.
  22127. *
  22128. * @private
  22129. * @param {Function} func The function to wrap.
  22130. * @param {Function} transform The argument transform.
  22131. * @returns {Function} Returns the new function.
  22132. */
  22133. function overArg(func, transform) {
  22134. return function(arg) {
  22135. return func(transform(arg));
  22136. };
  22137. }
  22138. /**
  22139. * Replaces all `placeholder` elements in `array` with an internal placeholder
  22140. * and returns an array of their indexes.
  22141. *
  22142. * @private
  22143. * @param {Array} array The array to modify.
  22144. * @param {*} placeholder The placeholder to replace.
  22145. * @returns {Array} Returns the new array of placeholder indexes.
  22146. */
  22147. function replaceHolders(array, placeholder) {
  22148. var index = -1,
  22149. length = array.length,
  22150. resIndex = 0,
  22151. result = [];
  22152. while (++index < length) {
  22153. var value = array[index];
  22154. if (value === placeholder || value === PLACEHOLDER) {
  22155. array[index] = PLACEHOLDER;
  22156. result[resIndex++] = index;
  22157. }
  22158. }
  22159. return result;
  22160. }
  22161. /**
  22162. * Converts `set` to an array of its values.
  22163. *
  22164. * @private
  22165. * @param {Object} set The set to convert.
  22166. * @returns {Array} Returns the values.
  22167. */
  22168. function setToArray(set) {
  22169. var index = -1,
  22170. result = Array(set.size);
  22171. set.forEach(function(value) {
  22172. result[++index] = value;
  22173. });
  22174. return result;
  22175. }
  22176. /**
  22177. * Converts `set` to its value-value pairs.
  22178. *
  22179. * @private
  22180. * @param {Object} set The set to convert.
  22181. * @returns {Array} Returns the value-value pairs.
  22182. */
  22183. function setToPairs(set) {
  22184. var index = -1,
  22185. result = Array(set.size);
  22186. set.forEach(function(value) {
  22187. result[++index] = [value, value];
  22188. });
  22189. return result;
  22190. }
  22191. /**
  22192. * A specialized version of `_.indexOf` which performs strict equality
  22193. * comparisons of values, i.e. `===`.
  22194. *
  22195. * @private
  22196. * @param {Array} array The array to inspect.
  22197. * @param {*} value The value to search for.
  22198. * @param {number} fromIndex The index to search from.
  22199. * @returns {number} Returns the index of the matched value, else `-1`.
  22200. */
  22201. function strictIndexOf(array, value, fromIndex) {
  22202. var index = fromIndex - 1,
  22203. length = array.length;
  22204. while (++index < length) {
  22205. if (array[index] === value) {
  22206. return index;
  22207. }
  22208. }
  22209. return -1;
  22210. }
  22211. /**
  22212. * A specialized version of `_.lastIndexOf` which performs strict equality
  22213. * comparisons of values, i.e. `===`.
  22214. *
  22215. * @private
  22216. * @param {Array} array The array to inspect.
  22217. * @param {*} value The value to search for.
  22218. * @param {number} fromIndex The index to search from.
  22219. * @returns {number} Returns the index of the matched value, else `-1`.
  22220. */
  22221. function strictLastIndexOf(array, value, fromIndex) {
  22222. var index = fromIndex + 1;
  22223. while (index--) {
  22224. if (array[index] === value) {
  22225. return index;
  22226. }
  22227. }
  22228. return index;
  22229. }
  22230. /**
  22231. * Gets the number of symbols in `string`.
  22232. *
  22233. * @private
  22234. * @param {string} string The string to inspect.
  22235. * @returns {number} Returns the string size.
  22236. */
  22237. function stringSize(string) {
  22238. return hasUnicode(string)
  22239. ? unicodeSize(string)
  22240. : asciiSize(string);
  22241. }
  22242. /**
  22243. * Converts `string` to an array.
  22244. *
  22245. * @private
  22246. * @param {string} string The string to convert.
  22247. * @returns {Array} Returns the converted array.
  22248. */
  22249. function stringToArray(string) {
  22250. return hasUnicode(string)
  22251. ? unicodeToArray(string)
  22252. : asciiToArray(string);
  22253. }
  22254. /**
  22255. * Used by `_.unescape` to convert HTML entities to characters.
  22256. *
  22257. * @private
  22258. * @param {string} chr The matched character to unescape.
  22259. * @returns {string} Returns the unescaped character.
  22260. */
  22261. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  22262. /**
  22263. * Gets the size of a Unicode `string`.
  22264. *
  22265. * @private
  22266. * @param {string} string The string inspect.
  22267. * @returns {number} Returns the string size.
  22268. */
  22269. function unicodeSize(string) {
  22270. var result = reUnicode.lastIndex = 0;
  22271. while (reUnicode.test(string)) {
  22272. ++result;
  22273. }
  22274. return result;
  22275. }
  22276. /**
  22277. * Converts a Unicode `string` to an array.
  22278. *
  22279. * @private
  22280. * @param {string} string The string to convert.
  22281. * @returns {Array} Returns the converted array.
  22282. */
  22283. function unicodeToArray(string) {
  22284. return string.match(reUnicode) || [];
  22285. }
  22286. /**
  22287. * Splits a Unicode `string` into an array of its words.
  22288. *
  22289. * @private
  22290. * @param {string} The string to inspect.
  22291. * @returns {Array} Returns the words of `string`.
  22292. */
  22293. function unicodeWords(string) {
  22294. return string.match(reUnicodeWord) || [];
  22295. }
  22296. /*--------------------------------------------------------------------------*/
  22297. /**
  22298. * Create a new pristine `lodash` function using the `context` object.
  22299. *
  22300. * @static
  22301. * @memberOf _
  22302. * @since 1.1.0
  22303. * @category Util
  22304. * @param {Object} [context=root] The context object.
  22305. * @returns {Function} Returns a new `lodash` function.
  22306. * @example
  22307. *
  22308. * _.mixin({ 'foo': _.constant('foo') });
  22309. *
  22310. * var lodash = _.runInContext();
  22311. * lodash.mixin({ 'bar': lodash.constant('bar') });
  22312. *
  22313. * _.isFunction(_.foo);
  22314. * // => true
  22315. * _.isFunction(_.bar);
  22316. * // => false
  22317. *
  22318. * lodash.isFunction(lodash.foo);
  22319. * // => false
  22320. * lodash.isFunction(lodash.bar);
  22321. * // => true
  22322. *
  22323. * // Create a suped-up `defer` in Node.js.
  22324. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  22325. */
  22326. var runInContext = (function runInContext(context) {
  22327. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  22328. /** Built-in constructor references. */
  22329. var Array = context.Array,
  22330. Date = context.Date,
  22331. Error = context.Error,
  22332. Function = context.Function,
  22333. Math = context.Math,
  22334. Object = context.Object,
  22335. RegExp = context.RegExp,
  22336. String = context.String,
  22337. TypeError = context.TypeError;
  22338. /** Used for built-in method references. */
  22339. var arrayProto = Array.prototype,
  22340. funcProto = Function.prototype,
  22341. objectProto = Object.prototype;
  22342. /** Used to detect overreaching core-js shims. */
  22343. var coreJsData = context['__core-js_shared__'];
  22344. /** Used to resolve the decompiled source of functions. */
  22345. var funcToString = funcProto.toString;
  22346. /** Used to check objects for own properties. */
  22347. var hasOwnProperty = objectProto.hasOwnProperty;
  22348. /** Used to generate unique IDs. */
  22349. var idCounter = 0;
  22350. /** Used to detect methods masquerading as native. */
  22351. var maskSrcKey = (function() {
  22352. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  22353. return uid ? ('Symbol(src)_1.' + uid) : '';
  22354. }());
  22355. /**
  22356. * Used to resolve the
  22357. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  22358. * of values.
  22359. */
  22360. var nativeObjectToString = objectProto.toString;
  22361. /** Used to infer the `Object` constructor. */
  22362. var objectCtorString = funcToString.call(Object);
  22363. /** Used to restore the original `_` reference in `_.noConflict`. */
  22364. var oldDash = root._;
  22365. /** Used to detect if a method is native. */
  22366. var reIsNative = RegExp('^' +
  22367. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  22368. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  22369. );
  22370. /** Built-in value references. */
  22371. var Buffer = moduleExports ? context.Buffer : undefined,
  22372. Symbol = context.Symbol,
  22373. Uint8Array = context.Uint8Array,
  22374. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  22375. getPrototype = overArg(Object.getPrototypeOf, Object),
  22376. objectCreate = Object.create,
  22377. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  22378. splice = arrayProto.splice,
  22379. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  22380. symIterator = Symbol ? Symbol.iterator : undefined,
  22381. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  22382. var defineProperty = (function() {
  22383. try {
  22384. var func = getNative(Object, 'defineProperty');
  22385. func({}, '', {});
  22386. return func;
  22387. } catch (e) {}
  22388. }());
  22389. /** Mocked built-ins. */
  22390. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  22391. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  22392. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  22393. /* Built-in method references for those with the same name as other `lodash` methods. */
  22394. var nativeCeil = Math.ceil,
  22395. nativeFloor = Math.floor,
  22396. nativeGetSymbols = Object.getOwnPropertySymbols,
  22397. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  22398. nativeIsFinite = context.isFinite,
  22399. nativeJoin = arrayProto.join,
  22400. nativeKeys = overArg(Object.keys, Object),
  22401. nativeMax = Math.max,
  22402. nativeMin = Math.min,
  22403. nativeNow = Date.now,
  22404. nativeParseInt = context.parseInt,
  22405. nativeRandom = Math.random,
  22406. nativeReverse = arrayProto.reverse;
  22407. /* Built-in method references that are verified to be native. */
  22408. var DataView = getNative(context, 'DataView'),
  22409. Map = getNative(context, 'Map'),
  22410. Promise = getNative(context, 'Promise'),
  22411. Set = getNative(context, 'Set'),
  22412. WeakMap = getNative(context, 'WeakMap'),
  22413. nativeCreate = getNative(Object, 'create');
  22414. /** Used to store function metadata. */
  22415. var metaMap = WeakMap && new WeakMap;
  22416. /** Used to lookup unminified function names. */
  22417. var realNames = {};
  22418. /** Used to detect maps, sets, and weakmaps. */
  22419. var dataViewCtorString = toSource(DataView),
  22420. mapCtorString = toSource(Map),
  22421. promiseCtorString = toSource(Promise),
  22422. setCtorString = toSource(Set),
  22423. weakMapCtorString = toSource(WeakMap);
  22424. /** Used to convert symbols to primitives and strings. */
  22425. var symbolProto = Symbol ? Symbol.prototype : undefined,
  22426. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  22427. symbolToString = symbolProto ? symbolProto.toString : undefined;
  22428. /*------------------------------------------------------------------------*/
  22429. /**
  22430. * Creates a `lodash` object which wraps `value` to enable implicit method
  22431. * chain sequences. Methods that operate on and return arrays, collections,
  22432. * and functions can be chained together. Methods that retrieve a single value
  22433. * or may return a primitive value will automatically end the chain sequence
  22434. * and return the unwrapped value. Otherwise, the value must be unwrapped
  22435. * with `_#value`.
  22436. *
  22437. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  22438. * enabled using `_.chain`.
  22439. *
  22440. * The execution of chained methods is lazy, that is, it's deferred until
  22441. * `_#value` is implicitly or explicitly called.
  22442. *
  22443. * Lazy evaluation allows several methods to support shortcut fusion.
  22444. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  22445. * the creation of intermediate arrays and can greatly reduce the number of
  22446. * iteratee executions. Sections of a chain sequence qualify for shortcut
  22447. * fusion if the section is applied to an array and iteratees accept only
  22448. * one argument. The heuristic for whether a section qualifies for shortcut
  22449. * fusion is subject to change.
  22450. *
  22451. * Chaining is supported in custom builds as long as the `_#value` method is
  22452. * directly or indirectly included in the build.
  22453. *
  22454. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  22455. *
  22456. * The wrapper `Array` methods are:
  22457. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  22458. *
  22459. * The wrapper `String` methods are:
  22460. * `replace` and `split`
  22461. *
  22462. * The wrapper methods that support shortcut fusion are:
  22463. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  22464. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  22465. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  22466. *
  22467. * The chainable wrapper methods are:
  22468. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  22469. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  22470. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  22471. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  22472. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  22473. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  22474. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  22475. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  22476. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  22477. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  22478. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  22479. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  22480. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  22481. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  22482. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  22483. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  22484. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  22485. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  22486. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  22487. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  22488. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  22489. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  22490. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  22491. * `zipObject`, `zipObjectDeep`, and `zipWith`
  22492. *
  22493. * The wrapper methods that are **not** chainable by default are:
  22494. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  22495. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  22496. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  22497. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  22498. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  22499. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  22500. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  22501. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  22502. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  22503. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  22504. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  22505. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  22506. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  22507. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  22508. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  22509. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  22510. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  22511. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  22512. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  22513. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  22514. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  22515. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  22516. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  22517. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  22518. * `upperFirst`, `value`, and `words`
  22519. *
  22520. * @name _
  22521. * @constructor
  22522. * @category Seq
  22523. * @param {*} value The value to wrap in a `lodash` instance.
  22524. * @returns {Object} Returns the new `lodash` wrapper instance.
  22525. * @example
  22526. *
  22527. * function square(n) {
  22528. * return n * n;
  22529. * }
  22530. *
  22531. * var wrapped = _([1, 2, 3]);
  22532. *
  22533. * // Returns an unwrapped value.
  22534. * wrapped.reduce(_.add);
  22535. * // => 6
  22536. *
  22537. * // Returns a wrapped value.
  22538. * var squares = wrapped.map(square);
  22539. *
  22540. * _.isArray(squares);
  22541. * // => false
  22542. *
  22543. * _.isArray(squares.value());
  22544. * // => true
  22545. */
  22546. function lodash(value) {
  22547. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  22548. if (value instanceof LodashWrapper) {
  22549. return value;
  22550. }
  22551. if (hasOwnProperty.call(value, '__wrapped__')) {
  22552. return wrapperClone(value);
  22553. }
  22554. }
  22555. return new LodashWrapper(value);
  22556. }
  22557. /**
  22558. * The base implementation of `_.create` without support for assigning
  22559. * properties to the created object.
  22560. *
  22561. * @private
  22562. * @param {Object} proto The object to inherit from.
  22563. * @returns {Object} Returns the new object.
  22564. */
  22565. var baseCreate = (function() {
  22566. function object() {}
  22567. return function(proto) {
  22568. if (!isObject(proto)) {
  22569. return {};
  22570. }
  22571. if (objectCreate) {
  22572. return objectCreate(proto);
  22573. }
  22574. object.prototype = proto;
  22575. var result = new object;
  22576. object.prototype = undefined;
  22577. return result;
  22578. };
  22579. }());
  22580. /**
  22581. * The function whose prototype chain sequence wrappers inherit from.
  22582. *
  22583. * @private
  22584. */
  22585. function baseLodash() {
  22586. // No operation performed.
  22587. }
  22588. /**
  22589. * The base constructor for creating `lodash` wrapper objects.
  22590. *
  22591. * @private
  22592. * @param {*} value The value to wrap.
  22593. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  22594. */
  22595. function LodashWrapper(value, chainAll) {
  22596. this.__wrapped__ = value;
  22597. this.__actions__ = [];
  22598. this.__chain__ = !!chainAll;
  22599. this.__index__ = 0;
  22600. this.__values__ = undefined;
  22601. }
  22602. /**
  22603. * By default, the template delimiters used by lodash are like those in
  22604. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  22605. * following template settings to use alternative delimiters.
  22606. *
  22607. * @static
  22608. * @memberOf _
  22609. * @type {Object}
  22610. */
  22611. lodash.templateSettings = {
  22612. /**
  22613. * Used to detect `data` property values to be HTML-escaped.
  22614. *
  22615. * @memberOf _.templateSettings
  22616. * @type {RegExp}
  22617. */
  22618. 'escape': reEscape,
  22619. /**
  22620. * Used to detect code to be evaluated.
  22621. *
  22622. * @memberOf _.templateSettings
  22623. * @type {RegExp}
  22624. */
  22625. 'evaluate': reEvaluate,
  22626. /**
  22627. * Used to detect `data` property values to inject.
  22628. *
  22629. * @memberOf _.templateSettings
  22630. * @type {RegExp}
  22631. */
  22632. 'interpolate': reInterpolate,
  22633. /**
  22634. * Used to reference the data object in the template text.
  22635. *
  22636. * @memberOf _.templateSettings
  22637. * @type {string}
  22638. */
  22639. 'variable': '',
  22640. /**
  22641. * Used to import variables into the compiled template.
  22642. *
  22643. * @memberOf _.templateSettings
  22644. * @type {Object}
  22645. */
  22646. 'imports': {
  22647. /**
  22648. * A reference to the `lodash` function.
  22649. *
  22650. * @memberOf _.templateSettings.imports
  22651. * @type {Function}
  22652. */
  22653. '_': lodash
  22654. }
  22655. };
  22656. // Ensure wrappers are instances of `baseLodash`.
  22657. lodash.prototype = baseLodash.prototype;
  22658. lodash.prototype.constructor = lodash;
  22659. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  22660. LodashWrapper.prototype.constructor = LodashWrapper;
  22661. /*------------------------------------------------------------------------*/
  22662. /**
  22663. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  22664. *
  22665. * @private
  22666. * @constructor
  22667. * @param {*} value The value to wrap.
  22668. */
  22669. function LazyWrapper(value) {
  22670. this.__wrapped__ = value;
  22671. this.__actions__ = [];
  22672. this.__dir__ = 1;
  22673. this.__filtered__ = false;
  22674. this.__iteratees__ = [];
  22675. this.__takeCount__ = MAX_ARRAY_LENGTH;
  22676. this.__views__ = [];
  22677. }
  22678. /**
  22679. * Creates a clone of the lazy wrapper object.
  22680. *
  22681. * @private
  22682. * @name clone
  22683. * @memberOf LazyWrapper
  22684. * @returns {Object} Returns the cloned `LazyWrapper` object.
  22685. */
  22686. function lazyClone() {
  22687. var result = new LazyWrapper(this.__wrapped__);
  22688. result.__actions__ = copyArray(this.__actions__);
  22689. result.__dir__ = this.__dir__;
  22690. result.__filtered__ = this.__filtered__;
  22691. result.__iteratees__ = copyArray(this.__iteratees__);
  22692. result.__takeCount__ = this.__takeCount__;
  22693. result.__views__ = copyArray(this.__views__);
  22694. return result;
  22695. }
  22696. /**
  22697. * Reverses the direction of lazy iteration.
  22698. *
  22699. * @private
  22700. * @name reverse
  22701. * @memberOf LazyWrapper
  22702. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  22703. */
  22704. function lazyReverse() {
  22705. if (this.__filtered__) {
  22706. var result = new LazyWrapper(this);
  22707. result.__dir__ = -1;
  22708. result.__filtered__ = true;
  22709. } else {
  22710. result = this.clone();
  22711. result.__dir__ *= -1;
  22712. }
  22713. return result;
  22714. }
  22715. /**
  22716. * Extracts the unwrapped value from its lazy wrapper.
  22717. *
  22718. * @private
  22719. * @name value
  22720. * @memberOf LazyWrapper
  22721. * @returns {*} Returns the unwrapped value.
  22722. */
  22723. function lazyValue() {
  22724. var array = this.__wrapped__.value(),
  22725. dir = this.__dir__,
  22726. isArr = isArray(array),
  22727. isRight = dir < 0,
  22728. arrLength = isArr ? array.length : 0,
  22729. view = getView(0, arrLength, this.__views__),
  22730. start = view.start,
  22731. end = view.end,
  22732. length = end - start,
  22733. index = isRight ? end : (start - 1),
  22734. iteratees = this.__iteratees__,
  22735. iterLength = iteratees.length,
  22736. resIndex = 0,
  22737. takeCount = nativeMin(length, this.__takeCount__);
  22738. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  22739. return baseWrapperValue(array, this.__actions__);
  22740. }
  22741. var result = [];
  22742. outer:
  22743. while (length-- && resIndex < takeCount) {
  22744. index += dir;
  22745. var iterIndex = -1,
  22746. value = array[index];
  22747. while (++iterIndex < iterLength) {
  22748. var data = iteratees[iterIndex],
  22749. iteratee = data.iteratee,
  22750. type = data.type,
  22751. computed = iteratee(value);
  22752. if (type == LAZY_MAP_FLAG) {
  22753. value = computed;
  22754. } else if (!computed) {
  22755. if (type == LAZY_FILTER_FLAG) {
  22756. continue outer;
  22757. } else {
  22758. break outer;
  22759. }
  22760. }
  22761. }
  22762. result[resIndex++] = value;
  22763. }
  22764. return result;
  22765. }
  22766. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  22767. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  22768. LazyWrapper.prototype.constructor = LazyWrapper;
  22769. /*------------------------------------------------------------------------*/
  22770. /**
  22771. * Creates a hash object.
  22772. *
  22773. * @private
  22774. * @constructor
  22775. * @param {Array} [entries] The key-value pairs to cache.
  22776. */
  22777. function Hash(entries) {
  22778. var index = -1,
  22779. length = entries == null ? 0 : entries.length;
  22780. this.clear();
  22781. while (++index < length) {
  22782. var entry = entries[index];
  22783. this.set(entry[0], entry[1]);
  22784. }
  22785. }
  22786. /**
  22787. * Removes all key-value entries from the hash.
  22788. *
  22789. * @private
  22790. * @name clear
  22791. * @memberOf Hash
  22792. */
  22793. function hashClear() {
  22794. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  22795. this.size = 0;
  22796. }
  22797. /**
  22798. * Removes `key` and its value from the hash.
  22799. *
  22800. * @private
  22801. * @name delete
  22802. * @memberOf Hash
  22803. * @param {Object} hash The hash to modify.
  22804. * @param {string} key The key of the value to remove.
  22805. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  22806. */
  22807. function hashDelete(key) {
  22808. var result = this.has(key) && delete this.__data__[key];
  22809. this.size -= result ? 1 : 0;
  22810. return result;
  22811. }
  22812. /**
  22813. * Gets the hash value for `key`.
  22814. *
  22815. * @private
  22816. * @name get
  22817. * @memberOf Hash
  22818. * @param {string} key The key of the value to get.
  22819. * @returns {*} Returns the entry value.
  22820. */
  22821. function hashGet(key) {
  22822. var data = this.__data__;
  22823. if (nativeCreate) {
  22824. var result = data[key];
  22825. return result === HASH_UNDEFINED ? undefined : result;
  22826. }
  22827. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  22828. }
  22829. /**
  22830. * Checks if a hash value for `key` exists.
  22831. *
  22832. * @private
  22833. * @name has
  22834. * @memberOf Hash
  22835. * @param {string} key The key of the entry to check.
  22836. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  22837. */
  22838. function hashHas(key) {
  22839. var data = this.__data__;
  22840. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  22841. }
  22842. /**
  22843. * Sets the hash `key` to `value`.
  22844. *
  22845. * @private
  22846. * @name set
  22847. * @memberOf Hash
  22848. * @param {string} key The key of the value to set.
  22849. * @param {*} value The value to set.
  22850. * @returns {Object} Returns the hash instance.
  22851. */
  22852. function hashSet(key, value) {
  22853. var data = this.__data__;
  22854. this.size += this.has(key) ? 0 : 1;
  22855. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  22856. return this;
  22857. }
  22858. // Add methods to `Hash`.
  22859. Hash.prototype.clear = hashClear;
  22860. Hash.prototype['delete'] = hashDelete;
  22861. Hash.prototype.get = hashGet;
  22862. Hash.prototype.has = hashHas;
  22863. Hash.prototype.set = hashSet;
  22864. /*------------------------------------------------------------------------*/
  22865. /**
  22866. * Creates an list cache object.
  22867. *
  22868. * @private
  22869. * @constructor
  22870. * @param {Array} [entries] The key-value pairs to cache.
  22871. */
  22872. function ListCache(entries) {
  22873. var index = -1,
  22874. length = entries == null ? 0 : entries.length;
  22875. this.clear();
  22876. while (++index < length) {
  22877. var entry = entries[index];
  22878. this.set(entry[0], entry[1]);
  22879. }
  22880. }
  22881. /**
  22882. * Removes all key-value entries from the list cache.
  22883. *
  22884. * @private
  22885. * @name clear
  22886. * @memberOf ListCache
  22887. */
  22888. function listCacheClear() {
  22889. this.__data__ = [];
  22890. this.size = 0;
  22891. }
  22892. /**
  22893. * Removes `key` and its value from the list cache.
  22894. *
  22895. * @private
  22896. * @name delete
  22897. * @memberOf ListCache
  22898. * @param {string} key The key of the value to remove.
  22899. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  22900. */
  22901. function listCacheDelete(key) {
  22902. var data = this.__data__,
  22903. index = assocIndexOf(data, key);
  22904. if (index < 0) {
  22905. return false;
  22906. }
  22907. var lastIndex = data.length - 1;
  22908. if (index == lastIndex) {
  22909. data.pop();
  22910. } else {
  22911. splice.call(data, index, 1);
  22912. }
  22913. --this.size;
  22914. return true;
  22915. }
  22916. /**
  22917. * Gets the list cache value for `key`.
  22918. *
  22919. * @private
  22920. * @name get
  22921. * @memberOf ListCache
  22922. * @param {string} key The key of the value to get.
  22923. * @returns {*} Returns the entry value.
  22924. */
  22925. function listCacheGet(key) {
  22926. var data = this.__data__,
  22927. index = assocIndexOf(data, key);
  22928. return index < 0 ? undefined : data[index][1];
  22929. }
  22930. /**
  22931. * Checks if a list cache value for `key` exists.
  22932. *
  22933. * @private
  22934. * @name has
  22935. * @memberOf ListCache
  22936. * @param {string} key The key of the entry to check.
  22937. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  22938. */
  22939. function listCacheHas(key) {
  22940. return assocIndexOf(this.__data__, key) > -1;
  22941. }
  22942. /**
  22943. * Sets the list cache `key` to `value`.
  22944. *
  22945. * @private
  22946. * @name set
  22947. * @memberOf ListCache
  22948. * @param {string} key The key of the value to set.
  22949. * @param {*} value The value to set.
  22950. * @returns {Object} Returns the list cache instance.
  22951. */
  22952. function listCacheSet(key, value) {
  22953. var data = this.__data__,
  22954. index = assocIndexOf(data, key);
  22955. if (index < 0) {
  22956. ++this.size;
  22957. data.push([key, value]);
  22958. } else {
  22959. data[index][1] = value;
  22960. }
  22961. return this;
  22962. }
  22963. // Add methods to `ListCache`.
  22964. ListCache.prototype.clear = listCacheClear;
  22965. ListCache.prototype['delete'] = listCacheDelete;
  22966. ListCache.prototype.get = listCacheGet;
  22967. ListCache.prototype.has = listCacheHas;
  22968. ListCache.prototype.set = listCacheSet;
  22969. /*------------------------------------------------------------------------*/
  22970. /**
  22971. * Creates a map cache object to store key-value pairs.
  22972. *
  22973. * @private
  22974. * @constructor
  22975. * @param {Array} [entries] The key-value pairs to cache.
  22976. */
  22977. function MapCache(entries) {
  22978. var index = -1,
  22979. length = entries == null ? 0 : entries.length;
  22980. this.clear();
  22981. while (++index < length) {
  22982. var entry = entries[index];
  22983. this.set(entry[0], entry[1]);
  22984. }
  22985. }
  22986. /**
  22987. * Removes all key-value entries from the map.
  22988. *
  22989. * @private
  22990. * @name clear
  22991. * @memberOf MapCache
  22992. */
  22993. function mapCacheClear() {
  22994. this.size = 0;
  22995. this.__data__ = {
  22996. 'hash': new Hash,
  22997. 'map': new (Map || ListCache),
  22998. 'string': new Hash
  22999. };
  23000. }
  23001. /**
  23002. * Removes `key` and its value from the map.
  23003. *
  23004. * @private
  23005. * @name delete
  23006. * @memberOf MapCache
  23007. * @param {string} key The key of the value to remove.
  23008. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  23009. */
  23010. function mapCacheDelete(key) {
  23011. var result = getMapData(this, key)['delete'](key);
  23012. this.size -= result ? 1 : 0;
  23013. return result;
  23014. }
  23015. /**
  23016. * Gets the map value for `key`.
  23017. *
  23018. * @private
  23019. * @name get
  23020. * @memberOf MapCache
  23021. * @param {string} key The key of the value to get.
  23022. * @returns {*} Returns the entry value.
  23023. */
  23024. function mapCacheGet(key) {
  23025. return getMapData(this, key).get(key);
  23026. }
  23027. /**
  23028. * Checks if a map value for `key` exists.
  23029. *
  23030. * @private
  23031. * @name has
  23032. * @memberOf MapCache
  23033. * @param {string} key The key of the entry to check.
  23034. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  23035. */
  23036. function mapCacheHas(key) {
  23037. return getMapData(this, key).has(key);
  23038. }
  23039. /**
  23040. * Sets the map `key` to `value`.
  23041. *
  23042. * @private
  23043. * @name set
  23044. * @memberOf MapCache
  23045. * @param {string} key The key of the value to set.
  23046. * @param {*} value The value to set.
  23047. * @returns {Object} Returns the map cache instance.
  23048. */
  23049. function mapCacheSet(key, value) {
  23050. var data = getMapData(this, key),
  23051. size = data.size;
  23052. data.set(key, value);
  23053. this.size += data.size == size ? 0 : 1;
  23054. return this;
  23055. }
  23056. // Add methods to `MapCache`.
  23057. MapCache.prototype.clear = mapCacheClear;
  23058. MapCache.prototype['delete'] = mapCacheDelete;
  23059. MapCache.prototype.get = mapCacheGet;
  23060. MapCache.prototype.has = mapCacheHas;
  23061. MapCache.prototype.set = mapCacheSet;
  23062. /*------------------------------------------------------------------------*/
  23063. /**
  23064. *
  23065. * Creates an array cache object to store unique values.
  23066. *
  23067. * @private
  23068. * @constructor
  23069. * @param {Array} [values] The values to cache.
  23070. */
  23071. function SetCache(values) {
  23072. var index = -1,
  23073. length = values == null ? 0 : values.length;
  23074. this.__data__ = new MapCache;
  23075. while (++index < length) {
  23076. this.add(values[index]);
  23077. }
  23078. }
  23079. /**
  23080. * Adds `value` to the array cache.
  23081. *
  23082. * @private
  23083. * @name add
  23084. * @memberOf SetCache
  23085. * @alias push
  23086. * @param {*} value The value to cache.
  23087. * @returns {Object} Returns the cache instance.
  23088. */
  23089. function setCacheAdd(value) {
  23090. this.__data__.set(value, HASH_UNDEFINED);
  23091. return this;
  23092. }
  23093. /**
  23094. * Checks if `value` is in the array cache.
  23095. *
  23096. * @private
  23097. * @name has
  23098. * @memberOf SetCache
  23099. * @param {*} value The value to search for.
  23100. * @returns {number} Returns `true` if `value` is found, else `false`.
  23101. */
  23102. function setCacheHas(value) {
  23103. return this.__data__.has(value);
  23104. }
  23105. // Add methods to `SetCache`.
  23106. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  23107. SetCache.prototype.has = setCacheHas;
  23108. /*------------------------------------------------------------------------*/
  23109. /**
  23110. * Creates a stack cache object to store key-value pairs.
  23111. *
  23112. * @private
  23113. * @constructor
  23114. * @param {Array} [entries] The key-value pairs to cache.
  23115. */
  23116. function Stack(entries) {
  23117. var data = this.__data__ = new ListCache(entries);
  23118. this.size = data.size;
  23119. }
  23120. /**
  23121. * Removes all key-value entries from the stack.
  23122. *
  23123. * @private
  23124. * @name clear
  23125. * @memberOf Stack
  23126. */
  23127. function stackClear() {
  23128. this.__data__ = new ListCache;
  23129. this.size = 0;
  23130. }
  23131. /**
  23132. * Removes `key` and its value from the stack.
  23133. *
  23134. * @private
  23135. * @name delete
  23136. * @memberOf Stack
  23137. * @param {string} key The key of the value to remove.
  23138. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  23139. */
  23140. function stackDelete(key) {
  23141. var data = this.__data__,
  23142. result = data['delete'](key);
  23143. this.size = data.size;
  23144. return result;
  23145. }
  23146. /**
  23147. * Gets the stack value for `key`.
  23148. *
  23149. * @private
  23150. * @name get
  23151. * @memberOf Stack
  23152. * @param {string} key The key of the value to get.
  23153. * @returns {*} Returns the entry value.
  23154. */
  23155. function stackGet(key) {
  23156. return this.__data__.get(key);
  23157. }
  23158. /**
  23159. * Checks if a stack value for `key` exists.
  23160. *
  23161. * @private
  23162. * @name has
  23163. * @memberOf Stack
  23164. * @param {string} key The key of the entry to check.
  23165. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  23166. */
  23167. function stackHas(key) {
  23168. return this.__data__.has(key);
  23169. }
  23170. /**
  23171. * Sets the stack `key` to `value`.
  23172. *
  23173. * @private
  23174. * @name set
  23175. * @memberOf Stack
  23176. * @param {string} key The key of the value to set.
  23177. * @param {*} value The value to set.
  23178. * @returns {Object} Returns the stack cache instance.
  23179. */
  23180. function stackSet(key, value) {
  23181. var data = this.__data__;
  23182. if (data instanceof ListCache) {
  23183. var pairs = data.__data__;
  23184. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  23185. pairs.push([key, value]);
  23186. this.size = ++data.size;
  23187. return this;
  23188. }
  23189. data = this.__data__ = new MapCache(pairs);
  23190. }
  23191. data.set(key, value);
  23192. this.size = data.size;
  23193. return this;
  23194. }
  23195. // Add methods to `Stack`.
  23196. Stack.prototype.clear = stackClear;
  23197. Stack.prototype['delete'] = stackDelete;
  23198. Stack.prototype.get = stackGet;
  23199. Stack.prototype.has = stackHas;
  23200. Stack.prototype.set = stackSet;
  23201. /*------------------------------------------------------------------------*/
  23202. /**
  23203. * Creates an array of the enumerable property names of the array-like `value`.
  23204. *
  23205. * @private
  23206. * @param {*} value The value to query.
  23207. * @param {boolean} inherited Specify returning inherited property names.
  23208. * @returns {Array} Returns the array of property names.
  23209. */
  23210. function arrayLikeKeys(value, inherited) {
  23211. var isArr = isArray(value),
  23212. isArg = !isArr && isArguments(value),
  23213. isBuff = !isArr && !isArg && isBuffer(value),
  23214. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  23215. skipIndexes = isArr || isArg || isBuff || isType,
  23216. result = skipIndexes ? baseTimes(value.length, String) : [],
  23217. length = result.length;
  23218. for (var key in value) {
  23219. if ((inherited || hasOwnProperty.call(value, key)) &&
  23220. !(skipIndexes && (
  23221. // Safari 9 has enumerable `arguments.length` in strict mode.
  23222. key == 'length' ||
  23223. // Node.js 0.10 has enumerable non-index properties on buffers.
  23224. (isBuff && (key == 'offset' || key == 'parent')) ||
  23225. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  23226. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  23227. // Skip index properties.
  23228. isIndex(key, length)
  23229. ))) {
  23230. result.push(key);
  23231. }
  23232. }
  23233. return result;
  23234. }
  23235. /**
  23236. * A specialized version of `_.sample` for arrays.
  23237. *
  23238. * @private
  23239. * @param {Array} array The array to sample.
  23240. * @returns {*} Returns the random element.
  23241. */
  23242. function arraySample(array) {
  23243. var length = array.length;
  23244. return length ? array[baseRandom(0, length - 1)] : undefined;
  23245. }
  23246. /**
  23247. * A specialized version of `_.sampleSize` for arrays.
  23248. *
  23249. * @private
  23250. * @param {Array} array The array to sample.
  23251. * @param {number} n The number of elements to sample.
  23252. * @returns {Array} Returns the random elements.
  23253. */
  23254. function arraySampleSize(array, n) {
  23255. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  23256. }
  23257. /**
  23258. * A specialized version of `_.shuffle` for arrays.
  23259. *
  23260. * @private
  23261. * @param {Array} array The array to shuffle.
  23262. * @returns {Array} Returns the new shuffled array.
  23263. */
  23264. function arrayShuffle(array) {
  23265. return shuffleSelf(copyArray(array));
  23266. }
  23267. /**
  23268. * This function is like `assignValue` except that it doesn't assign
  23269. * `undefined` values.
  23270. *
  23271. * @private
  23272. * @param {Object} object The object to modify.
  23273. * @param {string} key The key of the property to assign.
  23274. * @param {*} value The value to assign.
  23275. */
  23276. function assignMergeValue(object, key, value) {
  23277. if ((value !== undefined && !eq(object[key], value)) ||
  23278. (value === undefined && !(key in object))) {
  23279. baseAssignValue(object, key, value);
  23280. }
  23281. }
  23282. /**
  23283. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  23284. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  23285. * for equality comparisons.
  23286. *
  23287. * @private
  23288. * @param {Object} object The object to modify.
  23289. * @param {string} key The key of the property to assign.
  23290. * @param {*} value The value to assign.
  23291. */
  23292. function assignValue(object, key, value) {
  23293. var objValue = object[key];
  23294. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  23295. (value === undefined && !(key in object))) {
  23296. baseAssignValue(object, key, value);
  23297. }
  23298. }
  23299. /**
  23300. * Gets the index at which the `key` is found in `array` of key-value pairs.
  23301. *
  23302. * @private
  23303. * @param {Array} array The array to inspect.
  23304. * @param {*} key The key to search for.
  23305. * @returns {number} Returns the index of the matched value, else `-1`.
  23306. */
  23307. function assocIndexOf(array, key) {
  23308. var length = array.length;
  23309. while (length--) {
  23310. if (eq(array[length][0], key)) {
  23311. return length;
  23312. }
  23313. }
  23314. return -1;
  23315. }
  23316. /**
  23317. * Aggregates elements of `collection` on `accumulator` with keys transformed
  23318. * by `iteratee` and values set by `setter`.
  23319. *
  23320. * @private
  23321. * @param {Array|Object} collection The collection to iterate over.
  23322. * @param {Function} setter The function to set `accumulator` values.
  23323. * @param {Function} iteratee The iteratee to transform keys.
  23324. * @param {Object} accumulator The initial aggregated object.
  23325. * @returns {Function} Returns `accumulator`.
  23326. */
  23327. function baseAggregator(collection, setter, iteratee, accumulator) {
  23328. baseEach(collection, function(value, key, collection) {
  23329. setter(accumulator, value, iteratee(value), collection);
  23330. });
  23331. return accumulator;
  23332. }
  23333. /**
  23334. * The base implementation of `_.assign` without support for multiple sources
  23335. * or `customizer` functions.
  23336. *
  23337. * @private
  23338. * @param {Object} object The destination object.
  23339. * @param {Object} source The source object.
  23340. * @returns {Object} Returns `object`.
  23341. */
  23342. function baseAssign(object, source) {
  23343. return object && copyObject(source, keys(source), object);
  23344. }
  23345. /**
  23346. * The base implementation of `_.assignIn` without support for multiple sources
  23347. * or `customizer` functions.
  23348. *
  23349. * @private
  23350. * @param {Object} object The destination object.
  23351. * @param {Object} source The source object.
  23352. * @returns {Object} Returns `object`.
  23353. */
  23354. function baseAssignIn(object, source) {
  23355. return object && copyObject(source, keysIn(source), object);
  23356. }
  23357. /**
  23358. * The base implementation of `assignValue` and `assignMergeValue` without
  23359. * value checks.
  23360. *
  23361. * @private
  23362. * @param {Object} object The object to modify.
  23363. * @param {string} key The key of the property to assign.
  23364. * @param {*} value The value to assign.
  23365. */
  23366. function baseAssignValue(object, key, value) {
  23367. if (key == '__proto__' && defineProperty) {
  23368. defineProperty(object, key, {
  23369. 'configurable': true,
  23370. 'enumerable': true,
  23371. 'value': value,
  23372. 'writable': true
  23373. });
  23374. } else {
  23375. object[key] = value;
  23376. }
  23377. }
  23378. /**
  23379. * The base implementation of `_.at` without support for individual paths.
  23380. *
  23381. * @private
  23382. * @param {Object} object The object to iterate over.
  23383. * @param {string[]} paths The property paths to pick.
  23384. * @returns {Array} Returns the picked elements.
  23385. */
  23386. function baseAt(object, paths) {
  23387. var index = -1,
  23388. length = paths.length,
  23389. result = Array(length),
  23390. skip = object == null;
  23391. while (++index < length) {
  23392. result[index] = skip ? undefined : get(object, paths[index]);
  23393. }
  23394. return result;
  23395. }
  23396. /**
  23397. * The base implementation of `_.clamp` which doesn't coerce arguments.
  23398. *
  23399. * @private
  23400. * @param {number} number The number to clamp.
  23401. * @param {number} [lower] The lower bound.
  23402. * @param {number} upper The upper bound.
  23403. * @returns {number} Returns the clamped number.
  23404. */
  23405. function baseClamp(number, lower, upper) {
  23406. if (number === number) {
  23407. if (upper !== undefined) {
  23408. number = number <= upper ? number : upper;
  23409. }
  23410. if (lower !== undefined) {
  23411. number = number >= lower ? number : lower;
  23412. }
  23413. }
  23414. return number;
  23415. }
  23416. /**
  23417. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  23418. * traversed objects.
  23419. *
  23420. * @private
  23421. * @param {*} value The value to clone.
  23422. * @param {boolean} bitmask The bitmask flags.
  23423. * 1 - Deep clone
  23424. * 2 - Flatten inherited properties
  23425. * 4 - Clone symbols
  23426. * @param {Function} [customizer] The function to customize cloning.
  23427. * @param {string} [key] The key of `value`.
  23428. * @param {Object} [object] The parent object of `value`.
  23429. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  23430. * @returns {*} Returns the cloned value.
  23431. */
  23432. function baseClone(value, bitmask, customizer, key, object, stack) {
  23433. var result,
  23434. isDeep = bitmask & CLONE_DEEP_FLAG,
  23435. isFlat = bitmask & CLONE_FLAT_FLAG,
  23436. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  23437. if (customizer) {
  23438. result = object ? customizer(value, key, object, stack) : customizer(value);
  23439. }
  23440. if (result !== undefined) {
  23441. return result;
  23442. }
  23443. if (!isObject(value)) {
  23444. return value;
  23445. }
  23446. var isArr = isArray(value);
  23447. if (isArr) {
  23448. result = initCloneArray(value);
  23449. if (!isDeep) {
  23450. return copyArray(value, result);
  23451. }
  23452. } else {
  23453. var tag = getTag(value),
  23454. isFunc = tag == funcTag || tag == genTag;
  23455. if (isBuffer(value)) {
  23456. return cloneBuffer(value, isDeep);
  23457. }
  23458. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  23459. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  23460. if (!isDeep) {
  23461. return isFlat
  23462. ? copySymbolsIn(value, baseAssignIn(result, value))
  23463. : copySymbols(value, baseAssign(result, value));
  23464. }
  23465. } else {
  23466. if (!cloneableTags[tag]) {
  23467. return object ? value : {};
  23468. }
  23469. result = initCloneByTag(value, tag, isDeep);
  23470. }
  23471. }
  23472. // Check for circular references and return its corresponding clone.
  23473. stack || (stack = new Stack);
  23474. var stacked = stack.get(value);
  23475. if (stacked) {
  23476. return stacked;
  23477. }
  23478. stack.set(value, result);
  23479. if (isSet(value)) {
  23480. value.forEach(function(subValue) {
  23481. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  23482. });
  23483. } else if (isMap(value)) {
  23484. value.forEach(function(subValue, key) {
  23485. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  23486. });
  23487. }
  23488. var keysFunc = isFull
  23489. ? (isFlat ? getAllKeysIn : getAllKeys)
  23490. : (isFlat ? keysIn : keys);
  23491. var props = isArr ? undefined : keysFunc(value);
  23492. arrayEach(props || value, function(subValue, key) {
  23493. if (props) {
  23494. key = subValue;
  23495. subValue = value[key];
  23496. }
  23497. // Recursively populate clone (susceptible to call stack limits).
  23498. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  23499. });
  23500. return result;
  23501. }
  23502. /**
  23503. * The base implementation of `_.conforms` which doesn't clone `source`.
  23504. *
  23505. * @private
  23506. * @param {Object} source The object of property predicates to conform to.
  23507. * @returns {Function} Returns the new spec function.
  23508. */
  23509. function baseConforms(source) {
  23510. var props = keys(source);
  23511. return function(object) {
  23512. return baseConformsTo(object, source, props);
  23513. };
  23514. }
  23515. /**
  23516. * The base implementation of `_.conformsTo` which accepts `props` to check.
  23517. *
  23518. * @private
  23519. * @param {Object} object The object to inspect.
  23520. * @param {Object} source The object of property predicates to conform to.
  23521. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  23522. */
  23523. function baseConformsTo(object, source, props) {
  23524. var length = props.length;
  23525. if (object == null) {
  23526. return !length;
  23527. }
  23528. object = Object(object);
  23529. while (length--) {
  23530. var key = props[length],
  23531. predicate = source[key],
  23532. value = object[key];
  23533. if ((value === undefined && !(key in object)) || !predicate(value)) {
  23534. return false;
  23535. }
  23536. }
  23537. return true;
  23538. }
  23539. /**
  23540. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  23541. * to provide to `func`.
  23542. *
  23543. * @private
  23544. * @param {Function} func The function to delay.
  23545. * @param {number} wait The number of milliseconds to delay invocation.
  23546. * @param {Array} args The arguments to provide to `func`.
  23547. * @returns {number|Object} Returns the timer id or timeout object.
  23548. */
  23549. function baseDelay(func, wait, args) {
  23550. if (typeof func != 'function') {
  23551. throw new TypeError(FUNC_ERROR_TEXT);
  23552. }
  23553. return setTimeout(function() { func.apply(undefined, args); }, wait);
  23554. }
  23555. /**
  23556. * The base implementation of methods like `_.difference` without support
  23557. * for excluding multiple arrays or iteratee shorthands.
  23558. *
  23559. * @private
  23560. * @param {Array} array The array to inspect.
  23561. * @param {Array} values The values to exclude.
  23562. * @param {Function} [iteratee] The iteratee invoked per element.
  23563. * @param {Function} [comparator] The comparator invoked per element.
  23564. * @returns {Array} Returns the new array of filtered values.
  23565. */
  23566. function baseDifference(array, values, iteratee, comparator) {
  23567. var index = -1,
  23568. includes = arrayIncludes,
  23569. isCommon = true,
  23570. length = array.length,
  23571. result = [],
  23572. valuesLength = values.length;
  23573. if (!length) {
  23574. return result;
  23575. }
  23576. if (iteratee) {
  23577. values = arrayMap(values, baseUnary(iteratee));
  23578. }
  23579. if (comparator) {
  23580. includes = arrayIncludesWith;
  23581. isCommon = false;
  23582. }
  23583. else if (values.length >= LARGE_ARRAY_SIZE) {
  23584. includes = cacheHas;
  23585. isCommon = false;
  23586. values = new SetCache(values);
  23587. }
  23588. outer:
  23589. while (++index < length) {
  23590. var value = array[index],
  23591. computed = iteratee == null ? value : iteratee(value);
  23592. value = (comparator || value !== 0) ? value : 0;
  23593. if (isCommon && computed === computed) {
  23594. var valuesIndex = valuesLength;
  23595. while (valuesIndex--) {
  23596. if (values[valuesIndex] === computed) {
  23597. continue outer;
  23598. }
  23599. }
  23600. result.push(value);
  23601. }
  23602. else if (!includes(values, computed, comparator)) {
  23603. result.push(value);
  23604. }
  23605. }
  23606. return result;
  23607. }
  23608. /**
  23609. * The base implementation of `_.forEach` without support for iteratee shorthands.
  23610. *
  23611. * @private
  23612. * @param {Array|Object} collection The collection to iterate over.
  23613. * @param {Function} iteratee The function invoked per iteration.
  23614. * @returns {Array|Object} Returns `collection`.
  23615. */
  23616. var baseEach = createBaseEach(baseForOwn);
  23617. /**
  23618. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  23619. *
  23620. * @private
  23621. * @param {Array|Object} collection The collection to iterate over.
  23622. * @param {Function} iteratee The function invoked per iteration.
  23623. * @returns {Array|Object} Returns `collection`.
  23624. */
  23625. var baseEachRight = createBaseEach(baseForOwnRight, true);
  23626. /**
  23627. * The base implementation of `_.every` without support for iteratee shorthands.
  23628. *
  23629. * @private
  23630. * @param {Array|Object} collection The collection to iterate over.
  23631. * @param {Function} predicate The function invoked per iteration.
  23632. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  23633. * else `false`
  23634. */
  23635. function baseEvery(collection, predicate) {
  23636. var result = true;
  23637. baseEach(collection, function(value, index, collection) {
  23638. result = !!predicate(value, index, collection);
  23639. return result;
  23640. });
  23641. return result;
  23642. }
  23643. /**
  23644. * The base implementation of methods like `_.max` and `_.min` which accepts a
  23645. * `comparator` to determine the extremum value.
  23646. *
  23647. * @private
  23648. * @param {Array} array The array to iterate over.
  23649. * @param {Function} iteratee The iteratee invoked per iteration.
  23650. * @param {Function} comparator The comparator used to compare values.
  23651. * @returns {*} Returns the extremum value.
  23652. */
  23653. function baseExtremum(array, iteratee, comparator) {
  23654. var index = -1,
  23655. length = array.length;
  23656. while (++index < length) {
  23657. var value = array[index],
  23658. current = iteratee(value);
  23659. if (current != null && (computed === undefined
  23660. ? (current === current && !isSymbol(current))
  23661. : comparator(current, computed)
  23662. )) {
  23663. var computed = current,
  23664. result = value;
  23665. }
  23666. }
  23667. return result;
  23668. }
  23669. /**
  23670. * The base implementation of `_.fill` without an iteratee call guard.
  23671. *
  23672. * @private
  23673. * @param {Array} array The array to fill.
  23674. * @param {*} value The value to fill `array` with.
  23675. * @param {number} [start=0] The start position.
  23676. * @param {number} [end=array.length] The end position.
  23677. * @returns {Array} Returns `array`.
  23678. */
  23679. function baseFill(array, value, start, end) {
  23680. var length = array.length;
  23681. start = toInteger(start);
  23682. if (start < 0) {
  23683. start = -start > length ? 0 : (length + start);
  23684. }
  23685. end = (end === undefined || end > length) ? length : toInteger(end);
  23686. if (end < 0) {
  23687. end += length;
  23688. }
  23689. end = start > end ? 0 : toLength(end);
  23690. while (start < end) {
  23691. array[start++] = value;
  23692. }
  23693. return array;
  23694. }
  23695. /**
  23696. * The base implementation of `_.filter` without support for iteratee shorthands.
  23697. *
  23698. * @private
  23699. * @param {Array|Object} collection The collection to iterate over.
  23700. * @param {Function} predicate The function invoked per iteration.
  23701. * @returns {Array} Returns the new filtered array.
  23702. */
  23703. function baseFilter(collection, predicate) {
  23704. var result = [];
  23705. baseEach(collection, function(value, index, collection) {
  23706. if (predicate(value, index, collection)) {
  23707. result.push(value);
  23708. }
  23709. });
  23710. return result;
  23711. }
  23712. /**
  23713. * The base implementation of `_.flatten` with support for restricting flattening.
  23714. *
  23715. * @private
  23716. * @param {Array} array The array to flatten.
  23717. * @param {number} depth The maximum recursion depth.
  23718. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  23719. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  23720. * @param {Array} [result=[]] The initial result value.
  23721. * @returns {Array} Returns the new flattened array.
  23722. */
  23723. function baseFlatten(array, depth, predicate, isStrict, result) {
  23724. var index = -1,
  23725. length = array.length;
  23726. predicate || (predicate = isFlattenable);
  23727. result || (result = []);
  23728. while (++index < length) {
  23729. var value = array[index];
  23730. if (depth > 0 && predicate(value)) {
  23731. if (depth > 1) {
  23732. // Recursively flatten arrays (susceptible to call stack limits).
  23733. baseFlatten(value, depth - 1, predicate, isStrict, result);
  23734. } else {
  23735. arrayPush(result, value);
  23736. }
  23737. } else if (!isStrict) {
  23738. result[result.length] = value;
  23739. }
  23740. }
  23741. return result;
  23742. }
  23743. /**
  23744. * The base implementation of `baseForOwn` which iterates over `object`
  23745. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  23746. * Iteratee functions may exit iteration early by explicitly returning `false`.
  23747. *
  23748. * @private
  23749. * @param {Object} object The object to iterate over.
  23750. * @param {Function} iteratee The function invoked per iteration.
  23751. * @param {Function} keysFunc The function to get the keys of `object`.
  23752. * @returns {Object} Returns `object`.
  23753. */
  23754. var baseFor = createBaseFor();
  23755. /**
  23756. * This function is like `baseFor` except that it iterates over properties
  23757. * in the opposite order.
  23758. *
  23759. * @private
  23760. * @param {Object} object The object to iterate over.
  23761. * @param {Function} iteratee The function invoked per iteration.
  23762. * @param {Function} keysFunc The function to get the keys of `object`.
  23763. * @returns {Object} Returns `object`.
  23764. */
  23765. var baseForRight = createBaseFor(true);
  23766. /**
  23767. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  23768. *
  23769. * @private
  23770. * @param {Object} object The object to iterate over.
  23771. * @param {Function} iteratee The function invoked per iteration.
  23772. * @returns {Object} Returns `object`.
  23773. */
  23774. function baseForOwn(object, iteratee) {
  23775. return object && baseFor(object, iteratee, keys);
  23776. }
  23777. /**
  23778. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  23779. *
  23780. * @private
  23781. * @param {Object} object The object to iterate over.
  23782. * @param {Function} iteratee The function invoked per iteration.
  23783. * @returns {Object} Returns `object`.
  23784. */
  23785. function baseForOwnRight(object, iteratee) {
  23786. return object && baseForRight(object, iteratee, keys);
  23787. }
  23788. /**
  23789. * The base implementation of `_.functions` which creates an array of
  23790. * `object` function property names filtered from `props`.
  23791. *
  23792. * @private
  23793. * @param {Object} object The object to inspect.
  23794. * @param {Array} props The property names to filter.
  23795. * @returns {Array} Returns the function names.
  23796. */
  23797. function baseFunctions(object, props) {
  23798. return arrayFilter(props, function(key) {
  23799. return isFunction(object[key]);
  23800. });
  23801. }
  23802. /**
  23803. * The base implementation of `_.get` without support for default values.
  23804. *
  23805. * @private
  23806. * @param {Object} object The object to query.
  23807. * @param {Array|string} path The path of the property to get.
  23808. * @returns {*} Returns the resolved value.
  23809. */
  23810. function baseGet(object, path) {
  23811. path = castPath(path, object);
  23812. var index = 0,
  23813. length = path.length;
  23814. while (object != null && index < length) {
  23815. object = object[toKey(path[index++])];
  23816. }
  23817. return (index && index == length) ? object : undefined;
  23818. }
  23819. /**
  23820. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  23821. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  23822. * symbols of `object`.
  23823. *
  23824. * @private
  23825. * @param {Object} object The object to query.
  23826. * @param {Function} keysFunc The function to get the keys of `object`.
  23827. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  23828. * @returns {Array} Returns the array of property names and symbols.
  23829. */
  23830. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  23831. var result = keysFunc(object);
  23832. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  23833. }
  23834. /**
  23835. * The base implementation of `getTag` without fallbacks for buggy environments.
  23836. *
  23837. * @private
  23838. * @param {*} value The value to query.
  23839. * @returns {string} Returns the `toStringTag`.
  23840. */
  23841. function baseGetTag(value) {
  23842. if (value == null) {
  23843. return value === undefined ? undefinedTag : nullTag;
  23844. }
  23845. return (symToStringTag && symToStringTag in Object(value))
  23846. ? getRawTag(value)
  23847. : objectToString(value);
  23848. }
  23849. /**
  23850. * The base implementation of `_.gt` which doesn't coerce arguments.
  23851. *
  23852. * @private
  23853. * @param {*} value The value to compare.
  23854. * @param {*} other The other value to compare.
  23855. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  23856. * else `false`.
  23857. */
  23858. function baseGt(value, other) {
  23859. return value > other;
  23860. }
  23861. /**
  23862. * The base implementation of `_.has` without support for deep paths.
  23863. *
  23864. * @private
  23865. * @param {Object} [object] The object to query.
  23866. * @param {Array|string} key The key to check.
  23867. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  23868. */
  23869. function baseHas(object, key) {
  23870. return object != null && hasOwnProperty.call(object, key);
  23871. }
  23872. /**
  23873. * The base implementation of `_.hasIn` without support for deep paths.
  23874. *
  23875. * @private
  23876. * @param {Object} [object] The object to query.
  23877. * @param {Array|string} key The key to check.
  23878. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  23879. */
  23880. function baseHasIn(object, key) {
  23881. return object != null && key in Object(object);
  23882. }
  23883. /**
  23884. * The base implementation of `_.inRange` which doesn't coerce arguments.
  23885. *
  23886. * @private
  23887. * @param {number} number The number to check.
  23888. * @param {number} start The start of the range.
  23889. * @param {number} end The end of the range.
  23890. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  23891. */
  23892. function baseInRange(number, start, end) {
  23893. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  23894. }
  23895. /**
  23896. * The base implementation of methods like `_.intersection`, without support
  23897. * for iteratee shorthands, that accepts an array of arrays to inspect.
  23898. *
  23899. * @private
  23900. * @param {Array} arrays The arrays to inspect.
  23901. * @param {Function} [iteratee] The iteratee invoked per element.
  23902. * @param {Function} [comparator] The comparator invoked per element.
  23903. * @returns {Array} Returns the new array of shared values.
  23904. */
  23905. function baseIntersection(arrays, iteratee, comparator) {
  23906. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  23907. length = arrays[0].length,
  23908. othLength = arrays.length,
  23909. othIndex = othLength,
  23910. caches = Array(othLength),
  23911. maxLength = Infinity,
  23912. result = [];
  23913. while (othIndex--) {
  23914. var array = arrays[othIndex];
  23915. if (othIndex && iteratee) {
  23916. array = arrayMap(array, baseUnary(iteratee));
  23917. }
  23918. maxLength = nativeMin(array.length, maxLength);
  23919. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  23920. ? new SetCache(othIndex && array)
  23921. : undefined;
  23922. }
  23923. array = arrays[0];
  23924. var index = -1,
  23925. seen = caches[0];
  23926. outer:
  23927. while (++index < length && result.length < maxLength) {
  23928. var value = array[index],
  23929. computed = iteratee ? iteratee(value) : value;
  23930. value = (comparator || value !== 0) ? value : 0;
  23931. if (!(seen
  23932. ? cacheHas(seen, computed)
  23933. : includes(result, computed, comparator)
  23934. )) {
  23935. othIndex = othLength;
  23936. while (--othIndex) {
  23937. var cache = caches[othIndex];
  23938. if (!(cache
  23939. ? cacheHas(cache, computed)
  23940. : includes(arrays[othIndex], computed, comparator))
  23941. ) {
  23942. continue outer;
  23943. }
  23944. }
  23945. if (seen) {
  23946. seen.push(computed);
  23947. }
  23948. result.push(value);
  23949. }
  23950. }
  23951. return result;
  23952. }
  23953. /**
  23954. * The base implementation of `_.invert` and `_.invertBy` which inverts
  23955. * `object` with values transformed by `iteratee` and set by `setter`.
  23956. *
  23957. * @private
  23958. * @param {Object} object The object to iterate over.
  23959. * @param {Function} setter The function to set `accumulator` values.
  23960. * @param {Function} iteratee The iteratee to transform values.
  23961. * @param {Object} accumulator The initial inverted object.
  23962. * @returns {Function} Returns `accumulator`.
  23963. */
  23964. function baseInverter(object, setter, iteratee, accumulator) {
  23965. baseForOwn(object, function(value, key, object) {
  23966. setter(accumulator, iteratee(value), key, object);
  23967. });
  23968. return accumulator;
  23969. }
  23970. /**
  23971. * The base implementation of `_.invoke` without support for individual
  23972. * method arguments.
  23973. *
  23974. * @private
  23975. * @param {Object} object The object to query.
  23976. * @param {Array|string} path The path of the method to invoke.
  23977. * @param {Array} args The arguments to invoke the method with.
  23978. * @returns {*} Returns the result of the invoked method.
  23979. */
  23980. function baseInvoke(object, path, args) {
  23981. path = castPath(path, object);
  23982. object = parent(object, path);
  23983. var func = object == null ? object : object[toKey(last(path))];
  23984. return func == null ? undefined : apply(func, object, args);
  23985. }
  23986. /**
  23987. * The base implementation of `_.isArguments`.
  23988. *
  23989. * @private
  23990. * @param {*} value The value to check.
  23991. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  23992. */
  23993. function baseIsArguments(value) {
  23994. return isObjectLike(value) && baseGetTag(value) == argsTag;
  23995. }
  23996. /**
  23997. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  23998. *
  23999. * @private
  24000. * @param {*} value The value to check.
  24001. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  24002. */
  24003. function baseIsArrayBuffer(value) {
  24004. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  24005. }
  24006. /**
  24007. * The base implementation of `_.isDate` without Node.js optimizations.
  24008. *
  24009. * @private
  24010. * @param {*} value The value to check.
  24011. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  24012. */
  24013. function baseIsDate(value) {
  24014. return isObjectLike(value) && baseGetTag(value) == dateTag;
  24015. }
  24016. /**
  24017. * The base implementation of `_.isEqual` which supports partial comparisons
  24018. * and tracks traversed objects.
  24019. *
  24020. * @private
  24021. * @param {*} value The value to compare.
  24022. * @param {*} other The other value to compare.
  24023. * @param {boolean} bitmask The bitmask flags.
  24024. * 1 - Unordered comparison
  24025. * 2 - Partial comparison
  24026. * @param {Function} [customizer] The function to customize comparisons.
  24027. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  24028. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24029. */
  24030. function baseIsEqual(value, other, bitmask, customizer, stack) {
  24031. if (value === other) {
  24032. return true;
  24033. }
  24034. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  24035. return value !== value && other !== other;
  24036. }
  24037. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  24038. }
  24039. /**
  24040. * A specialized version of `baseIsEqual` for arrays and objects which performs
  24041. * deep comparisons and tracks traversed objects enabling objects with circular
  24042. * references to be compared.
  24043. *
  24044. * @private
  24045. * @param {Object} object The object to compare.
  24046. * @param {Object} other The other object to compare.
  24047. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24048. * @param {Function} customizer The function to customize comparisons.
  24049. * @param {Function} equalFunc The function to determine equivalents of values.
  24050. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  24051. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24052. */
  24053. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  24054. var objIsArr = isArray(object),
  24055. othIsArr = isArray(other),
  24056. objTag = objIsArr ? arrayTag : getTag(object),
  24057. othTag = othIsArr ? arrayTag : getTag(other);
  24058. objTag = objTag == argsTag ? objectTag : objTag;
  24059. othTag = othTag == argsTag ? objectTag : othTag;
  24060. var objIsObj = objTag == objectTag,
  24061. othIsObj = othTag == objectTag,
  24062. isSameTag = objTag == othTag;
  24063. if (isSameTag && isBuffer(object)) {
  24064. if (!isBuffer(other)) {
  24065. return false;
  24066. }
  24067. objIsArr = true;
  24068. objIsObj = false;
  24069. }
  24070. if (isSameTag && !objIsObj) {
  24071. stack || (stack = new Stack);
  24072. return (objIsArr || isTypedArray(object))
  24073. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  24074. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  24075. }
  24076. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  24077. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  24078. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  24079. if (objIsWrapped || othIsWrapped) {
  24080. var objUnwrapped = objIsWrapped ? object.value() : object,
  24081. othUnwrapped = othIsWrapped ? other.value() : other;
  24082. stack || (stack = new Stack);
  24083. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  24084. }
  24085. }
  24086. if (!isSameTag) {
  24087. return false;
  24088. }
  24089. stack || (stack = new Stack);
  24090. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  24091. }
  24092. /**
  24093. * The base implementation of `_.isMap` without Node.js optimizations.
  24094. *
  24095. * @private
  24096. * @param {*} value The value to check.
  24097. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  24098. */
  24099. function baseIsMap(value) {
  24100. return isObjectLike(value) && getTag(value) == mapTag;
  24101. }
  24102. /**
  24103. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  24104. *
  24105. * @private
  24106. * @param {Object} object The object to inspect.
  24107. * @param {Object} source The object of property values to match.
  24108. * @param {Array} matchData The property names, values, and compare flags to match.
  24109. * @param {Function} [customizer] The function to customize comparisons.
  24110. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  24111. */
  24112. function baseIsMatch(object, source, matchData, customizer) {
  24113. var index = matchData.length,
  24114. length = index,
  24115. noCustomizer = !customizer;
  24116. if (object == null) {
  24117. return !length;
  24118. }
  24119. object = Object(object);
  24120. while (index--) {
  24121. var data = matchData[index];
  24122. if ((noCustomizer && data[2])
  24123. ? data[1] !== object[data[0]]
  24124. : !(data[0] in object)
  24125. ) {
  24126. return false;
  24127. }
  24128. }
  24129. while (++index < length) {
  24130. data = matchData[index];
  24131. var key = data[0],
  24132. objValue = object[key],
  24133. srcValue = data[1];
  24134. if (noCustomizer && data[2]) {
  24135. if (objValue === undefined && !(key in object)) {
  24136. return false;
  24137. }
  24138. } else {
  24139. var stack = new Stack;
  24140. if (customizer) {
  24141. var result = customizer(objValue, srcValue, key, object, source, stack);
  24142. }
  24143. if (!(result === undefined
  24144. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  24145. : result
  24146. )) {
  24147. return false;
  24148. }
  24149. }
  24150. }
  24151. return true;
  24152. }
  24153. /**
  24154. * The base implementation of `_.isNative` without bad shim checks.
  24155. *
  24156. * @private
  24157. * @param {*} value The value to check.
  24158. * @returns {boolean} Returns `true` if `value` is a native function,
  24159. * else `false`.
  24160. */
  24161. function baseIsNative(value) {
  24162. if (!isObject(value) || isMasked(value)) {
  24163. return false;
  24164. }
  24165. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  24166. return pattern.test(toSource(value));
  24167. }
  24168. /**
  24169. * The base implementation of `_.isRegExp` without Node.js optimizations.
  24170. *
  24171. * @private
  24172. * @param {*} value The value to check.
  24173. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  24174. */
  24175. function baseIsRegExp(value) {
  24176. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  24177. }
  24178. /**
  24179. * The base implementation of `_.isSet` without Node.js optimizations.
  24180. *
  24181. * @private
  24182. * @param {*} value The value to check.
  24183. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  24184. */
  24185. function baseIsSet(value) {
  24186. return isObjectLike(value) && getTag(value) == setTag;
  24187. }
  24188. /**
  24189. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  24190. *
  24191. * @private
  24192. * @param {*} value The value to check.
  24193. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  24194. */
  24195. function baseIsTypedArray(value) {
  24196. return isObjectLike(value) &&
  24197. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  24198. }
  24199. /**
  24200. * The base implementation of `_.iteratee`.
  24201. *
  24202. * @private
  24203. * @param {*} [value=_.identity] The value to convert to an iteratee.
  24204. * @returns {Function} Returns the iteratee.
  24205. */
  24206. function baseIteratee(value) {
  24207. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  24208. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  24209. if (typeof value == 'function') {
  24210. return value;
  24211. }
  24212. if (value == null) {
  24213. return identity;
  24214. }
  24215. if (typeof value == 'object') {
  24216. return isArray(value)
  24217. ? baseMatchesProperty(value[0], value[1])
  24218. : baseMatches(value);
  24219. }
  24220. return property(value);
  24221. }
  24222. /**
  24223. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  24224. *
  24225. * @private
  24226. * @param {Object} object The object to query.
  24227. * @returns {Array} Returns the array of property names.
  24228. */
  24229. function baseKeys(object) {
  24230. if (!isPrototype(object)) {
  24231. return nativeKeys(object);
  24232. }
  24233. var result = [];
  24234. for (var key in Object(object)) {
  24235. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  24236. result.push(key);
  24237. }
  24238. }
  24239. return result;
  24240. }
  24241. /**
  24242. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  24243. *
  24244. * @private
  24245. * @param {Object} object The object to query.
  24246. * @returns {Array} Returns the array of property names.
  24247. */
  24248. function baseKeysIn(object) {
  24249. if (!isObject(object)) {
  24250. return nativeKeysIn(object);
  24251. }
  24252. var isProto = isPrototype(object),
  24253. result = [];
  24254. for (var key in object) {
  24255. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  24256. result.push(key);
  24257. }
  24258. }
  24259. return result;
  24260. }
  24261. /**
  24262. * The base implementation of `_.lt` which doesn't coerce arguments.
  24263. *
  24264. * @private
  24265. * @param {*} value The value to compare.
  24266. * @param {*} other The other value to compare.
  24267. * @returns {boolean} Returns `true` if `value` is less than `other`,
  24268. * else `false`.
  24269. */
  24270. function baseLt(value, other) {
  24271. return value < other;
  24272. }
  24273. /**
  24274. * The base implementation of `_.map` without support for iteratee shorthands.
  24275. *
  24276. * @private
  24277. * @param {Array|Object} collection The collection to iterate over.
  24278. * @param {Function} iteratee The function invoked per iteration.
  24279. * @returns {Array} Returns the new mapped array.
  24280. */
  24281. function baseMap(collection, iteratee) {
  24282. var index = -1,
  24283. result = isArrayLike(collection) ? Array(collection.length) : [];
  24284. baseEach(collection, function(value, key, collection) {
  24285. result[++index] = iteratee(value, key, collection);
  24286. });
  24287. return result;
  24288. }
  24289. /**
  24290. * The base implementation of `_.matches` which doesn't clone `source`.
  24291. *
  24292. * @private
  24293. * @param {Object} source The object of property values to match.
  24294. * @returns {Function} Returns the new spec function.
  24295. */
  24296. function baseMatches(source) {
  24297. var matchData = getMatchData(source);
  24298. if (matchData.length == 1 && matchData[0][2]) {
  24299. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  24300. }
  24301. return function(object) {
  24302. return object === source || baseIsMatch(object, source, matchData);
  24303. };
  24304. }
  24305. /**
  24306. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  24307. *
  24308. * @private
  24309. * @param {string} path The path of the property to get.
  24310. * @param {*} srcValue The value to match.
  24311. * @returns {Function} Returns the new spec function.
  24312. */
  24313. function baseMatchesProperty(path, srcValue) {
  24314. if (isKey(path) && isStrictComparable(srcValue)) {
  24315. return matchesStrictComparable(toKey(path), srcValue);
  24316. }
  24317. return function(object) {
  24318. var objValue = get(object, path);
  24319. return (objValue === undefined && objValue === srcValue)
  24320. ? hasIn(object, path)
  24321. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  24322. };
  24323. }
  24324. /**
  24325. * The base implementation of `_.merge` without support for multiple sources.
  24326. *
  24327. * @private
  24328. * @param {Object} object The destination object.
  24329. * @param {Object} source The source object.
  24330. * @param {number} srcIndex The index of `source`.
  24331. * @param {Function} [customizer] The function to customize merged values.
  24332. * @param {Object} [stack] Tracks traversed source values and their merged
  24333. * counterparts.
  24334. */
  24335. function baseMerge(object, source, srcIndex, customizer, stack) {
  24336. if (object === source) {
  24337. return;
  24338. }
  24339. baseFor(source, function(srcValue, key) {
  24340. stack || (stack = new Stack);
  24341. if (isObject(srcValue)) {
  24342. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  24343. }
  24344. else {
  24345. var newValue = customizer
  24346. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  24347. : undefined;
  24348. if (newValue === undefined) {
  24349. newValue = srcValue;
  24350. }
  24351. assignMergeValue(object, key, newValue);
  24352. }
  24353. }, keysIn);
  24354. }
  24355. /**
  24356. * A specialized version of `baseMerge` for arrays and objects which performs
  24357. * deep merges and tracks traversed objects enabling objects with circular
  24358. * references to be merged.
  24359. *
  24360. * @private
  24361. * @param {Object} object The destination object.
  24362. * @param {Object} source The source object.
  24363. * @param {string} key The key of the value to merge.
  24364. * @param {number} srcIndex The index of `source`.
  24365. * @param {Function} mergeFunc The function to merge values.
  24366. * @param {Function} [customizer] The function to customize assigned values.
  24367. * @param {Object} [stack] Tracks traversed source values and their merged
  24368. * counterparts.
  24369. */
  24370. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  24371. var objValue = safeGet(object, key),
  24372. srcValue = safeGet(source, key),
  24373. stacked = stack.get(srcValue);
  24374. if (stacked) {
  24375. assignMergeValue(object, key, stacked);
  24376. return;
  24377. }
  24378. var newValue = customizer
  24379. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  24380. : undefined;
  24381. var isCommon = newValue === undefined;
  24382. if (isCommon) {
  24383. var isArr = isArray(srcValue),
  24384. isBuff = !isArr && isBuffer(srcValue),
  24385. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  24386. newValue = srcValue;
  24387. if (isArr || isBuff || isTyped) {
  24388. if (isArray(objValue)) {
  24389. newValue = objValue;
  24390. }
  24391. else if (isArrayLikeObject(objValue)) {
  24392. newValue = copyArray(objValue);
  24393. }
  24394. else if (isBuff) {
  24395. isCommon = false;
  24396. newValue = cloneBuffer(srcValue, true);
  24397. }
  24398. else if (isTyped) {
  24399. isCommon = false;
  24400. newValue = cloneTypedArray(srcValue, true);
  24401. }
  24402. else {
  24403. newValue = [];
  24404. }
  24405. }
  24406. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  24407. newValue = objValue;
  24408. if (isArguments(objValue)) {
  24409. newValue = toPlainObject(objValue);
  24410. }
  24411. else if (!isObject(objValue) || isFunction(objValue)) {
  24412. newValue = initCloneObject(srcValue);
  24413. }
  24414. }
  24415. else {
  24416. isCommon = false;
  24417. }
  24418. }
  24419. if (isCommon) {
  24420. // Recursively merge objects and arrays (susceptible to call stack limits).
  24421. stack.set(srcValue, newValue);
  24422. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  24423. stack['delete'](srcValue);
  24424. }
  24425. assignMergeValue(object, key, newValue);
  24426. }
  24427. /**
  24428. * The base implementation of `_.nth` which doesn't coerce arguments.
  24429. *
  24430. * @private
  24431. * @param {Array} array The array to query.
  24432. * @param {number} n The index of the element to return.
  24433. * @returns {*} Returns the nth element of `array`.
  24434. */
  24435. function baseNth(array, n) {
  24436. var length = array.length;
  24437. if (!length) {
  24438. return;
  24439. }
  24440. n += n < 0 ? length : 0;
  24441. return isIndex(n, length) ? array[n] : undefined;
  24442. }
  24443. /**
  24444. * The base implementation of `_.orderBy` without param guards.
  24445. *
  24446. * @private
  24447. * @param {Array|Object} collection The collection to iterate over.
  24448. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  24449. * @param {string[]} orders The sort orders of `iteratees`.
  24450. * @returns {Array} Returns the new sorted array.
  24451. */
  24452. function baseOrderBy(collection, iteratees, orders) {
  24453. var index = -1;
  24454. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  24455. var result = baseMap(collection, function(value, key, collection) {
  24456. var criteria = arrayMap(iteratees, function(iteratee) {
  24457. return iteratee(value);
  24458. });
  24459. return { 'criteria': criteria, 'index': ++index, 'value': value };
  24460. });
  24461. return baseSortBy(result, function(object, other) {
  24462. return compareMultiple(object, other, orders);
  24463. });
  24464. }
  24465. /**
  24466. * The base implementation of `_.pick` without support for individual
  24467. * property identifiers.
  24468. *
  24469. * @private
  24470. * @param {Object} object The source object.
  24471. * @param {string[]} paths The property paths to pick.
  24472. * @returns {Object} Returns the new object.
  24473. */
  24474. function basePick(object, paths) {
  24475. return basePickBy(object, paths, function(value, path) {
  24476. return hasIn(object, path);
  24477. });
  24478. }
  24479. /**
  24480. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  24481. *
  24482. * @private
  24483. * @param {Object} object The source object.
  24484. * @param {string[]} paths The property paths to pick.
  24485. * @param {Function} predicate The function invoked per property.
  24486. * @returns {Object} Returns the new object.
  24487. */
  24488. function basePickBy(object, paths, predicate) {
  24489. var index = -1,
  24490. length = paths.length,
  24491. result = {};
  24492. while (++index < length) {
  24493. var path = paths[index],
  24494. value = baseGet(object, path);
  24495. if (predicate(value, path)) {
  24496. baseSet(result, castPath(path, object), value);
  24497. }
  24498. }
  24499. return result;
  24500. }
  24501. /**
  24502. * A specialized version of `baseProperty` which supports deep paths.
  24503. *
  24504. * @private
  24505. * @param {Array|string} path The path of the property to get.
  24506. * @returns {Function} Returns the new accessor function.
  24507. */
  24508. function basePropertyDeep(path) {
  24509. return function(object) {
  24510. return baseGet(object, path);
  24511. };
  24512. }
  24513. /**
  24514. * The base implementation of `_.pullAllBy` without support for iteratee
  24515. * shorthands.
  24516. *
  24517. * @private
  24518. * @param {Array} array The array to modify.
  24519. * @param {Array} values The values to remove.
  24520. * @param {Function} [iteratee] The iteratee invoked per element.
  24521. * @param {Function} [comparator] The comparator invoked per element.
  24522. * @returns {Array} Returns `array`.
  24523. */
  24524. function basePullAll(array, values, iteratee, comparator) {
  24525. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  24526. index = -1,
  24527. length = values.length,
  24528. seen = array;
  24529. if (array === values) {
  24530. values = copyArray(values);
  24531. }
  24532. if (iteratee) {
  24533. seen = arrayMap(array, baseUnary(iteratee));
  24534. }
  24535. while (++index < length) {
  24536. var fromIndex = 0,
  24537. value = values[index],
  24538. computed = iteratee ? iteratee(value) : value;
  24539. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  24540. if (seen !== array) {
  24541. splice.call(seen, fromIndex, 1);
  24542. }
  24543. splice.call(array, fromIndex, 1);
  24544. }
  24545. }
  24546. return array;
  24547. }
  24548. /**
  24549. * The base implementation of `_.pullAt` without support for individual
  24550. * indexes or capturing the removed elements.
  24551. *
  24552. * @private
  24553. * @param {Array} array The array to modify.
  24554. * @param {number[]} indexes The indexes of elements to remove.
  24555. * @returns {Array} Returns `array`.
  24556. */
  24557. function basePullAt(array, indexes) {
  24558. var length = array ? indexes.length : 0,
  24559. lastIndex = length - 1;
  24560. while (length--) {
  24561. var index = indexes[length];
  24562. if (length == lastIndex || index !== previous) {
  24563. var previous = index;
  24564. if (isIndex(index)) {
  24565. splice.call(array, index, 1);
  24566. } else {
  24567. baseUnset(array, index);
  24568. }
  24569. }
  24570. }
  24571. return array;
  24572. }
  24573. /**
  24574. * The base implementation of `_.random` without support for returning
  24575. * floating-point numbers.
  24576. *
  24577. * @private
  24578. * @param {number} lower The lower bound.
  24579. * @param {number} upper The upper bound.
  24580. * @returns {number} Returns the random number.
  24581. */
  24582. function baseRandom(lower, upper) {
  24583. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  24584. }
  24585. /**
  24586. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  24587. * coerce arguments.
  24588. *
  24589. * @private
  24590. * @param {number} start The start of the range.
  24591. * @param {number} end The end of the range.
  24592. * @param {number} step The value to increment or decrement by.
  24593. * @param {boolean} [fromRight] Specify iterating from right to left.
  24594. * @returns {Array} Returns the range of numbers.
  24595. */
  24596. function baseRange(start, end, step, fromRight) {
  24597. var index = -1,
  24598. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  24599. result = Array(length);
  24600. while (length--) {
  24601. result[fromRight ? length : ++index] = start;
  24602. start += step;
  24603. }
  24604. return result;
  24605. }
  24606. /**
  24607. * The base implementation of `_.repeat` which doesn't coerce arguments.
  24608. *
  24609. * @private
  24610. * @param {string} string The string to repeat.
  24611. * @param {number} n The number of times to repeat the string.
  24612. * @returns {string} Returns the repeated string.
  24613. */
  24614. function baseRepeat(string, n) {
  24615. var result = '';
  24616. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  24617. return result;
  24618. }
  24619. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  24620. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  24621. do {
  24622. if (n % 2) {
  24623. result += string;
  24624. }
  24625. n = nativeFloor(n / 2);
  24626. if (n) {
  24627. string += string;
  24628. }
  24629. } while (n);
  24630. return result;
  24631. }
  24632. /**
  24633. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  24634. *
  24635. * @private
  24636. * @param {Function} func The function to apply a rest parameter to.
  24637. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24638. * @returns {Function} Returns the new function.
  24639. */
  24640. function baseRest(func, start) {
  24641. return setToString(overRest(func, start, identity), func + '');
  24642. }
  24643. /**
  24644. * The base implementation of `_.sample`.
  24645. *
  24646. * @private
  24647. * @param {Array|Object} collection The collection to sample.
  24648. * @returns {*} Returns the random element.
  24649. */
  24650. function baseSample(collection) {
  24651. return arraySample(values(collection));
  24652. }
  24653. /**
  24654. * The base implementation of `_.sampleSize` without param guards.
  24655. *
  24656. * @private
  24657. * @param {Array|Object} collection The collection to sample.
  24658. * @param {number} n The number of elements to sample.
  24659. * @returns {Array} Returns the random elements.
  24660. */
  24661. function baseSampleSize(collection, n) {
  24662. var array = values(collection);
  24663. return shuffleSelf(array, baseClamp(n, 0, array.length));
  24664. }
  24665. /**
  24666. * The base implementation of `_.set`.
  24667. *
  24668. * @private
  24669. * @param {Object} object The object to modify.
  24670. * @param {Array|string} path The path of the property to set.
  24671. * @param {*} value The value to set.
  24672. * @param {Function} [customizer] The function to customize path creation.
  24673. * @returns {Object} Returns `object`.
  24674. */
  24675. function baseSet(object, path, value, customizer) {
  24676. if (!isObject(object)) {
  24677. return object;
  24678. }
  24679. path = castPath(path, object);
  24680. var index = -1,
  24681. length = path.length,
  24682. lastIndex = length - 1,
  24683. nested = object;
  24684. while (nested != null && ++index < length) {
  24685. var key = toKey(path[index]),
  24686. newValue = value;
  24687. if (index != lastIndex) {
  24688. var objValue = nested[key];
  24689. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  24690. if (newValue === undefined) {
  24691. newValue = isObject(objValue)
  24692. ? objValue
  24693. : (isIndex(path[index + 1]) ? [] : {});
  24694. }
  24695. }
  24696. assignValue(nested, key, newValue);
  24697. nested = nested[key];
  24698. }
  24699. return object;
  24700. }
  24701. /**
  24702. * The base implementation of `setData` without support for hot loop shorting.
  24703. *
  24704. * @private
  24705. * @param {Function} func The function to associate metadata with.
  24706. * @param {*} data The metadata.
  24707. * @returns {Function} Returns `func`.
  24708. */
  24709. var baseSetData = !metaMap ? identity : function(func, data) {
  24710. metaMap.set(func, data);
  24711. return func;
  24712. };
  24713. /**
  24714. * The base implementation of `setToString` without support for hot loop shorting.
  24715. *
  24716. * @private
  24717. * @param {Function} func The function to modify.
  24718. * @param {Function} string The `toString` result.
  24719. * @returns {Function} Returns `func`.
  24720. */
  24721. var baseSetToString = !defineProperty ? identity : function(func, string) {
  24722. return defineProperty(func, 'toString', {
  24723. 'configurable': true,
  24724. 'enumerable': false,
  24725. 'value': constant(string),
  24726. 'writable': true
  24727. });
  24728. };
  24729. /**
  24730. * The base implementation of `_.shuffle`.
  24731. *
  24732. * @private
  24733. * @param {Array|Object} collection The collection to shuffle.
  24734. * @returns {Array} Returns the new shuffled array.
  24735. */
  24736. function baseShuffle(collection) {
  24737. return shuffleSelf(values(collection));
  24738. }
  24739. /**
  24740. * The base implementation of `_.slice` without an iteratee call guard.
  24741. *
  24742. * @private
  24743. * @param {Array} array The array to slice.
  24744. * @param {number} [start=0] The start position.
  24745. * @param {number} [end=array.length] The end position.
  24746. * @returns {Array} Returns the slice of `array`.
  24747. */
  24748. function baseSlice(array, start, end) {
  24749. var index = -1,
  24750. length = array.length;
  24751. if (start < 0) {
  24752. start = -start > length ? 0 : (length + start);
  24753. }
  24754. end = end > length ? length : end;
  24755. if (end < 0) {
  24756. end += length;
  24757. }
  24758. length = start > end ? 0 : ((end - start) >>> 0);
  24759. start >>>= 0;
  24760. var result = Array(length);
  24761. while (++index < length) {
  24762. result[index] = array[index + start];
  24763. }
  24764. return result;
  24765. }
  24766. /**
  24767. * The base implementation of `_.some` without support for iteratee shorthands.
  24768. *
  24769. * @private
  24770. * @param {Array|Object} collection The collection to iterate over.
  24771. * @param {Function} predicate The function invoked per iteration.
  24772. * @returns {boolean} Returns `true` if any element passes the predicate check,
  24773. * else `false`.
  24774. */
  24775. function baseSome(collection, predicate) {
  24776. var result;
  24777. baseEach(collection, function(value, index, collection) {
  24778. result = predicate(value, index, collection);
  24779. return !result;
  24780. });
  24781. return !!result;
  24782. }
  24783. /**
  24784. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  24785. * performs a binary search of `array` to determine the index at which `value`
  24786. * should be inserted into `array` in order to maintain its sort order.
  24787. *
  24788. * @private
  24789. * @param {Array} array The sorted array to inspect.
  24790. * @param {*} value The value to evaluate.
  24791. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  24792. * @returns {number} Returns the index at which `value` should be inserted
  24793. * into `array`.
  24794. */
  24795. function baseSortedIndex(array, value, retHighest) {
  24796. var low = 0,
  24797. high = array == null ? low : array.length;
  24798. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  24799. while (low < high) {
  24800. var mid = (low + high) >>> 1,
  24801. computed = array[mid];
  24802. if (computed !== null && !isSymbol(computed) &&
  24803. (retHighest ? (computed <= value) : (computed < value))) {
  24804. low = mid + 1;
  24805. } else {
  24806. high = mid;
  24807. }
  24808. }
  24809. return high;
  24810. }
  24811. return baseSortedIndexBy(array, value, identity, retHighest);
  24812. }
  24813. /**
  24814. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  24815. * which invokes `iteratee` for `value` and each element of `array` to compute
  24816. * their sort ranking. The iteratee is invoked with one argument; (value).
  24817. *
  24818. * @private
  24819. * @param {Array} array The sorted array to inspect.
  24820. * @param {*} value The value to evaluate.
  24821. * @param {Function} iteratee The iteratee invoked per element.
  24822. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  24823. * @returns {number} Returns the index at which `value` should be inserted
  24824. * into `array`.
  24825. */
  24826. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  24827. value = iteratee(value);
  24828. var low = 0,
  24829. high = array == null ? 0 : array.length,
  24830. valIsNaN = value !== value,
  24831. valIsNull = value === null,
  24832. valIsSymbol = isSymbol(value),
  24833. valIsUndefined = value === undefined;
  24834. while (low < high) {
  24835. var mid = nativeFloor((low + high) / 2),
  24836. computed = iteratee(array[mid]),
  24837. othIsDefined = computed !== undefined,
  24838. othIsNull = computed === null,
  24839. othIsReflexive = computed === computed,
  24840. othIsSymbol = isSymbol(computed);
  24841. if (valIsNaN) {
  24842. var setLow = retHighest || othIsReflexive;
  24843. } else if (valIsUndefined) {
  24844. setLow = othIsReflexive && (retHighest || othIsDefined);
  24845. } else if (valIsNull) {
  24846. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  24847. } else if (valIsSymbol) {
  24848. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  24849. } else if (othIsNull || othIsSymbol) {
  24850. setLow = false;
  24851. } else {
  24852. setLow = retHighest ? (computed <= value) : (computed < value);
  24853. }
  24854. if (setLow) {
  24855. low = mid + 1;
  24856. } else {
  24857. high = mid;
  24858. }
  24859. }
  24860. return nativeMin(high, MAX_ARRAY_INDEX);
  24861. }
  24862. /**
  24863. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  24864. * support for iteratee shorthands.
  24865. *
  24866. * @private
  24867. * @param {Array} array The array to inspect.
  24868. * @param {Function} [iteratee] The iteratee invoked per element.
  24869. * @returns {Array} Returns the new duplicate free array.
  24870. */
  24871. function baseSortedUniq(array, iteratee) {
  24872. var index = -1,
  24873. length = array.length,
  24874. resIndex = 0,
  24875. result = [];
  24876. while (++index < length) {
  24877. var value = array[index],
  24878. computed = iteratee ? iteratee(value) : value;
  24879. if (!index || !eq(computed, seen)) {
  24880. var seen = computed;
  24881. result[resIndex++] = value === 0 ? 0 : value;
  24882. }
  24883. }
  24884. return result;
  24885. }
  24886. /**
  24887. * The base implementation of `_.toNumber` which doesn't ensure correct
  24888. * conversions of binary, hexadecimal, or octal string values.
  24889. *
  24890. * @private
  24891. * @param {*} value The value to process.
  24892. * @returns {number} Returns the number.
  24893. */
  24894. function baseToNumber(value) {
  24895. if (typeof value == 'number') {
  24896. return value;
  24897. }
  24898. if (isSymbol(value)) {
  24899. return NAN;
  24900. }
  24901. return +value;
  24902. }
  24903. /**
  24904. * The base implementation of `_.toString` which doesn't convert nullish
  24905. * values to empty strings.
  24906. *
  24907. * @private
  24908. * @param {*} value The value to process.
  24909. * @returns {string} Returns the string.
  24910. */
  24911. function baseToString(value) {
  24912. // Exit early for strings to avoid a performance hit in some environments.
  24913. if (typeof value == 'string') {
  24914. return value;
  24915. }
  24916. if (isArray(value)) {
  24917. // Recursively convert values (susceptible to call stack limits).
  24918. return arrayMap(value, baseToString) + '';
  24919. }
  24920. if (isSymbol(value)) {
  24921. return symbolToString ? symbolToString.call(value) : '';
  24922. }
  24923. var result = (value + '');
  24924. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24925. }
  24926. /**
  24927. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  24928. *
  24929. * @private
  24930. * @param {Array} array The array to inspect.
  24931. * @param {Function} [iteratee] The iteratee invoked per element.
  24932. * @param {Function} [comparator] The comparator invoked per element.
  24933. * @returns {Array} Returns the new duplicate free array.
  24934. */
  24935. function baseUniq(array, iteratee, comparator) {
  24936. var index = -1,
  24937. includes = arrayIncludes,
  24938. length = array.length,
  24939. isCommon = true,
  24940. result = [],
  24941. seen = result;
  24942. if (comparator) {
  24943. isCommon = false;
  24944. includes = arrayIncludesWith;
  24945. }
  24946. else if (length >= LARGE_ARRAY_SIZE) {
  24947. var set = iteratee ? null : createSet(array);
  24948. if (set) {
  24949. return setToArray(set);
  24950. }
  24951. isCommon = false;
  24952. includes = cacheHas;
  24953. seen = new SetCache;
  24954. }
  24955. else {
  24956. seen = iteratee ? [] : result;
  24957. }
  24958. outer:
  24959. while (++index < length) {
  24960. var value = array[index],
  24961. computed = iteratee ? iteratee(value) : value;
  24962. value = (comparator || value !== 0) ? value : 0;
  24963. if (isCommon && computed === computed) {
  24964. var seenIndex = seen.length;
  24965. while (seenIndex--) {
  24966. if (seen[seenIndex] === computed) {
  24967. continue outer;
  24968. }
  24969. }
  24970. if (iteratee) {
  24971. seen.push(computed);
  24972. }
  24973. result.push(value);
  24974. }
  24975. else if (!includes(seen, computed, comparator)) {
  24976. if (seen !== result) {
  24977. seen.push(computed);
  24978. }
  24979. result.push(value);
  24980. }
  24981. }
  24982. return result;
  24983. }
  24984. /**
  24985. * The base implementation of `_.unset`.
  24986. *
  24987. * @private
  24988. * @param {Object} object The object to modify.
  24989. * @param {Array|string} path The property path to unset.
  24990. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  24991. */
  24992. function baseUnset(object, path) {
  24993. path = castPath(path, object);
  24994. object = parent(object, path);
  24995. return object == null || delete object[toKey(last(path))];
  24996. }
  24997. /**
  24998. * The base implementation of `_.update`.
  24999. *
  25000. * @private
  25001. * @param {Object} object The object to modify.
  25002. * @param {Array|string} path The path of the property to update.
  25003. * @param {Function} updater The function to produce the updated value.
  25004. * @param {Function} [customizer] The function to customize path creation.
  25005. * @returns {Object} Returns `object`.
  25006. */
  25007. function baseUpdate(object, path, updater, customizer) {
  25008. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  25009. }
  25010. /**
  25011. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  25012. * without support for iteratee shorthands.
  25013. *
  25014. * @private
  25015. * @param {Array} array The array to query.
  25016. * @param {Function} predicate The function invoked per iteration.
  25017. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  25018. * @param {boolean} [fromRight] Specify iterating from right to left.
  25019. * @returns {Array} Returns the slice of `array`.
  25020. */
  25021. function baseWhile(array, predicate, isDrop, fromRight) {
  25022. var length = array.length,
  25023. index = fromRight ? length : -1;
  25024. while ((fromRight ? index-- : ++index < length) &&
  25025. predicate(array[index], index, array)) {}
  25026. return isDrop
  25027. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  25028. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  25029. }
  25030. /**
  25031. * The base implementation of `wrapperValue` which returns the result of
  25032. * performing a sequence of actions on the unwrapped `value`, where each
  25033. * successive action is supplied the return value of the previous.
  25034. *
  25035. * @private
  25036. * @param {*} value The unwrapped value.
  25037. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  25038. * @returns {*} Returns the resolved value.
  25039. */
  25040. function baseWrapperValue(value, actions) {
  25041. var result = value;
  25042. if (result instanceof LazyWrapper) {
  25043. result = result.value();
  25044. }
  25045. return arrayReduce(actions, function(result, action) {
  25046. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  25047. }, result);
  25048. }
  25049. /**
  25050. * The base implementation of methods like `_.xor`, without support for
  25051. * iteratee shorthands, that accepts an array of arrays to inspect.
  25052. *
  25053. * @private
  25054. * @param {Array} arrays The arrays to inspect.
  25055. * @param {Function} [iteratee] The iteratee invoked per element.
  25056. * @param {Function} [comparator] The comparator invoked per element.
  25057. * @returns {Array} Returns the new array of values.
  25058. */
  25059. function baseXor(arrays, iteratee, comparator) {
  25060. var length = arrays.length;
  25061. if (length < 2) {
  25062. return length ? baseUniq(arrays[0]) : [];
  25063. }
  25064. var index = -1,
  25065. result = Array(length);
  25066. while (++index < length) {
  25067. var array = arrays[index],
  25068. othIndex = -1;
  25069. while (++othIndex < length) {
  25070. if (othIndex != index) {
  25071. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  25072. }
  25073. }
  25074. }
  25075. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  25076. }
  25077. /**
  25078. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  25079. *
  25080. * @private
  25081. * @param {Array} props The property identifiers.
  25082. * @param {Array} values The property values.
  25083. * @param {Function} assignFunc The function to assign values.
  25084. * @returns {Object} Returns the new object.
  25085. */
  25086. function baseZipObject(props, values, assignFunc) {
  25087. var index = -1,
  25088. length = props.length,
  25089. valsLength = values.length,
  25090. result = {};
  25091. while (++index < length) {
  25092. var value = index < valsLength ? values[index] : undefined;
  25093. assignFunc(result, props[index], value);
  25094. }
  25095. return result;
  25096. }
  25097. /**
  25098. * Casts `value` to an empty array if it's not an array like object.
  25099. *
  25100. * @private
  25101. * @param {*} value The value to inspect.
  25102. * @returns {Array|Object} Returns the cast array-like object.
  25103. */
  25104. function castArrayLikeObject(value) {
  25105. return isArrayLikeObject(value) ? value : [];
  25106. }
  25107. /**
  25108. * Casts `value` to `identity` if it's not a function.
  25109. *
  25110. * @private
  25111. * @param {*} value The value to inspect.
  25112. * @returns {Function} Returns cast function.
  25113. */
  25114. function castFunction(value) {
  25115. return typeof value == 'function' ? value : identity;
  25116. }
  25117. /**
  25118. * Casts `value` to a path array if it's not one.
  25119. *
  25120. * @private
  25121. * @param {*} value The value to inspect.
  25122. * @param {Object} [object] The object to query keys on.
  25123. * @returns {Array} Returns the cast property path array.
  25124. */
  25125. function castPath(value, object) {
  25126. if (isArray(value)) {
  25127. return value;
  25128. }
  25129. return isKey(value, object) ? [value] : stringToPath(toString(value));
  25130. }
  25131. /**
  25132. * A `baseRest` alias which can be replaced with `identity` by module
  25133. * replacement plugins.
  25134. *
  25135. * @private
  25136. * @type {Function}
  25137. * @param {Function} func The function to apply a rest parameter to.
  25138. * @returns {Function} Returns the new function.
  25139. */
  25140. var castRest = baseRest;
  25141. /**
  25142. * Casts `array` to a slice if it's needed.
  25143. *
  25144. * @private
  25145. * @param {Array} array The array to inspect.
  25146. * @param {number} start The start position.
  25147. * @param {number} [end=array.length] The end position.
  25148. * @returns {Array} Returns the cast slice.
  25149. */
  25150. function castSlice(array, start, end) {
  25151. var length = array.length;
  25152. end = end === undefined ? length : end;
  25153. return (!start && end >= length) ? array : baseSlice(array, start, end);
  25154. }
  25155. /**
  25156. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  25157. *
  25158. * @private
  25159. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  25160. */
  25161. var clearTimeout = ctxClearTimeout || function(id) {
  25162. return root.clearTimeout(id);
  25163. };
  25164. /**
  25165. * Creates a clone of `buffer`.
  25166. *
  25167. * @private
  25168. * @param {Buffer} buffer The buffer to clone.
  25169. * @param {boolean} [isDeep] Specify a deep clone.
  25170. * @returns {Buffer} Returns the cloned buffer.
  25171. */
  25172. function cloneBuffer(buffer, isDeep) {
  25173. if (isDeep) {
  25174. return buffer.slice();
  25175. }
  25176. var length = buffer.length,
  25177. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  25178. buffer.copy(result);
  25179. return result;
  25180. }
  25181. /**
  25182. * Creates a clone of `arrayBuffer`.
  25183. *
  25184. * @private
  25185. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  25186. * @returns {ArrayBuffer} Returns the cloned array buffer.
  25187. */
  25188. function cloneArrayBuffer(arrayBuffer) {
  25189. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  25190. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  25191. return result;
  25192. }
  25193. /**
  25194. * Creates a clone of `dataView`.
  25195. *
  25196. * @private
  25197. * @param {Object} dataView The data view to clone.
  25198. * @param {boolean} [isDeep] Specify a deep clone.
  25199. * @returns {Object} Returns the cloned data view.
  25200. */
  25201. function cloneDataView(dataView, isDeep) {
  25202. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  25203. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  25204. }
  25205. /**
  25206. * Creates a clone of `regexp`.
  25207. *
  25208. * @private
  25209. * @param {Object} regexp The regexp to clone.
  25210. * @returns {Object} Returns the cloned regexp.
  25211. */
  25212. function cloneRegExp(regexp) {
  25213. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  25214. result.lastIndex = regexp.lastIndex;
  25215. return result;
  25216. }
  25217. /**
  25218. * Creates a clone of the `symbol` object.
  25219. *
  25220. * @private
  25221. * @param {Object} symbol The symbol object to clone.
  25222. * @returns {Object} Returns the cloned symbol object.
  25223. */
  25224. function cloneSymbol(symbol) {
  25225. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  25226. }
  25227. /**
  25228. * Creates a clone of `typedArray`.
  25229. *
  25230. * @private
  25231. * @param {Object} typedArray The typed array to clone.
  25232. * @param {boolean} [isDeep] Specify a deep clone.
  25233. * @returns {Object} Returns the cloned typed array.
  25234. */
  25235. function cloneTypedArray(typedArray, isDeep) {
  25236. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  25237. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  25238. }
  25239. /**
  25240. * Compares values to sort them in ascending order.
  25241. *
  25242. * @private
  25243. * @param {*} value The value to compare.
  25244. * @param {*} other The other value to compare.
  25245. * @returns {number} Returns the sort order indicator for `value`.
  25246. */
  25247. function compareAscending(value, other) {
  25248. if (value !== other) {
  25249. var valIsDefined = value !== undefined,
  25250. valIsNull = value === null,
  25251. valIsReflexive = value === value,
  25252. valIsSymbol = isSymbol(value);
  25253. var othIsDefined = other !== undefined,
  25254. othIsNull = other === null,
  25255. othIsReflexive = other === other,
  25256. othIsSymbol = isSymbol(other);
  25257. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  25258. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  25259. (valIsNull && othIsDefined && othIsReflexive) ||
  25260. (!valIsDefined && othIsReflexive) ||
  25261. !valIsReflexive) {
  25262. return 1;
  25263. }
  25264. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  25265. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  25266. (othIsNull && valIsDefined && valIsReflexive) ||
  25267. (!othIsDefined && valIsReflexive) ||
  25268. !othIsReflexive) {
  25269. return -1;
  25270. }
  25271. }
  25272. return 0;
  25273. }
  25274. /**
  25275. * Used by `_.orderBy` to compare multiple properties of a value to another
  25276. * and stable sort them.
  25277. *
  25278. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  25279. * specify an order of "desc" for descending or "asc" for ascending sort order
  25280. * of corresponding values.
  25281. *
  25282. * @private
  25283. * @param {Object} object The object to compare.
  25284. * @param {Object} other The other object to compare.
  25285. * @param {boolean[]|string[]} orders The order to sort by for each property.
  25286. * @returns {number} Returns the sort order indicator for `object`.
  25287. */
  25288. function compareMultiple(object, other, orders) {
  25289. var index = -1,
  25290. objCriteria = object.criteria,
  25291. othCriteria = other.criteria,
  25292. length = objCriteria.length,
  25293. ordersLength = orders.length;
  25294. while (++index < length) {
  25295. var result = compareAscending(objCriteria[index], othCriteria[index]);
  25296. if (result) {
  25297. if (index >= ordersLength) {
  25298. return result;
  25299. }
  25300. var order = orders[index];
  25301. return result * (order == 'desc' ? -1 : 1);
  25302. }
  25303. }
  25304. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  25305. // that causes it, under certain circumstances, to provide the same value for
  25306. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  25307. // for more details.
  25308. //
  25309. // This also ensures a stable sort in V8 and other engines.
  25310. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  25311. return object.index - other.index;
  25312. }
  25313. /**
  25314. * Creates an array that is the composition of partially applied arguments,
  25315. * placeholders, and provided arguments into a single array of arguments.
  25316. *
  25317. * @private
  25318. * @param {Array} args The provided arguments.
  25319. * @param {Array} partials The arguments to prepend to those provided.
  25320. * @param {Array} holders The `partials` placeholder indexes.
  25321. * @params {boolean} [isCurried] Specify composing for a curried function.
  25322. * @returns {Array} Returns the new array of composed arguments.
  25323. */
  25324. function composeArgs(args, partials, holders, isCurried) {
  25325. var argsIndex = -1,
  25326. argsLength = args.length,
  25327. holdersLength = holders.length,
  25328. leftIndex = -1,
  25329. leftLength = partials.length,
  25330. rangeLength = nativeMax(argsLength - holdersLength, 0),
  25331. result = Array(leftLength + rangeLength),
  25332. isUncurried = !isCurried;
  25333. while (++leftIndex < leftLength) {
  25334. result[leftIndex] = partials[leftIndex];
  25335. }
  25336. while (++argsIndex < holdersLength) {
  25337. if (isUncurried || argsIndex < argsLength) {
  25338. result[holders[argsIndex]] = args[argsIndex];
  25339. }
  25340. }
  25341. while (rangeLength--) {
  25342. result[leftIndex++] = args[argsIndex++];
  25343. }
  25344. return result;
  25345. }
  25346. /**
  25347. * This function is like `composeArgs` except that the arguments composition
  25348. * is tailored for `_.partialRight`.
  25349. *
  25350. * @private
  25351. * @param {Array} args The provided arguments.
  25352. * @param {Array} partials The arguments to append to those provided.
  25353. * @param {Array} holders The `partials` placeholder indexes.
  25354. * @params {boolean} [isCurried] Specify composing for a curried function.
  25355. * @returns {Array} Returns the new array of composed arguments.
  25356. */
  25357. function composeArgsRight(args, partials, holders, isCurried) {
  25358. var argsIndex = -1,
  25359. argsLength = args.length,
  25360. holdersIndex = -1,
  25361. holdersLength = holders.length,
  25362. rightIndex = -1,
  25363. rightLength = partials.length,
  25364. rangeLength = nativeMax(argsLength - holdersLength, 0),
  25365. result = Array(rangeLength + rightLength),
  25366. isUncurried = !isCurried;
  25367. while (++argsIndex < rangeLength) {
  25368. result[argsIndex] = args[argsIndex];
  25369. }
  25370. var offset = argsIndex;
  25371. while (++rightIndex < rightLength) {
  25372. result[offset + rightIndex] = partials[rightIndex];
  25373. }
  25374. while (++holdersIndex < holdersLength) {
  25375. if (isUncurried || argsIndex < argsLength) {
  25376. result[offset + holders[holdersIndex]] = args[argsIndex++];
  25377. }
  25378. }
  25379. return result;
  25380. }
  25381. /**
  25382. * Copies the values of `source` to `array`.
  25383. *
  25384. * @private
  25385. * @param {Array} source The array to copy values from.
  25386. * @param {Array} [array=[]] The array to copy values to.
  25387. * @returns {Array} Returns `array`.
  25388. */
  25389. function copyArray(source, array) {
  25390. var index = -1,
  25391. length = source.length;
  25392. array || (array = Array(length));
  25393. while (++index < length) {
  25394. array[index] = source[index];
  25395. }
  25396. return array;
  25397. }
  25398. /**
  25399. * Copies properties of `source` to `object`.
  25400. *
  25401. * @private
  25402. * @param {Object} source The object to copy properties from.
  25403. * @param {Array} props The property identifiers to copy.
  25404. * @param {Object} [object={}] The object to copy properties to.
  25405. * @param {Function} [customizer] The function to customize copied values.
  25406. * @returns {Object} Returns `object`.
  25407. */
  25408. function copyObject(source, props, object, customizer) {
  25409. var isNew = !object;
  25410. object || (object = {});
  25411. var index = -1,
  25412. length = props.length;
  25413. while (++index < length) {
  25414. var key = props[index];
  25415. var newValue = customizer
  25416. ? customizer(object[key], source[key], key, object, source)
  25417. : undefined;
  25418. if (newValue === undefined) {
  25419. newValue = source[key];
  25420. }
  25421. if (isNew) {
  25422. baseAssignValue(object, key, newValue);
  25423. } else {
  25424. assignValue(object, key, newValue);
  25425. }
  25426. }
  25427. return object;
  25428. }
  25429. /**
  25430. * Copies own symbols of `source` to `object`.
  25431. *
  25432. * @private
  25433. * @param {Object} source The object to copy symbols from.
  25434. * @param {Object} [object={}] The object to copy symbols to.
  25435. * @returns {Object} Returns `object`.
  25436. */
  25437. function copySymbols(source, object) {
  25438. return copyObject(source, getSymbols(source), object);
  25439. }
  25440. /**
  25441. * Copies own and inherited symbols of `source` to `object`.
  25442. *
  25443. * @private
  25444. * @param {Object} source The object to copy symbols from.
  25445. * @param {Object} [object={}] The object to copy symbols to.
  25446. * @returns {Object} Returns `object`.
  25447. */
  25448. function copySymbolsIn(source, object) {
  25449. return copyObject(source, getSymbolsIn(source), object);
  25450. }
  25451. /**
  25452. * Creates a function like `_.groupBy`.
  25453. *
  25454. * @private
  25455. * @param {Function} setter The function to set accumulator values.
  25456. * @param {Function} [initializer] The accumulator object initializer.
  25457. * @returns {Function} Returns the new aggregator function.
  25458. */
  25459. function createAggregator(setter, initializer) {
  25460. return function(collection, iteratee) {
  25461. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  25462. accumulator = initializer ? initializer() : {};
  25463. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  25464. };
  25465. }
  25466. /**
  25467. * Creates a function like `_.assign`.
  25468. *
  25469. * @private
  25470. * @param {Function} assigner The function to assign values.
  25471. * @returns {Function} Returns the new assigner function.
  25472. */
  25473. function createAssigner(assigner) {
  25474. return baseRest(function(object, sources) {
  25475. var index = -1,
  25476. length = sources.length,
  25477. customizer = length > 1 ? sources[length - 1] : undefined,
  25478. guard = length > 2 ? sources[2] : undefined;
  25479. customizer = (assigner.length > 3 && typeof customizer == 'function')
  25480. ? (length--, customizer)
  25481. : undefined;
  25482. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  25483. customizer = length < 3 ? undefined : customizer;
  25484. length = 1;
  25485. }
  25486. object = Object(object);
  25487. while (++index < length) {
  25488. var source = sources[index];
  25489. if (source) {
  25490. assigner(object, source, index, customizer);
  25491. }
  25492. }
  25493. return object;
  25494. });
  25495. }
  25496. /**
  25497. * Creates a `baseEach` or `baseEachRight` function.
  25498. *
  25499. * @private
  25500. * @param {Function} eachFunc The function to iterate over a collection.
  25501. * @param {boolean} [fromRight] Specify iterating from right to left.
  25502. * @returns {Function} Returns the new base function.
  25503. */
  25504. function createBaseEach(eachFunc, fromRight) {
  25505. return function(collection, iteratee) {
  25506. if (collection == null) {
  25507. return collection;
  25508. }
  25509. if (!isArrayLike(collection)) {
  25510. return eachFunc(collection, iteratee);
  25511. }
  25512. var length = collection.length,
  25513. index = fromRight ? length : -1,
  25514. iterable = Object(collection);
  25515. while ((fromRight ? index-- : ++index < length)) {
  25516. if (iteratee(iterable[index], index, iterable) === false) {
  25517. break;
  25518. }
  25519. }
  25520. return collection;
  25521. };
  25522. }
  25523. /**
  25524. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  25525. *
  25526. * @private
  25527. * @param {boolean} [fromRight] Specify iterating from right to left.
  25528. * @returns {Function} Returns the new base function.
  25529. */
  25530. function createBaseFor(fromRight) {
  25531. return function(object, iteratee, keysFunc) {
  25532. var index = -1,
  25533. iterable = Object(object),
  25534. props = keysFunc(object),
  25535. length = props.length;
  25536. while (length--) {
  25537. var key = props[fromRight ? length : ++index];
  25538. if (iteratee(iterable[key], key, iterable) === false) {
  25539. break;
  25540. }
  25541. }
  25542. return object;
  25543. };
  25544. }
  25545. /**
  25546. * Creates a function that wraps `func` to invoke it with the optional `this`
  25547. * binding of `thisArg`.
  25548. *
  25549. * @private
  25550. * @param {Function} func The function to wrap.
  25551. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25552. * @param {*} [thisArg] The `this` binding of `func`.
  25553. * @returns {Function} Returns the new wrapped function.
  25554. */
  25555. function createBind(func, bitmask, thisArg) {
  25556. var isBind = bitmask & WRAP_BIND_FLAG,
  25557. Ctor = createCtor(func);
  25558. function wrapper() {
  25559. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  25560. return fn.apply(isBind ? thisArg : this, arguments);
  25561. }
  25562. return wrapper;
  25563. }
  25564. /**
  25565. * Creates a function like `_.lowerFirst`.
  25566. *
  25567. * @private
  25568. * @param {string} methodName The name of the `String` case method to use.
  25569. * @returns {Function} Returns the new case function.
  25570. */
  25571. function createCaseFirst(methodName) {
  25572. return function(string) {
  25573. string = toString(string);
  25574. var strSymbols = hasUnicode(string)
  25575. ? stringToArray(string)
  25576. : undefined;
  25577. var chr = strSymbols
  25578. ? strSymbols[0]
  25579. : string.charAt(0);
  25580. var trailing = strSymbols
  25581. ? castSlice(strSymbols, 1).join('')
  25582. : string.slice(1);
  25583. return chr[methodName]() + trailing;
  25584. };
  25585. }
  25586. /**
  25587. * Creates a function like `_.camelCase`.
  25588. *
  25589. * @private
  25590. * @param {Function} callback The function to combine each word.
  25591. * @returns {Function} Returns the new compounder function.
  25592. */
  25593. function createCompounder(callback) {
  25594. return function(string) {
  25595. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  25596. };
  25597. }
  25598. /**
  25599. * Creates a function that produces an instance of `Ctor` regardless of
  25600. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  25601. *
  25602. * @private
  25603. * @param {Function} Ctor The constructor to wrap.
  25604. * @returns {Function} Returns the new wrapped function.
  25605. */
  25606. function createCtor(Ctor) {
  25607. return function() {
  25608. // Use a `switch` statement to work with class constructors. See
  25609. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  25610. // for more details.
  25611. var args = arguments;
  25612. switch (args.length) {
  25613. case 0: return new Ctor;
  25614. case 1: return new Ctor(args[0]);
  25615. case 2: return new Ctor(args[0], args[1]);
  25616. case 3: return new Ctor(args[0], args[1], args[2]);
  25617. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  25618. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  25619. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  25620. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  25621. }
  25622. var thisBinding = baseCreate(Ctor.prototype),
  25623. result = Ctor.apply(thisBinding, args);
  25624. // Mimic the constructor's `return` behavior.
  25625. // See https://es5.github.io/#x13.2.2 for more details.
  25626. return isObject(result) ? result : thisBinding;
  25627. };
  25628. }
  25629. /**
  25630. * Creates a function that wraps `func` to enable currying.
  25631. *
  25632. * @private
  25633. * @param {Function} func The function to wrap.
  25634. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25635. * @param {number} arity The arity of `func`.
  25636. * @returns {Function} Returns the new wrapped function.
  25637. */
  25638. function createCurry(func, bitmask, arity) {
  25639. var Ctor = createCtor(func);
  25640. function wrapper() {
  25641. var length = arguments.length,
  25642. args = Array(length),
  25643. index = length,
  25644. placeholder = getHolder(wrapper);
  25645. while (index--) {
  25646. args[index] = arguments[index];
  25647. }
  25648. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  25649. ? []
  25650. : replaceHolders(args, placeholder);
  25651. length -= holders.length;
  25652. if (length < arity) {
  25653. return createRecurry(
  25654. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  25655. args, holders, undefined, undefined, arity - length);
  25656. }
  25657. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  25658. return apply(fn, this, args);
  25659. }
  25660. return wrapper;
  25661. }
  25662. /**
  25663. * Creates a `_.find` or `_.findLast` function.
  25664. *
  25665. * @private
  25666. * @param {Function} findIndexFunc The function to find the collection index.
  25667. * @returns {Function} Returns the new find function.
  25668. */
  25669. function createFind(findIndexFunc) {
  25670. return function(collection, predicate, fromIndex) {
  25671. var iterable = Object(collection);
  25672. if (!isArrayLike(collection)) {
  25673. var iteratee = getIteratee(predicate, 3);
  25674. collection = keys(collection);
  25675. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  25676. }
  25677. var index = findIndexFunc(collection, predicate, fromIndex);
  25678. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  25679. };
  25680. }
  25681. /**
  25682. * Creates a `_.flow` or `_.flowRight` function.
  25683. *
  25684. * @private
  25685. * @param {boolean} [fromRight] Specify iterating from right to left.
  25686. * @returns {Function} Returns the new flow function.
  25687. */
  25688. function createFlow(fromRight) {
  25689. return flatRest(function(funcs) {
  25690. var length = funcs.length,
  25691. index = length,
  25692. prereq = LodashWrapper.prototype.thru;
  25693. if (fromRight) {
  25694. funcs.reverse();
  25695. }
  25696. while (index--) {
  25697. var func = funcs[index];
  25698. if (typeof func != 'function') {
  25699. throw new TypeError(FUNC_ERROR_TEXT);
  25700. }
  25701. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  25702. var wrapper = new LodashWrapper([], true);
  25703. }
  25704. }
  25705. index = wrapper ? index : length;
  25706. while (++index < length) {
  25707. func = funcs[index];
  25708. var funcName = getFuncName(func),
  25709. data = funcName == 'wrapper' ? getData(func) : undefined;
  25710. if (data && isLaziable(data[0]) &&
  25711. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  25712. !data[4].length && data[9] == 1
  25713. ) {
  25714. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  25715. } else {
  25716. wrapper = (func.length == 1 && isLaziable(func))
  25717. ? wrapper[funcName]()
  25718. : wrapper.thru(func);
  25719. }
  25720. }
  25721. return function() {
  25722. var args = arguments,
  25723. value = args[0];
  25724. if (wrapper && args.length == 1 && isArray(value)) {
  25725. return wrapper.plant(value).value();
  25726. }
  25727. var index = 0,
  25728. result = length ? funcs[index].apply(this, args) : value;
  25729. while (++index < length) {
  25730. result = funcs[index].call(this, result);
  25731. }
  25732. return result;
  25733. };
  25734. });
  25735. }
  25736. /**
  25737. * Creates a function that wraps `func` to invoke it with optional `this`
  25738. * binding of `thisArg`, partial application, and currying.
  25739. *
  25740. * @private
  25741. * @param {Function|string} func The function or method name to wrap.
  25742. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25743. * @param {*} [thisArg] The `this` binding of `func`.
  25744. * @param {Array} [partials] The arguments to prepend to those provided to
  25745. * the new function.
  25746. * @param {Array} [holders] The `partials` placeholder indexes.
  25747. * @param {Array} [partialsRight] The arguments to append to those provided
  25748. * to the new function.
  25749. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  25750. * @param {Array} [argPos] The argument positions of the new function.
  25751. * @param {number} [ary] The arity cap of `func`.
  25752. * @param {number} [arity] The arity of `func`.
  25753. * @returns {Function} Returns the new wrapped function.
  25754. */
  25755. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  25756. var isAry = bitmask & WRAP_ARY_FLAG,
  25757. isBind = bitmask & WRAP_BIND_FLAG,
  25758. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  25759. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  25760. isFlip = bitmask & WRAP_FLIP_FLAG,
  25761. Ctor = isBindKey ? undefined : createCtor(func);
  25762. function wrapper() {
  25763. var length = arguments.length,
  25764. args = Array(length),
  25765. index = length;
  25766. while (index--) {
  25767. args[index] = arguments[index];
  25768. }
  25769. if (isCurried) {
  25770. var placeholder = getHolder(wrapper),
  25771. holdersCount = countHolders(args, placeholder);
  25772. }
  25773. if (partials) {
  25774. args = composeArgs(args, partials, holders, isCurried);
  25775. }
  25776. if (partialsRight) {
  25777. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  25778. }
  25779. length -= holdersCount;
  25780. if (isCurried && length < arity) {
  25781. var newHolders = replaceHolders(args, placeholder);
  25782. return createRecurry(
  25783. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  25784. args, newHolders, argPos, ary, arity - length
  25785. );
  25786. }
  25787. var thisBinding = isBind ? thisArg : this,
  25788. fn = isBindKey ? thisBinding[func] : func;
  25789. length = args.length;
  25790. if (argPos) {
  25791. args = reorder(args, argPos);
  25792. } else if (isFlip && length > 1) {
  25793. args.reverse();
  25794. }
  25795. if (isAry && ary < length) {
  25796. args.length = ary;
  25797. }
  25798. if (this && this !== root && this instanceof wrapper) {
  25799. fn = Ctor || createCtor(fn);
  25800. }
  25801. return fn.apply(thisBinding, args);
  25802. }
  25803. return wrapper;
  25804. }
  25805. /**
  25806. * Creates a function like `_.invertBy`.
  25807. *
  25808. * @private
  25809. * @param {Function} setter The function to set accumulator values.
  25810. * @param {Function} toIteratee The function to resolve iteratees.
  25811. * @returns {Function} Returns the new inverter function.
  25812. */
  25813. function createInverter(setter, toIteratee) {
  25814. return function(object, iteratee) {
  25815. return baseInverter(object, setter, toIteratee(iteratee), {});
  25816. };
  25817. }
  25818. /**
  25819. * Creates a function that performs a mathematical operation on two values.
  25820. *
  25821. * @private
  25822. * @param {Function} operator The function to perform the operation.
  25823. * @param {number} [defaultValue] The value used for `undefined` arguments.
  25824. * @returns {Function} Returns the new mathematical operation function.
  25825. */
  25826. function createMathOperation(operator, defaultValue) {
  25827. return function(value, other) {
  25828. var result;
  25829. if (value === undefined && other === undefined) {
  25830. return defaultValue;
  25831. }
  25832. if (value !== undefined) {
  25833. result = value;
  25834. }
  25835. if (other !== undefined) {
  25836. if (result === undefined) {
  25837. return other;
  25838. }
  25839. if (typeof value == 'string' || typeof other == 'string') {
  25840. value = baseToString(value);
  25841. other = baseToString(other);
  25842. } else {
  25843. value = baseToNumber(value);
  25844. other = baseToNumber(other);
  25845. }
  25846. result = operator(value, other);
  25847. }
  25848. return result;
  25849. };
  25850. }
  25851. /**
  25852. * Creates a function like `_.over`.
  25853. *
  25854. * @private
  25855. * @param {Function} arrayFunc The function to iterate over iteratees.
  25856. * @returns {Function} Returns the new over function.
  25857. */
  25858. function createOver(arrayFunc) {
  25859. return flatRest(function(iteratees) {
  25860. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  25861. return baseRest(function(args) {
  25862. var thisArg = this;
  25863. return arrayFunc(iteratees, function(iteratee) {
  25864. return apply(iteratee, thisArg, args);
  25865. });
  25866. });
  25867. });
  25868. }
  25869. /**
  25870. * Creates the padding for `string` based on `length`. The `chars` string
  25871. * is truncated if the number of characters exceeds `length`.
  25872. *
  25873. * @private
  25874. * @param {number} length The padding length.
  25875. * @param {string} [chars=' '] The string used as padding.
  25876. * @returns {string} Returns the padding for `string`.
  25877. */
  25878. function createPadding(length, chars) {
  25879. chars = chars === undefined ? ' ' : baseToString(chars);
  25880. var charsLength = chars.length;
  25881. if (charsLength < 2) {
  25882. return charsLength ? baseRepeat(chars, length) : chars;
  25883. }
  25884. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  25885. return hasUnicode(chars)
  25886. ? castSlice(stringToArray(result), 0, length).join('')
  25887. : result.slice(0, length);
  25888. }
  25889. /**
  25890. * Creates a function that wraps `func` to invoke it with the `this` binding
  25891. * of `thisArg` and `partials` prepended to the arguments it receives.
  25892. *
  25893. * @private
  25894. * @param {Function} func The function to wrap.
  25895. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25896. * @param {*} thisArg The `this` binding of `func`.
  25897. * @param {Array} partials The arguments to prepend to those provided to
  25898. * the new function.
  25899. * @returns {Function} Returns the new wrapped function.
  25900. */
  25901. function createPartial(func, bitmask, thisArg, partials) {
  25902. var isBind = bitmask & WRAP_BIND_FLAG,
  25903. Ctor = createCtor(func);
  25904. function wrapper() {
  25905. var argsIndex = -1,
  25906. argsLength = arguments.length,
  25907. leftIndex = -1,
  25908. leftLength = partials.length,
  25909. args = Array(leftLength + argsLength),
  25910. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  25911. while (++leftIndex < leftLength) {
  25912. args[leftIndex] = partials[leftIndex];
  25913. }
  25914. while (argsLength--) {
  25915. args[leftIndex++] = arguments[++argsIndex];
  25916. }
  25917. return apply(fn, isBind ? thisArg : this, args);
  25918. }
  25919. return wrapper;
  25920. }
  25921. /**
  25922. * Creates a `_.range` or `_.rangeRight` function.
  25923. *
  25924. * @private
  25925. * @param {boolean} [fromRight] Specify iterating from right to left.
  25926. * @returns {Function} Returns the new range function.
  25927. */
  25928. function createRange(fromRight) {
  25929. return function(start, end, step) {
  25930. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  25931. end = step = undefined;
  25932. }
  25933. // Ensure the sign of `-0` is preserved.
  25934. start = toFinite(start);
  25935. if (end === undefined) {
  25936. end = start;
  25937. start = 0;
  25938. } else {
  25939. end = toFinite(end);
  25940. }
  25941. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  25942. return baseRange(start, end, step, fromRight);
  25943. };
  25944. }
  25945. /**
  25946. * Creates a function that performs a relational operation on two values.
  25947. *
  25948. * @private
  25949. * @param {Function} operator The function to perform the operation.
  25950. * @returns {Function} Returns the new relational operation function.
  25951. */
  25952. function createRelationalOperation(operator) {
  25953. return function(value, other) {
  25954. if (!(typeof value == 'string' && typeof other == 'string')) {
  25955. value = toNumber(value);
  25956. other = toNumber(other);
  25957. }
  25958. return operator(value, other);
  25959. };
  25960. }
  25961. /**
  25962. * Creates a function that wraps `func` to continue currying.
  25963. *
  25964. * @private
  25965. * @param {Function} func The function to wrap.
  25966. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25967. * @param {Function} wrapFunc The function to create the `func` wrapper.
  25968. * @param {*} placeholder The placeholder value.
  25969. * @param {*} [thisArg] The `this` binding of `func`.
  25970. * @param {Array} [partials] The arguments to prepend to those provided to
  25971. * the new function.
  25972. * @param {Array} [holders] The `partials` placeholder indexes.
  25973. * @param {Array} [argPos] The argument positions of the new function.
  25974. * @param {number} [ary] The arity cap of `func`.
  25975. * @param {number} [arity] The arity of `func`.
  25976. * @returns {Function} Returns the new wrapped function.
  25977. */
  25978. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  25979. var isCurry = bitmask & WRAP_CURRY_FLAG,
  25980. newHolders = isCurry ? holders : undefined,
  25981. newHoldersRight = isCurry ? undefined : holders,
  25982. newPartials = isCurry ? partials : undefined,
  25983. newPartialsRight = isCurry ? undefined : partials;
  25984. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  25985. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  25986. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  25987. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  25988. }
  25989. var newData = [
  25990. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  25991. newHoldersRight, argPos, ary, arity
  25992. ];
  25993. var result = wrapFunc.apply(undefined, newData);
  25994. if (isLaziable(func)) {
  25995. setData(result, newData);
  25996. }
  25997. result.placeholder = placeholder;
  25998. return setWrapToString(result, func, bitmask);
  25999. }
  26000. /**
  26001. * Creates a function like `_.round`.
  26002. *
  26003. * @private
  26004. * @param {string} methodName The name of the `Math` method to use when rounding.
  26005. * @returns {Function} Returns the new round function.
  26006. */
  26007. function createRound(methodName) {
  26008. var func = Math[methodName];
  26009. return function(number, precision) {
  26010. number = toNumber(number);
  26011. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  26012. if (precision && nativeIsFinite(number)) {
  26013. // Shift with exponential notation to avoid floating-point issues.
  26014. // See [MDN](https://mdn.io/round#Examples) for more details.
  26015. var pair = (toString(number) + 'e').split('e'),
  26016. value = func(pair[0] + 'e' + (+pair[1] + precision));
  26017. pair = (toString(value) + 'e').split('e');
  26018. return +(pair[0] + 'e' + (+pair[1] - precision));
  26019. }
  26020. return func(number);
  26021. };
  26022. }
  26023. /**
  26024. * Creates a set object of `values`.
  26025. *
  26026. * @private
  26027. * @param {Array} values The values to add to the set.
  26028. * @returns {Object} Returns the new set.
  26029. */
  26030. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  26031. return new Set(values);
  26032. };
  26033. /**
  26034. * Creates a `_.toPairs` or `_.toPairsIn` function.
  26035. *
  26036. * @private
  26037. * @param {Function} keysFunc The function to get the keys of a given object.
  26038. * @returns {Function} Returns the new pairs function.
  26039. */
  26040. function createToPairs(keysFunc) {
  26041. return function(object) {
  26042. var tag = getTag(object);
  26043. if (tag == mapTag) {
  26044. return mapToArray(object);
  26045. }
  26046. if (tag == setTag) {
  26047. return setToPairs(object);
  26048. }
  26049. return baseToPairs(object, keysFunc(object));
  26050. };
  26051. }
  26052. /**
  26053. * Creates a function that either curries or invokes `func` with optional
  26054. * `this` binding and partially applied arguments.
  26055. *
  26056. * @private
  26057. * @param {Function|string} func The function or method name to wrap.
  26058. * @param {number} bitmask The bitmask flags.
  26059. * 1 - `_.bind`
  26060. * 2 - `_.bindKey`
  26061. * 4 - `_.curry` or `_.curryRight` of a bound function
  26062. * 8 - `_.curry`
  26063. * 16 - `_.curryRight`
  26064. * 32 - `_.partial`
  26065. * 64 - `_.partialRight`
  26066. * 128 - `_.rearg`
  26067. * 256 - `_.ary`
  26068. * 512 - `_.flip`
  26069. * @param {*} [thisArg] The `this` binding of `func`.
  26070. * @param {Array} [partials] The arguments to be partially applied.
  26071. * @param {Array} [holders] The `partials` placeholder indexes.
  26072. * @param {Array} [argPos] The argument positions of the new function.
  26073. * @param {number} [ary] The arity cap of `func`.
  26074. * @param {number} [arity] The arity of `func`.
  26075. * @returns {Function} Returns the new wrapped function.
  26076. */
  26077. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  26078. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  26079. if (!isBindKey && typeof func != 'function') {
  26080. throw new TypeError(FUNC_ERROR_TEXT);
  26081. }
  26082. var length = partials ? partials.length : 0;
  26083. if (!length) {
  26084. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  26085. partials = holders = undefined;
  26086. }
  26087. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  26088. arity = arity === undefined ? arity : toInteger(arity);
  26089. length -= holders ? holders.length : 0;
  26090. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  26091. var partialsRight = partials,
  26092. holdersRight = holders;
  26093. partials = holders = undefined;
  26094. }
  26095. var data = isBindKey ? undefined : getData(func);
  26096. var newData = [
  26097. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  26098. argPos, ary, arity
  26099. ];
  26100. if (data) {
  26101. mergeData(newData, data);
  26102. }
  26103. func = newData[0];
  26104. bitmask = newData[1];
  26105. thisArg = newData[2];
  26106. partials = newData[3];
  26107. holders = newData[4];
  26108. arity = newData[9] = newData[9] === undefined
  26109. ? (isBindKey ? 0 : func.length)
  26110. : nativeMax(newData[9] - length, 0);
  26111. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  26112. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  26113. }
  26114. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  26115. var result = createBind(func, bitmask, thisArg);
  26116. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  26117. result = createCurry(func, bitmask, arity);
  26118. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  26119. result = createPartial(func, bitmask, thisArg, partials);
  26120. } else {
  26121. result = createHybrid.apply(undefined, newData);
  26122. }
  26123. var setter = data ? baseSetData : setData;
  26124. return setWrapToString(setter(result, newData), func, bitmask);
  26125. }
  26126. /**
  26127. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  26128. * of source objects to the destination object for all destination properties
  26129. * that resolve to `undefined`.
  26130. *
  26131. * @private
  26132. * @param {*} objValue The destination value.
  26133. * @param {*} srcValue The source value.
  26134. * @param {string} key The key of the property to assign.
  26135. * @param {Object} object The parent object of `objValue`.
  26136. * @returns {*} Returns the value to assign.
  26137. */
  26138. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  26139. if (objValue === undefined ||
  26140. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  26141. return srcValue;
  26142. }
  26143. return objValue;
  26144. }
  26145. /**
  26146. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  26147. * objects into destination objects that are passed thru.
  26148. *
  26149. * @private
  26150. * @param {*} objValue The destination value.
  26151. * @param {*} srcValue The source value.
  26152. * @param {string} key The key of the property to merge.
  26153. * @param {Object} object The parent object of `objValue`.
  26154. * @param {Object} source The parent object of `srcValue`.
  26155. * @param {Object} [stack] Tracks traversed source values and their merged
  26156. * counterparts.
  26157. * @returns {*} Returns the value to assign.
  26158. */
  26159. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  26160. if (isObject(objValue) && isObject(srcValue)) {
  26161. // Recursively merge objects and arrays (susceptible to call stack limits).
  26162. stack.set(srcValue, objValue);
  26163. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  26164. stack['delete'](srcValue);
  26165. }
  26166. return objValue;
  26167. }
  26168. /**
  26169. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  26170. * objects.
  26171. *
  26172. * @private
  26173. * @param {*} value The value to inspect.
  26174. * @param {string} key The key of the property to inspect.
  26175. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  26176. */
  26177. function customOmitClone(value) {
  26178. return isPlainObject(value) ? undefined : value;
  26179. }
  26180. /**
  26181. * A specialized version of `baseIsEqualDeep` for arrays with support for
  26182. * partial deep comparisons.
  26183. *
  26184. * @private
  26185. * @param {Array} array The array to compare.
  26186. * @param {Array} other The other array to compare.
  26187. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  26188. * @param {Function} customizer The function to customize comparisons.
  26189. * @param {Function} equalFunc The function to determine equivalents of values.
  26190. * @param {Object} stack Tracks traversed `array` and `other` objects.
  26191. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  26192. */
  26193. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  26194. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  26195. arrLength = array.length,
  26196. othLength = other.length;
  26197. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  26198. return false;
  26199. }
  26200. // Assume cyclic values are equal.
  26201. var stacked = stack.get(array);
  26202. if (stacked && stack.get(other)) {
  26203. return stacked == other;
  26204. }
  26205. var index = -1,
  26206. result = true,
  26207. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  26208. stack.set(array, other);
  26209. stack.set(other, array);
  26210. // Ignore non-index properties.
  26211. while (++index < arrLength) {
  26212. var arrValue = array[index],
  26213. othValue = other[index];
  26214. if (customizer) {
  26215. var compared = isPartial
  26216. ? customizer(othValue, arrValue, index, other, array, stack)
  26217. : customizer(arrValue, othValue, index, array, other, stack);
  26218. }
  26219. if (compared !== undefined) {
  26220. if (compared) {
  26221. continue;
  26222. }
  26223. result = false;
  26224. break;
  26225. }
  26226. // Recursively compare arrays (susceptible to call stack limits).
  26227. if (seen) {
  26228. if (!arraySome(other, function(othValue, othIndex) {
  26229. if (!cacheHas(seen, othIndex) &&
  26230. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  26231. return seen.push(othIndex);
  26232. }
  26233. })) {
  26234. result = false;
  26235. break;
  26236. }
  26237. } else if (!(
  26238. arrValue === othValue ||
  26239. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  26240. )) {
  26241. result = false;
  26242. break;
  26243. }
  26244. }
  26245. stack['delete'](array);
  26246. stack['delete'](other);
  26247. return result;
  26248. }
  26249. /**
  26250. * A specialized version of `baseIsEqualDeep` for comparing objects of
  26251. * the same `toStringTag`.
  26252. *
  26253. * **Note:** This function only supports comparing values with tags of
  26254. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  26255. *
  26256. * @private
  26257. * @param {Object} object The object to compare.
  26258. * @param {Object} other The other object to compare.
  26259. * @param {string} tag The `toStringTag` of the objects to compare.
  26260. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  26261. * @param {Function} customizer The function to customize comparisons.
  26262. * @param {Function} equalFunc The function to determine equivalents of values.
  26263. * @param {Object} stack Tracks traversed `object` and `other` objects.
  26264. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  26265. */
  26266. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  26267. switch (tag) {
  26268. case dataViewTag:
  26269. if ((object.byteLength != other.byteLength) ||
  26270. (object.byteOffset != other.byteOffset)) {
  26271. return false;
  26272. }
  26273. object = object.buffer;
  26274. other = other.buffer;
  26275. case arrayBufferTag:
  26276. if ((object.byteLength != other.byteLength) ||
  26277. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  26278. return false;
  26279. }
  26280. return true;
  26281. case boolTag:
  26282. case dateTag:
  26283. case numberTag:
  26284. // Coerce booleans to `1` or `0` and dates to milliseconds.
  26285. // Invalid dates are coerced to `NaN`.
  26286. return eq(+object, +other);
  26287. case errorTag:
  26288. return object.name == other.name && object.message == other.message;
  26289. case regexpTag:
  26290. case stringTag:
  26291. // Coerce regexes to strings and treat strings, primitives and objects,
  26292. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  26293. // for more details.
  26294. return object == (other + '');
  26295. case mapTag:
  26296. var convert = mapToArray;
  26297. case setTag:
  26298. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  26299. convert || (convert = setToArray);
  26300. if (object.size != other.size && !isPartial) {
  26301. return false;
  26302. }
  26303. // Assume cyclic values are equal.
  26304. var stacked = stack.get(object);
  26305. if (stacked) {
  26306. return stacked == other;
  26307. }
  26308. bitmask |= COMPARE_UNORDERED_FLAG;
  26309. // Recursively compare objects (susceptible to call stack limits).
  26310. stack.set(object, other);
  26311. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  26312. stack['delete'](object);
  26313. return result;
  26314. case symbolTag:
  26315. if (symbolValueOf) {
  26316. return symbolValueOf.call(object) == symbolValueOf.call(other);
  26317. }
  26318. }
  26319. return false;
  26320. }
  26321. /**
  26322. * A specialized version of `baseIsEqualDeep` for objects with support for
  26323. * partial deep comparisons.
  26324. *
  26325. * @private
  26326. * @param {Object} object The object to compare.
  26327. * @param {Object} other The other object to compare.
  26328. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  26329. * @param {Function} customizer The function to customize comparisons.
  26330. * @param {Function} equalFunc The function to determine equivalents of values.
  26331. * @param {Object} stack Tracks traversed `object` and `other` objects.
  26332. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  26333. */
  26334. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  26335. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  26336. objProps = getAllKeys(object),
  26337. objLength = objProps.length,
  26338. othProps = getAllKeys(other),
  26339. othLength = othProps.length;
  26340. if (objLength != othLength && !isPartial) {
  26341. return false;
  26342. }
  26343. var index = objLength;
  26344. while (index--) {
  26345. var key = objProps[index];
  26346. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  26347. return false;
  26348. }
  26349. }
  26350. // Assume cyclic values are equal.
  26351. var stacked = stack.get(object);
  26352. if (stacked && stack.get(other)) {
  26353. return stacked == other;
  26354. }
  26355. var result = true;
  26356. stack.set(object, other);
  26357. stack.set(other, object);
  26358. var skipCtor = isPartial;
  26359. while (++index < objLength) {
  26360. key = objProps[index];
  26361. var objValue = object[key],
  26362. othValue = other[key];
  26363. if (customizer) {
  26364. var compared = isPartial
  26365. ? customizer(othValue, objValue, key, other, object, stack)
  26366. : customizer(objValue, othValue, key, object, other, stack);
  26367. }
  26368. // Recursively compare objects (susceptible to call stack limits).
  26369. if (!(compared === undefined
  26370. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  26371. : compared
  26372. )) {
  26373. result = false;
  26374. break;
  26375. }
  26376. skipCtor || (skipCtor = key == 'constructor');
  26377. }
  26378. if (result && !skipCtor) {
  26379. var objCtor = object.constructor,
  26380. othCtor = other.constructor;
  26381. // Non `Object` object instances with different constructors are not equal.
  26382. if (objCtor != othCtor &&
  26383. ('constructor' in object && 'constructor' in other) &&
  26384. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  26385. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  26386. result = false;
  26387. }
  26388. }
  26389. stack['delete'](object);
  26390. stack['delete'](other);
  26391. return result;
  26392. }
  26393. /**
  26394. * A specialized version of `baseRest` which flattens the rest array.
  26395. *
  26396. * @private
  26397. * @param {Function} func The function to apply a rest parameter to.
  26398. * @returns {Function} Returns the new function.
  26399. */
  26400. function flatRest(func) {
  26401. return setToString(overRest(func, undefined, flatten), func + '');
  26402. }
  26403. /**
  26404. * Creates an array of own enumerable property names and symbols of `object`.
  26405. *
  26406. * @private
  26407. * @param {Object} object The object to query.
  26408. * @returns {Array} Returns the array of property names and symbols.
  26409. */
  26410. function getAllKeys(object) {
  26411. return baseGetAllKeys(object, keys, getSymbols);
  26412. }
  26413. /**
  26414. * Creates an array of own and inherited enumerable property names and
  26415. * symbols of `object`.
  26416. *
  26417. * @private
  26418. * @param {Object} object The object to query.
  26419. * @returns {Array} Returns the array of property names and symbols.
  26420. */
  26421. function getAllKeysIn(object) {
  26422. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  26423. }
  26424. /**
  26425. * Gets metadata for `func`.
  26426. *
  26427. * @private
  26428. * @param {Function} func The function to query.
  26429. * @returns {*} Returns the metadata for `func`.
  26430. */
  26431. var getData = !metaMap ? noop : function(func) {
  26432. return metaMap.get(func);
  26433. };
  26434. /**
  26435. * Gets the name of `func`.
  26436. *
  26437. * @private
  26438. * @param {Function} func The function to query.
  26439. * @returns {string} Returns the function name.
  26440. */
  26441. function getFuncName(func) {
  26442. var result = (func.name + ''),
  26443. array = realNames[result],
  26444. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  26445. while (length--) {
  26446. var data = array[length],
  26447. otherFunc = data.func;
  26448. if (otherFunc == null || otherFunc == func) {
  26449. return data.name;
  26450. }
  26451. }
  26452. return result;
  26453. }
  26454. /**
  26455. * Gets the argument placeholder value for `func`.
  26456. *
  26457. * @private
  26458. * @param {Function} func The function to inspect.
  26459. * @returns {*} Returns the placeholder value.
  26460. */
  26461. function getHolder(func) {
  26462. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  26463. return object.placeholder;
  26464. }
  26465. /**
  26466. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  26467. * this function returns the custom method, otherwise it returns `baseIteratee`.
  26468. * If arguments are provided, the chosen function is invoked with them and
  26469. * its result is returned.
  26470. *
  26471. * @private
  26472. * @param {*} [value] The value to convert to an iteratee.
  26473. * @param {number} [arity] The arity of the created iteratee.
  26474. * @returns {Function} Returns the chosen function or its result.
  26475. */
  26476. function getIteratee() {
  26477. var result = lodash.iteratee || iteratee;
  26478. result = result === iteratee ? baseIteratee : result;
  26479. return arguments.length ? result(arguments[0], arguments[1]) : result;
  26480. }
  26481. /**
  26482. * Gets the data for `map`.
  26483. *
  26484. * @private
  26485. * @param {Object} map The map to query.
  26486. * @param {string} key The reference key.
  26487. * @returns {*} Returns the map data.
  26488. */
  26489. function getMapData(map, key) {
  26490. var data = map.__data__;
  26491. return isKeyable(key)
  26492. ? data[typeof key == 'string' ? 'string' : 'hash']
  26493. : data.map;
  26494. }
  26495. /**
  26496. * Gets the property names, values, and compare flags of `object`.
  26497. *
  26498. * @private
  26499. * @param {Object} object The object to query.
  26500. * @returns {Array} Returns the match data of `object`.
  26501. */
  26502. function getMatchData(object) {
  26503. var result = keys(object),
  26504. length = result.length;
  26505. while (length--) {
  26506. var key = result[length],
  26507. value = object[key];
  26508. result[length] = [key, value, isStrictComparable(value)];
  26509. }
  26510. return result;
  26511. }
  26512. /**
  26513. * Gets the native function at `key` of `object`.
  26514. *
  26515. * @private
  26516. * @param {Object} object The object to query.
  26517. * @param {string} key The key of the method to get.
  26518. * @returns {*} Returns the function if it's native, else `undefined`.
  26519. */
  26520. function getNative(object, key) {
  26521. var value = getValue(object, key);
  26522. return baseIsNative(value) ? value : undefined;
  26523. }
  26524. /**
  26525. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  26526. *
  26527. * @private
  26528. * @param {*} value The value to query.
  26529. * @returns {string} Returns the raw `toStringTag`.
  26530. */
  26531. function getRawTag(value) {
  26532. var isOwn = hasOwnProperty.call(value, symToStringTag),
  26533. tag = value[symToStringTag];
  26534. try {
  26535. value[symToStringTag] = undefined;
  26536. var unmasked = true;
  26537. } catch (e) {}
  26538. var result = nativeObjectToString.call(value);
  26539. if (unmasked) {
  26540. if (isOwn) {
  26541. value[symToStringTag] = tag;
  26542. } else {
  26543. delete value[symToStringTag];
  26544. }
  26545. }
  26546. return result;
  26547. }
  26548. /**
  26549. * Creates an array of the own enumerable symbols of `object`.
  26550. *
  26551. * @private
  26552. * @param {Object} object The object to query.
  26553. * @returns {Array} Returns the array of symbols.
  26554. */
  26555. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  26556. if (object == null) {
  26557. return [];
  26558. }
  26559. object = Object(object);
  26560. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  26561. return propertyIsEnumerable.call(object, symbol);
  26562. });
  26563. };
  26564. /**
  26565. * Creates an array of the own and inherited enumerable symbols of `object`.
  26566. *
  26567. * @private
  26568. * @param {Object} object The object to query.
  26569. * @returns {Array} Returns the array of symbols.
  26570. */
  26571. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  26572. var result = [];
  26573. while (object) {
  26574. arrayPush(result, getSymbols(object));
  26575. object = getPrototype(object);
  26576. }
  26577. return result;
  26578. };
  26579. /**
  26580. * Gets the `toStringTag` of `value`.
  26581. *
  26582. * @private
  26583. * @param {*} value The value to query.
  26584. * @returns {string} Returns the `toStringTag`.
  26585. */
  26586. var getTag = baseGetTag;
  26587. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  26588. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  26589. (Map && getTag(new Map) != mapTag) ||
  26590. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  26591. (Set && getTag(new Set) != setTag) ||
  26592. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  26593. getTag = function(value) {
  26594. var result = baseGetTag(value),
  26595. Ctor = result == objectTag ? value.constructor : undefined,
  26596. ctorString = Ctor ? toSource(Ctor) : '';
  26597. if (ctorString) {
  26598. switch (ctorString) {
  26599. case dataViewCtorString: return dataViewTag;
  26600. case mapCtorString: return mapTag;
  26601. case promiseCtorString: return promiseTag;
  26602. case setCtorString: return setTag;
  26603. case weakMapCtorString: return weakMapTag;
  26604. }
  26605. }
  26606. return result;
  26607. };
  26608. }
  26609. /**
  26610. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  26611. *
  26612. * @private
  26613. * @param {number} start The start of the view.
  26614. * @param {number} end The end of the view.
  26615. * @param {Array} transforms The transformations to apply to the view.
  26616. * @returns {Object} Returns an object containing the `start` and `end`
  26617. * positions of the view.
  26618. */
  26619. function getView(start, end, transforms) {
  26620. var index = -1,
  26621. length = transforms.length;
  26622. while (++index < length) {
  26623. var data = transforms[index],
  26624. size = data.size;
  26625. switch (data.type) {
  26626. case 'drop': start += size; break;
  26627. case 'dropRight': end -= size; break;
  26628. case 'take': end = nativeMin(end, start + size); break;
  26629. case 'takeRight': start = nativeMax(start, end - size); break;
  26630. }
  26631. }
  26632. return { 'start': start, 'end': end };
  26633. }
  26634. /**
  26635. * Extracts wrapper details from the `source` body comment.
  26636. *
  26637. * @private
  26638. * @param {string} source The source to inspect.
  26639. * @returns {Array} Returns the wrapper details.
  26640. */
  26641. function getWrapDetails(source) {
  26642. var match = source.match(reWrapDetails);
  26643. return match ? match[1].split(reSplitDetails) : [];
  26644. }
  26645. /**
  26646. * Checks if `path` exists on `object`.
  26647. *
  26648. * @private
  26649. * @param {Object} object The object to query.
  26650. * @param {Array|string} path The path to check.
  26651. * @param {Function} hasFunc The function to check properties.
  26652. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  26653. */
  26654. function hasPath(object, path, hasFunc) {
  26655. path = castPath(path, object);
  26656. var index = -1,
  26657. length = path.length,
  26658. result = false;
  26659. while (++index < length) {
  26660. var key = toKey(path[index]);
  26661. if (!(result = object != null && hasFunc(object, key))) {
  26662. break;
  26663. }
  26664. object = object[key];
  26665. }
  26666. if (result || ++index != length) {
  26667. return result;
  26668. }
  26669. length = object == null ? 0 : object.length;
  26670. return !!length && isLength(length) && isIndex(key, length) &&
  26671. (isArray(object) || isArguments(object));
  26672. }
  26673. /**
  26674. * Initializes an array clone.
  26675. *
  26676. * @private
  26677. * @param {Array} array The array to clone.
  26678. * @returns {Array} Returns the initialized clone.
  26679. */
  26680. function initCloneArray(array) {
  26681. var length = array.length,
  26682. result = new array.constructor(length);
  26683. // Add properties assigned by `RegExp#exec`.
  26684. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  26685. result.index = array.index;
  26686. result.input = array.input;
  26687. }
  26688. return result;
  26689. }
  26690. /**
  26691. * Initializes an object clone.
  26692. *
  26693. * @private
  26694. * @param {Object} object The object to clone.
  26695. * @returns {Object} Returns the initialized clone.
  26696. */
  26697. function initCloneObject(object) {
  26698. return (typeof object.constructor == 'function' && !isPrototype(object))
  26699. ? baseCreate(getPrototype(object))
  26700. : {};
  26701. }
  26702. /**
  26703. * Initializes an object clone based on its `toStringTag`.
  26704. *
  26705. * **Note:** This function only supports cloning values with tags of
  26706. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  26707. *
  26708. * @private
  26709. * @param {Object} object The object to clone.
  26710. * @param {string} tag The `toStringTag` of the object to clone.
  26711. * @param {boolean} [isDeep] Specify a deep clone.
  26712. * @returns {Object} Returns the initialized clone.
  26713. */
  26714. function initCloneByTag(object, tag, isDeep) {
  26715. var Ctor = object.constructor;
  26716. switch (tag) {
  26717. case arrayBufferTag:
  26718. return cloneArrayBuffer(object);
  26719. case boolTag:
  26720. case dateTag:
  26721. return new Ctor(+object);
  26722. case dataViewTag:
  26723. return cloneDataView(object, isDeep);
  26724. case float32Tag: case float64Tag:
  26725. case int8Tag: case int16Tag: case int32Tag:
  26726. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  26727. return cloneTypedArray(object, isDeep);
  26728. case mapTag:
  26729. return new Ctor;
  26730. case numberTag:
  26731. case stringTag:
  26732. return new Ctor(object);
  26733. case regexpTag:
  26734. return cloneRegExp(object);
  26735. case setTag:
  26736. return new Ctor;
  26737. case symbolTag:
  26738. return cloneSymbol(object);
  26739. }
  26740. }
  26741. /**
  26742. * Inserts wrapper `details` in a comment at the top of the `source` body.
  26743. *
  26744. * @private
  26745. * @param {string} source The source to modify.
  26746. * @returns {Array} details The details to insert.
  26747. * @returns {string} Returns the modified source.
  26748. */
  26749. function insertWrapDetails(source, details) {
  26750. var length = details.length;
  26751. if (!length) {
  26752. return source;
  26753. }
  26754. var lastIndex = length - 1;
  26755. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  26756. details = details.join(length > 2 ? ', ' : ' ');
  26757. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  26758. }
  26759. /**
  26760. * Checks if `value` is a flattenable `arguments` object or array.
  26761. *
  26762. * @private
  26763. * @param {*} value The value to check.
  26764. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  26765. */
  26766. function isFlattenable(value) {
  26767. return isArray(value) || isArguments(value) ||
  26768. !!(spreadableSymbol && value && value[spreadableSymbol]);
  26769. }
  26770. /**
  26771. * Checks if `value` is a valid array-like index.
  26772. *
  26773. * @private
  26774. * @param {*} value The value to check.
  26775. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  26776. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  26777. */
  26778. function isIndex(value, length) {
  26779. var type = typeof value;
  26780. length = length == null ? MAX_SAFE_INTEGER : length;
  26781. return !!length &&
  26782. (type == 'number' ||
  26783. (type != 'symbol' && reIsUint.test(value))) &&
  26784. (value > -1 && value % 1 == 0 && value < length);
  26785. }
  26786. /**
  26787. * Checks if the given arguments are from an iteratee call.
  26788. *
  26789. * @private
  26790. * @param {*} value The potential iteratee value argument.
  26791. * @param {*} index The potential iteratee index or key argument.
  26792. * @param {*} object The potential iteratee object argument.
  26793. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  26794. * else `false`.
  26795. */
  26796. function isIterateeCall(value, index, object) {
  26797. if (!isObject(object)) {
  26798. return false;
  26799. }
  26800. var type = typeof index;
  26801. if (type == 'number'
  26802. ? (isArrayLike(object) && isIndex(index, object.length))
  26803. : (type == 'string' && index in object)
  26804. ) {
  26805. return eq(object[index], value);
  26806. }
  26807. return false;
  26808. }
  26809. /**
  26810. * Checks if `value` is a property name and not a property path.
  26811. *
  26812. * @private
  26813. * @param {*} value The value to check.
  26814. * @param {Object} [object] The object to query keys on.
  26815. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  26816. */
  26817. function isKey(value, object) {
  26818. if (isArray(value)) {
  26819. return false;
  26820. }
  26821. var type = typeof value;
  26822. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  26823. value == null || isSymbol(value)) {
  26824. return true;
  26825. }
  26826. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  26827. (object != null && value in Object(object));
  26828. }
  26829. /**
  26830. * Checks if `value` is suitable for use as unique object key.
  26831. *
  26832. * @private
  26833. * @param {*} value The value to check.
  26834. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  26835. */
  26836. function isKeyable(value) {
  26837. var type = typeof value;
  26838. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  26839. ? (value !== '__proto__')
  26840. : (value === null);
  26841. }
  26842. /**
  26843. * Checks if `func` has a lazy counterpart.
  26844. *
  26845. * @private
  26846. * @param {Function} func The function to check.
  26847. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  26848. * else `false`.
  26849. */
  26850. function isLaziable(func) {
  26851. var funcName = getFuncName(func),
  26852. other = lodash[funcName];
  26853. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  26854. return false;
  26855. }
  26856. if (func === other) {
  26857. return true;
  26858. }
  26859. var data = getData(other);
  26860. return !!data && func === data[0];
  26861. }
  26862. /**
  26863. * Checks if `func` has its source masked.
  26864. *
  26865. * @private
  26866. * @param {Function} func The function to check.
  26867. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  26868. */
  26869. function isMasked(func) {
  26870. return !!maskSrcKey && (maskSrcKey in func);
  26871. }
  26872. /**
  26873. * Checks if `func` is capable of being masked.
  26874. *
  26875. * @private
  26876. * @param {*} value The value to check.
  26877. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  26878. */
  26879. var isMaskable = coreJsData ? isFunction : stubFalse;
  26880. /**
  26881. * Checks if `value` is likely a prototype object.
  26882. *
  26883. * @private
  26884. * @param {*} value The value to check.
  26885. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  26886. */
  26887. function isPrototype(value) {
  26888. var Ctor = value && value.constructor,
  26889. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  26890. return value === proto;
  26891. }
  26892. /**
  26893. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  26894. *
  26895. * @private
  26896. * @param {*} value The value to check.
  26897. * @returns {boolean} Returns `true` if `value` if suitable for strict
  26898. * equality comparisons, else `false`.
  26899. */
  26900. function isStrictComparable(value) {
  26901. return value === value && !isObject(value);
  26902. }
  26903. /**
  26904. * A specialized version of `matchesProperty` for source values suitable
  26905. * for strict equality comparisons, i.e. `===`.
  26906. *
  26907. * @private
  26908. * @param {string} key The key of the property to get.
  26909. * @param {*} srcValue The value to match.
  26910. * @returns {Function} Returns the new spec function.
  26911. */
  26912. function matchesStrictComparable(key, srcValue) {
  26913. return function(object) {
  26914. if (object == null) {
  26915. return false;
  26916. }
  26917. return object[key] === srcValue &&
  26918. (srcValue !== undefined || (key in Object(object)));
  26919. };
  26920. }
  26921. /**
  26922. * A specialized version of `_.memoize` which clears the memoized function's
  26923. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  26924. *
  26925. * @private
  26926. * @param {Function} func The function to have its output memoized.
  26927. * @returns {Function} Returns the new memoized function.
  26928. */
  26929. function memoizeCapped(func) {
  26930. var result = memoize(func, function(key) {
  26931. if (cache.size === MAX_MEMOIZE_SIZE) {
  26932. cache.clear();
  26933. }
  26934. return key;
  26935. });
  26936. var cache = result.cache;
  26937. return result;
  26938. }
  26939. /**
  26940. * Merges the function metadata of `source` into `data`.
  26941. *
  26942. * Merging metadata reduces the number of wrappers used to invoke a function.
  26943. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  26944. * may be applied regardless of execution order. Methods like `_.ary` and
  26945. * `_.rearg` modify function arguments, making the order in which they are
  26946. * executed important, preventing the merging of metadata. However, we make
  26947. * an exception for a safe combined case where curried functions have `_.ary`
  26948. * and or `_.rearg` applied.
  26949. *
  26950. * @private
  26951. * @param {Array} data The destination metadata.
  26952. * @param {Array} source The source metadata.
  26953. * @returns {Array} Returns `data`.
  26954. */
  26955. function mergeData(data, source) {
  26956. var bitmask = data[1],
  26957. srcBitmask = source[1],
  26958. newBitmask = bitmask | srcBitmask,
  26959. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  26960. var isCombo =
  26961. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  26962. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  26963. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  26964. // Exit early if metadata can't be merged.
  26965. if (!(isCommon || isCombo)) {
  26966. return data;
  26967. }
  26968. // Use source `thisArg` if available.
  26969. if (srcBitmask & WRAP_BIND_FLAG) {
  26970. data[2] = source[2];
  26971. // Set when currying a bound function.
  26972. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  26973. }
  26974. // Compose partial arguments.
  26975. var value = source[3];
  26976. if (value) {
  26977. var partials = data[3];
  26978. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  26979. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  26980. }
  26981. // Compose partial right arguments.
  26982. value = source[5];
  26983. if (value) {
  26984. partials = data[5];
  26985. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  26986. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  26987. }
  26988. // Use source `argPos` if available.
  26989. value = source[7];
  26990. if (value) {
  26991. data[7] = value;
  26992. }
  26993. // Use source `ary` if it's smaller.
  26994. if (srcBitmask & WRAP_ARY_FLAG) {
  26995. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  26996. }
  26997. // Use source `arity` if one is not provided.
  26998. if (data[9] == null) {
  26999. data[9] = source[9];
  27000. }
  27001. // Use source `func` and merge bitmasks.
  27002. data[0] = source[0];
  27003. data[1] = newBitmask;
  27004. return data;
  27005. }
  27006. /**
  27007. * This function is like
  27008. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  27009. * except that it includes inherited enumerable properties.
  27010. *
  27011. * @private
  27012. * @param {Object} object The object to query.
  27013. * @returns {Array} Returns the array of property names.
  27014. */
  27015. function nativeKeysIn(object) {
  27016. var result = [];
  27017. if (object != null) {
  27018. for (var key in Object(object)) {
  27019. result.push(key);
  27020. }
  27021. }
  27022. return result;
  27023. }
  27024. /**
  27025. * Converts `value` to a string using `Object.prototype.toString`.
  27026. *
  27027. * @private
  27028. * @param {*} value The value to convert.
  27029. * @returns {string} Returns the converted string.
  27030. */
  27031. function objectToString(value) {
  27032. return nativeObjectToString.call(value);
  27033. }
  27034. /**
  27035. * A specialized version of `baseRest` which transforms the rest array.
  27036. *
  27037. * @private
  27038. * @param {Function} func The function to apply a rest parameter to.
  27039. * @param {number} [start=func.length-1] The start position of the rest parameter.
  27040. * @param {Function} transform The rest array transform.
  27041. * @returns {Function} Returns the new function.
  27042. */
  27043. function overRest(func, start, transform) {
  27044. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  27045. return function() {
  27046. var args = arguments,
  27047. index = -1,
  27048. length = nativeMax(args.length - start, 0),
  27049. array = Array(length);
  27050. while (++index < length) {
  27051. array[index] = args[start + index];
  27052. }
  27053. index = -1;
  27054. var otherArgs = Array(start + 1);
  27055. while (++index < start) {
  27056. otherArgs[index] = args[index];
  27057. }
  27058. otherArgs[start] = transform(array);
  27059. return apply(func, this, otherArgs);
  27060. };
  27061. }
  27062. /**
  27063. * Gets the parent value at `path` of `object`.
  27064. *
  27065. * @private
  27066. * @param {Object} object The object to query.
  27067. * @param {Array} path The path to get the parent value of.
  27068. * @returns {*} Returns the parent value.
  27069. */
  27070. function parent(object, path) {
  27071. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  27072. }
  27073. /**
  27074. * Reorder `array` according to the specified indexes where the element at
  27075. * the first index is assigned as the first element, the element at
  27076. * the second index is assigned as the second element, and so on.
  27077. *
  27078. * @private
  27079. * @param {Array} array The array to reorder.
  27080. * @param {Array} indexes The arranged array indexes.
  27081. * @returns {Array} Returns `array`.
  27082. */
  27083. function reorder(array, indexes) {
  27084. var arrLength = array.length,
  27085. length = nativeMin(indexes.length, arrLength),
  27086. oldArray = copyArray(array);
  27087. while (length--) {
  27088. var index = indexes[length];
  27089. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  27090. }
  27091. return array;
  27092. }
  27093. /**
  27094. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  27095. *
  27096. * @private
  27097. * @param {Object} object The object to query.
  27098. * @param {string} key The key of the property to get.
  27099. * @returns {*} Returns the property value.
  27100. */
  27101. function safeGet(object, key) {
  27102. if (key === 'constructor' && typeof object[key] === 'function') {
  27103. return;
  27104. }
  27105. if (key == '__proto__') {
  27106. return;
  27107. }
  27108. return object[key];
  27109. }
  27110. /**
  27111. * Sets metadata for `func`.
  27112. *
  27113. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  27114. * period of time, it will trip its breaker and transition to an identity
  27115. * function to avoid garbage collection pauses in V8. See
  27116. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  27117. * for more details.
  27118. *
  27119. * @private
  27120. * @param {Function} func The function to associate metadata with.
  27121. * @param {*} data The metadata.
  27122. * @returns {Function} Returns `func`.
  27123. */
  27124. var setData = shortOut(baseSetData);
  27125. /**
  27126. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  27127. *
  27128. * @private
  27129. * @param {Function} func The function to delay.
  27130. * @param {number} wait The number of milliseconds to delay invocation.
  27131. * @returns {number|Object} Returns the timer id or timeout object.
  27132. */
  27133. var setTimeout = ctxSetTimeout || function(func, wait) {
  27134. return root.setTimeout(func, wait);
  27135. };
  27136. /**
  27137. * Sets the `toString` method of `func` to return `string`.
  27138. *
  27139. * @private
  27140. * @param {Function} func The function to modify.
  27141. * @param {Function} string The `toString` result.
  27142. * @returns {Function} Returns `func`.
  27143. */
  27144. var setToString = shortOut(baseSetToString);
  27145. /**
  27146. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  27147. * with wrapper details in a comment at the top of the source body.
  27148. *
  27149. * @private
  27150. * @param {Function} wrapper The function to modify.
  27151. * @param {Function} reference The reference function.
  27152. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  27153. * @returns {Function} Returns `wrapper`.
  27154. */
  27155. function setWrapToString(wrapper, reference, bitmask) {
  27156. var source = (reference + '');
  27157. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  27158. }
  27159. /**
  27160. * Creates a function that'll short out and invoke `identity` instead
  27161. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  27162. * milliseconds.
  27163. *
  27164. * @private
  27165. * @param {Function} func The function to restrict.
  27166. * @returns {Function} Returns the new shortable function.
  27167. */
  27168. function shortOut(func) {
  27169. var count = 0,
  27170. lastCalled = 0;
  27171. return function() {
  27172. var stamp = nativeNow(),
  27173. remaining = HOT_SPAN - (stamp - lastCalled);
  27174. lastCalled = stamp;
  27175. if (remaining > 0) {
  27176. if (++count >= HOT_COUNT) {
  27177. return arguments[0];
  27178. }
  27179. } else {
  27180. count = 0;
  27181. }
  27182. return func.apply(undefined, arguments);
  27183. };
  27184. }
  27185. /**
  27186. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  27187. *
  27188. * @private
  27189. * @param {Array} array The array to shuffle.
  27190. * @param {number} [size=array.length] The size of `array`.
  27191. * @returns {Array} Returns `array`.
  27192. */
  27193. function shuffleSelf(array, size) {
  27194. var index = -1,
  27195. length = array.length,
  27196. lastIndex = length - 1;
  27197. size = size === undefined ? length : size;
  27198. while (++index < size) {
  27199. var rand = baseRandom(index, lastIndex),
  27200. value = array[rand];
  27201. array[rand] = array[index];
  27202. array[index] = value;
  27203. }
  27204. array.length = size;
  27205. return array;
  27206. }
  27207. /**
  27208. * Converts `string` to a property path array.
  27209. *
  27210. * @private
  27211. * @param {string} string The string to convert.
  27212. * @returns {Array} Returns the property path array.
  27213. */
  27214. var stringToPath = memoizeCapped(function(string) {
  27215. var result = [];
  27216. if (string.charCodeAt(0) === 46 /* . */) {
  27217. result.push('');
  27218. }
  27219. string.replace(rePropName, function(match, number, quote, subString) {
  27220. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  27221. });
  27222. return result;
  27223. });
  27224. /**
  27225. * Converts `value` to a string key if it's not a string or symbol.
  27226. *
  27227. * @private
  27228. * @param {*} value The value to inspect.
  27229. * @returns {string|symbol} Returns the key.
  27230. */
  27231. function toKey(value) {
  27232. if (typeof value == 'string' || isSymbol(value)) {
  27233. return value;
  27234. }
  27235. var result = (value + '');
  27236. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  27237. }
  27238. /**
  27239. * Converts `func` to its source code.
  27240. *
  27241. * @private
  27242. * @param {Function} func The function to convert.
  27243. * @returns {string} Returns the source code.
  27244. */
  27245. function toSource(func) {
  27246. if (func != null) {
  27247. try {
  27248. return funcToString.call(func);
  27249. } catch (e) {}
  27250. try {
  27251. return (func + '');
  27252. } catch (e) {}
  27253. }
  27254. return '';
  27255. }
  27256. /**
  27257. * Updates wrapper `details` based on `bitmask` flags.
  27258. *
  27259. * @private
  27260. * @returns {Array} details The details to modify.
  27261. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  27262. * @returns {Array} Returns `details`.
  27263. */
  27264. function updateWrapDetails(details, bitmask) {
  27265. arrayEach(wrapFlags, function(pair) {
  27266. var value = '_.' + pair[0];
  27267. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  27268. details.push(value);
  27269. }
  27270. });
  27271. return details.sort();
  27272. }
  27273. /**
  27274. * Creates a clone of `wrapper`.
  27275. *
  27276. * @private
  27277. * @param {Object} wrapper The wrapper to clone.
  27278. * @returns {Object} Returns the cloned wrapper.
  27279. */
  27280. function wrapperClone(wrapper) {
  27281. if (wrapper instanceof LazyWrapper) {
  27282. return wrapper.clone();
  27283. }
  27284. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  27285. result.__actions__ = copyArray(wrapper.__actions__);
  27286. result.__index__ = wrapper.__index__;
  27287. result.__values__ = wrapper.__values__;
  27288. return result;
  27289. }
  27290. /*------------------------------------------------------------------------*/
  27291. /**
  27292. * Creates an array of elements split into groups the length of `size`.
  27293. * If `array` can't be split evenly, the final chunk will be the remaining
  27294. * elements.
  27295. *
  27296. * @static
  27297. * @memberOf _
  27298. * @since 3.0.0
  27299. * @category Array
  27300. * @param {Array} array The array to process.
  27301. * @param {number} [size=1] The length of each chunk
  27302. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27303. * @returns {Array} Returns the new array of chunks.
  27304. * @example
  27305. *
  27306. * _.chunk(['a', 'b', 'c', 'd'], 2);
  27307. * // => [['a', 'b'], ['c', 'd']]
  27308. *
  27309. * _.chunk(['a', 'b', 'c', 'd'], 3);
  27310. * // => [['a', 'b', 'c'], ['d']]
  27311. */
  27312. function chunk(array, size, guard) {
  27313. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  27314. size = 1;
  27315. } else {
  27316. size = nativeMax(toInteger(size), 0);
  27317. }
  27318. var length = array == null ? 0 : array.length;
  27319. if (!length || size < 1) {
  27320. return [];
  27321. }
  27322. var index = 0,
  27323. resIndex = 0,
  27324. result = Array(nativeCeil(length / size));
  27325. while (index < length) {
  27326. result[resIndex++] = baseSlice(array, index, (index += size));
  27327. }
  27328. return result;
  27329. }
  27330. /**
  27331. * Creates an array with all falsey values removed. The values `false`, `null`,
  27332. * `0`, `""`, `undefined`, and `NaN` are falsey.
  27333. *
  27334. * @static
  27335. * @memberOf _
  27336. * @since 0.1.0
  27337. * @category Array
  27338. * @param {Array} array The array to compact.
  27339. * @returns {Array} Returns the new array of filtered values.
  27340. * @example
  27341. *
  27342. * _.compact([0, 1, false, 2, '', 3]);
  27343. * // => [1, 2, 3]
  27344. */
  27345. function compact(array) {
  27346. var index = -1,
  27347. length = array == null ? 0 : array.length,
  27348. resIndex = 0,
  27349. result = [];
  27350. while (++index < length) {
  27351. var value = array[index];
  27352. if (value) {
  27353. result[resIndex++] = value;
  27354. }
  27355. }
  27356. return result;
  27357. }
  27358. /**
  27359. * Creates a new array concatenating `array` with any additional arrays
  27360. * and/or values.
  27361. *
  27362. * @static
  27363. * @memberOf _
  27364. * @since 4.0.0
  27365. * @category Array
  27366. * @param {Array} array The array to concatenate.
  27367. * @param {...*} [values] The values to concatenate.
  27368. * @returns {Array} Returns the new concatenated array.
  27369. * @example
  27370. *
  27371. * var array = [1];
  27372. * var other = _.concat(array, 2, [3], [[4]]);
  27373. *
  27374. * console.log(other);
  27375. * // => [1, 2, 3, [4]]
  27376. *
  27377. * console.log(array);
  27378. * // => [1]
  27379. */
  27380. function concat() {
  27381. var length = arguments.length;
  27382. if (!length) {
  27383. return [];
  27384. }
  27385. var args = Array(length - 1),
  27386. array = arguments[0],
  27387. index = length;
  27388. while (index--) {
  27389. args[index - 1] = arguments[index];
  27390. }
  27391. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  27392. }
  27393. /**
  27394. * Creates an array of `array` values not included in the other given arrays
  27395. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27396. * for equality comparisons. The order and references of result values are
  27397. * determined by the first array.
  27398. *
  27399. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  27400. *
  27401. * @static
  27402. * @memberOf _
  27403. * @since 0.1.0
  27404. * @category Array
  27405. * @param {Array} array The array to inspect.
  27406. * @param {...Array} [values] The values to exclude.
  27407. * @returns {Array} Returns the new array of filtered values.
  27408. * @see _.without, _.xor
  27409. * @example
  27410. *
  27411. * _.difference([2, 1], [2, 3]);
  27412. * // => [1]
  27413. */
  27414. var difference = baseRest(function(array, values) {
  27415. return isArrayLikeObject(array)
  27416. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  27417. : [];
  27418. });
  27419. /**
  27420. * This method is like `_.difference` except that it accepts `iteratee` which
  27421. * is invoked for each element of `array` and `values` to generate the criterion
  27422. * by which they're compared. The order and references of result values are
  27423. * determined by the first array. The iteratee is invoked with one argument:
  27424. * (value).
  27425. *
  27426. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  27427. *
  27428. * @static
  27429. * @memberOf _
  27430. * @since 4.0.0
  27431. * @category Array
  27432. * @param {Array} array The array to inspect.
  27433. * @param {...Array} [values] The values to exclude.
  27434. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27435. * @returns {Array} Returns the new array of filtered values.
  27436. * @example
  27437. *
  27438. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  27439. * // => [1.2]
  27440. *
  27441. * // The `_.property` iteratee shorthand.
  27442. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  27443. * // => [{ 'x': 2 }]
  27444. */
  27445. var differenceBy = baseRest(function(array, values) {
  27446. var iteratee = last(values);
  27447. if (isArrayLikeObject(iteratee)) {
  27448. iteratee = undefined;
  27449. }
  27450. return isArrayLikeObject(array)
  27451. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  27452. : [];
  27453. });
  27454. /**
  27455. * This method is like `_.difference` except that it accepts `comparator`
  27456. * which is invoked to compare elements of `array` to `values`. The order and
  27457. * references of result values are determined by the first array. The comparator
  27458. * is invoked with two arguments: (arrVal, othVal).
  27459. *
  27460. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  27461. *
  27462. * @static
  27463. * @memberOf _
  27464. * @since 4.0.0
  27465. * @category Array
  27466. * @param {Array} array The array to inspect.
  27467. * @param {...Array} [values] The values to exclude.
  27468. * @param {Function} [comparator] The comparator invoked per element.
  27469. * @returns {Array} Returns the new array of filtered values.
  27470. * @example
  27471. *
  27472. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  27473. *
  27474. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  27475. * // => [{ 'x': 2, 'y': 1 }]
  27476. */
  27477. var differenceWith = baseRest(function(array, values) {
  27478. var comparator = last(values);
  27479. if (isArrayLikeObject(comparator)) {
  27480. comparator = undefined;
  27481. }
  27482. return isArrayLikeObject(array)
  27483. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  27484. : [];
  27485. });
  27486. /**
  27487. * Creates a slice of `array` with `n` elements dropped from the beginning.
  27488. *
  27489. * @static
  27490. * @memberOf _
  27491. * @since 0.5.0
  27492. * @category Array
  27493. * @param {Array} array The array to query.
  27494. * @param {number} [n=1] The number of elements to drop.
  27495. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27496. * @returns {Array} Returns the slice of `array`.
  27497. * @example
  27498. *
  27499. * _.drop([1, 2, 3]);
  27500. * // => [2, 3]
  27501. *
  27502. * _.drop([1, 2, 3], 2);
  27503. * // => [3]
  27504. *
  27505. * _.drop([1, 2, 3], 5);
  27506. * // => []
  27507. *
  27508. * _.drop([1, 2, 3], 0);
  27509. * // => [1, 2, 3]
  27510. */
  27511. function drop(array, n, guard) {
  27512. var length = array == null ? 0 : array.length;
  27513. if (!length) {
  27514. return [];
  27515. }
  27516. n = (guard || n === undefined) ? 1 : toInteger(n);
  27517. return baseSlice(array, n < 0 ? 0 : n, length);
  27518. }
  27519. /**
  27520. * Creates a slice of `array` with `n` elements dropped from the end.
  27521. *
  27522. * @static
  27523. * @memberOf _
  27524. * @since 3.0.0
  27525. * @category Array
  27526. * @param {Array} array The array to query.
  27527. * @param {number} [n=1] The number of elements to drop.
  27528. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27529. * @returns {Array} Returns the slice of `array`.
  27530. * @example
  27531. *
  27532. * _.dropRight([1, 2, 3]);
  27533. * // => [1, 2]
  27534. *
  27535. * _.dropRight([1, 2, 3], 2);
  27536. * // => [1]
  27537. *
  27538. * _.dropRight([1, 2, 3], 5);
  27539. * // => []
  27540. *
  27541. * _.dropRight([1, 2, 3], 0);
  27542. * // => [1, 2, 3]
  27543. */
  27544. function dropRight(array, n, guard) {
  27545. var length = array == null ? 0 : array.length;
  27546. if (!length) {
  27547. return [];
  27548. }
  27549. n = (guard || n === undefined) ? 1 : toInteger(n);
  27550. n = length - n;
  27551. return baseSlice(array, 0, n < 0 ? 0 : n);
  27552. }
  27553. /**
  27554. * Creates a slice of `array` excluding elements dropped from the end.
  27555. * Elements are dropped until `predicate` returns falsey. The predicate is
  27556. * invoked with three arguments: (value, index, array).
  27557. *
  27558. * @static
  27559. * @memberOf _
  27560. * @since 3.0.0
  27561. * @category Array
  27562. * @param {Array} array The array to query.
  27563. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27564. * @returns {Array} Returns the slice of `array`.
  27565. * @example
  27566. *
  27567. * var users = [
  27568. * { 'user': 'barney', 'active': true },
  27569. * { 'user': 'fred', 'active': false },
  27570. * { 'user': 'pebbles', 'active': false }
  27571. * ];
  27572. *
  27573. * _.dropRightWhile(users, function(o) { return !o.active; });
  27574. * // => objects for ['barney']
  27575. *
  27576. * // The `_.matches` iteratee shorthand.
  27577. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  27578. * // => objects for ['barney', 'fred']
  27579. *
  27580. * // The `_.matchesProperty` iteratee shorthand.
  27581. * _.dropRightWhile(users, ['active', false]);
  27582. * // => objects for ['barney']
  27583. *
  27584. * // The `_.property` iteratee shorthand.
  27585. * _.dropRightWhile(users, 'active');
  27586. * // => objects for ['barney', 'fred', 'pebbles']
  27587. */
  27588. function dropRightWhile(array, predicate) {
  27589. return (array && array.length)
  27590. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  27591. : [];
  27592. }
  27593. /**
  27594. * Creates a slice of `array` excluding elements dropped from the beginning.
  27595. * Elements are dropped until `predicate` returns falsey. The predicate is
  27596. * invoked with three arguments: (value, index, array).
  27597. *
  27598. * @static
  27599. * @memberOf _
  27600. * @since 3.0.0
  27601. * @category Array
  27602. * @param {Array} array The array to query.
  27603. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27604. * @returns {Array} Returns the slice of `array`.
  27605. * @example
  27606. *
  27607. * var users = [
  27608. * { 'user': 'barney', 'active': false },
  27609. * { 'user': 'fred', 'active': false },
  27610. * { 'user': 'pebbles', 'active': true }
  27611. * ];
  27612. *
  27613. * _.dropWhile(users, function(o) { return !o.active; });
  27614. * // => objects for ['pebbles']
  27615. *
  27616. * // The `_.matches` iteratee shorthand.
  27617. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  27618. * // => objects for ['fred', 'pebbles']
  27619. *
  27620. * // The `_.matchesProperty` iteratee shorthand.
  27621. * _.dropWhile(users, ['active', false]);
  27622. * // => objects for ['pebbles']
  27623. *
  27624. * // The `_.property` iteratee shorthand.
  27625. * _.dropWhile(users, 'active');
  27626. * // => objects for ['barney', 'fred', 'pebbles']
  27627. */
  27628. function dropWhile(array, predicate) {
  27629. return (array && array.length)
  27630. ? baseWhile(array, getIteratee(predicate, 3), true)
  27631. : [];
  27632. }
  27633. /**
  27634. * Fills elements of `array` with `value` from `start` up to, but not
  27635. * including, `end`.
  27636. *
  27637. * **Note:** This method mutates `array`.
  27638. *
  27639. * @static
  27640. * @memberOf _
  27641. * @since 3.2.0
  27642. * @category Array
  27643. * @param {Array} array The array to fill.
  27644. * @param {*} value The value to fill `array` with.
  27645. * @param {number} [start=0] The start position.
  27646. * @param {number} [end=array.length] The end position.
  27647. * @returns {Array} Returns `array`.
  27648. * @example
  27649. *
  27650. * var array = [1, 2, 3];
  27651. *
  27652. * _.fill(array, 'a');
  27653. * console.log(array);
  27654. * // => ['a', 'a', 'a']
  27655. *
  27656. * _.fill(Array(3), 2);
  27657. * // => [2, 2, 2]
  27658. *
  27659. * _.fill([4, 6, 8, 10], '*', 1, 3);
  27660. * // => [4, '*', '*', 10]
  27661. */
  27662. function fill(array, value, start, end) {
  27663. var length = array == null ? 0 : array.length;
  27664. if (!length) {
  27665. return [];
  27666. }
  27667. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  27668. start = 0;
  27669. end = length;
  27670. }
  27671. return baseFill(array, value, start, end);
  27672. }
  27673. /**
  27674. * This method is like `_.find` except that it returns the index of the first
  27675. * element `predicate` returns truthy for instead of the element itself.
  27676. *
  27677. * @static
  27678. * @memberOf _
  27679. * @since 1.1.0
  27680. * @category Array
  27681. * @param {Array} array The array to inspect.
  27682. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27683. * @param {number} [fromIndex=0] The index to search from.
  27684. * @returns {number} Returns the index of the found element, else `-1`.
  27685. * @example
  27686. *
  27687. * var users = [
  27688. * { 'user': 'barney', 'active': false },
  27689. * { 'user': 'fred', 'active': false },
  27690. * { 'user': 'pebbles', 'active': true }
  27691. * ];
  27692. *
  27693. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  27694. * // => 0
  27695. *
  27696. * // The `_.matches` iteratee shorthand.
  27697. * _.findIndex(users, { 'user': 'fred', 'active': false });
  27698. * // => 1
  27699. *
  27700. * // The `_.matchesProperty` iteratee shorthand.
  27701. * _.findIndex(users, ['active', false]);
  27702. * // => 0
  27703. *
  27704. * // The `_.property` iteratee shorthand.
  27705. * _.findIndex(users, 'active');
  27706. * // => 2
  27707. */
  27708. function findIndex(array, predicate, fromIndex) {
  27709. var length = array == null ? 0 : array.length;
  27710. if (!length) {
  27711. return -1;
  27712. }
  27713. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  27714. if (index < 0) {
  27715. index = nativeMax(length + index, 0);
  27716. }
  27717. return baseFindIndex(array, getIteratee(predicate, 3), index);
  27718. }
  27719. /**
  27720. * This method is like `_.findIndex` except that it iterates over elements
  27721. * of `collection` from right to left.
  27722. *
  27723. * @static
  27724. * @memberOf _
  27725. * @since 2.0.0
  27726. * @category Array
  27727. * @param {Array} array The array to inspect.
  27728. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27729. * @param {number} [fromIndex=array.length-1] The index to search from.
  27730. * @returns {number} Returns the index of the found element, else `-1`.
  27731. * @example
  27732. *
  27733. * var users = [
  27734. * { 'user': 'barney', 'active': true },
  27735. * { 'user': 'fred', 'active': false },
  27736. * { 'user': 'pebbles', 'active': false }
  27737. * ];
  27738. *
  27739. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  27740. * // => 2
  27741. *
  27742. * // The `_.matches` iteratee shorthand.
  27743. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  27744. * // => 0
  27745. *
  27746. * // The `_.matchesProperty` iteratee shorthand.
  27747. * _.findLastIndex(users, ['active', false]);
  27748. * // => 2
  27749. *
  27750. * // The `_.property` iteratee shorthand.
  27751. * _.findLastIndex(users, 'active');
  27752. * // => 0
  27753. */
  27754. function findLastIndex(array, predicate, fromIndex) {
  27755. var length = array == null ? 0 : array.length;
  27756. if (!length) {
  27757. return -1;
  27758. }
  27759. var index = length - 1;
  27760. if (fromIndex !== undefined) {
  27761. index = toInteger(fromIndex);
  27762. index = fromIndex < 0
  27763. ? nativeMax(length + index, 0)
  27764. : nativeMin(index, length - 1);
  27765. }
  27766. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  27767. }
  27768. /**
  27769. * Flattens `array` a single level deep.
  27770. *
  27771. * @static
  27772. * @memberOf _
  27773. * @since 0.1.0
  27774. * @category Array
  27775. * @param {Array} array The array to flatten.
  27776. * @returns {Array} Returns the new flattened array.
  27777. * @example
  27778. *
  27779. * _.flatten([1, [2, [3, [4]], 5]]);
  27780. * // => [1, 2, [3, [4]], 5]
  27781. */
  27782. function flatten(array) {
  27783. var length = array == null ? 0 : array.length;
  27784. return length ? baseFlatten(array, 1) : [];
  27785. }
  27786. /**
  27787. * Recursively flattens `array`.
  27788. *
  27789. * @static
  27790. * @memberOf _
  27791. * @since 3.0.0
  27792. * @category Array
  27793. * @param {Array} array The array to flatten.
  27794. * @returns {Array} Returns the new flattened array.
  27795. * @example
  27796. *
  27797. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  27798. * // => [1, 2, 3, 4, 5]
  27799. */
  27800. function flattenDeep(array) {
  27801. var length = array == null ? 0 : array.length;
  27802. return length ? baseFlatten(array, INFINITY) : [];
  27803. }
  27804. /**
  27805. * Recursively flatten `array` up to `depth` times.
  27806. *
  27807. * @static
  27808. * @memberOf _
  27809. * @since 4.4.0
  27810. * @category Array
  27811. * @param {Array} array The array to flatten.
  27812. * @param {number} [depth=1] The maximum recursion depth.
  27813. * @returns {Array} Returns the new flattened array.
  27814. * @example
  27815. *
  27816. * var array = [1, [2, [3, [4]], 5]];
  27817. *
  27818. * _.flattenDepth(array, 1);
  27819. * // => [1, 2, [3, [4]], 5]
  27820. *
  27821. * _.flattenDepth(array, 2);
  27822. * // => [1, 2, 3, [4], 5]
  27823. */
  27824. function flattenDepth(array, depth) {
  27825. var length = array == null ? 0 : array.length;
  27826. if (!length) {
  27827. return [];
  27828. }
  27829. depth = depth === undefined ? 1 : toInteger(depth);
  27830. return baseFlatten(array, depth);
  27831. }
  27832. /**
  27833. * The inverse of `_.toPairs`; this method returns an object composed
  27834. * from key-value `pairs`.
  27835. *
  27836. * @static
  27837. * @memberOf _
  27838. * @since 4.0.0
  27839. * @category Array
  27840. * @param {Array} pairs The key-value pairs.
  27841. * @returns {Object} Returns the new object.
  27842. * @example
  27843. *
  27844. * _.fromPairs([['a', 1], ['b', 2]]);
  27845. * // => { 'a': 1, 'b': 2 }
  27846. */
  27847. function fromPairs(pairs) {
  27848. var index = -1,
  27849. length = pairs == null ? 0 : pairs.length,
  27850. result = {};
  27851. while (++index < length) {
  27852. var pair = pairs[index];
  27853. result[pair[0]] = pair[1];
  27854. }
  27855. return result;
  27856. }
  27857. /**
  27858. * Gets the first element of `array`.
  27859. *
  27860. * @static
  27861. * @memberOf _
  27862. * @since 0.1.0
  27863. * @alias first
  27864. * @category Array
  27865. * @param {Array} array The array to query.
  27866. * @returns {*} Returns the first element of `array`.
  27867. * @example
  27868. *
  27869. * _.head([1, 2, 3]);
  27870. * // => 1
  27871. *
  27872. * _.head([]);
  27873. * // => undefined
  27874. */
  27875. function head(array) {
  27876. return (array && array.length) ? array[0] : undefined;
  27877. }
  27878. /**
  27879. * Gets the index at which the first occurrence of `value` is found in `array`
  27880. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27881. * for equality comparisons. If `fromIndex` is negative, it's used as the
  27882. * offset from the end of `array`.
  27883. *
  27884. * @static
  27885. * @memberOf _
  27886. * @since 0.1.0
  27887. * @category Array
  27888. * @param {Array} array The array to inspect.
  27889. * @param {*} value The value to search for.
  27890. * @param {number} [fromIndex=0] The index to search from.
  27891. * @returns {number} Returns the index of the matched value, else `-1`.
  27892. * @example
  27893. *
  27894. * _.indexOf([1, 2, 1, 2], 2);
  27895. * // => 1
  27896. *
  27897. * // Search from the `fromIndex`.
  27898. * _.indexOf([1, 2, 1, 2], 2, 2);
  27899. * // => 3
  27900. */
  27901. function indexOf(array, value, fromIndex) {
  27902. var length = array == null ? 0 : array.length;
  27903. if (!length) {
  27904. return -1;
  27905. }
  27906. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  27907. if (index < 0) {
  27908. index = nativeMax(length + index, 0);
  27909. }
  27910. return baseIndexOf(array, value, index);
  27911. }
  27912. /**
  27913. * Gets all but the last element of `array`.
  27914. *
  27915. * @static
  27916. * @memberOf _
  27917. * @since 0.1.0
  27918. * @category Array
  27919. * @param {Array} array The array to query.
  27920. * @returns {Array} Returns the slice of `array`.
  27921. * @example
  27922. *
  27923. * _.initial([1, 2, 3]);
  27924. * // => [1, 2]
  27925. */
  27926. function initial(array) {
  27927. var length = array == null ? 0 : array.length;
  27928. return length ? baseSlice(array, 0, -1) : [];
  27929. }
  27930. /**
  27931. * Creates an array of unique values that are included in all given arrays
  27932. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27933. * for equality comparisons. The order and references of result values are
  27934. * determined by the first array.
  27935. *
  27936. * @static
  27937. * @memberOf _
  27938. * @since 0.1.0
  27939. * @category Array
  27940. * @param {...Array} [arrays] The arrays to inspect.
  27941. * @returns {Array} Returns the new array of intersecting values.
  27942. * @example
  27943. *
  27944. * _.intersection([2, 1], [2, 3]);
  27945. * // => [2]
  27946. */
  27947. var intersection = baseRest(function(arrays) {
  27948. var mapped = arrayMap(arrays, castArrayLikeObject);
  27949. return (mapped.length && mapped[0] === arrays[0])
  27950. ? baseIntersection(mapped)
  27951. : [];
  27952. });
  27953. /**
  27954. * This method is like `_.intersection` except that it accepts `iteratee`
  27955. * which is invoked for each element of each `arrays` to generate the criterion
  27956. * by which they're compared. The order and references of result values are
  27957. * determined by the first array. The iteratee is invoked with one argument:
  27958. * (value).
  27959. *
  27960. * @static
  27961. * @memberOf _
  27962. * @since 4.0.0
  27963. * @category Array
  27964. * @param {...Array} [arrays] The arrays to inspect.
  27965. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27966. * @returns {Array} Returns the new array of intersecting values.
  27967. * @example
  27968. *
  27969. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  27970. * // => [2.1]
  27971. *
  27972. * // The `_.property` iteratee shorthand.
  27973. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  27974. * // => [{ 'x': 1 }]
  27975. */
  27976. var intersectionBy = baseRest(function(arrays) {
  27977. var iteratee = last(arrays),
  27978. mapped = arrayMap(arrays, castArrayLikeObject);
  27979. if (iteratee === last(mapped)) {
  27980. iteratee = undefined;
  27981. } else {
  27982. mapped.pop();
  27983. }
  27984. return (mapped.length && mapped[0] === arrays[0])
  27985. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  27986. : [];
  27987. });
  27988. /**
  27989. * This method is like `_.intersection` except that it accepts `comparator`
  27990. * which is invoked to compare elements of `arrays`. The order and references
  27991. * of result values are determined by the first array. The comparator is
  27992. * invoked with two arguments: (arrVal, othVal).
  27993. *
  27994. * @static
  27995. * @memberOf _
  27996. * @since 4.0.0
  27997. * @category Array
  27998. * @param {...Array} [arrays] The arrays to inspect.
  27999. * @param {Function} [comparator] The comparator invoked per element.
  28000. * @returns {Array} Returns the new array of intersecting values.
  28001. * @example
  28002. *
  28003. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  28004. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  28005. *
  28006. * _.intersectionWith(objects, others, _.isEqual);
  28007. * // => [{ 'x': 1, 'y': 2 }]
  28008. */
  28009. var intersectionWith = baseRest(function(arrays) {
  28010. var comparator = last(arrays),
  28011. mapped = arrayMap(arrays, castArrayLikeObject);
  28012. comparator = typeof comparator == 'function' ? comparator : undefined;
  28013. if (comparator) {
  28014. mapped.pop();
  28015. }
  28016. return (mapped.length && mapped[0] === arrays[0])
  28017. ? baseIntersection(mapped, undefined, comparator)
  28018. : [];
  28019. });
  28020. /**
  28021. * Converts all elements in `array` into a string separated by `separator`.
  28022. *
  28023. * @static
  28024. * @memberOf _
  28025. * @since 4.0.0
  28026. * @category Array
  28027. * @param {Array} array The array to convert.
  28028. * @param {string} [separator=','] The element separator.
  28029. * @returns {string} Returns the joined string.
  28030. * @example
  28031. *
  28032. * _.join(['a', 'b', 'c'], '~');
  28033. * // => 'a~b~c'
  28034. */
  28035. function join(array, separator) {
  28036. return array == null ? '' : nativeJoin.call(array, separator);
  28037. }
  28038. /**
  28039. * Gets the last element of `array`.
  28040. *
  28041. * @static
  28042. * @memberOf _
  28043. * @since 0.1.0
  28044. * @category Array
  28045. * @param {Array} array The array to query.
  28046. * @returns {*} Returns the last element of `array`.
  28047. * @example
  28048. *
  28049. * _.last([1, 2, 3]);
  28050. * // => 3
  28051. */
  28052. function last(array) {
  28053. var length = array == null ? 0 : array.length;
  28054. return length ? array[length - 1] : undefined;
  28055. }
  28056. /**
  28057. * This method is like `_.indexOf` except that it iterates over elements of
  28058. * `array` from right to left.
  28059. *
  28060. * @static
  28061. * @memberOf _
  28062. * @since 0.1.0
  28063. * @category Array
  28064. * @param {Array} array The array to inspect.
  28065. * @param {*} value The value to search for.
  28066. * @param {number} [fromIndex=array.length-1] The index to search from.
  28067. * @returns {number} Returns the index of the matched value, else `-1`.
  28068. * @example
  28069. *
  28070. * _.lastIndexOf([1, 2, 1, 2], 2);
  28071. * // => 3
  28072. *
  28073. * // Search from the `fromIndex`.
  28074. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  28075. * // => 1
  28076. */
  28077. function lastIndexOf(array, value, fromIndex) {
  28078. var length = array == null ? 0 : array.length;
  28079. if (!length) {
  28080. return -1;
  28081. }
  28082. var index = length;
  28083. if (fromIndex !== undefined) {
  28084. index = toInteger(fromIndex);
  28085. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  28086. }
  28087. return value === value
  28088. ? strictLastIndexOf(array, value, index)
  28089. : baseFindIndex(array, baseIsNaN, index, true);
  28090. }
  28091. /**
  28092. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  28093. * element from the end is returned.
  28094. *
  28095. * @static
  28096. * @memberOf _
  28097. * @since 4.11.0
  28098. * @category Array
  28099. * @param {Array} array The array to query.
  28100. * @param {number} [n=0] The index of the element to return.
  28101. * @returns {*} Returns the nth element of `array`.
  28102. * @example
  28103. *
  28104. * var array = ['a', 'b', 'c', 'd'];
  28105. *
  28106. * _.nth(array, 1);
  28107. * // => 'b'
  28108. *
  28109. * _.nth(array, -2);
  28110. * // => 'c';
  28111. */
  28112. function nth(array, n) {
  28113. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  28114. }
  28115. /**
  28116. * Removes all given values from `array` using
  28117. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28118. * for equality comparisons.
  28119. *
  28120. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  28121. * to remove elements from an array by predicate.
  28122. *
  28123. * @static
  28124. * @memberOf _
  28125. * @since 2.0.0
  28126. * @category Array
  28127. * @param {Array} array The array to modify.
  28128. * @param {...*} [values] The values to remove.
  28129. * @returns {Array} Returns `array`.
  28130. * @example
  28131. *
  28132. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  28133. *
  28134. * _.pull(array, 'a', 'c');
  28135. * console.log(array);
  28136. * // => ['b', 'b']
  28137. */
  28138. var pull = baseRest(pullAll);
  28139. /**
  28140. * This method is like `_.pull` except that it accepts an array of values to remove.
  28141. *
  28142. * **Note:** Unlike `_.difference`, this method mutates `array`.
  28143. *
  28144. * @static
  28145. * @memberOf _
  28146. * @since 4.0.0
  28147. * @category Array
  28148. * @param {Array} array The array to modify.
  28149. * @param {Array} values The values to remove.
  28150. * @returns {Array} Returns `array`.
  28151. * @example
  28152. *
  28153. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  28154. *
  28155. * _.pullAll(array, ['a', 'c']);
  28156. * console.log(array);
  28157. * // => ['b', 'b']
  28158. */
  28159. function pullAll(array, values) {
  28160. return (array && array.length && values && values.length)
  28161. ? basePullAll(array, values)
  28162. : array;
  28163. }
  28164. /**
  28165. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  28166. * invoked for each element of `array` and `values` to generate the criterion
  28167. * by which they're compared. The iteratee is invoked with one argument: (value).
  28168. *
  28169. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  28170. *
  28171. * @static
  28172. * @memberOf _
  28173. * @since 4.0.0
  28174. * @category Array
  28175. * @param {Array} array The array to modify.
  28176. * @param {Array} values The values to remove.
  28177. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  28178. * @returns {Array} Returns `array`.
  28179. * @example
  28180. *
  28181. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  28182. *
  28183. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  28184. * console.log(array);
  28185. * // => [{ 'x': 2 }]
  28186. */
  28187. function pullAllBy(array, values, iteratee) {
  28188. return (array && array.length && values && values.length)
  28189. ? basePullAll(array, values, getIteratee(iteratee, 2))
  28190. : array;
  28191. }
  28192. /**
  28193. * This method is like `_.pullAll` except that it accepts `comparator` which
  28194. * is invoked to compare elements of `array` to `values`. The comparator is
  28195. * invoked with two arguments: (arrVal, othVal).
  28196. *
  28197. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  28198. *
  28199. * @static
  28200. * @memberOf _
  28201. * @since 4.6.0
  28202. * @category Array
  28203. * @param {Array} array The array to modify.
  28204. * @param {Array} values The values to remove.
  28205. * @param {Function} [comparator] The comparator invoked per element.
  28206. * @returns {Array} Returns `array`.
  28207. * @example
  28208. *
  28209. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  28210. *
  28211. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  28212. * console.log(array);
  28213. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  28214. */
  28215. function pullAllWith(array, values, comparator) {
  28216. return (array && array.length && values && values.length)
  28217. ? basePullAll(array, values, undefined, comparator)
  28218. : array;
  28219. }
  28220. /**
  28221. * Removes elements from `array` corresponding to `indexes` and returns an
  28222. * array of removed elements.
  28223. *
  28224. * **Note:** Unlike `_.at`, this method mutates `array`.
  28225. *
  28226. * @static
  28227. * @memberOf _
  28228. * @since 3.0.0
  28229. * @category Array
  28230. * @param {Array} array The array to modify.
  28231. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  28232. * @returns {Array} Returns the new array of removed elements.
  28233. * @example
  28234. *
  28235. * var array = ['a', 'b', 'c', 'd'];
  28236. * var pulled = _.pullAt(array, [1, 3]);
  28237. *
  28238. * console.log(array);
  28239. * // => ['a', 'c']
  28240. *
  28241. * console.log(pulled);
  28242. * // => ['b', 'd']
  28243. */
  28244. var pullAt = flatRest(function(array, indexes) {
  28245. var length = array == null ? 0 : array.length,
  28246. result = baseAt(array, indexes);
  28247. basePullAt(array, arrayMap(indexes, function(index) {
  28248. return isIndex(index, length) ? +index : index;
  28249. }).sort(compareAscending));
  28250. return result;
  28251. });
  28252. /**
  28253. * Removes all elements from `array` that `predicate` returns truthy for
  28254. * and returns an array of the removed elements. The predicate is invoked
  28255. * with three arguments: (value, index, array).
  28256. *
  28257. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  28258. * to pull elements from an array by value.
  28259. *
  28260. * @static
  28261. * @memberOf _
  28262. * @since 2.0.0
  28263. * @category Array
  28264. * @param {Array} array The array to modify.
  28265. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28266. * @returns {Array} Returns the new array of removed elements.
  28267. * @example
  28268. *
  28269. * var array = [1, 2, 3, 4];
  28270. * var evens = _.remove(array, function(n) {
  28271. * return n % 2 == 0;
  28272. * });
  28273. *
  28274. * console.log(array);
  28275. * // => [1, 3]
  28276. *
  28277. * console.log(evens);
  28278. * // => [2, 4]
  28279. */
  28280. function remove(array, predicate) {
  28281. var result = [];
  28282. if (!(array && array.length)) {
  28283. return result;
  28284. }
  28285. var index = -1,
  28286. indexes = [],
  28287. length = array.length;
  28288. predicate = getIteratee(predicate, 3);
  28289. while (++index < length) {
  28290. var value = array[index];
  28291. if (predicate(value, index, array)) {
  28292. result.push(value);
  28293. indexes.push(index);
  28294. }
  28295. }
  28296. basePullAt(array, indexes);
  28297. return result;
  28298. }
  28299. /**
  28300. * Reverses `array` so that the first element becomes the last, the second
  28301. * element becomes the second to last, and so on.
  28302. *
  28303. * **Note:** This method mutates `array` and is based on
  28304. * [`Array#reverse`](https://mdn.io/Array/reverse).
  28305. *
  28306. * @static
  28307. * @memberOf _
  28308. * @since 4.0.0
  28309. * @category Array
  28310. * @param {Array} array The array to modify.
  28311. * @returns {Array} Returns `array`.
  28312. * @example
  28313. *
  28314. * var array = [1, 2, 3];
  28315. *
  28316. * _.reverse(array);
  28317. * // => [3, 2, 1]
  28318. *
  28319. * console.log(array);
  28320. * // => [3, 2, 1]
  28321. */
  28322. function reverse(array) {
  28323. return array == null ? array : nativeReverse.call(array);
  28324. }
  28325. /**
  28326. * Creates a slice of `array` from `start` up to, but not including, `end`.
  28327. *
  28328. * **Note:** This method is used instead of
  28329. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  28330. * returned.
  28331. *
  28332. * @static
  28333. * @memberOf _
  28334. * @since 3.0.0
  28335. * @category Array
  28336. * @param {Array} array The array to slice.
  28337. * @param {number} [start=0] The start position.
  28338. * @param {number} [end=array.length] The end position.
  28339. * @returns {Array} Returns the slice of `array`.
  28340. */
  28341. function slice(array, start, end) {
  28342. var length = array == null ? 0 : array.length;
  28343. if (!length) {
  28344. return [];
  28345. }
  28346. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  28347. start = 0;
  28348. end = length;
  28349. }
  28350. else {
  28351. start = start == null ? 0 : toInteger(start);
  28352. end = end === undefined ? length : toInteger(end);
  28353. }
  28354. return baseSlice(array, start, end);
  28355. }
  28356. /**
  28357. * Uses a binary search to determine the lowest index at which `value`
  28358. * should be inserted into `array` in order to maintain its sort order.
  28359. *
  28360. * @static
  28361. * @memberOf _
  28362. * @since 0.1.0
  28363. * @category Array
  28364. * @param {Array} array The sorted array to inspect.
  28365. * @param {*} value The value to evaluate.
  28366. * @returns {number} Returns the index at which `value` should be inserted
  28367. * into `array`.
  28368. * @example
  28369. *
  28370. * _.sortedIndex([30, 50], 40);
  28371. * // => 1
  28372. */
  28373. function sortedIndex(array, value) {
  28374. return baseSortedIndex(array, value);
  28375. }
  28376. /**
  28377. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  28378. * which is invoked for `value` and each element of `array` to compute their
  28379. * sort ranking. The iteratee is invoked with one argument: (value).
  28380. *
  28381. * @static
  28382. * @memberOf _
  28383. * @since 4.0.0
  28384. * @category Array
  28385. * @param {Array} array The sorted array to inspect.
  28386. * @param {*} value The value to evaluate.
  28387. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  28388. * @returns {number} Returns the index at which `value` should be inserted
  28389. * into `array`.
  28390. * @example
  28391. *
  28392. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  28393. *
  28394. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  28395. * // => 0
  28396. *
  28397. * // The `_.property` iteratee shorthand.
  28398. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  28399. * // => 0
  28400. */
  28401. function sortedIndexBy(array, value, iteratee) {
  28402. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  28403. }
  28404. /**
  28405. * This method is like `_.indexOf` except that it performs a binary
  28406. * search on a sorted `array`.
  28407. *
  28408. * @static
  28409. * @memberOf _
  28410. * @since 4.0.0
  28411. * @category Array
  28412. * @param {Array} array The array to inspect.
  28413. * @param {*} value The value to search for.
  28414. * @returns {number} Returns the index of the matched value, else `-1`.
  28415. * @example
  28416. *
  28417. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  28418. * // => 1
  28419. */
  28420. function sortedIndexOf(array, value) {
  28421. var length = array == null ? 0 : array.length;
  28422. if (length) {
  28423. var index = baseSortedIndex(array, value);
  28424. if (index < length && eq(array[index], value)) {
  28425. return index;
  28426. }
  28427. }
  28428. return -1;
  28429. }
  28430. /**
  28431. * This method is like `_.sortedIndex` except that it returns the highest
  28432. * index at which `value` should be inserted into `array` in order to
  28433. * maintain its sort order.
  28434. *
  28435. * @static
  28436. * @memberOf _
  28437. * @since 3.0.0
  28438. * @category Array
  28439. * @param {Array} array The sorted array to inspect.
  28440. * @param {*} value The value to evaluate.
  28441. * @returns {number} Returns the index at which `value` should be inserted
  28442. * into `array`.
  28443. * @example
  28444. *
  28445. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  28446. * // => 4
  28447. */
  28448. function sortedLastIndex(array, value) {
  28449. return baseSortedIndex(array, value, true);
  28450. }
  28451. /**
  28452. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  28453. * which is invoked for `value` and each element of `array` to compute their
  28454. * sort ranking. The iteratee is invoked with one argument: (value).
  28455. *
  28456. * @static
  28457. * @memberOf _
  28458. * @since 4.0.0
  28459. * @category Array
  28460. * @param {Array} array The sorted array to inspect.
  28461. * @param {*} value The value to evaluate.
  28462. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  28463. * @returns {number} Returns the index at which `value` should be inserted
  28464. * into `array`.
  28465. * @example
  28466. *
  28467. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  28468. *
  28469. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  28470. * // => 1
  28471. *
  28472. * // The `_.property` iteratee shorthand.
  28473. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  28474. * // => 1
  28475. */
  28476. function sortedLastIndexBy(array, value, iteratee) {
  28477. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  28478. }
  28479. /**
  28480. * This method is like `_.lastIndexOf` except that it performs a binary
  28481. * search on a sorted `array`.
  28482. *
  28483. * @static
  28484. * @memberOf _
  28485. * @since 4.0.0
  28486. * @category Array
  28487. * @param {Array} array The array to inspect.
  28488. * @param {*} value The value to search for.
  28489. * @returns {number} Returns the index of the matched value, else `-1`.
  28490. * @example
  28491. *
  28492. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  28493. * // => 3
  28494. */
  28495. function sortedLastIndexOf(array, value) {
  28496. var length = array == null ? 0 : array.length;
  28497. if (length) {
  28498. var index = baseSortedIndex(array, value, true) - 1;
  28499. if (eq(array[index], value)) {
  28500. return index;
  28501. }
  28502. }
  28503. return -1;
  28504. }
  28505. /**
  28506. * This method is like `_.uniq` except that it's designed and optimized
  28507. * for sorted arrays.
  28508. *
  28509. * @static
  28510. * @memberOf _
  28511. * @since 4.0.0
  28512. * @category Array
  28513. * @param {Array} array The array to inspect.
  28514. * @returns {Array} Returns the new duplicate free array.
  28515. * @example
  28516. *
  28517. * _.sortedUniq([1, 1, 2]);
  28518. * // => [1, 2]
  28519. */
  28520. function sortedUniq(array) {
  28521. return (array && array.length)
  28522. ? baseSortedUniq(array)
  28523. : [];
  28524. }
  28525. /**
  28526. * This method is like `_.uniqBy` except that it's designed and optimized
  28527. * for sorted arrays.
  28528. *
  28529. * @static
  28530. * @memberOf _
  28531. * @since 4.0.0
  28532. * @category Array
  28533. * @param {Array} array The array to inspect.
  28534. * @param {Function} [iteratee] The iteratee invoked per element.
  28535. * @returns {Array} Returns the new duplicate free array.
  28536. * @example
  28537. *
  28538. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  28539. * // => [1.1, 2.3]
  28540. */
  28541. function sortedUniqBy(array, iteratee) {
  28542. return (array && array.length)
  28543. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  28544. : [];
  28545. }
  28546. /**
  28547. * Gets all but the first element of `array`.
  28548. *
  28549. * @static
  28550. * @memberOf _
  28551. * @since 4.0.0
  28552. * @category Array
  28553. * @param {Array} array The array to query.
  28554. * @returns {Array} Returns the slice of `array`.
  28555. * @example
  28556. *
  28557. * _.tail([1, 2, 3]);
  28558. * // => [2, 3]
  28559. */
  28560. function tail(array) {
  28561. var length = array == null ? 0 : array.length;
  28562. return length ? baseSlice(array, 1, length) : [];
  28563. }
  28564. /**
  28565. * Creates a slice of `array` with `n` elements taken from the beginning.
  28566. *
  28567. * @static
  28568. * @memberOf _
  28569. * @since 0.1.0
  28570. * @category Array
  28571. * @param {Array} array The array to query.
  28572. * @param {number} [n=1] The number of elements to take.
  28573. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28574. * @returns {Array} Returns the slice of `array`.
  28575. * @example
  28576. *
  28577. * _.take([1, 2, 3]);
  28578. * // => [1]
  28579. *
  28580. * _.take([1, 2, 3], 2);
  28581. * // => [1, 2]
  28582. *
  28583. * _.take([1, 2, 3], 5);
  28584. * // => [1, 2, 3]
  28585. *
  28586. * _.take([1, 2, 3], 0);
  28587. * // => []
  28588. */
  28589. function take(array, n, guard) {
  28590. if (!(array && array.length)) {
  28591. return [];
  28592. }
  28593. n = (guard || n === undefined) ? 1 : toInteger(n);
  28594. return baseSlice(array, 0, n < 0 ? 0 : n);
  28595. }
  28596. /**
  28597. * Creates a slice of `array` with `n` elements taken from the end.
  28598. *
  28599. * @static
  28600. * @memberOf _
  28601. * @since 3.0.0
  28602. * @category Array
  28603. * @param {Array} array The array to query.
  28604. * @param {number} [n=1] The number of elements to take.
  28605. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28606. * @returns {Array} Returns the slice of `array`.
  28607. * @example
  28608. *
  28609. * _.takeRight([1, 2, 3]);
  28610. * // => [3]
  28611. *
  28612. * _.takeRight([1, 2, 3], 2);
  28613. * // => [2, 3]
  28614. *
  28615. * _.takeRight([1, 2, 3], 5);
  28616. * // => [1, 2, 3]
  28617. *
  28618. * _.takeRight([1, 2, 3], 0);
  28619. * // => []
  28620. */
  28621. function takeRight(array, n, guard) {
  28622. var length = array == null ? 0 : array.length;
  28623. if (!length) {
  28624. return [];
  28625. }
  28626. n = (guard || n === undefined) ? 1 : toInteger(n);
  28627. n = length - n;
  28628. return baseSlice(array, n < 0 ? 0 : n, length);
  28629. }
  28630. /**
  28631. * Creates a slice of `array` with elements taken from the end. Elements are
  28632. * taken until `predicate` returns falsey. The predicate is invoked with
  28633. * three arguments: (value, index, array).
  28634. *
  28635. * @static
  28636. * @memberOf _
  28637. * @since 3.0.0
  28638. * @category Array
  28639. * @param {Array} array The array to query.
  28640. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28641. * @returns {Array} Returns the slice of `array`.
  28642. * @example
  28643. *
  28644. * var users = [
  28645. * { 'user': 'barney', 'active': true },
  28646. * { 'user': 'fred', 'active': false },
  28647. * { 'user': 'pebbles', 'active': false }
  28648. * ];
  28649. *
  28650. * _.takeRightWhile(users, function(o) { return !o.active; });
  28651. * // => objects for ['fred', 'pebbles']
  28652. *
  28653. * // The `_.matches` iteratee shorthand.
  28654. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  28655. * // => objects for ['pebbles']
  28656. *
  28657. * // The `_.matchesProperty` iteratee shorthand.
  28658. * _.takeRightWhile(users, ['active', false]);
  28659. * // => objects for ['fred', 'pebbles']
  28660. *
  28661. * // The `_.property` iteratee shorthand.
  28662. * _.takeRightWhile(users, 'active');
  28663. * // => []
  28664. */
  28665. function takeRightWhile(array, predicate) {
  28666. return (array && array.length)
  28667. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  28668. : [];
  28669. }
  28670. /**
  28671. * Creates a slice of `array` with elements taken from the beginning. Elements
  28672. * are taken until `predicate` returns falsey. The predicate is invoked with
  28673. * three arguments: (value, index, array).
  28674. *
  28675. * @static
  28676. * @memberOf _
  28677. * @since 3.0.0
  28678. * @category Array
  28679. * @param {Array} array The array to query.
  28680. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28681. * @returns {Array} Returns the slice of `array`.
  28682. * @example
  28683. *
  28684. * var users = [
  28685. * { 'user': 'barney', 'active': false },
  28686. * { 'user': 'fred', 'active': false },
  28687. * { 'user': 'pebbles', 'active': true }
  28688. * ];
  28689. *
  28690. * _.takeWhile(users, function(o) { return !o.active; });
  28691. * // => objects for ['barney', 'fred']
  28692. *
  28693. * // The `_.matches` iteratee shorthand.
  28694. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  28695. * // => objects for ['barney']
  28696. *
  28697. * // The `_.matchesProperty` iteratee shorthand.
  28698. * _.takeWhile(users, ['active', false]);
  28699. * // => objects for ['barney', 'fred']
  28700. *
  28701. * // The `_.property` iteratee shorthand.
  28702. * _.takeWhile(users, 'active');
  28703. * // => []
  28704. */
  28705. function takeWhile(array, predicate) {
  28706. return (array && array.length)
  28707. ? baseWhile(array, getIteratee(predicate, 3))
  28708. : [];
  28709. }
  28710. /**
  28711. * Creates an array of unique values, in order, from all given arrays using
  28712. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28713. * for equality comparisons.
  28714. *
  28715. * @static
  28716. * @memberOf _
  28717. * @since 0.1.0
  28718. * @category Array
  28719. * @param {...Array} [arrays] The arrays to inspect.
  28720. * @returns {Array} Returns the new array of combined values.
  28721. * @example
  28722. *
  28723. * _.union([2], [1, 2]);
  28724. * // => [2, 1]
  28725. */
  28726. var union = baseRest(function(arrays) {
  28727. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  28728. });
  28729. /**
  28730. * This method is like `_.union` except that it accepts `iteratee` which is
  28731. * invoked for each element of each `arrays` to generate the criterion by
  28732. * which uniqueness is computed. Result values are chosen from the first
  28733. * array in which the value occurs. The iteratee is invoked with one argument:
  28734. * (value).
  28735. *
  28736. * @static
  28737. * @memberOf _
  28738. * @since 4.0.0
  28739. * @category Array
  28740. * @param {...Array} [arrays] The arrays to inspect.
  28741. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  28742. * @returns {Array} Returns the new array of combined values.
  28743. * @example
  28744. *
  28745. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  28746. * // => [2.1, 1.2]
  28747. *
  28748. * // The `_.property` iteratee shorthand.
  28749. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  28750. * // => [{ 'x': 1 }, { 'x': 2 }]
  28751. */
  28752. var unionBy = baseRest(function(arrays) {
  28753. var iteratee = last(arrays);
  28754. if (isArrayLikeObject(iteratee)) {
  28755. iteratee = undefined;
  28756. }
  28757. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  28758. });
  28759. /**
  28760. * This method is like `_.union` except that it accepts `comparator` which
  28761. * is invoked to compare elements of `arrays`. Result values are chosen from
  28762. * the first array in which the value occurs. The comparator is invoked
  28763. * with two arguments: (arrVal, othVal).
  28764. *
  28765. * @static
  28766. * @memberOf _
  28767. * @since 4.0.0
  28768. * @category Array
  28769. * @param {...Array} [arrays] The arrays to inspect.
  28770. * @param {Function} [comparator] The comparator invoked per element.
  28771. * @returns {Array} Returns the new array of combined values.
  28772. * @example
  28773. *
  28774. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  28775. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  28776. *
  28777. * _.unionWith(objects, others, _.isEqual);
  28778. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  28779. */
  28780. var unionWith = baseRest(function(arrays) {
  28781. var comparator = last(arrays);
  28782. comparator = typeof comparator == 'function' ? comparator : undefined;
  28783. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  28784. });
  28785. /**
  28786. * Creates a duplicate-free version of an array, using
  28787. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28788. * for equality comparisons, in which only the first occurrence of each element
  28789. * is kept. The order of result values is determined by the order they occur
  28790. * in the array.
  28791. *
  28792. * @static
  28793. * @memberOf _
  28794. * @since 0.1.0
  28795. * @category Array
  28796. * @param {Array} array The array to inspect.
  28797. * @returns {Array} Returns the new duplicate free array.
  28798. * @example
  28799. *
  28800. * _.uniq([2, 1, 2]);
  28801. * // => [2, 1]
  28802. */
  28803. function uniq(array) {
  28804. return (array && array.length) ? baseUniq(array) : [];
  28805. }
  28806. /**
  28807. * This method is like `_.uniq` except that it accepts `iteratee` which is
  28808. * invoked for each element in `array` to generate the criterion by which
  28809. * uniqueness is computed. The order of result values is determined by the
  28810. * order they occur in the array. The iteratee is invoked with one argument:
  28811. * (value).
  28812. *
  28813. * @static
  28814. * @memberOf _
  28815. * @since 4.0.0
  28816. * @category Array
  28817. * @param {Array} array The array to inspect.
  28818. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  28819. * @returns {Array} Returns the new duplicate free array.
  28820. * @example
  28821. *
  28822. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  28823. * // => [2.1, 1.2]
  28824. *
  28825. * // The `_.property` iteratee shorthand.
  28826. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  28827. * // => [{ 'x': 1 }, { 'x': 2 }]
  28828. */
  28829. function uniqBy(array, iteratee) {
  28830. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  28831. }
  28832. /**
  28833. * This method is like `_.uniq` except that it accepts `comparator` which
  28834. * is invoked to compare elements of `array`. The order of result values is
  28835. * determined by the order they occur in the array.The comparator is invoked
  28836. * with two arguments: (arrVal, othVal).
  28837. *
  28838. * @static
  28839. * @memberOf _
  28840. * @since 4.0.0
  28841. * @category Array
  28842. * @param {Array} array The array to inspect.
  28843. * @param {Function} [comparator] The comparator invoked per element.
  28844. * @returns {Array} Returns the new duplicate free array.
  28845. * @example
  28846. *
  28847. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  28848. *
  28849. * _.uniqWith(objects, _.isEqual);
  28850. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  28851. */
  28852. function uniqWith(array, comparator) {
  28853. comparator = typeof comparator == 'function' ? comparator : undefined;
  28854. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  28855. }
  28856. /**
  28857. * This method is like `_.zip` except that it accepts an array of grouped
  28858. * elements and creates an array regrouping the elements to their pre-zip
  28859. * configuration.
  28860. *
  28861. * @static
  28862. * @memberOf _
  28863. * @since 1.2.0
  28864. * @category Array
  28865. * @param {Array} array The array of grouped elements to process.
  28866. * @returns {Array} Returns the new array of regrouped elements.
  28867. * @example
  28868. *
  28869. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  28870. * // => [['a', 1, true], ['b', 2, false]]
  28871. *
  28872. * _.unzip(zipped);
  28873. * // => [['a', 'b'], [1, 2], [true, false]]
  28874. */
  28875. function unzip(array) {
  28876. if (!(array && array.length)) {
  28877. return [];
  28878. }
  28879. var length = 0;
  28880. array = arrayFilter(array, function(group) {
  28881. if (isArrayLikeObject(group)) {
  28882. length = nativeMax(group.length, length);
  28883. return true;
  28884. }
  28885. });
  28886. return baseTimes(length, function(index) {
  28887. return arrayMap(array, baseProperty(index));
  28888. });
  28889. }
  28890. /**
  28891. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  28892. * how regrouped values should be combined. The iteratee is invoked with the
  28893. * elements of each group: (...group).
  28894. *
  28895. * @static
  28896. * @memberOf _
  28897. * @since 3.8.0
  28898. * @category Array
  28899. * @param {Array} array The array of grouped elements to process.
  28900. * @param {Function} [iteratee=_.identity] The function to combine
  28901. * regrouped values.
  28902. * @returns {Array} Returns the new array of regrouped elements.
  28903. * @example
  28904. *
  28905. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  28906. * // => [[1, 10, 100], [2, 20, 200]]
  28907. *
  28908. * _.unzipWith(zipped, _.add);
  28909. * // => [3, 30, 300]
  28910. */
  28911. function unzipWith(array, iteratee) {
  28912. if (!(array && array.length)) {
  28913. return [];
  28914. }
  28915. var result = unzip(array);
  28916. if (iteratee == null) {
  28917. return result;
  28918. }
  28919. return arrayMap(result, function(group) {
  28920. return apply(iteratee, undefined, group);
  28921. });
  28922. }
  28923. /**
  28924. * Creates an array excluding all given values using
  28925. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28926. * for equality comparisons.
  28927. *
  28928. * **Note:** Unlike `_.pull`, this method returns a new array.
  28929. *
  28930. * @static
  28931. * @memberOf _
  28932. * @since 0.1.0
  28933. * @category Array
  28934. * @param {Array} array The array to inspect.
  28935. * @param {...*} [values] The values to exclude.
  28936. * @returns {Array} Returns the new array of filtered values.
  28937. * @see _.difference, _.xor
  28938. * @example
  28939. *
  28940. * _.without([2, 1, 2, 3], 1, 2);
  28941. * // => [3]
  28942. */
  28943. var without = baseRest(function(array, values) {
  28944. return isArrayLikeObject(array)
  28945. ? baseDifference(array, values)
  28946. : [];
  28947. });
  28948. /**
  28949. * Creates an array of unique values that is the
  28950. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  28951. * of the given arrays. The order of result values is determined by the order
  28952. * they occur in the arrays.
  28953. *
  28954. * @static
  28955. * @memberOf _
  28956. * @since 2.4.0
  28957. * @category Array
  28958. * @param {...Array} [arrays] The arrays to inspect.
  28959. * @returns {Array} Returns the new array of filtered values.
  28960. * @see _.difference, _.without
  28961. * @example
  28962. *
  28963. * _.xor([2, 1], [2, 3]);
  28964. * // => [1, 3]
  28965. */
  28966. var xor = baseRest(function(arrays) {
  28967. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  28968. });
  28969. /**
  28970. * This method is like `_.xor` except that it accepts `iteratee` which is
  28971. * invoked for each element of each `arrays` to generate the criterion by
  28972. * which by which they're compared. The order of result values is determined
  28973. * by the order they occur in the arrays. The iteratee is invoked with one
  28974. * argument: (value).
  28975. *
  28976. * @static
  28977. * @memberOf _
  28978. * @since 4.0.0
  28979. * @category Array
  28980. * @param {...Array} [arrays] The arrays to inspect.
  28981. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  28982. * @returns {Array} Returns the new array of filtered values.
  28983. * @example
  28984. *
  28985. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  28986. * // => [1.2, 3.4]
  28987. *
  28988. * // The `_.property` iteratee shorthand.
  28989. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  28990. * // => [{ 'x': 2 }]
  28991. */
  28992. var xorBy = baseRest(function(arrays) {
  28993. var iteratee = last(arrays);
  28994. if (isArrayLikeObject(iteratee)) {
  28995. iteratee = undefined;
  28996. }
  28997. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  28998. });
  28999. /**
  29000. * This method is like `_.xor` except that it accepts `comparator` which is
  29001. * invoked to compare elements of `arrays`. The order of result values is
  29002. * determined by the order they occur in the arrays. The comparator is invoked
  29003. * with two arguments: (arrVal, othVal).
  29004. *
  29005. * @static
  29006. * @memberOf _
  29007. * @since 4.0.0
  29008. * @category Array
  29009. * @param {...Array} [arrays] The arrays to inspect.
  29010. * @param {Function} [comparator] The comparator invoked per element.
  29011. * @returns {Array} Returns the new array of filtered values.
  29012. * @example
  29013. *
  29014. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  29015. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  29016. *
  29017. * _.xorWith(objects, others, _.isEqual);
  29018. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  29019. */
  29020. var xorWith = baseRest(function(arrays) {
  29021. var comparator = last(arrays);
  29022. comparator = typeof comparator == 'function' ? comparator : undefined;
  29023. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  29024. });
  29025. /**
  29026. * Creates an array of grouped elements, the first of which contains the
  29027. * first elements of the given arrays, the second of which contains the
  29028. * second elements of the given arrays, and so on.
  29029. *
  29030. * @static
  29031. * @memberOf _
  29032. * @since 0.1.0
  29033. * @category Array
  29034. * @param {...Array} [arrays] The arrays to process.
  29035. * @returns {Array} Returns the new array of grouped elements.
  29036. * @example
  29037. *
  29038. * _.zip(['a', 'b'], [1, 2], [true, false]);
  29039. * // => [['a', 1, true], ['b', 2, false]]
  29040. */
  29041. var zip = baseRest(unzip);
  29042. /**
  29043. * This method is like `_.fromPairs` except that it accepts two arrays,
  29044. * one of property identifiers and one of corresponding values.
  29045. *
  29046. * @static
  29047. * @memberOf _
  29048. * @since 0.4.0
  29049. * @category Array
  29050. * @param {Array} [props=[]] The property identifiers.
  29051. * @param {Array} [values=[]] The property values.
  29052. * @returns {Object} Returns the new object.
  29053. * @example
  29054. *
  29055. * _.zipObject(['a', 'b'], [1, 2]);
  29056. * // => { 'a': 1, 'b': 2 }
  29057. */
  29058. function zipObject(props, values) {
  29059. return baseZipObject(props || [], values || [], assignValue);
  29060. }
  29061. /**
  29062. * This method is like `_.zipObject` except that it supports property paths.
  29063. *
  29064. * @static
  29065. * @memberOf _
  29066. * @since 4.1.0
  29067. * @category Array
  29068. * @param {Array} [props=[]] The property identifiers.
  29069. * @param {Array} [values=[]] The property values.
  29070. * @returns {Object} Returns the new object.
  29071. * @example
  29072. *
  29073. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  29074. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  29075. */
  29076. function zipObjectDeep(props, values) {
  29077. return baseZipObject(props || [], values || [], baseSet);
  29078. }
  29079. /**
  29080. * This method is like `_.zip` except that it accepts `iteratee` to specify
  29081. * how grouped values should be combined. The iteratee is invoked with the
  29082. * elements of each group: (...group).
  29083. *
  29084. * @static
  29085. * @memberOf _
  29086. * @since 3.8.0
  29087. * @category Array
  29088. * @param {...Array} [arrays] The arrays to process.
  29089. * @param {Function} [iteratee=_.identity] The function to combine
  29090. * grouped values.
  29091. * @returns {Array} Returns the new array of grouped elements.
  29092. * @example
  29093. *
  29094. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  29095. * return a + b + c;
  29096. * });
  29097. * // => [111, 222]
  29098. */
  29099. var zipWith = baseRest(function(arrays) {
  29100. var length = arrays.length,
  29101. iteratee = length > 1 ? arrays[length - 1] : undefined;
  29102. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  29103. return unzipWith(arrays, iteratee);
  29104. });
  29105. /*------------------------------------------------------------------------*/
  29106. /**
  29107. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  29108. * chain sequences enabled. The result of such sequences must be unwrapped
  29109. * with `_#value`.
  29110. *
  29111. * @static
  29112. * @memberOf _
  29113. * @since 1.3.0
  29114. * @category Seq
  29115. * @param {*} value The value to wrap.
  29116. * @returns {Object} Returns the new `lodash` wrapper instance.
  29117. * @example
  29118. *
  29119. * var users = [
  29120. * { 'user': 'barney', 'age': 36 },
  29121. * { 'user': 'fred', 'age': 40 },
  29122. * { 'user': 'pebbles', 'age': 1 }
  29123. * ];
  29124. *
  29125. * var youngest = _
  29126. * .chain(users)
  29127. * .sortBy('age')
  29128. * .map(function(o) {
  29129. * return o.user + ' is ' + o.age;
  29130. * })
  29131. * .head()
  29132. * .value();
  29133. * // => 'pebbles is 1'
  29134. */
  29135. function chain(value) {
  29136. var result = lodash(value);
  29137. result.__chain__ = true;
  29138. return result;
  29139. }
  29140. /**
  29141. * This method invokes `interceptor` and returns `value`. The interceptor
  29142. * is invoked with one argument; (value). The purpose of this method is to
  29143. * "tap into" a method chain sequence in order to modify intermediate results.
  29144. *
  29145. * @static
  29146. * @memberOf _
  29147. * @since 0.1.0
  29148. * @category Seq
  29149. * @param {*} value The value to provide to `interceptor`.
  29150. * @param {Function} interceptor The function to invoke.
  29151. * @returns {*} Returns `value`.
  29152. * @example
  29153. *
  29154. * _([1, 2, 3])
  29155. * .tap(function(array) {
  29156. * // Mutate input array.
  29157. * array.pop();
  29158. * })
  29159. * .reverse()
  29160. * .value();
  29161. * // => [2, 1]
  29162. */
  29163. function tap(value, interceptor) {
  29164. interceptor(value);
  29165. return value;
  29166. }
  29167. /**
  29168. * This method is like `_.tap` except that it returns the result of `interceptor`.
  29169. * The purpose of this method is to "pass thru" values replacing intermediate
  29170. * results in a method chain sequence.
  29171. *
  29172. * @static
  29173. * @memberOf _
  29174. * @since 3.0.0
  29175. * @category Seq
  29176. * @param {*} value The value to provide to `interceptor`.
  29177. * @param {Function} interceptor The function to invoke.
  29178. * @returns {*} Returns the result of `interceptor`.
  29179. * @example
  29180. *
  29181. * _(' abc ')
  29182. * .chain()
  29183. * .trim()
  29184. * .thru(function(value) {
  29185. * return [value];
  29186. * })
  29187. * .value();
  29188. * // => ['abc']
  29189. */
  29190. function thru(value, interceptor) {
  29191. return interceptor(value);
  29192. }
  29193. /**
  29194. * This method is the wrapper version of `_.at`.
  29195. *
  29196. * @name at
  29197. * @memberOf _
  29198. * @since 1.0.0
  29199. * @category Seq
  29200. * @param {...(string|string[])} [paths] The property paths to pick.
  29201. * @returns {Object} Returns the new `lodash` wrapper instance.
  29202. * @example
  29203. *
  29204. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  29205. *
  29206. * _(object).at(['a[0].b.c', 'a[1]']).value();
  29207. * // => [3, 4]
  29208. */
  29209. var wrapperAt = flatRest(function(paths) {
  29210. var length = paths.length,
  29211. start = length ? paths[0] : 0,
  29212. value = this.__wrapped__,
  29213. interceptor = function(object) { return baseAt(object, paths); };
  29214. if (length > 1 || this.__actions__.length ||
  29215. !(value instanceof LazyWrapper) || !isIndex(start)) {
  29216. return this.thru(interceptor);
  29217. }
  29218. value = value.slice(start, +start + (length ? 1 : 0));
  29219. value.__actions__.push({
  29220. 'func': thru,
  29221. 'args': [interceptor],
  29222. 'thisArg': undefined
  29223. });
  29224. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  29225. if (length && !array.length) {
  29226. array.push(undefined);
  29227. }
  29228. return array;
  29229. });
  29230. });
  29231. /**
  29232. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  29233. *
  29234. * @name chain
  29235. * @memberOf _
  29236. * @since 0.1.0
  29237. * @category Seq
  29238. * @returns {Object} Returns the new `lodash` wrapper instance.
  29239. * @example
  29240. *
  29241. * var users = [
  29242. * { 'user': 'barney', 'age': 36 },
  29243. * { 'user': 'fred', 'age': 40 }
  29244. * ];
  29245. *
  29246. * // A sequence without explicit chaining.
  29247. * _(users).head();
  29248. * // => { 'user': 'barney', 'age': 36 }
  29249. *
  29250. * // A sequence with explicit chaining.
  29251. * _(users)
  29252. * .chain()
  29253. * .head()
  29254. * .pick('user')
  29255. * .value();
  29256. * // => { 'user': 'barney' }
  29257. */
  29258. function wrapperChain() {
  29259. return chain(this);
  29260. }
  29261. /**
  29262. * Executes the chain sequence and returns the wrapped result.
  29263. *
  29264. * @name commit
  29265. * @memberOf _
  29266. * @since 3.2.0
  29267. * @category Seq
  29268. * @returns {Object} Returns the new `lodash` wrapper instance.
  29269. * @example
  29270. *
  29271. * var array = [1, 2];
  29272. * var wrapped = _(array).push(3);
  29273. *
  29274. * console.log(array);
  29275. * // => [1, 2]
  29276. *
  29277. * wrapped = wrapped.commit();
  29278. * console.log(array);
  29279. * // => [1, 2, 3]
  29280. *
  29281. * wrapped.last();
  29282. * // => 3
  29283. *
  29284. * console.log(array);
  29285. * // => [1, 2, 3]
  29286. */
  29287. function wrapperCommit() {
  29288. return new LodashWrapper(this.value(), this.__chain__);
  29289. }
  29290. /**
  29291. * Gets the next value on a wrapped object following the
  29292. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  29293. *
  29294. * @name next
  29295. * @memberOf _
  29296. * @since 4.0.0
  29297. * @category Seq
  29298. * @returns {Object} Returns the next iterator value.
  29299. * @example
  29300. *
  29301. * var wrapped = _([1, 2]);
  29302. *
  29303. * wrapped.next();
  29304. * // => { 'done': false, 'value': 1 }
  29305. *
  29306. * wrapped.next();
  29307. * // => { 'done': false, 'value': 2 }
  29308. *
  29309. * wrapped.next();
  29310. * // => { 'done': true, 'value': undefined }
  29311. */
  29312. function wrapperNext() {
  29313. if (this.__values__ === undefined) {
  29314. this.__values__ = toArray(this.value());
  29315. }
  29316. var done = this.__index__ >= this.__values__.length,
  29317. value = done ? undefined : this.__values__[this.__index__++];
  29318. return { 'done': done, 'value': value };
  29319. }
  29320. /**
  29321. * Enables the wrapper to be iterable.
  29322. *
  29323. * @name Symbol.iterator
  29324. * @memberOf _
  29325. * @since 4.0.0
  29326. * @category Seq
  29327. * @returns {Object} Returns the wrapper object.
  29328. * @example
  29329. *
  29330. * var wrapped = _([1, 2]);
  29331. *
  29332. * wrapped[Symbol.iterator]() === wrapped;
  29333. * // => true
  29334. *
  29335. * Array.from(wrapped);
  29336. * // => [1, 2]
  29337. */
  29338. function wrapperToIterator() {
  29339. return this;
  29340. }
  29341. /**
  29342. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  29343. *
  29344. * @name plant
  29345. * @memberOf _
  29346. * @since 3.2.0
  29347. * @category Seq
  29348. * @param {*} value The value to plant.
  29349. * @returns {Object} Returns the new `lodash` wrapper instance.
  29350. * @example
  29351. *
  29352. * function square(n) {
  29353. * return n * n;
  29354. * }
  29355. *
  29356. * var wrapped = _([1, 2]).map(square);
  29357. * var other = wrapped.plant([3, 4]);
  29358. *
  29359. * other.value();
  29360. * // => [9, 16]
  29361. *
  29362. * wrapped.value();
  29363. * // => [1, 4]
  29364. */
  29365. function wrapperPlant(value) {
  29366. var result,
  29367. parent = this;
  29368. while (parent instanceof baseLodash) {
  29369. var clone = wrapperClone(parent);
  29370. clone.__index__ = 0;
  29371. clone.__values__ = undefined;
  29372. if (result) {
  29373. previous.__wrapped__ = clone;
  29374. } else {
  29375. result = clone;
  29376. }
  29377. var previous = clone;
  29378. parent = parent.__wrapped__;
  29379. }
  29380. previous.__wrapped__ = value;
  29381. return result;
  29382. }
  29383. /**
  29384. * This method is the wrapper version of `_.reverse`.
  29385. *
  29386. * **Note:** This method mutates the wrapped array.
  29387. *
  29388. * @name reverse
  29389. * @memberOf _
  29390. * @since 0.1.0
  29391. * @category Seq
  29392. * @returns {Object} Returns the new `lodash` wrapper instance.
  29393. * @example
  29394. *
  29395. * var array = [1, 2, 3];
  29396. *
  29397. * _(array).reverse().value()
  29398. * // => [3, 2, 1]
  29399. *
  29400. * console.log(array);
  29401. * // => [3, 2, 1]
  29402. */
  29403. function wrapperReverse() {
  29404. var value = this.__wrapped__;
  29405. if (value instanceof LazyWrapper) {
  29406. var wrapped = value;
  29407. if (this.__actions__.length) {
  29408. wrapped = new LazyWrapper(this);
  29409. }
  29410. wrapped = wrapped.reverse();
  29411. wrapped.__actions__.push({
  29412. 'func': thru,
  29413. 'args': [reverse],
  29414. 'thisArg': undefined
  29415. });
  29416. return new LodashWrapper(wrapped, this.__chain__);
  29417. }
  29418. return this.thru(reverse);
  29419. }
  29420. /**
  29421. * Executes the chain sequence to resolve the unwrapped value.
  29422. *
  29423. * @name value
  29424. * @memberOf _
  29425. * @since 0.1.0
  29426. * @alias toJSON, valueOf
  29427. * @category Seq
  29428. * @returns {*} Returns the resolved unwrapped value.
  29429. * @example
  29430. *
  29431. * _([1, 2, 3]).value();
  29432. * // => [1, 2, 3]
  29433. */
  29434. function wrapperValue() {
  29435. return baseWrapperValue(this.__wrapped__, this.__actions__);
  29436. }
  29437. /*------------------------------------------------------------------------*/
  29438. /**
  29439. * Creates an object composed of keys generated from the results of running
  29440. * each element of `collection` thru `iteratee`. The corresponding value of
  29441. * each key is the number of times the key was returned by `iteratee`. The
  29442. * iteratee is invoked with one argument: (value).
  29443. *
  29444. * @static
  29445. * @memberOf _
  29446. * @since 0.5.0
  29447. * @category Collection
  29448. * @param {Array|Object} collection The collection to iterate over.
  29449. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  29450. * @returns {Object} Returns the composed aggregate object.
  29451. * @example
  29452. *
  29453. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  29454. * // => { '4': 1, '6': 2 }
  29455. *
  29456. * // The `_.property` iteratee shorthand.
  29457. * _.countBy(['one', 'two', 'three'], 'length');
  29458. * // => { '3': 2, '5': 1 }
  29459. */
  29460. var countBy = createAggregator(function(result, value, key) {
  29461. if (hasOwnProperty.call(result, key)) {
  29462. ++result[key];
  29463. } else {
  29464. baseAssignValue(result, key, 1);
  29465. }
  29466. });
  29467. /**
  29468. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  29469. * Iteration is stopped once `predicate` returns falsey. The predicate is
  29470. * invoked with three arguments: (value, index|key, collection).
  29471. *
  29472. * **Note:** This method returns `true` for
  29473. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  29474. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  29475. * elements of empty collections.
  29476. *
  29477. * @static
  29478. * @memberOf _
  29479. * @since 0.1.0
  29480. * @category Collection
  29481. * @param {Array|Object} collection The collection to iterate over.
  29482. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29483. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  29484. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  29485. * else `false`.
  29486. * @example
  29487. *
  29488. * _.every([true, 1, null, 'yes'], Boolean);
  29489. * // => false
  29490. *
  29491. * var users = [
  29492. * { 'user': 'barney', 'age': 36, 'active': false },
  29493. * { 'user': 'fred', 'age': 40, 'active': false }
  29494. * ];
  29495. *
  29496. * // The `_.matches` iteratee shorthand.
  29497. * _.every(users, { 'user': 'barney', 'active': false });
  29498. * // => false
  29499. *
  29500. * // The `_.matchesProperty` iteratee shorthand.
  29501. * _.every(users, ['active', false]);
  29502. * // => true
  29503. *
  29504. * // The `_.property` iteratee shorthand.
  29505. * _.every(users, 'active');
  29506. * // => false
  29507. */
  29508. function every(collection, predicate, guard) {
  29509. var func = isArray(collection) ? arrayEvery : baseEvery;
  29510. if (guard && isIterateeCall(collection, predicate, guard)) {
  29511. predicate = undefined;
  29512. }
  29513. return func(collection, getIteratee(predicate, 3));
  29514. }
  29515. /**
  29516. * Iterates over elements of `collection`, returning an array of all elements
  29517. * `predicate` returns truthy for. The predicate is invoked with three
  29518. * arguments: (value, index|key, collection).
  29519. *
  29520. * **Note:** Unlike `_.remove`, this method returns a new array.
  29521. *
  29522. * @static
  29523. * @memberOf _
  29524. * @since 0.1.0
  29525. * @category Collection
  29526. * @param {Array|Object} collection The collection to iterate over.
  29527. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29528. * @returns {Array} Returns the new filtered array.
  29529. * @see _.reject
  29530. * @example
  29531. *
  29532. * var users = [
  29533. * { 'user': 'barney', 'age': 36, 'active': true },
  29534. * { 'user': 'fred', 'age': 40, 'active': false }
  29535. * ];
  29536. *
  29537. * _.filter(users, function(o) { return !o.active; });
  29538. * // => objects for ['fred']
  29539. *
  29540. * // The `_.matches` iteratee shorthand.
  29541. * _.filter(users, { 'age': 36, 'active': true });
  29542. * // => objects for ['barney']
  29543. *
  29544. * // The `_.matchesProperty` iteratee shorthand.
  29545. * _.filter(users, ['active', false]);
  29546. * // => objects for ['fred']
  29547. *
  29548. * // The `_.property` iteratee shorthand.
  29549. * _.filter(users, 'active');
  29550. * // => objects for ['barney']
  29551. */
  29552. function filter(collection, predicate) {
  29553. var func = isArray(collection) ? arrayFilter : baseFilter;
  29554. return func(collection, getIteratee(predicate, 3));
  29555. }
  29556. /**
  29557. * Iterates over elements of `collection`, returning the first element
  29558. * `predicate` returns truthy for. The predicate is invoked with three
  29559. * arguments: (value, index|key, collection).
  29560. *
  29561. * @static
  29562. * @memberOf _
  29563. * @since 0.1.0
  29564. * @category Collection
  29565. * @param {Array|Object} collection The collection to inspect.
  29566. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29567. * @param {number} [fromIndex=0] The index to search from.
  29568. * @returns {*} Returns the matched element, else `undefined`.
  29569. * @example
  29570. *
  29571. * var users = [
  29572. * { 'user': 'barney', 'age': 36, 'active': true },
  29573. * { 'user': 'fred', 'age': 40, 'active': false },
  29574. * { 'user': 'pebbles', 'age': 1, 'active': true }
  29575. * ];
  29576. *
  29577. * _.find(users, function(o) { return o.age < 40; });
  29578. * // => object for 'barney'
  29579. *
  29580. * // The `_.matches` iteratee shorthand.
  29581. * _.find(users, { 'age': 1, 'active': true });
  29582. * // => object for 'pebbles'
  29583. *
  29584. * // The `_.matchesProperty` iteratee shorthand.
  29585. * _.find(users, ['active', false]);
  29586. * // => object for 'fred'
  29587. *
  29588. * // The `_.property` iteratee shorthand.
  29589. * _.find(users, 'active');
  29590. * // => object for 'barney'
  29591. */
  29592. var find = createFind(findIndex);
  29593. /**
  29594. * This method is like `_.find` except that it iterates over elements of
  29595. * `collection` from right to left.
  29596. *
  29597. * @static
  29598. * @memberOf _
  29599. * @since 2.0.0
  29600. * @category Collection
  29601. * @param {Array|Object} collection The collection to inspect.
  29602. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29603. * @param {number} [fromIndex=collection.length-1] The index to search from.
  29604. * @returns {*} Returns the matched element, else `undefined`.
  29605. * @example
  29606. *
  29607. * _.findLast([1, 2, 3, 4], function(n) {
  29608. * return n % 2 == 1;
  29609. * });
  29610. * // => 3
  29611. */
  29612. var findLast = createFind(findLastIndex);
  29613. /**
  29614. * Creates a flattened array of values by running each element in `collection`
  29615. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  29616. * with three arguments: (value, index|key, collection).
  29617. *
  29618. * @static
  29619. * @memberOf _
  29620. * @since 4.0.0
  29621. * @category Collection
  29622. * @param {Array|Object} collection The collection to iterate over.
  29623. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29624. * @returns {Array} Returns the new flattened array.
  29625. * @example
  29626. *
  29627. * function duplicate(n) {
  29628. * return [n, n];
  29629. * }
  29630. *
  29631. * _.flatMap([1, 2], duplicate);
  29632. * // => [1, 1, 2, 2]
  29633. */
  29634. function flatMap(collection, iteratee) {
  29635. return baseFlatten(map(collection, iteratee), 1);
  29636. }
  29637. /**
  29638. * This method is like `_.flatMap` except that it recursively flattens the
  29639. * mapped results.
  29640. *
  29641. * @static
  29642. * @memberOf _
  29643. * @since 4.7.0
  29644. * @category Collection
  29645. * @param {Array|Object} collection The collection to iterate over.
  29646. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29647. * @returns {Array} Returns the new flattened array.
  29648. * @example
  29649. *
  29650. * function duplicate(n) {
  29651. * return [[[n, n]]];
  29652. * }
  29653. *
  29654. * _.flatMapDeep([1, 2], duplicate);
  29655. * // => [1, 1, 2, 2]
  29656. */
  29657. function flatMapDeep(collection, iteratee) {
  29658. return baseFlatten(map(collection, iteratee), INFINITY);
  29659. }
  29660. /**
  29661. * This method is like `_.flatMap` except that it recursively flattens the
  29662. * mapped results up to `depth` times.
  29663. *
  29664. * @static
  29665. * @memberOf _
  29666. * @since 4.7.0
  29667. * @category Collection
  29668. * @param {Array|Object} collection The collection to iterate over.
  29669. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29670. * @param {number} [depth=1] The maximum recursion depth.
  29671. * @returns {Array} Returns the new flattened array.
  29672. * @example
  29673. *
  29674. * function duplicate(n) {
  29675. * return [[[n, n]]];
  29676. * }
  29677. *
  29678. * _.flatMapDepth([1, 2], duplicate, 2);
  29679. * // => [[1, 1], [2, 2]]
  29680. */
  29681. function flatMapDepth(collection, iteratee, depth) {
  29682. depth = depth === undefined ? 1 : toInteger(depth);
  29683. return baseFlatten(map(collection, iteratee), depth);
  29684. }
  29685. /**
  29686. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  29687. * The iteratee is invoked with three arguments: (value, index|key, collection).
  29688. * Iteratee functions may exit iteration early by explicitly returning `false`.
  29689. *
  29690. * **Note:** As with other "Collections" methods, objects with a "length"
  29691. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  29692. * or `_.forOwn` for object iteration.
  29693. *
  29694. * @static
  29695. * @memberOf _
  29696. * @since 0.1.0
  29697. * @alias each
  29698. * @category Collection
  29699. * @param {Array|Object} collection The collection to iterate over.
  29700. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29701. * @returns {Array|Object} Returns `collection`.
  29702. * @see _.forEachRight
  29703. * @example
  29704. *
  29705. * _.forEach([1, 2], function(value) {
  29706. * console.log(value);
  29707. * });
  29708. * // => Logs `1` then `2`.
  29709. *
  29710. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  29711. * console.log(key);
  29712. * });
  29713. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  29714. */
  29715. function forEach(collection, iteratee) {
  29716. var func = isArray(collection) ? arrayEach : baseEach;
  29717. return func(collection, getIteratee(iteratee, 3));
  29718. }
  29719. /**
  29720. * This method is like `_.forEach` except that it iterates over elements of
  29721. * `collection` from right to left.
  29722. *
  29723. * @static
  29724. * @memberOf _
  29725. * @since 2.0.0
  29726. * @alias eachRight
  29727. * @category Collection
  29728. * @param {Array|Object} collection The collection to iterate over.
  29729. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29730. * @returns {Array|Object} Returns `collection`.
  29731. * @see _.forEach
  29732. * @example
  29733. *
  29734. * _.forEachRight([1, 2], function(value) {
  29735. * console.log(value);
  29736. * });
  29737. * // => Logs `2` then `1`.
  29738. */
  29739. function forEachRight(collection, iteratee) {
  29740. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  29741. return func(collection, getIteratee(iteratee, 3));
  29742. }
  29743. /**
  29744. * Creates an object composed of keys generated from the results of running
  29745. * each element of `collection` thru `iteratee`. The order of grouped values
  29746. * is determined by the order they occur in `collection`. The corresponding
  29747. * value of each key is an array of elements responsible for generating the
  29748. * key. The iteratee is invoked with one argument: (value).
  29749. *
  29750. * @static
  29751. * @memberOf _
  29752. * @since 0.1.0
  29753. * @category Collection
  29754. * @param {Array|Object} collection The collection to iterate over.
  29755. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  29756. * @returns {Object} Returns the composed aggregate object.
  29757. * @example
  29758. *
  29759. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  29760. * // => { '4': [4.2], '6': [6.1, 6.3] }
  29761. *
  29762. * // The `_.property` iteratee shorthand.
  29763. * _.groupBy(['one', 'two', 'three'], 'length');
  29764. * // => { '3': ['one', 'two'], '5': ['three'] }
  29765. */
  29766. var groupBy = createAggregator(function(result, value, key) {
  29767. if (hasOwnProperty.call(result, key)) {
  29768. result[key].push(value);
  29769. } else {
  29770. baseAssignValue(result, key, [value]);
  29771. }
  29772. });
  29773. /**
  29774. * Checks if `value` is in `collection`. If `collection` is a string, it's
  29775. * checked for a substring of `value`, otherwise
  29776. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  29777. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  29778. * the offset from the end of `collection`.
  29779. *
  29780. * @static
  29781. * @memberOf _
  29782. * @since 0.1.0
  29783. * @category Collection
  29784. * @param {Array|Object|string} collection The collection to inspect.
  29785. * @param {*} value The value to search for.
  29786. * @param {number} [fromIndex=0] The index to search from.
  29787. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  29788. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  29789. * @example
  29790. *
  29791. * _.includes([1, 2, 3], 1);
  29792. * // => true
  29793. *
  29794. * _.includes([1, 2, 3], 1, 2);
  29795. * // => false
  29796. *
  29797. * _.includes({ 'a': 1, 'b': 2 }, 1);
  29798. * // => true
  29799. *
  29800. * _.includes('abcd', 'bc');
  29801. * // => true
  29802. */
  29803. function includes(collection, value, fromIndex, guard) {
  29804. collection = isArrayLike(collection) ? collection : values(collection);
  29805. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  29806. var length = collection.length;
  29807. if (fromIndex < 0) {
  29808. fromIndex = nativeMax(length + fromIndex, 0);
  29809. }
  29810. return isString(collection)
  29811. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  29812. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  29813. }
  29814. /**
  29815. * Invokes the method at `path` of each element in `collection`, returning
  29816. * an array of the results of each invoked method. Any additional arguments
  29817. * are provided to each invoked method. If `path` is a function, it's invoked
  29818. * for, and `this` bound to, each element in `collection`.
  29819. *
  29820. * @static
  29821. * @memberOf _
  29822. * @since 4.0.0
  29823. * @category Collection
  29824. * @param {Array|Object} collection The collection to iterate over.
  29825. * @param {Array|Function|string} path The path of the method to invoke or
  29826. * the function invoked per iteration.
  29827. * @param {...*} [args] The arguments to invoke each method with.
  29828. * @returns {Array} Returns the array of results.
  29829. * @example
  29830. *
  29831. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  29832. * // => [[1, 5, 7], [1, 2, 3]]
  29833. *
  29834. * _.invokeMap([123, 456], String.prototype.split, '');
  29835. * // => [['1', '2', '3'], ['4', '5', '6']]
  29836. */
  29837. var invokeMap = baseRest(function(collection, path, args) {
  29838. var index = -1,
  29839. isFunc = typeof path == 'function',
  29840. result = isArrayLike(collection) ? Array(collection.length) : [];
  29841. baseEach(collection, function(value) {
  29842. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  29843. });
  29844. return result;
  29845. });
  29846. /**
  29847. * Creates an object composed of keys generated from the results of running
  29848. * each element of `collection` thru `iteratee`. The corresponding value of
  29849. * each key is the last element responsible for generating the key. The
  29850. * iteratee is invoked with one argument: (value).
  29851. *
  29852. * @static
  29853. * @memberOf _
  29854. * @since 4.0.0
  29855. * @category Collection
  29856. * @param {Array|Object} collection The collection to iterate over.
  29857. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  29858. * @returns {Object} Returns the composed aggregate object.
  29859. * @example
  29860. *
  29861. * var array = [
  29862. * { 'dir': 'left', 'code': 97 },
  29863. * { 'dir': 'right', 'code': 100 }
  29864. * ];
  29865. *
  29866. * _.keyBy(array, function(o) {
  29867. * return String.fromCharCode(o.code);
  29868. * });
  29869. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  29870. *
  29871. * _.keyBy(array, 'dir');
  29872. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  29873. */
  29874. var keyBy = createAggregator(function(result, value, key) {
  29875. baseAssignValue(result, key, value);
  29876. });
  29877. /**
  29878. * Creates an array of values by running each element in `collection` thru
  29879. * `iteratee`. The iteratee is invoked with three arguments:
  29880. * (value, index|key, collection).
  29881. *
  29882. * Many lodash methods are guarded to work as iteratees for methods like
  29883. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  29884. *
  29885. * The guarded methods are:
  29886. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  29887. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  29888. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  29889. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  29890. *
  29891. * @static
  29892. * @memberOf _
  29893. * @since 0.1.0
  29894. * @category Collection
  29895. * @param {Array|Object} collection The collection to iterate over.
  29896. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29897. * @returns {Array} Returns the new mapped array.
  29898. * @example
  29899. *
  29900. * function square(n) {
  29901. * return n * n;
  29902. * }
  29903. *
  29904. * _.map([4, 8], square);
  29905. * // => [16, 64]
  29906. *
  29907. * _.map({ 'a': 4, 'b': 8 }, square);
  29908. * // => [16, 64] (iteration order is not guaranteed)
  29909. *
  29910. * var users = [
  29911. * { 'user': 'barney' },
  29912. * { 'user': 'fred' }
  29913. * ];
  29914. *
  29915. * // The `_.property` iteratee shorthand.
  29916. * _.map(users, 'user');
  29917. * // => ['barney', 'fred']
  29918. */
  29919. function map(collection, iteratee) {
  29920. var func = isArray(collection) ? arrayMap : baseMap;
  29921. return func(collection, getIteratee(iteratee, 3));
  29922. }
  29923. /**
  29924. * This method is like `_.sortBy` except that it allows specifying the sort
  29925. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  29926. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  29927. * descending or "asc" for ascending sort order of corresponding values.
  29928. *
  29929. * @static
  29930. * @memberOf _
  29931. * @since 4.0.0
  29932. * @category Collection
  29933. * @param {Array|Object} collection The collection to iterate over.
  29934. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  29935. * The iteratees to sort by.
  29936. * @param {string[]} [orders] The sort orders of `iteratees`.
  29937. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  29938. * @returns {Array} Returns the new sorted array.
  29939. * @example
  29940. *
  29941. * var users = [
  29942. * { 'user': 'fred', 'age': 48 },
  29943. * { 'user': 'barney', 'age': 34 },
  29944. * { 'user': 'fred', 'age': 40 },
  29945. * { 'user': 'barney', 'age': 36 }
  29946. * ];
  29947. *
  29948. * // Sort by `user` in ascending order and by `age` in descending order.
  29949. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  29950. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  29951. */
  29952. function orderBy(collection, iteratees, orders, guard) {
  29953. if (collection == null) {
  29954. return [];
  29955. }
  29956. if (!isArray(iteratees)) {
  29957. iteratees = iteratees == null ? [] : [iteratees];
  29958. }
  29959. orders = guard ? undefined : orders;
  29960. if (!isArray(orders)) {
  29961. orders = orders == null ? [] : [orders];
  29962. }
  29963. return baseOrderBy(collection, iteratees, orders);
  29964. }
  29965. /**
  29966. * Creates an array of elements split into two groups, the first of which
  29967. * contains elements `predicate` returns truthy for, the second of which
  29968. * contains elements `predicate` returns falsey for. The predicate is
  29969. * invoked with one argument: (value).
  29970. *
  29971. * @static
  29972. * @memberOf _
  29973. * @since 3.0.0
  29974. * @category Collection
  29975. * @param {Array|Object} collection The collection to iterate over.
  29976. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29977. * @returns {Array} Returns the array of grouped elements.
  29978. * @example
  29979. *
  29980. * var users = [
  29981. * { 'user': 'barney', 'age': 36, 'active': false },
  29982. * { 'user': 'fred', 'age': 40, 'active': true },
  29983. * { 'user': 'pebbles', 'age': 1, 'active': false }
  29984. * ];
  29985. *
  29986. * _.partition(users, function(o) { return o.active; });
  29987. * // => objects for [['fred'], ['barney', 'pebbles']]
  29988. *
  29989. * // The `_.matches` iteratee shorthand.
  29990. * _.partition(users, { 'age': 1, 'active': false });
  29991. * // => objects for [['pebbles'], ['barney', 'fred']]
  29992. *
  29993. * // The `_.matchesProperty` iteratee shorthand.
  29994. * _.partition(users, ['active', false]);
  29995. * // => objects for [['barney', 'pebbles'], ['fred']]
  29996. *
  29997. * // The `_.property` iteratee shorthand.
  29998. * _.partition(users, 'active');
  29999. * // => objects for [['fred'], ['barney', 'pebbles']]
  30000. */
  30001. var partition = createAggregator(function(result, value, key) {
  30002. result[key ? 0 : 1].push(value);
  30003. }, function() { return [[], []]; });
  30004. /**
  30005. * Reduces `collection` to a value which is the accumulated result of running
  30006. * each element in `collection` thru `iteratee`, where each successive
  30007. * invocation is supplied the return value of the previous. If `accumulator`
  30008. * is not given, the first element of `collection` is used as the initial
  30009. * value. The iteratee is invoked with four arguments:
  30010. * (accumulator, value, index|key, collection).
  30011. *
  30012. * Many lodash methods are guarded to work as iteratees for methods like
  30013. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  30014. *
  30015. * The guarded methods are:
  30016. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  30017. * and `sortBy`
  30018. *
  30019. * @static
  30020. * @memberOf _
  30021. * @since 0.1.0
  30022. * @category Collection
  30023. * @param {Array|Object} collection The collection to iterate over.
  30024. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30025. * @param {*} [accumulator] The initial value.
  30026. * @returns {*} Returns the accumulated value.
  30027. * @see _.reduceRight
  30028. * @example
  30029. *
  30030. * _.reduce([1, 2], function(sum, n) {
  30031. * return sum + n;
  30032. * }, 0);
  30033. * // => 3
  30034. *
  30035. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  30036. * (result[value] || (result[value] = [])).push(key);
  30037. * return result;
  30038. * }, {});
  30039. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  30040. */
  30041. function reduce(collection, iteratee, accumulator) {
  30042. var func = isArray(collection) ? arrayReduce : baseReduce,
  30043. initAccum = arguments.length < 3;
  30044. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  30045. }
  30046. /**
  30047. * This method is like `_.reduce` except that it iterates over elements of
  30048. * `collection` from right to left.
  30049. *
  30050. * @static
  30051. * @memberOf _
  30052. * @since 0.1.0
  30053. * @category Collection
  30054. * @param {Array|Object} collection The collection to iterate over.
  30055. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30056. * @param {*} [accumulator] The initial value.
  30057. * @returns {*} Returns the accumulated value.
  30058. * @see _.reduce
  30059. * @example
  30060. *
  30061. * var array = [[0, 1], [2, 3], [4, 5]];
  30062. *
  30063. * _.reduceRight(array, function(flattened, other) {
  30064. * return flattened.concat(other);
  30065. * }, []);
  30066. * // => [4, 5, 2, 3, 0, 1]
  30067. */
  30068. function reduceRight(collection, iteratee, accumulator) {
  30069. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  30070. initAccum = arguments.length < 3;
  30071. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  30072. }
  30073. /**
  30074. * The opposite of `_.filter`; this method returns the elements of `collection`
  30075. * that `predicate` does **not** return truthy for.
  30076. *
  30077. * @static
  30078. * @memberOf _
  30079. * @since 0.1.0
  30080. * @category Collection
  30081. * @param {Array|Object} collection The collection to iterate over.
  30082. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30083. * @returns {Array} Returns the new filtered array.
  30084. * @see _.filter
  30085. * @example
  30086. *
  30087. * var users = [
  30088. * { 'user': 'barney', 'age': 36, 'active': false },
  30089. * { 'user': 'fred', 'age': 40, 'active': true }
  30090. * ];
  30091. *
  30092. * _.reject(users, function(o) { return !o.active; });
  30093. * // => objects for ['fred']
  30094. *
  30095. * // The `_.matches` iteratee shorthand.
  30096. * _.reject(users, { 'age': 40, 'active': true });
  30097. * // => objects for ['barney']
  30098. *
  30099. * // The `_.matchesProperty` iteratee shorthand.
  30100. * _.reject(users, ['active', false]);
  30101. * // => objects for ['fred']
  30102. *
  30103. * // The `_.property` iteratee shorthand.
  30104. * _.reject(users, 'active');
  30105. * // => objects for ['barney']
  30106. */
  30107. function reject(collection, predicate) {
  30108. var func = isArray(collection) ? arrayFilter : baseFilter;
  30109. return func(collection, negate(getIteratee(predicate, 3)));
  30110. }
  30111. /**
  30112. * Gets a random element from `collection`.
  30113. *
  30114. * @static
  30115. * @memberOf _
  30116. * @since 2.0.0
  30117. * @category Collection
  30118. * @param {Array|Object} collection The collection to sample.
  30119. * @returns {*} Returns the random element.
  30120. * @example
  30121. *
  30122. * _.sample([1, 2, 3, 4]);
  30123. * // => 2
  30124. */
  30125. function sample(collection) {
  30126. var func = isArray(collection) ? arraySample : baseSample;
  30127. return func(collection);
  30128. }
  30129. /**
  30130. * Gets `n` random elements at unique keys from `collection` up to the
  30131. * size of `collection`.
  30132. *
  30133. * @static
  30134. * @memberOf _
  30135. * @since 4.0.0
  30136. * @category Collection
  30137. * @param {Array|Object} collection The collection to sample.
  30138. * @param {number} [n=1] The number of elements to sample.
  30139. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  30140. * @returns {Array} Returns the random elements.
  30141. * @example
  30142. *
  30143. * _.sampleSize([1, 2, 3], 2);
  30144. * // => [3, 1]
  30145. *
  30146. * _.sampleSize([1, 2, 3], 4);
  30147. * // => [2, 3, 1]
  30148. */
  30149. function sampleSize(collection, n, guard) {
  30150. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  30151. n = 1;
  30152. } else {
  30153. n = toInteger(n);
  30154. }
  30155. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  30156. return func(collection, n);
  30157. }
  30158. /**
  30159. * Creates an array of shuffled values, using a version of the
  30160. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  30161. *
  30162. * @static
  30163. * @memberOf _
  30164. * @since 0.1.0
  30165. * @category Collection
  30166. * @param {Array|Object} collection The collection to shuffle.
  30167. * @returns {Array} Returns the new shuffled array.
  30168. * @example
  30169. *
  30170. * _.shuffle([1, 2, 3, 4]);
  30171. * // => [4, 1, 3, 2]
  30172. */
  30173. function shuffle(collection) {
  30174. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  30175. return func(collection);
  30176. }
  30177. /**
  30178. * Gets the size of `collection` by returning its length for array-like
  30179. * values or the number of own enumerable string keyed properties for objects.
  30180. *
  30181. * @static
  30182. * @memberOf _
  30183. * @since 0.1.0
  30184. * @category Collection
  30185. * @param {Array|Object|string} collection The collection to inspect.
  30186. * @returns {number} Returns the collection size.
  30187. * @example
  30188. *
  30189. * _.size([1, 2, 3]);
  30190. * // => 3
  30191. *
  30192. * _.size({ 'a': 1, 'b': 2 });
  30193. * // => 2
  30194. *
  30195. * _.size('pebbles');
  30196. * // => 7
  30197. */
  30198. function size(collection) {
  30199. if (collection == null) {
  30200. return 0;
  30201. }
  30202. if (isArrayLike(collection)) {
  30203. return isString(collection) ? stringSize(collection) : collection.length;
  30204. }
  30205. var tag = getTag(collection);
  30206. if (tag == mapTag || tag == setTag) {
  30207. return collection.size;
  30208. }
  30209. return baseKeys(collection).length;
  30210. }
  30211. /**
  30212. * Checks if `predicate` returns truthy for **any** element of `collection`.
  30213. * Iteration is stopped once `predicate` returns truthy. The predicate is
  30214. * invoked with three arguments: (value, index|key, collection).
  30215. *
  30216. * @static
  30217. * @memberOf _
  30218. * @since 0.1.0
  30219. * @category Collection
  30220. * @param {Array|Object} collection The collection to iterate over.
  30221. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30222. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  30223. * @returns {boolean} Returns `true` if any element passes the predicate check,
  30224. * else `false`.
  30225. * @example
  30226. *
  30227. * _.some([null, 0, 'yes', false], Boolean);
  30228. * // => true
  30229. *
  30230. * var users = [
  30231. * { 'user': 'barney', 'active': true },
  30232. * { 'user': 'fred', 'active': false }
  30233. * ];
  30234. *
  30235. * // The `_.matches` iteratee shorthand.
  30236. * _.some(users, { 'user': 'barney', 'active': false });
  30237. * // => false
  30238. *
  30239. * // The `_.matchesProperty` iteratee shorthand.
  30240. * _.some(users, ['active', false]);
  30241. * // => true
  30242. *
  30243. * // The `_.property` iteratee shorthand.
  30244. * _.some(users, 'active');
  30245. * // => true
  30246. */
  30247. function some(collection, predicate, guard) {
  30248. var func = isArray(collection) ? arraySome : baseSome;
  30249. if (guard && isIterateeCall(collection, predicate, guard)) {
  30250. predicate = undefined;
  30251. }
  30252. return func(collection, getIteratee(predicate, 3));
  30253. }
  30254. /**
  30255. * Creates an array of elements, sorted in ascending order by the results of
  30256. * running each element in a collection thru each iteratee. This method
  30257. * performs a stable sort, that is, it preserves the original sort order of
  30258. * equal elements. The iteratees are invoked with one argument: (value).
  30259. *
  30260. * @static
  30261. * @memberOf _
  30262. * @since 0.1.0
  30263. * @category Collection
  30264. * @param {Array|Object} collection The collection to iterate over.
  30265. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  30266. * The iteratees to sort by.
  30267. * @returns {Array} Returns the new sorted array.
  30268. * @example
  30269. *
  30270. * var users = [
  30271. * { 'user': 'fred', 'age': 48 },
  30272. * { 'user': 'barney', 'age': 36 },
  30273. * { 'user': 'fred', 'age': 40 },
  30274. * { 'user': 'barney', 'age': 34 }
  30275. * ];
  30276. *
  30277. * _.sortBy(users, [function(o) { return o.user; }]);
  30278. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  30279. *
  30280. * _.sortBy(users, ['user', 'age']);
  30281. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  30282. */
  30283. var sortBy = baseRest(function(collection, iteratees) {
  30284. if (collection == null) {
  30285. return [];
  30286. }
  30287. var length = iteratees.length;
  30288. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  30289. iteratees = [];
  30290. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  30291. iteratees = [iteratees[0]];
  30292. }
  30293. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  30294. });
  30295. /*------------------------------------------------------------------------*/
  30296. /**
  30297. * Gets the timestamp of the number of milliseconds that have elapsed since
  30298. * the Unix epoch (1 January 1970 00:00:00 UTC).
  30299. *
  30300. * @static
  30301. * @memberOf _
  30302. * @since 2.4.0
  30303. * @category Date
  30304. * @returns {number} Returns the timestamp.
  30305. * @example
  30306. *
  30307. * _.defer(function(stamp) {
  30308. * console.log(_.now() - stamp);
  30309. * }, _.now());
  30310. * // => Logs the number of milliseconds it took for the deferred invocation.
  30311. */
  30312. var now = ctxNow || function() {
  30313. return root.Date.now();
  30314. };
  30315. /*------------------------------------------------------------------------*/
  30316. /**
  30317. * The opposite of `_.before`; this method creates a function that invokes
  30318. * `func` once it's called `n` or more times.
  30319. *
  30320. * @static
  30321. * @memberOf _
  30322. * @since 0.1.0
  30323. * @category Function
  30324. * @param {number} n The number of calls before `func` is invoked.
  30325. * @param {Function} func The function to restrict.
  30326. * @returns {Function} Returns the new restricted function.
  30327. * @example
  30328. *
  30329. * var saves = ['profile', 'settings'];
  30330. *
  30331. * var done = _.after(saves.length, function() {
  30332. * console.log('done saving!');
  30333. * });
  30334. *
  30335. * _.forEach(saves, function(type) {
  30336. * asyncSave({ 'type': type, 'complete': done });
  30337. * });
  30338. * // => Logs 'done saving!' after the two async saves have completed.
  30339. */
  30340. function after(n, func) {
  30341. if (typeof func != 'function') {
  30342. throw new TypeError(FUNC_ERROR_TEXT);
  30343. }
  30344. n = toInteger(n);
  30345. return function() {
  30346. if (--n < 1) {
  30347. return func.apply(this, arguments);
  30348. }
  30349. };
  30350. }
  30351. /**
  30352. * Creates a function that invokes `func`, with up to `n` arguments,
  30353. * ignoring any additional arguments.
  30354. *
  30355. * @static
  30356. * @memberOf _
  30357. * @since 3.0.0
  30358. * @category Function
  30359. * @param {Function} func The function to cap arguments for.
  30360. * @param {number} [n=func.length] The arity cap.
  30361. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  30362. * @returns {Function} Returns the new capped function.
  30363. * @example
  30364. *
  30365. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  30366. * // => [6, 8, 10]
  30367. */
  30368. function ary(func, n, guard) {
  30369. n = guard ? undefined : n;
  30370. n = (func && n == null) ? func.length : n;
  30371. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  30372. }
  30373. /**
  30374. * Creates a function that invokes `func`, with the `this` binding and arguments
  30375. * of the created function, while it's called less than `n` times. Subsequent
  30376. * calls to the created function return the result of the last `func` invocation.
  30377. *
  30378. * @static
  30379. * @memberOf _
  30380. * @since 3.0.0
  30381. * @category Function
  30382. * @param {number} n The number of calls at which `func` is no longer invoked.
  30383. * @param {Function} func The function to restrict.
  30384. * @returns {Function} Returns the new restricted function.
  30385. * @example
  30386. *
  30387. * jQuery(element).on('click', _.before(5, addContactToList));
  30388. * // => Allows adding up to 4 contacts to the list.
  30389. */
  30390. function before(n, func) {
  30391. var result;
  30392. if (typeof func != 'function') {
  30393. throw new TypeError(FUNC_ERROR_TEXT);
  30394. }
  30395. n = toInteger(n);
  30396. return function() {
  30397. if (--n > 0) {
  30398. result = func.apply(this, arguments);
  30399. }
  30400. if (n <= 1) {
  30401. func = undefined;
  30402. }
  30403. return result;
  30404. };
  30405. }
  30406. /**
  30407. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  30408. * and `partials` prepended to the arguments it receives.
  30409. *
  30410. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  30411. * may be used as a placeholder for partially applied arguments.
  30412. *
  30413. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  30414. * property of bound functions.
  30415. *
  30416. * @static
  30417. * @memberOf _
  30418. * @since 0.1.0
  30419. * @category Function
  30420. * @param {Function} func The function to bind.
  30421. * @param {*} thisArg The `this` binding of `func`.
  30422. * @param {...*} [partials] The arguments to be partially applied.
  30423. * @returns {Function} Returns the new bound function.
  30424. * @example
  30425. *
  30426. * function greet(greeting, punctuation) {
  30427. * return greeting + ' ' + this.user + punctuation;
  30428. * }
  30429. *
  30430. * var object = { 'user': 'fred' };
  30431. *
  30432. * var bound = _.bind(greet, object, 'hi');
  30433. * bound('!');
  30434. * // => 'hi fred!'
  30435. *
  30436. * // Bound with placeholders.
  30437. * var bound = _.bind(greet, object, _, '!');
  30438. * bound('hi');
  30439. * // => 'hi fred!'
  30440. */
  30441. var bind = baseRest(function(func, thisArg, partials) {
  30442. var bitmask = WRAP_BIND_FLAG;
  30443. if (partials.length) {
  30444. var holders = replaceHolders(partials, getHolder(bind));
  30445. bitmask |= WRAP_PARTIAL_FLAG;
  30446. }
  30447. return createWrap(func, bitmask, thisArg, partials, holders);
  30448. });
  30449. /**
  30450. * Creates a function that invokes the method at `object[key]` with `partials`
  30451. * prepended to the arguments it receives.
  30452. *
  30453. * This method differs from `_.bind` by allowing bound functions to reference
  30454. * methods that may be redefined or don't yet exist. See
  30455. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  30456. * for more details.
  30457. *
  30458. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  30459. * builds, may be used as a placeholder for partially applied arguments.
  30460. *
  30461. * @static
  30462. * @memberOf _
  30463. * @since 0.10.0
  30464. * @category Function
  30465. * @param {Object} object The object to invoke the method on.
  30466. * @param {string} key The key of the method.
  30467. * @param {...*} [partials] The arguments to be partially applied.
  30468. * @returns {Function} Returns the new bound function.
  30469. * @example
  30470. *
  30471. * var object = {
  30472. * 'user': 'fred',
  30473. * 'greet': function(greeting, punctuation) {
  30474. * return greeting + ' ' + this.user + punctuation;
  30475. * }
  30476. * };
  30477. *
  30478. * var bound = _.bindKey(object, 'greet', 'hi');
  30479. * bound('!');
  30480. * // => 'hi fred!'
  30481. *
  30482. * object.greet = function(greeting, punctuation) {
  30483. * return greeting + 'ya ' + this.user + punctuation;
  30484. * };
  30485. *
  30486. * bound('!');
  30487. * // => 'hiya fred!'
  30488. *
  30489. * // Bound with placeholders.
  30490. * var bound = _.bindKey(object, 'greet', _, '!');
  30491. * bound('hi');
  30492. * // => 'hiya fred!'
  30493. */
  30494. var bindKey = baseRest(function(object, key, partials) {
  30495. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  30496. if (partials.length) {
  30497. var holders = replaceHolders(partials, getHolder(bindKey));
  30498. bitmask |= WRAP_PARTIAL_FLAG;
  30499. }
  30500. return createWrap(key, bitmask, object, partials, holders);
  30501. });
  30502. /**
  30503. * Creates a function that accepts arguments of `func` and either invokes
  30504. * `func` returning its result, if at least `arity` number of arguments have
  30505. * been provided, or returns a function that accepts the remaining `func`
  30506. * arguments, and so on. The arity of `func` may be specified if `func.length`
  30507. * is not sufficient.
  30508. *
  30509. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  30510. * may be used as a placeholder for provided arguments.
  30511. *
  30512. * **Note:** This method doesn't set the "length" property of curried functions.
  30513. *
  30514. * @static
  30515. * @memberOf _
  30516. * @since 2.0.0
  30517. * @category Function
  30518. * @param {Function} func The function to curry.
  30519. * @param {number} [arity=func.length] The arity of `func`.
  30520. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  30521. * @returns {Function} Returns the new curried function.
  30522. * @example
  30523. *
  30524. * var abc = function(a, b, c) {
  30525. * return [a, b, c];
  30526. * };
  30527. *
  30528. * var curried = _.curry(abc);
  30529. *
  30530. * curried(1)(2)(3);
  30531. * // => [1, 2, 3]
  30532. *
  30533. * curried(1, 2)(3);
  30534. * // => [1, 2, 3]
  30535. *
  30536. * curried(1, 2, 3);
  30537. * // => [1, 2, 3]
  30538. *
  30539. * // Curried with placeholders.
  30540. * curried(1)(_, 3)(2);
  30541. * // => [1, 2, 3]
  30542. */
  30543. function curry(func, arity, guard) {
  30544. arity = guard ? undefined : arity;
  30545. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  30546. result.placeholder = curry.placeholder;
  30547. return result;
  30548. }
  30549. /**
  30550. * This method is like `_.curry` except that arguments are applied to `func`
  30551. * in the manner of `_.partialRight` instead of `_.partial`.
  30552. *
  30553. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  30554. * builds, may be used as a placeholder for provided arguments.
  30555. *
  30556. * **Note:** This method doesn't set the "length" property of curried functions.
  30557. *
  30558. * @static
  30559. * @memberOf _
  30560. * @since 3.0.0
  30561. * @category Function
  30562. * @param {Function} func The function to curry.
  30563. * @param {number} [arity=func.length] The arity of `func`.
  30564. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  30565. * @returns {Function} Returns the new curried function.
  30566. * @example
  30567. *
  30568. * var abc = function(a, b, c) {
  30569. * return [a, b, c];
  30570. * };
  30571. *
  30572. * var curried = _.curryRight(abc);
  30573. *
  30574. * curried(3)(2)(1);
  30575. * // => [1, 2, 3]
  30576. *
  30577. * curried(2, 3)(1);
  30578. * // => [1, 2, 3]
  30579. *
  30580. * curried(1, 2, 3);
  30581. * // => [1, 2, 3]
  30582. *
  30583. * // Curried with placeholders.
  30584. * curried(3)(1, _)(2);
  30585. * // => [1, 2, 3]
  30586. */
  30587. function curryRight(func, arity, guard) {
  30588. arity = guard ? undefined : arity;
  30589. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  30590. result.placeholder = curryRight.placeholder;
  30591. return result;
  30592. }
  30593. /**
  30594. * Creates a debounced function that delays invoking `func` until after `wait`
  30595. * milliseconds have elapsed since the last time the debounced function was
  30596. * invoked. The debounced function comes with a `cancel` method to cancel
  30597. * delayed `func` invocations and a `flush` method to immediately invoke them.
  30598. * Provide `options` to indicate whether `func` should be invoked on the
  30599. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  30600. * with the last arguments provided to the debounced function. Subsequent
  30601. * calls to the debounced function return the result of the last `func`
  30602. * invocation.
  30603. *
  30604. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  30605. * invoked on the trailing edge of the timeout only if the debounced function
  30606. * is invoked more than once during the `wait` timeout.
  30607. *
  30608. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  30609. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  30610. *
  30611. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  30612. * for details over the differences between `_.debounce` and `_.throttle`.
  30613. *
  30614. * @static
  30615. * @memberOf _
  30616. * @since 0.1.0
  30617. * @category Function
  30618. * @param {Function} func The function to debounce.
  30619. * @param {number} [wait=0] The number of milliseconds to delay.
  30620. * @param {Object} [options={}] The options object.
  30621. * @param {boolean} [options.leading=false]
  30622. * Specify invoking on the leading edge of the timeout.
  30623. * @param {number} [options.maxWait]
  30624. * The maximum time `func` is allowed to be delayed before it's invoked.
  30625. * @param {boolean} [options.trailing=true]
  30626. * Specify invoking on the trailing edge of the timeout.
  30627. * @returns {Function} Returns the new debounced function.
  30628. * @example
  30629. *
  30630. * // Avoid costly calculations while the window size is in flux.
  30631. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  30632. *
  30633. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  30634. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  30635. * 'leading': true,
  30636. * 'trailing': false
  30637. * }));
  30638. *
  30639. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  30640. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  30641. * var source = new EventSource('/stream');
  30642. * jQuery(source).on('message', debounced);
  30643. *
  30644. * // Cancel the trailing debounced invocation.
  30645. * jQuery(window).on('popstate', debounced.cancel);
  30646. */
  30647. function debounce(func, wait, options) {
  30648. var lastArgs,
  30649. lastThis,
  30650. maxWait,
  30651. result,
  30652. timerId,
  30653. lastCallTime,
  30654. lastInvokeTime = 0,
  30655. leading = false,
  30656. maxing = false,
  30657. trailing = true;
  30658. if (typeof func != 'function') {
  30659. throw new TypeError(FUNC_ERROR_TEXT);
  30660. }
  30661. wait = toNumber(wait) || 0;
  30662. if (isObject(options)) {
  30663. leading = !!options.leading;
  30664. maxing = 'maxWait' in options;
  30665. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  30666. trailing = 'trailing' in options ? !!options.trailing : trailing;
  30667. }
  30668. function invokeFunc(time) {
  30669. var args = lastArgs,
  30670. thisArg = lastThis;
  30671. lastArgs = lastThis = undefined;
  30672. lastInvokeTime = time;
  30673. result = func.apply(thisArg, args);
  30674. return result;
  30675. }
  30676. function leadingEdge(time) {
  30677. // Reset any `maxWait` timer.
  30678. lastInvokeTime = time;
  30679. // Start the timer for the trailing edge.
  30680. timerId = setTimeout(timerExpired, wait);
  30681. // Invoke the leading edge.
  30682. return leading ? invokeFunc(time) : result;
  30683. }
  30684. function remainingWait(time) {
  30685. var timeSinceLastCall = time - lastCallTime,
  30686. timeSinceLastInvoke = time - lastInvokeTime,
  30687. timeWaiting = wait - timeSinceLastCall;
  30688. return maxing
  30689. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  30690. : timeWaiting;
  30691. }
  30692. function shouldInvoke(time) {
  30693. var timeSinceLastCall = time - lastCallTime,
  30694. timeSinceLastInvoke = time - lastInvokeTime;
  30695. // Either this is the first call, activity has stopped and we're at the
  30696. // trailing edge, the system time has gone backwards and we're treating
  30697. // it as the trailing edge, or we've hit the `maxWait` limit.
  30698. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  30699. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  30700. }
  30701. function timerExpired() {
  30702. var time = now();
  30703. if (shouldInvoke(time)) {
  30704. return trailingEdge(time);
  30705. }
  30706. // Restart the timer.
  30707. timerId = setTimeout(timerExpired, remainingWait(time));
  30708. }
  30709. function trailingEdge(time) {
  30710. timerId = undefined;
  30711. // Only invoke if we have `lastArgs` which means `func` has been
  30712. // debounced at least once.
  30713. if (trailing && lastArgs) {
  30714. return invokeFunc(time);
  30715. }
  30716. lastArgs = lastThis = undefined;
  30717. return result;
  30718. }
  30719. function cancel() {
  30720. if (timerId !== undefined) {
  30721. clearTimeout(timerId);
  30722. }
  30723. lastInvokeTime = 0;
  30724. lastArgs = lastCallTime = lastThis = timerId = undefined;
  30725. }
  30726. function flush() {
  30727. return timerId === undefined ? result : trailingEdge(now());
  30728. }
  30729. function debounced() {
  30730. var time = now(),
  30731. isInvoking = shouldInvoke(time);
  30732. lastArgs = arguments;
  30733. lastThis = this;
  30734. lastCallTime = time;
  30735. if (isInvoking) {
  30736. if (timerId === undefined) {
  30737. return leadingEdge(lastCallTime);
  30738. }
  30739. if (maxing) {
  30740. // Handle invocations in a tight loop.
  30741. clearTimeout(timerId);
  30742. timerId = setTimeout(timerExpired, wait);
  30743. return invokeFunc(lastCallTime);
  30744. }
  30745. }
  30746. if (timerId === undefined) {
  30747. timerId = setTimeout(timerExpired, wait);
  30748. }
  30749. return result;
  30750. }
  30751. debounced.cancel = cancel;
  30752. debounced.flush = flush;
  30753. return debounced;
  30754. }
  30755. /**
  30756. * Defers invoking the `func` until the current call stack has cleared. Any
  30757. * additional arguments are provided to `func` when it's invoked.
  30758. *
  30759. * @static
  30760. * @memberOf _
  30761. * @since 0.1.0
  30762. * @category Function
  30763. * @param {Function} func The function to defer.
  30764. * @param {...*} [args] The arguments to invoke `func` with.
  30765. * @returns {number} Returns the timer id.
  30766. * @example
  30767. *
  30768. * _.defer(function(text) {
  30769. * console.log(text);
  30770. * }, 'deferred');
  30771. * // => Logs 'deferred' after one millisecond.
  30772. */
  30773. var defer = baseRest(function(func, args) {
  30774. return baseDelay(func, 1, args);
  30775. });
  30776. /**
  30777. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  30778. * provided to `func` when it's invoked.
  30779. *
  30780. * @static
  30781. * @memberOf _
  30782. * @since 0.1.0
  30783. * @category Function
  30784. * @param {Function} func The function to delay.
  30785. * @param {number} wait The number of milliseconds to delay invocation.
  30786. * @param {...*} [args] The arguments to invoke `func` with.
  30787. * @returns {number} Returns the timer id.
  30788. * @example
  30789. *
  30790. * _.delay(function(text) {
  30791. * console.log(text);
  30792. * }, 1000, 'later');
  30793. * // => Logs 'later' after one second.
  30794. */
  30795. var delay = baseRest(function(func, wait, args) {
  30796. return baseDelay(func, toNumber(wait) || 0, args);
  30797. });
  30798. /**
  30799. * Creates a function that invokes `func` with arguments reversed.
  30800. *
  30801. * @static
  30802. * @memberOf _
  30803. * @since 4.0.0
  30804. * @category Function
  30805. * @param {Function} func The function to flip arguments for.
  30806. * @returns {Function} Returns the new flipped function.
  30807. * @example
  30808. *
  30809. * var flipped = _.flip(function() {
  30810. * return _.toArray(arguments);
  30811. * });
  30812. *
  30813. * flipped('a', 'b', 'c', 'd');
  30814. * // => ['d', 'c', 'b', 'a']
  30815. */
  30816. function flip(func) {
  30817. return createWrap(func, WRAP_FLIP_FLAG);
  30818. }
  30819. /**
  30820. * Creates a function that memoizes the result of `func`. If `resolver` is
  30821. * provided, it determines the cache key for storing the result based on the
  30822. * arguments provided to the memoized function. By default, the first argument
  30823. * provided to the memoized function is used as the map cache key. The `func`
  30824. * is invoked with the `this` binding of the memoized function.
  30825. *
  30826. * **Note:** The cache is exposed as the `cache` property on the memoized
  30827. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  30828. * constructor with one whose instances implement the
  30829. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  30830. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  30831. *
  30832. * @static
  30833. * @memberOf _
  30834. * @since 0.1.0
  30835. * @category Function
  30836. * @param {Function} func The function to have its output memoized.
  30837. * @param {Function} [resolver] The function to resolve the cache key.
  30838. * @returns {Function} Returns the new memoized function.
  30839. * @example
  30840. *
  30841. * var object = { 'a': 1, 'b': 2 };
  30842. * var other = { 'c': 3, 'd': 4 };
  30843. *
  30844. * var values = _.memoize(_.values);
  30845. * values(object);
  30846. * // => [1, 2]
  30847. *
  30848. * values(other);
  30849. * // => [3, 4]
  30850. *
  30851. * object.a = 2;
  30852. * values(object);
  30853. * // => [1, 2]
  30854. *
  30855. * // Modify the result cache.
  30856. * values.cache.set(object, ['a', 'b']);
  30857. * values(object);
  30858. * // => ['a', 'b']
  30859. *
  30860. * // Replace `_.memoize.Cache`.
  30861. * _.memoize.Cache = WeakMap;
  30862. */
  30863. function memoize(func, resolver) {
  30864. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  30865. throw new TypeError(FUNC_ERROR_TEXT);
  30866. }
  30867. var memoized = function() {
  30868. var args = arguments,
  30869. key = resolver ? resolver.apply(this, args) : args[0],
  30870. cache = memoized.cache;
  30871. if (cache.has(key)) {
  30872. return cache.get(key);
  30873. }
  30874. var result = func.apply(this, args);
  30875. memoized.cache = cache.set(key, result) || cache;
  30876. return result;
  30877. };
  30878. memoized.cache = new (memoize.Cache || MapCache);
  30879. return memoized;
  30880. }
  30881. // Expose `MapCache`.
  30882. memoize.Cache = MapCache;
  30883. /**
  30884. * Creates a function that negates the result of the predicate `func`. The
  30885. * `func` predicate is invoked with the `this` binding and arguments of the
  30886. * created function.
  30887. *
  30888. * @static
  30889. * @memberOf _
  30890. * @since 3.0.0
  30891. * @category Function
  30892. * @param {Function} predicate The predicate to negate.
  30893. * @returns {Function} Returns the new negated function.
  30894. * @example
  30895. *
  30896. * function isEven(n) {
  30897. * return n % 2 == 0;
  30898. * }
  30899. *
  30900. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  30901. * // => [1, 3, 5]
  30902. */
  30903. function negate(predicate) {
  30904. if (typeof predicate != 'function') {
  30905. throw new TypeError(FUNC_ERROR_TEXT);
  30906. }
  30907. return function() {
  30908. var args = arguments;
  30909. switch (args.length) {
  30910. case 0: return !predicate.call(this);
  30911. case 1: return !predicate.call(this, args[0]);
  30912. case 2: return !predicate.call(this, args[0], args[1]);
  30913. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  30914. }
  30915. return !predicate.apply(this, args);
  30916. };
  30917. }
  30918. /**
  30919. * Creates a function that is restricted to invoking `func` once. Repeat calls
  30920. * to the function return the value of the first invocation. The `func` is
  30921. * invoked with the `this` binding and arguments of the created function.
  30922. *
  30923. * @static
  30924. * @memberOf _
  30925. * @since 0.1.0
  30926. * @category Function
  30927. * @param {Function} func The function to restrict.
  30928. * @returns {Function} Returns the new restricted function.
  30929. * @example
  30930. *
  30931. * var initialize = _.once(createApplication);
  30932. * initialize();
  30933. * initialize();
  30934. * // => `createApplication` is invoked once
  30935. */
  30936. function once(func) {
  30937. return before(2, func);
  30938. }
  30939. /**
  30940. * Creates a function that invokes `func` with its arguments transformed.
  30941. *
  30942. * @static
  30943. * @since 4.0.0
  30944. * @memberOf _
  30945. * @category Function
  30946. * @param {Function} func The function to wrap.
  30947. * @param {...(Function|Function[])} [transforms=[_.identity]]
  30948. * The argument transforms.
  30949. * @returns {Function} Returns the new function.
  30950. * @example
  30951. *
  30952. * function doubled(n) {
  30953. * return n * 2;
  30954. * }
  30955. *
  30956. * function square(n) {
  30957. * return n * n;
  30958. * }
  30959. *
  30960. * var func = _.overArgs(function(x, y) {
  30961. * return [x, y];
  30962. * }, [square, doubled]);
  30963. *
  30964. * func(9, 3);
  30965. * // => [81, 6]
  30966. *
  30967. * func(10, 5);
  30968. * // => [100, 10]
  30969. */
  30970. var overArgs = castRest(function(func, transforms) {
  30971. transforms = (transforms.length == 1 && isArray(transforms[0]))
  30972. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  30973. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  30974. var funcsLength = transforms.length;
  30975. return baseRest(function(args) {
  30976. var index = -1,
  30977. length = nativeMin(args.length, funcsLength);
  30978. while (++index < length) {
  30979. args[index] = transforms[index].call(this, args[index]);
  30980. }
  30981. return apply(func, this, args);
  30982. });
  30983. });
  30984. /**
  30985. * Creates a function that invokes `func` with `partials` prepended to the
  30986. * arguments it receives. This method is like `_.bind` except it does **not**
  30987. * alter the `this` binding.
  30988. *
  30989. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  30990. * builds, may be used as a placeholder for partially applied arguments.
  30991. *
  30992. * **Note:** This method doesn't set the "length" property of partially
  30993. * applied functions.
  30994. *
  30995. * @static
  30996. * @memberOf _
  30997. * @since 0.2.0
  30998. * @category Function
  30999. * @param {Function} func The function to partially apply arguments to.
  31000. * @param {...*} [partials] The arguments to be partially applied.
  31001. * @returns {Function} Returns the new partially applied function.
  31002. * @example
  31003. *
  31004. * function greet(greeting, name) {
  31005. * return greeting + ' ' + name;
  31006. * }
  31007. *
  31008. * var sayHelloTo = _.partial(greet, 'hello');
  31009. * sayHelloTo('fred');
  31010. * // => 'hello fred'
  31011. *
  31012. * // Partially applied with placeholders.
  31013. * var greetFred = _.partial(greet, _, 'fred');
  31014. * greetFred('hi');
  31015. * // => 'hi fred'
  31016. */
  31017. var partial = baseRest(function(func, partials) {
  31018. var holders = replaceHolders(partials, getHolder(partial));
  31019. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  31020. });
  31021. /**
  31022. * This method is like `_.partial` except that partially applied arguments
  31023. * are appended to the arguments it receives.
  31024. *
  31025. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  31026. * builds, may be used as a placeholder for partially applied arguments.
  31027. *
  31028. * **Note:** This method doesn't set the "length" property of partially
  31029. * applied functions.
  31030. *
  31031. * @static
  31032. * @memberOf _
  31033. * @since 1.0.0
  31034. * @category Function
  31035. * @param {Function} func The function to partially apply arguments to.
  31036. * @param {...*} [partials] The arguments to be partially applied.
  31037. * @returns {Function} Returns the new partially applied function.
  31038. * @example
  31039. *
  31040. * function greet(greeting, name) {
  31041. * return greeting + ' ' + name;
  31042. * }
  31043. *
  31044. * var greetFred = _.partialRight(greet, 'fred');
  31045. * greetFred('hi');
  31046. * // => 'hi fred'
  31047. *
  31048. * // Partially applied with placeholders.
  31049. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  31050. * sayHelloTo('fred');
  31051. * // => 'hello fred'
  31052. */
  31053. var partialRight = baseRest(function(func, partials) {
  31054. var holders = replaceHolders(partials, getHolder(partialRight));
  31055. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  31056. });
  31057. /**
  31058. * Creates a function that invokes `func` with arguments arranged according
  31059. * to the specified `indexes` where the argument value at the first index is
  31060. * provided as the first argument, the argument value at the second index is
  31061. * provided as the second argument, and so on.
  31062. *
  31063. * @static
  31064. * @memberOf _
  31065. * @since 3.0.0
  31066. * @category Function
  31067. * @param {Function} func The function to rearrange arguments for.
  31068. * @param {...(number|number[])} indexes The arranged argument indexes.
  31069. * @returns {Function} Returns the new function.
  31070. * @example
  31071. *
  31072. * var rearged = _.rearg(function(a, b, c) {
  31073. * return [a, b, c];
  31074. * }, [2, 0, 1]);
  31075. *
  31076. * rearged('b', 'c', 'a')
  31077. * // => ['a', 'b', 'c']
  31078. */
  31079. var rearg = flatRest(function(func, indexes) {
  31080. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  31081. });
  31082. /**
  31083. * Creates a function that invokes `func` with the `this` binding of the
  31084. * created function and arguments from `start` and beyond provided as
  31085. * an array.
  31086. *
  31087. * **Note:** This method is based on the
  31088. * [rest parameter](https://mdn.io/rest_parameters).
  31089. *
  31090. * @static
  31091. * @memberOf _
  31092. * @since 4.0.0
  31093. * @category Function
  31094. * @param {Function} func The function to apply a rest parameter to.
  31095. * @param {number} [start=func.length-1] The start position of the rest parameter.
  31096. * @returns {Function} Returns the new function.
  31097. * @example
  31098. *
  31099. * var say = _.rest(function(what, names) {
  31100. * return what + ' ' + _.initial(names).join(', ') +
  31101. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  31102. * });
  31103. *
  31104. * say('hello', 'fred', 'barney', 'pebbles');
  31105. * // => 'hello fred, barney, & pebbles'
  31106. */
  31107. function rest(func, start) {
  31108. if (typeof func != 'function') {
  31109. throw new TypeError(FUNC_ERROR_TEXT);
  31110. }
  31111. start = start === undefined ? start : toInteger(start);
  31112. return baseRest(func, start);
  31113. }
  31114. /**
  31115. * Creates a function that invokes `func` with the `this` binding of the
  31116. * create function and an array of arguments much like
  31117. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  31118. *
  31119. * **Note:** This method is based on the
  31120. * [spread operator](https://mdn.io/spread_operator).
  31121. *
  31122. * @static
  31123. * @memberOf _
  31124. * @since 3.2.0
  31125. * @category Function
  31126. * @param {Function} func The function to spread arguments over.
  31127. * @param {number} [start=0] The start position of the spread.
  31128. * @returns {Function} Returns the new function.
  31129. * @example
  31130. *
  31131. * var say = _.spread(function(who, what) {
  31132. * return who + ' says ' + what;
  31133. * });
  31134. *
  31135. * say(['fred', 'hello']);
  31136. * // => 'fred says hello'
  31137. *
  31138. * var numbers = Promise.all([
  31139. * Promise.resolve(40),
  31140. * Promise.resolve(36)
  31141. * ]);
  31142. *
  31143. * numbers.then(_.spread(function(x, y) {
  31144. * return x + y;
  31145. * }));
  31146. * // => a Promise of 76
  31147. */
  31148. function spread(func, start) {
  31149. if (typeof func != 'function') {
  31150. throw new TypeError(FUNC_ERROR_TEXT);
  31151. }
  31152. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  31153. return baseRest(function(args) {
  31154. var array = args[start],
  31155. otherArgs = castSlice(args, 0, start);
  31156. if (array) {
  31157. arrayPush(otherArgs, array);
  31158. }
  31159. return apply(func, this, otherArgs);
  31160. });
  31161. }
  31162. /**
  31163. * Creates a throttled function that only invokes `func` at most once per
  31164. * every `wait` milliseconds. The throttled function comes with a `cancel`
  31165. * method to cancel delayed `func` invocations and a `flush` method to
  31166. * immediately invoke them. Provide `options` to indicate whether `func`
  31167. * should be invoked on the leading and/or trailing edge of the `wait`
  31168. * timeout. The `func` is invoked with the last arguments provided to the
  31169. * throttled function. Subsequent calls to the throttled function return the
  31170. * result of the last `func` invocation.
  31171. *
  31172. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  31173. * invoked on the trailing edge of the timeout only if the throttled function
  31174. * is invoked more than once during the `wait` timeout.
  31175. *
  31176. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  31177. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  31178. *
  31179. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  31180. * for details over the differences between `_.throttle` and `_.debounce`.
  31181. *
  31182. * @static
  31183. * @memberOf _
  31184. * @since 0.1.0
  31185. * @category Function
  31186. * @param {Function} func The function to throttle.
  31187. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  31188. * @param {Object} [options={}] The options object.
  31189. * @param {boolean} [options.leading=true]
  31190. * Specify invoking on the leading edge of the timeout.
  31191. * @param {boolean} [options.trailing=true]
  31192. * Specify invoking on the trailing edge of the timeout.
  31193. * @returns {Function} Returns the new throttled function.
  31194. * @example
  31195. *
  31196. * // Avoid excessively updating the position while scrolling.
  31197. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  31198. *
  31199. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  31200. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  31201. * jQuery(element).on('click', throttled);
  31202. *
  31203. * // Cancel the trailing throttled invocation.
  31204. * jQuery(window).on('popstate', throttled.cancel);
  31205. */
  31206. function throttle(func, wait, options) {
  31207. var leading = true,
  31208. trailing = true;
  31209. if (typeof func != 'function') {
  31210. throw new TypeError(FUNC_ERROR_TEXT);
  31211. }
  31212. if (isObject(options)) {
  31213. leading = 'leading' in options ? !!options.leading : leading;
  31214. trailing = 'trailing' in options ? !!options.trailing : trailing;
  31215. }
  31216. return debounce(func, wait, {
  31217. 'leading': leading,
  31218. 'maxWait': wait,
  31219. 'trailing': trailing
  31220. });
  31221. }
  31222. /**
  31223. * Creates a function that accepts up to one argument, ignoring any
  31224. * additional arguments.
  31225. *
  31226. * @static
  31227. * @memberOf _
  31228. * @since 4.0.0
  31229. * @category Function
  31230. * @param {Function} func The function to cap arguments for.
  31231. * @returns {Function} Returns the new capped function.
  31232. * @example
  31233. *
  31234. * _.map(['6', '8', '10'], _.unary(parseInt));
  31235. * // => [6, 8, 10]
  31236. */
  31237. function unary(func) {
  31238. return ary(func, 1);
  31239. }
  31240. /**
  31241. * Creates a function that provides `value` to `wrapper` as its first
  31242. * argument. Any additional arguments provided to the function are appended
  31243. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  31244. * binding of the created function.
  31245. *
  31246. * @static
  31247. * @memberOf _
  31248. * @since 0.1.0
  31249. * @category Function
  31250. * @param {*} value The value to wrap.
  31251. * @param {Function} [wrapper=identity] The wrapper function.
  31252. * @returns {Function} Returns the new function.
  31253. * @example
  31254. *
  31255. * var p = _.wrap(_.escape, function(func, text) {
  31256. * return '<p>' + func(text) + '</p>';
  31257. * });
  31258. *
  31259. * p('fred, barney, & pebbles');
  31260. * // => '<p>fred, barney, &amp; pebbles</p>'
  31261. */
  31262. function wrap(value, wrapper) {
  31263. return partial(castFunction(wrapper), value);
  31264. }
  31265. /*------------------------------------------------------------------------*/
  31266. /**
  31267. * Casts `value` as an array if it's not one.
  31268. *
  31269. * @static
  31270. * @memberOf _
  31271. * @since 4.4.0
  31272. * @category Lang
  31273. * @param {*} value The value to inspect.
  31274. * @returns {Array} Returns the cast array.
  31275. * @example
  31276. *
  31277. * _.castArray(1);
  31278. * // => [1]
  31279. *
  31280. * _.castArray({ 'a': 1 });
  31281. * // => [{ 'a': 1 }]
  31282. *
  31283. * _.castArray('abc');
  31284. * // => ['abc']
  31285. *
  31286. * _.castArray(null);
  31287. * // => [null]
  31288. *
  31289. * _.castArray(undefined);
  31290. * // => [undefined]
  31291. *
  31292. * _.castArray();
  31293. * // => []
  31294. *
  31295. * var array = [1, 2, 3];
  31296. * console.log(_.castArray(array) === array);
  31297. * // => true
  31298. */
  31299. function castArray() {
  31300. if (!arguments.length) {
  31301. return [];
  31302. }
  31303. var value = arguments[0];
  31304. return isArray(value) ? value : [value];
  31305. }
  31306. /**
  31307. * Creates a shallow clone of `value`.
  31308. *
  31309. * **Note:** This method is loosely based on the
  31310. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  31311. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  31312. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  31313. * arrays. The own enumerable properties of `arguments` objects are cloned
  31314. * as plain objects. An empty object is returned for uncloneable values such
  31315. * as error objects, functions, DOM nodes, and WeakMaps.
  31316. *
  31317. * @static
  31318. * @memberOf _
  31319. * @since 0.1.0
  31320. * @category Lang
  31321. * @param {*} value The value to clone.
  31322. * @returns {*} Returns the cloned value.
  31323. * @see _.cloneDeep
  31324. * @example
  31325. *
  31326. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  31327. *
  31328. * var shallow = _.clone(objects);
  31329. * console.log(shallow[0] === objects[0]);
  31330. * // => true
  31331. */
  31332. function clone(value) {
  31333. return baseClone(value, CLONE_SYMBOLS_FLAG);
  31334. }
  31335. /**
  31336. * This method is like `_.clone` except that it accepts `customizer` which
  31337. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  31338. * cloning is handled by the method instead. The `customizer` is invoked with
  31339. * up to four arguments; (value [, index|key, object, stack]).
  31340. *
  31341. * @static
  31342. * @memberOf _
  31343. * @since 4.0.0
  31344. * @category Lang
  31345. * @param {*} value The value to clone.
  31346. * @param {Function} [customizer] The function to customize cloning.
  31347. * @returns {*} Returns the cloned value.
  31348. * @see _.cloneDeepWith
  31349. * @example
  31350. *
  31351. * function customizer(value) {
  31352. * if (_.isElement(value)) {
  31353. * return value.cloneNode(false);
  31354. * }
  31355. * }
  31356. *
  31357. * var el = _.cloneWith(document.body, customizer);
  31358. *
  31359. * console.log(el === document.body);
  31360. * // => false
  31361. * console.log(el.nodeName);
  31362. * // => 'BODY'
  31363. * console.log(el.childNodes.length);
  31364. * // => 0
  31365. */
  31366. function cloneWith(value, customizer) {
  31367. customizer = typeof customizer == 'function' ? customizer : undefined;
  31368. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  31369. }
  31370. /**
  31371. * This method is like `_.clone` except that it recursively clones `value`.
  31372. *
  31373. * @static
  31374. * @memberOf _
  31375. * @since 1.0.0
  31376. * @category Lang
  31377. * @param {*} value The value to recursively clone.
  31378. * @returns {*} Returns the deep cloned value.
  31379. * @see _.clone
  31380. * @example
  31381. *
  31382. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  31383. *
  31384. * var deep = _.cloneDeep(objects);
  31385. * console.log(deep[0] === objects[0]);
  31386. * // => false
  31387. */
  31388. function cloneDeep(value) {
  31389. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  31390. }
  31391. /**
  31392. * This method is like `_.cloneWith` except that it recursively clones `value`.
  31393. *
  31394. * @static
  31395. * @memberOf _
  31396. * @since 4.0.0
  31397. * @category Lang
  31398. * @param {*} value The value to recursively clone.
  31399. * @param {Function} [customizer] The function to customize cloning.
  31400. * @returns {*} Returns the deep cloned value.
  31401. * @see _.cloneWith
  31402. * @example
  31403. *
  31404. * function customizer(value) {
  31405. * if (_.isElement(value)) {
  31406. * return value.cloneNode(true);
  31407. * }
  31408. * }
  31409. *
  31410. * var el = _.cloneDeepWith(document.body, customizer);
  31411. *
  31412. * console.log(el === document.body);
  31413. * // => false
  31414. * console.log(el.nodeName);
  31415. * // => 'BODY'
  31416. * console.log(el.childNodes.length);
  31417. * // => 20
  31418. */
  31419. function cloneDeepWith(value, customizer) {
  31420. customizer = typeof customizer == 'function' ? customizer : undefined;
  31421. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  31422. }
  31423. /**
  31424. * Checks if `object` conforms to `source` by invoking the predicate
  31425. * properties of `source` with the corresponding property values of `object`.
  31426. *
  31427. * **Note:** This method is equivalent to `_.conforms` when `source` is
  31428. * partially applied.
  31429. *
  31430. * @static
  31431. * @memberOf _
  31432. * @since 4.14.0
  31433. * @category Lang
  31434. * @param {Object} object The object to inspect.
  31435. * @param {Object} source The object of property predicates to conform to.
  31436. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  31437. * @example
  31438. *
  31439. * var object = { 'a': 1, 'b': 2 };
  31440. *
  31441. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  31442. * // => true
  31443. *
  31444. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  31445. * // => false
  31446. */
  31447. function conformsTo(object, source) {
  31448. return source == null || baseConformsTo(object, source, keys(source));
  31449. }
  31450. /**
  31451. * Performs a
  31452. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  31453. * comparison between two values to determine if they are equivalent.
  31454. *
  31455. * @static
  31456. * @memberOf _
  31457. * @since 4.0.0
  31458. * @category Lang
  31459. * @param {*} value The value to compare.
  31460. * @param {*} other The other value to compare.
  31461. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  31462. * @example
  31463. *
  31464. * var object = { 'a': 1 };
  31465. * var other = { 'a': 1 };
  31466. *
  31467. * _.eq(object, object);
  31468. * // => true
  31469. *
  31470. * _.eq(object, other);
  31471. * // => false
  31472. *
  31473. * _.eq('a', 'a');
  31474. * // => true
  31475. *
  31476. * _.eq('a', Object('a'));
  31477. * // => false
  31478. *
  31479. * _.eq(NaN, NaN);
  31480. * // => true
  31481. */
  31482. function eq(value, other) {
  31483. return value === other || (value !== value && other !== other);
  31484. }
  31485. /**
  31486. * Checks if `value` is greater than `other`.
  31487. *
  31488. * @static
  31489. * @memberOf _
  31490. * @since 3.9.0
  31491. * @category Lang
  31492. * @param {*} value The value to compare.
  31493. * @param {*} other The other value to compare.
  31494. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  31495. * else `false`.
  31496. * @see _.lt
  31497. * @example
  31498. *
  31499. * _.gt(3, 1);
  31500. * // => true
  31501. *
  31502. * _.gt(3, 3);
  31503. * // => false
  31504. *
  31505. * _.gt(1, 3);
  31506. * // => false
  31507. */
  31508. var gt = createRelationalOperation(baseGt);
  31509. /**
  31510. * Checks if `value` is greater than or equal to `other`.
  31511. *
  31512. * @static
  31513. * @memberOf _
  31514. * @since 3.9.0
  31515. * @category Lang
  31516. * @param {*} value The value to compare.
  31517. * @param {*} other The other value to compare.
  31518. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  31519. * `other`, else `false`.
  31520. * @see _.lte
  31521. * @example
  31522. *
  31523. * _.gte(3, 1);
  31524. * // => true
  31525. *
  31526. * _.gte(3, 3);
  31527. * // => true
  31528. *
  31529. * _.gte(1, 3);
  31530. * // => false
  31531. */
  31532. var gte = createRelationalOperation(function(value, other) {
  31533. return value >= other;
  31534. });
  31535. /**
  31536. * Checks if `value` is likely an `arguments` object.
  31537. *
  31538. * @static
  31539. * @memberOf _
  31540. * @since 0.1.0
  31541. * @category Lang
  31542. * @param {*} value The value to check.
  31543. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  31544. * else `false`.
  31545. * @example
  31546. *
  31547. * _.isArguments(function() { return arguments; }());
  31548. * // => true
  31549. *
  31550. * _.isArguments([1, 2, 3]);
  31551. * // => false
  31552. */
  31553. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  31554. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  31555. !propertyIsEnumerable.call(value, 'callee');
  31556. };
  31557. /**
  31558. * Checks if `value` is classified as an `Array` object.
  31559. *
  31560. * @static
  31561. * @memberOf _
  31562. * @since 0.1.0
  31563. * @category Lang
  31564. * @param {*} value The value to check.
  31565. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  31566. * @example
  31567. *
  31568. * _.isArray([1, 2, 3]);
  31569. * // => true
  31570. *
  31571. * _.isArray(document.body.children);
  31572. * // => false
  31573. *
  31574. * _.isArray('abc');
  31575. * // => false
  31576. *
  31577. * _.isArray(_.noop);
  31578. * // => false
  31579. */
  31580. var isArray = Array.isArray;
  31581. /**
  31582. * Checks if `value` is classified as an `ArrayBuffer` object.
  31583. *
  31584. * @static
  31585. * @memberOf _
  31586. * @since 4.3.0
  31587. * @category Lang
  31588. * @param {*} value The value to check.
  31589. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  31590. * @example
  31591. *
  31592. * _.isArrayBuffer(new ArrayBuffer(2));
  31593. * // => true
  31594. *
  31595. * _.isArrayBuffer(new Array(2));
  31596. * // => false
  31597. */
  31598. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  31599. /**
  31600. * Checks if `value` is array-like. A value is considered array-like if it's
  31601. * not a function and has a `value.length` that's an integer greater than or
  31602. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  31603. *
  31604. * @static
  31605. * @memberOf _
  31606. * @since 4.0.0
  31607. * @category Lang
  31608. * @param {*} value The value to check.
  31609. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  31610. * @example
  31611. *
  31612. * _.isArrayLike([1, 2, 3]);
  31613. * // => true
  31614. *
  31615. * _.isArrayLike(document.body.children);
  31616. * // => true
  31617. *
  31618. * _.isArrayLike('abc');
  31619. * // => true
  31620. *
  31621. * _.isArrayLike(_.noop);
  31622. * // => false
  31623. */
  31624. function isArrayLike(value) {
  31625. return value != null && isLength(value.length) && !isFunction(value);
  31626. }
  31627. /**
  31628. * This method is like `_.isArrayLike` except that it also checks if `value`
  31629. * is an object.
  31630. *
  31631. * @static
  31632. * @memberOf _
  31633. * @since 4.0.0
  31634. * @category Lang
  31635. * @param {*} value The value to check.
  31636. * @returns {boolean} Returns `true` if `value` is an array-like object,
  31637. * else `false`.
  31638. * @example
  31639. *
  31640. * _.isArrayLikeObject([1, 2, 3]);
  31641. * // => true
  31642. *
  31643. * _.isArrayLikeObject(document.body.children);
  31644. * // => true
  31645. *
  31646. * _.isArrayLikeObject('abc');
  31647. * // => false
  31648. *
  31649. * _.isArrayLikeObject(_.noop);
  31650. * // => false
  31651. */
  31652. function isArrayLikeObject(value) {
  31653. return isObjectLike(value) && isArrayLike(value);
  31654. }
  31655. /**
  31656. * Checks if `value` is classified as a boolean primitive or object.
  31657. *
  31658. * @static
  31659. * @memberOf _
  31660. * @since 0.1.0
  31661. * @category Lang
  31662. * @param {*} value The value to check.
  31663. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  31664. * @example
  31665. *
  31666. * _.isBoolean(false);
  31667. * // => true
  31668. *
  31669. * _.isBoolean(null);
  31670. * // => false
  31671. */
  31672. function isBoolean(value) {
  31673. return value === true || value === false ||
  31674. (isObjectLike(value) && baseGetTag(value) == boolTag);
  31675. }
  31676. /**
  31677. * Checks if `value` is a buffer.
  31678. *
  31679. * @static
  31680. * @memberOf _
  31681. * @since 4.3.0
  31682. * @category Lang
  31683. * @param {*} value The value to check.
  31684. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  31685. * @example
  31686. *
  31687. * _.isBuffer(new Buffer(2));
  31688. * // => true
  31689. *
  31690. * _.isBuffer(new Uint8Array(2));
  31691. * // => false
  31692. */
  31693. var isBuffer = nativeIsBuffer || stubFalse;
  31694. /**
  31695. * Checks if `value` is classified as a `Date` object.
  31696. *
  31697. * @static
  31698. * @memberOf _
  31699. * @since 0.1.0
  31700. * @category Lang
  31701. * @param {*} value The value to check.
  31702. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  31703. * @example
  31704. *
  31705. * _.isDate(new Date);
  31706. * // => true
  31707. *
  31708. * _.isDate('Mon April 23 2012');
  31709. * // => false
  31710. */
  31711. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  31712. /**
  31713. * Checks if `value` is likely a DOM element.
  31714. *
  31715. * @static
  31716. * @memberOf _
  31717. * @since 0.1.0
  31718. * @category Lang
  31719. * @param {*} value The value to check.
  31720. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  31721. * @example
  31722. *
  31723. * _.isElement(document.body);
  31724. * // => true
  31725. *
  31726. * _.isElement('<body>');
  31727. * // => false
  31728. */
  31729. function isElement(value) {
  31730. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  31731. }
  31732. /**
  31733. * Checks if `value` is an empty object, collection, map, or set.
  31734. *
  31735. * Objects are considered empty if they have no own enumerable string keyed
  31736. * properties.
  31737. *
  31738. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  31739. * jQuery-like collections are considered empty if they have a `length` of `0`.
  31740. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  31741. *
  31742. * @static
  31743. * @memberOf _
  31744. * @since 0.1.0
  31745. * @category Lang
  31746. * @param {*} value The value to check.
  31747. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  31748. * @example
  31749. *
  31750. * _.isEmpty(null);
  31751. * // => true
  31752. *
  31753. * _.isEmpty(true);
  31754. * // => true
  31755. *
  31756. * _.isEmpty(1);
  31757. * // => true
  31758. *
  31759. * _.isEmpty([1, 2, 3]);
  31760. * // => false
  31761. *
  31762. * _.isEmpty({ 'a': 1 });
  31763. * // => false
  31764. */
  31765. function isEmpty(value) {
  31766. if (value == null) {
  31767. return true;
  31768. }
  31769. if (isArrayLike(value) &&
  31770. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  31771. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  31772. return !value.length;
  31773. }
  31774. var tag = getTag(value);
  31775. if (tag == mapTag || tag == setTag) {
  31776. return !value.size;
  31777. }
  31778. if (isPrototype(value)) {
  31779. return !baseKeys(value).length;
  31780. }
  31781. for (var key in value) {
  31782. if (hasOwnProperty.call(value, key)) {
  31783. return false;
  31784. }
  31785. }
  31786. return true;
  31787. }
  31788. /**
  31789. * Performs a deep comparison between two values to determine if they are
  31790. * equivalent.
  31791. *
  31792. * **Note:** This method supports comparing arrays, array buffers, booleans,
  31793. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  31794. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  31795. * by their own, not inherited, enumerable properties. Functions and DOM
  31796. * nodes are compared by strict equality, i.e. `===`.
  31797. *
  31798. * @static
  31799. * @memberOf _
  31800. * @since 0.1.0
  31801. * @category Lang
  31802. * @param {*} value The value to compare.
  31803. * @param {*} other The other value to compare.
  31804. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  31805. * @example
  31806. *
  31807. * var object = { 'a': 1 };
  31808. * var other = { 'a': 1 };
  31809. *
  31810. * _.isEqual(object, other);
  31811. * // => true
  31812. *
  31813. * object === other;
  31814. * // => false
  31815. */
  31816. function isEqual(value, other) {
  31817. return baseIsEqual(value, other);
  31818. }
  31819. /**
  31820. * This method is like `_.isEqual` except that it accepts `customizer` which
  31821. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  31822. * are handled by the method instead. The `customizer` is invoked with up to
  31823. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  31824. *
  31825. * @static
  31826. * @memberOf _
  31827. * @since 4.0.0
  31828. * @category Lang
  31829. * @param {*} value The value to compare.
  31830. * @param {*} other The other value to compare.
  31831. * @param {Function} [customizer] The function to customize comparisons.
  31832. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  31833. * @example
  31834. *
  31835. * function isGreeting(value) {
  31836. * return /^h(?:i|ello)$/.test(value);
  31837. * }
  31838. *
  31839. * function customizer(objValue, othValue) {
  31840. * if (isGreeting(objValue) && isGreeting(othValue)) {
  31841. * return true;
  31842. * }
  31843. * }
  31844. *
  31845. * var array = ['hello', 'goodbye'];
  31846. * var other = ['hi', 'goodbye'];
  31847. *
  31848. * _.isEqualWith(array, other, customizer);
  31849. * // => true
  31850. */
  31851. function isEqualWith(value, other, customizer) {
  31852. customizer = typeof customizer == 'function' ? customizer : undefined;
  31853. var result = customizer ? customizer(value, other) : undefined;
  31854. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  31855. }
  31856. /**
  31857. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  31858. * `SyntaxError`, `TypeError`, or `URIError` object.
  31859. *
  31860. * @static
  31861. * @memberOf _
  31862. * @since 3.0.0
  31863. * @category Lang
  31864. * @param {*} value The value to check.
  31865. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  31866. * @example
  31867. *
  31868. * _.isError(new Error);
  31869. * // => true
  31870. *
  31871. * _.isError(Error);
  31872. * // => false
  31873. */
  31874. function isError(value) {
  31875. if (!isObjectLike(value)) {
  31876. return false;
  31877. }
  31878. var tag = baseGetTag(value);
  31879. return tag == errorTag || tag == domExcTag ||
  31880. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  31881. }
  31882. /**
  31883. * Checks if `value` is a finite primitive number.
  31884. *
  31885. * **Note:** This method is based on
  31886. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  31887. *
  31888. * @static
  31889. * @memberOf _
  31890. * @since 0.1.0
  31891. * @category Lang
  31892. * @param {*} value The value to check.
  31893. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  31894. * @example
  31895. *
  31896. * _.isFinite(3);
  31897. * // => true
  31898. *
  31899. * _.isFinite(Number.MIN_VALUE);
  31900. * // => true
  31901. *
  31902. * _.isFinite(Infinity);
  31903. * // => false
  31904. *
  31905. * _.isFinite('3');
  31906. * // => false
  31907. */
  31908. function isFinite(value) {
  31909. return typeof value == 'number' && nativeIsFinite(value);
  31910. }
  31911. /**
  31912. * Checks if `value` is classified as a `Function` object.
  31913. *
  31914. * @static
  31915. * @memberOf _
  31916. * @since 0.1.0
  31917. * @category Lang
  31918. * @param {*} value The value to check.
  31919. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  31920. * @example
  31921. *
  31922. * _.isFunction(_);
  31923. * // => true
  31924. *
  31925. * _.isFunction(/abc/);
  31926. * // => false
  31927. */
  31928. function isFunction(value) {
  31929. if (!isObject(value)) {
  31930. return false;
  31931. }
  31932. // The use of `Object#toString` avoids issues with the `typeof` operator
  31933. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  31934. var tag = baseGetTag(value);
  31935. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  31936. }
  31937. /**
  31938. * Checks if `value` is an integer.
  31939. *
  31940. * **Note:** This method is based on
  31941. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  31942. *
  31943. * @static
  31944. * @memberOf _
  31945. * @since 4.0.0
  31946. * @category Lang
  31947. * @param {*} value The value to check.
  31948. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  31949. * @example
  31950. *
  31951. * _.isInteger(3);
  31952. * // => true
  31953. *
  31954. * _.isInteger(Number.MIN_VALUE);
  31955. * // => false
  31956. *
  31957. * _.isInteger(Infinity);
  31958. * // => false
  31959. *
  31960. * _.isInteger('3');
  31961. * // => false
  31962. */
  31963. function isInteger(value) {
  31964. return typeof value == 'number' && value == toInteger(value);
  31965. }
  31966. /**
  31967. * Checks if `value` is a valid array-like length.
  31968. *
  31969. * **Note:** This method is loosely based on
  31970. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  31971. *
  31972. * @static
  31973. * @memberOf _
  31974. * @since 4.0.0
  31975. * @category Lang
  31976. * @param {*} value The value to check.
  31977. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  31978. * @example
  31979. *
  31980. * _.isLength(3);
  31981. * // => true
  31982. *
  31983. * _.isLength(Number.MIN_VALUE);
  31984. * // => false
  31985. *
  31986. * _.isLength(Infinity);
  31987. * // => false
  31988. *
  31989. * _.isLength('3');
  31990. * // => false
  31991. */
  31992. function isLength(value) {
  31993. return typeof value == 'number' &&
  31994. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  31995. }
  31996. /**
  31997. * Checks if `value` is the
  31998. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  31999. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  32000. *
  32001. * @static
  32002. * @memberOf _
  32003. * @since 0.1.0
  32004. * @category Lang
  32005. * @param {*} value The value to check.
  32006. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  32007. * @example
  32008. *
  32009. * _.isObject({});
  32010. * // => true
  32011. *
  32012. * _.isObject([1, 2, 3]);
  32013. * // => true
  32014. *
  32015. * _.isObject(_.noop);
  32016. * // => true
  32017. *
  32018. * _.isObject(null);
  32019. * // => false
  32020. */
  32021. function isObject(value) {
  32022. var type = typeof value;
  32023. return value != null && (type == 'object' || type == 'function');
  32024. }
  32025. /**
  32026. * Checks if `value` is object-like. A value is object-like if it's not `null`
  32027. * and has a `typeof` result of "object".
  32028. *
  32029. * @static
  32030. * @memberOf _
  32031. * @since 4.0.0
  32032. * @category Lang
  32033. * @param {*} value The value to check.
  32034. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  32035. * @example
  32036. *
  32037. * _.isObjectLike({});
  32038. * // => true
  32039. *
  32040. * _.isObjectLike([1, 2, 3]);
  32041. * // => true
  32042. *
  32043. * _.isObjectLike(_.noop);
  32044. * // => false
  32045. *
  32046. * _.isObjectLike(null);
  32047. * // => false
  32048. */
  32049. function isObjectLike(value) {
  32050. return value != null && typeof value == 'object';
  32051. }
  32052. /**
  32053. * Checks if `value` is classified as a `Map` object.
  32054. *
  32055. * @static
  32056. * @memberOf _
  32057. * @since 4.3.0
  32058. * @category Lang
  32059. * @param {*} value The value to check.
  32060. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  32061. * @example
  32062. *
  32063. * _.isMap(new Map);
  32064. * // => true
  32065. *
  32066. * _.isMap(new WeakMap);
  32067. * // => false
  32068. */
  32069. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  32070. /**
  32071. * Performs a partial deep comparison between `object` and `source` to
  32072. * determine if `object` contains equivalent property values.
  32073. *
  32074. * **Note:** This method is equivalent to `_.matches` when `source` is
  32075. * partially applied.
  32076. *
  32077. * Partial comparisons will match empty array and empty object `source`
  32078. * values against any array or object value, respectively. See `_.isEqual`
  32079. * for a list of supported value comparisons.
  32080. *
  32081. * @static
  32082. * @memberOf _
  32083. * @since 3.0.0
  32084. * @category Lang
  32085. * @param {Object} object The object to inspect.
  32086. * @param {Object} source The object of property values to match.
  32087. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  32088. * @example
  32089. *
  32090. * var object = { 'a': 1, 'b': 2 };
  32091. *
  32092. * _.isMatch(object, { 'b': 2 });
  32093. * // => true
  32094. *
  32095. * _.isMatch(object, { 'b': 1 });
  32096. * // => false
  32097. */
  32098. function isMatch(object, source) {
  32099. return object === source || baseIsMatch(object, source, getMatchData(source));
  32100. }
  32101. /**
  32102. * This method is like `_.isMatch` except that it accepts `customizer` which
  32103. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  32104. * are handled by the method instead. The `customizer` is invoked with five
  32105. * arguments: (objValue, srcValue, index|key, object, source).
  32106. *
  32107. * @static
  32108. * @memberOf _
  32109. * @since 4.0.0
  32110. * @category Lang
  32111. * @param {Object} object The object to inspect.
  32112. * @param {Object} source The object of property values to match.
  32113. * @param {Function} [customizer] The function to customize comparisons.
  32114. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  32115. * @example
  32116. *
  32117. * function isGreeting(value) {
  32118. * return /^h(?:i|ello)$/.test(value);
  32119. * }
  32120. *
  32121. * function customizer(objValue, srcValue) {
  32122. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  32123. * return true;
  32124. * }
  32125. * }
  32126. *
  32127. * var object = { 'greeting': 'hello' };
  32128. * var source = { 'greeting': 'hi' };
  32129. *
  32130. * _.isMatchWith(object, source, customizer);
  32131. * // => true
  32132. */
  32133. function isMatchWith(object, source, customizer) {
  32134. customizer = typeof customizer == 'function' ? customizer : undefined;
  32135. return baseIsMatch(object, source, getMatchData(source), customizer);
  32136. }
  32137. /**
  32138. * Checks if `value` is `NaN`.
  32139. *
  32140. * **Note:** This method is based on
  32141. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  32142. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  32143. * `undefined` and other non-number values.
  32144. *
  32145. * @static
  32146. * @memberOf _
  32147. * @since 0.1.0
  32148. * @category Lang
  32149. * @param {*} value The value to check.
  32150. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  32151. * @example
  32152. *
  32153. * _.isNaN(NaN);
  32154. * // => true
  32155. *
  32156. * _.isNaN(new Number(NaN));
  32157. * // => true
  32158. *
  32159. * isNaN(undefined);
  32160. * // => true
  32161. *
  32162. * _.isNaN(undefined);
  32163. * // => false
  32164. */
  32165. function isNaN(value) {
  32166. // An `NaN` primitive is the only value that is not equal to itself.
  32167. // Perform the `toStringTag` check first to avoid errors with some
  32168. // ActiveX objects in IE.
  32169. return isNumber(value) && value != +value;
  32170. }
  32171. /**
  32172. * Checks if `value` is a pristine native function.
  32173. *
  32174. * **Note:** This method can't reliably detect native functions in the presence
  32175. * of the core-js package because core-js circumvents this kind of detection.
  32176. * Despite multiple requests, the core-js maintainer has made it clear: any
  32177. * attempt to fix the detection will be obstructed. As a result, we're left
  32178. * with little choice but to throw an error. Unfortunately, this also affects
  32179. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  32180. * which rely on core-js.
  32181. *
  32182. * @static
  32183. * @memberOf _
  32184. * @since 3.0.0
  32185. * @category Lang
  32186. * @param {*} value The value to check.
  32187. * @returns {boolean} Returns `true` if `value` is a native function,
  32188. * else `false`.
  32189. * @example
  32190. *
  32191. * _.isNative(Array.prototype.push);
  32192. * // => true
  32193. *
  32194. * _.isNative(_);
  32195. * // => false
  32196. */
  32197. function isNative(value) {
  32198. if (isMaskable(value)) {
  32199. throw new Error(CORE_ERROR_TEXT);
  32200. }
  32201. return baseIsNative(value);
  32202. }
  32203. /**
  32204. * Checks if `value` is `null`.
  32205. *
  32206. * @static
  32207. * @memberOf _
  32208. * @since 0.1.0
  32209. * @category Lang
  32210. * @param {*} value The value to check.
  32211. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  32212. * @example
  32213. *
  32214. * _.isNull(null);
  32215. * // => true
  32216. *
  32217. * _.isNull(void 0);
  32218. * // => false
  32219. */
  32220. function isNull(value) {
  32221. return value === null;
  32222. }
  32223. /**
  32224. * Checks if `value` is `null` or `undefined`.
  32225. *
  32226. * @static
  32227. * @memberOf _
  32228. * @since 4.0.0
  32229. * @category Lang
  32230. * @param {*} value The value to check.
  32231. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  32232. * @example
  32233. *
  32234. * _.isNil(null);
  32235. * // => true
  32236. *
  32237. * _.isNil(void 0);
  32238. * // => true
  32239. *
  32240. * _.isNil(NaN);
  32241. * // => false
  32242. */
  32243. function isNil(value) {
  32244. return value == null;
  32245. }
  32246. /**
  32247. * Checks if `value` is classified as a `Number` primitive or object.
  32248. *
  32249. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  32250. * classified as numbers, use the `_.isFinite` method.
  32251. *
  32252. * @static
  32253. * @memberOf _
  32254. * @since 0.1.0
  32255. * @category Lang
  32256. * @param {*} value The value to check.
  32257. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  32258. * @example
  32259. *
  32260. * _.isNumber(3);
  32261. * // => true
  32262. *
  32263. * _.isNumber(Number.MIN_VALUE);
  32264. * // => true
  32265. *
  32266. * _.isNumber(Infinity);
  32267. * // => true
  32268. *
  32269. * _.isNumber('3');
  32270. * // => false
  32271. */
  32272. function isNumber(value) {
  32273. return typeof value == 'number' ||
  32274. (isObjectLike(value) && baseGetTag(value) == numberTag);
  32275. }
  32276. /**
  32277. * Checks if `value` is a plain object, that is, an object created by the
  32278. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  32279. *
  32280. * @static
  32281. * @memberOf _
  32282. * @since 0.8.0
  32283. * @category Lang
  32284. * @param {*} value The value to check.
  32285. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  32286. * @example
  32287. *
  32288. * function Foo() {
  32289. * this.a = 1;
  32290. * }
  32291. *
  32292. * _.isPlainObject(new Foo);
  32293. * // => false
  32294. *
  32295. * _.isPlainObject([1, 2, 3]);
  32296. * // => false
  32297. *
  32298. * _.isPlainObject({ 'x': 0, 'y': 0 });
  32299. * // => true
  32300. *
  32301. * _.isPlainObject(Object.create(null));
  32302. * // => true
  32303. */
  32304. function isPlainObject(value) {
  32305. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  32306. return false;
  32307. }
  32308. var proto = getPrototype(value);
  32309. if (proto === null) {
  32310. return true;
  32311. }
  32312. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  32313. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  32314. funcToString.call(Ctor) == objectCtorString;
  32315. }
  32316. /**
  32317. * Checks if `value` is classified as a `RegExp` object.
  32318. *
  32319. * @static
  32320. * @memberOf _
  32321. * @since 0.1.0
  32322. * @category Lang
  32323. * @param {*} value The value to check.
  32324. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  32325. * @example
  32326. *
  32327. * _.isRegExp(/abc/);
  32328. * // => true
  32329. *
  32330. * _.isRegExp('/abc/');
  32331. * // => false
  32332. */
  32333. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  32334. /**
  32335. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  32336. * double precision number which isn't the result of a rounded unsafe integer.
  32337. *
  32338. * **Note:** This method is based on
  32339. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  32340. *
  32341. * @static
  32342. * @memberOf _
  32343. * @since 4.0.0
  32344. * @category Lang
  32345. * @param {*} value The value to check.
  32346. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  32347. * @example
  32348. *
  32349. * _.isSafeInteger(3);
  32350. * // => true
  32351. *
  32352. * _.isSafeInteger(Number.MIN_VALUE);
  32353. * // => false
  32354. *
  32355. * _.isSafeInteger(Infinity);
  32356. * // => false
  32357. *
  32358. * _.isSafeInteger('3');
  32359. * // => false
  32360. */
  32361. function isSafeInteger(value) {
  32362. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  32363. }
  32364. /**
  32365. * Checks if `value` is classified as a `Set` object.
  32366. *
  32367. * @static
  32368. * @memberOf _
  32369. * @since 4.3.0
  32370. * @category Lang
  32371. * @param {*} value The value to check.
  32372. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  32373. * @example
  32374. *
  32375. * _.isSet(new Set);
  32376. * // => true
  32377. *
  32378. * _.isSet(new WeakSet);
  32379. * // => false
  32380. */
  32381. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  32382. /**
  32383. * Checks if `value` is classified as a `String` primitive or object.
  32384. *
  32385. * @static
  32386. * @since 0.1.0
  32387. * @memberOf _
  32388. * @category Lang
  32389. * @param {*} value The value to check.
  32390. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  32391. * @example
  32392. *
  32393. * _.isString('abc');
  32394. * // => true
  32395. *
  32396. * _.isString(1);
  32397. * // => false
  32398. */
  32399. function isString(value) {
  32400. return typeof value == 'string' ||
  32401. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  32402. }
  32403. /**
  32404. * Checks if `value` is classified as a `Symbol` primitive or object.
  32405. *
  32406. * @static
  32407. * @memberOf _
  32408. * @since 4.0.0
  32409. * @category Lang
  32410. * @param {*} value The value to check.
  32411. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  32412. * @example
  32413. *
  32414. * _.isSymbol(Symbol.iterator);
  32415. * // => true
  32416. *
  32417. * _.isSymbol('abc');
  32418. * // => false
  32419. */
  32420. function isSymbol(value) {
  32421. return typeof value == 'symbol' ||
  32422. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  32423. }
  32424. /**
  32425. * Checks if `value` is classified as a typed array.
  32426. *
  32427. * @static
  32428. * @memberOf _
  32429. * @since 3.0.0
  32430. * @category Lang
  32431. * @param {*} value The value to check.
  32432. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  32433. * @example
  32434. *
  32435. * _.isTypedArray(new Uint8Array);
  32436. * // => true
  32437. *
  32438. * _.isTypedArray([]);
  32439. * // => false
  32440. */
  32441. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  32442. /**
  32443. * Checks if `value` is `undefined`.
  32444. *
  32445. * @static
  32446. * @since 0.1.0
  32447. * @memberOf _
  32448. * @category Lang
  32449. * @param {*} value The value to check.
  32450. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  32451. * @example
  32452. *
  32453. * _.isUndefined(void 0);
  32454. * // => true
  32455. *
  32456. * _.isUndefined(null);
  32457. * // => false
  32458. */
  32459. function isUndefined(value) {
  32460. return value === undefined;
  32461. }
  32462. /**
  32463. * Checks if `value` is classified as a `WeakMap` object.
  32464. *
  32465. * @static
  32466. * @memberOf _
  32467. * @since 4.3.0
  32468. * @category Lang
  32469. * @param {*} value The value to check.
  32470. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  32471. * @example
  32472. *
  32473. * _.isWeakMap(new WeakMap);
  32474. * // => true
  32475. *
  32476. * _.isWeakMap(new Map);
  32477. * // => false
  32478. */
  32479. function isWeakMap(value) {
  32480. return isObjectLike(value) && getTag(value) == weakMapTag;
  32481. }
  32482. /**
  32483. * Checks if `value` is classified as a `WeakSet` object.
  32484. *
  32485. * @static
  32486. * @memberOf _
  32487. * @since 4.3.0
  32488. * @category Lang
  32489. * @param {*} value The value to check.
  32490. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  32491. * @example
  32492. *
  32493. * _.isWeakSet(new WeakSet);
  32494. * // => true
  32495. *
  32496. * _.isWeakSet(new Set);
  32497. * // => false
  32498. */
  32499. function isWeakSet(value) {
  32500. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  32501. }
  32502. /**
  32503. * Checks if `value` is less than `other`.
  32504. *
  32505. * @static
  32506. * @memberOf _
  32507. * @since 3.9.0
  32508. * @category Lang
  32509. * @param {*} value The value to compare.
  32510. * @param {*} other The other value to compare.
  32511. * @returns {boolean} Returns `true` if `value` is less than `other`,
  32512. * else `false`.
  32513. * @see _.gt
  32514. * @example
  32515. *
  32516. * _.lt(1, 3);
  32517. * // => true
  32518. *
  32519. * _.lt(3, 3);
  32520. * // => false
  32521. *
  32522. * _.lt(3, 1);
  32523. * // => false
  32524. */
  32525. var lt = createRelationalOperation(baseLt);
  32526. /**
  32527. * Checks if `value` is less than or equal to `other`.
  32528. *
  32529. * @static
  32530. * @memberOf _
  32531. * @since 3.9.0
  32532. * @category Lang
  32533. * @param {*} value The value to compare.
  32534. * @param {*} other The other value to compare.
  32535. * @returns {boolean} Returns `true` if `value` is less than or equal to
  32536. * `other`, else `false`.
  32537. * @see _.gte
  32538. * @example
  32539. *
  32540. * _.lte(1, 3);
  32541. * // => true
  32542. *
  32543. * _.lte(3, 3);
  32544. * // => true
  32545. *
  32546. * _.lte(3, 1);
  32547. * // => false
  32548. */
  32549. var lte = createRelationalOperation(function(value, other) {
  32550. return value <= other;
  32551. });
  32552. /**
  32553. * Converts `value` to an array.
  32554. *
  32555. * @static
  32556. * @since 0.1.0
  32557. * @memberOf _
  32558. * @category Lang
  32559. * @param {*} value The value to convert.
  32560. * @returns {Array} Returns the converted array.
  32561. * @example
  32562. *
  32563. * _.toArray({ 'a': 1, 'b': 2 });
  32564. * // => [1, 2]
  32565. *
  32566. * _.toArray('abc');
  32567. * // => ['a', 'b', 'c']
  32568. *
  32569. * _.toArray(1);
  32570. * // => []
  32571. *
  32572. * _.toArray(null);
  32573. * // => []
  32574. */
  32575. function toArray(value) {
  32576. if (!value) {
  32577. return [];
  32578. }
  32579. if (isArrayLike(value)) {
  32580. return isString(value) ? stringToArray(value) : copyArray(value);
  32581. }
  32582. if (symIterator && value[symIterator]) {
  32583. return iteratorToArray(value[symIterator]());
  32584. }
  32585. var tag = getTag(value),
  32586. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  32587. return func(value);
  32588. }
  32589. /**
  32590. * Converts `value` to a finite number.
  32591. *
  32592. * @static
  32593. * @memberOf _
  32594. * @since 4.12.0
  32595. * @category Lang
  32596. * @param {*} value The value to convert.
  32597. * @returns {number} Returns the converted number.
  32598. * @example
  32599. *
  32600. * _.toFinite(3.2);
  32601. * // => 3.2
  32602. *
  32603. * _.toFinite(Number.MIN_VALUE);
  32604. * // => 5e-324
  32605. *
  32606. * _.toFinite(Infinity);
  32607. * // => 1.7976931348623157e+308
  32608. *
  32609. * _.toFinite('3.2');
  32610. * // => 3.2
  32611. */
  32612. function toFinite(value) {
  32613. if (!value) {
  32614. return value === 0 ? value : 0;
  32615. }
  32616. value = toNumber(value);
  32617. if (value === INFINITY || value === -INFINITY) {
  32618. var sign = (value < 0 ? -1 : 1);
  32619. return sign * MAX_INTEGER;
  32620. }
  32621. return value === value ? value : 0;
  32622. }
  32623. /**
  32624. * Converts `value` to an integer.
  32625. *
  32626. * **Note:** This method is loosely based on
  32627. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  32628. *
  32629. * @static
  32630. * @memberOf _
  32631. * @since 4.0.0
  32632. * @category Lang
  32633. * @param {*} value The value to convert.
  32634. * @returns {number} Returns the converted integer.
  32635. * @example
  32636. *
  32637. * _.toInteger(3.2);
  32638. * // => 3
  32639. *
  32640. * _.toInteger(Number.MIN_VALUE);
  32641. * // => 0
  32642. *
  32643. * _.toInteger(Infinity);
  32644. * // => 1.7976931348623157e+308
  32645. *
  32646. * _.toInteger('3.2');
  32647. * // => 3
  32648. */
  32649. function toInteger(value) {
  32650. var result = toFinite(value),
  32651. remainder = result % 1;
  32652. return result === result ? (remainder ? result - remainder : result) : 0;
  32653. }
  32654. /**
  32655. * Converts `value` to an integer suitable for use as the length of an
  32656. * array-like object.
  32657. *
  32658. * **Note:** This method is based on
  32659. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  32660. *
  32661. * @static
  32662. * @memberOf _
  32663. * @since 4.0.0
  32664. * @category Lang
  32665. * @param {*} value The value to convert.
  32666. * @returns {number} Returns the converted integer.
  32667. * @example
  32668. *
  32669. * _.toLength(3.2);
  32670. * // => 3
  32671. *
  32672. * _.toLength(Number.MIN_VALUE);
  32673. * // => 0
  32674. *
  32675. * _.toLength(Infinity);
  32676. * // => 4294967295
  32677. *
  32678. * _.toLength('3.2');
  32679. * // => 3
  32680. */
  32681. function toLength(value) {
  32682. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  32683. }
  32684. /**
  32685. * Converts `value` to a number.
  32686. *
  32687. * @static
  32688. * @memberOf _
  32689. * @since 4.0.0
  32690. * @category Lang
  32691. * @param {*} value The value to process.
  32692. * @returns {number} Returns the number.
  32693. * @example
  32694. *
  32695. * _.toNumber(3.2);
  32696. * // => 3.2
  32697. *
  32698. * _.toNumber(Number.MIN_VALUE);
  32699. * // => 5e-324
  32700. *
  32701. * _.toNumber(Infinity);
  32702. * // => Infinity
  32703. *
  32704. * _.toNumber('3.2');
  32705. * // => 3.2
  32706. */
  32707. function toNumber(value) {
  32708. if (typeof value == 'number') {
  32709. return value;
  32710. }
  32711. if (isSymbol(value)) {
  32712. return NAN;
  32713. }
  32714. if (isObject(value)) {
  32715. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  32716. value = isObject(other) ? (other + '') : other;
  32717. }
  32718. if (typeof value != 'string') {
  32719. return value === 0 ? value : +value;
  32720. }
  32721. value = value.replace(reTrim, '');
  32722. var isBinary = reIsBinary.test(value);
  32723. return (isBinary || reIsOctal.test(value))
  32724. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  32725. : (reIsBadHex.test(value) ? NAN : +value);
  32726. }
  32727. /**
  32728. * Converts `value` to a plain object flattening inherited enumerable string
  32729. * keyed properties of `value` to own properties of the plain object.
  32730. *
  32731. * @static
  32732. * @memberOf _
  32733. * @since 3.0.0
  32734. * @category Lang
  32735. * @param {*} value The value to convert.
  32736. * @returns {Object} Returns the converted plain object.
  32737. * @example
  32738. *
  32739. * function Foo() {
  32740. * this.b = 2;
  32741. * }
  32742. *
  32743. * Foo.prototype.c = 3;
  32744. *
  32745. * _.assign({ 'a': 1 }, new Foo);
  32746. * // => { 'a': 1, 'b': 2 }
  32747. *
  32748. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  32749. * // => { 'a': 1, 'b': 2, 'c': 3 }
  32750. */
  32751. function toPlainObject(value) {
  32752. return copyObject(value, keysIn(value));
  32753. }
  32754. /**
  32755. * Converts `value` to a safe integer. A safe integer can be compared and
  32756. * represented correctly.
  32757. *
  32758. * @static
  32759. * @memberOf _
  32760. * @since 4.0.0
  32761. * @category Lang
  32762. * @param {*} value The value to convert.
  32763. * @returns {number} Returns the converted integer.
  32764. * @example
  32765. *
  32766. * _.toSafeInteger(3.2);
  32767. * // => 3
  32768. *
  32769. * _.toSafeInteger(Number.MIN_VALUE);
  32770. * // => 0
  32771. *
  32772. * _.toSafeInteger(Infinity);
  32773. * // => 9007199254740991
  32774. *
  32775. * _.toSafeInteger('3.2');
  32776. * // => 3
  32777. */
  32778. function toSafeInteger(value) {
  32779. return value
  32780. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  32781. : (value === 0 ? value : 0);
  32782. }
  32783. /**
  32784. * Converts `value` to a string. An empty string is returned for `null`
  32785. * and `undefined` values. The sign of `-0` is preserved.
  32786. *
  32787. * @static
  32788. * @memberOf _
  32789. * @since 4.0.0
  32790. * @category Lang
  32791. * @param {*} value The value to convert.
  32792. * @returns {string} Returns the converted string.
  32793. * @example
  32794. *
  32795. * _.toString(null);
  32796. * // => ''
  32797. *
  32798. * _.toString(-0);
  32799. * // => '-0'
  32800. *
  32801. * _.toString([1, 2, 3]);
  32802. * // => '1,2,3'
  32803. */
  32804. function toString(value) {
  32805. return value == null ? '' : baseToString(value);
  32806. }
  32807. /*------------------------------------------------------------------------*/
  32808. /**
  32809. * Assigns own enumerable string keyed properties of source objects to the
  32810. * destination object. Source objects are applied from left to right.
  32811. * Subsequent sources overwrite property assignments of previous sources.
  32812. *
  32813. * **Note:** This method mutates `object` and is loosely based on
  32814. * [`Object.assign`](https://mdn.io/Object/assign).
  32815. *
  32816. * @static
  32817. * @memberOf _
  32818. * @since 0.10.0
  32819. * @category Object
  32820. * @param {Object} object The destination object.
  32821. * @param {...Object} [sources] The source objects.
  32822. * @returns {Object} Returns `object`.
  32823. * @see _.assignIn
  32824. * @example
  32825. *
  32826. * function Foo() {
  32827. * this.a = 1;
  32828. * }
  32829. *
  32830. * function Bar() {
  32831. * this.c = 3;
  32832. * }
  32833. *
  32834. * Foo.prototype.b = 2;
  32835. * Bar.prototype.d = 4;
  32836. *
  32837. * _.assign({ 'a': 0 }, new Foo, new Bar);
  32838. * // => { 'a': 1, 'c': 3 }
  32839. */
  32840. var assign = createAssigner(function(object, source) {
  32841. if (isPrototype(source) || isArrayLike(source)) {
  32842. copyObject(source, keys(source), object);
  32843. return;
  32844. }
  32845. for (var key in source) {
  32846. if (hasOwnProperty.call(source, key)) {
  32847. assignValue(object, key, source[key]);
  32848. }
  32849. }
  32850. });
  32851. /**
  32852. * This method is like `_.assign` except that it iterates over own and
  32853. * inherited source properties.
  32854. *
  32855. * **Note:** This method mutates `object`.
  32856. *
  32857. * @static
  32858. * @memberOf _
  32859. * @since 4.0.0
  32860. * @alias extend
  32861. * @category Object
  32862. * @param {Object} object The destination object.
  32863. * @param {...Object} [sources] The source objects.
  32864. * @returns {Object} Returns `object`.
  32865. * @see _.assign
  32866. * @example
  32867. *
  32868. * function Foo() {
  32869. * this.a = 1;
  32870. * }
  32871. *
  32872. * function Bar() {
  32873. * this.c = 3;
  32874. * }
  32875. *
  32876. * Foo.prototype.b = 2;
  32877. * Bar.prototype.d = 4;
  32878. *
  32879. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  32880. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  32881. */
  32882. var assignIn = createAssigner(function(object, source) {
  32883. copyObject(source, keysIn(source), object);
  32884. });
  32885. /**
  32886. * This method is like `_.assignIn` except that it accepts `customizer`
  32887. * which is invoked to produce the assigned values. If `customizer` returns
  32888. * `undefined`, assignment is handled by the method instead. The `customizer`
  32889. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  32890. *
  32891. * **Note:** This method mutates `object`.
  32892. *
  32893. * @static
  32894. * @memberOf _
  32895. * @since 4.0.0
  32896. * @alias extendWith
  32897. * @category Object
  32898. * @param {Object} object The destination object.
  32899. * @param {...Object} sources The source objects.
  32900. * @param {Function} [customizer] The function to customize assigned values.
  32901. * @returns {Object} Returns `object`.
  32902. * @see _.assignWith
  32903. * @example
  32904. *
  32905. * function customizer(objValue, srcValue) {
  32906. * return _.isUndefined(objValue) ? srcValue : objValue;
  32907. * }
  32908. *
  32909. * var defaults = _.partialRight(_.assignInWith, customizer);
  32910. *
  32911. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  32912. * // => { 'a': 1, 'b': 2 }
  32913. */
  32914. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  32915. copyObject(source, keysIn(source), object, customizer);
  32916. });
  32917. /**
  32918. * This method is like `_.assign` except that it accepts `customizer`
  32919. * which is invoked to produce the assigned values. If `customizer` returns
  32920. * `undefined`, assignment is handled by the method instead. The `customizer`
  32921. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  32922. *
  32923. * **Note:** This method mutates `object`.
  32924. *
  32925. * @static
  32926. * @memberOf _
  32927. * @since 4.0.0
  32928. * @category Object
  32929. * @param {Object} object The destination object.
  32930. * @param {...Object} sources The source objects.
  32931. * @param {Function} [customizer] The function to customize assigned values.
  32932. * @returns {Object} Returns `object`.
  32933. * @see _.assignInWith
  32934. * @example
  32935. *
  32936. * function customizer(objValue, srcValue) {
  32937. * return _.isUndefined(objValue) ? srcValue : objValue;
  32938. * }
  32939. *
  32940. * var defaults = _.partialRight(_.assignWith, customizer);
  32941. *
  32942. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  32943. * // => { 'a': 1, 'b': 2 }
  32944. */
  32945. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  32946. copyObject(source, keys(source), object, customizer);
  32947. });
  32948. /**
  32949. * Creates an array of values corresponding to `paths` of `object`.
  32950. *
  32951. * @static
  32952. * @memberOf _
  32953. * @since 1.0.0
  32954. * @category Object
  32955. * @param {Object} object The object to iterate over.
  32956. * @param {...(string|string[])} [paths] The property paths to pick.
  32957. * @returns {Array} Returns the picked values.
  32958. * @example
  32959. *
  32960. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  32961. *
  32962. * _.at(object, ['a[0].b.c', 'a[1]']);
  32963. * // => [3, 4]
  32964. */
  32965. var at = flatRest(baseAt);
  32966. /**
  32967. * Creates an object that inherits from the `prototype` object. If a
  32968. * `properties` object is given, its own enumerable string keyed properties
  32969. * are assigned to the created object.
  32970. *
  32971. * @static
  32972. * @memberOf _
  32973. * @since 2.3.0
  32974. * @category Object
  32975. * @param {Object} prototype The object to inherit from.
  32976. * @param {Object} [properties] The properties to assign to the object.
  32977. * @returns {Object} Returns the new object.
  32978. * @example
  32979. *
  32980. * function Shape() {
  32981. * this.x = 0;
  32982. * this.y = 0;
  32983. * }
  32984. *
  32985. * function Circle() {
  32986. * Shape.call(this);
  32987. * }
  32988. *
  32989. * Circle.prototype = _.create(Shape.prototype, {
  32990. * 'constructor': Circle
  32991. * });
  32992. *
  32993. * var circle = new Circle;
  32994. * circle instanceof Circle;
  32995. * // => true
  32996. *
  32997. * circle instanceof Shape;
  32998. * // => true
  32999. */
  33000. function create(prototype, properties) {
  33001. var result = baseCreate(prototype);
  33002. return properties == null ? result : baseAssign(result, properties);
  33003. }
  33004. /**
  33005. * Assigns own and inherited enumerable string keyed properties of source
  33006. * objects to the destination object for all destination properties that
  33007. * resolve to `undefined`. Source objects are applied from left to right.
  33008. * Once a property is set, additional values of the same property are ignored.
  33009. *
  33010. * **Note:** This method mutates `object`.
  33011. *
  33012. * @static
  33013. * @since 0.1.0
  33014. * @memberOf _
  33015. * @category Object
  33016. * @param {Object} object The destination object.
  33017. * @param {...Object} [sources] The source objects.
  33018. * @returns {Object} Returns `object`.
  33019. * @see _.defaultsDeep
  33020. * @example
  33021. *
  33022. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  33023. * // => { 'a': 1, 'b': 2 }
  33024. */
  33025. var defaults = baseRest(function(object, sources) {
  33026. object = Object(object);
  33027. var index = -1;
  33028. var length = sources.length;
  33029. var guard = length > 2 ? sources[2] : undefined;
  33030. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  33031. length = 1;
  33032. }
  33033. while (++index < length) {
  33034. var source = sources[index];
  33035. var props = keysIn(source);
  33036. var propsIndex = -1;
  33037. var propsLength = props.length;
  33038. while (++propsIndex < propsLength) {
  33039. var key = props[propsIndex];
  33040. var value = object[key];
  33041. if (value === undefined ||
  33042. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  33043. object[key] = source[key];
  33044. }
  33045. }
  33046. }
  33047. return object;
  33048. });
  33049. /**
  33050. * This method is like `_.defaults` except that it recursively assigns
  33051. * default properties.
  33052. *
  33053. * **Note:** This method mutates `object`.
  33054. *
  33055. * @static
  33056. * @memberOf _
  33057. * @since 3.10.0
  33058. * @category Object
  33059. * @param {Object} object The destination object.
  33060. * @param {...Object} [sources] The source objects.
  33061. * @returns {Object} Returns `object`.
  33062. * @see _.defaults
  33063. * @example
  33064. *
  33065. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  33066. * // => { 'a': { 'b': 2, 'c': 3 } }
  33067. */
  33068. var defaultsDeep = baseRest(function(args) {
  33069. args.push(undefined, customDefaultsMerge);
  33070. return apply(mergeWith, undefined, args);
  33071. });
  33072. /**
  33073. * This method is like `_.find` except that it returns the key of the first
  33074. * element `predicate` returns truthy for instead of the element itself.
  33075. *
  33076. * @static
  33077. * @memberOf _
  33078. * @since 1.1.0
  33079. * @category Object
  33080. * @param {Object} object The object to inspect.
  33081. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  33082. * @returns {string|undefined} Returns the key of the matched element,
  33083. * else `undefined`.
  33084. * @example
  33085. *
  33086. * var users = {
  33087. * 'barney': { 'age': 36, 'active': true },
  33088. * 'fred': { 'age': 40, 'active': false },
  33089. * 'pebbles': { 'age': 1, 'active': true }
  33090. * };
  33091. *
  33092. * _.findKey(users, function(o) { return o.age < 40; });
  33093. * // => 'barney' (iteration order is not guaranteed)
  33094. *
  33095. * // The `_.matches` iteratee shorthand.
  33096. * _.findKey(users, { 'age': 1, 'active': true });
  33097. * // => 'pebbles'
  33098. *
  33099. * // The `_.matchesProperty` iteratee shorthand.
  33100. * _.findKey(users, ['active', false]);
  33101. * // => 'fred'
  33102. *
  33103. * // The `_.property` iteratee shorthand.
  33104. * _.findKey(users, 'active');
  33105. * // => 'barney'
  33106. */
  33107. function findKey(object, predicate) {
  33108. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  33109. }
  33110. /**
  33111. * This method is like `_.findKey` except that it iterates over elements of
  33112. * a collection in the opposite order.
  33113. *
  33114. * @static
  33115. * @memberOf _
  33116. * @since 2.0.0
  33117. * @category Object
  33118. * @param {Object} object The object to inspect.
  33119. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  33120. * @returns {string|undefined} Returns the key of the matched element,
  33121. * else `undefined`.
  33122. * @example
  33123. *
  33124. * var users = {
  33125. * 'barney': { 'age': 36, 'active': true },
  33126. * 'fred': { 'age': 40, 'active': false },
  33127. * 'pebbles': { 'age': 1, 'active': true }
  33128. * };
  33129. *
  33130. * _.findLastKey(users, function(o) { return o.age < 40; });
  33131. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  33132. *
  33133. * // The `_.matches` iteratee shorthand.
  33134. * _.findLastKey(users, { 'age': 36, 'active': true });
  33135. * // => 'barney'
  33136. *
  33137. * // The `_.matchesProperty` iteratee shorthand.
  33138. * _.findLastKey(users, ['active', false]);
  33139. * // => 'fred'
  33140. *
  33141. * // The `_.property` iteratee shorthand.
  33142. * _.findLastKey(users, 'active');
  33143. * // => 'pebbles'
  33144. */
  33145. function findLastKey(object, predicate) {
  33146. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  33147. }
  33148. /**
  33149. * Iterates over own and inherited enumerable string keyed properties of an
  33150. * object and invokes `iteratee` for each property. The iteratee is invoked
  33151. * with three arguments: (value, key, object). Iteratee functions may exit
  33152. * iteration early by explicitly returning `false`.
  33153. *
  33154. * @static
  33155. * @memberOf _
  33156. * @since 0.3.0
  33157. * @category Object
  33158. * @param {Object} object The object to iterate over.
  33159. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33160. * @returns {Object} Returns `object`.
  33161. * @see _.forInRight
  33162. * @example
  33163. *
  33164. * function Foo() {
  33165. * this.a = 1;
  33166. * this.b = 2;
  33167. * }
  33168. *
  33169. * Foo.prototype.c = 3;
  33170. *
  33171. * _.forIn(new Foo, function(value, key) {
  33172. * console.log(key);
  33173. * });
  33174. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  33175. */
  33176. function forIn(object, iteratee) {
  33177. return object == null
  33178. ? object
  33179. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  33180. }
  33181. /**
  33182. * This method is like `_.forIn` except that it iterates over properties of
  33183. * `object` in the opposite order.
  33184. *
  33185. * @static
  33186. * @memberOf _
  33187. * @since 2.0.0
  33188. * @category Object
  33189. * @param {Object} object The object to iterate over.
  33190. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33191. * @returns {Object} Returns `object`.
  33192. * @see _.forIn
  33193. * @example
  33194. *
  33195. * function Foo() {
  33196. * this.a = 1;
  33197. * this.b = 2;
  33198. * }
  33199. *
  33200. * Foo.prototype.c = 3;
  33201. *
  33202. * _.forInRight(new Foo, function(value, key) {
  33203. * console.log(key);
  33204. * });
  33205. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  33206. */
  33207. function forInRight(object, iteratee) {
  33208. return object == null
  33209. ? object
  33210. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  33211. }
  33212. /**
  33213. * Iterates over own enumerable string keyed properties of an object and
  33214. * invokes `iteratee` for each property. The iteratee is invoked with three
  33215. * arguments: (value, key, object). Iteratee functions may exit iteration
  33216. * early by explicitly returning `false`.
  33217. *
  33218. * @static
  33219. * @memberOf _
  33220. * @since 0.3.0
  33221. * @category Object
  33222. * @param {Object} object The object to iterate over.
  33223. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33224. * @returns {Object} Returns `object`.
  33225. * @see _.forOwnRight
  33226. * @example
  33227. *
  33228. * function Foo() {
  33229. * this.a = 1;
  33230. * this.b = 2;
  33231. * }
  33232. *
  33233. * Foo.prototype.c = 3;
  33234. *
  33235. * _.forOwn(new Foo, function(value, key) {
  33236. * console.log(key);
  33237. * });
  33238. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  33239. */
  33240. function forOwn(object, iteratee) {
  33241. return object && baseForOwn(object, getIteratee(iteratee, 3));
  33242. }
  33243. /**
  33244. * This method is like `_.forOwn` except that it iterates over properties of
  33245. * `object` in the opposite order.
  33246. *
  33247. * @static
  33248. * @memberOf _
  33249. * @since 2.0.0
  33250. * @category Object
  33251. * @param {Object} object The object to iterate over.
  33252. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33253. * @returns {Object} Returns `object`.
  33254. * @see _.forOwn
  33255. * @example
  33256. *
  33257. * function Foo() {
  33258. * this.a = 1;
  33259. * this.b = 2;
  33260. * }
  33261. *
  33262. * Foo.prototype.c = 3;
  33263. *
  33264. * _.forOwnRight(new Foo, function(value, key) {
  33265. * console.log(key);
  33266. * });
  33267. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  33268. */
  33269. function forOwnRight(object, iteratee) {
  33270. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  33271. }
  33272. /**
  33273. * Creates an array of function property names from own enumerable properties
  33274. * of `object`.
  33275. *
  33276. * @static
  33277. * @since 0.1.0
  33278. * @memberOf _
  33279. * @category Object
  33280. * @param {Object} object The object to inspect.
  33281. * @returns {Array} Returns the function names.
  33282. * @see _.functionsIn
  33283. * @example
  33284. *
  33285. * function Foo() {
  33286. * this.a = _.constant('a');
  33287. * this.b = _.constant('b');
  33288. * }
  33289. *
  33290. * Foo.prototype.c = _.constant('c');
  33291. *
  33292. * _.functions(new Foo);
  33293. * // => ['a', 'b']
  33294. */
  33295. function functions(object) {
  33296. return object == null ? [] : baseFunctions(object, keys(object));
  33297. }
  33298. /**
  33299. * Creates an array of function property names from own and inherited
  33300. * enumerable properties of `object`.
  33301. *
  33302. * @static
  33303. * @memberOf _
  33304. * @since 4.0.0
  33305. * @category Object
  33306. * @param {Object} object The object to inspect.
  33307. * @returns {Array} Returns the function names.
  33308. * @see _.functions
  33309. * @example
  33310. *
  33311. * function Foo() {
  33312. * this.a = _.constant('a');
  33313. * this.b = _.constant('b');
  33314. * }
  33315. *
  33316. * Foo.prototype.c = _.constant('c');
  33317. *
  33318. * _.functionsIn(new Foo);
  33319. * // => ['a', 'b', 'c']
  33320. */
  33321. function functionsIn(object) {
  33322. return object == null ? [] : baseFunctions(object, keysIn(object));
  33323. }
  33324. /**
  33325. * Gets the value at `path` of `object`. If the resolved value is
  33326. * `undefined`, the `defaultValue` is returned in its place.
  33327. *
  33328. * @static
  33329. * @memberOf _
  33330. * @since 3.7.0
  33331. * @category Object
  33332. * @param {Object} object The object to query.
  33333. * @param {Array|string} path The path of the property to get.
  33334. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  33335. * @returns {*} Returns the resolved value.
  33336. * @example
  33337. *
  33338. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  33339. *
  33340. * _.get(object, 'a[0].b.c');
  33341. * // => 3
  33342. *
  33343. * _.get(object, ['a', '0', 'b', 'c']);
  33344. * // => 3
  33345. *
  33346. * _.get(object, 'a.b.c', 'default');
  33347. * // => 'default'
  33348. */
  33349. function get(object, path, defaultValue) {
  33350. var result = object == null ? undefined : baseGet(object, path);
  33351. return result === undefined ? defaultValue : result;
  33352. }
  33353. /**
  33354. * Checks if `path` is a direct property of `object`.
  33355. *
  33356. * @static
  33357. * @since 0.1.0
  33358. * @memberOf _
  33359. * @category Object
  33360. * @param {Object} object The object to query.
  33361. * @param {Array|string} path The path to check.
  33362. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  33363. * @example
  33364. *
  33365. * var object = { 'a': { 'b': 2 } };
  33366. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  33367. *
  33368. * _.has(object, 'a');
  33369. * // => true
  33370. *
  33371. * _.has(object, 'a.b');
  33372. * // => true
  33373. *
  33374. * _.has(object, ['a', 'b']);
  33375. * // => true
  33376. *
  33377. * _.has(other, 'a');
  33378. * // => false
  33379. */
  33380. function has(object, path) {
  33381. return object != null && hasPath(object, path, baseHas);
  33382. }
  33383. /**
  33384. * Checks if `path` is a direct or inherited property of `object`.
  33385. *
  33386. * @static
  33387. * @memberOf _
  33388. * @since 4.0.0
  33389. * @category Object
  33390. * @param {Object} object The object to query.
  33391. * @param {Array|string} path The path to check.
  33392. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  33393. * @example
  33394. *
  33395. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  33396. *
  33397. * _.hasIn(object, 'a');
  33398. * // => true
  33399. *
  33400. * _.hasIn(object, 'a.b');
  33401. * // => true
  33402. *
  33403. * _.hasIn(object, ['a', 'b']);
  33404. * // => true
  33405. *
  33406. * _.hasIn(object, 'b');
  33407. * // => false
  33408. */
  33409. function hasIn(object, path) {
  33410. return object != null && hasPath(object, path, baseHasIn);
  33411. }
  33412. /**
  33413. * Creates an object composed of the inverted keys and values of `object`.
  33414. * If `object` contains duplicate values, subsequent values overwrite
  33415. * property assignments of previous values.
  33416. *
  33417. * @static
  33418. * @memberOf _
  33419. * @since 0.7.0
  33420. * @category Object
  33421. * @param {Object} object The object to invert.
  33422. * @returns {Object} Returns the new inverted object.
  33423. * @example
  33424. *
  33425. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  33426. *
  33427. * _.invert(object);
  33428. * // => { '1': 'c', '2': 'b' }
  33429. */
  33430. var invert = createInverter(function(result, value, key) {
  33431. if (value != null &&
  33432. typeof value.toString != 'function') {
  33433. value = nativeObjectToString.call(value);
  33434. }
  33435. result[value] = key;
  33436. }, constant(identity));
  33437. /**
  33438. * This method is like `_.invert` except that the inverted object is generated
  33439. * from the results of running each element of `object` thru `iteratee`. The
  33440. * corresponding inverted value of each inverted key is an array of keys
  33441. * responsible for generating the inverted value. The iteratee is invoked
  33442. * with one argument: (value).
  33443. *
  33444. * @static
  33445. * @memberOf _
  33446. * @since 4.1.0
  33447. * @category Object
  33448. * @param {Object} object The object to invert.
  33449. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33450. * @returns {Object} Returns the new inverted object.
  33451. * @example
  33452. *
  33453. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  33454. *
  33455. * _.invertBy(object);
  33456. * // => { '1': ['a', 'c'], '2': ['b'] }
  33457. *
  33458. * _.invertBy(object, function(value) {
  33459. * return 'group' + value;
  33460. * });
  33461. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  33462. */
  33463. var invertBy = createInverter(function(result, value, key) {
  33464. if (value != null &&
  33465. typeof value.toString != 'function') {
  33466. value = nativeObjectToString.call(value);
  33467. }
  33468. if (hasOwnProperty.call(result, value)) {
  33469. result[value].push(key);
  33470. } else {
  33471. result[value] = [key];
  33472. }
  33473. }, getIteratee);
  33474. /**
  33475. * Invokes the method at `path` of `object`.
  33476. *
  33477. * @static
  33478. * @memberOf _
  33479. * @since 4.0.0
  33480. * @category Object
  33481. * @param {Object} object The object to query.
  33482. * @param {Array|string} path The path of the method to invoke.
  33483. * @param {...*} [args] The arguments to invoke the method with.
  33484. * @returns {*} Returns the result of the invoked method.
  33485. * @example
  33486. *
  33487. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  33488. *
  33489. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  33490. * // => [2, 3]
  33491. */
  33492. var invoke = baseRest(baseInvoke);
  33493. /**
  33494. * Creates an array of the own enumerable property names of `object`.
  33495. *
  33496. * **Note:** Non-object values are coerced to objects. See the
  33497. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  33498. * for more details.
  33499. *
  33500. * @static
  33501. * @since 0.1.0
  33502. * @memberOf _
  33503. * @category Object
  33504. * @param {Object} object The object to query.
  33505. * @returns {Array} Returns the array of property names.
  33506. * @example
  33507. *
  33508. * function Foo() {
  33509. * this.a = 1;
  33510. * this.b = 2;
  33511. * }
  33512. *
  33513. * Foo.prototype.c = 3;
  33514. *
  33515. * _.keys(new Foo);
  33516. * // => ['a', 'b'] (iteration order is not guaranteed)
  33517. *
  33518. * _.keys('hi');
  33519. * // => ['0', '1']
  33520. */
  33521. function keys(object) {
  33522. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  33523. }
  33524. /**
  33525. * Creates an array of the own and inherited enumerable property names of `object`.
  33526. *
  33527. * **Note:** Non-object values are coerced to objects.
  33528. *
  33529. * @static
  33530. * @memberOf _
  33531. * @since 3.0.0
  33532. * @category Object
  33533. * @param {Object} object The object to query.
  33534. * @returns {Array} Returns the array of property names.
  33535. * @example
  33536. *
  33537. * function Foo() {
  33538. * this.a = 1;
  33539. * this.b = 2;
  33540. * }
  33541. *
  33542. * Foo.prototype.c = 3;
  33543. *
  33544. * _.keysIn(new Foo);
  33545. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  33546. */
  33547. function keysIn(object) {
  33548. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  33549. }
  33550. /**
  33551. * The opposite of `_.mapValues`; this method creates an object with the
  33552. * same values as `object` and keys generated by running each own enumerable
  33553. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  33554. * with three arguments: (value, key, object).
  33555. *
  33556. * @static
  33557. * @memberOf _
  33558. * @since 3.8.0
  33559. * @category Object
  33560. * @param {Object} object The object to iterate over.
  33561. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33562. * @returns {Object} Returns the new mapped object.
  33563. * @see _.mapValues
  33564. * @example
  33565. *
  33566. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  33567. * return key + value;
  33568. * });
  33569. * // => { 'a1': 1, 'b2': 2 }
  33570. */
  33571. function mapKeys(object, iteratee) {
  33572. var result = {};
  33573. iteratee = getIteratee(iteratee, 3);
  33574. baseForOwn(object, function(value, key, object) {
  33575. baseAssignValue(result, iteratee(value, key, object), value);
  33576. });
  33577. return result;
  33578. }
  33579. /**
  33580. * Creates an object with the same keys as `object` and values generated
  33581. * by running each own enumerable string keyed property of `object` thru
  33582. * `iteratee`. The iteratee is invoked with three arguments:
  33583. * (value, key, object).
  33584. *
  33585. * @static
  33586. * @memberOf _
  33587. * @since 2.4.0
  33588. * @category Object
  33589. * @param {Object} object The object to iterate over.
  33590. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33591. * @returns {Object} Returns the new mapped object.
  33592. * @see _.mapKeys
  33593. * @example
  33594. *
  33595. * var users = {
  33596. * 'fred': { 'user': 'fred', 'age': 40 },
  33597. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  33598. * };
  33599. *
  33600. * _.mapValues(users, function(o) { return o.age; });
  33601. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  33602. *
  33603. * // The `_.property` iteratee shorthand.
  33604. * _.mapValues(users, 'age');
  33605. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  33606. */
  33607. function mapValues(object, iteratee) {
  33608. var result = {};
  33609. iteratee = getIteratee(iteratee, 3);
  33610. baseForOwn(object, function(value, key, object) {
  33611. baseAssignValue(result, key, iteratee(value, key, object));
  33612. });
  33613. return result;
  33614. }
  33615. /**
  33616. * This method is like `_.assign` except that it recursively merges own and
  33617. * inherited enumerable string keyed properties of source objects into the
  33618. * destination object. Source properties that resolve to `undefined` are
  33619. * skipped if a destination value exists. Array and plain object properties
  33620. * are merged recursively. Other objects and value types are overridden by
  33621. * assignment. Source objects are applied from left to right. Subsequent
  33622. * sources overwrite property assignments of previous sources.
  33623. *
  33624. * **Note:** This method mutates `object`.
  33625. *
  33626. * @static
  33627. * @memberOf _
  33628. * @since 0.5.0
  33629. * @category Object
  33630. * @param {Object} object The destination object.
  33631. * @param {...Object} [sources] The source objects.
  33632. * @returns {Object} Returns `object`.
  33633. * @example
  33634. *
  33635. * var object = {
  33636. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  33637. * };
  33638. *
  33639. * var other = {
  33640. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  33641. * };
  33642. *
  33643. * _.merge(object, other);
  33644. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  33645. */
  33646. var merge = createAssigner(function(object, source, srcIndex) {
  33647. baseMerge(object, source, srcIndex);
  33648. });
  33649. /**
  33650. * This method is like `_.merge` except that it accepts `customizer` which
  33651. * is invoked to produce the merged values of the destination and source
  33652. * properties. If `customizer` returns `undefined`, merging is handled by the
  33653. * method instead. The `customizer` is invoked with six arguments:
  33654. * (objValue, srcValue, key, object, source, stack).
  33655. *
  33656. * **Note:** This method mutates `object`.
  33657. *
  33658. * @static
  33659. * @memberOf _
  33660. * @since 4.0.0
  33661. * @category Object
  33662. * @param {Object} object The destination object.
  33663. * @param {...Object} sources The source objects.
  33664. * @param {Function} customizer The function to customize assigned values.
  33665. * @returns {Object} Returns `object`.
  33666. * @example
  33667. *
  33668. * function customizer(objValue, srcValue) {
  33669. * if (_.isArray(objValue)) {
  33670. * return objValue.concat(srcValue);
  33671. * }
  33672. * }
  33673. *
  33674. * var object = { 'a': [1], 'b': [2] };
  33675. * var other = { 'a': [3], 'b': [4] };
  33676. *
  33677. * _.mergeWith(object, other, customizer);
  33678. * // => { 'a': [1, 3], 'b': [2, 4] }
  33679. */
  33680. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  33681. baseMerge(object, source, srcIndex, customizer);
  33682. });
  33683. /**
  33684. * The opposite of `_.pick`; this method creates an object composed of the
  33685. * own and inherited enumerable property paths of `object` that are not omitted.
  33686. *
  33687. * **Note:** This method is considerably slower than `_.pick`.
  33688. *
  33689. * @static
  33690. * @since 0.1.0
  33691. * @memberOf _
  33692. * @category Object
  33693. * @param {Object} object The source object.
  33694. * @param {...(string|string[])} [paths] The property paths to omit.
  33695. * @returns {Object} Returns the new object.
  33696. * @example
  33697. *
  33698. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  33699. *
  33700. * _.omit(object, ['a', 'c']);
  33701. * // => { 'b': '2' }
  33702. */
  33703. var omit = flatRest(function(object, paths) {
  33704. var result = {};
  33705. if (object == null) {
  33706. return result;
  33707. }
  33708. var isDeep = false;
  33709. paths = arrayMap(paths, function(path) {
  33710. path = castPath(path, object);
  33711. isDeep || (isDeep = path.length > 1);
  33712. return path;
  33713. });
  33714. copyObject(object, getAllKeysIn(object), result);
  33715. if (isDeep) {
  33716. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  33717. }
  33718. var length = paths.length;
  33719. while (length--) {
  33720. baseUnset(result, paths[length]);
  33721. }
  33722. return result;
  33723. });
  33724. /**
  33725. * The opposite of `_.pickBy`; this method creates an object composed of
  33726. * the own and inherited enumerable string keyed properties of `object` that
  33727. * `predicate` doesn't return truthy for. The predicate is invoked with two
  33728. * arguments: (value, key).
  33729. *
  33730. * @static
  33731. * @memberOf _
  33732. * @since 4.0.0
  33733. * @category Object
  33734. * @param {Object} object The source object.
  33735. * @param {Function} [predicate=_.identity] The function invoked per property.
  33736. * @returns {Object} Returns the new object.
  33737. * @example
  33738. *
  33739. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  33740. *
  33741. * _.omitBy(object, _.isNumber);
  33742. * // => { 'b': '2' }
  33743. */
  33744. function omitBy(object, predicate) {
  33745. return pickBy(object, negate(getIteratee(predicate)));
  33746. }
  33747. /**
  33748. * Creates an object composed of the picked `object` properties.
  33749. *
  33750. * @static
  33751. * @since 0.1.0
  33752. * @memberOf _
  33753. * @category Object
  33754. * @param {Object} object The source object.
  33755. * @param {...(string|string[])} [paths] The property paths to pick.
  33756. * @returns {Object} Returns the new object.
  33757. * @example
  33758. *
  33759. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  33760. *
  33761. * _.pick(object, ['a', 'c']);
  33762. * // => { 'a': 1, 'c': 3 }
  33763. */
  33764. var pick = flatRest(function(object, paths) {
  33765. return object == null ? {} : basePick(object, paths);
  33766. });
  33767. /**
  33768. * Creates an object composed of the `object` properties `predicate` returns
  33769. * truthy for. The predicate is invoked with two arguments: (value, key).
  33770. *
  33771. * @static
  33772. * @memberOf _
  33773. * @since 4.0.0
  33774. * @category Object
  33775. * @param {Object} object The source object.
  33776. * @param {Function} [predicate=_.identity] The function invoked per property.
  33777. * @returns {Object} Returns the new object.
  33778. * @example
  33779. *
  33780. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  33781. *
  33782. * _.pickBy(object, _.isNumber);
  33783. * // => { 'a': 1, 'c': 3 }
  33784. */
  33785. function pickBy(object, predicate) {
  33786. if (object == null) {
  33787. return {};
  33788. }
  33789. var props = arrayMap(getAllKeysIn(object), function(prop) {
  33790. return [prop];
  33791. });
  33792. predicate = getIteratee(predicate);
  33793. return basePickBy(object, props, function(value, path) {
  33794. return predicate(value, path[0]);
  33795. });
  33796. }
  33797. /**
  33798. * This method is like `_.get` except that if the resolved value is a
  33799. * function it's invoked with the `this` binding of its parent object and
  33800. * its result is returned.
  33801. *
  33802. * @static
  33803. * @since 0.1.0
  33804. * @memberOf _
  33805. * @category Object
  33806. * @param {Object} object The object to query.
  33807. * @param {Array|string} path The path of the property to resolve.
  33808. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  33809. * @returns {*} Returns the resolved value.
  33810. * @example
  33811. *
  33812. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  33813. *
  33814. * _.result(object, 'a[0].b.c1');
  33815. * // => 3
  33816. *
  33817. * _.result(object, 'a[0].b.c2');
  33818. * // => 4
  33819. *
  33820. * _.result(object, 'a[0].b.c3', 'default');
  33821. * // => 'default'
  33822. *
  33823. * _.result(object, 'a[0].b.c3', _.constant('default'));
  33824. * // => 'default'
  33825. */
  33826. function result(object, path, defaultValue) {
  33827. path = castPath(path, object);
  33828. var index = -1,
  33829. length = path.length;
  33830. // Ensure the loop is entered when path is empty.
  33831. if (!length) {
  33832. length = 1;
  33833. object = undefined;
  33834. }
  33835. while (++index < length) {
  33836. var value = object == null ? undefined : object[toKey(path[index])];
  33837. if (value === undefined) {
  33838. index = length;
  33839. value = defaultValue;
  33840. }
  33841. object = isFunction(value) ? value.call(object) : value;
  33842. }
  33843. return object;
  33844. }
  33845. /**
  33846. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  33847. * it's created. Arrays are created for missing index properties while objects
  33848. * are created for all other missing properties. Use `_.setWith` to customize
  33849. * `path` creation.
  33850. *
  33851. * **Note:** This method mutates `object`.
  33852. *
  33853. * @static
  33854. * @memberOf _
  33855. * @since 3.7.0
  33856. * @category Object
  33857. * @param {Object} object The object to modify.
  33858. * @param {Array|string} path The path of the property to set.
  33859. * @param {*} value The value to set.
  33860. * @returns {Object} Returns `object`.
  33861. * @example
  33862. *
  33863. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  33864. *
  33865. * _.set(object, 'a[0].b.c', 4);
  33866. * console.log(object.a[0].b.c);
  33867. * // => 4
  33868. *
  33869. * _.set(object, ['x', '0', 'y', 'z'], 5);
  33870. * console.log(object.x[0].y.z);
  33871. * // => 5
  33872. */
  33873. function set(object, path, value) {
  33874. return object == null ? object : baseSet(object, path, value);
  33875. }
  33876. /**
  33877. * This method is like `_.set` except that it accepts `customizer` which is
  33878. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  33879. * path creation is handled by the method instead. The `customizer` is invoked
  33880. * with three arguments: (nsValue, key, nsObject).
  33881. *
  33882. * **Note:** This method mutates `object`.
  33883. *
  33884. * @static
  33885. * @memberOf _
  33886. * @since 4.0.0
  33887. * @category Object
  33888. * @param {Object} object The object to modify.
  33889. * @param {Array|string} path The path of the property to set.
  33890. * @param {*} value The value to set.
  33891. * @param {Function} [customizer] The function to customize assigned values.
  33892. * @returns {Object} Returns `object`.
  33893. * @example
  33894. *
  33895. * var object = {};
  33896. *
  33897. * _.setWith(object, '[0][1]', 'a', Object);
  33898. * // => { '0': { '1': 'a' } }
  33899. */
  33900. function setWith(object, path, value, customizer) {
  33901. customizer = typeof customizer == 'function' ? customizer : undefined;
  33902. return object == null ? object : baseSet(object, path, value, customizer);
  33903. }
  33904. /**
  33905. * Creates an array of own enumerable string keyed-value pairs for `object`
  33906. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  33907. * entries are returned.
  33908. *
  33909. * @static
  33910. * @memberOf _
  33911. * @since 4.0.0
  33912. * @alias entries
  33913. * @category Object
  33914. * @param {Object} object The object to query.
  33915. * @returns {Array} Returns the key-value pairs.
  33916. * @example
  33917. *
  33918. * function Foo() {
  33919. * this.a = 1;
  33920. * this.b = 2;
  33921. * }
  33922. *
  33923. * Foo.prototype.c = 3;
  33924. *
  33925. * _.toPairs(new Foo);
  33926. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  33927. */
  33928. var toPairs = createToPairs(keys);
  33929. /**
  33930. * Creates an array of own and inherited enumerable string keyed-value pairs
  33931. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  33932. * or set, its entries are returned.
  33933. *
  33934. * @static
  33935. * @memberOf _
  33936. * @since 4.0.0
  33937. * @alias entriesIn
  33938. * @category Object
  33939. * @param {Object} object The object to query.
  33940. * @returns {Array} Returns the key-value pairs.
  33941. * @example
  33942. *
  33943. * function Foo() {
  33944. * this.a = 1;
  33945. * this.b = 2;
  33946. * }
  33947. *
  33948. * Foo.prototype.c = 3;
  33949. *
  33950. * _.toPairsIn(new Foo);
  33951. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  33952. */
  33953. var toPairsIn = createToPairs(keysIn);
  33954. /**
  33955. * An alternative to `_.reduce`; this method transforms `object` to a new
  33956. * `accumulator` object which is the result of running each of its own
  33957. * enumerable string keyed properties thru `iteratee`, with each invocation
  33958. * potentially mutating the `accumulator` object. If `accumulator` is not
  33959. * provided, a new object with the same `[[Prototype]]` will be used. The
  33960. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  33961. * Iteratee functions may exit iteration early by explicitly returning `false`.
  33962. *
  33963. * @static
  33964. * @memberOf _
  33965. * @since 1.3.0
  33966. * @category Object
  33967. * @param {Object} object The object to iterate over.
  33968. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33969. * @param {*} [accumulator] The custom accumulator value.
  33970. * @returns {*} Returns the accumulated value.
  33971. * @example
  33972. *
  33973. * _.transform([2, 3, 4], function(result, n) {
  33974. * result.push(n *= n);
  33975. * return n % 2 == 0;
  33976. * }, []);
  33977. * // => [4, 9]
  33978. *
  33979. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  33980. * (result[value] || (result[value] = [])).push(key);
  33981. * }, {});
  33982. * // => { '1': ['a', 'c'], '2': ['b'] }
  33983. */
  33984. function transform(object, iteratee, accumulator) {
  33985. var isArr = isArray(object),
  33986. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  33987. iteratee = getIteratee(iteratee, 4);
  33988. if (accumulator == null) {
  33989. var Ctor = object && object.constructor;
  33990. if (isArrLike) {
  33991. accumulator = isArr ? new Ctor : [];
  33992. }
  33993. else if (isObject(object)) {
  33994. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  33995. }
  33996. else {
  33997. accumulator = {};
  33998. }
  33999. }
  34000. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  34001. return iteratee(accumulator, value, index, object);
  34002. });
  34003. return accumulator;
  34004. }
  34005. /**
  34006. * Removes the property at `path` of `object`.
  34007. *
  34008. * **Note:** This method mutates `object`.
  34009. *
  34010. * @static
  34011. * @memberOf _
  34012. * @since 4.0.0
  34013. * @category Object
  34014. * @param {Object} object The object to modify.
  34015. * @param {Array|string} path The path of the property to unset.
  34016. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  34017. * @example
  34018. *
  34019. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  34020. * _.unset(object, 'a[0].b.c');
  34021. * // => true
  34022. *
  34023. * console.log(object);
  34024. * // => { 'a': [{ 'b': {} }] };
  34025. *
  34026. * _.unset(object, ['a', '0', 'b', 'c']);
  34027. * // => true
  34028. *
  34029. * console.log(object);
  34030. * // => { 'a': [{ 'b': {} }] };
  34031. */
  34032. function unset(object, path) {
  34033. return object == null ? true : baseUnset(object, path);
  34034. }
  34035. /**
  34036. * This method is like `_.set` except that accepts `updater` to produce the
  34037. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  34038. * is invoked with one argument: (value).
  34039. *
  34040. * **Note:** This method mutates `object`.
  34041. *
  34042. * @static
  34043. * @memberOf _
  34044. * @since 4.6.0
  34045. * @category Object
  34046. * @param {Object} object The object to modify.
  34047. * @param {Array|string} path The path of the property to set.
  34048. * @param {Function} updater The function to produce the updated value.
  34049. * @returns {Object} Returns `object`.
  34050. * @example
  34051. *
  34052. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  34053. *
  34054. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  34055. * console.log(object.a[0].b.c);
  34056. * // => 9
  34057. *
  34058. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  34059. * console.log(object.x[0].y.z);
  34060. * // => 0
  34061. */
  34062. function update(object, path, updater) {
  34063. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  34064. }
  34065. /**
  34066. * This method is like `_.update` except that it accepts `customizer` which is
  34067. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  34068. * path creation is handled by the method instead. The `customizer` is invoked
  34069. * with three arguments: (nsValue, key, nsObject).
  34070. *
  34071. * **Note:** This method mutates `object`.
  34072. *
  34073. * @static
  34074. * @memberOf _
  34075. * @since 4.6.0
  34076. * @category Object
  34077. * @param {Object} object The object to modify.
  34078. * @param {Array|string} path The path of the property to set.
  34079. * @param {Function} updater The function to produce the updated value.
  34080. * @param {Function} [customizer] The function to customize assigned values.
  34081. * @returns {Object} Returns `object`.
  34082. * @example
  34083. *
  34084. * var object = {};
  34085. *
  34086. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  34087. * // => { '0': { '1': 'a' } }
  34088. */
  34089. function updateWith(object, path, updater, customizer) {
  34090. customizer = typeof customizer == 'function' ? customizer : undefined;
  34091. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  34092. }
  34093. /**
  34094. * Creates an array of the own enumerable string keyed property values of `object`.
  34095. *
  34096. * **Note:** Non-object values are coerced to objects.
  34097. *
  34098. * @static
  34099. * @since 0.1.0
  34100. * @memberOf _
  34101. * @category Object
  34102. * @param {Object} object The object to query.
  34103. * @returns {Array} Returns the array of property values.
  34104. * @example
  34105. *
  34106. * function Foo() {
  34107. * this.a = 1;
  34108. * this.b = 2;
  34109. * }
  34110. *
  34111. * Foo.prototype.c = 3;
  34112. *
  34113. * _.values(new Foo);
  34114. * // => [1, 2] (iteration order is not guaranteed)
  34115. *
  34116. * _.values('hi');
  34117. * // => ['h', 'i']
  34118. */
  34119. function values(object) {
  34120. return object == null ? [] : baseValues(object, keys(object));
  34121. }
  34122. /**
  34123. * Creates an array of the own and inherited enumerable string keyed property
  34124. * values of `object`.
  34125. *
  34126. * **Note:** Non-object values are coerced to objects.
  34127. *
  34128. * @static
  34129. * @memberOf _
  34130. * @since 3.0.0
  34131. * @category Object
  34132. * @param {Object} object The object to query.
  34133. * @returns {Array} Returns the array of property values.
  34134. * @example
  34135. *
  34136. * function Foo() {
  34137. * this.a = 1;
  34138. * this.b = 2;
  34139. * }
  34140. *
  34141. * Foo.prototype.c = 3;
  34142. *
  34143. * _.valuesIn(new Foo);
  34144. * // => [1, 2, 3] (iteration order is not guaranteed)
  34145. */
  34146. function valuesIn(object) {
  34147. return object == null ? [] : baseValues(object, keysIn(object));
  34148. }
  34149. /*------------------------------------------------------------------------*/
  34150. /**
  34151. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  34152. *
  34153. * @static
  34154. * @memberOf _
  34155. * @since 4.0.0
  34156. * @category Number
  34157. * @param {number} number The number to clamp.
  34158. * @param {number} [lower] The lower bound.
  34159. * @param {number} upper The upper bound.
  34160. * @returns {number} Returns the clamped number.
  34161. * @example
  34162. *
  34163. * _.clamp(-10, -5, 5);
  34164. * // => -5
  34165. *
  34166. * _.clamp(10, -5, 5);
  34167. * // => 5
  34168. */
  34169. function clamp(number, lower, upper) {
  34170. if (upper === undefined) {
  34171. upper = lower;
  34172. lower = undefined;
  34173. }
  34174. if (upper !== undefined) {
  34175. upper = toNumber(upper);
  34176. upper = upper === upper ? upper : 0;
  34177. }
  34178. if (lower !== undefined) {
  34179. lower = toNumber(lower);
  34180. lower = lower === lower ? lower : 0;
  34181. }
  34182. return baseClamp(toNumber(number), lower, upper);
  34183. }
  34184. /**
  34185. * Checks if `n` is between `start` and up to, but not including, `end`. If
  34186. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  34187. * If `start` is greater than `end` the params are swapped to support
  34188. * negative ranges.
  34189. *
  34190. * @static
  34191. * @memberOf _
  34192. * @since 3.3.0
  34193. * @category Number
  34194. * @param {number} number The number to check.
  34195. * @param {number} [start=0] The start of the range.
  34196. * @param {number} end The end of the range.
  34197. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  34198. * @see _.range, _.rangeRight
  34199. * @example
  34200. *
  34201. * _.inRange(3, 2, 4);
  34202. * // => true
  34203. *
  34204. * _.inRange(4, 8);
  34205. * // => true
  34206. *
  34207. * _.inRange(4, 2);
  34208. * // => false
  34209. *
  34210. * _.inRange(2, 2);
  34211. * // => false
  34212. *
  34213. * _.inRange(1.2, 2);
  34214. * // => true
  34215. *
  34216. * _.inRange(5.2, 4);
  34217. * // => false
  34218. *
  34219. * _.inRange(-3, -2, -6);
  34220. * // => true
  34221. */
  34222. function inRange(number, start, end) {
  34223. start = toFinite(start);
  34224. if (end === undefined) {
  34225. end = start;
  34226. start = 0;
  34227. } else {
  34228. end = toFinite(end);
  34229. }
  34230. number = toNumber(number);
  34231. return baseInRange(number, start, end);
  34232. }
  34233. /**
  34234. * Produces a random number between the inclusive `lower` and `upper` bounds.
  34235. * If only one argument is provided a number between `0` and the given number
  34236. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  34237. * floats, a floating-point number is returned instead of an integer.
  34238. *
  34239. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  34240. * floating-point values which can produce unexpected results.
  34241. *
  34242. * @static
  34243. * @memberOf _
  34244. * @since 0.7.0
  34245. * @category Number
  34246. * @param {number} [lower=0] The lower bound.
  34247. * @param {number} [upper=1] The upper bound.
  34248. * @param {boolean} [floating] Specify returning a floating-point number.
  34249. * @returns {number} Returns the random number.
  34250. * @example
  34251. *
  34252. * _.random(0, 5);
  34253. * // => an integer between 0 and 5
  34254. *
  34255. * _.random(5);
  34256. * // => also an integer between 0 and 5
  34257. *
  34258. * _.random(5, true);
  34259. * // => a floating-point number between 0 and 5
  34260. *
  34261. * _.random(1.2, 5.2);
  34262. * // => a floating-point number between 1.2 and 5.2
  34263. */
  34264. function random(lower, upper, floating) {
  34265. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  34266. upper = floating = undefined;
  34267. }
  34268. if (floating === undefined) {
  34269. if (typeof upper == 'boolean') {
  34270. floating = upper;
  34271. upper = undefined;
  34272. }
  34273. else if (typeof lower == 'boolean') {
  34274. floating = lower;
  34275. lower = undefined;
  34276. }
  34277. }
  34278. if (lower === undefined && upper === undefined) {
  34279. lower = 0;
  34280. upper = 1;
  34281. }
  34282. else {
  34283. lower = toFinite(lower);
  34284. if (upper === undefined) {
  34285. upper = lower;
  34286. lower = 0;
  34287. } else {
  34288. upper = toFinite(upper);
  34289. }
  34290. }
  34291. if (lower > upper) {
  34292. var temp = lower;
  34293. lower = upper;
  34294. upper = temp;
  34295. }
  34296. if (floating || lower % 1 || upper % 1) {
  34297. var rand = nativeRandom();
  34298. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  34299. }
  34300. return baseRandom(lower, upper);
  34301. }
  34302. /*------------------------------------------------------------------------*/
  34303. /**
  34304. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  34305. *
  34306. * @static
  34307. * @memberOf _
  34308. * @since 3.0.0
  34309. * @category String
  34310. * @param {string} [string=''] The string to convert.
  34311. * @returns {string} Returns the camel cased string.
  34312. * @example
  34313. *
  34314. * _.camelCase('Foo Bar');
  34315. * // => 'fooBar'
  34316. *
  34317. * _.camelCase('--foo-bar--');
  34318. * // => 'fooBar'
  34319. *
  34320. * _.camelCase('__FOO_BAR__');
  34321. * // => 'fooBar'
  34322. */
  34323. var camelCase = createCompounder(function(result, word, index) {
  34324. word = word.toLowerCase();
  34325. return result + (index ? capitalize(word) : word);
  34326. });
  34327. /**
  34328. * Converts the first character of `string` to upper case and the remaining
  34329. * to lower case.
  34330. *
  34331. * @static
  34332. * @memberOf _
  34333. * @since 3.0.0
  34334. * @category String
  34335. * @param {string} [string=''] The string to capitalize.
  34336. * @returns {string} Returns the capitalized string.
  34337. * @example
  34338. *
  34339. * _.capitalize('FRED');
  34340. * // => 'Fred'
  34341. */
  34342. function capitalize(string) {
  34343. return upperFirst(toString(string).toLowerCase());
  34344. }
  34345. /**
  34346. * Deburrs `string` by converting
  34347. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  34348. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  34349. * letters to basic Latin letters and removing
  34350. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  34351. *
  34352. * @static
  34353. * @memberOf _
  34354. * @since 3.0.0
  34355. * @category String
  34356. * @param {string} [string=''] The string to deburr.
  34357. * @returns {string} Returns the deburred string.
  34358. * @example
  34359. *
  34360. * _.deburr('déjà vu');
  34361. * // => 'deja vu'
  34362. */
  34363. function deburr(string) {
  34364. string = toString(string);
  34365. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  34366. }
  34367. /**
  34368. * Checks if `string` ends with the given target string.
  34369. *
  34370. * @static
  34371. * @memberOf _
  34372. * @since 3.0.0
  34373. * @category String
  34374. * @param {string} [string=''] The string to inspect.
  34375. * @param {string} [target] The string to search for.
  34376. * @param {number} [position=string.length] The position to search up to.
  34377. * @returns {boolean} Returns `true` if `string` ends with `target`,
  34378. * else `false`.
  34379. * @example
  34380. *
  34381. * _.endsWith('abc', 'c');
  34382. * // => true
  34383. *
  34384. * _.endsWith('abc', 'b');
  34385. * // => false
  34386. *
  34387. * _.endsWith('abc', 'b', 2);
  34388. * // => true
  34389. */
  34390. function endsWith(string, target, position) {
  34391. string = toString(string);
  34392. target = baseToString(target);
  34393. var length = string.length;
  34394. position = position === undefined
  34395. ? length
  34396. : baseClamp(toInteger(position), 0, length);
  34397. var end = position;
  34398. position -= target.length;
  34399. return position >= 0 && string.slice(position, end) == target;
  34400. }
  34401. /**
  34402. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  34403. * corresponding HTML entities.
  34404. *
  34405. * **Note:** No other characters are escaped. To escape additional
  34406. * characters use a third-party library like [_he_](https://mths.be/he).
  34407. *
  34408. * Though the ">" character is escaped for symmetry, characters like
  34409. * ">" and "/" don't need escaping in HTML and have no special meaning
  34410. * unless they're part of a tag or unquoted attribute value. See
  34411. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  34412. * (under "semi-related fun fact") for more details.
  34413. *
  34414. * When working with HTML you should always
  34415. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  34416. * XSS vectors.
  34417. *
  34418. * @static
  34419. * @since 0.1.0
  34420. * @memberOf _
  34421. * @category String
  34422. * @param {string} [string=''] The string to escape.
  34423. * @returns {string} Returns the escaped string.
  34424. * @example
  34425. *
  34426. * _.escape('fred, barney, & pebbles');
  34427. * // => 'fred, barney, &amp; pebbles'
  34428. */
  34429. function escape(string) {
  34430. string = toString(string);
  34431. return (string && reHasUnescapedHtml.test(string))
  34432. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  34433. : string;
  34434. }
  34435. /**
  34436. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  34437. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  34438. *
  34439. * @static
  34440. * @memberOf _
  34441. * @since 3.0.0
  34442. * @category String
  34443. * @param {string} [string=''] The string to escape.
  34444. * @returns {string} Returns the escaped string.
  34445. * @example
  34446. *
  34447. * _.escapeRegExp('[lodash](https://lodash.com/)');
  34448. * // => '\[lodash\]\(https://lodash\.com/\)'
  34449. */
  34450. function escapeRegExp(string) {
  34451. string = toString(string);
  34452. return (string && reHasRegExpChar.test(string))
  34453. ? string.replace(reRegExpChar, '\\$&')
  34454. : string;
  34455. }
  34456. /**
  34457. * Converts `string` to
  34458. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  34459. *
  34460. * @static
  34461. * @memberOf _
  34462. * @since 3.0.0
  34463. * @category String
  34464. * @param {string} [string=''] The string to convert.
  34465. * @returns {string} Returns the kebab cased string.
  34466. * @example
  34467. *
  34468. * _.kebabCase('Foo Bar');
  34469. * // => 'foo-bar'
  34470. *
  34471. * _.kebabCase('fooBar');
  34472. * // => 'foo-bar'
  34473. *
  34474. * _.kebabCase('__FOO_BAR__');
  34475. * // => 'foo-bar'
  34476. */
  34477. var kebabCase = createCompounder(function(result, word, index) {
  34478. return result + (index ? '-' : '') + word.toLowerCase();
  34479. });
  34480. /**
  34481. * Converts `string`, as space separated words, to lower case.
  34482. *
  34483. * @static
  34484. * @memberOf _
  34485. * @since 4.0.0
  34486. * @category String
  34487. * @param {string} [string=''] The string to convert.
  34488. * @returns {string} Returns the lower cased string.
  34489. * @example
  34490. *
  34491. * _.lowerCase('--Foo-Bar--');
  34492. * // => 'foo bar'
  34493. *
  34494. * _.lowerCase('fooBar');
  34495. * // => 'foo bar'
  34496. *
  34497. * _.lowerCase('__FOO_BAR__');
  34498. * // => 'foo bar'
  34499. */
  34500. var lowerCase = createCompounder(function(result, word, index) {
  34501. return result + (index ? ' ' : '') + word.toLowerCase();
  34502. });
  34503. /**
  34504. * Converts the first character of `string` to lower case.
  34505. *
  34506. * @static
  34507. * @memberOf _
  34508. * @since 4.0.0
  34509. * @category String
  34510. * @param {string} [string=''] The string to convert.
  34511. * @returns {string} Returns the converted string.
  34512. * @example
  34513. *
  34514. * _.lowerFirst('Fred');
  34515. * // => 'fred'
  34516. *
  34517. * _.lowerFirst('FRED');
  34518. * // => 'fRED'
  34519. */
  34520. var lowerFirst = createCaseFirst('toLowerCase');
  34521. /**
  34522. * Pads `string` on the left and right sides if it's shorter than `length`.
  34523. * Padding characters are truncated if they can't be evenly divided by `length`.
  34524. *
  34525. * @static
  34526. * @memberOf _
  34527. * @since 3.0.0
  34528. * @category String
  34529. * @param {string} [string=''] The string to pad.
  34530. * @param {number} [length=0] The padding length.
  34531. * @param {string} [chars=' '] The string used as padding.
  34532. * @returns {string} Returns the padded string.
  34533. * @example
  34534. *
  34535. * _.pad('abc', 8);
  34536. * // => ' abc '
  34537. *
  34538. * _.pad('abc', 8, '_-');
  34539. * // => '_-abc_-_'
  34540. *
  34541. * _.pad('abc', 3);
  34542. * // => 'abc'
  34543. */
  34544. function pad(string, length, chars) {
  34545. string = toString(string);
  34546. length = toInteger(length);
  34547. var strLength = length ? stringSize(string) : 0;
  34548. if (!length || strLength >= length) {
  34549. return string;
  34550. }
  34551. var mid = (length - strLength) / 2;
  34552. return (
  34553. createPadding(nativeFloor(mid), chars) +
  34554. string +
  34555. createPadding(nativeCeil(mid), chars)
  34556. );
  34557. }
  34558. /**
  34559. * Pads `string` on the right side if it's shorter than `length`. Padding
  34560. * characters are truncated if they exceed `length`.
  34561. *
  34562. * @static
  34563. * @memberOf _
  34564. * @since 4.0.0
  34565. * @category String
  34566. * @param {string} [string=''] The string to pad.
  34567. * @param {number} [length=0] The padding length.
  34568. * @param {string} [chars=' '] The string used as padding.
  34569. * @returns {string} Returns the padded string.
  34570. * @example
  34571. *
  34572. * _.padEnd('abc', 6);
  34573. * // => 'abc '
  34574. *
  34575. * _.padEnd('abc', 6, '_-');
  34576. * // => 'abc_-_'
  34577. *
  34578. * _.padEnd('abc', 3);
  34579. * // => 'abc'
  34580. */
  34581. function padEnd(string, length, chars) {
  34582. string = toString(string);
  34583. length = toInteger(length);
  34584. var strLength = length ? stringSize(string) : 0;
  34585. return (length && strLength < length)
  34586. ? (string + createPadding(length - strLength, chars))
  34587. : string;
  34588. }
  34589. /**
  34590. * Pads `string` on the left side if it's shorter than `length`. Padding
  34591. * characters are truncated if they exceed `length`.
  34592. *
  34593. * @static
  34594. * @memberOf _
  34595. * @since 4.0.0
  34596. * @category String
  34597. * @param {string} [string=''] The string to pad.
  34598. * @param {number} [length=0] The padding length.
  34599. * @param {string} [chars=' '] The string used as padding.
  34600. * @returns {string} Returns the padded string.
  34601. * @example
  34602. *
  34603. * _.padStart('abc', 6);
  34604. * // => ' abc'
  34605. *
  34606. * _.padStart('abc', 6, '_-');
  34607. * // => '_-_abc'
  34608. *
  34609. * _.padStart('abc', 3);
  34610. * // => 'abc'
  34611. */
  34612. function padStart(string, length, chars) {
  34613. string = toString(string);
  34614. length = toInteger(length);
  34615. var strLength = length ? stringSize(string) : 0;
  34616. return (length && strLength < length)
  34617. ? (createPadding(length - strLength, chars) + string)
  34618. : string;
  34619. }
  34620. /**
  34621. * Converts `string` to an integer of the specified radix. If `radix` is
  34622. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  34623. * hexadecimal, in which case a `radix` of `16` is used.
  34624. *
  34625. * **Note:** This method aligns with the
  34626. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  34627. *
  34628. * @static
  34629. * @memberOf _
  34630. * @since 1.1.0
  34631. * @category String
  34632. * @param {string} string The string to convert.
  34633. * @param {number} [radix=10] The radix to interpret `value` by.
  34634. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  34635. * @returns {number} Returns the converted integer.
  34636. * @example
  34637. *
  34638. * _.parseInt('08');
  34639. * // => 8
  34640. *
  34641. * _.map(['6', '08', '10'], _.parseInt);
  34642. * // => [6, 8, 10]
  34643. */
  34644. function parseInt(string, radix, guard) {
  34645. if (guard || radix == null) {
  34646. radix = 0;
  34647. } else if (radix) {
  34648. radix = +radix;
  34649. }
  34650. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  34651. }
  34652. /**
  34653. * Repeats the given string `n` times.
  34654. *
  34655. * @static
  34656. * @memberOf _
  34657. * @since 3.0.0
  34658. * @category String
  34659. * @param {string} [string=''] The string to repeat.
  34660. * @param {number} [n=1] The number of times to repeat the string.
  34661. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  34662. * @returns {string} Returns the repeated string.
  34663. * @example
  34664. *
  34665. * _.repeat('*', 3);
  34666. * // => '***'
  34667. *
  34668. * _.repeat('abc', 2);
  34669. * // => 'abcabc'
  34670. *
  34671. * _.repeat('abc', 0);
  34672. * // => ''
  34673. */
  34674. function repeat(string, n, guard) {
  34675. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  34676. n = 1;
  34677. } else {
  34678. n = toInteger(n);
  34679. }
  34680. return baseRepeat(toString(string), n);
  34681. }
  34682. /**
  34683. * Replaces matches for `pattern` in `string` with `replacement`.
  34684. *
  34685. * **Note:** This method is based on
  34686. * [`String#replace`](https://mdn.io/String/replace).
  34687. *
  34688. * @static
  34689. * @memberOf _
  34690. * @since 4.0.0
  34691. * @category String
  34692. * @param {string} [string=''] The string to modify.
  34693. * @param {RegExp|string} pattern The pattern to replace.
  34694. * @param {Function|string} replacement The match replacement.
  34695. * @returns {string} Returns the modified string.
  34696. * @example
  34697. *
  34698. * _.replace('Hi Fred', 'Fred', 'Barney');
  34699. * // => 'Hi Barney'
  34700. */
  34701. function replace() {
  34702. var args = arguments,
  34703. string = toString(args[0]);
  34704. return args.length < 3 ? string : string.replace(args[1], args[2]);
  34705. }
  34706. /**
  34707. * Converts `string` to
  34708. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  34709. *
  34710. * @static
  34711. * @memberOf _
  34712. * @since 3.0.0
  34713. * @category String
  34714. * @param {string} [string=''] The string to convert.
  34715. * @returns {string} Returns the snake cased string.
  34716. * @example
  34717. *
  34718. * _.snakeCase('Foo Bar');
  34719. * // => 'foo_bar'
  34720. *
  34721. * _.snakeCase('fooBar');
  34722. * // => 'foo_bar'
  34723. *
  34724. * _.snakeCase('--FOO-BAR--');
  34725. * // => 'foo_bar'
  34726. */
  34727. var snakeCase = createCompounder(function(result, word, index) {
  34728. return result + (index ? '_' : '') + word.toLowerCase();
  34729. });
  34730. /**
  34731. * Splits `string` by `separator`.
  34732. *
  34733. * **Note:** This method is based on
  34734. * [`String#split`](https://mdn.io/String/split).
  34735. *
  34736. * @static
  34737. * @memberOf _
  34738. * @since 4.0.0
  34739. * @category String
  34740. * @param {string} [string=''] The string to split.
  34741. * @param {RegExp|string} separator The separator pattern to split by.
  34742. * @param {number} [limit] The length to truncate results to.
  34743. * @returns {Array} Returns the string segments.
  34744. * @example
  34745. *
  34746. * _.split('a-b-c', '-', 2);
  34747. * // => ['a', 'b']
  34748. */
  34749. function split(string, separator, limit) {
  34750. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  34751. separator = limit = undefined;
  34752. }
  34753. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  34754. if (!limit) {
  34755. return [];
  34756. }
  34757. string = toString(string);
  34758. if (string && (
  34759. typeof separator == 'string' ||
  34760. (separator != null && !isRegExp(separator))
  34761. )) {
  34762. separator = baseToString(separator);
  34763. if (!separator && hasUnicode(string)) {
  34764. return castSlice(stringToArray(string), 0, limit);
  34765. }
  34766. }
  34767. return string.split(separator, limit);
  34768. }
  34769. /**
  34770. * Converts `string` to
  34771. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  34772. *
  34773. * @static
  34774. * @memberOf _
  34775. * @since 3.1.0
  34776. * @category String
  34777. * @param {string} [string=''] The string to convert.
  34778. * @returns {string} Returns the start cased string.
  34779. * @example
  34780. *
  34781. * _.startCase('--foo-bar--');
  34782. * // => 'Foo Bar'
  34783. *
  34784. * _.startCase('fooBar');
  34785. * // => 'Foo Bar'
  34786. *
  34787. * _.startCase('__FOO_BAR__');
  34788. * // => 'FOO BAR'
  34789. */
  34790. var startCase = createCompounder(function(result, word, index) {
  34791. return result + (index ? ' ' : '') + upperFirst(word);
  34792. });
  34793. /**
  34794. * Checks if `string` starts with the given target string.
  34795. *
  34796. * @static
  34797. * @memberOf _
  34798. * @since 3.0.0
  34799. * @category String
  34800. * @param {string} [string=''] The string to inspect.
  34801. * @param {string} [target] The string to search for.
  34802. * @param {number} [position=0] The position to search from.
  34803. * @returns {boolean} Returns `true` if `string` starts with `target`,
  34804. * else `false`.
  34805. * @example
  34806. *
  34807. * _.startsWith('abc', 'a');
  34808. * // => true
  34809. *
  34810. * _.startsWith('abc', 'b');
  34811. * // => false
  34812. *
  34813. * _.startsWith('abc', 'b', 1);
  34814. * // => true
  34815. */
  34816. function startsWith(string, target, position) {
  34817. string = toString(string);
  34818. position = position == null
  34819. ? 0
  34820. : baseClamp(toInteger(position), 0, string.length);
  34821. target = baseToString(target);
  34822. return string.slice(position, position + target.length) == target;
  34823. }
  34824. /**
  34825. * Creates a compiled template function that can interpolate data properties
  34826. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  34827. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  34828. * properties may be accessed as free variables in the template. If a setting
  34829. * object is given, it takes precedence over `_.templateSettings` values.
  34830. *
  34831. * **Note:** In the development build `_.template` utilizes
  34832. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  34833. * for easier debugging.
  34834. *
  34835. * For more information on precompiling templates see
  34836. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  34837. *
  34838. * For more information on Chrome extension sandboxes see
  34839. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  34840. *
  34841. * @static
  34842. * @since 0.1.0
  34843. * @memberOf _
  34844. * @category String
  34845. * @param {string} [string=''] The template string.
  34846. * @param {Object} [options={}] The options object.
  34847. * @param {RegExp} [options.escape=_.templateSettings.escape]
  34848. * The HTML "escape" delimiter.
  34849. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  34850. * The "evaluate" delimiter.
  34851. * @param {Object} [options.imports=_.templateSettings.imports]
  34852. * An object to import into the template as free variables.
  34853. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  34854. * The "interpolate" delimiter.
  34855. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  34856. * The sourceURL of the compiled template.
  34857. * @param {string} [options.variable='obj']
  34858. * The data object variable name.
  34859. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  34860. * @returns {Function} Returns the compiled template function.
  34861. * @example
  34862. *
  34863. * // Use the "interpolate" delimiter to create a compiled template.
  34864. * var compiled = _.template('hello <%= user %>!');
  34865. * compiled({ 'user': 'fred' });
  34866. * // => 'hello fred!'
  34867. *
  34868. * // Use the HTML "escape" delimiter to escape data property values.
  34869. * var compiled = _.template('<b><%- value %></b>');
  34870. * compiled({ 'value': '<script>' });
  34871. * // => '<b>&lt;script&gt;</b>'
  34872. *
  34873. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  34874. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  34875. * compiled({ 'users': ['fred', 'barney'] });
  34876. * // => '<li>fred</li><li>barney</li>'
  34877. *
  34878. * // Use the internal `print` function in "evaluate" delimiters.
  34879. * var compiled = _.template('<% print("hello " + user); %>!');
  34880. * compiled({ 'user': 'barney' });
  34881. * // => 'hello barney!'
  34882. *
  34883. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  34884. * // Disable support by replacing the "interpolate" delimiter.
  34885. * var compiled = _.template('hello ${ user }!');
  34886. * compiled({ 'user': 'pebbles' });
  34887. * // => 'hello pebbles!'
  34888. *
  34889. * // Use backslashes to treat delimiters as plain text.
  34890. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  34891. * compiled({ 'value': 'ignored' });
  34892. * // => '<%- value %>'
  34893. *
  34894. * // Use the `imports` option to import `jQuery` as `jq`.
  34895. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  34896. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  34897. * compiled({ 'users': ['fred', 'barney'] });
  34898. * // => '<li>fred</li><li>barney</li>'
  34899. *
  34900. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  34901. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  34902. * compiled(data);
  34903. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  34904. *
  34905. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  34906. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  34907. * compiled.source;
  34908. * // => function(data) {
  34909. * // var __t, __p = '';
  34910. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  34911. * // return __p;
  34912. * // }
  34913. *
  34914. * // Use custom template delimiters.
  34915. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  34916. * var compiled = _.template('hello {{ user }}!');
  34917. * compiled({ 'user': 'mustache' });
  34918. * // => 'hello mustache!'
  34919. *
  34920. * // Use the `source` property to inline compiled templates for meaningful
  34921. * // line numbers in error messages and stack traces.
  34922. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  34923. * var JST = {\
  34924. * "main": ' + _.template(mainText).source + '\
  34925. * };\
  34926. * ');
  34927. */
  34928. function template(string, options, guard) {
  34929. // Based on John Resig's `tmpl` implementation
  34930. // (http://ejohn.org/blog/javascript-micro-templating/)
  34931. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  34932. var settings = lodash.templateSettings;
  34933. if (guard && isIterateeCall(string, options, guard)) {
  34934. options = undefined;
  34935. }
  34936. string = toString(string);
  34937. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  34938. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  34939. importsKeys = keys(imports),
  34940. importsValues = baseValues(imports, importsKeys);
  34941. var isEscaping,
  34942. isEvaluating,
  34943. index = 0,
  34944. interpolate = options.interpolate || reNoMatch,
  34945. source = "__p += '";
  34946. // Compile the regexp to match each delimiter.
  34947. var reDelimiters = RegExp(
  34948. (options.escape || reNoMatch).source + '|' +
  34949. interpolate.source + '|' +
  34950. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  34951. (options.evaluate || reNoMatch).source + '|$'
  34952. , 'g');
  34953. // Use a sourceURL for easier debugging.
  34954. // The sourceURL gets injected into the source that's eval-ed, so be careful
  34955. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  34956. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  34957. var sourceURL = '//# sourceURL=' +
  34958. (hasOwnProperty.call(options, 'sourceURL')
  34959. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  34960. : ('lodash.templateSources[' + (++templateCounter) + ']')
  34961. ) + '\n';
  34962. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  34963. interpolateValue || (interpolateValue = esTemplateValue);
  34964. // Escape characters that can't be included in string literals.
  34965. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  34966. // Replace delimiters with snippets.
  34967. if (escapeValue) {
  34968. isEscaping = true;
  34969. source += "' +\n__e(" + escapeValue + ") +\n'";
  34970. }
  34971. if (evaluateValue) {
  34972. isEvaluating = true;
  34973. source += "';\n" + evaluateValue + ";\n__p += '";
  34974. }
  34975. if (interpolateValue) {
  34976. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  34977. }
  34978. index = offset + match.length;
  34979. // The JS engine embedded in Adobe products needs `match` returned in
  34980. // order to produce the correct `offset` value.
  34981. return match;
  34982. });
  34983. source += "';\n";
  34984. // If `variable` is not specified wrap a with-statement around the generated
  34985. // code to add the data object to the top of the scope chain.
  34986. // Like with sourceURL, we take care to not check the option's prototype,
  34987. // as this configuration is a code injection vector.
  34988. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  34989. if (!variable) {
  34990. source = 'with (obj) {\n' + source + '\n}\n';
  34991. }
  34992. // Cleanup code by stripping empty strings.
  34993. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  34994. .replace(reEmptyStringMiddle, '$1')
  34995. .replace(reEmptyStringTrailing, '$1;');
  34996. // Frame code as the function body.
  34997. source = 'function(' + (variable || 'obj') + ') {\n' +
  34998. (variable
  34999. ? ''
  35000. : 'obj || (obj = {});\n'
  35001. ) +
  35002. "var __t, __p = ''" +
  35003. (isEscaping
  35004. ? ', __e = _.escape'
  35005. : ''
  35006. ) +
  35007. (isEvaluating
  35008. ? ', __j = Array.prototype.join;\n' +
  35009. "function print() { __p += __j.call(arguments, '') }\n"
  35010. : ';\n'
  35011. ) +
  35012. source +
  35013. 'return __p\n}';
  35014. var result = attempt(function() {
  35015. return Function(importsKeys, sourceURL + 'return ' + source)
  35016. .apply(undefined, importsValues);
  35017. });
  35018. // Provide the compiled function's source by its `toString` method or
  35019. // the `source` property as a convenience for inlining compiled templates.
  35020. result.source = source;
  35021. if (isError(result)) {
  35022. throw result;
  35023. }
  35024. return result;
  35025. }
  35026. /**
  35027. * Converts `string`, as a whole, to lower case just like
  35028. * [String#toLowerCase](https://mdn.io/toLowerCase).
  35029. *
  35030. * @static
  35031. * @memberOf _
  35032. * @since 4.0.0
  35033. * @category String
  35034. * @param {string} [string=''] The string to convert.
  35035. * @returns {string} Returns the lower cased string.
  35036. * @example
  35037. *
  35038. * _.toLower('--Foo-Bar--');
  35039. * // => '--foo-bar--'
  35040. *
  35041. * _.toLower('fooBar');
  35042. * // => 'foobar'
  35043. *
  35044. * _.toLower('__FOO_BAR__');
  35045. * // => '__foo_bar__'
  35046. */
  35047. function toLower(value) {
  35048. return toString(value).toLowerCase();
  35049. }
  35050. /**
  35051. * Converts `string`, as a whole, to upper case just like
  35052. * [String#toUpperCase](https://mdn.io/toUpperCase).
  35053. *
  35054. * @static
  35055. * @memberOf _
  35056. * @since 4.0.0
  35057. * @category String
  35058. * @param {string} [string=''] The string to convert.
  35059. * @returns {string} Returns the upper cased string.
  35060. * @example
  35061. *
  35062. * _.toUpper('--foo-bar--');
  35063. * // => '--FOO-BAR--'
  35064. *
  35065. * _.toUpper('fooBar');
  35066. * // => 'FOOBAR'
  35067. *
  35068. * _.toUpper('__foo_bar__');
  35069. * // => '__FOO_BAR__'
  35070. */
  35071. function toUpper(value) {
  35072. return toString(value).toUpperCase();
  35073. }
  35074. /**
  35075. * Removes leading and trailing whitespace or specified characters from `string`.
  35076. *
  35077. * @static
  35078. * @memberOf _
  35079. * @since 3.0.0
  35080. * @category String
  35081. * @param {string} [string=''] The string to trim.
  35082. * @param {string} [chars=whitespace] The characters to trim.
  35083. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  35084. * @returns {string} Returns the trimmed string.
  35085. * @example
  35086. *
  35087. * _.trim(' abc ');
  35088. * // => 'abc'
  35089. *
  35090. * _.trim('-_-abc-_-', '_-');
  35091. * // => 'abc'
  35092. *
  35093. * _.map([' foo ', ' bar '], _.trim);
  35094. * // => ['foo', 'bar']
  35095. */
  35096. function trim(string, chars, guard) {
  35097. string = toString(string);
  35098. if (string && (guard || chars === undefined)) {
  35099. return string.replace(reTrim, '');
  35100. }
  35101. if (!string || !(chars = baseToString(chars))) {
  35102. return string;
  35103. }
  35104. var strSymbols = stringToArray(string),
  35105. chrSymbols = stringToArray(chars),
  35106. start = charsStartIndex(strSymbols, chrSymbols),
  35107. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  35108. return castSlice(strSymbols, start, end).join('');
  35109. }
  35110. /**
  35111. * Removes trailing whitespace or specified characters from `string`.
  35112. *
  35113. * @static
  35114. * @memberOf _
  35115. * @since 4.0.0
  35116. * @category String
  35117. * @param {string} [string=''] The string to trim.
  35118. * @param {string} [chars=whitespace] The characters to trim.
  35119. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  35120. * @returns {string} Returns the trimmed string.
  35121. * @example
  35122. *
  35123. * _.trimEnd(' abc ');
  35124. * // => ' abc'
  35125. *
  35126. * _.trimEnd('-_-abc-_-', '_-');
  35127. * // => '-_-abc'
  35128. */
  35129. function trimEnd(string, chars, guard) {
  35130. string = toString(string);
  35131. if (string && (guard || chars === undefined)) {
  35132. return string.replace(reTrimEnd, '');
  35133. }
  35134. if (!string || !(chars = baseToString(chars))) {
  35135. return string;
  35136. }
  35137. var strSymbols = stringToArray(string),
  35138. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  35139. return castSlice(strSymbols, 0, end).join('');
  35140. }
  35141. /**
  35142. * Removes leading whitespace or specified characters from `string`.
  35143. *
  35144. * @static
  35145. * @memberOf _
  35146. * @since 4.0.0
  35147. * @category String
  35148. * @param {string} [string=''] The string to trim.
  35149. * @param {string} [chars=whitespace] The characters to trim.
  35150. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  35151. * @returns {string} Returns the trimmed string.
  35152. * @example
  35153. *
  35154. * _.trimStart(' abc ');
  35155. * // => 'abc '
  35156. *
  35157. * _.trimStart('-_-abc-_-', '_-');
  35158. * // => 'abc-_-'
  35159. */
  35160. function trimStart(string, chars, guard) {
  35161. string = toString(string);
  35162. if (string && (guard || chars === undefined)) {
  35163. return string.replace(reTrimStart, '');
  35164. }
  35165. if (!string || !(chars = baseToString(chars))) {
  35166. return string;
  35167. }
  35168. var strSymbols = stringToArray(string),
  35169. start = charsStartIndex(strSymbols, stringToArray(chars));
  35170. return castSlice(strSymbols, start).join('');
  35171. }
  35172. /**
  35173. * Truncates `string` if it's longer than the given maximum string length.
  35174. * The last characters of the truncated string are replaced with the omission
  35175. * string which defaults to "...".
  35176. *
  35177. * @static
  35178. * @memberOf _
  35179. * @since 4.0.0
  35180. * @category String
  35181. * @param {string} [string=''] The string to truncate.
  35182. * @param {Object} [options={}] The options object.
  35183. * @param {number} [options.length=30] The maximum string length.
  35184. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  35185. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  35186. * @returns {string} Returns the truncated string.
  35187. * @example
  35188. *
  35189. * _.truncate('hi-diddly-ho there, neighborino');
  35190. * // => 'hi-diddly-ho there, neighbo...'
  35191. *
  35192. * _.truncate('hi-diddly-ho there, neighborino', {
  35193. * 'length': 24,
  35194. * 'separator': ' '
  35195. * });
  35196. * // => 'hi-diddly-ho there,...'
  35197. *
  35198. * _.truncate('hi-diddly-ho there, neighborino', {
  35199. * 'length': 24,
  35200. * 'separator': /,? +/
  35201. * });
  35202. * // => 'hi-diddly-ho there...'
  35203. *
  35204. * _.truncate('hi-diddly-ho there, neighborino', {
  35205. * 'omission': ' [...]'
  35206. * });
  35207. * // => 'hi-diddly-ho there, neig [...]'
  35208. */
  35209. function truncate(string, options) {
  35210. var length = DEFAULT_TRUNC_LENGTH,
  35211. omission = DEFAULT_TRUNC_OMISSION;
  35212. if (isObject(options)) {
  35213. var separator = 'separator' in options ? options.separator : separator;
  35214. length = 'length' in options ? toInteger(options.length) : length;
  35215. omission = 'omission' in options ? baseToString(options.omission) : omission;
  35216. }
  35217. string = toString(string);
  35218. var strLength = string.length;
  35219. if (hasUnicode(string)) {
  35220. var strSymbols = stringToArray(string);
  35221. strLength = strSymbols.length;
  35222. }
  35223. if (length >= strLength) {
  35224. return string;
  35225. }
  35226. var end = length - stringSize(omission);
  35227. if (end < 1) {
  35228. return omission;
  35229. }
  35230. var result = strSymbols
  35231. ? castSlice(strSymbols, 0, end).join('')
  35232. : string.slice(0, end);
  35233. if (separator === undefined) {
  35234. return result + omission;
  35235. }
  35236. if (strSymbols) {
  35237. end += (result.length - end);
  35238. }
  35239. if (isRegExp(separator)) {
  35240. if (string.slice(end).search(separator)) {
  35241. var match,
  35242. substring = result;
  35243. if (!separator.global) {
  35244. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  35245. }
  35246. separator.lastIndex = 0;
  35247. while ((match = separator.exec(substring))) {
  35248. var newEnd = match.index;
  35249. }
  35250. result = result.slice(0, newEnd === undefined ? end : newEnd);
  35251. }
  35252. } else if (string.indexOf(baseToString(separator), end) != end) {
  35253. var index = result.lastIndexOf(separator);
  35254. if (index > -1) {
  35255. result = result.slice(0, index);
  35256. }
  35257. }
  35258. return result + omission;
  35259. }
  35260. /**
  35261. * The inverse of `_.escape`; this method converts the HTML entities
  35262. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  35263. * their corresponding characters.
  35264. *
  35265. * **Note:** No other HTML entities are unescaped. To unescape additional
  35266. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  35267. *
  35268. * @static
  35269. * @memberOf _
  35270. * @since 0.6.0
  35271. * @category String
  35272. * @param {string} [string=''] The string to unescape.
  35273. * @returns {string} Returns the unescaped string.
  35274. * @example
  35275. *
  35276. * _.unescape('fred, barney, &amp; pebbles');
  35277. * // => 'fred, barney, & pebbles'
  35278. */
  35279. function unescape(string) {
  35280. string = toString(string);
  35281. return (string && reHasEscapedHtml.test(string))
  35282. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  35283. : string;
  35284. }
  35285. /**
  35286. * Converts `string`, as space separated words, to upper case.
  35287. *
  35288. * @static
  35289. * @memberOf _
  35290. * @since 4.0.0
  35291. * @category String
  35292. * @param {string} [string=''] The string to convert.
  35293. * @returns {string} Returns the upper cased string.
  35294. * @example
  35295. *
  35296. * _.upperCase('--foo-bar');
  35297. * // => 'FOO BAR'
  35298. *
  35299. * _.upperCase('fooBar');
  35300. * // => 'FOO BAR'
  35301. *
  35302. * _.upperCase('__foo_bar__');
  35303. * // => 'FOO BAR'
  35304. */
  35305. var upperCase = createCompounder(function(result, word, index) {
  35306. return result + (index ? ' ' : '') + word.toUpperCase();
  35307. });
  35308. /**
  35309. * Converts the first character of `string` to upper case.
  35310. *
  35311. * @static
  35312. * @memberOf _
  35313. * @since 4.0.0
  35314. * @category String
  35315. * @param {string} [string=''] The string to convert.
  35316. * @returns {string} Returns the converted string.
  35317. * @example
  35318. *
  35319. * _.upperFirst('fred');
  35320. * // => 'Fred'
  35321. *
  35322. * _.upperFirst('FRED');
  35323. * // => 'FRED'
  35324. */
  35325. var upperFirst = createCaseFirst('toUpperCase');
  35326. /**
  35327. * Splits `string` into an array of its words.
  35328. *
  35329. * @static
  35330. * @memberOf _
  35331. * @since 3.0.0
  35332. * @category String
  35333. * @param {string} [string=''] The string to inspect.
  35334. * @param {RegExp|string} [pattern] The pattern to match words.
  35335. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  35336. * @returns {Array} Returns the words of `string`.
  35337. * @example
  35338. *
  35339. * _.words('fred, barney, & pebbles');
  35340. * // => ['fred', 'barney', 'pebbles']
  35341. *
  35342. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  35343. * // => ['fred', 'barney', '&', 'pebbles']
  35344. */
  35345. function words(string, pattern, guard) {
  35346. string = toString(string);
  35347. pattern = guard ? undefined : pattern;
  35348. if (pattern === undefined) {
  35349. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  35350. }
  35351. return string.match(pattern) || [];
  35352. }
  35353. /*------------------------------------------------------------------------*/
  35354. /**
  35355. * Attempts to invoke `func`, returning either the result or the caught error
  35356. * object. Any additional arguments are provided to `func` when it's invoked.
  35357. *
  35358. * @static
  35359. * @memberOf _
  35360. * @since 3.0.0
  35361. * @category Util
  35362. * @param {Function} func The function to attempt.
  35363. * @param {...*} [args] The arguments to invoke `func` with.
  35364. * @returns {*} Returns the `func` result or error object.
  35365. * @example
  35366. *
  35367. * // Avoid throwing errors for invalid selectors.
  35368. * var elements = _.attempt(function(selector) {
  35369. * return document.querySelectorAll(selector);
  35370. * }, '>_>');
  35371. *
  35372. * if (_.isError(elements)) {
  35373. * elements = [];
  35374. * }
  35375. */
  35376. var attempt = baseRest(function(func, args) {
  35377. try {
  35378. return apply(func, undefined, args);
  35379. } catch (e) {
  35380. return isError(e) ? e : new Error(e);
  35381. }
  35382. });
  35383. /**
  35384. * Binds methods of an object to the object itself, overwriting the existing
  35385. * method.
  35386. *
  35387. * **Note:** This method doesn't set the "length" property of bound functions.
  35388. *
  35389. * @static
  35390. * @since 0.1.0
  35391. * @memberOf _
  35392. * @category Util
  35393. * @param {Object} object The object to bind and assign the bound methods to.
  35394. * @param {...(string|string[])} methodNames The object method names to bind.
  35395. * @returns {Object} Returns `object`.
  35396. * @example
  35397. *
  35398. * var view = {
  35399. * 'label': 'docs',
  35400. * 'click': function() {
  35401. * console.log('clicked ' + this.label);
  35402. * }
  35403. * };
  35404. *
  35405. * _.bindAll(view, ['click']);
  35406. * jQuery(element).on('click', view.click);
  35407. * // => Logs 'clicked docs' when clicked.
  35408. */
  35409. var bindAll = flatRest(function(object, methodNames) {
  35410. arrayEach(methodNames, function(key) {
  35411. key = toKey(key);
  35412. baseAssignValue(object, key, bind(object[key], object));
  35413. });
  35414. return object;
  35415. });
  35416. /**
  35417. * Creates a function that iterates over `pairs` and invokes the corresponding
  35418. * function of the first predicate to return truthy. The predicate-function
  35419. * pairs are invoked with the `this` binding and arguments of the created
  35420. * function.
  35421. *
  35422. * @static
  35423. * @memberOf _
  35424. * @since 4.0.0
  35425. * @category Util
  35426. * @param {Array} pairs The predicate-function pairs.
  35427. * @returns {Function} Returns the new composite function.
  35428. * @example
  35429. *
  35430. * var func = _.cond([
  35431. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  35432. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  35433. * [_.stubTrue, _.constant('no match')]
  35434. * ]);
  35435. *
  35436. * func({ 'a': 1, 'b': 2 });
  35437. * // => 'matches A'
  35438. *
  35439. * func({ 'a': 0, 'b': 1 });
  35440. * // => 'matches B'
  35441. *
  35442. * func({ 'a': '1', 'b': '2' });
  35443. * // => 'no match'
  35444. */
  35445. function cond(pairs) {
  35446. var length = pairs == null ? 0 : pairs.length,
  35447. toIteratee = getIteratee();
  35448. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  35449. if (typeof pair[1] != 'function') {
  35450. throw new TypeError(FUNC_ERROR_TEXT);
  35451. }
  35452. return [toIteratee(pair[0]), pair[1]];
  35453. });
  35454. return baseRest(function(args) {
  35455. var index = -1;
  35456. while (++index < length) {
  35457. var pair = pairs[index];
  35458. if (apply(pair[0], this, args)) {
  35459. return apply(pair[1], this, args);
  35460. }
  35461. }
  35462. });
  35463. }
  35464. /**
  35465. * Creates a function that invokes the predicate properties of `source` with
  35466. * the corresponding property values of a given object, returning `true` if
  35467. * all predicates return truthy, else `false`.
  35468. *
  35469. * **Note:** The created function is equivalent to `_.conformsTo` with
  35470. * `source` partially applied.
  35471. *
  35472. * @static
  35473. * @memberOf _
  35474. * @since 4.0.0
  35475. * @category Util
  35476. * @param {Object} source The object of property predicates to conform to.
  35477. * @returns {Function} Returns the new spec function.
  35478. * @example
  35479. *
  35480. * var objects = [
  35481. * { 'a': 2, 'b': 1 },
  35482. * { 'a': 1, 'b': 2 }
  35483. * ];
  35484. *
  35485. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  35486. * // => [{ 'a': 1, 'b': 2 }]
  35487. */
  35488. function conforms(source) {
  35489. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  35490. }
  35491. /**
  35492. * Creates a function that returns `value`.
  35493. *
  35494. * @static
  35495. * @memberOf _
  35496. * @since 2.4.0
  35497. * @category Util
  35498. * @param {*} value The value to return from the new function.
  35499. * @returns {Function} Returns the new constant function.
  35500. * @example
  35501. *
  35502. * var objects = _.times(2, _.constant({ 'a': 1 }));
  35503. *
  35504. * console.log(objects);
  35505. * // => [{ 'a': 1 }, { 'a': 1 }]
  35506. *
  35507. * console.log(objects[0] === objects[1]);
  35508. * // => true
  35509. */
  35510. function constant(value) {
  35511. return function() {
  35512. return value;
  35513. };
  35514. }
  35515. /**
  35516. * Checks `value` to determine whether a default value should be returned in
  35517. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  35518. * or `undefined`.
  35519. *
  35520. * @static
  35521. * @memberOf _
  35522. * @since 4.14.0
  35523. * @category Util
  35524. * @param {*} value The value to check.
  35525. * @param {*} defaultValue The default value.
  35526. * @returns {*} Returns the resolved value.
  35527. * @example
  35528. *
  35529. * _.defaultTo(1, 10);
  35530. * // => 1
  35531. *
  35532. * _.defaultTo(undefined, 10);
  35533. * // => 10
  35534. */
  35535. function defaultTo(value, defaultValue) {
  35536. return (value == null || value !== value) ? defaultValue : value;
  35537. }
  35538. /**
  35539. * Creates a function that returns the result of invoking the given functions
  35540. * with the `this` binding of the created function, where each successive
  35541. * invocation is supplied the return value of the previous.
  35542. *
  35543. * @static
  35544. * @memberOf _
  35545. * @since 3.0.0
  35546. * @category Util
  35547. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  35548. * @returns {Function} Returns the new composite function.
  35549. * @see _.flowRight
  35550. * @example
  35551. *
  35552. * function square(n) {
  35553. * return n * n;
  35554. * }
  35555. *
  35556. * var addSquare = _.flow([_.add, square]);
  35557. * addSquare(1, 2);
  35558. * // => 9
  35559. */
  35560. var flow = createFlow();
  35561. /**
  35562. * This method is like `_.flow` except that it creates a function that
  35563. * invokes the given functions from right to left.
  35564. *
  35565. * @static
  35566. * @since 3.0.0
  35567. * @memberOf _
  35568. * @category Util
  35569. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  35570. * @returns {Function} Returns the new composite function.
  35571. * @see _.flow
  35572. * @example
  35573. *
  35574. * function square(n) {
  35575. * return n * n;
  35576. * }
  35577. *
  35578. * var addSquare = _.flowRight([square, _.add]);
  35579. * addSquare(1, 2);
  35580. * // => 9
  35581. */
  35582. var flowRight = createFlow(true);
  35583. /**
  35584. * This method returns the first argument it receives.
  35585. *
  35586. * @static
  35587. * @since 0.1.0
  35588. * @memberOf _
  35589. * @category Util
  35590. * @param {*} value Any value.
  35591. * @returns {*} Returns `value`.
  35592. * @example
  35593. *
  35594. * var object = { 'a': 1 };
  35595. *
  35596. * console.log(_.identity(object) === object);
  35597. * // => true
  35598. */
  35599. function identity(value) {
  35600. return value;
  35601. }
  35602. /**
  35603. * Creates a function that invokes `func` with the arguments of the created
  35604. * function. If `func` is a property name, the created function returns the
  35605. * property value for a given element. If `func` is an array or object, the
  35606. * created function returns `true` for elements that contain the equivalent
  35607. * source properties, otherwise it returns `false`.
  35608. *
  35609. * @static
  35610. * @since 4.0.0
  35611. * @memberOf _
  35612. * @category Util
  35613. * @param {*} [func=_.identity] The value to convert to a callback.
  35614. * @returns {Function} Returns the callback.
  35615. * @example
  35616. *
  35617. * var users = [
  35618. * { 'user': 'barney', 'age': 36, 'active': true },
  35619. * { 'user': 'fred', 'age': 40, 'active': false }
  35620. * ];
  35621. *
  35622. * // The `_.matches` iteratee shorthand.
  35623. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  35624. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  35625. *
  35626. * // The `_.matchesProperty` iteratee shorthand.
  35627. * _.filter(users, _.iteratee(['user', 'fred']));
  35628. * // => [{ 'user': 'fred', 'age': 40 }]
  35629. *
  35630. * // The `_.property` iteratee shorthand.
  35631. * _.map(users, _.iteratee('user'));
  35632. * // => ['barney', 'fred']
  35633. *
  35634. * // Create custom iteratee shorthands.
  35635. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  35636. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  35637. * return func.test(string);
  35638. * };
  35639. * });
  35640. *
  35641. * _.filter(['abc', 'def'], /ef/);
  35642. * // => ['def']
  35643. */
  35644. function iteratee(func) {
  35645. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  35646. }
  35647. /**
  35648. * Creates a function that performs a partial deep comparison between a given
  35649. * object and `source`, returning `true` if the given object has equivalent
  35650. * property values, else `false`.
  35651. *
  35652. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  35653. * partially applied.
  35654. *
  35655. * Partial comparisons will match empty array and empty object `source`
  35656. * values against any array or object value, respectively. See `_.isEqual`
  35657. * for a list of supported value comparisons.
  35658. *
  35659. * @static
  35660. * @memberOf _
  35661. * @since 3.0.0
  35662. * @category Util
  35663. * @param {Object} source The object of property values to match.
  35664. * @returns {Function} Returns the new spec function.
  35665. * @example
  35666. *
  35667. * var objects = [
  35668. * { 'a': 1, 'b': 2, 'c': 3 },
  35669. * { 'a': 4, 'b': 5, 'c': 6 }
  35670. * ];
  35671. *
  35672. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  35673. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  35674. */
  35675. function matches(source) {
  35676. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  35677. }
  35678. /**
  35679. * Creates a function that performs a partial deep comparison between the
  35680. * value at `path` of a given object to `srcValue`, returning `true` if the
  35681. * object value is equivalent, else `false`.
  35682. *
  35683. * **Note:** Partial comparisons will match empty array and empty object
  35684. * `srcValue` values against any array or object value, respectively. See
  35685. * `_.isEqual` for a list of supported value comparisons.
  35686. *
  35687. * @static
  35688. * @memberOf _
  35689. * @since 3.2.0
  35690. * @category Util
  35691. * @param {Array|string} path The path of the property to get.
  35692. * @param {*} srcValue The value to match.
  35693. * @returns {Function} Returns the new spec function.
  35694. * @example
  35695. *
  35696. * var objects = [
  35697. * { 'a': 1, 'b': 2, 'c': 3 },
  35698. * { 'a': 4, 'b': 5, 'c': 6 }
  35699. * ];
  35700. *
  35701. * _.find(objects, _.matchesProperty('a', 4));
  35702. * // => { 'a': 4, 'b': 5, 'c': 6 }
  35703. */
  35704. function matchesProperty(path, srcValue) {
  35705. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  35706. }
  35707. /**
  35708. * Creates a function that invokes the method at `path` of a given object.
  35709. * Any additional arguments are provided to the invoked method.
  35710. *
  35711. * @static
  35712. * @memberOf _
  35713. * @since 3.7.0
  35714. * @category Util
  35715. * @param {Array|string} path The path of the method to invoke.
  35716. * @param {...*} [args] The arguments to invoke the method with.
  35717. * @returns {Function} Returns the new invoker function.
  35718. * @example
  35719. *
  35720. * var objects = [
  35721. * { 'a': { 'b': _.constant(2) } },
  35722. * { 'a': { 'b': _.constant(1) } }
  35723. * ];
  35724. *
  35725. * _.map(objects, _.method('a.b'));
  35726. * // => [2, 1]
  35727. *
  35728. * _.map(objects, _.method(['a', 'b']));
  35729. * // => [2, 1]
  35730. */
  35731. var method = baseRest(function(path, args) {
  35732. return function(object) {
  35733. return baseInvoke(object, path, args);
  35734. };
  35735. });
  35736. /**
  35737. * The opposite of `_.method`; this method creates a function that invokes
  35738. * the method at a given path of `object`. Any additional arguments are
  35739. * provided to the invoked method.
  35740. *
  35741. * @static
  35742. * @memberOf _
  35743. * @since 3.7.0
  35744. * @category Util
  35745. * @param {Object} object The object to query.
  35746. * @param {...*} [args] The arguments to invoke the method with.
  35747. * @returns {Function} Returns the new invoker function.
  35748. * @example
  35749. *
  35750. * var array = _.times(3, _.constant),
  35751. * object = { 'a': array, 'b': array, 'c': array };
  35752. *
  35753. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  35754. * // => [2, 0]
  35755. *
  35756. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  35757. * // => [2, 0]
  35758. */
  35759. var methodOf = baseRest(function(object, args) {
  35760. return function(path) {
  35761. return baseInvoke(object, path, args);
  35762. };
  35763. });
  35764. /**
  35765. * Adds all own enumerable string keyed function properties of a source
  35766. * object to the destination object. If `object` is a function, then methods
  35767. * are added to its prototype as well.
  35768. *
  35769. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  35770. * avoid conflicts caused by modifying the original.
  35771. *
  35772. * @static
  35773. * @since 0.1.0
  35774. * @memberOf _
  35775. * @category Util
  35776. * @param {Function|Object} [object=lodash] The destination object.
  35777. * @param {Object} source The object of functions to add.
  35778. * @param {Object} [options={}] The options object.
  35779. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  35780. * @returns {Function|Object} Returns `object`.
  35781. * @example
  35782. *
  35783. * function vowels(string) {
  35784. * return _.filter(string, function(v) {
  35785. * return /[aeiou]/i.test(v);
  35786. * });
  35787. * }
  35788. *
  35789. * _.mixin({ 'vowels': vowels });
  35790. * _.vowels('fred');
  35791. * // => ['e']
  35792. *
  35793. * _('fred').vowels().value();
  35794. * // => ['e']
  35795. *
  35796. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  35797. * _('fred').vowels();
  35798. * // => ['e']
  35799. */
  35800. function mixin(object, source, options) {
  35801. var props = keys(source),
  35802. methodNames = baseFunctions(source, props);
  35803. if (options == null &&
  35804. !(isObject(source) && (methodNames.length || !props.length))) {
  35805. options = source;
  35806. source = object;
  35807. object = this;
  35808. methodNames = baseFunctions(source, keys(source));
  35809. }
  35810. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  35811. isFunc = isFunction(object);
  35812. arrayEach(methodNames, function(methodName) {
  35813. var func = source[methodName];
  35814. object[methodName] = func;
  35815. if (isFunc) {
  35816. object.prototype[methodName] = function() {
  35817. var chainAll = this.__chain__;
  35818. if (chain || chainAll) {
  35819. var result = object(this.__wrapped__),
  35820. actions = result.__actions__ = copyArray(this.__actions__);
  35821. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  35822. result.__chain__ = chainAll;
  35823. return result;
  35824. }
  35825. return func.apply(object, arrayPush([this.value()], arguments));
  35826. };
  35827. }
  35828. });
  35829. return object;
  35830. }
  35831. /**
  35832. * Reverts the `_` variable to its previous value and returns a reference to
  35833. * the `lodash` function.
  35834. *
  35835. * @static
  35836. * @since 0.1.0
  35837. * @memberOf _
  35838. * @category Util
  35839. * @returns {Function} Returns the `lodash` function.
  35840. * @example
  35841. *
  35842. * var lodash = _.noConflict();
  35843. */
  35844. function noConflict() {
  35845. if (root._ === this) {
  35846. root._ = oldDash;
  35847. }
  35848. return this;
  35849. }
  35850. /**
  35851. * This method returns `undefined`.
  35852. *
  35853. * @static
  35854. * @memberOf _
  35855. * @since 2.3.0
  35856. * @category Util
  35857. * @example
  35858. *
  35859. * _.times(2, _.noop);
  35860. * // => [undefined, undefined]
  35861. */
  35862. function noop() {
  35863. // No operation performed.
  35864. }
  35865. /**
  35866. * Creates a function that gets the argument at index `n`. If `n` is negative,
  35867. * the nth argument from the end is returned.
  35868. *
  35869. * @static
  35870. * @memberOf _
  35871. * @since 4.0.0
  35872. * @category Util
  35873. * @param {number} [n=0] The index of the argument to return.
  35874. * @returns {Function} Returns the new pass-thru function.
  35875. * @example
  35876. *
  35877. * var func = _.nthArg(1);
  35878. * func('a', 'b', 'c', 'd');
  35879. * // => 'b'
  35880. *
  35881. * var func = _.nthArg(-2);
  35882. * func('a', 'b', 'c', 'd');
  35883. * // => 'c'
  35884. */
  35885. function nthArg(n) {
  35886. n = toInteger(n);
  35887. return baseRest(function(args) {
  35888. return baseNth(args, n);
  35889. });
  35890. }
  35891. /**
  35892. * Creates a function that invokes `iteratees` with the arguments it receives
  35893. * and returns their results.
  35894. *
  35895. * @static
  35896. * @memberOf _
  35897. * @since 4.0.0
  35898. * @category Util
  35899. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  35900. * The iteratees to invoke.
  35901. * @returns {Function} Returns the new function.
  35902. * @example
  35903. *
  35904. * var func = _.over([Math.max, Math.min]);
  35905. *
  35906. * func(1, 2, 3, 4);
  35907. * // => [4, 1]
  35908. */
  35909. var over = createOver(arrayMap);
  35910. /**
  35911. * Creates a function that checks if **all** of the `predicates` return
  35912. * truthy when invoked with the arguments it receives.
  35913. *
  35914. * @static
  35915. * @memberOf _
  35916. * @since 4.0.0
  35917. * @category Util
  35918. * @param {...(Function|Function[])} [predicates=[_.identity]]
  35919. * The predicates to check.
  35920. * @returns {Function} Returns the new function.
  35921. * @example
  35922. *
  35923. * var func = _.overEvery([Boolean, isFinite]);
  35924. *
  35925. * func('1');
  35926. * // => true
  35927. *
  35928. * func(null);
  35929. * // => false
  35930. *
  35931. * func(NaN);
  35932. * // => false
  35933. */
  35934. var overEvery = createOver(arrayEvery);
  35935. /**
  35936. * Creates a function that checks if **any** of the `predicates` return
  35937. * truthy when invoked with the arguments it receives.
  35938. *
  35939. * @static
  35940. * @memberOf _
  35941. * @since 4.0.0
  35942. * @category Util
  35943. * @param {...(Function|Function[])} [predicates=[_.identity]]
  35944. * The predicates to check.
  35945. * @returns {Function} Returns the new function.
  35946. * @example
  35947. *
  35948. * var func = _.overSome([Boolean, isFinite]);
  35949. *
  35950. * func('1');
  35951. * // => true
  35952. *
  35953. * func(null);
  35954. * // => true
  35955. *
  35956. * func(NaN);
  35957. * // => false
  35958. */
  35959. var overSome = createOver(arraySome);
  35960. /**
  35961. * Creates a function that returns the value at `path` of a given object.
  35962. *
  35963. * @static
  35964. * @memberOf _
  35965. * @since 2.4.0
  35966. * @category Util
  35967. * @param {Array|string} path The path of the property to get.
  35968. * @returns {Function} Returns the new accessor function.
  35969. * @example
  35970. *
  35971. * var objects = [
  35972. * { 'a': { 'b': 2 } },
  35973. * { 'a': { 'b': 1 } }
  35974. * ];
  35975. *
  35976. * _.map(objects, _.property('a.b'));
  35977. * // => [2, 1]
  35978. *
  35979. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  35980. * // => [1, 2]
  35981. */
  35982. function property(path) {
  35983. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  35984. }
  35985. /**
  35986. * The opposite of `_.property`; this method creates a function that returns
  35987. * the value at a given path of `object`.
  35988. *
  35989. * @static
  35990. * @memberOf _
  35991. * @since 3.0.0
  35992. * @category Util
  35993. * @param {Object} object The object to query.
  35994. * @returns {Function} Returns the new accessor function.
  35995. * @example
  35996. *
  35997. * var array = [0, 1, 2],
  35998. * object = { 'a': array, 'b': array, 'c': array };
  35999. *
  36000. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  36001. * // => [2, 0]
  36002. *
  36003. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  36004. * // => [2, 0]
  36005. */
  36006. function propertyOf(object) {
  36007. return function(path) {
  36008. return object == null ? undefined : baseGet(object, path);
  36009. };
  36010. }
  36011. /**
  36012. * Creates an array of numbers (positive and/or negative) progressing from
  36013. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  36014. * `start` is specified without an `end` or `step`. If `end` is not specified,
  36015. * it's set to `start` with `start` then set to `0`.
  36016. *
  36017. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  36018. * floating-point values which can produce unexpected results.
  36019. *
  36020. * @static
  36021. * @since 0.1.0
  36022. * @memberOf _
  36023. * @category Util
  36024. * @param {number} [start=0] The start of the range.
  36025. * @param {number} end The end of the range.
  36026. * @param {number} [step=1] The value to increment or decrement by.
  36027. * @returns {Array} Returns the range of numbers.
  36028. * @see _.inRange, _.rangeRight
  36029. * @example
  36030. *
  36031. * _.range(4);
  36032. * // => [0, 1, 2, 3]
  36033. *
  36034. * _.range(-4);
  36035. * // => [0, -1, -2, -3]
  36036. *
  36037. * _.range(1, 5);
  36038. * // => [1, 2, 3, 4]
  36039. *
  36040. * _.range(0, 20, 5);
  36041. * // => [0, 5, 10, 15]
  36042. *
  36043. * _.range(0, -4, -1);
  36044. * // => [0, -1, -2, -3]
  36045. *
  36046. * _.range(1, 4, 0);
  36047. * // => [1, 1, 1]
  36048. *
  36049. * _.range(0);
  36050. * // => []
  36051. */
  36052. var range = createRange();
  36053. /**
  36054. * This method is like `_.range` except that it populates values in
  36055. * descending order.
  36056. *
  36057. * @static
  36058. * @memberOf _
  36059. * @since 4.0.0
  36060. * @category Util
  36061. * @param {number} [start=0] The start of the range.
  36062. * @param {number} end The end of the range.
  36063. * @param {number} [step=1] The value to increment or decrement by.
  36064. * @returns {Array} Returns the range of numbers.
  36065. * @see _.inRange, _.range
  36066. * @example
  36067. *
  36068. * _.rangeRight(4);
  36069. * // => [3, 2, 1, 0]
  36070. *
  36071. * _.rangeRight(-4);
  36072. * // => [-3, -2, -1, 0]
  36073. *
  36074. * _.rangeRight(1, 5);
  36075. * // => [4, 3, 2, 1]
  36076. *
  36077. * _.rangeRight(0, 20, 5);
  36078. * // => [15, 10, 5, 0]
  36079. *
  36080. * _.rangeRight(0, -4, -1);
  36081. * // => [-3, -2, -1, 0]
  36082. *
  36083. * _.rangeRight(1, 4, 0);
  36084. * // => [1, 1, 1]
  36085. *
  36086. * _.rangeRight(0);
  36087. * // => []
  36088. */
  36089. var rangeRight = createRange(true);
  36090. /**
  36091. * This method returns a new empty array.
  36092. *
  36093. * @static
  36094. * @memberOf _
  36095. * @since 4.13.0
  36096. * @category Util
  36097. * @returns {Array} Returns the new empty array.
  36098. * @example
  36099. *
  36100. * var arrays = _.times(2, _.stubArray);
  36101. *
  36102. * console.log(arrays);
  36103. * // => [[], []]
  36104. *
  36105. * console.log(arrays[0] === arrays[1]);
  36106. * // => false
  36107. */
  36108. function stubArray() {
  36109. return [];
  36110. }
  36111. /**
  36112. * This method returns `false`.
  36113. *
  36114. * @static
  36115. * @memberOf _
  36116. * @since 4.13.0
  36117. * @category Util
  36118. * @returns {boolean} Returns `false`.
  36119. * @example
  36120. *
  36121. * _.times(2, _.stubFalse);
  36122. * // => [false, false]
  36123. */
  36124. function stubFalse() {
  36125. return false;
  36126. }
  36127. /**
  36128. * This method returns a new empty object.
  36129. *
  36130. * @static
  36131. * @memberOf _
  36132. * @since 4.13.0
  36133. * @category Util
  36134. * @returns {Object} Returns the new empty object.
  36135. * @example
  36136. *
  36137. * var objects = _.times(2, _.stubObject);
  36138. *
  36139. * console.log(objects);
  36140. * // => [{}, {}]
  36141. *
  36142. * console.log(objects[0] === objects[1]);
  36143. * // => false
  36144. */
  36145. function stubObject() {
  36146. return {};
  36147. }
  36148. /**
  36149. * This method returns an empty string.
  36150. *
  36151. * @static
  36152. * @memberOf _
  36153. * @since 4.13.0
  36154. * @category Util
  36155. * @returns {string} Returns the empty string.
  36156. * @example
  36157. *
  36158. * _.times(2, _.stubString);
  36159. * // => ['', '']
  36160. */
  36161. function stubString() {
  36162. return '';
  36163. }
  36164. /**
  36165. * This method returns `true`.
  36166. *
  36167. * @static
  36168. * @memberOf _
  36169. * @since 4.13.0
  36170. * @category Util
  36171. * @returns {boolean} Returns `true`.
  36172. * @example
  36173. *
  36174. * _.times(2, _.stubTrue);
  36175. * // => [true, true]
  36176. */
  36177. function stubTrue() {
  36178. return true;
  36179. }
  36180. /**
  36181. * Invokes the iteratee `n` times, returning an array of the results of
  36182. * each invocation. The iteratee is invoked with one argument; (index).
  36183. *
  36184. * @static
  36185. * @since 0.1.0
  36186. * @memberOf _
  36187. * @category Util
  36188. * @param {number} n The number of times to invoke `iteratee`.
  36189. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  36190. * @returns {Array} Returns the array of results.
  36191. * @example
  36192. *
  36193. * _.times(3, String);
  36194. * // => ['0', '1', '2']
  36195. *
  36196. * _.times(4, _.constant(0));
  36197. * // => [0, 0, 0, 0]
  36198. */
  36199. function times(n, iteratee) {
  36200. n = toInteger(n);
  36201. if (n < 1 || n > MAX_SAFE_INTEGER) {
  36202. return [];
  36203. }
  36204. var index = MAX_ARRAY_LENGTH,
  36205. length = nativeMin(n, MAX_ARRAY_LENGTH);
  36206. iteratee = getIteratee(iteratee);
  36207. n -= MAX_ARRAY_LENGTH;
  36208. var result = baseTimes(length, iteratee);
  36209. while (++index < n) {
  36210. iteratee(index);
  36211. }
  36212. return result;
  36213. }
  36214. /**
  36215. * Converts `value` to a property path array.
  36216. *
  36217. * @static
  36218. * @memberOf _
  36219. * @since 4.0.0
  36220. * @category Util
  36221. * @param {*} value The value to convert.
  36222. * @returns {Array} Returns the new property path array.
  36223. * @example
  36224. *
  36225. * _.toPath('a.b.c');
  36226. * // => ['a', 'b', 'c']
  36227. *
  36228. * _.toPath('a[0].b.c');
  36229. * // => ['a', '0', 'b', 'c']
  36230. */
  36231. function toPath(value) {
  36232. if (isArray(value)) {
  36233. return arrayMap(value, toKey);
  36234. }
  36235. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  36236. }
  36237. /**
  36238. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  36239. *
  36240. * @static
  36241. * @since 0.1.0
  36242. * @memberOf _
  36243. * @category Util
  36244. * @param {string} [prefix=''] The value to prefix the ID with.
  36245. * @returns {string} Returns the unique ID.
  36246. * @example
  36247. *
  36248. * _.uniqueId('contact_');
  36249. * // => 'contact_104'
  36250. *
  36251. * _.uniqueId();
  36252. * // => '105'
  36253. */
  36254. function uniqueId(prefix) {
  36255. var id = ++idCounter;
  36256. return toString(prefix) + id;
  36257. }
  36258. /*------------------------------------------------------------------------*/
  36259. /**
  36260. * Adds two numbers.
  36261. *
  36262. * @static
  36263. * @memberOf _
  36264. * @since 3.4.0
  36265. * @category Math
  36266. * @param {number} augend The first number in an addition.
  36267. * @param {number} addend The second number in an addition.
  36268. * @returns {number} Returns the total.
  36269. * @example
  36270. *
  36271. * _.add(6, 4);
  36272. * // => 10
  36273. */
  36274. var add = createMathOperation(function(augend, addend) {
  36275. return augend + addend;
  36276. }, 0);
  36277. /**
  36278. * Computes `number` rounded up to `precision`.
  36279. *
  36280. * @static
  36281. * @memberOf _
  36282. * @since 3.10.0
  36283. * @category Math
  36284. * @param {number} number The number to round up.
  36285. * @param {number} [precision=0] The precision to round up to.
  36286. * @returns {number} Returns the rounded up number.
  36287. * @example
  36288. *
  36289. * _.ceil(4.006);
  36290. * // => 5
  36291. *
  36292. * _.ceil(6.004, 2);
  36293. * // => 6.01
  36294. *
  36295. * _.ceil(6040, -2);
  36296. * // => 6100
  36297. */
  36298. var ceil = createRound('ceil');
  36299. /**
  36300. * Divide two numbers.
  36301. *
  36302. * @static
  36303. * @memberOf _
  36304. * @since 4.7.0
  36305. * @category Math
  36306. * @param {number} dividend The first number in a division.
  36307. * @param {number} divisor The second number in a division.
  36308. * @returns {number} Returns the quotient.
  36309. * @example
  36310. *
  36311. * _.divide(6, 4);
  36312. * // => 1.5
  36313. */
  36314. var divide = createMathOperation(function(dividend, divisor) {
  36315. return dividend / divisor;
  36316. }, 1);
  36317. /**
  36318. * Computes `number` rounded down to `precision`.
  36319. *
  36320. * @static
  36321. * @memberOf _
  36322. * @since 3.10.0
  36323. * @category Math
  36324. * @param {number} number The number to round down.
  36325. * @param {number} [precision=0] The precision to round down to.
  36326. * @returns {number} Returns the rounded down number.
  36327. * @example
  36328. *
  36329. * _.floor(4.006);
  36330. * // => 4
  36331. *
  36332. * _.floor(0.046, 2);
  36333. * // => 0.04
  36334. *
  36335. * _.floor(4060, -2);
  36336. * // => 4000
  36337. */
  36338. var floor = createRound('floor');
  36339. /**
  36340. * Computes the maximum value of `array`. If `array` is empty or falsey,
  36341. * `undefined` is returned.
  36342. *
  36343. * @static
  36344. * @since 0.1.0
  36345. * @memberOf _
  36346. * @category Math
  36347. * @param {Array} array The array to iterate over.
  36348. * @returns {*} Returns the maximum value.
  36349. * @example
  36350. *
  36351. * _.max([4, 2, 8, 6]);
  36352. * // => 8
  36353. *
  36354. * _.max([]);
  36355. * // => undefined
  36356. */
  36357. function max(array) {
  36358. return (array && array.length)
  36359. ? baseExtremum(array, identity, baseGt)
  36360. : undefined;
  36361. }
  36362. /**
  36363. * This method is like `_.max` except that it accepts `iteratee` which is
  36364. * invoked for each element in `array` to generate the criterion by which
  36365. * the value is ranked. The iteratee is invoked with one argument: (value).
  36366. *
  36367. * @static
  36368. * @memberOf _
  36369. * @since 4.0.0
  36370. * @category Math
  36371. * @param {Array} array The array to iterate over.
  36372. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  36373. * @returns {*} Returns the maximum value.
  36374. * @example
  36375. *
  36376. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  36377. *
  36378. * _.maxBy(objects, function(o) { return o.n; });
  36379. * // => { 'n': 2 }
  36380. *
  36381. * // The `_.property` iteratee shorthand.
  36382. * _.maxBy(objects, 'n');
  36383. * // => { 'n': 2 }
  36384. */
  36385. function maxBy(array, iteratee) {
  36386. return (array && array.length)
  36387. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  36388. : undefined;
  36389. }
  36390. /**
  36391. * Computes the mean of the values in `array`.
  36392. *
  36393. * @static
  36394. * @memberOf _
  36395. * @since 4.0.0
  36396. * @category Math
  36397. * @param {Array} array The array to iterate over.
  36398. * @returns {number} Returns the mean.
  36399. * @example
  36400. *
  36401. * _.mean([4, 2, 8, 6]);
  36402. * // => 5
  36403. */
  36404. function mean(array) {
  36405. return baseMean(array, identity);
  36406. }
  36407. /**
  36408. * This method is like `_.mean` except that it accepts `iteratee` which is
  36409. * invoked for each element in `array` to generate the value to be averaged.
  36410. * The iteratee is invoked with one argument: (value).
  36411. *
  36412. * @static
  36413. * @memberOf _
  36414. * @since 4.7.0
  36415. * @category Math
  36416. * @param {Array} array The array to iterate over.
  36417. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  36418. * @returns {number} Returns the mean.
  36419. * @example
  36420. *
  36421. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  36422. *
  36423. * _.meanBy(objects, function(o) { return o.n; });
  36424. * // => 5
  36425. *
  36426. * // The `_.property` iteratee shorthand.
  36427. * _.meanBy(objects, 'n');
  36428. * // => 5
  36429. */
  36430. function meanBy(array, iteratee) {
  36431. return baseMean(array, getIteratee(iteratee, 2));
  36432. }
  36433. /**
  36434. * Computes the minimum value of `array`. If `array` is empty or falsey,
  36435. * `undefined` is returned.
  36436. *
  36437. * @static
  36438. * @since 0.1.0
  36439. * @memberOf _
  36440. * @category Math
  36441. * @param {Array} array The array to iterate over.
  36442. * @returns {*} Returns the minimum value.
  36443. * @example
  36444. *
  36445. * _.min([4, 2, 8, 6]);
  36446. * // => 2
  36447. *
  36448. * _.min([]);
  36449. * // => undefined
  36450. */
  36451. function min(array) {
  36452. return (array && array.length)
  36453. ? baseExtremum(array, identity, baseLt)
  36454. : undefined;
  36455. }
  36456. /**
  36457. * This method is like `_.min` except that it accepts `iteratee` which is
  36458. * invoked for each element in `array` to generate the criterion by which
  36459. * the value is ranked. The iteratee is invoked with one argument: (value).
  36460. *
  36461. * @static
  36462. * @memberOf _
  36463. * @since 4.0.0
  36464. * @category Math
  36465. * @param {Array} array The array to iterate over.
  36466. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  36467. * @returns {*} Returns the minimum value.
  36468. * @example
  36469. *
  36470. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  36471. *
  36472. * _.minBy(objects, function(o) { return o.n; });
  36473. * // => { 'n': 1 }
  36474. *
  36475. * // The `_.property` iteratee shorthand.
  36476. * _.minBy(objects, 'n');
  36477. * // => { 'n': 1 }
  36478. */
  36479. function minBy(array, iteratee) {
  36480. return (array && array.length)
  36481. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  36482. : undefined;
  36483. }
  36484. /**
  36485. * Multiply two numbers.
  36486. *
  36487. * @static
  36488. * @memberOf _
  36489. * @since 4.7.0
  36490. * @category Math
  36491. * @param {number} multiplier The first number in a multiplication.
  36492. * @param {number} multiplicand The second number in a multiplication.
  36493. * @returns {number} Returns the product.
  36494. * @example
  36495. *
  36496. * _.multiply(6, 4);
  36497. * // => 24
  36498. */
  36499. var multiply = createMathOperation(function(multiplier, multiplicand) {
  36500. return multiplier * multiplicand;
  36501. }, 1);
  36502. /**
  36503. * Computes `number` rounded to `precision`.
  36504. *
  36505. * @static
  36506. * @memberOf _
  36507. * @since 3.10.0
  36508. * @category Math
  36509. * @param {number} number The number to round.
  36510. * @param {number} [precision=0] The precision to round to.
  36511. * @returns {number} Returns the rounded number.
  36512. * @example
  36513. *
  36514. * _.round(4.006);
  36515. * // => 4
  36516. *
  36517. * _.round(4.006, 2);
  36518. * // => 4.01
  36519. *
  36520. * _.round(4060, -2);
  36521. * // => 4100
  36522. */
  36523. var round = createRound('round');
  36524. /**
  36525. * Subtract two numbers.
  36526. *
  36527. * @static
  36528. * @memberOf _
  36529. * @since 4.0.0
  36530. * @category Math
  36531. * @param {number} minuend The first number in a subtraction.
  36532. * @param {number} subtrahend The second number in a subtraction.
  36533. * @returns {number} Returns the difference.
  36534. * @example
  36535. *
  36536. * _.subtract(6, 4);
  36537. * // => 2
  36538. */
  36539. var subtract = createMathOperation(function(minuend, subtrahend) {
  36540. return minuend - subtrahend;
  36541. }, 0);
  36542. /**
  36543. * Computes the sum of the values in `array`.
  36544. *
  36545. * @static
  36546. * @memberOf _
  36547. * @since 3.4.0
  36548. * @category Math
  36549. * @param {Array} array The array to iterate over.
  36550. * @returns {number} Returns the sum.
  36551. * @example
  36552. *
  36553. * _.sum([4, 2, 8, 6]);
  36554. * // => 20
  36555. */
  36556. function sum(array) {
  36557. return (array && array.length)
  36558. ? baseSum(array, identity)
  36559. : 0;
  36560. }
  36561. /**
  36562. * This method is like `_.sum` except that it accepts `iteratee` which is
  36563. * invoked for each element in `array` to generate the value to be summed.
  36564. * The iteratee is invoked with one argument: (value).
  36565. *
  36566. * @static
  36567. * @memberOf _
  36568. * @since 4.0.0
  36569. * @category Math
  36570. * @param {Array} array The array to iterate over.
  36571. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  36572. * @returns {number} Returns the sum.
  36573. * @example
  36574. *
  36575. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  36576. *
  36577. * _.sumBy(objects, function(o) { return o.n; });
  36578. * // => 20
  36579. *
  36580. * // The `_.property` iteratee shorthand.
  36581. * _.sumBy(objects, 'n');
  36582. * // => 20
  36583. */
  36584. function sumBy(array, iteratee) {
  36585. return (array && array.length)
  36586. ? baseSum(array, getIteratee(iteratee, 2))
  36587. : 0;
  36588. }
  36589. /*------------------------------------------------------------------------*/
  36590. // Add methods that return wrapped values in chain sequences.
  36591. lodash.after = after;
  36592. lodash.ary = ary;
  36593. lodash.assign = assign;
  36594. lodash.assignIn = assignIn;
  36595. lodash.assignInWith = assignInWith;
  36596. lodash.assignWith = assignWith;
  36597. lodash.at = at;
  36598. lodash.before = before;
  36599. lodash.bind = bind;
  36600. lodash.bindAll = bindAll;
  36601. lodash.bindKey = bindKey;
  36602. lodash.castArray = castArray;
  36603. lodash.chain = chain;
  36604. lodash.chunk = chunk;
  36605. lodash.compact = compact;
  36606. lodash.concat = concat;
  36607. lodash.cond = cond;
  36608. lodash.conforms = conforms;
  36609. lodash.constant = constant;
  36610. lodash.countBy = countBy;
  36611. lodash.create = create;
  36612. lodash.curry = curry;
  36613. lodash.curryRight = curryRight;
  36614. lodash.debounce = debounce;
  36615. lodash.defaults = defaults;
  36616. lodash.defaultsDeep = defaultsDeep;
  36617. lodash.defer = defer;
  36618. lodash.delay = delay;
  36619. lodash.difference = difference;
  36620. lodash.differenceBy = differenceBy;
  36621. lodash.differenceWith = differenceWith;
  36622. lodash.drop = drop;
  36623. lodash.dropRight = dropRight;
  36624. lodash.dropRightWhile = dropRightWhile;
  36625. lodash.dropWhile = dropWhile;
  36626. lodash.fill = fill;
  36627. lodash.filter = filter;
  36628. lodash.flatMap = flatMap;
  36629. lodash.flatMapDeep = flatMapDeep;
  36630. lodash.flatMapDepth = flatMapDepth;
  36631. lodash.flatten = flatten;
  36632. lodash.flattenDeep = flattenDeep;
  36633. lodash.flattenDepth = flattenDepth;
  36634. lodash.flip = flip;
  36635. lodash.flow = flow;
  36636. lodash.flowRight = flowRight;
  36637. lodash.fromPairs = fromPairs;
  36638. lodash.functions = functions;
  36639. lodash.functionsIn = functionsIn;
  36640. lodash.groupBy = groupBy;
  36641. lodash.initial = initial;
  36642. lodash.intersection = intersection;
  36643. lodash.intersectionBy = intersectionBy;
  36644. lodash.intersectionWith = intersectionWith;
  36645. lodash.invert = invert;
  36646. lodash.invertBy = invertBy;
  36647. lodash.invokeMap = invokeMap;
  36648. lodash.iteratee = iteratee;
  36649. lodash.keyBy = keyBy;
  36650. lodash.keys = keys;
  36651. lodash.keysIn = keysIn;
  36652. lodash.map = map;
  36653. lodash.mapKeys = mapKeys;
  36654. lodash.mapValues = mapValues;
  36655. lodash.matches = matches;
  36656. lodash.matchesProperty = matchesProperty;
  36657. lodash.memoize = memoize;
  36658. lodash.merge = merge;
  36659. lodash.mergeWith = mergeWith;
  36660. lodash.method = method;
  36661. lodash.methodOf = methodOf;
  36662. lodash.mixin = mixin;
  36663. lodash.negate = negate;
  36664. lodash.nthArg = nthArg;
  36665. lodash.omit = omit;
  36666. lodash.omitBy = omitBy;
  36667. lodash.once = once;
  36668. lodash.orderBy = orderBy;
  36669. lodash.over = over;
  36670. lodash.overArgs = overArgs;
  36671. lodash.overEvery = overEvery;
  36672. lodash.overSome = overSome;
  36673. lodash.partial = partial;
  36674. lodash.partialRight = partialRight;
  36675. lodash.partition = partition;
  36676. lodash.pick = pick;
  36677. lodash.pickBy = pickBy;
  36678. lodash.property = property;
  36679. lodash.propertyOf = propertyOf;
  36680. lodash.pull = pull;
  36681. lodash.pullAll = pullAll;
  36682. lodash.pullAllBy = pullAllBy;
  36683. lodash.pullAllWith = pullAllWith;
  36684. lodash.pullAt = pullAt;
  36685. lodash.range = range;
  36686. lodash.rangeRight = rangeRight;
  36687. lodash.rearg = rearg;
  36688. lodash.reject = reject;
  36689. lodash.remove = remove;
  36690. lodash.rest = rest;
  36691. lodash.reverse = reverse;
  36692. lodash.sampleSize = sampleSize;
  36693. lodash.set = set;
  36694. lodash.setWith = setWith;
  36695. lodash.shuffle = shuffle;
  36696. lodash.slice = slice;
  36697. lodash.sortBy = sortBy;
  36698. lodash.sortedUniq = sortedUniq;
  36699. lodash.sortedUniqBy = sortedUniqBy;
  36700. lodash.split = split;
  36701. lodash.spread = spread;
  36702. lodash.tail = tail;
  36703. lodash.take = take;
  36704. lodash.takeRight = takeRight;
  36705. lodash.takeRightWhile = takeRightWhile;
  36706. lodash.takeWhile = takeWhile;
  36707. lodash.tap = tap;
  36708. lodash.throttle = throttle;
  36709. lodash.thru = thru;
  36710. lodash.toArray = toArray;
  36711. lodash.toPairs = toPairs;
  36712. lodash.toPairsIn = toPairsIn;
  36713. lodash.toPath = toPath;
  36714. lodash.toPlainObject = toPlainObject;
  36715. lodash.transform = transform;
  36716. lodash.unary = unary;
  36717. lodash.union = union;
  36718. lodash.unionBy = unionBy;
  36719. lodash.unionWith = unionWith;
  36720. lodash.uniq = uniq;
  36721. lodash.uniqBy = uniqBy;
  36722. lodash.uniqWith = uniqWith;
  36723. lodash.unset = unset;
  36724. lodash.unzip = unzip;
  36725. lodash.unzipWith = unzipWith;
  36726. lodash.update = update;
  36727. lodash.updateWith = updateWith;
  36728. lodash.values = values;
  36729. lodash.valuesIn = valuesIn;
  36730. lodash.without = without;
  36731. lodash.words = words;
  36732. lodash.wrap = wrap;
  36733. lodash.xor = xor;
  36734. lodash.xorBy = xorBy;
  36735. lodash.xorWith = xorWith;
  36736. lodash.zip = zip;
  36737. lodash.zipObject = zipObject;
  36738. lodash.zipObjectDeep = zipObjectDeep;
  36739. lodash.zipWith = zipWith;
  36740. // Add aliases.
  36741. lodash.entries = toPairs;
  36742. lodash.entriesIn = toPairsIn;
  36743. lodash.extend = assignIn;
  36744. lodash.extendWith = assignInWith;
  36745. // Add methods to `lodash.prototype`.
  36746. mixin(lodash, lodash);
  36747. /*------------------------------------------------------------------------*/
  36748. // Add methods that return unwrapped values in chain sequences.
  36749. lodash.add = add;
  36750. lodash.attempt = attempt;
  36751. lodash.camelCase = camelCase;
  36752. lodash.capitalize = capitalize;
  36753. lodash.ceil = ceil;
  36754. lodash.clamp = clamp;
  36755. lodash.clone = clone;
  36756. lodash.cloneDeep = cloneDeep;
  36757. lodash.cloneDeepWith = cloneDeepWith;
  36758. lodash.cloneWith = cloneWith;
  36759. lodash.conformsTo = conformsTo;
  36760. lodash.deburr = deburr;
  36761. lodash.defaultTo = defaultTo;
  36762. lodash.divide = divide;
  36763. lodash.endsWith = endsWith;
  36764. lodash.eq = eq;
  36765. lodash.escape = escape;
  36766. lodash.escapeRegExp = escapeRegExp;
  36767. lodash.every = every;
  36768. lodash.find = find;
  36769. lodash.findIndex = findIndex;
  36770. lodash.findKey = findKey;
  36771. lodash.findLast = findLast;
  36772. lodash.findLastIndex = findLastIndex;
  36773. lodash.findLastKey = findLastKey;
  36774. lodash.floor = floor;
  36775. lodash.forEach = forEach;
  36776. lodash.forEachRight = forEachRight;
  36777. lodash.forIn = forIn;
  36778. lodash.forInRight = forInRight;
  36779. lodash.forOwn = forOwn;
  36780. lodash.forOwnRight = forOwnRight;
  36781. lodash.get = get;
  36782. lodash.gt = gt;
  36783. lodash.gte = gte;
  36784. lodash.has = has;
  36785. lodash.hasIn = hasIn;
  36786. lodash.head = head;
  36787. lodash.identity = identity;
  36788. lodash.includes = includes;
  36789. lodash.indexOf = indexOf;
  36790. lodash.inRange = inRange;
  36791. lodash.invoke = invoke;
  36792. lodash.isArguments = isArguments;
  36793. lodash.isArray = isArray;
  36794. lodash.isArrayBuffer = isArrayBuffer;
  36795. lodash.isArrayLike = isArrayLike;
  36796. lodash.isArrayLikeObject = isArrayLikeObject;
  36797. lodash.isBoolean = isBoolean;
  36798. lodash.isBuffer = isBuffer;
  36799. lodash.isDate = isDate;
  36800. lodash.isElement = isElement;
  36801. lodash.isEmpty = isEmpty;
  36802. lodash.isEqual = isEqual;
  36803. lodash.isEqualWith = isEqualWith;
  36804. lodash.isError = isError;
  36805. lodash.isFinite = isFinite;
  36806. lodash.isFunction = isFunction;
  36807. lodash.isInteger = isInteger;
  36808. lodash.isLength = isLength;
  36809. lodash.isMap = isMap;
  36810. lodash.isMatch = isMatch;
  36811. lodash.isMatchWith = isMatchWith;
  36812. lodash.isNaN = isNaN;
  36813. lodash.isNative = isNative;
  36814. lodash.isNil = isNil;
  36815. lodash.isNull = isNull;
  36816. lodash.isNumber = isNumber;
  36817. lodash.isObject = isObject;
  36818. lodash.isObjectLike = isObjectLike;
  36819. lodash.isPlainObject = isPlainObject;
  36820. lodash.isRegExp = isRegExp;
  36821. lodash.isSafeInteger = isSafeInteger;
  36822. lodash.isSet = isSet;
  36823. lodash.isString = isString;
  36824. lodash.isSymbol = isSymbol;
  36825. lodash.isTypedArray = isTypedArray;
  36826. lodash.isUndefined = isUndefined;
  36827. lodash.isWeakMap = isWeakMap;
  36828. lodash.isWeakSet = isWeakSet;
  36829. lodash.join = join;
  36830. lodash.kebabCase = kebabCase;
  36831. lodash.last = last;
  36832. lodash.lastIndexOf = lastIndexOf;
  36833. lodash.lowerCase = lowerCase;
  36834. lodash.lowerFirst = lowerFirst;
  36835. lodash.lt = lt;
  36836. lodash.lte = lte;
  36837. lodash.max = max;
  36838. lodash.maxBy = maxBy;
  36839. lodash.mean = mean;
  36840. lodash.meanBy = meanBy;
  36841. lodash.min = min;
  36842. lodash.minBy = minBy;
  36843. lodash.stubArray = stubArray;
  36844. lodash.stubFalse = stubFalse;
  36845. lodash.stubObject = stubObject;
  36846. lodash.stubString = stubString;
  36847. lodash.stubTrue = stubTrue;
  36848. lodash.multiply = multiply;
  36849. lodash.nth = nth;
  36850. lodash.noConflict = noConflict;
  36851. lodash.noop = noop;
  36852. lodash.now = now;
  36853. lodash.pad = pad;
  36854. lodash.padEnd = padEnd;
  36855. lodash.padStart = padStart;
  36856. lodash.parseInt = parseInt;
  36857. lodash.random = random;
  36858. lodash.reduce = reduce;
  36859. lodash.reduceRight = reduceRight;
  36860. lodash.repeat = repeat;
  36861. lodash.replace = replace;
  36862. lodash.result = result;
  36863. lodash.round = round;
  36864. lodash.runInContext = runInContext;
  36865. lodash.sample = sample;
  36866. lodash.size = size;
  36867. lodash.snakeCase = snakeCase;
  36868. lodash.some = some;
  36869. lodash.sortedIndex = sortedIndex;
  36870. lodash.sortedIndexBy = sortedIndexBy;
  36871. lodash.sortedIndexOf = sortedIndexOf;
  36872. lodash.sortedLastIndex = sortedLastIndex;
  36873. lodash.sortedLastIndexBy = sortedLastIndexBy;
  36874. lodash.sortedLastIndexOf = sortedLastIndexOf;
  36875. lodash.startCase = startCase;
  36876. lodash.startsWith = startsWith;
  36877. lodash.subtract = subtract;
  36878. lodash.sum = sum;
  36879. lodash.sumBy = sumBy;
  36880. lodash.template = template;
  36881. lodash.times = times;
  36882. lodash.toFinite = toFinite;
  36883. lodash.toInteger = toInteger;
  36884. lodash.toLength = toLength;
  36885. lodash.toLower = toLower;
  36886. lodash.toNumber = toNumber;
  36887. lodash.toSafeInteger = toSafeInteger;
  36888. lodash.toString = toString;
  36889. lodash.toUpper = toUpper;
  36890. lodash.trim = trim;
  36891. lodash.trimEnd = trimEnd;
  36892. lodash.trimStart = trimStart;
  36893. lodash.truncate = truncate;
  36894. lodash.unescape = unescape;
  36895. lodash.uniqueId = uniqueId;
  36896. lodash.upperCase = upperCase;
  36897. lodash.upperFirst = upperFirst;
  36898. // Add aliases.
  36899. lodash.each = forEach;
  36900. lodash.eachRight = forEachRight;
  36901. lodash.first = head;
  36902. mixin(lodash, (function() {
  36903. var source = {};
  36904. baseForOwn(lodash, function(func, methodName) {
  36905. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  36906. source[methodName] = func;
  36907. }
  36908. });
  36909. return source;
  36910. }()), { 'chain': false });
  36911. /*------------------------------------------------------------------------*/
  36912. /**
  36913. * The semantic version number.
  36914. *
  36915. * @static
  36916. * @memberOf _
  36917. * @type {string}
  36918. */
  36919. lodash.VERSION = VERSION;
  36920. // Assign default placeholders.
  36921. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  36922. lodash[methodName].placeholder = lodash;
  36923. });
  36924. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  36925. arrayEach(['drop', 'take'], function(methodName, index) {
  36926. LazyWrapper.prototype[methodName] = function(n) {
  36927. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  36928. var result = (this.__filtered__ && !index)
  36929. ? new LazyWrapper(this)
  36930. : this.clone();
  36931. if (result.__filtered__) {
  36932. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  36933. } else {
  36934. result.__views__.push({
  36935. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  36936. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  36937. });
  36938. }
  36939. return result;
  36940. };
  36941. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  36942. return this.reverse()[methodName](n).reverse();
  36943. };
  36944. });
  36945. // Add `LazyWrapper` methods that accept an `iteratee` value.
  36946. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  36947. var type = index + 1,
  36948. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  36949. LazyWrapper.prototype[methodName] = function(iteratee) {
  36950. var result = this.clone();
  36951. result.__iteratees__.push({
  36952. 'iteratee': getIteratee(iteratee, 3),
  36953. 'type': type
  36954. });
  36955. result.__filtered__ = result.__filtered__ || isFilter;
  36956. return result;
  36957. };
  36958. });
  36959. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  36960. arrayEach(['head', 'last'], function(methodName, index) {
  36961. var takeName = 'take' + (index ? 'Right' : '');
  36962. LazyWrapper.prototype[methodName] = function() {
  36963. return this[takeName](1).value()[0];
  36964. };
  36965. });
  36966. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  36967. arrayEach(['initial', 'tail'], function(methodName, index) {
  36968. var dropName = 'drop' + (index ? '' : 'Right');
  36969. LazyWrapper.prototype[methodName] = function() {
  36970. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  36971. };
  36972. });
  36973. LazyWrapper.prototype.compact = function() {
  36974. return this.filter(identity);
  36975. };
  36976. LazyWrapper.prototype.find = function(predicate) {
  36977. return this.filter(predicate).head();
  36978. };
  36979. LazyWrapper.prototype.findLast = function(predicate) {
  36980. return this.reverse().find(predicate);
  36981. };
  36982. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  36983. if (typeof path == 'function') {
  36984. return new LazyWrapper(this);
  36985. }
  36986. return this.map(function(value) {
  36987. return baseInvoke(value, path, args);
  36988. });
  36989. });
  36990. LazyWrapper.prototype.reject = function(predicate) {
  36991. return this.filter(negate(getIteratee(predicate)));
  36992. };
  36993. LazyWrapper.prototype.slice = function(start, end) {
  36994. start = toInteger(start);
  36995. var result = this;
  36996. if (result.__filtered__ && (start > 0 || end < 0)) {
  36997. return new LazyWrapper(result);
  36998. }
  36999. if (start < 0) {
  37000. result = result.takeRight(-start);
  37001. } else if (start) {
  37002. result = result.drop(start);
  37003. }
  37004. if (end !== undefined) {
  37005. end = toInteger(end);
  37006. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  37007. }
  37008. return result;
  37009. };
  37010. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  37011. return this.reverse().takeWhile(predicate).reverse();
  37012. };
  37013. LazyWrapper.prototype.toArray = function() {
  37014. return this.take(MAX_ARRAY_LENGTH);
  37015. };
  37016. // Add `LazyWrapper` methods to `lodash.prototype`.
  37017. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  37018. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  37019. isTaker = /^(?:head|last)$/.test(methodName),
  37020. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  37021. retUnwrapped = isTaker || /^find/.test(methodName);
  37022. if (!lodashFunc) {
  37023. return;
  37024. }
  37025. lodash.prototype[methodName] = function() {
  37026. var value = this.__wrapped__,
  37027. args = isTaker ? [1] : arguments,
  37028. isLazy = value instanceof LazyWrapper,
  37029. iteratee = args[0],
  37030. useLazy = isLazy || isArray(value);
  37031. var interceptor = function(value) {
  37032. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  37033. return (isTaker && chainAll) ? result[0] : result;
  37034. };
  37035. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  37036. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  37037. isLazy = useLazy = false;
  37038. }
  37039. var chainAll = this.__chain__,
  37040. isHybrid = !!this.__actions__.length,
  37041. isUnwrapped = retUnwrapped && !chainAll,
  37042. onlyLazy = isLazy && !isHybrid;
  37043. if (!retUnwrapped && useLazy) {
  37044. value = onlyLazy ? value : new LazyWrapper(this);
  37045. var result = func.apply(value, args);
  37046. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  37047. return new LodashWrapper(result, chainAll);
  37048. }
  37049. if (isUnwrapped && onlyLazy) {
  37050. return func.apply(this, args);
  37051. }
  37052. result = this.thru(interceptor);
  37053. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  37054. };
  37055. });
  37056. // Add `Array` methods to `lodash.prototype`.
  37057. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  37058. var func = arrayProto[methodName],
  37059. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  37060. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  37061. lodash.prototype[methodName] = function() {
  37062. var args = arguments;
  37063. if (retUnwrapped && !this.__chain__) {
  37064. var value = this.value();
  37065. return func.apply(isArray(value) ? value : [], args);
  37066. }
  37067. return this[chainName](function(value) {
  37068. return func.apply(isArray(value) ? value : [], args);
  37069. });
  37070. };
  37071. });
  37072. // Map minified method names to their real names.
  37073. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  37074. var lodashFunc = lodash[methodName];
  37075. if (lodashFunc) {
  37076. var key = lodashFunc.name + '';
  37077. if (!hasOwnProperty.call(realNames, key)) {
  37078. realNames[key] = [];
  37079. }
  37080. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  37081. }
  37082. });
  37083. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  37084. 'name': 'wrapper',
  37085. 'func': undefined
  37086. }];
  37087. // Add methods to `LazyWrapper`.
  37088. LazyWrapper.prototype.clone = lazyClone;
  37089. LazyWrapper.prototype.reverse = lazyReverse;
  37090. LazyWrapper.prototype.value = lazyValue;
  37091. // Add chain sequence methods to the `lodash` wrapper.
  37092. lodash.prototype.at = wrapperAt;
  37093. lodash.prototype.chain = wrapperChain;
  37094. lodash.prototype.commit = wrapperCommit;
  37095. lodash.prototype.next = wrapperNext;
  37096. lodash.prototype.plant = wrapperPlant;
  37097. lodash.prototype.reverse = wrapperReverse;
  37098. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  37099. // Add lazy aliases.
  37100. lodash.prototype.first = lodash.prototype.head;
  37101. if (symIterator) {
  37102. lodash.prototype[symIterator] = wrapperToIterator;
  37103. }
  37104. return lodash;
  37105. });
  37106. /*--------------------------------------------------------------------------*/
  37107. // Export lodash.
  37108. var _ = runInContext();
  37109. // Some AMD build optimizers, like r.js, check for condition patterns like:
  37110. if (true) {
  37111. // Expose Lodash on the global object to prevent errors when Lodash is
  37112. // loaded by a script tag in the presence of an AMD loader.
  37113. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  37114. // Use `_.noConflict` to remove Lodash from the global object.
  37115. root._ = _;
  37116. // Define as an anonymous module so, through path mapping, it can be
  37117. // referenced as the "underscore" module.
  37118. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  37119. return _;
  37120. }).call(exports, __webpack_require__, exports, module),
  37121. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  37122. }
  37123. // Check for `exports` after `define` in case a build optimizer adds it.
  37124. else {}
  37125. }.call(this));
  37126. /* 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)))
  37127. /***/ }),
  37128. /***/ "./node_modules/ms/index.js":
  37129. /*!**********************************!*\
  37130. !*** ./node_modules/ms/index.js ***!
  37131. \**********************************/
  37132. /*! no static exports found */
  37133. /***/ (function(module, exports) {
  37134. /**
  37135. * Helpers.
  37136. */
  37137. var s = 1000;
  37138. var m = s * 60;
  37139. var h = m * 60;
  37140. var d = h * 24;
  37141. var y = d * 365.25;
  37142. /**
  37143. * Parse or format the given `val`.
  37144. *
  37145. * Options:
  37146. *
  37147. * - `long` verbose formatting [false]
  37148. *
  37149. * @param {String|Number} val
  37150. * @param {Object} [options]
  37151. * @throws {Error} throw an error if val is not a non-empty string or a number
  37152. * @return {String|Number}
  37153. * @api public
  37154. */
  37155. module.exports = function(val, options) {
  37156. options = options || {};
  37157. var type = typeof val;
  37158. if (type === 'string' && val.length > 0) {
  37159. return parse(val);
  37160. } else if (type === 'number' && isNaN(val) === false) {
  37161. return options.long ? fmtLong(val) : fmtShort(val);
  37162. }
  37163. throw new Error(
  37164. 'val is not a non-empty string or a valid number. val=' +
  37165. JSON.stringify(val)
  37166. );
  37167. };
  37168. /**
  37169. * Parse the given `str` and return milliseconds.
  37170. *
  37171. * @param {String} str
  37172. * @return {Number}
  37173. * @api private
  37174. */
  37175. function parse(str) {
  37176. str = String(str);
  37177. if (str.length > 100) {
  37178. return;
  37179. }
  37180. var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
  37181. str
  37182. );
  37183. if (!match) {
  37184. return;
  37185. }
  37186. var n = parseFloat(match[1]);
  37187. var type = (match[2] || 'ms').toLowerCase();
  37188. switch (type) {
  37189. case 'years':
  37190. case 'year':
  37191. case 'yrs':
  37192. case 'yr':
  37193. case 'y':
  37194. return n * y;
  37195. case 'days':
  37196. case 'day':
  37197. case 'd':
  37198. return n * d;
  37199. case 'hours':
  37200. case 'hour':
  37201. case 'hrs':
  37202. case 'hr':
  37203. case 'h':
  37204. return n * h;
  37205. case 'minutes':
  37206. case 'minute':
  37207. case 'mins':
  37208. case 'min':
  37209. case 'm':
  37210. return n * m;
  37211. case 'seconds':
  37212. case 'second':
  37213. case 'secs':
  37214. case 'sec':
  37215. case 's':
  37216. return n * s;
  37217. case 'milliseconds':
  37218. case 'millisecond':
  37219. case 'msecs':
  37220. case 'msec':
  37221. case 'ms':
  37222. return n;
  37223. default:
  37224. return undefined;
  37225. }
  37226. }
  37227. /**
  37228. * Short format for `ms`.
  37229. *
  37230. * @param {Number} ms
  37231. * @return {String}
  37232. * @api private
  37233. */
  37234. function fmtShort(ms) {
  37235. if (ms >= d) {
  37236. return Math.round(ms / d) + 'd';
  37237. }
  37238. if (ms >= h) {
  37239. return Math.round(ms / h) + 'h';
  37240. }
  37241. if (ms >= m) {
  37242. return Math.round(ms / m) + 'm';
  37243. }
  37244. if (ms >= s) {
  37245. return Math.round(ms / s) + 's';
  37246. }
  37247. return ms + 'ms';
  37248. }
  37249. /**
  37250. * Long format for `ms`.
  37251. *
  37252. * @param {Number} ms
  37253. * @return {String}
  37254. * @api private
  37255. */
  37256. function fmtLong(ms) {
  37257. return plural(ms, d, 'day') ||
  37258. plural(ms, h, 'hour') ||
  37259. plural(ms, m, 'minute') ||
  37260. plural(ms, s, 'second') ||
  37261. ms + ' ms';
  37262. }
  37263. /**
  37264. * Pluralization helper.
  37265. */
  37266. function plural(ms, n, name) {
  37267. if (ms < n) {
  37268. return;
  37269. }
  37270. if (ms < n * 1.5) {
  37271. return Math.floor(ms / n) + ' ' + name;
  37272. }
  37273. return Math.ceil(ms / n) + ' ' + name + 's';
  37274. }
  37275. /***/ }),
  37276. /***/ "./node_modules/parseqs/index.js":
  37277. /*!***************************************!*\
  37278. !*** ./node_modules/parseqs/index.js ***!
  37279. \***************************************/
  37280. /*! no static exports found */
  37281. /***/ (function(module, exports) {
  37282. /**
  37283. * Compiles a querystring
  37284. * Returns string representation of the object
  37285. *
  37286. * @param {Object}
  37287. * @api private
  37288. */
  37289. exports.encode = function (obj) {
  37290. var str = '';
  37291. for (var i in obj) {
  37292. if (obj.hasOwnProperty(i)) {
  37293. if (str.length) str += '&';
  37294. str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);
  37295. }
  37296. }
  37297. return str;
  37298. };
  37299. /**
  37300. * Parses a simple querystring into an object
  37301. *
  37302. * @param {String} qs
  37303. * @api private
  37304. */
  37305. exports.decode = function(qs){
  37306. var qry = {};
  37307. var pairs = qs.split('&');
  37308. for (var i = 0, l = pairs.length; i < l; i++) {
  37309. var pair = pairs[i].split('=');
  37310. qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
  37311. }
  37312. return qry;
  37313. };
  37314. /***/ }),
  37315. /***/ "./node_modules/parseuri/index.js":
  37316. /*!****************************************!*\
  37317. !*** ./node_modules/parseuri/index.js ***!
  37318. \****************************************/
  37319. /*! no static exports found */
  37320. /***/ (function(module, exports) {
  37321. /**
  37322. * Parses an URI
  37323. *
  37324. * @author Steven Levithan <stevenlevithan.com> (MIT license)
  37325. * @api private
  37326. */
  37327. var re = /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;
  37328. var parts = [
  37329. 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'
  37330. ];
  37331. module.exports = function parseuri(str) {
  37332. var src = str,
  37333. b = str.indexOf('['),
  37334. e = str.indexOf(']');
  37335. if (b != -1 && e != -1) {
  37336. str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);
  37337. }
  37338. var m = re.exec(str || ''),
  37339. uri = {},
  37340. i = 14;
  37341. while (i--) {
  37342. uri[parts[i]] = m[i] || '';
  37343. }
  37344. if (b != -1 && e != -1) {
  37345. uri.source = src;
  37346. uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');
  37347. uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');
  37348. uri.ipv6uri = true;
  37349. }
  37350. return uri;
  37351. };
  37352. /***/ }),
  37353. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  37354. /*!***************************************************!*\
  37355. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  37356. \***************************************************/
  37357. /*! exports provided: default */
  37358. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  37359. "use strict";
  37360. __webpack_require__.r(__webpack_exports__);
  37361. /* WEBPACK VAR INJECTION */(function(global) {/**!
  37362. * @fileOverview Kickass library to create and place poppers near their reference elements.
  37363. * @version 1.16.1
  37364. * @license
  37365. * Copyright (c) 2016 Federico Zivolo and contributors
  37366. *
  37367. * Permission is hereby granted, free of charge, to any person obtaining a copy
  37368. * of this software and associated documentation files (the "Software"), to deal
  37369. * in the Software without restriction, including without limitation the rights
  37370. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  37371. * copies of the Software, and to permit persons to whom the Software is
  37372. * furnished to do so, subject to the following conditions:
  37373. *
  37374. * The above copyright notice and this permission notice shall be included in all
  37375. * copies or substantial portions of the Software.
  37376. *
  37377. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  37378. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  37379. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  37380. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  37381. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  37382. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  37383. * SOFTWARE.
  37384. */
  37385. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  37386. var timeoutDuration = function () {
  37387. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  37388. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  37389. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  37390. return 1;
  37391. }
  37392. }
  37393. return 0;
  37394. }();
  37395. function microtaskDebounce(fn) {
  37396. var called = false;
  37397. return function () {
  37398. if (called) {
  37399. return;
  37400. }
  37401. called = true;
  37402. window.Promise.resolve().then(function () {
  37403. called = false;
  37404. fn();
  37405. });
  37406. };
  37407. }
  37408. function taskDebounce(fn) {
  37409. var scheduled = false;
  37410. return function () {
  37411. if (!scheduled) {
  37412. scheduled = true;
  37413. setTimeout(function () {
  37414. scheduled = false;
  37415. fn();
  37416. }, timeoutDuration);
  37417. }
  37418. };
  37419. }
  37420. var supportsMicroTasks = isBrowser && window.Promise;
  37421. /**
  37422. * Create a debounced version of a method, that's asynchronously deferred
  37423. * but called in the minimum time possible.
  37424. *
  37425. * @method
  37426. * @memberof Popper.Utils
  37427. * @argument {Function} fn
  37428. * @returns {Function}
  37429. */
  37430. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  37431. /**
  37432. * Check if the given variable is a function
  37433. * @method
  37434. * @memberof Popper.Utils
  37435. * @argument {Any} functionToCheck - variable to check
  37436. * @returns {Boolean} answer to: is a function?
  37437. */
  37438. function isFunction(functionToCheck) {
  37439. var getType = {};
  37440. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  37441. }
  37442. /**
  37443. * Get CSS computed property of the given element
  37444. * @method
  37445. * @memberof Popper.Utils
  37446. * @argument {Eement} element
  37447. * @argument {String} property
  37448. */
  37449. function getStyleComputedProperty(element, property) {
  37450. if (element.nodeType !== 1) {
  37451. return [];
  37452. }
  37453. // NOTE: 1 DOM access here
  37454. var window = element.ownerDocument.defaultView;
  37455. var css = window.getComputedStyle(element, null);
  37456. return property ? css[property] : css;
  37457. }
  37458. /**
  37459. * Returns the parentNode or the host of the element
  37460. * @method
  37461. * @memberof Popper.Utils
  37462. * @argument {Element} element
  37463. * @returns {Element} parent
  37464. */
  37465. function getParentNode(element) {
  37466. if (element.nodeName === 'HTML') {
  37467. return element;
  37468. }
  37469. return element.parentNode || element.host;
  37470. }
  37471. /**
  37472. * Returns the scrolling parent of the given element
  37473. * @method
  37474. * @memberof Popper.Utils
  37475. * @argument {Element} element
  37476. * @returns {Element} scroll parent
  37477. */
  37478. function getScrollParent(element) {
  37479. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  37480. if (!element) {
  37481. return document.body;
  37482. }
  37483. switch (element.nodeName) {
  37484. case 'HTML':
  37485. case 'BODY':
  37486. return element.ownerDocument.body;
  37487. case '#document':
  37488. return element.body;
  37489. }
  37490. // Firefox want us to check `-x` and `-y` variations as well
  37491. var _getStyleComputedProp = getStyleComputedProperty(element),
  37492. overflow = _getStyleComputedProp.overflow,
  37493. overflowX = _getStyleComputedProp.overflowX,
  37494. overflowY = _getStyleComputedProp.overflowY;
  37495. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  37496. return element;
  37497. }
  37498. return getScrollParent(getParentNode(element));
  37499. }
  37500. /**
  37501. * Returns the reference node of the reference object, or the reference object itself.
  37502. * @method
  37503. * @memberof Popper.Utils
  37504. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  37505. * @returns {Element} parent
  37506. */
  37507. function getReferenceNode(reference) {
  37508. return reference && reference.referenceNode ? reference.referenceNode : reference;
  37509. }
  37510. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  37511. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  37512. /**
  37513. * Determines if the browser is Internet Explorer
  37514. * @method
  37515. * @memberof Popper.Utils
  37516. * @param {Number} version to check
  37517. * @returns {Boolean} isIE
  37518. */
  37519. function isIE(version) {
  37520. if (version === 11) {
  37521. return isIE11;
  37522. }
  37523. if (version === 10) {
  37524. return isIE10;
  37525. }
  37526. return isIE11 || isIE10;
  37527. }
  37528. /**
  37529. * Returns the offset parent of the given element
  37530. * @method
  37531. * @memberof Popper.Utils
  37532. * @argument {Element} element
  37533. * @returns {Element} offset parent
  37534. */
  37535. function getOffsetParent(element) {
  37536. if (!element) {
  37537. return document.documentElement;
  37538. }
  37539. var noOffsetParent = isIE(10) ? document.body : null;
  37540. // NOTE: 1 DOM access here
  37541. var offsetParent = element.offsetParent || null;
  37542. // Skip hidden elements which don't have an offsetParent
  37543. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  37544. offsetParent = (element = element.nextElementSibling).offsetParent;
  37545. }
  37546. var nodeName = offsetParent && offsetParent.nodeName;
  37547. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  37548. return element ? element.ownerDocument.documentElement : document.documentElement;
  37549. }
  37550. // .offsetParent will return the closest TH, TD or TABLE in case
  37551. // no offsetParent is present, I hate this job...
  37552. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  37553. return getOffsetParent(offsetParent);
  37554. }
  37555. return offsetParent;
  37556. }
  37557. function isOffsetContainer(element) {
  37558. var nodeName = element.nodeName;
  37559. if (nodeName === 'BODY') {
  37560. return false;
  37561. }
  37562. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  37563. }
  37564. /**
  37565. * Finds the root node (document, shadowDOM root) of the given element
  37566. * @method
  37567. * @memberof Popper.Utils
  37568. * @argument {Element} node
  37569. * @returns {Element} root node
  37570. */
  37571. function getRoot(node) {
  37572. if (node.parentNode !== null) {
  37573. return getRoot(node.parentNode);
  37574. }
  37575. return node;
  37576. }
  37577. /**
  37578. * Finds the offset parent common to the two provided nodes
  37579. * @method
  37580. * @memberof Popper.Utils
  37581. * @argument {Element} element1
  37582. * @argument {Element} element2
  37583. * @returns {Element} common offset parent
  37584. */
  37585. function findCommonOffsetParent(element1, element2) {
  37586. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  37587. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  37588. return document.documentElement;
  37589. }
  37590. // Here we make sure to give as "start" the element that comes first in the DOM
  37591. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  37592. var start = order ? element1 : element2;
  37593. var end = order ? element2 : element1;
  37594. // Get common ancestor container
  37595. var range = document.createRange();
  37596. range.setStart(start, 0);
  37597. range.setEnd(end, 0);
  37598. var commonAncestorContainer = range.commonAncestorContainer;
  37599. // Both nodes are inside #document
  37600. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  37601. if (isOffsetContainer(commonAncestorContainer)) {
  37602. return commonAncestorContainer;
  37603. }
  37604. return getOffsetParent(commonAncestorContainer);
  37605. }
  37606. // one of the nodes is inside shadowDOM, find which one
  37607. var element1root = getRoot(element1);
  37608. if (element1root.host) {
  37609. return findCommonOffsetParent(element1root.host, element2);
  37610. } else {
  37611. return findCommonOffsetParent(element1, getRoot(element2).host);
  37612. }
  37613. }
  37614. /**
  37615. * Gets the scroll value of the given element in the given side (top and left)
  37616. * @method
  37617. * @memberof Popper.Utils
  37618. * @argument {Element} element
  37619. * @argument {String} side `top` or `left`
  37620. * @returns {number} amount of scrolled pixels
  37621. */
  37622. function getScroll(element) {
  37623. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  37624. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  37625. var nodeName = element.nodeName;
  37626. if (nodeName === 'BODY' || nodeName === 'HTML') {
  37627. var html = element.ownerDocument.documentElement;
  37628. var scrollingElement = element.ownerDocument.scrollingElement || html;
  37629. return scrollingElement[upperSide];
  37630. }
  37631. return element[upperSide];
  37632. }
  37633. /*
  37634. * Sum or subtract the element scroll values (left and top) from a given rect object
  37635. * @method
  37636. * @memberof Popper.Utils
  37637. * @param {Object} rect - Rect object you want to change
  37638. * @param {HTMLElement} element - The element from the function reads the scroll values
  37639. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  37640. * @return {Object} rect - The modifier rect object
  37641. */
  37642. function includeScroll(rect, element) {
  37643. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  37644. var scrollTop = getScroll(element, 'top');
  37645. var scrollLeft = getScroll(element, 'left');
  37646. var modifier = subtract ? -1 : 1;
  37647. rect.top += scrollTop * modifier;
  37648. rect.bottom += scrollTop * modifier;
  37649. rect.left += scrollLeft * modifier;
  37650. rect.right += scrollLeft * modifier;
  37651. return rect;
  37652. }
  37653. /*
  37654. * Helper to detect borders of a given element
  37655. * @method
  37656. * @memberof Popper.Utils
  37657. * @param {CSSStyleDeclaration} styles
  37658. * Result of `getStyleComputedProperty` on the given element
  37659. * @param {String} axis - `x` or `y`
  37660. * @return {number} borders - The borders size of the given axis
  37661. */
  37662. function getBordersSize(styles, axis) {
  37663. var sideA = axis === 'x' ? 'Left' : 'Top';
  37664. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  37665. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  37666. }
  37667. function getSize(axis, body, html, computedStyle) {
  37668. 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);
  37669. }
  37670. function getWindowSizes(document) {
  37671. var body = document.body;
  37672. var html = document.documentElement;
  37673. var computedStyle = isIE(10) && getComputedStyle(html);
  37674. return {
  37675. height: getSize('Height', body, html, computedStyle),
  37676. width: getSize('Width', body, html, computedStyle)
  37677. };
  37678. }
  37679. var classCallCheck = function (instance, Constructor) {
  37680. if (!(instance instanceof Constructor)) {
  37681. throw new TypeError("Cannot call a class as a function");
  37682. }
  37683. };
  37684. var createClass = function () {
  37685. function defineProperties(target, props) {
  37686. for (var i = 0; i < props.length; i++) {
  37687. var descriptor = props[i];
  37688. descriptor.enumerable = descriptor.enumerable || false;
  37689. descriptor.configurable = true;
  37690. if ("value" in descriptor) descriptor.writable = true;
  37691. Object.defineProperty(target, descriptor.key, descriptor);
  37692. }
  37693. }
  37694. return function (Constructor, protoProps, staticProps) {
  37695. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  37696. if (staticProps) defineProperties(Constructor, staticProps);
  37697. return Constructor;
  37698. };
  37699. }();
  37700. var defineProperty = function (obj, key, value) {
  37701. if (key in obj) {
  37702. Object.defineProperty(obj, key, {
  37703. value: value,
  37704. enumerable: true,
  37705. configurable: true,
  37706. writable: true
  37707. });
  37708. } else {
  37709. obj[key] = value;
  37710. }
  37711. return obj;
  37712. };
  37713. var _extends = Object.assign || function (target) {
  37714. for (var i = 1; i < arguments.length; i++) {
  37715. var source = arguments[i];
  37716. for (var key in source) {
  37717. if (Object.prototype.hasOwnProperty.call(source, key)) {
  37718. target[key] = source[key];
  37719. }
  37720. }
  37721. }
  37722. return target;
  37723. };
  37724. /**
  37725. * Given element offsets, generate an output similar to getBoundingClientRect
  37726. * @method
  37727. * @memberof Popper.Utils
  37728. * @argument {Object} offsets
  37729. * @returns {Object} ClientRect like output
  37730. */
  37731. function getClientRect(offsets) {
  37732. return _extends({}, offsets, {
  37733. right: offsets.left + offsets.width,
  37734. bottom: offsets.top + offsets.height
  37735. });
  37736. }
  37737. /**
  37738. * Get bounding client rect of given element
  37739. * @method
  37740. * @memberof Popper.Utils
  37741. * @param {HTMLElement} element
  37742. * @return {Object} client rect
  37743. */
  37744. function getBoundingClientRect(element) {
  37745. var rect = {};
  37746. // IE10 10 FIX: Please, don't ask, the element isn't
  37747. // considered in DOM in some circumstances...
  37748. // This isn't reproducible in IE10 compatibility mode of IE11
  37749. try {
  37750. if (isIE(10)) {
  37751. rect = element.getBoundingClientRect();
  37752. var scrollTop = getScroll(element, 'top');
  37753. var scrollLeft = getScroll(element, 'left');
  37754. rect.top += scrollTop;
  37755. rect.left += scrollLeft;
  37756. rect.bottom += scrollTop;
  37757. rect.right += scrollLeft;
  37758. } else {
  37759. rect = element.getBoundingClientRect();
  37760. }
  37761. } catch (e) {}
  37762. var result = {
  37763. left: rect.left,
  37764. top: rect.top,
  37765. width: rect.right - rect.left,
  37766. height: rect.bottom - rect.top
  37767. };
  37768. // subtract scrollbar size from sizes
  37769. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  37770. var width = sizes.width || element.clientWidth || result.width;
  37771. var height = sizes.height || element.clientHeight || result.height;
  37772. var horizScrollbar = element.offsetWidth - width;
  37773. var vertScrollbar = element.offsetHeight - height;
  37774. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  37775. // we make this check conditional for performance reasons
  37776. if (horizScrollbar || vertScrollbar) {
  37777. var styles = getStyleComputedProperty(element);
  37778. horizScrollbar -= getBordersSize(styles, 'x');
  37779. vertScrollbar -= getBordersSize(styles, 'y');
  37780. result.width -= horizScrollbar;
  37781. result.height -= vertScrollbar;
  37782. }
  37783. return getClientRect(result);
  37784. }
  37785. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  37786. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  37787. var isIE10 = isIE(10);
  37788. var isHTML = parent.nodeName === 'HTML';
  37789. var childrenRect = getBoundingClientRect(children);
  37790. var parentRect = getBoundingClientRect(parent);
  37791. var scrollParent = getScrollParent(children);
  37792. var styles = getStyleComputedProperty(parent);
  37793. var borderTopWidth = parseFloat(styles.borderTopWidth);
  37794. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  37795. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  37796. if (fixedPosition && isHTML) {
  37797. parentRect.top = Math.max(parentRect.top, 0);
  37798. parentRect.left = Math.max(parentRect.left, 0);
  37799. }
  37800. var offsets = getClientRect({
  37801. top: childrenRect.top - parentRect.top - borderTopWidth,
  37802. left: childrenRect.left - parentRect.left - borderLeftWidth,
  37803. width: childrenRect.width,
  37804. height: childrenRect.height
  37805. });
  37806. offsets.marginTop = 0;
  37807. offsets.marginLeft = 0;
  37808. // Subtract margins of documentElement in case it's being used as parent
  37809. // we do this only on HTML because it's the only element that behaves
  37810. // differently when margins are applied to it. The margins are included in
  37811. // the box of the documentElement, in the other cases not.
  37812. if (!isIE10 && isHTML) {
  37813. var marginTop = parseFloat(styles.marginTop);
  37814. var marginLeft = parseFloat(styles.marginLeft);
  37815. offsets.top -= borderTopWidth - marginTop;
  37816. offsets.bottom -= borderTopWidth - marginTop;
  37817. offsets.left -= borderLeftWidth - marginLeft;
  37818. offsets.right -= borderLeftWidth - marginLeft;
  37819. // Attach marginTop and marginLeft because in some circumstances we may need them
  37820. offsets.marginTop = marginTop;
  37821. offsets.marginLeft = marginLeft;
  37822. }
  37823. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  37824. offsets = includeScroll(offsets, parent);
  37825. }
  37826. return offsets;
  37827. }
  37828. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  37829. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  37830. var html = element.ownerDocument.documentElement;
  37831. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  37832. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  37833. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  37834. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  37835. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  37836. var offset = {
  37837. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  37838. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  37839. width: width,
  37840. height: height
  37841. };
  37842. return getClientRect(offset);
  37843. }
  37844. /**
  37845. * Check if the given element is fixed or is inside a fixed parent
  37846. * @method
  37847. * @memberof Popper.Utils
  37848. * @argument {Element} element
  37849. * @argument {Element} customContainer
  37850. * @returns {Boolean} answer to "isFixed?"
  37851. */
  37852. function isFixed(element) {
  37853. var nodeName = element.nodeName;
  37854. if (nodeName === 'BODY' || nodeName === 'HTML') {
  37855. return false;
  37856. }
  37857. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  37858. return true;
  37859. }
  37860. var parentNode = getParentNode(element);
  37861. if (!parentNode) {
  37862. return false;
  37863. }
  37864. return isFixed(parentNode);
  37865. }
  37866. /**
  37867. * Finds the first parent of an element that has a transformed property defined
  37868. * @method
  37869. * @memberof Popper.Utils
  37870. * @argument {Element} element
  37871. * @returns {Element} first transformed parent or documentElement
  37872. */
  37873. function getFixedPositionOffsetParent(element) {
  37874. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  37875. if (!element || !element.parentElement || isIE()) {
  37876. return document.documentElement;
  37877. }
  37878. var el = element.parentElement;
  37879. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  37880. el = el.parentElement;
  37881. }
  37882. return el || document.documentElement;
  37883. }
  37884. /**
  37885. * Computed the boundaries limits and return them
  37886. * @method
  37887. * @memberof Popper.Utils
  37888. * @param {HTMLElement} popper
  37889. * @param {HTMLElement} reference
  37890. * @param {number} padding
  37891. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  37892. * @param {Boolean} fixedPosition - Is in fixed position mode
  37893. * @returns {Object} Coordinates of the boundaries
  37894. */
  37895. function getBoundaries(popper, reference, padding, boundariesElement) {
  37896. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  37897. // NOTE: 1 DOM access here
  37898. var boundaries = { top: 0, left: 0 };
  37899. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  37900. // Handle viewport case
  37901. if (boundariesElement === 'viewport') {
  37902. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  37903. } else {
  37904. // Handle other cases based on DOM element used as boundaries
  37905. var boundariesNode = void 0;
  37906. if (boundariesElement === 'scrollParent') {
  37907. boundariesNode = getScrollParent(getParentNode(reference));
  37908. if (boundariesNode.nodeName === 'BODY') {
  37909. boundariesNode = popper.ownerDocument.documentElement;
  37910. }
  37911. } else if (boundariesElement === 'window') {
  37912. boundariesNode = popper.ownerDocument.documentElement;
  37913. } else {
  37914. boundariesNode = boundariesElement;
  37915. }
  37916. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  37917. // In case of HTML, we need a different computation
  37918. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  37919. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  37920. height = _getWindowSizes.height,
  37921. width = _getWindowSizes.width;
  37922. boundaries.top += offsets.top - offsets.marginTop;
  37923. boundaries.bottom = height + offsets.top;
  37924. boundaries.left += offsets.left - offsets.marginLeft;
  37925. boundaries.right = width + offsets.left;
  37926. } else {
  37927. // for all the other DOM elements, this one is good
  37928. boundaries = offsets;
  37929. }
  37930. }
  37931. // Add paddings
  37932. padding = padding || 0;
  37933. var isPaddingNumber = typeof padding === 'number';
  37934. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  37935. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  37936. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  37937. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  37938. return boundaries;
  37939. }
  37940. function getArea(_ref) {
  37941. var width = _ref.width,
  37942. height = _ref.height;
  37943. return width * height;
  37944. }
  37945. /**
  37946. * Utility used to transform the `auto` placement to the placement with more
  37947. * available space.
  37948. * @method
  37949. * @memberof Popper.Utils
  37950. * @argument {Object} data - The data object generated by update method
  37951. * @argument {Object} options - Modifiers configuration and options
  37952. * @returns {Object} The data object, properly modified
  37953. */
  37954. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  37955. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  37956. if (placement.indexOf('auto') === -1) {
  37957. return placement;
  37958. }
  37959. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  37960. var rects = {
  37961. top: {
  37962. width: boundaries.width,
  37963. height: refRect.top - boundaries.top
  37964. },
  37965. right: {
  37966. width: boundaries.right - refRect.right,
  37967. height: boundaries.height
  37968. },
  37969. bottom: {
  37970. width: boundaries.width,
  37971. height: boundaries.bottom - refRect.bottom
  37972. },
  37973. left: {
  37974. width: refRect.left - boundaries.left,
  37975. height: boundaries.height
  37976. }
  37977. };
  37978. var sortedAreas = Object.keys(rects).map(function (key) {
  37979. return _extends({
  37980. key: key
  37981. }, rects[key], {
  37982. area: getArea(rects[key])
  37983. });
  37984. }).sort(function (a, b) {
  37985. return b.area - a.area;
  37986. });
  37987. var filteredAreas = sortedAreas.filter(function (_ref2) {
  37988. var width = _ref2.width,
  37989. height = _ref2.height;
  37990. return width >= popper.clientWidth && height >= popper.clientHeight;
  37991. });
  37992. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  37993. var variation = placement.split('-')[1];
  37994. return computedPlacement + (variation ? '-' + variation : '');
  37995. }
  37996. /**
  37997. * Get offsets to the reference element
  37998. * @method
  37999. * @memberof Popper.Utils
  38000. * @param {Object} state
  38001. * @param {Element} popper - the popper element
  38002. * @param {Element} reference - the reference element (the popper will be relative to this)
  38003. * @param {Element} fixedPosition - is in fixed position mode
  38004. * @returns {Object} An object containing the offsets which will be applied to the popper
  38005. */
  38006. function getReferenceOffsets(state, popper, reference) {
  38007. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  38008. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  38009. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  38010. }
  38011. /**
  38012. * Get the outer sizes of the given element (offset size + margins)
  38013. * @method
  38014. * @memberof Popper.Utils
  38015. * @argument {Element} element
  38016. * @returns {Object} object containing width and height properties
  38017. */
  38018. function getOuterSizes(element) {
  38019. var window = element.ownerDocument.defaultView;
  38020. var styles = window.getComputedStyle(element);
  38021. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  38022. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  38023. var result = {
  38024. width: element.offsetWidth + y,
  38025. height: element.offsetHeight + x
  38026. };
  38027. return result;
  38028. }
  38029. /**
  38030. * Get the opposite placement of the given one
  38031. * @method
  38032. * @memberof Popper.Utils
  38033. * @argument {String} placement
  38034. * @returns {String} flipped placement
  38035. */
  38036. function getOppositePlacement(placement) {
  38037. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  38038. return placement.replace(/left|right|bottom|top/g, function (matched) {
  38039. return hash[matched];
  38040. });
  38041. }
  38042. /**
  38043. * Get offsets to the popper
  38044. * @method
  38045. * @memberof Popper.Utils
  38046. * @param {Object} position - CSS position the Popper will get applied
  38047. * @param {HTMLElement} popper - the popper element
  38048. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  38049. * @param {String} placement - one of the valid placement options
  38050. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  38051. */
  38052. function getPopperOffsets(popper, referenceOffsets, placement) {
  38053. placement = placement.split('-')[0];
  38054. // Get popper node sizes
  38055. var popperRect = getOuterSizes(popper);
  38056. // Add position, width and height to our offsets object
  38057. var popperOffsets = {
  38058. width: popperRect.width,
  38059. height: popperRect.height
  38060. };
  38061. // depending by the popper placement we have to compute its offsets slightly differently
  38062. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  38063. var mainSide = isHoriz ? 'top' : 'left';
  38064. var secondarySide = isHoriz ? 'left' : 'top';
  38065. var measurement = isHoriz ? 'height' : 'width';
  38066. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  38067. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  38068. if (placement === secondarySide) {
  38069. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  38070. } else {
  38071. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  38072. }
  38073. return popperOffsets;
  38074. }
  38075. /**
  38076. * Mimics the `find` method of Array
  38077. * @method
  38078. * @memberof Popper.Utils
  38079. * @argument {Array} arr
  38080. * @argument prop
  38081. * @argument value
  38082. * @returns index or -1
  38083. */
  38084. function find(arr, check) {
  38085. // use native find if supported
  38086. if (Array.prototype.find) {
  38087. return arr.find(check);
  38088. }
  38089. // use `filter` to obtain the same behavior of `find`
  38090. return arr.filter(check)[0];
  38091. }
  38092. /**
  38093. * Return the index of the matching object
  38094. * @method
  38095. * @memberof Popper.Utils
  38096. * @argument {Array} arr
  38097. * @argument prop
  38098. * @argument value
  38099. * @returns index or -1
  38100. */
  38101. function findIndex(arr, prop, value) {
  38102. // use native findIndex if supported
  38103. if (Array.prototype.findIndex) {
  38104. return arr.findIndex(function (cur) {
  38105. return cur[prop] === value;
  38106. });
  38107. }
  38108. // use `find` + `indexOf` if `findIndex` isn't supported
  38109. var match = find(arr, function (obj) {
  38110. return obj[prop] === value;
  38111. });
  38112. return arr.indexOf(match);
  38113. }
  38114. /**
  38115. * Loop trough the list of modifiers and run them in order,
  38116. * each of them will then edit the data object.
  38117. * @method
  38118. * @memberof Popper.Utils
  38119. * @param {dataObject} data
  38120. * @param {Array} modifiers
  38121. * @param {String} ends - Optional modifier name used as stopper
  38122. * @returns {dataObject}
  38123. */
  38124. function runModifiers(modifiers, data, ends) {
  38125. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  38126. modifiersToRun.forEach(function (modifier) {
  38127. if (modifier['function']) {
  38128. // eslint-disable-line dot-notation
  38129. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  38130. }
  38131. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  38132. if (modifier.enabled && isFunction(fn)) {
  38133. // Add properties to offsets to make them a complete clientRect object
  38134. // we do this before each modifier to make sure the previous one doesn't
  38135. // mess with these values
  38136. data.offsets.popper = getClientRect(data.offsets.popper);
  38137. data.offsets.reference = getClientRect(data.offsets.reference);
  38138. data = fn(data, modifier);
  38139. }
  38140. });
  38141. return data;
  38142. }
  38143. /**
  38144. * Updates the position of the popper, computing the new offsets and applying
  38145. * the new style.<br />
  38146. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  38147. * @method
  38148. * @memberof Popper
  38149. */
  38150. function update() {
  38151. // if popper is destroyed, don't perform any further update
  38152. if (this.state.isDestroyed) {
  38153. return;
  38154. }
  38155. var data = {
  38156. instance: this,
  38157. styles: {},
  38158. arrowStyles: {},
  38159. attributes: {},
  38160. flipped: false,
  38161. offsets: {}
  38162. };
  38163. // compute reference element offsets
  38164. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  38165. // compute auto placement, store placement inside the data object,
  38166. // modifiers will be able to edit `placement` if needed
  38167. // and refer to originalPlacement to know the original value
  38168. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  38169. // store the computed placement inside `originalPlacement`
  38170. data.originalPlacement = data.placement;
  38171. data.positionFixed = this.options.positionFixed;
  38172. // compute the popper offsets
  38173. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  38174. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  38175. // run the modifiers
  38176. data = runModifiers(this.modifiers, data);
  38177. // the first `update` will call `onCreate` callback
  38178. // the other ones will call `onUpdate` callback
  38179. if (!this.state.isCreated) {
  38180. this.state.isCreated = true;
  38181. this.options.onCreate(data);
  38182. } else {
  38183. this.options.onUpdate(data);
  38184. }
  38185. }
  38186. /**
  38187. * Helper used to know if the given modifier is enabled.
  38188. * @method
  38189. * @memberof Popper.Utils
  38190. * @returns {Boolean}
  38191. */
  38192. function isModifierEnabled(modifiers, modifierName) {
  38193. return modifiers.some(function (_ref) {
  38194. var name = _ref.name,
  38195. enabled = _ref.enabled;
  38196. return enabled && name === modifierName;
  38197. });
  38198. }
  38199. /**
  38200. * Get the prefixed supported property name
  38201. * @method
  38202. * @memberof Popper.Utils
  38203. * @argument {String} property (camelCase)
  38204. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  38205. */
  38206. function getSupportedPropertyName(property) {
  38207. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  38208. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  38209. for (var i = 0; i < prefixes.length; i++) {
  38210. var prefix = prefixes[i];
  38211. var toCheck = prefix ? '' + prefix + upperProp : property;
  38212. if (typeof document.body.style[toCheck] !== 'undefined') {
  38213. return toCheck;
  38214. }
  38215. }
  38216. return null;
  38217. }
  38218. /**
  38219. * Destroys the popper.
  38220. * @method
  38221. * @memberof Popper
  38222. */
  38223. function destroy() {
  38224. this.state.isDestroyed = true;
  38225. // touch DOM only if `applyStyle` modifier is enabled
  38226. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  38227. this.popper.removeAttribute('x-placement');
  38228. this.popper.style.position = '';
  38229. this.popper.style.top = '';
  38230. this.popper.style.left = '';
  38231. this.popper.style.right = '';
  38232. this.popper.style.bottom = '';
  38233. this.popper.style.willChange = '';
  38234. this.popper.style[getSupportedPropertyName('transform')] = '';
  38235. }
  38236. this.disableEventListeners();
  38237. // remove the popper if user explicitly asked for the deletion on destroy
  38238. // do not use `remove` because IE11 doesn't support it
  38239. if (this.options.removeOnDestroy) {
  38240. this.popper.parentNode.removeChild(this.popper);
  38241. }
  38242. return this;
  38243. }
  38244. /**
  38245. * Get the window associated with the element
  38246. * @argument {Element} element
  38247. * @returns {Window}
  38248. */
  38249. function getWindow(element) {
  38250. var ownerDocument = element.ownerDocument;
  38251. return ownerDocument ? ownerDocument.defaultView : window;
  38252. }
  38253. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  38254. var isBody = scrollParent.nodeName === 'BODY';
  38255. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  38256. target.addEventListener(event, callback, { passive: true });
  38257. if (!isBody) {
  38258. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  38259. }
  38260. scrollParents.push(target);
  38261. }
  38262. /**
  38263. * Setup needed event listeners used to update the popper position
  38264. * @method
  38265. * @memberof Popper.Utils
  38266. * @private
  38267. */
  38268. function setupEventListeners(reference, options, state, updateBound) {
  38269. // Resize event listener on window
  38270. state.updateBound = updateBound;
  38271. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  38272. // Scroll event listener on scroll parents
  38273. var scrollElement = getScrollParent(reference);
  38274. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  38275. state.scrollElement = scrollElement;
  38276. state.eventsEnabled = true;
  38277. return state;
  38278. }
  38279. /**
  38280. * It will add resize/scroll events and start recalculating
  38281. * position of the popper element when they are triggered.
  38282. * @method
  38283. * @memberof Popper
  38284. */
  38285. function enableEventListeners() {
  38286. if (!this.state.eventsEnabled) {
  38287. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  38288. }
  38289. }
  38290. /**
  38291. * Remove event listeners used to update the popper position
  38292. * @method
  38293. * @memberof Popper.Utils
  38294. * @private
  38295. */
  38296. function removeEventListeners(reference, state) {
  38297. // Remove resize event listener on window
  38298. getWindow(reference).removeEventListener('resize', state.updateBound);
  38299. // Remove scroll event listener on scroll parents
  38300. state.scrollParents.forEach(function (target) {
  38301. target.removeEventListener('scroll', state.updateBound);
  38302. });
  38303. // Reset state
  38304. state.updateBound = null;
  38305. state.scrollParents = [];
  38306. state.scrollElement = null;
  38307. state.eventsEnabled = false;
  38308. return state;
  38309. }
  38310. /**
  38311. * It will remove resize/scroll events and won't recalculate popper position
  38312. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  38313. * unless you call `update` method manually.
  38314. * @method
  38315. * @memberof Popper
  38316. */
  38317. function disableEventListeners() {
  38318. if (this.state.eventsEnabled) {
  38319. cancelAnimationFrame(this.scheduleUpdate);
  38320. this.state = removeEventListeners(this.reference, this.state);
  38321. }
  38322. }
  38323. /**
  38324. * Tells if a given input is a number
  38325. * @method
  38326. * @memberof Popper.Utils
  38327. * @param {*} input to check
  38328. * @return {Boolean}
  38329. */
  38330. function isNumeric(n) {
  38331. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  38332. }
  38333. /**
  38334. * Set the style to the given popper
  38335. * @method
  38336. * @memberof Popper.Utils
  38337. * @argument {Element} element - Element to apply the style to
  38338. * @argument {Object} styles
  38339. * Object with a list of properties and values which will be applied to the element
  38340. */
  38341. function setStyles(element, styles) {
  38342. Object.keys(styles).forEach(function (prop) {
  38343. var unit = '';
  38344. // add unit if the value is numeric and is one of the following
  38345. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  38346. unit = 'px';
  38347. }
  38348. element.style[prop] = styles[prop] + unit;
  38349. });
  38350. }
  38351. /**
  38352. * Set the attributes to the given popper
  38353. * @method
  38354. * @memberof Popper.Utils
  38355. * @argument {Element} element - Element to apply the attributes to
  38356. * @argument {Object} styles
  38357. * Object with a list of properties and values which will be applied to the element
  38358. */
  38359. function setAttributes(element, attributes) {
  38360. Object.keys(attributes).forEach(function (prop) {
  38361. var value = attributes[prop];
  38362. if (value !== false) {
  38363. element.setAttribute(prop, attributes[prop]);
  38364. } else {
  38365. element.removeAttribute(prop);
  38366. }
  38367. });
  38368. }
  38369. /**
  38370. * @function
  38371. * @memberof Modifiers
  38372. * @argument {Object} data - The data object generated by `update` method
  38373. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  38374. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  38375. * @argument {Object} options - Modifiers configuration and options
  38376. * @returns {Object} The same data object
  38377. */
  38378. function applyStyle(data) {
  38379. // any property present in `data.styles` will be applied to the popper,
  38380. // in this way we can make the 3rd party modifiers add custom styles to it
  38381. // Be aware, modifiers could override the properties defined in the previous
  38382. // lines of this modifier!
  38383. setStyles(data.instance.popper, data.styles);
  38384. // any property present in `data.attributes` will be applied to the popper,
  38385. // they will be set as HTML attributes of the element
  38386. setAttributes(data.instance.popper, data.attributes);
  38387. // if arrowElement is defined and arrowStyles has some properties
  38388. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  38389. setStyles(data.arrowElement, data.arrowStyles);
  38390. }
  38391. return data;
  38392. }
  38393. /**
  38394. * Set the x-placement attribute before everything else because it could be used
  38395. * to add margins to the popper margins needs to be calculated to get the
  38396. * correct popper offsets.
  38397. * @method
  38398. * @memberof Popper.modifiers
  38399. * @param {HTMLElement} reference - The reference element used to position the popper
  38400. * @param {HTMLElement} popper - The HTML element used as popper
  38401. * @param {Object} options - Popper.js options
  38402. */
  38403. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  38404. // compute reference element offsets
  38405. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  38406. // compute auto placement, store placement inside the data object,
  38407. // modifiers will be able to edit `placement` if needed
  38408. // and refer to originalPlacement to know the original value
  38409. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  38410. popper.setAttribute('x-placement', placement);
  38411. // Apply `position` to popper before anything else because
  38412. // without the position applied we can't guarantee correct computations
  38413. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  38414. return options;
  38415. }
  38416. /**
  38417. * @function
  38418. * @memberof Popper.Utils
  38419. * @argument {Object} data - The data object generated by `update` method
  38420. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  38421. * @returns {Object} The popper's position offsets rounded
  38422. *
  38423. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  38424. * good as it can be within reason.
  38425. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  38426. *
  38427. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  38428. * as well on High DPI screens).
  38429. *
  38430. * Firefox prefers no rounding for positioning and does not have blurriness on
  38431. * high DPI screens.
  38432. *
  38433. * Only horizontal placement and left/right values need to be considered.
  38434. */
  38435. function getRoundedOffsets(data, shouldRound) {
  38436. var _data$offsets = data.offsets,
  38437. popper = _data$offsets.popper,
  38438. reference = _data$offsets.reference;
  38439. var round = Math.round,
  38440. floor = Math.floor;
  38441. var noRound = function noRound(v) {
  38442. return v;
  38443. };
  38444. var referenceWidth = round(reference.width);
  38445. var popperWidth = round(popper.width);
  38446. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  38447. var isVariation = data.placement.indexOf('-') !== -1;
  38448. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  38449. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  38450. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  38451. var verticalToInteger = !shouldRound ? noRound : round;
  38452. return {
  38453. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  38454. top: verticalToInteger(popper.top),
  38455. bottom: verticalToInteger(popper.bottom),
  38456. right: horizontalToInteger(popper.right)
  38457. };
  38458. }
  38459. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  38460. /**
  38461. * @function
  38462. * @memberof Modifiers
  38463. * @argument {Object} data - The data object generated by `update` method
  38464. * @argument {Object} options - Modifiers configuration and options
  38465. * @returns {Object} The data object, properly modified
  38466. */
  38467. function computeStyle(data, options) {
  38468. var x = options.x,
  38469. y = options.y;
  38470. var popper = data.offsets.popper;
  38471. // Remove this legacy support in Popper.js v2
  38472. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  38473. return modifier.name === 'applyStyle';
  38474. }).gpuAcceleration;
  38475. if (legacyGpuAccelerationOption !== undefined) {
  38476. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  38477. }
  38478. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  38479. var offsetParent = getOffsetParent(data.instance.popper);
  38480. var offsetParentRect = getBoundingClientRect(offsetParent);
  38481. // Styles
  38482. var styles = {
  38483. position: popper.position
  38484. };
  38485. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  38486. var sideA = x === 'bottom' ? 'top' : 'bottom';
  38487. var sideB = y === 'right' ? 'left' : 'right';
  38488. // if gpuAcceleration is set to `true` and transform is supported,
  38489. // we use `translate3d` to apply the position to the popper we
  38490. // automatically use the supported prefixed version if needed
  38491. var prefixedProperty = getSupportedPropertyName('transform');
  38492. // now, let's make a step back and look at this code closely (wtf?)
  38493. // If the content of the popper grows once it's been positioned, it
  38494. // may happen that the popper gets misplaced because of the new content
  38495. // overflowing its reference element
  38496. // To avoid this problem, we provide two options (x and y), which allow
  38497. // the consumer to define the offset origin.
  38498. // If we position a popper on top of a reference element, we can set
  38499. // `x` to `top` to make the popper grow towards its top instead of
  38500. // its bottom.
  38501. var left = void 0,
  38502. top = void 0;
  38503. if (sideA === 'bottom') {
  38504. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  38505. // and not the bottom of the html element
  38506. if (offsetParent.nodeName === 'HTML') {
  38507. top = -offsetParent.clientHeight + offsets.bottom;
  38508. } else {
  38509. top = -offsetParentRect.height + offsets.bottom;
  38510. }
  38511. } else {
  38512. top = offsets.top;
  38513. }
  38514. if (sideB === 'right') {
  38515. if (offsetParent.nodeName === 'HTML') {
  38516. left = -offsetParent.clientWidth + offsets.right;
  38517. } else {
  38518. left = -offsetParentRect.width + offsets.right;
  38519. }
  38520. } else {
  38521. left = offsets.left;
  38522. }
  38523. if (gpuAcceleration && prefixedProperty) {
  38524. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  38525. styles[sideA] = 0;
  38526. styles[sideB] = 0;
  38527. styles.willChange = 'transform';
  38528. } else {
  38529. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  38530. var invertTop = sideA === 'bottom' ? -1 : 1;
  38531. var invertLeft = sideB === 'right' ? -1 : 1;
  38532. styles[sideA] = top * invertTop;
  38533. styles[sideB] = left * invertLeft;
  38534. styles.willChange = sideA + ', ' + sideB;
  38535. }
  38536. // Attributes
  38537. var attributes = {
  38538. 'x-placement': data.placement
  38539. };
  38540. // Update `data` attributes, styles and arrowStyles
  38541. data.attributes = _extends({}, attributes, data.attributes);
  38542. data.styles = _extends({}, styles, data.styles);
  38543. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  38544. return data;
  38545. }
  38546. /**
  38547. * Helper used to know if the given modifier depends from another one.<br />
  38548. * It checks if the needed modifier is listed and enabled.
  38549. * @method
  38550. * @memberof Popper.Utils
  38551. * @param {Array} modifiers - list of modifiers
  38552. * @param {String} requestingName - name of requesting modifier
  38553. * @param {String} requestedName - name of requested modifier
  38554. * @returns {Boolean}
  38555. */
  38556. function isModifierRequired(modifiers, requestingName, requestedName) {
  38557. var requesting = find(modifiers, function (_ref) {
  38558. var name = _ref.name;
  38559. return name === requestingName;
  38560. });
  38561. var isRequired = !!requesting && modifiers.some(function (modifier) {
  38562. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  38563. });
  38564. if (!isRequired) {
  38565. var _requesting = '`' + requestingName + '`';
  38566. var requested = '`' + requestedName + '`';
  38567. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  38568. }
  38569. return isRequired;
  38570. }
  38571. /**
  38572. * @function
  38573. * @memberof Modifiers
  38574. * @argument {Object} data - The data object generated by update method
  38575. * @argument {Object} options - Modifiers configuration and options
  38576. * @returns {Object} The data object, properly modified
  38577. */
  38578. function arrow(data, options) {
  38579. var _data$offsets$arrow;
  38580. // arrow depends on keepTogether in order to work
  38581. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  38582. return data;
  38583. }
  38584. var arrowElement = options.element;
  38585. // if arrowElement is a string, suppose it's a CSS selector
  38586. if (typeof arrowElement === 'string') {
  38587. arrowElement = data.instance.popper.querySelector(arrowElement);
  38588. // if arrowElement is not found, don't run the modifier
  38589. if (!arrowElement) {
  38590. return data;
  38591. }
  38592. } else {
  38593. // if the arrowElement isn't a query selector we must check that the
  38594. // provided DOM node is child of its popper node
  38595. if (!data.instance.popper.contains(arrowElement)) {
  38596. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  38597. return data;
  38598. }
  38599. }
  38600. var placement = data.placement.split('-')[0];
  38601. var _data$offsets = data.offsets,
  38602. popper = _data$offsets.popper,
  38603. reference = _data$offsets.reference;
  38604. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  38605. var len = isVertical ? 'height' : 'width';
  38606. var sideCapitalized = isVertical ? 'Top' : 'Left';
  38607. var side = sideCapitalized.toLowerCase();
  38608. var altSide = isVertical ? 'left' : 'top';
  38609. var opSide = isVertical ? 'bottom' : 'right';
  38610. var arrowElementSize = getOuterSizes(arrowElement)[len];
  38611. //
  38612. // extends keepTogether behavior making sure the popper and its
  38613. // reference have enough pixels in conjunction
  38614. //
  38615. // top/left side
  38616. if (reference[opSide] - arrowElementSize < popper[side]) {
  38617. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  38618. }
  38619. // bottom/right side
  38620. if (reference[side] + arrowElementSize > popper[opSide]) {
  38621. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  38622. }
  38623. data.offsets.popper = getClientRect(data.offsets.popper);
  38624. // compute center of the popper
  38625. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  38626. // Compute the sideValue using the updated popper offsets
  38627. // take popper margin in account because we don't have this info available
  38628. var css = getStyleComputedProperty(data.instance.popper);
  38629. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  38630. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  38631. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  38632. // prevent arrowElement from being placed not contiguously to its popper
  38633. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  38634. data.arrowElement = arrowElement;
  38635. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  38636. return data;
  38637. }
  38638. /**
  38639. * Get the opposite placement variation of the given one
  38640. * @method
  38641. * @memberof Popper.Utils
  38642. * @argument {String} placement variation
  38643. * @returns {String} flipped placement variation
  38644. */
  38645. function getOppositeVariation(variation) {
  38646. if (variation === 'end') {
  38647. return 'start';
  38648. } else if (variation === 'start') {
  38649. return 'end';
  38650. }
  38651. return variation;
  38652. }
  38653. /**
  38654. * List of accepted placements to use as values of the `placement` option.<br />
  38655. * Valid placements are:
  38656. * - `auto`
  38657. * - `top`
  38658. * - `right`
  38659. * - `bottom`
  38660. * - `left`
  38661. *
  38662. * Each placement can have a variation from this list:
  38663. * - `-start`
  38664. * - `-end`
  38665. *
  38666. * Variations are interpreted easily if you think of them as the left to right
  38667. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  38668. * is right.<br />
  38669. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  38670. *
  38671. * Some valid examples are:
  38672. * - `top-end` (on top of reference, right aligned)
  38673. * - `right-start` (on right of reference, top aligned)
  38674. * - `bottom` (on bottom, centered)
  38675. * - `auto-end` (on the side with more space available, alignment depends by placement)
  38676. *
  38677. * @static
  38678. * @type {Array}
  38679. * @enum {String}
  38680. * @readonly
  38681. * @method placements
  38682. * @memberof Popper
  38683. */
  38684. 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'];
  38685. // Get rid of `auto` `auto-start` and `auto-end`
  38686. var validPlacements = placements.slice(3);
  38687. /**
  38688. * Given an initial placement, returns all the subsequent placements
  38689. * clockwise (or counter-clockwise).
  38690. *
  38691. * @method
  38692. * @memberof Popper.Utils
  38693. * @argument {String} placement - A valid placement (it accepts variations)
  38694. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  38695. * @returns {Array} placements including their variations
  38696. */
  38697. function clockwise(placement) {
  38698. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  38699. var index = validPlacements.indexOf(placement);
  38700. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  38701. return counter ? arr.reverse() : arr;
  38702. }
  38703. var BEHAVIORS = {
  38704. FLIP: 'flip',
  38705. CLOCKWISE: 'clockwise',
  38706. COUNTERCLOCKWISE: 'counterclockwise'
  38707. };
  38708. /**
  38709. * @function
  38710. * @memberof Modifiers
  38711. * @argument {Object} data - The data object generated by update method
  38712. * @argument {Object} options - Modifiers configuration and options
  38713. * @returns {Object} The data object, properly modified
  38714. */
  38715. function flip(data, options) {
  38716. // if `inner` modifier is enabled, we can't use the `flip` modifier
  38717. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  38718. return data;
  38719. }
  38720. if (data.flipped && data.placement === data.originalPlacement) {
  38721. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  38722. return data;
  38723. }
  38724. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  38725. var placement = data.placement.split('-')[0];
  38726. var placementOpposite = getOppositePlacement(placement);
  38727. var variation = data.placement.split('-')[1] || '';
  38728. var flipOrder = [];
  38729. switch (options.behavior) {
  38730. case BEHAVIORS.FLIP:
  38731. flipOrder = [placement, placementOpposite];
  38732. break;
  38733. case BEHAVIORS.CLOCKWISE:
  38734. flipOrder = clockwise(placement);
  38735. break;
  38736. case BEHAVIORS.COUNTERCLOCKWISE:
  38737. flipOrder = clockwise(placement, true);
  38738. break;
  38739. default:
  38740. flipOrder = options.behavior;
  38741. }
  38742. flipOrder.forEach(function (step, index) {
  38743. if (placement !== step || flipOrder.length === index + 1) {
  38744. return data;
  38745. }
  38746. placement = data.placement.split('-')[0];
  38747. placementOpposite = getOppositePlacement(placement);
  38748. var popperOffsets = data.offsets.popper;
  38749. var refOffsets = data.offsets.reference;
  38750. // using floor because the reference offsets may contain decimals we are not going to consider here
  38751. var floor = Math.floor;
  38752. 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);
  38753. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  38754. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  38755. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  38756. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  38757. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  38758. // flip the variation if required
  38759. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  38760. // flips variation if reference element overflows boundaries
  38761. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  38762. // flips variation if popper content overflows boundaries
  38763. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  38764. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  38765. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  38766. // this boolean to detect any flip loop
  38767. data.flipped = true;
  38768. if (overlapsRef || overflowsBoundaries) {
  38769. placement = flipOrder[index + 1];
  38770. }
  38771. if (flippedVariation) {
  38772. variation = getOppositeVariation(variation);
  38773. }
  38774. data.placement = placement + (variation ? '-' + variation : '');
  38775. // this object contains `position`, we want to preserve it along with
  38776. // any additional property we may add in the future
  38777. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  38778. data = runModifiers(data.instance.modifiers, data, 'flip');
  38779. }
  38780. });
  38781. return data;
  38782. }
  38783. /**
  38784. * @function
  38785. * @memberof Modifiers
  38786. * @argument {Object} data - The data object generated by update method
  38787. * @argument {Object} options - Modifiers configuration and options
  38788. * @returns {Object} The data object, properly modified
  38789. */
  38790. function keepTogether(data) {
  38791. var _data$offsets = data.offsets,
  38792. popper = _data$offsets.popper,
  38793. reference = _data$offsets.reference;
  38794. var placement = data.placement.split('-')[0];
  38795. var floor = Math.floor;
  38796. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  38797. var side = isVertical ? 'right' : 'bottom';
  38798. var opSide = isVertical ? 'left' : 'top';
  38799. var measurement = isVertical ? 'width' : 'height';
  38800. if (popper[side] < floor(reference[opSide])) {
  38801. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  38802. }
  38803. if (popper[opSide] > floor(reference[side])) {
  38804. data.offsets.popper[opSide] = floor(reference[side]);
  38805. }
  38806. return data;
  38807. }
  38808. /**
  38809. * Converts a string containing value + unit into a px value number
  38810. * @function
  38811. * @memberof {modifiers~offset}
  38812. * @private
  38813. * @argument {String} str - Value + unit string
  38814. * @argument {String} measurement - `height` or `width`
  38815. * @argument {Object} popperOffsets
  38816. * @argument {Object} referenceOffsets
  38817. * @returns {Number|String}
  38818. * Value in pixels, or original string if no values were extracted
  38819. */
  38820. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  38821. // separate value from unit
  38822. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  38823. var value = +split[1];
  38824. var unit = split[2];
  38825. // If it's not a number it's an operator, I guess
  38826. if (!value) {
  38827. return str;
  38828. }
  38829. if (unit.indexOf('%') === 0) {
  38830. var element = void 0;
  38831. switch (unit) {
  38832. case '%p':
  38833. element = popperOffsets;
  38834. break;
  38835. case '%':
  38836. case '%r':
  38837. default:
  38838. element = referenceOffsets;
  38839. }
  38840. var rect = getClientRect(element);
  38841. return rect[measurement] / 100 * value;
  38842. } else if (unit === 'vh' || unit === 'vw') {
  38843. // if is a vh or vw, we calculate the size based on the viewport
  38844. var size = void 0;
  38845. if (unit === 'vh') {
  38846. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  38847. } else {
  38848. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  38849. }
  38850. return size / 100 * value;
  38851. } else {
  38852. // if is an explicit pixel unit, we get rid of the unit and keep the value
  38853. // if is an implicit unit, it's px, and we return just the value
  38854. return value;
  38855. }
  38856. }
  38857. /**
  38858. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  38859. * @function
  38860. * @memberof {modifiers~offset}
  38861. * @private
  38862. * @argument {String} offset
  38863. * @argument {Object} popperOffsets
  38864. * @argument {Object} referenceOffsets
  38865. * @argument {String} basePlacement
  38866. * @returns {Array} a two cells array with x and y offsets in numbers
  38867. */
  38868. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  38869. var offsets = [0, 0];
  38870. // Use height if placement is left or right and index is 0 otherwise use width
  38871. // in this way the first offset will use an axis and the second one
  38872. // will use the other one
  38873. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  38874. // Split the offset string to obtain a list of values and operands
  38875. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  38876. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  38877. return frag.trim();
  38878. });
  38879. // Detect if the offset string contains a pair of values or a single one
  38880. // they could be separated by comma or space
  38881. var divider = fragments.indexOf(find(fragments, function (frag) {
  38882. return frag.search(/,|\s/) !== -1;
  38883. }));
  38884. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  38885. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  38886. }
  38887. // If divider is found, we divide the list of values and operands to divide
  38888. // them by ofset X and Y.
  38889. var splitRegex = /\s*,\s*|\s+/;
  38890. 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];
  38891. // Convert the values with units to absolute pixels to allow our computations
  38892. ops = ops.map(function (op, index) {
  38893. // Most of the units rely on the orientation of the popper
  38894. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  38895. var mergeWithPrevious = false;
  38896. return op
  38897. // This aggregates any `+` or `-` sign that aren't considered operators
  38898. // e.g.: 10 + +5 => [10, +, +5]
  38899. .reduce(function (a, b) {
  38900. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  38901. a[a.length - 1] = b;
  38902. mergeWithPrevious = true;
  38903. return a;
  38904. } else if (mergeWithPrevious) {
  38905. a[a.length - 1] += b;
  38906. mergeWithPrevious = false;
  38907. return a;
  38908. } else {
  38909. return a.concat(b);
  38910. }
  38911. }, [])
  38912. // Here we convert the string values into number values (in px)
  38913. .map(function (str) {
  38914. return toValue(str, measurement, popperOffsets, referenceOffsets);
  38915. });
  38916. });
  38917. // Loop trough the offsets arrays and execute the operations
  38918. ops.forEach(function (op, index) {
  38919. op.forEach(function (frag, index2) {
  38920. if (isNumeric(frag)) {
  38921. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  38922. }
  38923. });
  38924. });
  38925. return offsets;
  38926. }
  38927. /**
  38928. * @function
  38929. * @memberof Modifiers
  38930. * @argument {Object} data - The data object generated by update method
  38931. * @argument {Object} options - Modifiers configuration and options
  38932. * @argument {Number|String} options.offset=0
  38933. * The offset value as described in the modifier description
  38934. * @returns {Object} The data object, properly modified
  38935. */
  38936. function offset(data, _ref) {
  38937. var offset = _ref.offset;
  38938. var placement = data.placement,
  38939. _data$offsets = data.offsets,
  38940. popper = _data$offsets.popper,
  38941. reference = _data$offsets.reference;
  38942. var basePlacement = placement.split('-')[0];
  38943. var offsets = void 0;
  38944. if (isNumeric(+offset)) {
  38945. offsets = [+offset, 0];
  38946. } else {
  38947. offsets = parseOffset(offset, popper, reference, basePlacement);
  38948. }
  38949. if (basePlacement === 'left') {
  38950. popper.top += offsets[0];
  38951. popper.left -= offsets[1];
  38952. } else if (basePlacement === 'right') {
  38953. popper.top += offsets[0];
  38954. popper.left += offsets[1];
  38955. } else if (basePlacement === 'top') {
  38956. popper.left += offsets[0];
  38957. popper.top -= offsets[1];
  38958. } else if (basePlacement === 'bottom') {
  38959. popper.left += offsets[0];
  38960. popper.top += offsets[1];
  38961. }
  38962. data.popper = popper;
  38963. return data;
  38964. }
  38965. /**
  38966. * @function
  38967. * @memberof Modifiers
  38968. * @argument {Object} data - The data object generated by `update` method
  38969. * @argument {Object} options - Modifiers configuration and options
  38970. * @returns {Object} The data object, properly modified
  38971. */
  38972. function preventOverflow(data, options) {
  38973. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  38974. // If offsetParent is the reference element, we really want to
  38975. // go one step up and use the next offsetParent as reference to
  38976. // avoid to make this modifier completely useless and look like broken
  38977. if (data.instance.reference === boundariesElement) {
  38978. boundariesElement = getOffsetParent(boundariesElement);
  38979. }
  38980. // NOTE: DOM access here
  38981. // resets the popper's position so that the document size can be calculated excluding
  38982. // the size of the popper element itself
  38983. var transformProp = getSupportedPropertyName('transform');
  38984. var popperStyles = data.instance.popper.style; // assignment to help minification
  38985. var top = popperStyles.top,
  38986. left = popperStyles.left,
  38987. transform = popperStyles[transformProp];
  38988. popperStyles.top = '';
  38989. popperStyles.left = '';
  38990. popperStyles[transformProp] = '';
  38991. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  38992. // NOTE: DOM access here
  38993. // restores the original style properties after the offsets have been computed
  38994. popperStyles.top = top;
  38995. popperStyles.left = left;
  38996. popperStyles[transformProp] = transform;
  38997. options.boundaries = boundaries;
  38998. var order = options.priority;
  38999. var popper = data.offsets.popper;
  39000. var check = {
  39001. primary: function primary(placement) {
  39002. var value = popper[placement];
  39003. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  39004. value = Math.max(popper[placement], boundaries[placement]);
  39005. }
  39006. return defineProperty({}, placement, value);
  39007. },
  39008. secondary: function secondary(placement) {
  39009. var mainSide = placement === 'right' ? 'left' : 'top';
  39010. var value = popper[mainSide];
  39011. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  39012. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  39013. }
  39014. return defineProperty({}, mainSide, value);
  39015. }
  39016. };
  39017. order.forEach(function (placement) {
  39018. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  39019. popper = _extends({}, popper, check[side](placement));
  39020. });
  39021. data.offsets.popper = popper;
  39022. return data;
  39023. }
  39024. /**
  39025. * @function
  39026. * @memberof Modifiers
  39027. * @argument {Object} data - The data object generated by `update` method
  39028. * @argument {Object} options - Modifiers configuration and options
  39029. * @returns {Object} The data object, properly modified
  39030. */
  39031. function shift(data) {
  39032. var placement = data.placement;
  39033. var basePlacement = placement.split('-')[0];
  39034. var shiftvariation = placement.split('-')[1];
  39035. // if shift shiftvariation is specified, run the modifier
  39036. if (shiftvariation) {
  39037. var _data$offsets = data.offsets,
  39038. reference = _data$offsets.reference,
  39039. popper = _data$offsets.popper;
  39040. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  39041. var side = isVertical ? 'left' : 'top';
  39042. var measurement = isVertical ? 'width' : 'height';
  39043. var shiftOffsets = {
  39044. start: defineProperty({}, side, reference[side]),
  39045. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  39046. };
  39047. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  39048. }
  39049. return data;
  39050. }
  39051. /**
  39052. * @function
  39053. * @memberof Modifiers
  39054. * @argument {Object} data - The data object generated by update method
  39055. * @argument {Object} options - Modifiers configuration and options
  39056. * @returns {Object} The data object, properly modified
  39057. */
  39058. function hide(data) {
  39059. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  39060. return data;
  39061. }
  39062. var refRect = data.offsets.reference;
  39063. var bound = find(data.instance.modifiers, function (modifier) {
  39064. return modifier.name === 'preventOverflow';
  39065. }).boundaries;
  39066. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  39067. // Avoid unnecessary DOM access if visibility hasn't changed
  39068. if (data.hide === true) {
  39069. return data;
  39070. }
  39071. data.hide = true;
  39072. data.attributes['x-out-of-boundaries'] = '';
  39073. } else {
  39074. // Avoid unnecessary DOM access if visibility hasn't changed
  39075. if (data.hide === false) {
  39076. return data;
  39077. }
  39078. data.hide = false;
  39079. data.attributes['x-out-of-boundaries'] = false;
  39080. }
  39081. return data;
  39082. }
  39083. /**
  39084. * @function
  39085. * @memberof Modifiers
  39086. * @argument {Object} data - The data object generated by `update` method
  39087. * @argument {Object} options - Modifiers configuration and options
  39088. * @returns {Object} The data object, properly modified
  39089. */
  39090. function inner(data) {
  39091. var placement = data.placement;
  39092. var basePlacement = placement.split('-')[0];
  39093. var _data$offsets = data.offsets,
  39094. popper = _data$offsets.popper,
  39095. reference = _data$offsets.reference;
  39096. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  39097. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  39098. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  39099. data.placement = getOppositePlacement(placement);
  39100. data.offsets.popper = getClientRect(popper);
  39101. return data;
  39102. }
  39103. /**
  39104. * Modifier function, each modifier can have a function of this type assigned
  39105. * to its `fn` property.<br />
  39106. * These functions will be called on each update, this means that you must
  39107. * make sure they are performant enough to avoid performance bottlenecks.
  39108. *
  39109. * @function ModifierFn
  39110. * @argument {dataObject} data - The data object generated by `update` method
  39111. * @argument {Object} options - Modifiers configuration and options
  39112. * @returns {dataObject} The data object, properly modified
  39113. */
  39114. /**
  39115. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  39116. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  39117. * needed by the library.
  39118. *
  39119. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  39120. * All the other properties are configurations that could be tweaked.
  39121. * @namespace modifiers
  39122. */
  39123. var modifiers = {
  39124. /**
  39125. * Modifier used to shift the popper on the start or end of its reference
  39126. * element.<br />
  39127. * It will read the variation of the `placement` property.<br />
  39128. * It can be one either `-end` or `-start`.
  39129. * @memberof modifiers
  39130. * @inner
  39131. */
  39132. shift: {
  39133. /** @prop {number} order=100 - Index used to define the order of execution */
  39134. order: 100,
  39135. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  39136. enabled: true,
  39137. /** @prop {ModifierFn} */
  39138. fn: shift
  39139. },
  39140. /**
  39141. * The `offset` modifier can shift your popper on both its axis.
  39142. *
  39143. * It accepts the following units:
  39144. * - `px` or unit-less, interpreted as pixels
  39145. * - `%` or `%r`, percentage relative to the length of the reference element
  39146. * - `%p`, percentage relative to the length of the popper element
  39147. * - `vw`, CSS viewport width unit
  39148. * - `vh`, CSS viewport height unit
  39149. *
  39150. * For length is intended the main axis relative to the placement of the popper.<br />
  39151. * This means that if the placement is `top` or `bottom`, the length will be the
  39152. * `width`. In case of `left` or `right`, it will be the `height`.
  39153. *
  39154. * You can provide a single value (as `Number` or `String`), or a pair of values
  39155. * as `String` divided by a comma or one (or more) white spaces.<br />
  39156. * The latter is a deprecated method because it leads to confusion and will be
  39157. * removed in v2.<br />
  39158. * Additionally, it accepts additions and subtractions between different units.
  39159. * Note that multiplications and divisions aren't supported.
  39160. *
  39161. * Valid examples are:
  39162. * ```
  39163. * 10
  39164. * '10%'
  39165. * '10, 10'
  39166. * '10%, 10'
  39167. * '10 + 10%'
  39168. * '10 - 5vh + 3%'
  39169. * '-10px + 5vh, 5px - 6%'
  39170. * ```
  39171. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  39172. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  39173. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  39174. *
  39175. * @memberof modifiers
  39176. * @inner
  39177. */
  39178. offset: {
  39179. /** @prop {number} order=200 - Index used to define the order of execution */
  39180. order: 200,
  39181. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  39182. enabled: true,
  39183. /** @prop {ModifierFn} */
  39184. fn: offset,
  39185. /** @prop {Number|String} offset=0
  39186. * The offset value as described in the modifier description
  39187. */
  39188. offset: 0
  39189. },
  39190. /**
  39191. * Modifier used to prevent the popper from being positioned outside the boundary.
  39192. *
  39193. * A scenario exists where the reference itself is not within the boundaries.<br />
  39194. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  39195. * In this case we need to decide whether the popper should either:
  39196. *
  39197. * - detach from the reference and remain "trapped" in the boundaries, or
  39198. * - if it should ignore the boundary and "escape with its reference"
  39199. *
  39200. * When `escapeWithReference` is set to`true` and reference is completely
  39201. * outside its boundaries, the popper will overflow (or completely leave)
  39202. * the boundaries in order to remain attached to the edge of the reference.
  39203. *
  39204. * @memberof modifiers
  39205. * @inner
  39206. */
  39207. preventOverflow: {
  39208. /** @prop {number} order=300 - Index used to define the order of execution */
  39209. order: 300,
  39210. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  39211. enabled: true,
  39212. /** @prop {ModifierFn} */
  39213. fn: preventOverflow,
  39214. /**
  39215. * @prop {Array} [priority=['left','right','top','bottom']]
  39216. * Popper will try to prevent overflow following these priorities by default,
  39217. * then, it could overflow on the left and on top of the `boundariesElement`
  39218. */
  39219. priority: ['left', 'right', 'top', 'bottom'],
  39220. /**
  39221. * @prop {number} padding=5
  39222. * Amount of pixel used to define a minimum distance between the boundaries
  39223. * and the popper. This makes sure the popper always has a little padding
  39224. * between the edges of its container
  39225. */
  39226. padding: 5,
  39227. /**
  39228. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  39229. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  39230. * `viewport` or any DOM element.
  39231. */
  39232. boundariesElement: 'scrollParent'
  39233. },
  39234. /**
  39235. * Modifier used to make sure the reference and its popper stay near each other
  39236. * without leaving any gap between the two. Especially useful when the arrow is
  39237. * enabled and you want to ensure that it points to its reference element.
  39238. * It cares only about the first axis. You can still have poppers with margin
  39239. * between the popper and its reference element.
  39240. * @memberof modifiers
  39241. * @inner
  39242. */
  39243. keepTogether: {
  39244. /** @prop {number} order=400 - Index used to define the order of execution */
  39245. order: 400,
  39246. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  39247. enabled: true,
  39248. /** @prop {ModifierFn} */
  39249. fn: keepTogether
  39250. },
  39251. /**
  39252. * This modifier is used to move the `arrowElement` of the popper to make
  39253. * sure it is positioned between the reference element and its popper element.
  39254. * It will read the outer size of the `arrowElement` node to detect how many
  39255. * pixels of conjunction are needed.
  39256. *
  39257. * It has no effect if no `arrowElement` is provided.
  39258. * @memberof modifiers
  39259. * @inner
  39260. */
  39261. arrow: {
  39262. /** @prop {number} order=500 - Index used to define the order of execution */
  39263. order: 500,
  39264. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  39265. enabled: true,
  39266. /** @prop {ModifierFn} */
  39267. fn: arrow,
  39268. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  39269. element: '[x-arrow]'
  39270. },
  39271. /**
  39272. * Modifier used to flip the popper's placement when it starts to overlap its
  39273. * reference element.
  39274. *
  39275. * Requires the `preventOverflow` modifier before it in order to work.
  39276. *
  39277. * **NOTE:** this modifier will interrupt the current update cycle and will
  39278. * restart it if it detects the need to flip the placement.
  39279. * @memberof modifiers
  39280. * @inner
  39281. */
  39282. flip: {
  39283. /** @prop {number} order=600 - Index used to define the order of execution */
  39284. order: 600,
  39285. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  39286. enabled: true,
  39287. /** @prop {ModifierFn} */
  39288. fn: flip,
  39289. /**
  39290. * @prop {String|Array} behavior='flip'
  39291. * The behavior used to change the popper's placement. It can be one of
  39292. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  39293. * placements (with optional variations)
  39294. */
  39295. behavior: 'flip',
  39296. /**
  39297. * @prop {number} padding=5
  39298. * The popper will flip if it hits the edges of the `boundariesElement`
  39299. */
  39300. padding: 5,
  39301. /**
  39302. * @prop {String|HTMLElement} boundariesElement='viewport'
  39303. * The element which will define the boundaries of the popper position.
  39304. * The popper will never be placed outside of the defined boundaries
  39305. * (except if `keepTogether` is enabled)
  39306. */
  39307. boundariesElement: 'viewport',
  39308. /**
  39309. * @prop {Boolean} flipVariations=false
  39310. * The popper will switch placement variation between `-start` and `-end` when
  39311. * the reference element overlaps its boundaries.
  39312. *
  39313. * The original placement should have a set variation.
  39314. */
  39315. flipVariations: false,
  39316. /**
  39317. * @prop {Boolean} flipVariationsByContent=false
  39318. * The popper will switch placement variation between `-start` and `-end` when
  39319. * the popper element overlaps its reference boundaries.
  39320. *
  39321. * The original placement should have a set variation.
  39322. */
  39323. flipVariationsByContent: false
  39324. },
  39325. /**
  39326. * Modifier used to make the popper flow toward the inner of the reference element.
  39327. * By default, when this modifier is disabled, the popper will be placed outside
  39328. * the reference element.
  39329. * @memberof modifiers
  39330. * @inner
  39331. */
  39332. inner: {
  39333. /** @prop {number} order=700 - Index used to define the order of execution */
  39334. order: 700,
  39335. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  39336. enabled: false,
  39337. /** @prop {ModifierFn} */
  39338. fn: inner
  39339. },
  39340. /**
  39341. * Modifier used to hide the popper when its reference element is outside of the
  39342. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  39343. * be used to hide with a CSS selector the popper when its reference is
  39344. * out of boundaries.
  39345. *
  39346. * Requires the `preventOverflow` modifier before it in order to work.
  39347. * @memberof modifiers
  39348. * @inner
  39349. */
  39350. hide: {
  39351. /** @prop {number} order=800 - Index used to define the order of execution */
  39352. order: 800,
  39353. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  39354. enabled: true,
  39355. /** @prop {ModifierFn} */
  39356. fn: hide
  39357. },
  39358. /**
  39359. * Computes the style that will be applied to the popper element to gets
  39360. * properly positioned.
  39361. *
  39362. * Note that this modifier will not touch the DOM, it just prepares the styles
  39363. * so that `applyStyle` modifier can apply it. This separation is useful
  39364. * in case you need to replace `applyStyle` with a custom implementation.
  39365. *
  39366. * This modifier has `850` as `order` value to maintain backward compatibility
  39367. * with previous versions of Popper.js. Expect the modifiers ordering method
  39368. * to change in future major versions of the library.
  39369. *
  39370. * @memberof modifiers
  39371. * @inner
  39372. */
  39373. computeStyle: {
  39374. /** @prop {number} order=850 - Index used to define the order of execution */
  39375. order: 850,
  39376. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  39377. enabled: true,
  39378. /** @prop {ModifierFn} */
  39379. fn: computeStyle,
  39380. /**
  39381. * @prop {Boolean} gpuAcceleration=true
  39382. * If true, it uses the CSS 3D transformation to position the popper.
  39383. * Otherwise, it will use the `top` and `left` properties
  39384. */
  39385. gpuAcceleration: true,
  39386. /**
  39387. * @prop {string} [x='bottom']
  39388. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  39389. * Change this if your popper should grow in a direction different from `bottom`
  39390. */
  39391. x: 'bottom',
  39392. /**
  39393. * @prop {string} [x='left']
  39394. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  39395. * Change this if your popper should grow in a direction different from `right`
  39396. */
  39397. y: 'right'
  39398. },
  39399. /**
  39400. * Applies the computed styles to the popper element.
  39401. *
  39402. * All the DOM manipulations are limited to this modifier. This is useful in case
  39403. * you want to integrate Popper.js inside a framework or view library and you
  39404. * want to delegate all the DOM manipulations to it.
  39405. *
  39406. * Note that if you disable this modifier, you must make sure the popper element
  39407. * has its position set to `absolute` before Popper.js can do its work!
  39408. *
  39409. * Just disable this modifier and define your own to achieve the desired effect.
  39410. *
  39411. * @memberof modifiers
  39412. * @inner
  39413. */
  39414. applyStyle: {
  39415. /** @prop {number} order=900 - Index used to define the order of execution */
  39416. order: 900,
  39417. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  39418. enabled: true,
  39419. /** @prop {ModifierFn} */
  39420. fn: applyStyle,
  39421. /** @prop {Function} */
  39422. onLoad: applyStyleOnLoad,
  39423. /**
  39424. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  39425. * @prop {Boolean} gpuAcceleration=true
  39426. * If true, it uses the CSS 3D transformation to position the popper.
  39427. * Otherwise, it will use the `top` and `left` properties
  39428. */
  39429. gpuAcceleration: undefined
  39430. }
  39431. };
  39432. /**
  39433. * The `dataObject` is an object containing all the information used by Popper.js.
  39434. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  39435. * @name dataObject
  39436. * @property {Object} data.instance The Popper.js instance
  39437. * @property {String} data.placement Placement applied to popper
  39438. * @property {String} data.originalPlacement Placement originally defined on init
  39439. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  39440. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  39441. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  39442. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  39443. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  39444. * @property {Object} data.boundaries Offsets of the popper boundaries
  39445. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  39446. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  39447. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  39448. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  39449. */
  39450. /**
  39451. * Default options provided to Popper.js constructor.<br />
  39452. * These can be overridden using the `options` argument of Popper.js.<br />
  39453. * To override an option, simply pass an object with the same
  39454. * structure of the `options` object, as the 3rd argument. For example:
  39455. * ```
  39456. * new Popper(ref, pop, {
  39457. * modifiers: {
  39458. * preventOverflow: { enabled: false }
  39459. * }
  39460. * })
  39461. * ```
  39462. * @type {Object}
  39463. * @static
  39464. * @memberof Popper
  39465. */
  39466. var Defaults = {
  39467. /**
  39468. * Popper's placement.
  39469. * @prop {Popper.placements} placement='bottom'
  39470. */
  39471. placement: 'bottom',
  39472. /**
  39473. * Set this to true if you want popper to position it self in 'fixed' mode
  39474. * @prop {Boolean} positionFixed=false
  39475. */
  39476. positionFixed: false,
  39477. /**
  39478. * Whether events (resize, scroll) are initially enabled.
  39479. * @prop {Boolean} eventsEnabled=true
  39480. */
  39481. eventsEnabled: true,
  39482. /**
  39483. * Set to true if you want to automatically remove the popper when
  39484. * you call the `destroy` method.
  39485. * @prop {Boolean} removeOnDestroy=false
  39486. */
  39487. removeOnDestroy: false,
  39488. /**
  39489. * Callback called when the popper is created.<br />
  39490. * By default, it is set to no-op.<br />
  39491. * Access Popper.js instance with `data.instance`.
  39492. * @prop {onCreate}
  39493. */
  39494. onCreate: function onCreate() {},
  39495. /**
  39496. * Callback called when the popper is updated. This callback is not called
  39497. * on the initialization/creation of the popper, but only on subsequent
  39498. * updates.<br />
  39499. * By default, it is set to no-op.<br />
  39500. * Access Popper.js instance with `data.instance`.
  39501. * @prop {onUpdate}
  39502. */
  39503. onUpdate: function onUpdate() {},
  39504. /**
  39505. * List of modifiers used to modify the offsets before they are applied to the popper.
  39506. * They provide most of the functionalities of Popper.js.
  39507. * @prop {modifiers}
  39508. */
  39509. modifiers: modifiers
  39510. };
  39511. /**
  39512. * @callback onCreate
  39513. * @param {dataObject} data
  39514. */
  39515. /**
  39516. * @callback onUpdate
  39517. * @param {dataObject} data
  39518. */
  39519. // Utils
  39520. // Methods
  39521. var Popper = function () {
  39522. /**
  39523. * Creates a new Popper.js instance.
  39524. * @class Popper
  39525. * @param {Element|referenceObject} reference - The reference element used to position the popper
  39526. * @param {Element} popper - The HTML / XML element used as the popper
  39527. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  39528. * @return {Object} instance - The generated Popper.js instance
  39529. */
  39530. function Popper(reference, popper) {
  39531. var _this = this;
  39532. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  39533. classCallCheck(this, Popper);
  39534. this.scheduleUpdate = function () {
  39535. return requestAnimationFrame(_this.update);
  39536. };
  39537. // make update() debounced, so that it only runs at most once-per-tick
  39538. this.update = debounce(this.update.bind(this));
  39539. // with {} we create a new object with the options inside it
  39540. this.options = _extends({}, Popper.Defaults, options);
  39541. // init state
  39542. this.state = {
  39543. isDestroyed: false,
  39544. isCreated: false,
  39545. scrollParents: []
  39546. };
  39547. // get reference and popper elements (allow jQuery wrappers)
  39548. this.reference = reference && reference.jquery ? reference[0] : reference;
  39549. this.popper = popper && popper.jquery ? popper[0] : popper;
  39550. // Deep merge modifiers options
  39551. this.options.modifiers = {};
  39552. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  39553. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  39554. });
  39555. // Refactoring modifiers' list (Object => Array)
  39556. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  39557. return _extends({
  39558. name: name
  39559. }, _this.options.modifiers[name]);
  39560. })
  39561. // sort the modifiers by order
  39562. .sort(function (a, b) {
  39563. return a.order - b.order;
  39564. });
  39565. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  39566. // such code is executed in the same order of its modifier
  39567. // they could add new properties to their options configuration
  39568. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  39569. this.modifiers.forEach(function (modifierOptions) {
  39570. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  39571. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  39572. }
  39573. });
  39574. // fire the first update to position the popper in the right place
  39575. this.update();
  39576. var eventsEnabled = this.options.eventsEnabled;
  39577. if (eventsEnabled) {
  39578. // setup event listeners, they will take care of update the position in specific situations
  39579. this.enableEventListeners();
  39580. }
  39581. this.state.eventsEnabled = eventsEnabled;
  39582. }
  39583. // We can't use class properties because they don't get listed in the
  39584. // class prototype and break stuff like Sinon stubs
  39585. createClass(Popper, [{
  39586. key: 'update',
  39587. value: function update$$1() {
  39588. return update.call(this);
  39589. }
  39590. }, {
  39591. key: 'destroy',
  39592. value: function destroy$$1() {
  39593. return destroy.call(this);
  39594. }
  39595. }, {
  39596. key: 'enableEventListeners',
  39597. value: function enableEventListeners$$1() {
  39598. return enableEventListeners.call(this);
  39599. }
  39600. }, {
  39601. key: 'disableEventListeners',
  39602. value: function disableEventListeners$$1() {
  39603. return disableEventListeners.call(this);
  39604. }
  39605. /**
  39606. * Schedules an update. It will run on the next UI update available.
  39607. * @method scheduleUpdate
  39608. * @memberof Popper
  39609. */
  39610. /**
  39611. * Collection of utilities useful when writing custom modifiers.
  39612. * Starting from version 1.7, this method is available only if you
  39613. * include `popper-utils.js` before `popper.js`.
  39614. *
  39615. * **DEPRECATION**: This way to access PopperUtils is deprecated
  39616. * and will be removed in v2! Use the PopperUtils module directly instead.
  39617. * Due to the high instability of the methods contained in Utils, we can't
  39618. * guarantee them to follow semver. Use them at your own risk!
  39619. * @static
  39620. * @private
  39621. * @type {Object}
  39622. * @deprecated since version 1.8
  39623. * @member Utils
  39624. * @memberof Popper
  39625. */
  39626. }]);
  39627. return Popper;
  39628. }();
  39629. /**
  39630. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  39631. * and lets you use it as replacement of a real DOM node.<br />
  39632. * You can use this method to position a popper relatively to a set of coordinates
  39633. * in case you don't have a DOM node to use as reference.
  39634. *
  39635. * ```
  39636. * new Popper(referenceObject, popperNode);
  39637. * ```
  39638. *
  39639. * NB: This feature isn't supported in Internet Explorer 10.
  39640. * @name referenceObject
  39641. * @property {Function} data.getBoundingClientRect
  39642. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  39643. * @property {number} data.clientWidth
  39644. * An ES6 getter that will return the width of the virtual reference element.
  39645. * @property {number} data.clientHeight
  39646. * An ES6 getter that will return the height of the virtual reference element.
  39647. */
  39648. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  39649. Popper.placements = placements;
  39650. Popper.Defaults = Defaults;
  39651. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  39652. //# sourceMappingURL=popper.js.map
  39653. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  39654. /***/ }),
  39655. /***/ "./node_modules/process/browser.js":
  39656. /*!*****************************************!*\
  39657. !*** ./node_modules/process/browser.js ***!
  39658. \*****************************************/
  39659. /*! no static exports found */
  39660. /***/ (function(module, exports) {
  39661. // shim for using process in browser
  39662. var process = module.exports = {};
  39663. // cached from whatever global is present so that test runners that stub it
  39664. // don't break things. But we need to wrap it in a try catch in case it is
  39665. // wrapped in strict mode code which doesn't define any globals. It's inside a
  39666. // function because try/catches deoptimize in certain engines.
  39667. var cachedSetTimeout;
  39668. var cachedClearTimeout;
  39669. function defaultSetTimout() {
  39670. throw new Error('setTimeout has not been defined');
  39671. }
  39672. function defaultClearTimeout () {
  39673. throw new Error('clearTimeout has not been defined');
  39674. }
  39675. (function () {
  39676. try {
  39677. if (typeof setTimeout === 'function') {
  39678. cachedSetTimeout = setTimeout;
  39679. } else {
  39680. cachedSetTimeout = defaultSetTimout;
  39681. }
  39682. } catch (e) {
  39683. cachedSetTimeout = defaultSetTimout;
  39684. }
  39685. try {
  39686. if (typeof clearTimeout === 'function') {
  39687. cachedClearTimeout = clearTimeout;
  39688. } else {
  39689. cachedClearTimeout = defaultClearTimeout;
  39690. }
  39691. } catch (e) {
  39692. cachedClearTimeout = defaultClearTimeout;
  39693. }
  39694. } ())
  39695. function runTimeout(fun) {
  39696. if (cachedSetTimeout === setTimeout) {
  39697. //normal enviroments in sane situations
  39698. return setTimeout(fun, 0);
  39699. }
  39700. // if setTimeout wasn't available but was latter defined
  39701. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  39702. cachedSetTimeout = setTimeout;
  39703. return setTimeout(fun, 0);
  39704. }
  39705. try {
  39706. // when when somebody has screwed with setTimeout but no I.E. maddness
  39707. return cachedSetTimeout(fun, 0);
  39708. } catch(e){
  39709. try {
  39710. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  39711. return cachedSetTimeout.call(null, fun, 0);
  39712. } catch(e){
  39713. // 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
  39714. return cachedSetTimeout.call(this, fun, 0);
  39715. }
  39716. }
  39717. }
  39718. function runClearTimeout(marker) {
  39719. if (cachedClearTimeout === clearTimeout) {
  39720. //normal enviroments in sane situations
  39721. return clearTimeout(marker);
  39722. }
  39723. // if clearTimeout wasn't available but was latter defined
  39724. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  39725. cachedClearTimeout = clearTimeout;
  39726. return clearTimeout(marker);
  39727. }
  39728. try {
  39729. // when when somebody has screwed with setTimeout but no I.E. maddness
  39730. return cachedClearTimeout(marker);
  39731. } catch (e){
  39732. try {
  39733. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  39734. return cachedClearTimeout.call(null, marker);
  39735. } catch (e){
  39736. // 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.
  39737. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  39738. return cachedClearTimeout.call(this, marker);
  39739. }
  39740. }
  39741. }
  39742. var queue = [];
  39743. var draining = false;
  39744. var currentQueue;
  39745. var queueIndex = -1;
  39746. function cleanUpNextTick() {
  39747. if (!draining || !currentQueue) {
  39748. return;
  39749. }
  39750. draining = false;
  39751. if (currentQueue.length) {
  39752. queue = currentQueue.concat(queue);
  39753. } else {
  39754. queueIndex = -1;
  39755. }
  39756. if (queue.length) {
  39757. drainQueue();
  39758. }
  39759. }
  39760. function drainQueue() {
  39761. if (draining) {
  39762. return;
  39763. }
  39764. var timeout = runTimeout(cleanUpNextTick);
  39765. draining = true;
  39766. var len = queue.length;
  39767. while(len) {
  39768. currentQueue = queue;
  39769. queue = [];
  39770. while (++queueIndex < len) {
  39771. if (currentQueue) {
  39772. currentQueue[queueIndex].run();
  39773. }
  39774. }
  39775. queueIndex = -1;
  39776. len = queue.length;
  39777. }
  39778. currentQueue = null;
  39779. draining = false;
  39780. runClearTimeout(timeout);
  39781. }
  39782. process.nextTick = function (fun) {
  39783. var args = new Array(arguments.length - 1);
  39784. if (arguments.length > 1) {
  39785. for (var i = 1; i < arguments.length; i++) {
  39786. args[i - 1] = arguments[i];
  39787. }
  39788. }
  39789. queue.push(new Item(fun, args));
  39790. if (queue.length === 1 && !draining) {
  39791. runTimeout(drainQueue);
  39792. }
  39793. };
  39794. // v8 likes predictible objects
  39795. function Item(fun, array) {
  39796. this.fun = fun;
  39797. this.array = array;
  39798. }
  39799. Item.prototype.run = function () {
  39800. this.fun.apply(null, this.array);
  39801. };
  39802. process.title = 'browser';
  39803. process.browser = true;
  39804. process.env = {};
  39805. process.argv = [];
  39806. process.version = ''; // empty string to avoid regexp issues
  39807. process.versions = {};
  39808. function noop() {}
  39809. process.on = noop;
  39810. process.addListener = noop;
  39811. process.once = noop;
  39812. process.off = noop;
  39813. process.removeListener = noop;
  39814. process.removeAllListeners = noop;
  39815. process.emit = noop;
  39816. process.prependListener = noop;
  39817. process.prependOnceListener = noop;
  39818. process.listeners = function (name) { return [] }
  39819. process.binding = function (name) {
  39820. throw new Error('process.binding is not supported');
  39821. };
  39822. process.cwd = function () { return '/' };
  39823. process.chdir = function (dir) {
  39824. throw new Error('process.chdir is not supported');
  39825. };
  39826. process.umask = function() { return 0; };
  39827. /***/ }),
  39828. /***/ "./node_modules/setimmediate/setImmediate.js":
  39829. /*!***************************************************!*\
  39830. !*** ./node_modules/setimmediate/setImmediate.js ***!
  39831. \***************************************************/
  39832. /*! no static exports found */
  39833. /***/ (function(module, exports, __webpack_require__) {
  39834. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  39835. "use strict";
  39836. if (global.setImmediate) {
  39837. return;
  39838. }
  39839. var nextHandle = 1; // Spec says greater than zero
  39840. var tasksByHandle = {};
  39841. var currentlyRunningATask = false;
  39842. var doc = global.document;
  39843. var registerImmediate;
  39844. function setImmediate(callback) {
  39845. // Callback can either be a function or a string
  39846. if (typeof callback !== "function") {
  39847. callback = new Function("" + callback);
  39848. }
  39849. // Copy function arguments
  39850. var args = new Array(arguments.length - 1);
  39851. for (var i = 0; i < args.length; i++) {
  39852. args[i] = arguments[i + 1];
  39853. }
  39854. // Store and register the task
  39855. var task = { callback: callback, args: args };
  39856. tasksByHandle[nextHandle] = task;
  39857. registerImmediate(nextHandle);
  39858. return nextHandle++;
  39859. }
  39860. function clearImmediate(handle) {
  39861. delete tasksByHandle[handle];
  39862. }
  39863. function run(task) {
  39864. var callback = task.callback;
  39865. var args = task.args;
  39866. switch (args.length) {
  39867. case 0:
  39868. callback();
  39869. break;
  39870. case 1:
  39871. callback(args[0]);
  39872. break;
  39873. case 2:
  39874. callback(args[0], args[1]);
  39875. break;
  39876. case 3:
  39877. callback(args[0], args[1], args[2]);
  39878. break;
  39879. default:
  39880. callback.apply(undefined, args);
  39881. break;
  39882. }
  39883. }
  39884. function runIfPresent(handle) {
  39885. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  39886. // So if we're currently running a task, we'll need to delay this invocation.
  39887. if (currentlyRunningATask) {
  39888. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  39889. // "too much recursion" error.
  39890. setTimeout(runIfPresent, 0, handle);
  39891. } else {
  39892. var task = tasksByHandle[handle];
  39893. if (task) {
  39894. currentlyRunningATask = true;
  39895. try {
  39896. run(task);
  39897. } finally {
  39898. clearImmediate(handle);
  39899. currentlyRunningATask = false;
  39900. }
  39901. }
  39902. }
  39903. }
  39904. function installNextTickImplementation() {
  39905. registerImmediate = function(handle) {
  39906. process.nextTick(function () { runIfPresent(handle); });
  39907. };
  39908. }
  39909. function canUsePostMessage() {
  39910. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  39911. // where `global.postMessage` means something completely different and can't be used for this purpose.
  39912. if (global.postMessage && !global.importScripts) {
  39913. var postMessageIsAsynchronous = true;
  39914. var oldOnMessage = global.onmessage;
  39915. global.onmessage = function() {
  39916. postMessageIsAsynchronous = false;
  39917. };
  39918. global.postMessage("", "*");
  39919. global.onmessage = oldOnMessage;
  39920. return postMessageIsAsynchronous;
  39921. }
  39922. }
  39923. function installPostMessageImplementation() {
  39924. // Installs an event handler on `global` for the `message` event: see
  39925. // * https://developer.mozilla.org/en/DOM/window.postMessage
  39926. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  39927. var messagePrefix = "setImmediate$" + Math.random() + "$";
  39928. var onGlobalMessage = function(event) {
  39929. if (event.source === global &&
  39930. typeof event.data === "string" &&
  39931. event.data.indexOf(messagePrefix) === 0) {
  39932. runIfPresent(+event.data.slice(messagePrefix.length));
  39933. }
  39934. };
  39935. if (global.addEventListener) {
  39936. global.addEventListener("message", onGlobalMessage, false);
  39937. } else {
  39938. global.attachEvent("onmessage", onGlobalMessage);
  39939. }
  39940. registerImmediate = function(handle) {
  39941. global.postMessage(messagePrefix + handle, "*");
  39942. };
  39943. }
  39944. function installMessageChannelImplementation() {
  39945. var channel = new MessageChannel();
  39946. channel.port1.onmessage = function(event) {
  39947. var handle = event.data;
  39948. runIfPresent(handle);
  39949. };
  39950. registerImmediate = function(handle) {
  39951. channel.port2.postMessage(handle);
  39952. };
  39953. }
  39954. function installReadyStateChangeImplementation() {
  39955. var html = doc.documentElement;
  39956. registerImmediate = function(handle) {
  39957. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  39958. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  39959. var script = doc.createElement("script");
  39960. script.onreadystatechange = function () {
  39961. runIfPresent(handle);
  39962. script.onreadystatechange = null;
  39963. html.removeChild(script);
  39964. script = null;
  39965. };
  39966. html.appendChild(script);
  39967. };
  39968. }
  39969. function installSetTimeoutImplementation() {
  39970. registerImmediate = function(handle) {
  39971. setTimeout(runIfPresent, 0, handle);
  39972. };
  39973. }
  39974. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  39975. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  39976. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  39977. // Don't get fooled by e.g. browserify environments.
  39978. if ({}.toString.call(global.process) === "[object process]") {
  39979. // For Node.js before 0.9
  39980. installNextTickImplementation();
  39981. } else if (canUsePostMessage()) {
  39982. // For non-IE10 modern browsers
  39983. installPostMessageImplementation();
  39984. } else if (global.MessageChannel) {
  39985. // For web workers, where supported
  39986. installMessageChannelImplementation();
  39987. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  39988. // For IE 6–8
  39989. installReadyStateChangeImplementation();
  39990. } else {
  39991. // For older browsers
  39992. installSetTimeoutImplementation();
  39993. }
  39994. attachTo.setImmediate = setImmediate;
  39995. attachTo.clearImmediate = clearImmediate;
  39996. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  39997. /* 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")))
  39998. /***/ }),
  39999. /***/ "./node_modules/socket.io-client/lib/index.js":
  40000. /*!****************************************************!*\
  40001. !*** ./node_modules/socket.io-client/lib/index.js ***!
  40002. \****************************************************/
  40003. /*! no static exports found */
  40004. /***/ (function(module, exports, __webpack_require__) {
  40005. /**
  40006. * Module dependencies.
  40007. */
  40008. var url = __webpack_require__(/*! ./url */ "./node_modules/socket.io-client/lib/url.js");
  40009. var parser = __webpack_require__(/*! socket.io-parser */ "./node_modules/socket.io-parser/index.js");
  40010. var Manager = __webpack_require__(/*! ./manager */ "./node_modules/socket.io-client/lib/manager.js");
  40011. var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")('socket.io-client');
  40012. /**
  40013. * Module exports.
  40014. */
  40015. module.exports = exports = lookup;
  40016. /**
  40017. * Managers cache.
  40018. */
  40019. var cache = exports.managers = {};
  40020. /**
  40021. * Looks up an existing `Manager` for multiplexing.
  40022. * If the user summons:
  40023. *
  40024. * `io('http://localhost/a');`
  40025. * `io('http://localhost/b');`
  40026. *
  40027. * We reuse the existing instance based on same scheme/port/host,
  40028. * and we initialize sockets for each namespace.
  40029. *
  40030. * @api public
  40031. */
  40032. function lookup (uri, opts) {
  40033. if (typeof uri === 'object') {
  40034. opts = uri;
  40035. uri = undefined;
  40036. }
  40037. opts = opts || {};
  40038. var parsed = url(uri);
  40039. var source = parsed.source;
  40040. var id = parsed.id;
  40041. var path = parsed.path;
  40042. var sameNamespace = cache[id] && path in cache[id].nsps;
  40043. var newConnection = opts.forceNew || opts['force new connection'] ||
  40044. false === opts.multiplex || sameNamespace;
  40045. var io;
  40046. if (newConnection) {
  40047. debug('ignoring socket cache for %s', source);
  40048. io = Manager(source, opts);
  40049. } else {
  40050. if (!cache[id]) {
  40051. debug('new io instance for %s', source);
  40052. cache[id] = Manager(source, opts);
  40053. }
  40054. io = cache[id];
  40055. }
  40056. if (parsed.query && !opts.query) {
  40057. opts.query = parsed.query;
  40058. }
  40059. return io.socket(parsed.path, opts);
  40060. }
  40061. /**
  40062. * Protocol version.
  40063. *
  40064. * @api public
  40065. */
  40066. exports.protocol = parser.protocol;
  40067. /**
  40068. * `connect`.
  40069. *
  40070. * @param {String} uri
  40071. * @api public
  40072. */
  40073. exports.connect = lookup;
  40074. /**
  40075. * Expose constructors for standalone build.
  40076. *
  40077. * @api public
  40078. */
  40079. exports.Manager = __webpack_require__(/*! ./manager */ "./node_modules/socket.io-client/lib/manager.js");
  40080. exports.Socket = __webpack_require__(/*! ./socket */ "./node_modules/socket.io-client/lib/socket.js");
  40081. /***/ }),
  40082. /***/ "./node_modules/socket.io-client/lib/manager.js":
  40083. /*!******************************************************!*\
  40084. !*** ./node_modules/socket.io-client/lib/manager.js ***!
  40085. \******************************************************/
  40086. /*! no static exports found */
  40087. /***/ (function(module, exports, __webpack_require__) {
  40088. /**
  40089. * Module dependencies.
  40090. */
  40091. var eio = __webpack_require__(/*! engine.io-client */ "./node_modules/engine.io-client/lib/index.js");
  40092. var Socket = __webpack_require__(/*! ./socket */ "./node_modules/socket.io-client/lib/socket.js");
  40093. var Emitter = __webpack_require__(/*! component-emitter */ "./node_modules/component-emitter/index.js");
  40094. var parser = __webpack_require__(/*! socket.io-parser */ "./node_modules/socket.io-parser/index.js");
  40095. var on = __webpack_require__(/*! ./on */ "./node_modules/socket.io-client/lib/on.js");
  40096. var bind = __webpack_require__(/*! component-bind */ "./node_modules/component-bind/index.js");
  40097. var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")('socket.io-client:manager');
  40098. var indexOf = __webpack_require__(/*! indexof */ "./node_modules/indexof/index.js");
  40099. var Backoff = __webpack_require__(/*! backo2 */ "./node_modules/backo2/index.js");
  40100. /**
  40101. * IE6+ hasOwnProperty
  40102. */
  40103. var has = Object.prototype.hasOwnProperty;
  40104. /**
  40105. * Module exports
  40106. */
  40107. module.exports = Manager;
  40108. /**
  40109. * `Manager` constructor.
  40110. *
  40111. * @param {String} engine instance or engine uri/opts
  40112. * @param {Object} options
  40113. * @api public
  40114. */
  40115. function Manager (uri, opts) {
  40116. if (!(this instanceof Manager)) return new Manager(uri, opts);
  40117. if (uri && ('object' === typeof uri)) {
  40118. opts = uri;
  40119. uri = undefined;
  40120. }
  40121. opts = opts || {};
  40122. opts.path = opts.path || '/socket.io';
  40123. this.nsps = {};
  40124. this.subs = [];
  40125. this.opts = opts;
  40126. this.reconnection(opts.reconnection !== false);
  40127. this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);
  40128. this.reconnectionDelay(opts.reconnectionDelay || 1000);
  40129. this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);
  40130. this.randomizationFactor(opts.randomizationFactor || 0.5);
  40131. this.backoff = new Backoff({
  40132. min: this.reconnectionDelay(),
  40133. max: this.reconnectionDelayMax(),
  40134. jitter: this.randomizationFactor()
  40135. });
  40136. this.timeout(null == opts.timeout ? 20000 : opts.timeout);
  40137. this.readyState = 'closed';
  40138. this.uri = uri;
  40139. this.connecting = [];
  40140. this.lastPing = null;
  40141. this.encoding = false;
  40142. this.packetBuffer = [];
  40143. var _parser = opts.parser || parser;
  40144. this.encoder = new _parser.Encoder();
  40145. this.decoder = new _parser.Decoder();
  40146. this.autoConnect = opts.autoConnect !== false;
  40147. if (this.autoConnect) this.open();
  40148. }
  40149. /**
  40150. * Propagate given event to sockets and emit on `this`
  40151. *
  40152. * @api private
  40153. */
  40154. Manager.prototype.emitAll = function () {
  40155. this.emit.apply(this, arguments);
  40156. for (var nsp in this.nsps) {
  40157. if (has.call(this.nsps, nsp)) {
  40158. this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);
  40159. }
  40160. }
  40161. };
  40162. /**
  40163. * Update `socket.id` of all sockets
  40164. *
  40165. * @api private
  40166. */
  40167. Manager.prototype.updateSocketIds = function () {
  40168. for (var nsp in this.nsps) {
  40169. if (has.call(this.nsps, nsp)) {
  40170. this.nsps[nsp].id = this.generateId(nsp);
  40171. }
  40172. }
  40173. };
  40174. /**
  40175. * generate `socket.id` for the given `nsp`
  40176. *
  40177. * @param {String} nsp
  40178. * @return {String}
  40179. * @api private
  40180. */
  40181. Manager.prototype.generateId = function (nsp) {
  40182. return (nsp === '/' ? '' : (nsp + '#')) + this.engine.id;
  40183. };
  40184. /**
  40185. * Mix in `Emitter`.
  40186. */
  40187. Emitter(Manager.prototype);
  40188. /**
  40189. * Sets the `reconnection` config.
  40190. *
  40191. * @param {Boolean} true/false if it should automatically reconnect
  40192. * @return {Manager} self or value
  40193. * @api public
  40194. */
  40195. Manager.prototype.reconnection = function (v) {
  40196. if (!arguments.length) return this._reconnection;
  40197. this._reconnection = !!v;
  40198. return this;
  40199. };
  40200. /**
  40201. * Sets the reconnection attempts config.
  40202. *
  40203. * @param {Number} max reconnection attempts before giving up
  40204. * @return {Manager} self or value
  40205. * @api public
  40206. */
  40207. Manager.prototype.reconnectionAttempts = function (v) {
  40208. if (!arguments.length) return this._reconnectionAttempts;
  40209. this._reconnectionAttempts = v;
  40210. return this;
  40211. };
  40212. /**
  40213. * Sets the delay between reconnections.
  40214. *
  40215. * @param {Number} delay
  40216. * @return {Manager} self or value
  40217. * @api public
  40218. */
  40219. Manager.prototype.reconnectionDelay = function (v) {
  40220. if (!arguments.length) return this._reconnectionDelay;
  40221. this._reconnectionDelay = v;
  40222. this.backoff && this.backoff.setMin(v);
  40223. return this;
  40224. };
  40225. Manager.prototype.randomizationFactor = function (v) {
  40226. if (!arguments.length) return this._randomizationFactor;
  40227. this._randomizationFactor = v;
  40228. this.backoff && this.backoff.setJitter(v);
  40229. return this;
  40230. };
  40231. /**
  40232. * Sets the maximum delay between reconnections.
  40233. *
  40234. * @param {Number} delay
  40235. * @return {Manager} self or value
  40236. * @api public
  40237. */
  40238. Manager.prototype.reconnectionDelayMax = function (v) {
  40239. if (!arguments.length) return this._reconnectionDelayMax;
  40240. this._reconnectionDelayMax = v;
  40241. this.backoff && this.backoff.setMax(v);
  40242. return this;
  40243. };
  40244. /**
  40245. * Sets the connection timeout. `false` to disable
  40246. *
  40247. * @return {Manager} self or value
  40248. * @api public
  40249. */
  40250. Manager.prototype.timeout = function (v) {
  40251. if (!arguments.length) return this._timeout;
  40252. this._timeout = v;
  40253. return this;
  40254. };
  40255. /**
  40256. * Starts trying to reconnect if reconnection is enabled and we have not
  40257. * started reconnecting yet
  40258. *
  40259. * @api private
  40260. */
  40261. Manager.prototype.maybeReconnectOnOpen = function () {
  40262. // Only try to reconnect if it's the first time we're connecting
  40263. if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) {
  40264. // keeps reconnection from firing twice for the same reconnection loop
  40265. this.reconnect();
  40266. }
  40267. };
  40268. /**
  40269. * Sets the current transport `socket`.
  40270. *
  40271. * @param {Function} optional, callback
  40272. * @return {Manager} self
  40273. * @api public
  40274. */
  40275. Manager.prototype.open =
  40276. Manager.prototype.connect = function (fn, opts) {
  40277. debug('readyState %s', this.readyState);
  40278. if (~this.readyState.indexOf('open')) return this;
  40279. debug('opening %s', this.uri);
  40280. this.engine = eio(this.uri, this.opts);
  40281. var socket = this.engine;
  40282. var self = this;
  40283. this.readyState = 'opening';
  40284. this.skipReconnect = false;
  40285. // emit `open`
  40286. var openSub = on(socket, 'open', function () {
  40287. self.onopen();
  40288. fn && fn();
  40289. });
  40290. // emit `connect_error`
  40291. var errorSub = on(socket, 'error', function (data) {
  40292. debug('connect_error');
  40293. self.cleanup();
  40294. self.readyState = 'closed';
  40295. self.emitAll('connect_error', data);
  40296. if (fn) {
  40297. var err = new Error('Connection error');
  40298. err.data = data;
  40299. fn(err);
  40300. } else {
  40301. // Only do this if there is no fn to handle the error
  40302. self.maybeReconnectOnOpen();
  40303. }
  40304. });
  40305. // emit `connect_timeout`
  40306. if (false !== this._timeout) {
  40307. var timeout = this._timeout;
  40308. debug('connect attempt will timeout after %d', timeout);
  40309. // set timer
  40310. var timer = setTimeout(function () {
  40311. debug('connect attempt timed out after %d', timeout);
  40312. openSub.destroy();
  40313. socket.close();
  40314. socket.emit('error', 'timeout');
  40315. self.emitAll('connect_timeout', timeout);
  40316. }, timeout);
  40317. this.subs.push({
  40318. destroy: function () {
  40319. clearTimeout(timer);
  40320. }
  40321. });
  40322. }
  40323. this.subs.push(openSub);
  40324. this.subs.push(errorSub);
  40325. return this;
  40326. };
  40327. /**
  40328. * Called upon transport open.
  40329. *
  40330. * @api private
  40331. */
  40332. Manager.prototype.onopen = function () {
  40333. debug('open');
  40334. // clear old subs
  40335. this.cleanup();
  40336. // mark as open
  40337. this.readyState = 'open';
  40338. this.emit('open');
  40339. // add new subs
  40340. var socket = this.engine;
  40341. this.subs.push(on(socket, 'data', bind(this, 'ondata')));
  40342. this.subs.push(on(socket, 'ping', bind(this, 'onping')));
  40343. this.subs.push(on(socket, 'pong', bind(this, 'onpong')));
  40344. this.subs.push(on(socket, 'error', bind(this, 'onerror')));
  40345. this.subs.push(on(socket, 'close', bind(this, 'onclose')));
  40346. this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded')));
  40347. };
  40348. /**
  40349. * Called upon a ping.
  40350. *
  40351. * @api private
  40352. */
  40353. Manager.prototype.onping = function () {
  40354. this.lastPing = new Date();
  40355. this.emitAll('ping');
  40356. };
  40357. /**
  40358. * Called upon a packet.
  40359. *
  40360. * @api private
  40361. */
  40362. Manager.prototype.onpong = function () {
  40363. this.emitAll('pong', new Date() - this.lastPing);
  40364. };
  40365. /**
  40366. * Called with data.
  40367. *
  40368. * @api private
  40369. */
  40370. Manager.prototype.ondata = function (data) {
  40371. this.decoder.add(data);
  40372. };
  40373. /**
  40374. * Called when parser fully decodes a packet.
  40375. *
  40376. * @api private
  40377. */
  40378. Manager.prototype.ondecoded = function (packet) {
  40379. this.emit('packet', packet);
  40380. };
  40381. /**
  40382. * Called upon socket error.
  40383. *
  40384. * @api private
  40385. */
  40386. Manager.prototype.onerror = function (err) {
  40387. debug('error', err);
  40388. this.emitAll('error', err);
  40389. };
  40390. /**
  40391. * Creates a new socket for the given `nsp`.
  40392. *
  40393. * @return {Socket}
  40394. * @api public
  40395. */
  40396. Manager.prototype.socket = function (nsp, opts) {
  40397. var socket = this.nsps[nsp];
  40398. if (!socket) {
  40399. socket = new Socket(this, nsp, opts);
  40400. this.nsps[nsp] = socket;
  40401. var self = this;
  40402. socket.on('connecting', onConnecting);
  40403. socket.on('connect', function () {
  40404. socket.id = self.generateId(nsp);
  40405. });
  40406. if (this.autoConnect) {
  40407. // manually call here since connecting event is fired before listening
  40408. onConnecting();
  40409. }
  40410. }
  40411. function onConnecting () {
  40412. if (!~indexOf(self.connecting, socket)) {
  40413. self.connecting.push(socket);
  40414. }
  40415. }
  40416. return socket;
  40417. };
  40418. /**
  40419. * Called upon a socket close.
  40420. *
  40421. * @param {Socket} socket
  40422. */
  40423. Manager.prototype.destroy = function (socket) {
  40424. var index = indexOf(this.connecting, socket);
  40425. if (~index) this.connecting.splice(index, 1);
  40426. if (this.connecting.length) return;
  40427. this.close();
  40428. };
  40429. /**
  40430. * Writes a packet.
  40431. *
  40432. * @param {Object} packet
  40433. * @api private
  40434. */
  40435. Manager.prototype.packet = function (packet) {
  40436. debug('writing packet %j', packet);
  40437. var self = this;
  40438. if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query;
  40439. if (!self.encoding) {
  40440. // encode, then write to engine with result
  40441. self.encoding = true;
  40442. this.encoder.encode(packet, function (encodedPackets) {
  40443. for (var i = 0; i < encodedPackets.length; i++) {
  40444. self.engine.write(encodedPackets[i], packet.options);
  40445. }
  40446. self.encoding = false;
  40447. self.processPacketQueue();
  40448. });
  40449. } else { // add packet to the queue
  40450. self.packetBuffer.push(packet);
  40451. }
  40452. };
  40453. /**
  40454. * If packet buffer is non-empty, begins encoding the
  40455. * next packet in line.
  40456. *
  40457. * @api private
  40458. */
  40459. Manager.prototype.processPacketQueue = function () {
  40460. if (this.packetBuffer.length > 0 && !this.encoding) {
  40461. var pack = this.packetBuffer.shift();
  40462. this.packet(pack);
  40463. }
  40464. };
  40465. /**
  40466. * Clean up transport subscriptions and packet buffer.
  40467. *
  40468. * @api private
  40469. */
  40470. Manager.prototype.cleanup = function () {
  40471. debug('cleanup');
  40472. var subsLength = this.subs.length;
  40473. for (var i = 0; i < subsLength; i++) {
  40474. var sub = this.subs.shift();
  40475. sub.destroy();
  40476. }
  40477. this.packetBuffer = [];
  40478. this.encoding = false;
  40479. this.lastPing = null;
  40480. this.decoder.destroy();
  40481. };
  40482. /**
  40483. * Close the current socket.
  40484. *
  40485. * @api private
  40486. */
  40487. Manager.prototype.close =
  40488. Manager.prototype.disconnect = function () {
  40489. debug('disconnect');
  40490. this.skipReconnect = true;
  40491. this.reconnecting = false;
  40492. if ('opening' === this.readyState) {
  40493. // `onclose` will not fire because
  40494. // an open event never happened
  40495. this.cleanup();
  40496. }
  40497. this.backoff.reset();
  40498. this.readyState = 'closed';
  40499. if (this.engine) this.engine.close();
  40500. };
  40501. /**
  40502. * Called upon engine close.
  40503. *
  40504. * @api private
  40505. */
  40506. Manager.prototype.onclose = function (reason) {
  40507. debug('onclose');
  40508. this.cleanup();
  40509. this.backoff.reset();
  40510. this.readyState = 'closed';
  40511. this.emit('close', reason);
  40512. if (this._reconnection && !this.skipReconnect) {
  40513. this.reconnect();
  40514. }
  40515. };
  40516. /**
  40517. * Attempt a reconnection.
  40518. *
  40519. * @api private
  40520. */
  40521. Manager.prototype.reconnect = function () {
  40522. if (this.reconnecting || this.skipReconnect) return this;
  40523. var self = this;
  40524. if (this.backoff.attempts >= this._reconnectionAttempts) {
  40525. debug('reconnect failed');
  40526. this.backoff.reset();
  40527. this.emitAll('reconnect_failed');
  40528. this.reconnecting = false;
  40529. } else {
  40530. var delay = this.backoff.duration();
  40531. debug('will wait %dms before reconnect attempt', delay);
  40532. this.reconnecting = true;
  40533. var timer = setTimeout(function () {
  40534. if (self.skipReconnect) return;
  40535. debug('attempting reconnect');
  40536. self.emitAll('reconnect_attempt', self.backoff.attempts);
  40537. self.emitAll('reconnecting', self.backoff.attempts);
  40538. // check again for the case socket closed in above events
  40539. if (self.skipReconnect) return;
  40540. self.open(function (err) {
  40541. if (err) {
  40542. debug('reconnect attempt error');
  40543. self.reconnecting = false;
  40544. self.reconnect();
  40545. self.emitAll('reconnect_error', err.data);
  40546. } else {
  40547. debug('reconnect success');
  40548. self.onreconnect();
  40549. }
  40550. });
  40551. }, delay);
  40552. this.subs.push({
  40553. destroy: function () {
  40554. clearTimeout(timer);
  40555. }
  40556. });
  40557. }
  40558. };
  40559. /**
  40560. * Called upon successful reconnect.
  40561. *
  40562. * @api private
  40563. */
  40564. Manager.prototype.onreconnect = function () {
  40565. var attempt = this.backoff.attempts;
  40566. this.reconnecting = false;
  40567. this.backoff.reset();
  40568. this.updateSocketIds();
  40569. this.emitAll('reconnect', attempt);
  40570. };
  40571. /***/ }),
  40572. /***/ "./node_modules/socket.io-client/lib/on.js":
  40573. /*!*************************************************!*\
  40574. !*** ./node_modules/socket.io-client/lib/on.js ***!
  40575. \*************************************************/
  40576. /*! no static exports found */
  40577. /***/ (function(module, exports) {
  40578. /**
  40579. * Module exports.
  40580. */
  40581. module.exports = on;
  40582. /**
  40583. * Helper for subscriptions.
  40584. *
  40585. * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`
  40586. * @param {String} event name
  40587. * @param {Function} callback
  40588. * @api public
  40589. */
  40590. function on (obj, ev, fn) {
  40591. obj.on(ev, fn);
  40592. return {
  40593. destroy: function () {
  40594. obj.removeListener(ev, fn);
  40595. }
  40596. };
  40597. }
  40598. /***/ }),
  40599. /***/ "./node_modules/socket.io-client/lib/socket.js":
  40600. /*!*****************************************************!*\
  40601. !*** ./node_modules/socket.io-client/lib/socket.js ***!
  40602. \*****************************************************/
  40603. /*! no static exports found */
  40604. /***/ (function(module, exports, __webpack_require__) {
  40605. /**
  40606. * Module dependencies.
  40607. */
  40608. var parser = __webpack_require__(/*! socket.io-parser */ "./node_modules/socket.io-parser/index.js");
  40609. var Emitter = __webpack_require__(/*! component-emitter */ "./node_modules/component-emitter/index.js");
  40610. var toArray = __webpack_require__(/*! to-array */ "./node_modules/to-array/index.js");
  40611. var on = __webpack_require__(/*! ./on */ "./node_modules/socket.io-client/lib/on.js");
  40612. var bind = __webpack_require__(/*! component-bind */ "./node_modules/component-bind/index.js");
  40613. var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")('socket.io-client:socket');
  40614. var parseqs = __webpack_require__(/*! parseqs */ "./node_modules/parseqs/index.js");
  40615. var hasBin = __webpack_require__(/*! has-binary2 */ "./node_modules/has-binary2/index.js");
  40616. /**
  40617. * Module exports.
  40618. */
  40619. module.exports = exports = Socket;
  40620. /**
  40621. * Internal events (blacklisted).
  40622. * These events can't be emitted by the user.
  40623. *
  40624. * @api private
  40625. */
  40626. var events = {
  40627. connect: 1,
  40628. connect_error: 1,
  40629. connect_timeout: 1,
  40630. connecting: 1,
  40631. disconnect: 1,
  40632. error: 1,
  40633. reconnect: 1,
  40634. reconnect_attempt: 1,
  40635. reconnect_failed: 1,
  40636. reconnect_error: 1,
  40637. reconnecting: 1,
  40638. ping: 1,
  40639. pong: 1
  40640. };
  40641. /**
  40642. * Shortcut to `Emitter#emit`.
  40643. */
  40644. var emit = Emitter.prototype.emit;
  40645. /**
  40646. * `Socket` constructor.
  40647. *
  40648. * @api public
  40649. */
  40650. function Socket (io, nsp, opts) {
  40651. this.io = io;
  40652. this.nsp = nsp;
  40653. this.json = this; // compat
  40654. this.ids = 0;
  40655. this.acks = {};
  40656. this.receiveBuffer = [];
  40657. this.sendBuffer = [];
  40658. this.connected = false;
  40659. this.disconnected = true;
  40660. this.flags = {};
  40661. if (opts && opts.query) {
  40662. this.query = opts.query;
  40663. }
  40664. if (this.io.autoConnect) this.open();
  40665. }
  40666. /**
  40667. * Mix in `Emitter`.
  40668. */
  40669. Emitter(Socket.prototype);
  40670. /**
  40671. * Subscribe to open, close and packet events
  40672. *
  40673. * @api private
  40674. */
  40675. Socket.prototype.subEvents = function () {
  40676. if (this.subs) return;
  40677. var io = this.io;
  40678. this.subs = [
  40679. on(io, 'open', bind(this, 'onopen')),
  40680. on(io, 'packet', bind(this, 'onpacket')),
  40681. on(io, 'close', bind(this, 'onclose'))
  40682. ];
  40683. };
  40684. /**
  40685. * "Opens" the socket.
  40686. *
  40687. * @api public
  40688. */
  40689. Socket.prototype.open =
  40690. Socket.prototype.connect = function () {
  40691. if (this.connected) return this;
  40692. this.subEvents();
  40693. this.io.open(); // ensure open
  40694. if ('open' === this.io.readyState) this.onopen();
  40695. this.emit('connecting');
  40696. return this;
  40697. };
  40698. /**
  40699. * Sends a `message` event.
  40700. *
  40701. * @return {Socket} self
  40702. * @api public
  40703. */
  40704. Socket.prototype.send = function () {
  40705. var args = toArray(arguments);
  40706. args.unshift('message');
  40707. this.emit.apply(this, args);
  40708. return this;
  40709. };
  40710. /**
  40711. * Override `emit`.
  40712. * If the event is in `events`, it's emitted normally.
  40713. *
  40714. * @param {String} event name
  40715. * @return {Socket} self
  40716. * @api public
  40717. */
  40718. Socket.prototype.emit = function (ev) {
  40719. if (events.hasOwnProperty(ev)) {
  40720. emit.apply(this, arguments);
  40721. return this;
  40722. }
  40723. var args = toArray(arguments);
  40724. var packet = {
  40725. type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) ? parser.BINARY_EVENT : parser.EVENT,
  40726. data: args
  40727. };
  40728. packet.options = {};
  40729. packet.options.compress = !this.flags || false !== this.flags.compress;
  40730. // event ack callback
  40731. if ('function' === typeof args[args.length - 1]) {
  40732. debug('emitting packet with ack id %d', this.ids);
  40733. this.acks[this.ids] = args.pop();
  40734. packet.id = this.ids++;
  40735. }
  40736. if (this.connected) {
  40737. this.packet(packet);
  40738. } else {
  40739. this.sendBuffer.push(packet);
  40740. }
  40741. this.flags = {};
  40742. return this;
  40743. };
  40744. /**
  40745. * Sends a packet.
  40746. *
  40747. * @param {Object} packet
  40748. * @api private
  40749. */
  40750. Socket.prototype.packet = function (packet) {
  40751. packet.nsp = this.nsp;
  40752. this.io.packet(packet);
  40753. };
  40754. /**
  40755. * Called upon engine `open`.
  40756. *
  40757. * @api private
  40758. */
  40759. Socket.prototype.onopen = function () {
  40760. debug('transport is open - connecting');
  40761. // write connect packet if necessary
  40762. if ('/' !== this.nsp) {
  40763. if (this.query) {
  40764. var query = typeof this.query === 'object' ? parseqs.encode(this.query) : this.query;
  40765. debug('sending connect packet with query %s', query);
  40766. this.packet({type: parser.CONNECT, query: query});
  40767. } else {
  40768. this.packet({type: parser.CONNECT});
  40769. }
  40770. }
  40771. };
  40772. /**
  40773. * Called upon engine `close`.
  40774. *
  40775. * @param {String} reason
  40776. * @api private
  40777. */
  40778. Socket.prototype.onclose = function (reason) {
  40779. debug('close (%s)', reason);
  40780. this.connected = false;
  40781. this.disconnected = true;
  40782. delete this.id;
  40783. this.emit('disconnect', reason);
  40784. };
  40785. /**
  40786. * Called with socket packet.
  40787. *
  40788. * @param {Object} packet
  40789. * @api private
  40790. */
  40791. Socket.prototype.onpacket = function (packet) {
  40792. var sameNamespace = packet.nsp === this.nsp;
  40793. var rootNamespaceError = packet.type === parser.ERROR && packet.nsp === '/';
  40794. if (!sameNamespace && !rootNamespaceError) return;
  40795. switch (packet.type) {
  40796. case parser.CONNECT:
  40797. this.onconnect();
  40798. break;
  40799. case parser.EVENT:
  40800. this.onevent(packet);
  40801. break;
  40802. case parser.BINARY_EVENT:
  40803. this.onevent(packet);
  40804. break;
  40805. case parser.ACK:
  40806. this.onack(packet);
  40807. break;
  40808. case parser.BINARY_ACK:
  40809. this.onack(packet);
  40810. break;
  40811. case parser.DISCONNECT:
  40812. this.ondisconnect();
  40813. break;
  40814. case parser.ERROR:
  40815. this.emit('error', packet.data);
  40816. break;
  40817. }
  40818. };
  40819. /**
  40820. * Called upon a server event.
  40821. *
  40822. * @param {Object} packet
  40823. * @api private
  40824. */
  40825. Socket.prototype.onevent = function (packet) {
  40826. var args = packet.data || [];
  40827. debug('emitting event %j', args);
  40828. if (null != packet.id) {
  40829. debug('attaching ack callback to event');
  40830. args.push(this.ack(packet.id));
  40831. }
  40832. if (this.connected) {
  40833. emit.apply(this, args);
  40834. } else {
  40835. this.receiveBuffer.push(args);
  40836. }
  40837. };
  40838. /**
  40839. * Produces an ack callback to emit with an event.
  40840. *
  40841. * @api private
  40842. */
  40843. Socket.prototype.ack = function (id) {
  40844. var self = this;
  40845. var sent = false;
  40846. return function () {
  40847. // prevent double callbacks
  40848. if (sent) return;
  40849. sent = true;
  40850. var args = toArray(arguments);
  40851. debug('sending ack %j', args);
  40852. self.packet({
  40853. type: hasBin(args) ? parser.BINARY_ACK : parser.ACK,
  40854. id: id,
  40855. data: args
  40856. });
  40857. };
  40858. };
  40859. /**
  40860. * Called upon a server acknowlegement.
  40861. *
  40862. * @param {Object} packet
  40863. * @api private
  40864. */
  40865. Socket.prototype.onack = function (packet) {
  40866. var ack = this.acks[packet.id];
  40867. if ('function' === typeof ack) {
  40868. debug('calling ack %s with %j', packet.id, packet.data);
  40869. ack.apply(this, packet.data);
  40870. delete this.acks[packet.id];
  40871. } else {
  40872. debug('bad ack %s', packet.id);
  40873. }
  40874. };
  40875. /**
  40876. * Called upon server connect.
  40877. *
  40878. * @api private
  40879. */
  40880. Socket.prototype.onconnect = function () {
  40881. this.connected = true;
  40882. this.disconnected = false;
  40883. this.emit('connect');
  40884. this.emitBuffered();
  40885. };
  40886. /**
  40887. * Emit buffered events (received and emitted).
  40888. *
  40889. * @api private
  40890. */
  40891. Socket.prototype.emitBuffered = function () {
  40892. var i;
  40893. for (i = 0; i < this.receiveBuffer.length; i++) {
  40894. emit.apply(this, this.receiveBuffer[i]);
  40895. }
  40896. this.receiveBuffer = [];
  40897. for (i = 0; i < this.sendBuffer.length; i++) {
  40898. this.packet(this.sendBuffer[i]);
  40899. }
  40900. this.sendBuffer = [];
  40901. };
  40902. /**
  40903. * Called upon server disconnect.
  40904. *
  40905. * @api private
  40906. */
  40907. Socket.prototype.ondisconnect = function () {
  40908. debug('server disconnect (%s)', this.nsp);
  40909. this.destroy();
  40910. this.onclose('io server disconnect');
  40911. };
  40912. /**
  40913. * Called upon forced client/server side disconnections,
  40914. * this method ensures the manager stops tracking us and
  40915. * that reconnections don't get triggered for this.
  40916. *
  40917. * @api private.
  40918. */
  40919. Socket.prototype.destroy = function () {
  40920. if (this.subs) {
  40921. // clean subscriptions to avoid reconnections
  40922. for (var i = 0; i < this.subs.length; i++) {
  40923. this.subs[i].destroy();
  40924. }
  40925. this.subs = null;
  40926. }
  40927. this.io.destroy(this);
  40928. };
  40929. /**
  40930. * Disconnects the socket manually.
  40931. *
  40932. * @return {Socket} self
  40933. * @api public
  40934. */
  40935. Socket.prototype.close =
  40936. Socket.prototype.disconnect = function () {
  40937. if (this.connected) {
  40938. debug('performing disconnect (%s)', this.nsp);
  40939. this.packet({ type: parser.DISCONNECT });
  40940. }
  40941. // remove socket from pool
  40942. this.destroy();
  40943. if (this.connected) {
  40944. // fire events
  40945. this.onclose('io client disconnect');
  40946. }
  40947. return this;
  40948. };
  40949. /**
  40950. * Sets the compress flag.
  40951. *
  40952. * @param {Boolean} if `true`, compresses the sending data
  40953. * @return {Socket} self
  40954. * @api public
  40955. */
  40956. Socket.prototype.compress = function (compress) {
  40957. this.flags.compress = compress;
  40958. return this;
  40959. };
  40960. /**
  40961. * Sets the binary flag
  40962. *
  40963. * @param {Boolean} whether the emitted data contains binary
  40964. * @return {Socket} self
  40965. * @api public
  40966. */
  40967. Socket.prototype.binary = function (binary) {
  40968. this.flags.binary = binary;
  40969. return this;
  40970. };
  40971. /***/ }),
  40972. /***/ "./node_modules/socket.io-client/lib/url.js":
  40973. /*!**************************************************!*\
  40974. !*** ./node_modules/socket.io-client/lib/url.js ***!
  40975. \**************************************************/
  40976. /*! no static exports found */
  40977. /***/ (function(module, exports, __webpack_require__) {
  40978. /**
  40979. * Module dependencies.
  40980. */
  40981. var parseuri = __webpack_require__(/*! parseuri */ "./node_modules/parseuri/index.js");
  40982. var debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js")('socket.io-client:url');
  40983. /**
  40984. * Module exports.
  40985. */
  40986. module.exports = url;
  40987. /**
  40988. * URL parser.
  40989. *
  40990. * @param {String} url
  40991. * @param {Object} An object meant to mimic window.location.
  40992. * Defaults to window.location.
  40993. * @api public
  40994. */
  40995. function url (uri, loc) {
  40996. var obj = uri;
  40997. // default to window.location
  40998. loc = loc || (typeof location !== 'undefined' && location);
  40999. if (null == uri) uri = loc.protocol + '//' + loc.host;
  41000. // relative path support
  41001. if ('string' === typeof uri) {
  41002. if ('/' === uri.charAt(0)) {
  41003. if ('/' === uri.charAt(1)) {
  41004. uri = loc.protocol + uri;
  41005. } else {
  41006. uri = loc.host + uri;
  41007. }
  41008. }
  41009. if (!/^(https?|wss?):\/\//.test(uri)) {
  41010. debug('protocol-less url %s', uri);
  41011. if ('undefined' !== typeof loc) {
  41012. uri = loc.protocol + '//' + uri;
  41013. } else {
  41014. uri = 'https://' + uri;
  41015. }
  41016. }
  41017. // parse
  41018. debug('parse %s', uri);
  41019. obj = parseuri(uri);
  41020. }
  41021. // make sure we treat `localhost:80` and `localhost` equally
  41022. if (!obj.port) {
  41023. if (/^(http|ws)$/.test(obj.protocol)) {
  41024. obj.port = '80';
  41025. } else if (/^(http|ws)s$/.test(obj.protocol)) {
  41026. obj.port = '443';
  41027. }
  41028. }
  41029. obj.path = obj.path || '/';
  41030. var ipv6 = obj.host.indexOf(':') !== -1;
  41031. var host = ipv6 ? '[' + obj.host + ']' : obj.host;
  41032. // define unique id
  41033. obj.id = obj.protocol + '://' + host + ':' + obj.port;
  41034. // define href
  41035. obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : (':' + obj.port));
  41036. return obj;
  41037. }
  41038. /***/ }),
  41039. /***/ "./node_modules/socket.io-parser/binary.js":
  41040. /*!*************************************************!*\
  41041. !*** ./node_modules/socket.io-parser/binary.js ***!
  41042. \*************************************************/
  41043. /*! no static exports found */
  41044. /***/ (function(module, exports, __webpack_require__) {
  41045. /*global Blob,File*/
  41046. /**
  41047. * Module requirements
  41048. */
  41049. var isArray = __webpack_require__(/*! isarray */ "./node_modules/socket.io-parser/node_modules/isarray/index.js");
  41050. var isBuf = __webpack_require__(/*! ./is-buffer */ "./node_modules/socket.io-parser/is-buffer.js");
  41051. var toString = Object.prototype.toString;
  41052. var withNativeBlob = typeof Blob === 'function' || (typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]');
  41053. var withNativeFile = typeof File === 'function' || (typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]');
  41054. /**
  41055. * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder.
  41056. * Anything with blobs or files should be fed through removeBlobs before coming
  41057. * here.
  41058. *
  41059. * @param {Object} packet - socket.io event packet
  41060. * @return {Object} with deconstructed packet and list of buffers
  41061. * @api public
  41062. */
  41063. exports.deconstructPacket = function(packet) {
  41064. var buffers = [];
  41065. var packetData = packet.data;
  41066. var pack = packet;
  41067. pack.data = _deconstructPacket(packetData, buffers);
  41068. pack.attachments = buffers.length; // number of binary 'attachments'
  41069. return {packet: pack, buffers: buffers};
  41070. };
  41071. function _deconstructPacket(data, buffers) {
  41072. if (!data) return data;
  41073. if (isBuf(data)) {
  41074. var placeholder = { _placeholder: true, num: buffers.length };
  41075. buffers.push(data);
  41076. return placeholder;
  41077. } else if (isArray(data)) {
  41078. var newData = new Array(data.length);
  41079. for (var i = 0; i < data.length; i++) {
  41080. newData[i] = _deconstructPacket(data[i], buffers);
  41081. }
  41082. return newData;
  41083. } else if (typeof data === 'object' && !(data instanceof Date)) {
  41084. var newData = {};
  41085. for (var key in data) {
  41086. newData[key] = _deconstructPacket(data[key], buffers);
  41087. }
  41088. return newData;
  41089. }
  41090. return data;
  41091. }
  41092. /**
  41093. * Reconstructs a binary packet from its placeholder packet and buffers
  41094. *
  41095. * @param {Object} packet - event packet with placeholders
  41096. * @param {Array} buffers - binary buffers to put in placeholder positions
  41097. * @return {Object} reconstructed packet
  41098. * @api public
  41099. */
  41100. exports.reconstructPacket = function(packet, buffers) {
  41101. packet.data = _reconstructPacket(packet.data, buffers);
  41102. packet.attachments = undefined; // no longer useful
  41103. return packet;
  41104. };
  41105. function _reconstructPacket(data, buffers) {
  41106. if (!data) return data;
  41107. if (data && data._placeholder) {
  41108. return buffers[data.num]; // appropriate buffer (should be natural order anyway)
  41109. } else if (isArray(data)) {
  41110. for (var i = 0; i < data.length; i++) {
  41111. data[i] = _reconstructPacket(data[i], buffers);
  41112. }
  41113. } else if (typeof data === 'object') {
  41114. for (var key in data) {
  41115. data[key] = _reconstructPacket(data[key], buffers);
  41116. }
  41117. }
  41118. return data;
  41119. }
  41120. /**
  41121. * Asynchronously removes Blobs or Files from data via
  41122. * FileReader's readAsArrayBuffer method. Used before encoding
  41123. * data as msgpack. Calls callback with the blobless data.
  41124. *
  41125. * @param {Object} data
  41126. * @param {Function} callback
  41127. * @api private
  41128. */
  41129. exports.removeBlobs = function(data, callback) {
  41130. function _removeBlobs(obj, curKey, containingObject) {
  41131. if (!obj) return obj;
  41132. // convert any blob
  41133. if ((withNativeBlob && obj instanceof Blob) ||
  41134. (withNativeFile && obj instanceof File)) {
  41135. pendingBlobs++;
  41136. // async filereader
  41137. var fileReader = new FileReader();
  41138. fileReader.onload = function() { // this.result == arraybuffer
  41139. if (containingObject) {
  41140. containingObject[curKey] = this.result;
  41141. }
  41142. else {
  41143. bloblessData = this.result;
  41144. }
  41145. // if nothing pending its callback time
  41146. if(! --pendingBlobs) {
  41147. callback(bloblessData);
  41148. }
  41149. };
  41150. fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer
  41151. } else if (isArray(obj)) { // handle array
  41152. for (var i = 0; i < obj.length; i++) {
  41153. _removeBlobs(obj[i], i, obj);
  41154. }
  41155. } else if (typeof obj === 'object' && !isBuf(obj)) { // and object
  41156. for (var key in obj) {
  41157. _removeBlobs(obj[key], key, obj);
  41158. }
  41159. }
  41160. }
  41161. var pendingBlobs = 0;
  41162. var bloblessData = data;
  41163. _removeBlobs(bloblessData);
  41164. if (!pendingBlobs) {
  41165. callback(bloblessData);
  41166. }
  41167. };
  41168. /***/ }),
  41169. /***/ "./node_modules/socket.io-parser/index.js":
  41170. /*!************************************************!*\
  41171. !*** ./node_modules/socket.io-parser/index.js ***!
  41172. \************************************************/
  41173. /*! no static exports found */
  41174. /***/ (function(module, exports, __webpack_require__) {
  41175. /**
  41176. * Module dependencies.
  41177. */
  41178. var debug = __webpack_require__(/*! debug */ "./node_modules/socket.io-parser/node_modules/debug/src/browser.js")('socket.io-parser');
  41179. var Emitter = __webpack_require__(/*! component-emitter */ "./node_modules/component-emitter/index.js");
  41180. var binary = __webpack_require__(/*! ./binary */ "./node_modules/socket.io-parser/binary.js");
  41181. var isArray = __webpack_require__(/*! isarray */ "./node_modules/socket.io-parser/node_modules/isarray/index.js");
  41182. var isBuf = __webpack_require__(/*! ./is-buffer */ "./node_modules/socket.io-parser/is-buffer.js");
  41183. /**
  41184. * Protocol version.
  41185. *
  41186. * @api public
  41187. */
  41188. exports.protocol = 4;
  41189. /**
  41190. * Packet types.
  41191. *
  41192. * @api public
  41193. */
  41194. exports.types = [
  41195. 'CONNECT',
  41196. 'DISCONNECT',
  41197. 'EVENT',
  41198. 'ACK',
  41199. 'ERROR',
  41200. 'BINARY_EVENT',
  41201. 'BINARY_ACK'
  41202. ];
  41203. /**
  41204. * Packet type `connect`.
  41205. *
  41206. * @api public
  41207. */
  41208. exports.CONNECT = 0;
  41209. /**
  41210. * Packet type `disconnect`.
  41211. *
  41212. * @api public
  41213. */
  41214. exports.DISCONNECT = 1;
  41215. /**
  41216. * Packet type `event`.
  41217. *
  41218. * @api public
  41219. */
  41220. exports.EVENT = 2;
  41221. /**
  41222. * Packet type `ack`.
  41223. *
  41224. * @api public
  41225. */
  41226. exports.ACK = 3;
  41227. /**
  41228. * Packet type `error`.
  41229. *
  41230. * @api public
  41231. */
  41232. exports.ERROR = 4;
  41233. /**
  41234. * Packet type 'binary event'
  41235. *
  41236. * @api public
  41237. */
  41238. exports.BINARY_EVENT = 5;
  41239. /**
  41240. * Packet type `binary ack`. For acks with binary arguments.
  41241. *
  41242. * @api public
  41243. */
  41244. exports.BINARY_ACK = 6;
  41245. /**
  41246. * Encoder constructor.
  41247. *
  41248. * @api public
  41249. */
  41250. exports.Encoder = Encoder;
  41251. /**
  41252. * Decoder constructor.
  41253. *
  41254. * @api public
  41255. */
  41256. exports.Decoder = Decoder;
  41257. /**
  41258. * A socket.io Encoder instance
  41259. *
  41260. * @api public
  41261. */
  41262. function Encoder() {}
  41263. var ERROR_PACKET = exports.ERROR + '"encode error"';
  41264. /**
  41265. * Encode a packet as a single string if non-binary, or as a
  41266. * buffer sequence, depending on packet type.
  41267. *
  41268. * @param {Object} obj - packet object
  41269. * @param {Function} callback - function to handle encodings (likely engine.write)
  41270. * @return Calls callback with Array of encodings
  41271. * @api public
  41272. */
  41273. Encoder.prototype.encode = function(obj, callback){
  41274. debug('encoding packet %j', obj);
  41275. if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {
  41276. encodeAsBinary(obj, callback);
  41277. } else {
  41278. var encoding = encodeAsString(obj);
  41279. callback([encoding]);
  41280. }
  41281. };
  41282. /**
  41283. * Encode packet as string.
  41284. *
  41285. * @param {Object} packet
  41286. * @return {String} encoded
  41287. * @api private
  41288. */
  41289. function encodeAsString(obj) {
  41290. // first is type
  41291. var str = '' + obj.type;
  41292. // attachments if we have them
  41293. if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {
  41294. str += obj.attachments + '-';
  41295. }
  41296. // if we have a namespace other than `/`
  41297. // we append it followed by a comma `,`
  41298. if (obj.nsp && '/' !== obj.nsp) {
  41299. str += obj.nsp + ',';
  41300. }
  41301. // immediately followed by the id
  41302. if (null != obj.id) {
  41303. str += obj.id;
  41304. }
  41305. // json data
  41306. if (null != obj.data) {
  41307. var payload = tryStringify(obj.data);
  41308. if (payload !== false) {
  41309. str += payload;
  41310. } else {
  41311. return ERROR_PACKET;
  41312. }
  41313. }
  41314. debug('encoded %j as %s', obj, str);
  41315. return str;
  41316. }
  41317. function tryStringify(str) {
  41318. try {
  41319. return JSON.stringify(str);
  41320. } catch(e){
  41321. return false;
  41322. }
  41323. }
  41324. /**
  41325. * Encode packet as 'buffer sequence' by removing blobs, and
  41326. * deconstructing packet into object with placeholders and
  41327. * a list of buffers.
  41328. *
  41329. * @param {Object} packet
  41330. * @return {Buffer} encoded
  41331. * @api private
  41332. */
  41333. function encodeAsBinary(obj, callback) {
  41334. function writeEncoding(bloblessData) {
  41335. var deconstruction = binary.deconstructPacket(bloblessData);
  41336. var pack = encodeAsString(deconstruction.packet);
  41337. var buffers = deconstruction.buffers;
  41338. buffers.unshift(pack); // add packet info to beginning of data list
  41339. callback(buffers); // write all the buffers
  41340. }
  41341. binary.removeBlobs(obj, writeEncoding);
  41342. }
  41343. /**
  41344. * A socket.io Decoder instance
  41345. *
  41346. * @return {Object} decoder
  41347. * @api public
  41348. */
  41349. function Decoder() {
  41350. this.reconstructor = null;
  41351. }
  41352. /**
  41353. * Mix in `Emitter` with Decoder.
  41354. */
  41355. Emitter(Decoder.prototype);
  41356. /**
  41357. * Decodes an encoded packet string into packet JSON.
  41358. *
  41359. * @param {String} obj - encoded packet
  41360. * @return {Object} packet
  41361. * @api public
  41362. */
  41363. Decoder.prototype.add = function(obj) {
  41364. var packet;
  41365. if (typeof obj === 'string') {
  41366. packet = decodeString(obj);
  41367. if (exports.BINARY_EVENT === packet.type || exports.BINARY_ACK === packet.type) { // binary packet's json
  41368. this.reconstructor = new BinaryReconstructor(packet);
  41369. // no attachments, labeled binary but no binary data to follow
  41370. if (this.reconstructor.reconPack.attachments === 0) {
  41371. this.emit('decoded', packet);
  41372. }
  41373. } else { // non-binary full packet
  41374. this.emit('decoded', packet);
  41375. }
  41376. } else if (isBuf(obj) || obj.base64) { // raw binary data
  41377. if (!this.reconstructor) {
  41378. throw new Error('got binary data when not reconstructing a packet');
  41379. } else {
  41380. packet = this.reconstructor.takeBinaryData(obj);
  41381. if (packet) { // received final buffer
  41382. this.reconstructor = null;
  41383. this.emit('decoded', packet);
  41384. }
  41385. }
  41386. } else {
  41387. throw new Error('Unknown type: ' + obj);
  41388. }
  41389. };
  41390. /**
  41391. * Decode a packet String (JSON data)
  41392. *
  41393. * @param {String} str
  41394. * @return {Object} packet
  41395. * @api private
  41396. */
  41397. function decodeString(str) {
  41398. var i = 0;
  41399. // look up type
  41400. var p = {
  41401. type: Number(str.charAt(0))
  41402. };
  41403. if (null == exports.types[p.type]) {
  41404. return error('unknown packet type ' + p.type);
  41405. }
  41406. // look up attachments if type binary
  41407. if (exports.BINARY_EVENT === p.type || exports.BINARY_ACK === p.type) {
  41408. var buf = '';
  41409. while (str.charAt(++i) !== '-') {
  41410. buf += str.charAt(i);
  41411. if (i == str.length) break;
  41412. }
  41413. if (buf != Number(buf) || str.charAt(i) !== '-') {
  41414. throw new Error('Illegal attachments');
  41415. }
  41416. p.attachments = Number(buf);
  41417. }
  41418. // look up namespace (if any)
  41419. if ('/' === str.charAt(i + 1)) {
  41420. p.nsp = '';
  41421. while (++i) {
  41422. var c = str.charAt(i);
  41423. if (',' === c) break;
  41424. p.nsp += c;
  41425. if (i === str.length) break;
  41426. }
  41427. } else {
  41428. p.nsp = '/';
  41429. }
  41430. // look up id
  41431. var next = str.charAt(i + 1);
  41432. if ('' !== next && Number(next) == next) {
  41433. p.id = '';
  41434. while (++i) {
  41435. var c = str.charAt(i);
  41436. if (null == c || Number(c) != c) {
  41437. --i;
  41438. break;
  41439. }
  41440. p.id += str.charAt(i);
  41441. if (i === str.length) break;
  41442. }
  41443. p.id = Number(p.id);
  41444. }
  41445. // look up json data
  41446. if (str.charAt(++i)) {
  41447. var payload = tryParse(str.substr(i));
  41448. var isPayloadValid = payload !== false && (p.type === exports.ERROR || isArray(payload));
  41449. if (isPayloadValid) {
  41450. p.data = payload;
  41451. } else {
  41452. return error('invalid payload');
  41453. }
  41454. }
  41455. debug('decoded %s as %j', str, p);
  41456. return p;
  41457. }
  41458. function tryParse(str) {
  41459. try {
  41460. return JSON.parse(str);
  41461. } catch(e){
  41462. return false;
  41463. }
  41464. }
  41465. /**
  41466. * Deallocates a parser's resources
  41467. *
  41468. * @api public
  41469. */
  41470. Decoder.prototype.destroy = function() {
  41471. if (this.reconstructor) {
  41472. this.reconstructor.finishedReconstruction();
  41473. }
  41474. };
  41475. /**
  41476. * A manager of a binary event's 'buffer sequence'. Should
  41477. * be constructed whenever a packet of type BINARY_EVENT is
  41478. * decoded.
  41479. *
  41480. * @param {Object} packet
  41481. * @return {BinaryReconstructor} initialized reconstructor
  41482. * @api private
  41483. */
  41484. function BinaryReconstructor(packet) {
  41485. this.reconPack = packet;
  41486. this.buffers = [];
  41487. }
  41488. /**
  41489. * Method to be called when binary data received from connection
  41490. * after a BINARY_EVENT packet.
  41491. *
  41492. * @param {Buffer | ArrayBuffer} binData - the raw binary data received
  41493. * @return {null | Object} returns null if more binary data is expected or
  41494. * a reconstructed packet object if all buffers have been received.
  41495. * @api private
  41496. */
  41497. BinaryReconstructor.prototype.takeBinaryData = function(binData) {
  41498. this.buffers.push(binData);
  41499. if (this.buffers.length === this.reconPack.attachments) { // done with buffer list
  41500. var packet = binary.reconstructPacket(this.reconPack, this.buffers);
  41501. this.finishedReconstruction();
  41502. return packet;
  41503. }
  41504. return null;
  41505. };
  41506. /**
  41507. * Cleans up binary packet reconstruction variables.
  41508. *
  41509. * @api private
  41510. */
  41511. BinaryReconstructor.prototype.finishedReconstruction = function() {
  41512. this.reconPack = null;
  41513. this.buffers = [];
  41514. };
  41515. function error(msg) {
  41516. return {
  41517. type: exports.ERROR,
  41518. data: 'parser error: ' + msg
  41519. };
  41520. }
  41521. /***/ }),
  41522. /***/ "./node_modules/socket.io-parser/is-buffer.js":
  41523. /*!****************************************************!*\
  41524. !*** ./node_modules/socket.io-parser/is-buffer.js ***!
  41525. \****************************************************/
  41526. /*! no static exports found */
  41527. /***/ (function(module, exports, __webpack_require__) {
  41528. /* WEBPACK VAR INJECTION */(function(Buffer) {
  41529. module.exports = isBuf;
  41530. var withNativeBuffer = typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function';
  41531. var withNativeArrayBuffer = typeof ArrayBuffer === 'function';
  41532. var isView = function (obj) {
  41533. return typeof ArrayBuffer.isView === 'function' ? ArrayBuffer.isView(obj) : (obj.buffer instanceof ArrayBuffer);
  41534. };
  41535. /**
  41536. * Returns true if obj is a buffer or an arraybuffer.
  41537. *
  41538. * @api private
  41539. */
  41540. function isBuf(obj) {
  41541. return (withNativeBuffer && Buffer.isBuffer(obj)) ||
  41542. (withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj)));
  41543. }
  41544. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  41545. /***/ }),
  41546. /***/ "./node_modules/socket.io-parser/node_modules/debug/src/browser.js":
  41547. /*!*************************************************************************!*\
  41548. !*** ./node_modules/socket.io-parser/node_modules/debug/src/browser.js ***!
  41549. \*************************************************************************/
  41550. /*! no static exports found */
  41551. /***/ (function(module, exports, __webpack_require__) {
  41552. /* WEBPACK VAR INJECTION */(function(process) {/**
  41553. * This is the web browser implementation of `debug()`.
  41554. *
  41555. * Expose `debug()` as the module.
  41556. */
  41557. exports = module.exports = __webpack_require__(/*! ./debug */ "./node_modules/socket.io-parser/node_modules/debug/src/debug.js");
  41558. exports.log = log;
  41559. exports.formatArgs = formatArgs;
  41560. exports.save = save;
  41561. exports.load = load;
  41562. exports.useColors = useColors;
  41563. exports.storage = 'undefined' != typeof chrome
  41564. && 'undefined' != typeof chrome.storage
  41565. ? chrome.storage.local
  41566. : localstorage();
  41567. /**
  41568. * Colors.
  41569. */
  41570. exports.colors = [
  41571. '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC',
  41572. '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF',
  41573. '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC',
  41574. '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF',
  41575. '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC',
  41576. '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033',
  41577. '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366',
  41578. '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933',
  41579. '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC',
  41580. '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF',
  41581. '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'
  41582. ];
  41583. /**
  41584. * Currently only WebKit-based Web Inspectors, Firefox >= v31,
  41585. * and the Firebug extension (any Firefox version) are known
  41586. * to support "%c" CSS customizations.
  41587. *
  41588. * TODO: add a `localStorage` variable to explicitly enable/disable colors
  41589. */
  41590. function useColors() {
  41591. // NB: In an Electron preload script, document will be defined but not fully
  41592. // initialized. Since we know we're in Chrome, we'll just detect this case
  41593. // explicitly
  41594. if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
  41595. return true;
  41596. }
  41597. // Internet Explorer and Edge do not support colors.
  41598. if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
  41599. return false;
  41600. }
  41601. // is webkit? http://stackoverflow.com/a/16459606/376773
  41602. // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
  41603. return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
  41604. // is firebug? http://stackoverflow.com/a/398120/376773
  41605. (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
  41606. // is firefox >= v31?
  41607. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  41608. (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
  41609. // double check webkit in userAgent just in case we are in a worker
  41610. (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
  41611. }
  41612. /**
  41613. * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
  41614. */
  41615. exports.formatters.j = function(v) {
  41616. try {
  41617. return JSON.stringify(v);
  41618. } catch (err) {
  41619. return '[UnexpectedJSONParseError]: ' + err.message;
  41620. }
  41621. };
  41622. /**
  41623. * Colorize log arguments if enabled.
  41624. *
  41625. * @api public
  41626. */
  41627. function formatArgs(args) {
  41628. var useColors = this.useColors;
  41629. args[0] = (useColors ? '%c' : '')
  41630. + this.namespace
  41631. + (useColors ? ' %c' : ' ')
  41632. + args[0]
  41633. + (useColors ? '%c ' : ' ')
  41634. + '+' + exports.humanize(this.diff);
  41635. if (!useColors) return;
  41636. var c = 'color: ' + this.color;
  41637. args.splice(1, 0, c, 'color: inherit')
  41638. // the final "%c" is somewhat tricky, because there could be other
  41639. // arguments passed either before or after the %c, so we need to
  41640. // figure out the correct index to insert the CSS into
  41641. var index = 0;
  41642. var lastC = 0;
  41643. args[0].replace(/%[a-zA-Z%]/g, function(match) {
  41644. if ('%%' === match) return;
  41645. index++;
  41646. if ('%c' === match) {
  41647. // we only are interested in the *last* %c
  41648. // (the user may have provided their own)
  41649. lastC = index;
  41650. }
  41651. });
  41652. args.splice(lastC, 0, c);
  41653. }
  41654. /**
  41655. * Invokes `console.log()` when available.
  41656. * No-op when `console.log` is not a "function".
  41657. *
  41658. * @api public
  41659. */
  41660. function log() {
  41661. // this hackery is required for IE8/9, where
  41662. // the `console.log` function doesn't have 'apply'
  41663. return 'object' === typeof console
  41664. && console.log
  41665. && Function.prototype.apply.call(console.log, console, arguments);
  41666. }
  41667. /**
  41668. * Save `namespaces`.
  41669. *
  41670. * @param {String} namespaces
  41671. * @api private
  41672. */
  41673. function save(namespaces) {
  41674. try {
  41675. if (null == namespaces) {
  41676. exports.storage.removeItem('debug');
  41677. } else {
  41678. exports.storage.debug = namespaces;
  41679. }
  41680. } catch(e) {}
  41681. }
  41682. /**
  41683. * Load `namespaces`.
  41684. *
  41685. * @return {String} returns the previously persisted debug modes
  41686. * @api private
  41687. */
  41688. function load() {
  41689. var r;
  41690. try {
  41691. r = exports.storage.debug;
  41692. } catch(e) {}
  41693. // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
  41694. if (!r && typeof process !== 'undefined' && 'env' in process) {
  41695. r = process.env.DEBUG;
  41696. }
  41697. return r;
  41698. }
  41699. /**
  41700. * Enable namespaces listed in `localStorage.debug` initially.
  41701. */
  41702. exports.enable(load());
  41703. /**
  41704. * Localstorage attempts to return the localstorage.
  41705. *
  41706. * This is necessary because safari throws
  41707. * when a user disables cookies/localstorage
  41708. * and you attempt to access it.
  41709. *
  41710. * @return {LocalStorage}
  41711. * @api private
  41712. */
  41713. function localstorage() {
  41714. try {
  41715. return window.localStorage;
  41716. } catch (e) {}
  41717. }
  41718. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../process/browser.js */ "./node_modules/process/browser.js")))
  41719. /***/ }),
  41720. /***/ "./node_modules/socket.io-parser/node_modules/debug/src/debug.js":
  41721. /*!***********************************************************************!*\
  41722. !*** ./node_modules/socket.io-parser/node_modules/debug/src/debug.js ***!
  41723. \***********************************************************************/
  41724. /*! no static exports found */
  41725. /***/ (function(module, exports, __webpack_require__) {
  41726. /**
  41727. * This is the common logic for both the Node.js and web browser
  41728. * implementations of `debug()`.
  41729. *
  41730. * Expose `debug()` as the module.
  41731. */
  41732. exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
  41733. exports.coerce = coerce;
  41734. exports.disable = disable;
  41735. exports.enable = enable;
  41736. exports.enabled = enabled;
  41737. exports.humanize = __webpack_require__(/*! ms */ "./node_modules/ms/index.js");
  41738. /**
  41739. * Active `debug` instances.
  41740. */
  41741. exports.instances = [];
  41742. /**
  41743. * The currently active debug mode names, and names to skip.
  41744. */
  41745. exports.names = [];
  41746. exports.skips = [];
  41747. /**
  41748. * Map of special "%n" handling functions, for the debug "format" argument.
  41749. *
  41750. * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
  41751. */
  41752. exports.formatters = {};
  41753. /**
  41754. * Select a color.
  41755. * @param {String} namespace
  41756. * @return {Number}
  41757. * @api private
  41758. */
  41759. function selectColor(namespace) {
  41760. var hash = 0, i;
  41761. for (i in namespace) {
  41762. hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
  41763. hash |= 0; // Convert to 32bit integer
  41764. }
  41765. return exports.colors[Math.abs(hash) % exports.colors.length];
  41766. }
  41767. /**
  41768. * Create a debugger with the given `namespace`.
  41769. *
  41770. * @param {String} namespace
  41771. * @return {Function}
  41772. * @api public
  41773. */
  41774. function createDebug(namespace) {
  41775. var prevTime;
  41776. function debug() {
  41777. // disabled?
  41778. if (!debug.enabled) return;
  41779. var self = debug;
  41780. // set `diff` timestamp
  41781. var curr = +new Date();
  41782. var ms = curr - (prevTime || curr);
  41783. self.diff = ms;
  41784. self.prev = prevTime;
  41785. self.curr = curr;
  41786. prevTime = curr;
  41787. // turn the `arguments` into a proper Array
  41788. var args = new Array(arguments.length);
  41789. for (var i = 0; i < args.length; i++) {
  41790. args[i] = arguments[i];
  41791. }
  41792. args[0] = exports.coerce(args[0]);
  41793. if ('string' !== typeof args[0]) {
  41794. // anything else let's inspect with %O
  41795. args.unshift('%O');
  41796. }
  41797. // apply any `formatters` transformations
  41798. var index = 0;
  41799. args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
  41800. // if we encounter an escaped % then don't increase the array index
  41801. if (match === '%%') return match;
  41802. index++;
  41803. var formatter = exports.formatters[format];
  41804. if ('function' === typeof formatter) {
  41805. var val = args[index];
  41806. match = formatter.call(self, val);
  41807. // now we need to remove `args[index]` since it's inlined in the `format`
  41808. args.splice(index, 1);
  41809. index--;
  41810. }
  41811. return match;
  41812. });
  41813. // apply env-specific formatting (colors, etc.)
  41814. exports.formatArgs.call(self, args);
  41815. var logFn = debug.log || exports.log || console.log.bind(console);
  41816. logFn.apply(self, args);
  41817. }
  41818. debug.namespace = namespace;
  41819. debug.enabled = exports.enabled(namespace);
  41820. debug.useColors = exports.useColors();
  41821. debug.color = selectColor(namespace);
  41822. debug.destroy = destroy;
  41823. // env-specific initialization logic for debug instances
  41824. if ('function' === typeof exports.init) {
  41825. exports.init(debug);
  41826. }
  41827. exports.instances.push(debug);
  41828. return debug;
  41829. }
  41830. function destroy () {
  41831. var index = exports.instances.indexOf(this);
  41832. if (index !== -1) {
  41833. exports.instances.splice(index, 1);
  41834. return true;
  41835. } else {
  41836. return false;
  41837. }
  41838. }
  41839. /**
  41840. * Enables a debug mode by namespaces. This can include modes
  41841. * separated by a colon and wildcards.
  41842. *
  41843. * @param {String} namespaces
  41844. * @api public
  41845. */
  41846. function enable(namespaces) {
  41847. exports.save(namespaces);
  41848. exports.names = [];
  41849. exports.skips = [];
  41850. var i;
  41851. var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
  41852. var len = split.length;
  41853. for (i = 0; i < len; i++) {
  41854. if (!split[i]) continue; // ignore empty strings
  41855. namespaces = split[i].replace(/\*/g, '.*?');
  41856. if (namespaces[0] === '-') {
  41857. exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
  41858. } else {
  41859. exports.names.push(new RegExp('^' + namespaces + '$'));
  41860. }
  41861. }
  41862. for (i = 0; i < exports.instances.length; i++) {
  41863. var instance = exports.instances[i];
  41864. instance.enabled = exports.enabled(instance.namespace);
  41865. }
  41866. }
  41867. /**
  41868. * Disable debug output.
  41869. *
  41870. * @api public
  41871. */
  41872. function disable() {
  41873. exports.enable('');
  41874. }
  41875. /**
  41876. * Returns true if the given mode name is enabled, false otherwise.
  41877. *
  41878. * @param {String} name
  41879. * @return {Boolean}
  41880. * @api public
  41881. */
  41882. function enabled(name) {
  41883. if (name[name.length - 1] === '*') {
  41884. return true;
  41885. }
  41886. var i, len;
  41887. for (i = 0, len = exports.skips.length; i < len; i++) {
  41888. if (exports.skips[i].test(name)) {
  41889. return false;
  41890. }
  41891. }
  41892. for (i = 0, len = exports.names.length; i < len; i++) {
  41893. if (exports.names[i].test(name)) {
  41894. return true;
  41895. }
  41896. }
  41897. return false;
  41898. }
  41899. /**
  41900. * Coerce `val`.
  41901. *
  41902. * @param {Mixed} val
  41903. * @return {Mixed}
  41904. * @api private
  41905. */
  41906. function coerce(val) {
  41907. if (val instanceof Error) return val.stack || val.message;
  41908. return val;
  41909. }
  41910. /***/ }),
  41911. /***/ "./node_modules/socket.io-parser/node_modules/isarray/index.js":
  41912. /*!*********************************************************************!*\
  41913. !*** ./node_modules/socket.io-parser/node_modules/isarray/index.js ***!
  41914. \*********************************************************************/
  41915. /*! no static exports found */
  41916. /***/ (function(module, exports) {
  41917. var toString = {}.toString;
  41918. module.exports = Array.isArray || function (arr) {
  41919. return toString.call(arr) == '[object Array]';
  41920. };
  41921. /***/ }),
  41922. /***/ "./node_modules/timers-browserify/main.js":
  41923. /*!************************************************!*\
  41924. !*** ./node_modules/timers-browserify/main.js ***!
  41925. \************************************************/
  41926. /*! no static exports found */
  41927. /***/ (function(module, exports, __webpack_require__) {
  41928. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  41929. (typeof self !== "undefined" && self) ||
  41930. window;
  41931. var apply = Function.prototype.apply;
  41932. // DOM APIs, for completeness
  41933. exports.setTimeout = function() {
  41934. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  41935. };
  41936. exports.setInterval = function() {
  41937. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  41938. };
  41939. exports.clearTimeout =
  41940. exports.clearInterval = function(timeout) {
  41941. if (timeout) {
  41942. timeout.close();
  41943. }
  41944. };
  41945. function Timeout(id, clearFn) {
  41946. this._id = id;
  41947. this._clearFn = clearFn;
  41948. }
  41949. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  41950. Timeout.prototype.close = function() {
  41951. this._clearFn.call(scope, this._id);
  41952. };
  41953. // Does not start the time, just sets up the members needed.
  41954. exports.enroll = function(item, msecs) {
  41955. clearTimeout(item._idleTimeoutId);
  41956. item._idleTimeout = msecs;
  41957. };
  41958. exports.unenroll = function(item) {
  41959. clearTimeout(item._idleTimeoutId);
  41960. item._idleTimeout = -1;
  41961. };
  41962. exports._unrefActive = exports.active = function(item) {
  41963. clearTimeout(item._idleTimeoutId);
  41964. var msecs = item._idleTimeout;
  41965. if (msecs >= 0) {
  41966. item._idleTimeoutId = setTimeout(function onTimeout() {
  41967. if (item._onTimeout)
  41968. item._onTimeout();
  41969. }, msecs);
  41970. }
  41971. };
  41972. // setimmediate attaches itself to the global object
  41973. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  41974. // On some exotic environments, it's not clear which object `setimmediate` was
  41975. // able to install onto. Search each possibility in the same order as the
  41976. // `setimmediate` library.
  41977. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  41978. (typeof global !== "undefined" && global.setImmediate) ||
  41979. (this && this.setImmediate);
  41980. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  41981. (typeof global !== "undefined" && global.clearImmediate) ||
  41982. (this && this.clearImmediate);
  41983. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  41984. /***/ }),
  41985. /***/ "./node_modules/to-array/index.js":
  41986. /*!****************************************!*\
  41987. !*** ./node_modules/to-array/index.js ***!
  41988. \****************************************/
  41989. /*! no static exports found */
  41990. /***/ (function(module, exports) {
  41991. module.exports = toArray
  41992. function toArray(list, index) {
  41993. var array = []
  41994. index = index || 0
  41995. for (var i = index || 0; i < list.length; i++) {
  41996. array[i - index] = list[i]
  41997. }
  41998. return array
  41999. }
  42000. /***/ }),
  42001. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  42002. /*!*************************************************!*\
  42003. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  42004. \*************************************************/
  42005. /*! no static exports found */
  42006. /***/ (function(module, exports, __webpack_require__) {
  42007. "use strict";
  42008. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  42009. * Vue.js v2.6.11
  42010. * (c) 2014-2019 Evan You
  42011. * Released under the MIT License.
  42012. */
  42013. /* */
  42014. var emptyObject = Object.freeze({});
  42015. // These helpers produce better VM code in JS engines due to their
  42016. // explicitness and function inlining.
  42017. function isUndef (v) {
  42018. return v === undefined || v === null
  42019. }
  42020. function isDef (v) {
  42021. return v !== undefined && v !== null
  42022. }
  42023. function isTrue (v) {
  42024. return v === true
  42025. }
  42026. function isFalse (v) {
  42027. return v === false
  42028. }
  42029. /**
  42030. * Check if value is primitive.
  42031. */
  42032. function isPrimitive (value) {
  42033. return (
  42034. typeof value === 'string' ||
  42035. typeof value === 'number' ||
  42036. // $flow-disable-line
  42037. typeof value === 'symbol' ||
  42038. typeof value === 'boolean'
  42039. )
  42040. }
  42041. /**
  42042. * Quick object check - this is primarily used to tell
  42043. * Objects from primitive values when we know the value
  42044. * is a JSON-compliant type.
  42045. */
  42046. function isObject (obj) {
  42047. return obj !== null && typeof obj === 'object'
  42048. }
  42049. /**
  42050. * Get the raw type string of a value, e.g., [object Object].
  42051. */
  42052. var _toString = Object.prototype.toString;
  42053. function toRawType (value) {
  42054. return _toString.call(value).slice(8, -1)
  42055. }
  42056. /**
  42057. * Strict object type check. Only returns true
  42058. * for plain JavaScript objects.
  42059. */
  42060. function isPlainObject (obj) {
  42061. return _toString.call(obj) === '[object Object]'
  42062. }
  42063. function isRegExp (v) {
  42064. return _toString.call(v) === '[object RegExp]'
  42065. }
  42066. /**
  42067. * Check if val is a valid array index.
  42068. */
  42069. function isValidArrayIndex (val) {
  42070. var n = parseFloat(String(val));
  42071. return n >= 0 && Math.floor(n) === n && isFinite(val)
  42072. }
  42073. function isPromise (val) {
  42074. return (
  42075. isDef(val) &&
  42076. typeof val.then === 'function' &&
  42077. typeof val.catch === 'function'
  42078. )
  42079. }
  42080. /**
  42081. * Convert a value to a string that is actually rendered.
  42082. */
  42083. function toString (val) {
  42084. return val == null
  42085. ? ''
  42086. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  42087. ? JSON.stringify(val, null, 2)
  42088. : String(val)
  42089. }
  42090. /**
  42091. * Convert an input value to a number for persistence.
  42092. * If the conversion fails, return original string.
  42093. */
  42094. function toNumber (val) {
  42095. var n = parseFloat(val);
  42096. return isNaN(n) ? val : n
  42097. }
  42098. /**
  42099. * Make a map and return a function for checking if a key
  42100. * is in that map.
  42101. */
  42102. function makeMap (
  42103. str,
  42104. expectsLowerCase
  42105. ) {
  42106. var map = Object.create(null);
  42107. var list = str.split(',');
  42108. for (var i = 0; i < list.length; i++) {
  42109. map[list[i]] = true;
  42110. }
  42111. return expectsLowerCase
  42112. ? function (val) { return map[val.toLowerCase()]; }
  42113. : function (val) { return map[val]; }
  42114. }
  42115. /**
  42116. * Check if a tag is a built-in tag.
  42117. */
  42118. var isBuiltInTag = makeMap('slot,component', true);
  42119. /**
  42120. * Check if an attribute is a reserved attribute.
  42121. */
  42122. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  42123. /**
  42124. * Remove an item from an array.
  42125. */
  42126. function remove (arr, item) {
  42127. if (arr.length) {
  42128. var index = arr.indexOf(item);
  42129. if (index > -1) {
  42130. return arr.splice(index, 1)
  42131. }
  42132. }
  42133. }
  42134. /**
  42135. * Check whether an object has the property.
  42136. */
  42137. var hasOwnProperty = Object.prototype.hasOwnProperty;
  42138. function hasOwn (obj, key) {
  42139. return hasOwnProperty.call(obj, key)
  42140. }
  42141. /**
  42142. * Create a cached version of a pure function.
  42143. */
  42144. function cached (fn) {
  42145. var cache = Object.create(null);
  42146. return (function cachedFn (str) {
  42147. var hit = cache[str];
  42148. return hit || (cache[str] = fn(str))
  42149. })
  42150. }
  42151. /**
  42152. * Camelize a hyphen-delimited string.
  42153. */
  42154. var camelizeRE = /-(\w)/g;
  42155. var camelize = cached(function (str) {
  42156. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  42157. });
  42158. /**
  42159. * Capitalize a string.
  42160. */
  42161. var capitalize = cached(function (str) {
  42162. return str.charAt(0).toUpperCase() + str.slice(1)
  42163. });
  42164. /**
  42165. * Hyphenate a camelCase string.
  42166. */
  42167. var hyphenateRE = /\B([A-Z])/g;
  42168. var hyphenate = cached(function (str) {
  42169. return str.replace(hyphenateRE, '-$1').toLowerCase()
  42170. });
  42171. /**
  42172. * Simple bind polyfill for environments that do not support it,
  42173. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  42174. * since native bind is now performant enough in most browsers.
  42175. * But removing it would mean breaking code that was able to run in
  42176. * PhantomJS 1.x, so this must be kept for backward compatibility.
  42177. */
  42178. /* istanbul ignore next */
  42179. function polyfillBind (fn, ctx) {
  42180. function boundFn (a) {
  42181. var l = arguments.length;
  42182. return l
  42183. ? l > 1
  42184. ? fn.apply(ctx, arguments)
  42185. : fn.call(ctx, a)
  42186. : fn.call(ctx)
  42187. }
  42188. boundFn._length = fn.length;
  42189. return boundFn
  42190. }
  42191. function nativeBind (fn, ctx) {
  42192. return fn.bind(ctx)
  42193. }
  42194. var bind = Function.prototype.bind
  42195. ? nativeBind
  42196. : polyfillBind;
  42197. /**
  42198. * Convert an Array-like object to a real Array.
  42199. */
  42200. function toArray (list, start) {
  42201. start = start || 0;
  42202. var i = list.length - start;
  42203. var ret = new Array(i);
  42204. while (i--) {
  42205. ret[i] = list[i + start];
  42206. }
  42207. return ret
  42208. }
  42209. /**
  42210. * Mix properties into target object.
  42211. */
  42212. function extend (to, _from) {
  42213. for (var key in _from) {
  42214. to[key] = _from[key];
  42215. }
  42216. return to
  42217. }
  42218. /**
  42219. * Merge an Array of Objects into a single Object.
  42220. */
  42221. function toObject (arr) {
  42222. var res = {};
  42223. for (var i = 0; i < arr.length; i++) {
  42224. if (arr[i]) {
  42225. extend(res, arr[i]);
  42226. }
  42227. }
  42228. return res
  42229. }
  42230. /* eslint-disable no-unused-vars */
  42231. /**
  42232. * Perform no operation.
  42233. * Stubbing args to make Flow happy without leaving useless transpiled code
  42234. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  42235. */
  42236. function noop (a, b, c) {}
  42237. /**
  42238. * Always return false.
  42239. */
  42240. var no = function (a, b, c) { return false; };
  42241. /* eslint-enable no-unused-vars */
  42242. /**
  42243. * Return the same value.
  42244. */
  42245. var identity = function (_) { return _; };
  42246. /**
  42247. * Generate a string containing static keys from compiler modules.
  42248. */
  42249. function genStaticKeys (modules) {
  42250. return modules.reduce(function (keys, m) {
  42251. return keys.concat(m.staticKeys || [])
  42252. }, []).join(',')
  42253. }
  42254. /**
  42255. * Check if two values are loosely equal - that is,
  42256. * if they are plain objects, do they have the same shape?
  42257. */
  42258. function looseEqual (a, b) {
  42259. if (a === b) { return true }
  42260. var isObjectA = isObject(a);
  42261. var isObjectB = isObject(b);
  42262. if (isObjectA && isObjectB) {
  42263. try {
  42264. var isArrayA = Array.isArray(a);
  42265. var isArrayB = Array.isArray(b);
  42266. if (isArrayA && isArrayB) {
  42267. return a.length === b.length && a.every(function (e, i) {
  42268. return looseEqual(e, b[i])
  42269. })
  42270. } else if (a instanceof Date && b instanceof Date) {
  42271. return a.getTime() === b.getTime()
  42272. } else if (!isArrayA && !isArrayB) {
  42273. var keysA = Object.keys(a);
  42274. var keysB = Object.keys(b);
  42275. return keysA.length === keysB.length && keysA.every(function (key) {
  42276. return looseEqual(a[key], b[key])
  42277. })
  42278. } else {
  42279. /* istanbul ignore next */
  42280. return false
  42281. }
  42282. } catch (e) {
  42283. /* istanbul ignore next */
  42284. return false
  42285. }
  42286. } else if (!isObjectA && !isObjectB) {
  42287. return String(a) === String(b)
  42288. } else {
  42289. return false
  42290. }
  42291. }
  42292. /**
  42293. * Return the first index at which a loosely equal value can be
  42294. * found in the array (if value is a plain object, the array must
  42295. * contain an object of the same shape), or -1 if it is not present.
  42296. */
  42297. function looseIndexOf (arr, val) {
  42298. for (var i = 0; i < arr.length; i++) {
  42299. if (looseEqual(arr[i], val)) { return i }
  42300. }
  42301. return -1
  42302. }
  42303. /**
  42304. * Ensure a function is called only once.
  42305. */
  42306. function once (fn) {
  42307. var called = false;
  42308. return function () {
  42309. if (!called) {
  42310. called = true;
  42311. fn.apply(this, arguments);
  42312. }
  42313. }
  42314. }
  42315. var SSR_ATTR = 'data-server-rendered';
  42316. var ASSET_TYPES = [
  42317. 'component',
  42318. 'directive',
  42319. 'filter'
  42320. ];
  42321. var LIFECYCLE_HOOKS = [
  42322. 'beforeCreate',
  42323. 'created',
  42324. 'beforeMount',
  42325. 'mounted',
  42326. 'beforeUpdate',
  42327. 'updated',
  42328. 'beforeDestroy',
  42329. 'destroyed',
  42330. 'activated',
  42331. 'deactivated',
  42332. 'errorCaptured',
  42333. 'serverPrefetch'
  42334. ];
  42335. /* */
  42336. var config = ({
  42337. /**
  42338. * Option merge strategies (used in core/util/options)
  42339. */
  42340. // $flow-disable-line
  42341. optionMergeStrategies: Object.create(null),
  42342. /**
  42343. * Whether to suppress warnings.
  42344. */
  42345. silent: false,
  42346. /**
  42347. * Show production mode tip message on boot?
  42348. */
  42349. productionTip: "development" !== 'production',
  42350. /**
  42351. * Whether to enable devtools
  42352. */
  42353. devtools: "development" !== 'production',
  42354. /**
  42355. * Whether to record perf
  42356. */
  42357. performance: false,
  42358. /**
  42359. * Error handler for watcher errors
  42360. */
  42361. errorHandler: null,
  42362. /**
  42363. * Warn handler for watcher warns
  42364. */
  42365. warnHandler: null,
  42366. /**
  42367. * Ignore certain custom elements
  42368. */
  42369. ignoredElements: [],
  42370. /**
  42371. * Custom user key aliases for v-on
  42372. */
  42373. // $flow-disable-line
  42374. keyCodes: Object.create(null),
  42375. /**
  42376. * Check if a tag is reserved so that it cannot be registered as a
  42377. * component. This is platform-dependent and may be overwritten.
  42378. */
  42379. isReservedTag: no,
  42380. /**
  42381. * Check if an attribute is reserved so that it cannot be used as a component
  42382. * prop. This is platform-dependent and may be overwritten.
  42383. */
  42384. isReservedAttr: no,
  42385. /**
  42386. * Check if a tag is an unknown element.
  42387. * Platform-dependent.
  42388. */
  42389. isUnknownElement: no,
  42390. /**
  42391. * Get the namespace of an element
  42392. */
  42393. getTagNamespace: noop,
  42394. /**
  42395. * Parse the real tag name for the specific platform.
  42396. */
  42397. parsePlatformTagName: identity,
  42398. /**
  42399. * Check if an attribute must be bound using property, e.g. value
  42400. * Platform-dependent.
  42401. */
  42402. mustUseProp: no,
  42403. /**
  42404. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  42405. * This will significantly reduce performance if set to false.
  42406. */
  42407. async: true,
  42408. /**
  42409. * Exposed for legacy reasons
  42410. */
  42411. _lifecycleHooks: LIFECYCLE_HOOKS
  42412. });
  42413. /* */
  42414. /**
  42415. * unicode letters used for parsing html tags, component names and property paths.
  42416. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  42417. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  42418. */
  42419. 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/;
  42420. /**
  42421. * Check if a string starts with $ or _
  42422. */
  42423. function isReserved (str) {
  42424. var c = (str + '').charCodeAt(0);
  42425. return c === 0x24 || c === 0x5F
  42426. }
  42427. /**
  42428. * Define a property.
  42429. */
  42430. function def (obj, key, val, enumerable) {
  42431. Object.defineProperty(obj, key, {
  42432. value: val,
  42433. enumerable: !!enumerable,
  42434. writable: true,
  42435. configurable: true
  42436. });
  42437. }
  42438. /**
  42439. * Parse simple path.
  42440. */
  42441. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  42442. function parsePath (path) {
  42443. if (bailRE.test(path)) {
  42444. return
  42445. }
  42446. var segments = path.split('.');
  42447. return function (obj) {
  42448. for (var i = 0; i < segments.length; i++) {
  42449. if (!obj) { return }
  42450. obj = obj[segments[i]];
  42451. }
  42452. return obj
  42453. }
  42454. }
  42455. /* */
  42456. // can we use __proto__?
  42457. var hasProto = '__proto__' in {};
  42458. // Browser environment sniffing
  42459. var inBrowser = typeof window !== 'undefined';
  42460. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  42461. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  42462. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  42463. var isIE = UA && /msie|trident/.test(UA);
  42464. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  42465. var isEdge = UA && UA.indexOf('edge/') > 0;
  42466. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  42467. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  42468. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  42469. var isPhantomJS = UA && /phantomjs/.test(UA);
  42470. var isFF = UA && UA.match(/firefox\/(\d+)/);
  42471. // Firefox has a "watch" function on Object.prototype...
  42472. var nativeWatch = ({}).watch;
  42473. var supportsPassive = false;
  42474. if (inBrowser) {
  42475. try {
  42476. var opts = {};
  42477. Object.defineProperty(opts, 'passive', ({
  42478. get: function get () {
  42479. /* istanbul ignore next */
  42480. supportsPassive = true;
  42481. }
  42482. })); // https://github.com/facebook/flow/issues/285
  42483. window.addEventListener('test-passive', null, opts);
  42484. } catch (e) {}
  42485. }
  42486. // this needs to be lazy-evaled because vue may be required before
  42487. // vue-server-renderer can set VUE_ENV
  42488. var _isServer;
  42489. var isServerRendering = function () {
  42490. if (_isServer === undefined) {
  42491. /* istanbul ignore if */
  42492. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  42493. // detect presence of vue-server-renderer and avoid
  42494. // Webpack shimming the process
  42495. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  42496. } else {
  42497. _isServer = false;
  42498. }
  42499. }
  42500. return _isServer
  42501. };
  42502. // detect devtools
  42503. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  42504. /* istanbul ignore next */
  42505. function isNative (Ctor) {
  42506. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  42507. }
  42508. var hasSymbol =
  42509. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  42510. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  42511. var _Set;
  42512. /* istanbul ignore if */ // $flow-disable-line
  42513. if (typeof Set !== 'undefined' && isNative(Set)) {
  42514. // use native Set when available.
  42515. _Set = Set;
  42516. } else {
  42517. // a non-standard Set polyfill that only works with primitive keys.
  42518. _Set = /*@__PURE__*/(function () {
  42519. function Set () {
  42520. this.set = Object.create(null);
  42521. }
  42522. Set.prototype.has = function has (key) {
  42523. return this.set[key] === true
  42524. };
  42525. Set.prototype.add = function add (key) {
  42526. this.set[key] = true;
  42527. };
  42528. Set.prototype.clear = function clear () {
  42529. this.set = Object.create(null);
  42530. };
  42531. return Set;
  42532. }());
  42533. }
  42534. /* */
  42535. var warn = noop;
  42536. var tip = noop;
  42537. var generateComponentTrace = (noop); // work around flow check
  42538. var formatComponentName = (noop);
  42539. {
  42540. var hasConsole = typeof console !== 'undefined';
  42541. var classifyRE = /(?:^|[-_])(\w)/g;
  42542. var classify = function (str) { return str
  42543. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  42544. .replace(/[-_]/g, ''); };
  42545. warn = function (msg, vm) {
  42546. var trace = vm ? generateComponentTrace(vm) : '';
  42547. if (config.warnHandler) {
  42548. config.warnHandler.call(null, msg, vm, trace);
  42549. } else if (hasConsole && (!config.silent)) {
  42550. console.error(("[Vue warn]: " + msg + trace));
  42551. }
  42552. };
  42553. tip = function (msg, vm) {
  42554. if (hasConsole && (!config.silent)) {
  42555. console.warn("[Vue tip]: " + msg + (
  42556. vm ? generateComponentTrace(vm) : ''
  42557. ));
  42558. }
  42559. };
  42560. formatComponentName = function (vm, includeFile) {
  42561. if (vm.$root === vm) {
  42562. return '<Root>'
  42563. }
  42564. var options = typeof vm === 'function' && vm.cid != null
  42565. ? vm.options
  42566. : vm._isVue
  42567. ? vm.$options || vm.constructor.options
  42568. : vm;
  42569. var name = options.name || options._componentTag;
  42570. var file = options.__file;
  42571. if (!name && file) {
  42572. var match = file.match(/([^/\\]+)\.vue$/);
  42573. name = match && match[1];
  42574. }
  42575. return (
  42576. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  42577. (file && includeFile !== false ? (" at " + file) : '')
  42578. )
  42579. };
  42580. var repeat = function (str, n) {
  42581. var res = '';
  42582. while (n) {
  42583. if (n % 2 === 1) { res += str; }
  42584. if (n > 1) { str += str; }
  42585. n >>= 1;
  42586. }
  42587. return res
  42588. };
  42589. generateComponentTrace = function (vm) {
  42590. if (vm._isVue && vm.$parent) {
  42591. var tree = [];
  42592. var currentRecursiveSequence = 0;
  42593. while (vm) {
  42594. if (tree.length > 0) {
  42595. var last = tree[tree.length - 1];
  42596. if (last.constructor === vm.constructor) {
  42597. currentRecursiveSequence++;
  42598. vm = vm.$parent;
  42599. continue
  42600. } else if (currentRecursiveSequence > 0) {
  42601. tree[tree.length - 1] = [last, currentRecursiveSequence];
  42602. currentRecursiveSequence = 0;
  42603. }
  42604. }
  42605. tree.push(vm);
  42606. vm = vm.$parent;
  42607. }
  42608. return '\n\nfound in\n\n' + tree
  42609. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  42610. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  42611. : formatComponentName(vm))); })
  42612. .join('\n')
  42613. } else {
  42614. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  42615. }
  42616. };
  42617. }
  42618. /* */
  42619. var uid = 0;
  42620. /**
  42621. * A dep is an observable that can have multiple
  42622. * directives subscribing to it.
  42623. */
  42624. var Dep = function Dep () {
  42625. this.id = uid++;
  42626. this.subs = [];
  42627. };
  42628. Dep.prototype.addSub = function addSub (sub) {
  42629. this.subs.push(sub);
  42630. };
  42631. Dep.prototype.removeSub = function removeSub (sub) {
  42632. remove(this.subs, sub);
  42633. };
  42634. Dep.prototype.depend = function depend () {
  42635. if (Dep.target) {
  42636. Dep.target.addDep(this);
  42637. }
  42638. };
  42639. Dep.prototype.notify = function notify () {
  42640. // stabilize the subscriber list first
  42641. var subs = this.subs.slice();
  42642. if (!config.async) {
  42643. // subs aren't sorted in scheduler if not running async
  42644. // we need to sort them now to make sure they fire in correct
  42645. // order
  42646. subs.sort(function (a, b) { return a.id - b.id; });
  42647. }
  42648. for (var i = 0, l = subs.length; i < l; i++) {
  42649. subs[i].update();
  42650. }
  42651. };
  42652. // The current target watcher being evaluated.
  42653. // This is globally unique because only one watcher
  42654. // can be evaluated at a time.
  42655. Dep.target = null;
  42656. var targetStack = [];
  42657. function pushTarget (target) {
  42658. targetStack.push(target);
  42659. Dep.target = target;
  42660. }
  42661. function popTarget () {
  42662. targetStack.pop();
  42663. Dep.target = targetStack[targetStack.length - 1];
  42664. }
  42665. /* */
  42666. var VNode = function VNode (
  42667. tag,
  42668. data,
  42669. children,
  42670. text,
  42671. elm,
  42672. context,
  42673. componentOptions,
  42674. asyncFactory
  42675. ) {
  42676. this.tag = tag;
  42677. this.data = data;
  42678. this.children = children;
  42679. this.text = text;
  42680. this.elm = elm;
  42681. this.ns = undefined;
  42682. this.context = context;
  42683. this.fnContext = undefined;
  42684. this.fnOptions = undefined;
  42685. this.fnScopeId = undefined;
  42686. this.key = data && data.key;
  42687. this.componentOptions = componentOptions;
  42688. this.componentInstance = undefined;
  42689. this.parent = undefined;
  42690. this.raw = false;
  42691. this.isStatic = false;
  42692. this.isRootInsert = true;
  42693. this.isComment = false;
  42694. this.isCloned = false;
  42695. this.isOnce = false;
  42696. this.asyncFactory = asyncFactory;
  42697. this.asyncMeta = undefined;
  42698. this.isAsyncPlaceholder = false;
  42699. };
  42700. var prototypeAccessors = { child: { configurable: true } };
  42701. // DEPRECATED: alias for componentInstance for backwards compat.
  42702. /* istanbul ignore next */
  42703. prototypeAccessors.child.get = function () {
  42704. return this.componentInstance
  42705. };
  42706. Object.defineProperties( VNode.prototype, prototypeAccessors );
  42707. var createEmptyVNode = function (text) {
  42708. if ( text === void 0 ) text = '';
  42709. var node = new VNode();
  42710. node.text = text;
  42711. node.isComment = true;
  42712. return node
  42713. };
  42714. function createTextVNode (val) {
  42715. return new VNode(undefined, undefined, undefined, String(val))
  42716. }
  42717. // optimized shallow clone
  42718. // used for static nodes and slot nodes because they may be reused across
  42719. // multiple renders, cloning them avoids errors when DOM manipulations rely
  42720. // on their elm reference.
  42721. function cloneVNode (vnode) {
  42722. var cloned = new VNode(
  42723. vnode.tag,
  42724. vnode.data,
  42725. // #7975
  42726. // clone children array to avoid mutating original in case of cloning
  42727. // a child.
  42728. vnode.children && vnode.children.slice(),
  42729. vnode.text,
  42730. vnode.elm,
  42731. vnode.context,
  42732. vnode.componentOptions,
  42733. vnode.asyncFactory
  42734. );
  42735. cloned.ns = vnode.ns;
  42736. cloned.isStatic = vnode.isStatic;
  42737. cloned.key = vnode.key;
  42738. cloned.isComment = vnode.isComment;
  42739. cloned.fnContext = vnode.fnContext;
  42740. cloned.fnOptions = vnode.fnOptions;
  42741. cloned.fnScopeId = vnode.fnScopeId;
  42742. cloned.asyncMeta = vnode.asyncMeta;
  42743. cloned.isCloned = true;
  42744. return cloned
  42745. }
  42746. /*
  42747. * not type checking this file because flow doesn't play well with
  42748. * dynamically accessing methods on Array prototype
  42749. */
  42750. var arrayProto = Array.prototype;
  42751. var arrayMethods = Object.create(arrayProto);
  42752. var methodsToPatch = [
  42753. 'push',
  42754. 'pop',
  42755. 'shift',
  42756. 'unshift',
  42757. 'splice',
  42758. 'sort',
  42759. 'reverse'
  42760. ];
  42761. /**
  42762. * Intercept mutating methods and emit events
  42763. */
  42764. methodsToPatch.forEach(function (method) {
  42765. // cache original method
  42766. var original = arrayProto[method];
  42767. def(arrayMethods, method, function mutator () {
  42768. var args = [], len = arguments.length;
  42769. while ( len-- ) args[ len ] = arguments[ len ];
  42770. var result = original.apply(this, args);
  42771. var ob = this.__ob__;
  42772. var inserted;
  42773. switch (method) {
  42774. case 'push':
  42775. case 'unshift':
  42776. inserted = args;
  42777. break
  42778. case 'splice':
  42779. inserted = args.slice(2);
  42780. break
  42781. }
  42782. if (inserted) { ob.observeArray(inserted); }
  42783. // notify change
  42784. ob.dep.notify();
  42785. return result
  42786. });
  42787. });
  42788. /* */
  42789. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  42790. /**
  42791. * In some cases we may want to disable observation inside a component's
  42792. * update computation.
  42793. */
  42794. var shouldObserve = true;
  42795. function toggleObserving (value) {
  42796. shouldObserve = value;
  42797. }
  42798. /**
  42799. * Observer class that is attached to each observed
  42800. * object. Once attached, the observer converts the target
  42801. * object's property keys into getter/setters that
  42802. * collect dependencies and dispatch updates.
  42803. */
  42804. var Observer = function Observer (value) {
  42805. this.value = value;
  42806. this.dep = new Dep();
  42807. this.vmCount = 0;
  42808. def(value, '__ob__', this);
  42809. if (Array.isArray(value)) {
  42810. if (hasProto) {
  42811. protoAugment(value, arrayMethods);
  42812. } else {
  42813. copyAugment(value, arrayMethods, arrayKeys);
  42814. }
  42815. this.observeArray(value);
  42816. } else {
  42817. this.walk(value);
  42818. }
  42819. };
  42820. /**
  42821. * Walk through all properties and convert them into
  42822. * getter/setters. This method should only be called when
  42823. * value type is Object.
  42824. */
  42825. Observer.prototype.walk = function walk (obj) {
  42826. var keys = Object.keys(obj);
  42827. for (var i = 0; i < keys.length; i++) {
  42828. defineReactive$$1(obj, keys[i]);
  42829. }
  42830. };
  42831. /**
  42832. * Observe a list of Array items.
  42833. */
  42834. Observer.prototype.observeArray = function observeArray (items) {
  42835. for (var i = 0, l = items.length; i < l; i++) {
  42836. observe(items[i]);
  42837. }
  42838. };
  42839. // helpers
  42840. /**
  42841. * Augment a target Object or Array by intercepting
  42842. * the prototype chain using __proto__
  42843. */
  42844. function protoAugment (target, src) {
  42845. /* eslint-disable no-proto */
  42846. target.__proto__ = src;
  42847. /* eslint-enable no-proto */
  42848. }
  42849. /**
  42850. * Augment a target Object or Array by defining
  42851. * hidden properties.
  42852. */
  42853. /* istanbul ignore next */
  42854. function copyAugment (target, src, keys) {
  42855. for (var i = 0, l = keys.length; i < l; i++) {
  42856. var key = keys[i];
  42857. def(target, key, src[key]);
  42858. }
  42859. }
  42860. /**
  42861. * Attempt to create an observer instance for a value,
  42862. * returns the new observer if successfully observed,
  42863. * or the existing observer if the value already has one.
  42864. */
  42865. function observe (value, asRootData) {
  42866. if (!isObject(value) || value instanceof VNode) {
  42867. return
  42868. }
  42869. var ob;
  42870. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  42871. ob = value.__ob__;
  42872. } else if (
  42873. shouldObserve &&
  42874. !isServerRendering() &&
  42875. (Array.isArray(value) || isPlainObject(value)) &&
  42876. Object.isExtensible(value) &&
  42877. !value._isVue
  42878. ) {
  42879. ob = new Observer(value);
  42880. }
  42881. if (asRootData && ob) {
  42882. ob.vmCount++;
  42883. }
  42884. return ob
  42885. }
  42886. /**
  42887. * Define a reactive property on an Object.
  42888. */
  42889. function defineReactive$$1 (
  42890. obj,
  42891. key,
  42892. val,
  42893. customSetter,
  42894. shallow
  42895. ) {
  42896. var dep = new Dep();
  42897. var property = Object.getOwnPropertyDescriptor(obj, key);
  42898. if (property && property.configurable === false) {
  42899. return
  42900. }
  42901. // cater for pre-defined getter/setters
  42902. var getter = property && property.get;
  42903. var setter = property && property.set;
  42904. if ((!getter || setter) && arguments.length === 2) {
  42905. val = obj[key];
  42906. }
  42907. var childOb = !shallow && observe(val);
  42908. Object.defineProperty(obj, key, {
  42909. enumerable: true,
  42910. configurable: true,
  42911. get: function reactiveGetter () {
  42912. var value = getter ? getter.call(obj) : val;
  42913. if (Dep.target) {
  42914. dep.depend();
  42915. if (childOb) {
  42916. childOb.dep.depend();
  42917. if (Array.isArray(value)) {
  42918. dependArray(value);
  42919. }
  42920. }
  42921. }
  42922. return value
  42923. },
  42924. set: function reactiveSetter (newVal) {
  42925. var value = getter ? getter.call(obj) : val;
  42926. /* eslint-disable no-self-compare */
  42927. if (newVal === value || (newVal !== newVal && value !== value)) {
  42928. return
  42929. }
  42930. /* eslint-enable no-self-compare */
  42931. if (customSetter) {
  42932. customSetter();
  42933. }
  42934. // #7981: for accessor properties without setter
  42935. if (getter && !setter) { return }
  42936. if (setter) {
  42937. setter.call(obj, newVal);
  42938. } else {
  42939. val = newVal;
  42940. }
  42941. childOb = !shallow && observe(newVal);
  42942. dep.notify();
  42943. }
  42944. });
  42945. }
  42946. /**
  42947. * Set a property on an object. Adds the new property and
  42948. * triggers change notification if the property doesn't
  42949. * already exist.
  42950. */
  42951. function set (target, key, val) {
  42952. if (isUndef(target) || isPrimitive(target)
  42953. ) {
  42954. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  42955. }
  42956. if (Array.isArray(target) && isValidArrayIndex(key)) {
  42957. target.length = Math.max(target.length, key);
  42958. target.splice(key, 1, val);
  42959. return val
  42960. }
  42961. if (key in target && !(key in Object.prototype)) {
  42962. target[key] = val;
  42963. return val
  42964. }
  42965. var ob = (target).__ob__;
  42966. if (target._isVue || (ob && ob.vmCount)) {
  42967. warn(
  42968. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  42969. 'at runtime - declare it upfront in the data option.'
  42970. );
  42971. return val
  42972. }
  42973. if (!ob) {
  42974. target[key] = val;
  42975. return val
  42976. }
  42977. defineReactive$$1(ob.value, key, val);
  42978. ob.dep.notify();
  42979. return val
  42980. }
  42981. /**
  42982. * Delete a property and trigger change if necessary.
  42983. */
  42984. function del (target, key) {
  42985. if (isUndef(target) || isPrimitive(target)
  42986. ) {
  42987. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  42988. }
  42989. if (Array.isArray(target) && isValidArrayIndex(key)) {
  42990. target.splice(key, 1);
  42991. return
  42992. }
  42993. var ob = (target).__ob__;
  42994. if (target._isVue || (ob && ob.vmCount)) {
  42995. warn(
  42996. 'Avoid deleting properties on a Vue instance or its root $data ' +
  42997. '- just set it to null.'
  42998. );
  42999. return
  43000. }
  43001. if (!hasOwn(target, key)) {
  43002. return
  43003. }
  43004. delete target[key];
  43005. if (!ob) {
  43006. return
  43007. }
  43008. ob.dep.notify();
  43009. }
  43010. /**
  43011. * Collect dependencies on array elements when the array is touched, since
  43012. * we cannot intercept array element access like property getters.
  43013. */
  43014. function dependArray (value) {
  43015. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  43016. e = value[i];
  43017. e && e.__ob__ && e.__ob__.dep.depend();
  43018. if (Array.isArray(e)) {
  43019. dependArray(e);
  43020. }
  43021. }
  43022. }
  43023. /* */
  43024. /**
  43025. * Option overwriting strategies are functions that handle
  43026. * how to merge a parent option value and a child option
  43027. * value into the final value.
  43028. */
  43029. var strats = config.optionMergeStrategies;
  43030. /**
  43031. * Options with restrictions
  43032. */
  43033. {
  43034. strats.el = strats.propsData = function (parent, child, vm, key) {
  43035. if (!vm) {
  43036. warn(
  43037. "option \"" + key + "\" can only be used during instance " +
  43038. 'creation with the `new` keyword.'
  43039. );
  43040. }
  43041. return defaultStrat(parent, child)
  43042. };
  43043. }
  43044. /**
  43045. * Helper that recursively merges two data objects together.
  43046. */
  43047. function mergeData (to, from) {
  43048. if (!from) { return to }
  43049. var key, toVal, fromVal;
  43050. var keys = hasSymbol
  43051. ? Reflect.ownKeys(from)
  43052. : Object.keys(from);
  43053. for (var i = 0; i < keys.length; i++) {
  43054. key = keys[i];
  43055. // in case the object is already observed...
  43056. if (key === '__ob__') { continue }
  43057. toVal = to[key];
  43058. fromVal = from[key];
  43059. if (!hasOwn(to, key)) {
  43060. set(to, key, fromVal);
  43061. } else if (
  43062. toVal !== fromVal &&
  43063. isPlainObject(toVal) &&
  43064. isPlainObject(fromVal)
  43065. ) {
  43066. mergeData(toVal, fromVal);
  43067. }
  43068. }
  43069. return to
  43070. }
  43071. /**
  43072. * Data
  43073. */
  43074. function mergeDataOrFn (
  43075. parentVal,
  43076. childVal,
  43077. vm
  43078. ) {
  43079. if (!vm) {
  43080. // in a Vue.extend merge, both should be functions
  43081. if (!childVal) {
  43082. return parentVal
  43083. }
  43084. if (!parentVal) {
  43085. return childVal
  43086. }
  43087. // when parentVal & childVal are both present,
  43088. // we need to return a function that returns the
  43089. // merged result of both functions... no need to
  43090. // check if parentVal is a function here because
  43091. // it has to be a function to pass previous merges.
  43092. return function mergedDataFn () {
  43093. return mergeData(
  43094. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  43095. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  43096. )
  43097. }
  43098. } else {
  43099. return function mergedInstanceDataFn () {
  43100. // instance merge
  43101. var instanceData = typeof childVal === 'function'
  43102. ? childVal.call(vm, vm)
  43103. : childVal;
  43104. var defaultData = typeof parentVal === 'function'
  43105. ? parentVal.call(vm, vm)
  43106. : parentVal;
  43107. if (instanceData) {
  43108. return mergeData(instanceData, defaultData)
  43109. } else {
  43110. return defaultData
  43111. }
  43112. }
  43113. }
  43114. }
  43115. strats.data = function (
  43116. parentVal,
  43117. childVal,
  43118. vm
  43119. ) {
  43120. if (!vm) {
  43121. if (childVal && typeof childVal !== 'function') {
  43122. warn(
  43123. 'The "data" option should be a function ' +
  43124. 'that returns a per-instance value in component ' +
  43125. 'definitions.',
  43126. vm
  43127. );
  43128. return parentVal
  43129. }
  43130. return mergeDataOrFn(parentVal, childVal)
  43131. }
  43132. return mergeDataOrFn(parentVal, childVal, vm)
  43133. };
  43134. /**
  43135. * Hooks and props are merged as arrays.
  43136. */
  43137. function mergeHook (
  43138. parentVal,
  43139. childVal
  43140. ) {
  43141. var res = childVal
  43142. ? parentVal
  43143. ? parentVal.concat(childVal)
  43144. : Array.isArray(childVal)
  43145. ? childVal
  43146. : [childVal]
  43147. : parentVal;
  43148. return res
  43149. ? dedupeHooks(res)
  43150. : res
  43151. }
  43152. function dedupeHooks (hooks) {
  43153. var res = [];
  43154. for (var i = 0; i < hooks.length; i++) {
  43155. if (res.indexOf(hooks[i]) === -1) {
  43156. res.push(hooks[i]);
  43157. }
  43158. }
  43159. return res
  43160. }
  43161. LIFECYCLE_HOOKS.forEach(function (hook) {
  43162. strats[hook] = mergeHook;
  43163. });
  43164. /**
  43165. * Assets
  43166. *
  43167. * When a vm is present (instance creation), we need to do
  43168. * a three-way merge between constructor options, instance
  43169. * options and parent options.
  43170. */
  43171. function mergeAssets (
  43172. parentVal,
  43173. childVal,
  43174. vm,
  43175. key
  43176. ) {
  43177. var res = Object.create(parentVal || null);
  43178. if (childVal) {
  43179. assertObjectType(key, childVal, vm);
  43180. return extend(res, childVal)
  43181. } else {
  43182. return res
  43183. }
  43184. }
  43185. ASSET_TYPES.forEach(function (type) {
  43186. strats[type + 's'] = mergeAssets;
  43187. });
  43188. /**
  43189. * Watchers.
  43190. *
  43191. * Watchers hashes should not overwrite one
  43192. * another, so we merge them as arrays.
  43193. */
  43194. strats.watch = function (
  43195. parentVal,
  43196. childVal,
  43197. vm,
  43198. key
  43199. ) {
  43200. // work around Firefox's Object.prototype.watch...
  43201. if (parentVal === nativeWatch) { parentVal = undefined; }
  43202. if (childVal === nativeWatch) { childVal = undefined; }
  43203. /* istanbul ignore if */
  43204. if (!childVal) { return Object.create(parentVal || null) }
  43205. {
  43206. assertObjectType(key, childVal, vm);
  43207. }
  43208. if (!parentVal) { return childVal }
  43209. var ret = {};
  43210. extend(ret, parentVal);
  43211. for (var key$1 in childVal) {
  43212. var parent = ret[key$1];
  43213. var child = childVal[key$1];
  43214. if (parent && !Array.isArray(parent)) {
  43215. parent = [parent];
  43216. }
  43217. ret[key$1] = parent
  43218. ? parent.concat(child)
  43219. : Array.isArray(child) ? child : [child];
  43220. }
  43221. return ret
  43222. };
  43223. /**
  43224. * Other object hashes.
  43225. */
  43226. strats.props =
  43227. strats.methods =
  43228. strats.inject =
  43229. strats.computed = function (
  43230. parentVal,
  43231. childVal,
  43232. vm,
  43233. key
  43234. ) {
  43235. if (childVal && "development" !== 'production') {
  43236. assertObjectType(key, childVal, vm);
  43237. }
  43238. if (!parentVal) { return childVal }
  43239. var ret = Object.create(null);
  43240. extend(ret, parentVal);
  43241. if (childVal) { extend(ret, childVal); }
  43242. return ret
  43243. };
  43244. strats.provide = mergeDataOrFn;
  43245. /**
  43246. * Default strategy.
  43247. */
  43248. var defaultStrat = function (parentVal, childVal) {
  43249. return childVal === undefined
  43250. ? parentVal
  43251. : childVal
  43252. };
  43253. /**
  43254. * Validate component names
  43255. */
  43256. function checkComponents (options) {
  43257. for (var key in options.components) {
  43258. validateComponentName(key);
  43259. }
  43260. }
  43261. function validateComponentName (name) {
  43262. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  43263. warn(
  43264. 'Invalid component name: "' + name + '". Component names ' +
  43265. 'should conform to valid custom element name in html5 specification.'
  43266. );
  43267. }
  43268. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  43269. warn(
  43270. 'Do not use built-in or reserved HTML elements as component ' +
  43271. 'id: ' + name
  43272. );
  43273. }
  43274. }
  43275. /**
  43276. * Ensure all props option syntax are normalized into the
  43277. * Object-based format.
  43278. */
  43279. function normalizeProps (options, vm) {
  43280. var props = options.props;
  43281. if (!props) { return }
  43282. var res = {};
  43283. var i, val, name;
  43284. if (Array.isArray(props)) {
  43285. i = props.length;
  43286. while (i--) {
  43287. val = props[i];
  43288. if (typeof val === 'string') {
  43289. name = camelize(val);
  43290. res[name] = { type: null };
  43291. } else {
  43292. warn('props must be strings when using array syntax.');
  43293. }
  43294. }
  43295. } else if (isPlainObject(props)) {
  43296. for (var key in props) {
  43297. val = props[key];
  43298. name = camelize(key);
  43299. res[name] = isPlainObject(val)
  43300. ? val
  43301. : { type: val };
  43302. }
  43303. } else {
  43304. warn(
  43305. "Invalid value for option \"props\": expected an Array or an Object, " +
  43306. "but got " + (toRawType(props)) + ".",
  43307. vm
  43308. );
  43309. }
  43310. options.props = res;
  43311. }
  43312. /**
  43313. * Normalize all injections into Object-based format
  43314. */
  43315. function normalizeInject (options, vm) {
  43316. var inject = options.inject;
  43317. if (!inject) { return }
  43318. var normalized = options.inject = {};
  43319. if (Array.isArray(inject)) {
  43320. for (var i = 0; i < inject.length; i++) {
  43321. normalized[inject[i]] = { from: inject[i] };
  43322. }
  43323. } else if (isPlainObject(inject)) {
  43324. for (var key in inject) {
  43325. var val = inject[key];
  43326. normalized[key] = isPlainObject(val)
  43327. ? extend({ from: key }, val)
  43328. : { from: val };
  43329. }
  43330. } else {
  43331. warn(
  43332. "Invalid value for option \"inject\": expected an Array or an Object, " +
  43333. "but got " + (toRawType(inject)) + ".",
  43334. vm
  43335. );
  43336. }
  43337. }
  43338. /**
  43339. * Normalize raw function directives into object format.
  43340. */
  43341. function normalizeDirectives (options) {
  43342. var dirs = options.directives;
  43343. if (dirs) {
  43344. for (var key in dirs) {
  43345. var def$$1 = dirs[key];
  43346. if (typeof def$$1 === 'function') {
  43347. dirs[key] = { bind: def$$1, update: def$$1 };
  43348. }
  43349. }
  43350. }
  43351. }
  43352. function assertObjectType (name, value, vm) {
  43353. if (!isPlainObject(value)) {
  43354. warn(
  43355. "Invalid value for option \"" + name + "\": expected an Object, " +
  43356. "but got " + (toRawType(value)) + ".",
  43357. vm
  43358. );
  43359. }
  43360. }
  43361. /**
  43362. * Merge two option objects into a new one.
  43363. * Core utility used in both instantiation and inheritance.
  43364. */
  43365. function mergeOptions (
  43366. parent,
  43367. child,
  43368. vm
  43369. ) {
  43370. {
  43371. checkComponents(child);
  43372. }
  43373. if (typeof child === 'function') {
  43374. child = child.options;
  43375. }
  43376. normalizeProps(child, vm);
  43377. normalizeInject(child, vm);
  43378. normalizeDirectives(child);
  43379. // Apply extends and mixins on the child options,
  43380. // but only if it is a raw options object that isn't
  43381. // the result of another mergeOptions call.
  43382. // Only merged options has the _base property.
  43383. if (!child._base) {
  43384. if (child.extends) {
  43385. parent = mergeOptions(parent, child.extends, vm);
  43386. }
  43387. if (child.mixins) {
  43388. for (var i = 0, l = child.mixins.length; i < l; i++) {
  43389. parent = mergeOptions(parent, child.mixins[i], vm);
  43390. }
  43391. }
  43392. }
  43393. var options = {};
  43394. var key;
  43395. for (key in parent) {
  43396. mergeField(key);
  43397. }
  43398. for (key in child) {
  43399. if (!hasOwn(parent, key)) {
  43400. mergeField(key);
  43401. }
  43402. }
  43403. function mergeField (key) {
  43404. var strat = strats[key] || defaultStrat;
  43405. options[key] = strat(parent[key], child[key], vm, key);
  43406. }
  43407. return options
  43408. }
  43409. /**
  43410. * Resolve an asset.
  43411. * This function is used because child instances need access
  43412. * to assets defined in its ancestor chain.
  43413. */
  43414. function resolveAsset (
  43415. options,
  43416. type,
  43417. id,
  43418. warnMissing
  43419. ) {
  43420. /* istanbul ignore if */
  43421. if (typeof id !== 'string') {
  43422. return
  43423. }
  43424. var assets = options[type];
  43425. // check local registration variations first
  43426. if (hasOwn(assets, id)) { return assets[id] }
  43427. var camelizedId = camelize(id);
  43428. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  43429. var PascalCaseId = capitalize(camelizedId);
  43430. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  43431. // fallback to prototype chain
  43432. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  43433. if (warnMissing && !res) {
  43434. warn(
  43435. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  43436. options
  43437. );
  43438. }
  43439. return res
  43440. }
  43441. /* */
  43442. function validateProp (
  43443. key,
  43444. propOptions,
  43445. propsData,
  43446. vm
  43447. ) {
  43448. var prop = propOptions[key];
  43449. var absent = !hasOwn(propsData, key);
  43450. var value = propsData[key];
  43451. // boolean casting
  43452. var booleanIndex = getTypeIndex(Boolean, prop.type);
  43453. if (booleanIndex > -1) {
  43454. if (absent && !hasOwn(prop, 'default')) {
  43455. value = false;
  43456. } else if (value === '' || value === hyphenate(key)) {
  43457. // only cast empty string / same name to boolean if
  43458. // boolean has higher priority
  43459. var stringIndex = getTypeIndex(String, prop.type);
  43460. if (stringIndex < 0 || booleanIndex < stringIndex) {
  43461. value = true;
  43462. }
  43463. }
  43464. }
  43465. // check default value
  43466. if (value === undefined) {
  43467. value = getPropDefaultValue(vm, prop, key);
  43468. // since the default value is a fresh copy,
  43469. // make sure to observe it.
  43470. var prevShouldObserve = shouldObserve;
  43471. toggleObserving(true);
  43472. observe(value);
  43473. toggleObserving(prevShouldObserve);
  43474. }
  43475. {
  43476. assertProp(prop, key, value, vm, absent);
  43477. }
  43478. return value
  43479. }
  43480. /**
  43481. * Get the default value of a prop.
  43482. */
  43483. function getPropDefaultValue (vm, prop, key) {
  43484. // no default, return undefined
  43485. if (!hasOwn(prop, 'default')) {
  43486. return undefined
  43487. }
  43488. var def = prop.default;
  43489. // warn against non-factory defaults for Object & Array
  43490. if (isObject(def)) {
  43491. warn(
  43492. 'Invalid default value for prop "' + key + '": ' +
  43493. 'Props with type Object/Array must use a factory function ' +
  43494. 'to return the default value.',
  43495. vm
  43496. );
  43497. }
  43498. // the raw prop value was also undefined from previous render,
  43499. // return previous default value to avoid unnecessary watcher trigger
  43500. if (vm && vm.$options.propsData &&
  43501. vm.$options.propsData[key] === undefined &&
  43502. vm._props[key] !== undefined
  43503. ) {
  43504. return vm._props[key]
  43505. }
  43506. // call factory function for non-Function types
  43507. // a value is Function if its prototype is function even across different execution context
  43508. return typeof def === 'function' && getType(prop.type) !== 'Function'
  43509. ? def.call(vm)
  43510. : def
  43511. }
  43512. /**
  43513. * Assert whether a prop is valid.
  43514. */
  43515. function assertProp (
  43516. prop,
  43517. name,
  43518. value,
  43519. vm,
  43520. absent
  43521. ) {
  43522. if (prop.required && absent) {
  43523. warn(
  43524. 'Missing required prop: "' + name + '"',
  43525. vm
  43526. );
  43527. return
  43528. }
  43529. if (value == null && !prop.required) {
  43530. return
  43531. }
  43532. var type = prop.type;
  43533. var valid = !type || type === true;
  43534. var expectedTypes = [];
  43535. if (type) {
  43536. if (!Array.isArray(type)) {
  43537. type = [type];
  43538. }
  43539. for (var i = 0; i < type.length && !valid; i++) {
  43540. var assertedType = assertType(value, type[i]);
  43541. expectedTypes.push(assertedType.expectedType || '');
  43542. valid = assertedType.valid;
  43543. }
  43544. }
  43545. if (!valid) {
  43546. warn(
  43547. getInvalidTypeMessage(name, value, expectedTypes),
  43548. vm
  43549. );
  43550. return
  43551. }
  43552. var validator = prop.validator;
  43553. if (validator) {
  43554. if (!validator(value)) {
  43555. warn(
  43556. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  43557. vm
  43558. );
  43559. }
  43560. }
  43561. }
  43562. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  43563. function assertType (value, type) {
  43564. var valid;
  43565. var expectedType = getType(type);
  43566. if (simpleCheckRE.test(expectedType)) {
  43567. var t = typeof value;
  43568. valid = t === expectedType.toLowerCase();
  43569. // for primitive wrapper objects
  43570. if (!valid && t === 'object') {
  43571. valid = value instanceof type;
  43572. }
  43573. } else if (expectedType === 'Object') {
  43574. valid = isPlainObject(value);
  43575. } else if (expectedType === 'Array') {
  43576. valid = Array.isArray(value);
  43577. } else {
  43578. valid = value instanceof type;
  43579. }
  43580. return {
  43581. valid: valid,
  43582. expectedType: expectedType
  43583. }
  43584. }
  43585. /**
  43586. * Use function string name to check built-in types,
  43587. * because a simple equality check will fail when running
  43588. * across different vms / iframes.
  43589. */
  43590. function getType (fn) {
  43591. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  43592. return match ? match[1] : ''
  43593. }
  43594. function isSameType (a, b) {
  43595. return getType(a) === getType(b)
  43596. }
  43597. function getTypeIndex (type, expectedTypes) {
  43598. if (!Array.isArray(expectedTypes)) {
  43599. return isSameType(expectedTypes, type) ? 0 : -1
  43600. }
  43601. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  43602. if (isSameType(expectedTypes[i], type)) {
  43603. return i
  43604. }
  43605. }
  43606. return -1
  43607. }
  43608. function getInvalidTypeMessage (name, value, expectedTypes) {
  43609. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  43610. " Expected " + (expectedTypes.map(capitalize).join(', '));
  43611. var expectedType = expectedTypes[0];
  43612. var receivedType = toRawType(value);
  43613. var expectedValue = styleValue(value, expectedType);
  43614. var receivedValue = styleValue(value, receivedType);
  43615. // check if we need to specify expected value
  43616. if (expectedTypes.length === 1 &&
  43617. isExplicable(expectedType) &&
  43618. !isBoolean(expectedType, receivedType)) {
  43619. message += " with value " + expectedValue;
  43620. }
  43621. message += ", got " + receivedType + " ";
  43622. // check if we need to specify received value
  43623. if (isExplicable(receivedType)) {
  43624. message += "with value " + receivedValue + ".";
  43625. }
  43626. return message
  43627. }
  43628. function styleValue (value, type) {
  43629. if (type === 'String') {
  43630. return ("\"" + value + "\"")
  43631. } else if (type === 'Number') {
  43632. return ("" + (Number(value)))
  43633. } else {
  43634. return ("" + value)
  43635. }
  43636. }
  43637. function isExplicable (value) {
  43638. var explicitTypes = ['string', 'number', 'boolean'];
  43639. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  43640. }
  43641. function isBoolean () {
  43642. var args = [], len = arguments.length;
  43643. while ( len-- ) args[ len ] = arguments[ len ];
  43644. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  43645. }
  43646. /* */
  43647. function handleError (err, vm, info) {
  43648. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  43649. // See: https://github.com/vuejs/vuex/issues/1505
  43650. pushTarget();
  43651. try {
  43652. if (vm) {
  43653. var cur = vm;
  43654. while ((cur = cur.$parent)) {
  43655. var hooks = cur.$options.errorCaptured;
  43656. if (hooks) {
  43657. for (var i = 0; i < hooks.length; i++) {
  43658. try {
  43659. var capture = hooks[i].call(cur, err, vm, info) === false;
  43660. if (capture) { return }
  43661. } catch (e) {
  43662. globalHandleError(e, cur, 'errorCaptured hook');
  43663. }
  43664. }
  43665. }
  43666. }
  43667. }
  43668. globalHandleError(err, vm, info);
  43669. } finally {
  43670. popTarget();
  43671. }
  43672. }
  43673. function invokeWithErrorHandling (
  43674. handler,
  43675. context,
  43676. args,
  43677. vm,
  43678. info
  43679. ) {
  43680. var res;
  43681. try {
  43682. res = args ? handler.apply(context, args) : handler.call(context);
  43683. if (res && !res._isVue && isPromise(res) && !res._handled) {
  43684. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  43685. // issue #9511
  43686. // avoid catch triggering multiple times when nested calls
  43687. res._handled = true;
  43688. }
  43689. } catch (e) {
  43690. handleError(e, vm, info);
  43691. }
  43692. return res
  43693. }
  43694. function globalHandleError (err, vm, info) {
  43695. if (config.errorHandler) {
  43696. try {
  43697. return config.errorHandler.call(null, err, vm, info)
  43698. } catch (e) {
  43699. // if the user intentionally throws the original error in the handler,
  43700. // do not log it twice
  43701. if (e !== err) {
  43702. logError(e, null, 'config.errorHandler');
  43703. }
  43704. }
  43705. }
  43706. logError(err, vm, info);
  43707. }
  43708. function logError (err, vm, info) {
  43709. {
  43710. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  43711. }
  43712. /* istanbul ignore else */
  43713. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  43714. console.error(err);
  43715. } else {
  43716. throw err
  43717. }
  43718. }
  43719. /* */
  43720. var isUsingMicroTask = false;
  43721. var callbacks = [];
  43722. var pending = false;
  43723. function flushCallbacks () {
  43724. pending = false;
  43725. var copies = callbacks.slice(0);
  43726. callbacks.length = 0;
  43727. for (var i = 0; i < copies.length; i++) {
  43728. copies[i]();
  43729. }
  43730. }
  43731. // Here we have async deferring wrappers using microtasks.
  43732. // In 2.5 we used (macro) tasks (in combination with microtasks).
  43733. // However, it has subtle problems when state is changed right before repaint
  43734. // (e.g. #6813, out-in transitions).
  43735. // Also, using (macro) tasks in event handler would cause some weird behaviors
  43736. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  43737. // So we now use microtasks everywhere, again.
  43738. // A major drawback of this tradeoff is that there are some scenarios
  43739. // where microtasks have too high a priority and fire in between supposedly
  43740. // sequential events (e.g. #4521, #6690, which have workarounds)
  43741. // or even between bubbling of the same event (#6566).
  43742. var timerFunc;
  43743. // The nextTick behavior leverages the microtask queue, which can be accessed
  43744. // via either native Promise.then or MutationObserver.
  43745. // MutationObserver has wider support, however it is seriously bugged in
  43746. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  43747. // completely stops working after triggering a few times... so, if native
  43748. // Promise is available, we will use it:
  43749. /* istanbul ignore next, $flow-disable-line */
  43750. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  43751. var p = Promise.resolve();
  43752. timerFunc = function () {
  43753. p.then(flushCallbacks);
  43754. // In problematic UIWebViews, Promise.then doesn't completely break, but
  43755. // it can get stuck in a weird state where callbacks are pushed into the
  43756. // microtask queue but the queue isn't being flushed, until the browser
  43757. // needs to do some other work, e.g. handle a timer. Therefore we can
  43758. // "force" the microtask queue to be flushed by adding an empty timer.
  43759. if (isIOS) { setTimeout(noop); }
  43760. };
  43761. isUsingMicroTask = true;
  43762. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  43763. isNative(MutationObserver) ||
  43764. // PhantomJS and iOS 7.x
  43765. MutationObserver.toString() === '[object MutationObserverConstructor]'
  43766. )) {
  43767. // Use MutationObserver where native Promise is not available,
  43768. // e.g. PhantomJS, iOS7, Android 4.4
  43769. // (#6466 MutationObserver is unreliable in IE11)
  43770. var counter = 1;
  43771. var observer = new MutationObserver(flushCallbacks);
  43772. var textNode = document.createTextNode(String(counter));
  43773. observer.observe(textNode, {
  43774. characterData: true
  43775. });
  43776. timerFunc = function () {
  43777. counter = (counter + 1) % 2;
  43778. textNode.data = String(counter);
  43779. };
  43780. isUsingMicroTask = true;
  43781. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  43782. // Fallback to setImmediate.
  43783. // Technically it leverages the (macro) task queue,
  43784. // but it is still a better choice than setTimeout.
  43785. timerFunc = function () {
  43786. setImmediate(flushCallbacks);
  43787. };
  43788. } else {
  43789. // Fallback to setTimeout.
  43790. timerFunc = function () {
  43791. setTimeout(flushCallbacks, 0);
  43792. };
  43793. }
  43794. function nextTick (cb, ctx) {
  43795. var _resolve;
  43796. callbacks.push(function () {
  43797. if (cb) {
  43798. try {
  43799. cb.call(ctx);
  43800. } catch (e) {
  43801. handleError(e, ctx, 'nextTick');
  43802. }
  43803. } else if (_resolve) {
  43804. _resolve(ctx);
  43805. }
  43806. });
  43807. if (!pending) {
  43808. pending = true;
  43809. timerFunc();
  43810. }
  43811. // $flow-disable-line
  43812. if (!cb && typeof Promise !== 'undefined') {
  43813. return new Promise(function (resolve) {
  43814. _resolve = resolve;
  43815. })
  43816. }
  43817. }
  43818. /* */
  43819. var mark;
  43820. var measure;
  43821. {
  43822. var perf = inBrowser && window.performance;
  43823. /* istanbul ignore if */
  43824. if (
  43825. perf &&
  43826. perf.mark &&
  43827. perf.measure &&
  43828. perf.clearMarks &&
  43829. perf.clearMeasures
  43830. ) {
  43831. mark = function (tag) { return perf.mark(tag); };
  43832. measure = function (name, startTag, endTag) {
  43833. perf.measure(name, startTag, endTag);
  43834. perf.clearMarks(startTag);
  43835. perf.clearMarks(endTag);
  43836. // perf.clearMeasures(name)
  43837. };
  43838. }
  43839. }
  43840. /* not type checking this file because flow doesn't play well with Proxy */
  43841. var initProxy;
  43842. {
  43843. var allowedGlobals = makeMap(
  43844. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  43845. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  43846. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  43847. 'require' // for Webpack/Browserify
  43848. );
  43849. var warnNonPresent = function (target, key) {
  43850. warn(
  43851. "Property or method \"" + key + "\" is not defined on the instance but " +
  43852. 'referenced during render. Make sure that this property is reactive, ' +
  43853. 'either in the data option, or for class-based components, by ' +
  43854. 'initializing the property. ' +
  43855. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  43856. target
  43857. );
  43858. };
  43859. var warnReservedPrefix = function (target, key) {
  43860. warn(
  43861. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  43862. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  43863. 'prevent conflicts with Vue internals. ' +
  43864. 'See: https://vuejs.org/v2/api/#data',
  43865. target
  43866. );
  43867. };
  43868. var hasProxy =
  43869. typeof Proxy !== 'undefined' && isNative(Proxy);
  43870. if (hasProxy) {
  43871. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  43872. config.keyCodes = new Proxy(config.keyCodes, {
  43873. set: function set (target, key, value) {
  43874. if (isBuiltInModifier(key)) {
  43875. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  43876. return false
  43877. } else {
  43878. target[key] = value;
  43879. return true
  43880. }
  43881. }
  43882. });
  43883. }
  43884. var hasHandler = {
  43885. has: function has (target, key) {
  43886. var has = key in target;
  43887. var isAllowed = allowedGlobals(key) ||
  43888. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  43889. if (!has && !isAllowed) {
  43890. if (key in target.$data) { warnReservedPrefix(target, key); }
  43891. else { warnNonPresent(target, key); }
  43892. }
  43893. return has || !isAllowed
  43894. }
  43895. };
  43896. var getHandler = {
  43897. get: function get (target, key) {
  43898. if (typeof key === 'string' && !(key in target)) {
  43899. if (key in target.$data) { warnReservedPrefix(target, key); }
  43900. else { warnNonPresent(target, key); }
  43901. }
  43902. return target[key]
  43903. }
  43904. };
  43905. initProxy = function initProxy (vm) {
  43906. if (hasProxy) {
  43907. // determine which proxy handler to use
  43908. var options = vm.$options;
  43909. var handlers = options.render && options.render._withStripped
  43910. ? getHandler
  43911. : hasHandler;
  43912. vm._renderProxy = new Proxy(vm, handlers);
  43913. } else {
  43914. vm._renderProxy = vm;
  43915. }
  43916. };
  43917. }
  43918. /* */
  43919. var seenObjects = new _Set();
  43920. /**
  43921. * Recursively traverse an object to evoke all converted
  43922. * getters, so that every nested property inside the object
  43923. * is collected as a "deep" dependency.
  43924. */
  43925. function traverse (val) {
  43926. _traverse(val, seenObjects);
  43927. seenObjects.clear();
  43928. }
  43929. function _traverse (val, seen) {
  43930. var i, keys;
  43931. var isA = Array.isArray(val);
  43932. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  43933. return
  43934. }
  43935. if (val.__ob__) {
  43936. var depId = val.__ob__.dep.id;
  43937. if (seen.has(depId)) {
  43938. return
  43939. }
  43940. seen.add(depId);
  43941. }
  43942. if (isA) {
  43943. i = val.length;
  43944. while (i--) { _traverse(val[i], seen); }
  43945. } else {
  43946. keys = Object.keys(val);
  43947. i = keys.length;
  43948. while (i--) { _traverse(val[keys[i]], seen); }
  43949. }
  43950. }
  43951. /* */
  43952. var normalizeEvent = cached(function (name) {
  43953. var passive = name.charAt(0) === '&';
  43954. name = passive ? name.slice(1) : name;
  43955. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  43956. name = once$$1 ? name.slice(1) : name;
  43957. var capture = name.charAt(0) === '!';
  43958. name = capture ? name.slice(1) : name;
  43959. return {
  43960. name: name,
  43961. once: once$$1,
  43962. capture: capture,
  43963. passive: passive
  43964. }
  43965. });
  43966. function createFnInvoker (fns, vm) {
  43967. function invoker () {
  43968. var arguments$1 = arguments;
  43969. var fns = invoker.fns;
  43970. if (Array.isArray(fns)) {
  43971. var cloned = fns.slice();
  43972. for (var i = 0; i < cloned.length; i++) {
  43973. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  43974. }
  43975. } else {
  43976. // return handler return value for single handlers
  43977. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  43978. }
  43979. }
  43980. invoker.fns = fns;
  43981. return invoker
  43982. }
  43983. function updateListeners (
  43984. on,
  43985. oldOn,
  43986. add,
  43987. remove$$1,
  43988. createOnceHandler,
  43989. vm
  43990. ) {
  43991. var name, def$$1, cur, old, event;
  43992. for (name in on) {
  43993. def$$1 = cur = on[name];
  43994. old = oldOn[name];
  43995. event = normalizeEvent(name);
  43996. if (isUndef(cur)) {
  43997. warn(
  43998. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  43999. vm
  44000. );
  44001. } else if (isUndef(old)) {
  44002. if (isUndef(cur.fns)) {
  44003. cur = on[name] = createFnInvoker(cur, vm);
  44004. }
  44005. if (isTrue(event.once)) {
  44006. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  44007. }
  44008. add(event.name, cur, event.capture, event.passive, event.params);
  44009. } else if (cur !== old) {
  44010. old.fns = cur;
  44011. on[name] = old;
  44012. }
  44013. }
  44014. for (name in oldOn) {
  44015. if (isUndef(on[name])) {
  44016. event = normalizeEvent(name);
  44017. remove$$1(event.name, oldOn[name], event.capture);
  44018. }
  44019. }
  44020. }
  44021. /* */
  44022. function mergeVNodeHook (def, hookKey, hook) {
  44023. if (def instanceof VNode) {
  44024. def = def.data.hook || (def.data.hook = {});
  44025. }
  44026. var invoker;
  44027. var oldHook = def[hookKey];
  44028. function wrappedHook () {
  44029. hook.apply(this, arguments);
  44030. // important: remove merged hook to ensure it's called only once
  44031. // and prevent memory leak
  44032. remove(invoker.fns, wrappedHook);
  44033. }
  44034. if (isUndef(oldHook)) {
  44035. // no existing hook
  44036. invoker = createFnInvoker([wrappedHook]);
  44037. } else {
  44038. /* istanbul ignore if */
  44039. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  44040. // already a merged invoker
  44041. invoker = oldHook;
  44042. invoker.fns.push(wrappedHook);
  44043. } else {
  44044. // existing plain hook
  44045. invoker = createFnInvoker([oldHook, wrappedHook]);
  44046. }
  44047. }
  44048. invoker.merged = true;
  44049. def[hookKey] = invoker;
  44050. }
  44051. /* */
  44052. function extractPropsFromVNodeData (
  44053. data,
  44054. Ctor,
  44055. tag
  44056. ) {
  44057. // we are only extracting raw values here.
  44058. // validation and default values are handled in the child
  44059. // component itself.
  44060. var propOptions = Ctor.options.props;
  44061. if (isUndef(propOptions)) {
  44062. return
  44063. }
  44064. var res = {};
  44065. var attrs = data.attrs;
  44066. var props = data.props;
  44067. if (isDef(attrs) || isDef(props)) {
  44068. for (var key in propOptions) {
  44069. var altKey = hyphenate(key);
  44070. {
  44071. var keyInLowerCase = key.toLowerCase();
  44072. if (
  44073. key !== keyInLowerCase &&
  44074. attrs && hasOwn(attrs, keyInLowerCase)
  44075. ) {
  44076. tip(
  44077. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  44078. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  44079. " \"" + key + "\". " +
  44080. "Note that HTML attributes are case-insensitive and camelCased " +
  44081. "props need to use their kebab-case equivalents when using in-DOM " +
  44082. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  44083. );
  44084. }
  44085. }
  44086. checkProp(res, props, key, altKey, true) ||
  44087. checkProp(res, attrs, key, altKey, false);
  44088. }
  44089. }
  44090. return res
  44091. }
  44092. function checkProp (
  44093. res,
  44094. hash,
  44095. key,
  44096. altKey,
  44097. preserve
  44098. ) {
  44099. if (isDef(hash)) {
  44100. if (hasOwn(hash, key)) {
  44101. res[key] = hash[key];
  44102. if (!preserve) {
  44103. delete hash[key];
  44104. }
  44105. return true
  44106. } else if (hasOwn(hash, altKey)) {
  44107. res[key] = hash[altKey];
  44108. if (!preserve) {
  44109. delete hash[altKey];
  44110. }
  44111. return true
  44112. }
  44113. }
  44114. return false
  44115. }
  44116. /* */
  44117. // The template compiler attempts to minimize the need for normalization by
  44118. // statically analyzing the template at compile time.
  44119. //
  44120. // For plain HTML markup, normalization can be completely skipped because the
  44121. // generated render function is guaranteed to return Array<VNode>. There are
  44122. // two cases where extra normalization is needed:
  44123. // 1. When the children contains components - because a functional component
  44124. // may return an Array instead of a single root. In this case, just a simple
  44125. // normalization is needed - if any child is an Array, we flatten the whole
  44126. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  44127. // because functional components already normalize their own children.
  44128. function simpleNormalizeChildren (children) {
  44129. for (var i = 0; i < children.length; i++) {
  44130. if (Array.isArray(children[i])) {
  44131. return Array.prototype.concat.apply([], children)
  44132. }
  44133. }
  44134. return children
  44135. }
  44136. // 2. When the children contains constructs that always generated nested Arrays,
  44137. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  44138. // with hand-written render functions / JSX. In such cases a full normalization
  44139. // is needed to cater to all possible types of children values.
  44140. function normalizeChildren (children) {
  44141. return isPrimitive(children)
  44142. ? [createTextVNode(children)]
  44143. : Array.isArray(children)
  44144. ? normalizeArrayChildren(children)
  44145. : undefined
  44146. }
  44147. function isTextNode (node) {
  44148. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  44149. }
  44150. function normalizeArrayChildren (children, nestedIndex) {
  44151. var res = [];
  44152. var i, c, lastIndex, last;
  44153. for (i = 0; i < children.length; i++) {
  44154. c = children[i];
  44155. if (isUndef(c) || typeof c === 'boolean') { continue }
  44156. lastIndex = res.length - 1;
  44157. last = res[lastIndex];
  44158. // nested
  44159. if (Array.isArray(c)) {
  44160. if (c.length > 0) {
  44161. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  44162. // merge adjacent text nodes
  44163. if (isTextNode(c[0]) && isTextNode(last)) {
  44164. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  44165. c.shift();
  44166. }
  44167. res.push.apply(res, c);
  44168. }
  44169. } else if (isPrimitive(c)) {
  44170. if (isTextNode(last)) {
  44171. // merge adjacent text nodes
  44172. // this is necessary for SSR hydration because text nodes are
  44173. // essentially merged when rendered to HTML strings
  44174. res[lastIndex] = createTextVNode(last.text + c);
  44175. } else if (c !== '') {
  44176. // convert primitive to vnode
  44177. res.push(createTextVNode(c));
  44178. }
  44179. } else {
  44180. if (isTextNode(c) && isTextNode(last)) {
  44181. // merge adjacent text nodes
  44182. res[lastIndex] = createTextVNode(last.text + c.text);
  44183. } else {
  44184. // default key for nested array children (likely generated by v-for)
  44185. if (isTrue(children._isVList) &&
  44186. isDef(c.tag) &&
  44187. isUndef(c.key) &&
  44188. isDef(nestedIndex)) {
  44189. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  44190. }
  44191. res.push(c);
  44192. }
  44193. }
  44194. }
  44195. return res
  44196. }
  44197. /* */
  44198. function initProvide (vm) {
  44199. var provide = vm.$options.provide;
  44200. if (provide) {
  44201. vm._provided = typeof provide === 'function'
  44202. ? provide.call(vm)
  44203. : provide;
  44204. }
  44205. }
  44206. function initInjections (vm) {
  44207. var result = resolveInject(vm.$options.inject, vm);
  44208. if (result) {
  44209. toggleObserving(false);
  44210. Object.keys(result).forEach(function (key) {
  44211. /* istanbul ignore else */
  44212. {
  44213. defineReactive$$1(vm, key, result[key], function () {
  44214. warn(
  44215. "Avoid mutating an injected value directly since the changes will be " +
  44216. "overwritten whenever the provided component re-renders. " +
  44217. "injection being mutated: \"" + key + "\"",
  44218. vm
  44219. );
  44220. });
  44221. }
  44222. });
  44223. toggleObserving(true);
  44224. }
  44225. }
  44226. function resolveInject (inject, vm) {
  44227. if (inject) {
  44228. // inject is :any because flow is not smart enough to figure out cached
  44229. var result = Object.create(null);
  44230. var keys = hasSymbol
  44231. ? Reflect.ownKeys(inject)
  44232. : Object.keys(inject);
  44233. for (var i = 0; i < keys.length; i++) {
  44234. var key = keys[i];
  44235. // #6574 in case the inject object is observed...
  44236. if (key === '__ob__') { continue }
  44237. var provideKey = inject[key].from;
  44238. var source = vm;
  44239. while (source) {
  44240. if (source._provided && hasOwn(source._provided, provideKey)) {
  44241. result[key] = source._provided[provideKey];
  44242. break
  44243. }
  44244. source = source.$parent;
  44245. }
  44246. if (!source) {
  44247. if ('default' in inject[key]) {
  44248. var provideDefault = inject[key].default;
  44249. result[key] = typeof provideDefault === 'function'
  44250. ? provideDefault.call(vm)
  44251. : provideDefault;
  44252. } else {
  44253. warn(("Injection \"" + key + "\" not found"), vm);
  44254. }
  44255. }
  44256. }
  44257. return result
  44258. }
  44259. }
  44260. /* */
  44261. /**
  44262. * Runtime helper for resolving raw children VNodes into a slot object.
  44263. */
  44264. function resolveSlots (
  44265. children,
  44266. context
  44267. ) {
  44268. if (!children || !children.length) {
  44269. return {}
  44270. }
  44271. var slots = {};
  44272. for (var i = 0, l = children.length; i < l; i++) {
  44273. var child = children[i];
  44274. var data = child.data;
  44275. // remove slot attribute if the node is resolved as a Vue slot node
  44276. if (data && data.attrs && data.attrs.slot) {
  44277. delete data.attrs.slot;
  44278. }
  44279. // named slots should only be respected if the vnode was rendered in the
  44280. // same context.
  44281. if ((child.context === context || child.fnContext === context) &&
  44282. data && data.slot != null
  44283. ) {
  44284. var name = data.slot;
  44285. var slot = (slots[name] || (slots[name] = []));
  44286. if (child.tag === 'template') {
  44287. slot.push.apply(slot, child.children || []);
  44288. } else {
  44289. slot.push(child);
  44290. }
  44291. } else {
  44292. (slots.default || (slots.default = [])).push(child);
  44293. }
  44294. }
  44295. // ignore slots that contains only whitespace
  44296. for (var name$1 in slots) {
  44297. if (slots[name$1].every(isWhitespace)) {
  44298. delete slots[name$1];
  44299. }
  44300. }
  44301. return slots
  44302. }
  44303. function isWhitespace (node) {
  44304. return (node.isComment && !node.asyncFactory) || node.text === ' '
  44305. }
  44306. /* */
  44307. function normalizeScopedSlots (
  44308. slots,
  44309. normalSlots,
  44310. prevSlots
  44311. ) {
  44312. var res;
  44313. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  44314. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  44315. var key = slots && slots.$key;
  44316. if (!slots) {
  44317. res = {};
  44318. } else if (slots._normalized) {
  44319. // fast path 1: child component re-render only, parent did not change
  44320. return slots._normalized
  44321. } else if (
  44322. isStable &&
  44323. prevSlots &&
  44324. prevSlots !== emptyObject &&
  44325. key === prevSlots.$key &&
  44326. !hasNormalSlots &&
  44327. !prevSlots.$hasNormal
  44328. ) {
  44329. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  44330. // only need to normalize once
  44331. return prevSlots
  44332. } else {
  44333. res = {};
  44334. for (var key$1 in slots) {
  44335. if (slots[key$1] && key$1[0] !== '$') {
  44336. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  44337. }
  44338. }
  44339. }
  44340. // expose normal slots on scopedSlots
  44341. for (var key$2 in normalSlots) {
  44342. if (!(key$2 in res)) {
  44343. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  44344. }
  44345. }
  44346. // avoriaz seems to mock a non-extensible $scopedSlots object
  44347. // and when that is passed down this would cause an error
  44348. if (slots && Object.isExtensible(slots)) {
  44349. (slots)._normalized = res;
  44350. }
  44351. def(res, '$stable', isStable);
  44352. def(res, '$key', key);
  44353. def(res, '$hasNormal', hasNormalSlots);
  44354. return res
  44355. }
  44356. function normalizeScopedSlot(normalSlots, key, fn) {
  44357. var normalized = function () {
  44358. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  44359. res = res && typeof res === 'object' && !Array.isArray(res)
  44360. ? [res] // single vnode
  44361. : normalizeChildren(res);
  44362. return res && (
  44363. res.length === 0 ||
  44364. (res.length === 1 && res[0].isComment) // #9658
  44365. ) ? undefined
  44366. : res
  44367. };
  44368. // this is a slot using the new v-slot syntax without scope. although it is
  44369. // compiled as a scoped slot, render fn users would expect it to be present
  44370. // on this.$slots because the usage is semantically a normal slot.
  44371. if (fn.proxy) {
  44372. Object.defineProperty(normalSlots, key, {
  44373. get: normalized,
  44374. enumerable: true,
  44375. configurable: true
  44376. });
  44377. }
  44378. return normalized
  44379. }
  44380. function proxyNormalSlot(slots, key) {
  44381. return function () { return slots[key]; }
  44382. }
  44383. /* */
  44384. /**
  44385. * Runtime helper for rendering v-for lists.
  44386. */
  44387. function renderList (
  44388. val,
  44389. render
  44390. ) {
  44391. var ret, i, l, keys, key;
  44392. if (Array.isArray(val) || typeof val === 'string') {
  44393. ret = new Array(val.length);
  44394. for (i = 0, l = val.length; i < l; i++) {
  44395. ret[i] = render(val[i], i);
  44396. }
  44397. } else if (typeof val === 'number') {
  44398. ret = new Array(val);
  44399. for (i = 0; i < val; i++) {
  44400. ret[i] = render(i + 1, i);
  44401. }
  44402. } else if (isObject(val)) {
  44403. if (hasSymbol && val[Symbol.iterator]) {
  44404. ret = [];
  44405. var iterator = val[Symbol.iterator]();
  44406. var result = iterator.next();
  44407. while (!result.done) {
  44408. ret.push(render(result.value, ret.length));
  44409. result = iterator.next();
  44410. }
  44411. } else {
  44412. keys = Object.keys(val);
  44413. ret = new Array(keys.length);
  44414. for (i = 0, l = keys.length; i < l; i++) {
  44415. key = keys[i];
  44416. ret[i] = render(val[key], key, i);
  44417. }
  44418. }
  44419. }
  44420. if (!isDef(ret)) {
  44421. ret = [];
  44422. }
  44423. (ret)._isVList = true;
  44424. return ret
  44425. }
  44426. /* */
  44427. /**
  44428. * Runtime helper for rendering <slot>
  44429. */
  44430. function renderSlot (
  44431. name,
  44432. fallback,
  44433. props,
  44434. bindObject
  44435. ) {
  44436. var scopedSlotFn = this.$scopedSlots[name];
  44437. var nodes;
  44438. if (scopedSlotFn) { // scoped slot
  44439. props = props || {};
  44440. if (bindObject) {
  44441. if (!isObject(bindObject)) {
  44442. warn(
  44443. 'slot v-bind without argument expects an Object',
  44444. this
  44445. );
  44446. }
  44447. props = extend(extend({}, bindObject), props);
  44448. }
  44449. nodes = scopedSlotFn(props) || fallback;
  44450. } else {
  44451. nodes = this.$slots[name] || fallback;
  44452. }
  44453. var target = props && props.slot;
  44454. if (target) {
  44455. return this.$createElement('template', { slot: target }, nodes)
  44456. } else {
  44457. return nodes
  44458. }
  44459. }
  44460. /* */
  44461. /**
  44462. * Runtime helper for resolving filters
  44463. */
  44464. function resolveFilter (id) {
  44465. return resolveAsset(this.$options, 'filters', id, true) || identity
  44466. }
  44467. /* */
  44468. function isKeyNotMatch (expect, actual) {
  44469. if (Array.isArray(expect)) {
  44470. return expect.indexOf(actual) === -1
  44471. } else {
  44472. return expect !== actual
  44473. }
  44474. }
  44475. /**
  44476. * Runtime helper for checking keyCodes from config.
  44477. * exposed as Vue.prototype._k
  44478. * passing in eventKeyName as last argument separately for backwards compat
  44479. */
  44480. function checkKeyCodes (
  44481. eventKeyCode,
  44482. key,
  44483. builtInKeyCode,
  44484. eventKeyName,
  44485. builtInKeyName
  44486. ) {
  44487. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  44488. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  44489. return isKeyNotMatch(builtInKeyName, eventKeyName)
  44490. } else if (mappedKeyCode) {
  44491. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  44492. } else if (eventKeyName) {
  44493. return hyphenate(eventKeyName) !== key
  44494. }
  44495. }
  44496. /* */
  44497. /**
  44498. * Runtime helper for merging v-bind="object" into a VNode's data.
  44499. */
  44500. function bindObjectProps (
  44501. data,
  44502. tag,
  44503. value,
  44504. asProp,
  44505. isSync
  44506. ) {
  44507. if (value) {
  44508. if (!isObject(value)) {
  44509. warn(
  44510. 'v-bind without argument expects an Object or Array value',
  44511. this
  44512. );
  44513. } else {
  44514. if (Array.isArray(value)) {
  44515. value = toObject(value);
  44516. }
  44517. var hash;
  44518. var loop = function ( key ) {
  44519. if (
  44520. key === 'class' ||
  44521. key === 'style' ||
  44522. isReservedAttribute(key)
  44523. ) {
  44524. hash = data;
  44525. } else {
  44526. var type = data.attrs && data.attrs.type;
  44527. hash = asProp || config.mustUseProp(tag, type, key)
  44528. ? data.domProps || (data.domProps = {})
  44529. : data.attrs || (data.attrs = {});
  44530. }
  44531. var camelizedKey = camelize(key);
  44532. var hyphenatedKey = hyphenate(key);
  44533. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  44534. hash[key] = value[key];
  44535. if (isSync) {
  44536. var on = data.on || (data.on = {});
  44537. on[("update:" + key)] = function ($event) {
  44538. value[key] = $event;
  44539. };
  44540. }
  44541. }
  44542. };
  44543. for (var key in value) loop( key );
  44544. }
  44545. }
  44546. return data
  44547. }
  44548. /* */
  44549. /**
  44550. * Runtime helper for rendering static trees.
  44551. */
  44552. function renderStatic (
  44553. index,
  44554. isInFor
  44555. ) {
  44556. var cached = this._staticTrees || (this._staticTrees = []);
  44557. var tree = cached[index];
  44558. // if has already-rendered static tree and not inside v-for,
  44559. // we can reuse the same tree.
  44560. if (tree && !isInFor) {
  44561. return tree
  44562. }
  44563. // otherwise, render a fresh tree.
  44564. tree = cached[index] = this.$options.staticRenderFns[index].call(
  44565. this._renderProxy,
  44566. null,
  44567. this // for render fns generated for functional component templates
  44568. );
  44569. markStatic(tree, ("__static__" + index), false);
  44570. return tree
  44571. }
  44572. /**
  44573. * Runtime helper for v-once.
  44574. * Effectively it means marking the node as static with a unique key.
  44575. */
  44576. function markOnce (
  44577. tree,
  44578. index,
  44579. key
  44580. ) {
  44581. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  44582. return tree
  44583. }
  44584. function markStatic (
  44585. tree,
  44586. key,
  44587. isOnce
  44588. ) {
  44589. if (Array.isArray(tree)) {
  44590. for (var i = 0; i < tree.length; i++) {
  44591. if (tree[i] && typeof tree[i] !== 'string') {
  44592. markStaticNode(tree[i], (key + "_" + i), isOnce);
  44593. }
  44594. }
  44595. } else {
  44596. markStaticNode(tree, key, isOnce);
  44597. }
  44598. }
  44599. function markStaticNode (node, key, isOnce) {
  44600. node.isStatic = true;
  44601. node.key = key;
  44602. node.isOnce = isOnce;
  44603. }
  44604. /* */
  44605. function bindObjectListeners (data, value) {
  44606. if (value) {
  44607. if (!isPlainObject(value)) {
  44608. warn(
  44609. 'v-on without argument expects an Object value',
  44610. this
  44611. );
  44612. } else {
  44613. var on = data.on = data.on ? extend({}, data.on) : {};
  44614. for (var key in value) {
  44615. var existing = on[key];
  44616. var ours = value[key];
  44617. on[key] = existing ? [].concat(existing, ours) : ours;
  44618. }
  44619. }
  44620. }
  44621. return data
  44622. }
  44623. /* */
  44624. function resolveScopedSlots (
  44625. fns, // see flow/vnode
  44626. res,
  44627. // the following are added in 2.6
  44628. hasDynamicKeys,
  44629. contentHashKey
  44630. ) {
  44631. res = res || { $stable: !hasDynamicKeys };
  44632. for (var i = 0; i < fns.length; i++) {
  44633. var slot = fns[i];
  44634. if (Array.isArray(slot)) {
  44635. resolveScopedSlots(slot, res, hasDynamicKeys);
  44636. } else if (slot) {
  44637. // marker for reverse proxying v-slot without scope on this.$slots
  44638. if (slot.proxy) {
  44639. slot.fn.proxy = true;
  44640. }
  44641. res[slot.key] = slot.fn;
  44642. }
  44643. }
  44644. if (contentHashKey) {
  44645. (res).$key = contentHashKey;
  44646. }
  44647. return res
  44648. }
  44649. /* */
  44650. function bindDynamicKeys (baseObj, values) {
  44651. for (var i = 0; i < values.length; i += 2) {
  44652. var key = values[i];
  44653. if (typeof key === 'string' && key) {
  44654. baseObj[values[i]] = values[i + 1];
  44655. } else if (key !== '' && key !== null) {
  44656. // null is a special value for explicitly removing a binding
  44657. warn(
  44658. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  44659. this
  44660. );
  44661. }
  44662. }
  44663. return baseObj
  44664. }
  44665. // helper to dynamically append modifier runtime markers to event names.
  44666. // ensure only append when value is already string, otherwise it will be cast
  44667. // to string and cause the type check to miss.
  44668. function prependModifier (value, symbol) {
  44669. return typeof value === 'string' ? symbol + value : value
  44670. }
  44671. /* */
  44672. function installRenderHelpers (target) {
  44673. target._o = markOnce;
  44674. target._n = toNumber;
  44675. target._s = toString;
  44676. target._l = renderList;
  44677. target._t = renderSlot;
  44678. target._q = looseEqual;
  44679. target._i = looseIndexOf;
  44680. target._m = renderStatic;
  44681. target._f = resolveFilter;
  44682. target._k = checkKeyCodes;
  44683. target._b = bindObjectProps;
  44684. target._v = createTextVNode;
  44685. target._e = createEmptyVNode;
  44686. target._u = resolveScopedSlots;
  44687. target._g = bindObjectListeners;
  44688. target._d = bindDynamicKeys;
  44689. target._p = prependModifier;
  44690. }
  44691. /* */
  44692. function FunctionalRenderContext (
  44693. data,
  44694. props,
  44695. children,
  44696. parent,
  44697. Ctor
  44698. ) {
  44699. var this$1 = this;
  44700. var options = Ctor.options;
  44701. // ensure the createElement function in functional components
  44702. // gets a unique context - this is necessary for correct named slot check
  44703. var contextVm;
  44704. if (hasOwn(parent, '_uid')) {
  44705. contextVm = Object.create(parent);
  44706. // $flow-disable-line
  44707. contextVm._original = parent;
  44708. } else {
  44709. // the context vm passed in is a functional context as well.
  44710. // in this case we want to make sure we are able to get a hold to the
  44711. // real context instance.
  44712. contextVm = parent;
  44713. // $flow-disable-line
  44714. parent = parent._original;
  44715. }
  44716. var isCompiled = isTrue(options._compiled);
  44717. var needNormalization = !isCompiled;
  44718. this.data = data;
  44719. this.props = props;
  44720. this.children = children;
  44721. this.parent = parent;
  44722. this.listeners = data.on || emptyObject;
  44723. this.injections = resolveInject(options.inject, parent);
  44724. this.slots = function () {
  44725. if (!this$1.$slots) {
  44726. normalizeScopedSlots(
  44727. data.scopedSlots,
  44728. this$1.$slots = resolveSlots(children, parent)
  44729. );
  44730. }
  44731. return this$1.$slots
  44732. };
  44733. Object.defineProperty(this, 'scopedSlots', ({
  44734. enumerable: true,
  44735. get: function get () {
  44736. return normalizeScopedSlots(data.scopedSlots, this.slots())
  44737. }
  44738. }));
  44739. // support for compiled functional template
  44740. if (isCompiled) {
  44741. // exposing $options for renderStatic()
  44742. this.$options = options;
  44743. // pre-resolve slots for renderSlot()
  44744. this.$slots = this.slots();
  44745. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  44746. }
  44747. if (options._scopeId) {
  44748. this._c = function (a, b, c, d) {
  44749. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  44750. if (vnode && !Array.isArray(vnode)) {
  44751. vnode.fnScopeId = options._scopeId;
  44752. vnode.fnContext = parent;
  44753. }
  44754. return vnode
  44755. };
  44756. } else {
  44757. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  44758. }
  44759. }
  44760. installRenderHelpers(FunctionalRenderContext.prototype);
  44761. function createFunctionalComponent (
  44762. Ctor,
  44763. propsData,
  44764. data,
  44765. contextVm,
  44766. children
  44767. ) {
  44768. var options = Ctor.options;
  44769. var props = {};
  44770. var propOptions = options.props;
  44771. if (isDef(propOptions)) {
  44772. for (var key in propOptions) {
  44773. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  44774. }
  44775. } else {
  44776. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  44777. if (isDef(data.props)) { mergeProps(props, data.props); }
  44778. }
  44779. var renderContext = new FunctionalRenderContext(
  44780. data,
  44781. props,
  44782. children,
  44783. contextVm,
  44784. Ctor
  44785. );
  44786. var vnode = options.render.call(null, renderContext._c, renderContext);
  44787. if (vnode instanceof VNode) {
  44788. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  44789. } else if (Array.isArray(vnode)) {
  44790. var vnodes = normalizeChildren(vnode) || [];
  44791. var res = new Array(vnodes.length);
  44792. for (var i = 0; i < vnodes.length; i++) {
  44793. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  44794. }
  44795. return res
  44796. }
  44797. }
  44798. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  44799. // #7817 clone node before setting fnContext, otherwise if the node is reused
  44800. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  44801. // that should not be matched to match.
  44802. var clone = cloneVNode(vnode);
  44803. clone.fnContext = contextVm;
  44804. clone.fnOptions = options;
  44805. {
  44806. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  44807. }
  44808. if (data.slot) {
  44809. (clone.data || (clone.data = {})).slot = data.slot;
  44810. }
  44811. return clone
  44812. }
  44813. function mergeProps (to, from) {
  44814. for (var key in from) {
  44815. to[camelize(key)] = from[key];
  44816. }
  44817. }
  44818. /* */
  44819. /* */
  44820. /* */
  44821. /* */
  44822. // inline hooks to be invoked on component VNodes during patch
  44823. var componentVNodeHooks = {
  44824. init: function init (vnode, hydrating) {
  44825. if (
  44826. vnode.componentInstance &&
  44827. !vnode.componentInstance._isDestroyed &&
  44828. vnode.data.keepAlive
  44829. ) {
  44830. // kept-alive components, treat as a patch
  44831. var mountedNode = vnode; // work around flow
  44832. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  44833. } else {
  44834. var child = vnode.componentInstance = createComponentInstanceForVnode(
  44835. vnode,
  44836. activeInstance
  44837. );
  44838. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  44839. }
  44840. },
  44841. prepatch: function prepatch (oldVnode, vnode) {
  44842. var options = vnode.componentOptions;
  44843. var child = vnode.componentInstance = oldVnode.componentInstance;
  44844. updateChildComponent(
  44845. child,
  44846. options.propsData, // updated props
  44847. options.listeners, // updated listeners
  44848. vnode, // new parent vnode
  44849. options.children // new children
  44850. );
  44851. },
  44852. insert: function insert (vnode) {
  44853. var context = vnode.context;
  44854. var componentInstance = vnode.componentInstance;
  44855. if (!componentInstance._isMounted) {
  44856. componentInstance._isMounted = true;
  44857. callHook(componentInstance, 'mounted');
  44858. }
  44859. if (vnode.data.keepAlive) {
  44860. if (context._isMounted) {
  44861. // vue-router#1212
  44862. // During updates, a kept-alive component's child components may
  44863. // change, so directly walking the tree here may call activated hooks
  44864. // on incorrect children. Instead we push them into a queue which will
  44865. // be processed after the whole patch process ended.
  44866. queueActivatedComponent(componentInstance);
  44867. } else {
  44868. activateChildComponent(componentInstance, true /* direct */);
  44869. }
  44870. }
  44871. },
  44872. destroy: function destroy (vnode) {
  44873. var componentInstance = vnode.componentInstance;
  44874. if (!componentInstance._isDestroyed) {
  44875. if (!vnode.data.keepAlive) {
  44876. componentInstance.$destroy();
  44877. } else {
  44878. deactivateChildComponent(componentInstance, true /* direct */);
  44879. }
  44880. }
  44881. }
  44882. };
  44883. var hooksToMerge = Object.keys(componentVNodeHooks);
  44884. function createComponent (
  44885. Ctor,
  44886. data,
  44887. context,
  44888. children,
  44889. tag
  44890. ) {
  44891. if (isUndef(Ctor)) {
  44892. return
  44893. }
  44894. var baseCtor = context.$options._base;
  44895. // plain options object: turn it into a constructor
  44896. if (isObject(Ctor)) {
  44897. Ctor = baseCtor.extend(Ctor);
  44898. }
  44899. // if at this stage it's not a constructor or an async component factory,
  44900. // reject.
  44901. if (typeof Ctor !== 'function') {
  44902. {
  44903. warn(("Invalid Component definition: " + (String(Ctor))), context);
  44904. }
  44905. return
  44906. }
  44907. // async component
  44908. var asyncFactory;
  44909. if (isUndef(Ctor.cid)) {
  44910. asyncFactory = Ctor;
  44911. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  44912. if (Ctor === undefined) {
  44913. // return a placeholder node for async component, which is rendered
  44914. // as a comment node but preserves all the raw information for the node.
  44915. // the information will be used for async server-rendering and hydration.
  44916. return createAsyncPlaceholder(
  44917. asyncFactory,
  44918. data,
  44919. context,
  44920. children,
  44921. tag
  44922. )
  44923. }
  44924. }
  44925. data = data || {};
  44926. // resolve constructor options in case global mixins are applied after
  44927. // component constructor creation
  44928. resolveConstructorOptions(Ctor);
  44929. // transform component v-model data into props & events
  44930. if (isDef(data.model)) {
  44931. transformModel(Ctor.options, data);
  44932. }
  44933. // extract props
  44934. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  44935. // functional component
  44936. if (isTrue(Ctor.options.functional)) {
  44937. return createFunctionalComponent(Ctor, propsData, data, context, children)
  44938. }
  44939. // extract listeners, since these needs to be treated as
  44940. // child component listeners instead of DOM listeners
  44941. var listeners = data.on;
  44942. // replace with listeners with .native modifier
  44943. // so it gets processed during parent component patch.
  44944. data.on = data.nativeOn;
  44945. if (isTrue(Ctor.options.abstract)) {
  44946. // abstract components do not keep anything
  44947. // other than props & listeners & slot
  44948. // work around flow
  44949. var slot = data.slot;
  44950. data = {};
  44951. if (slot) {
  44952. data.slot = slot;
  44953. }
  44954. }
  44955. // install component management hooks onto the placeholder node
  44956. installComponentHooks(data);
  44957. // return a placeholder vnode
  44958. var name = Ctor.options.name || tag;
  44959. var vnode = new VNode(
  44960. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  44961. data, undefined, undefined, undefined, context,
  44962. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  44963. asyncFactory
  44964. );
  44965. return vnode
  44966. }
  44967. function createComponentInstanceForVnode (
  44968. vnode, // we know it's MountedComponentVNode but flow doesn't
  44969. parent // activeInstance in lifecycle state
  44970. ) {
  44971. var options = {
  44972. _isComponent: true,
  44973. _parentVnode: vnode,
  44974. parent: parent
  44975. };
  44976. // check inline-template render functions
  44977. var inlineTemplate = vnode.data.inlineTemplate;
  44978. if (isDef(inlineTemplate)) {
  44979. options.render = inlineTemplate.render;
  44980. options.staticRenderFns = inlineTemplate.staticRenderFns;
  44981. }
  44982. return new vnode.componentOptions.Ctor(options)
  44983. }
  44984. function installComponentHooks (data) {
  44985. var hooks = data.hook || (data.hook = {});
  44986. for (var i = 0; i < hooksToMerge.length; i++) {
  44987. var key = hooksToMerge[i];
  44988. var existing = hooks[key];
  44989. var toMerge = componentVNodeHooks[key];
  44990. if (existing !== toMerge && !(existing && existing._merged)) {
  44991. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  44992. }
  44993. }
  44994. }
  44995. function mergeHook$1 (f1, f2) {
  44996. var merged = function (a, b) {
  44997. // flow complains about extra args which is why we use any
  44998. f1(a, b);
  44999. f2(a, b);
  45000. };
  45001. merged._merged = true;
  45002. return merged
  45003. }
  45004. // transform component v-model info (value and callback) into
  45005. // prop and event handler respectively.
  45006. function transformModel (options, data) {
  45007. var prop = (options.model && options.model.prop) || 'value';
  45008. var event = (options.model && options.model.event) || 'input'
  45009. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  45010. var on = data.on || (data.on = {});
  45011. var existing = on[event];
  45012. var callback = data.model.callback;
  45013. if (isDef(existing)) {
  45014. if (
  45015. Array.isArray(existing)
  45016. ? existing.indexOf(callback) === -1
  45017. : existing !== callback
  45018. ) {
  45019. on[event] = [callback].concat(existing);
  45020. }
  45021. } else {
  45022. on[event] = callback;
  45023. }
  45024. }
  45025. /* */
  45026. var SIMPLE_NORMALIZE = 1;
  45027. var ALWAYS_NORMALIZE = 2;
  45028. // wrapper function for providing a more flexible interface
  45029. // without getting yelled at by flow
  45030. function createElement (
  45031. context,
  45032. tag,
  45033. data,
  45034. children,
  45035. normalizationType,
  45036. alwaysNormalize
  45037. ) {
  45038. if (Array.isArray(data) || isPrimitive(data)) {
  45039. normalizationType = children;
  45040. children = data;
  45041. data = undefined;
  45042. }
  45043. if (isTrue(alwaysNormalize)) {
  45044. normalizationType = ALWAYS_NORMALIZE;
  45045. }
  45046. return _createElement(context, tag, data, children, normalizationType)
  45047. }
  45048. function _createElement (
  45049. context,
  45050. tag,
  45051. data,
  45052. children,
  45053. normalizationType
  45054. ) {
  45055. if (isDef(data) && isDef((data).__ob__)) {
  45056. warn(
  45057. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  45058. 'Always create fresh vnode data objects in each render!',
  45059. context
  45060. );
  45061. return createEmptyVNode()
  45062. }
  45063. // object syntax in v-bind
  45064. if (isDef(data) && isDef(data.is)) {
  45065. tag = data.is;
  45066. }
  45067. if (!tag) {
  45068. // in case of component :is set to falsy value
  45069. return createEmptyVNode()
  45070. }
  45071. // warn against non-primitive key
  45072. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  45073. ) {
  45074. {
  45075. warn(
  45076. 'Avoid using non-primitive value as key, ' +
  45077. 'use string/number value instead.',
  45078. context
  45079. );
  45080. }
  45081. }
  45082. // support single function children as default scoped slot
  45083. if (Array.isArray(children) &&
  45084. typeof children[0] === 'function'
  45085. ) {
  45086. data = data || {};
  45087. data.scopedSlots = { default: children[0] };
  45088. children.length = 0;
  45089. }
  45090. if (normalizationType === ALWAYS_NORMALIZE) {
  45091. children = normalizeChildren(children);
  45092. } else if (normalizationType === SIMPLE_NORMALIZE) {
  45093. children = simpleNormalizeChildren(children);
  45094. }
  45095. var vnode, ns;
  45096. if (typeof tag === 'string') {
  45097. var Ctor;
  45098. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  45099. if (config.isReservedTag(tag)) {
  45100. // platform built-in elements
  45101. if (isDef(data) && isDef(data.nativeOn)) {
  45102. warn(
  45103. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  45104. context
  45105. );
  45106. }
  45107. vnode = new VNode(
  45108. config.parsePlatformTagName(tag), data, children,
  45109. undefined, undefined, context
  45110. );
  45111. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  45112. // component
  45113. vnode = createComponent(Ctor, data, context, children, tag);
  45114. } else {
  45115. // unknown or unlisted namespaced elements
  45116. // check at runtime because it may get assigned a namespace when its
  45117. // parent normalizes children
  45118. vnode = new VNode(
  45119. tag, data, children,
  45120. undefined, undefined, context
  45121. );
  45122. }
  45123. } else {
  45124. // direct component options / constructor
  45125. vnode = createComponent(tag, data, context, children);
  45126. }
  45127. if (Array.isArray(vnode)) {
  45128. return vnode
  45129. } else if (isDef(vnode)) {
  45130. if (isDef(ns)) { applyNS(vnode, ns); }
  45131. if (isDef(data)) { registerDeepBindings(data); }
  45132. return vnode
  45133. } else {
  45134. return createEmptyVNode()
  45135. }
  45136. }
  45137. function applyNS (vnode, ns, force) {
  45138. vnode.ns = ns;
  45139. if (vnode.tag === 'foreignObject') {
  45140. // use default namespace inside foreignObject
  45141. ns = undefined;
  45142. force = true;
  45143. }
  45144. if (isDef(vnode.children)) {
  45145. for (var i = 0, l = vnode.children.length; i < l; i++) {
  45146. var child = vnode.children[i];
  45147. if (isDef(child.tag) && (
  45148. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  45149. applyNS(child, ns, force);
  45150. }
  45151. }
  45152. }
  45153. }
  45154. // ref #5318
  45155. // necessary to ensure parent re-render when deep bindings like :style and
  45156. // :class are used on slot nodes
  45157. function registerDeepBindings (data) {
  45158. if (isObject(data.style)) {
  45159. traverse(data.style);
  45160. }
  45161. if (isObject(data.class)) {
  45162. traverse(data.class);
  45163. }
  45164. }
  45165. /* */
  45166. function initRender (vm) {
  45167. vm._vnode = null; // the root of the child tree
  45168. vm._staticTrees = null; // v-once cached trees
  45169. var options = vm.$options;
  45170. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  45171. var renderContext = parentVnode && parentVnode.context;
  45172. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  45173. vm.$scopedSlots = emptyObject;
  45174. // bind the createElement fn to this instance
  45175. // so that we get proper render context inside it.
  45176. // args order: tag, data, children, normalizationType, alwaysNormalize
  45177. // internal version is used by render functions compiled from templates
  45178. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  45179. // normalization is always applied for the public version, used in
  45180. // user-written render functions.
  45181. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  45182. // $attrs & $listeners are exposed for easier HOC creation.
  45183. // they need to be reactive so that HOCs using them are always updated
  45184. var parentData = parentVnode && parentVnode.data;
  45185. /* istanbul ignore else */
  45186. {
  45187. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  45188. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  45189. }, true);
  45190. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  45191. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  45192. }, true);
  45193. }
  45194. }
  45195. var currentRenderingInstance = null;
  45196. function renderMixin (Vue) {
  45197. // install runtime convenience helpers
  45198. installRenderHelpers(Vue.prototype);
  45199. Vue.prototype.$nextTick = function (fn) {
  45200. return nextTick(fn, this)
  45201. };
  45202. Vue.prototype._render = function () {
  45203. var vm = this;
  45204. var ref = vm.$options;
  45205. var render = ref.render;
  45206. var _parentVnode = ref._parentVnode;
  45207. if (_parentVnode) {
  45208. vm.$scopedSlots = normalizeScopedSlots(
  45209. _parentVnode.data.scopedSlots,
  45210. vm.$slots,
  45211. vm.$scopedSlots
  45212. );
  45213. }
  45214. // set parent vnode. this allows render functions to have access
  45215. // to the data on the placeholder node.
  45216. vm.$vnode = _parentVnode;
  45217. // render self
  45218. var vnode;
  45219. try {
  45220. // There's no need to maintain a stack because all render fns are called
  45221. // separately from one another. Nested component's render fns are called
  45222. // when parent component is patched.
  45223. currentRenderingInstance = vm;
  45224. vnode = render.call(vm._renderProxy, vm.$createElement);
  45225. } catch (e) {
  45226. handleError(e, vm, "render");
  45227. // return error render result,
  45228. // or previous vnode to prevent render error causing blank component
  45229. /* istanbul ignore else */
  45230. if (vm.$options.renderError) {
  45231. try {
  45232. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  45233. } catch (e) {
  45234. handleError(e, vm, "renderError");
  45235. vnode = vm._vnode;
  45236. }
  45237. } else {
  45238. vnode = vm._vnode;
  45239. }
  45240. } finally {
  45241. currentRenderingInstance = null;
  45242. }
  45243. // if the returned array contains only a single node, allow it
  45244. if (Array.isArray(vnode) && vnode.length === 1) {
  45245. vnode = vnode[0];
  45246. }
  45247. // return empty vnode in case the render function errored out
  45248. if (!(vnode instanceof VNode)) {
  45249. if (Array.isArray(vnode)) {
  45250. warn(
  45251. 'Multiple root nodes returned from render function. Render function ' +
  45252. 'should return a single root node.',
  45253. vm
  45254. );
  45255. }
  45256. vnode = createEmptyVNode();
  45257. }
  45258. // set parent
  45259. vnode.parent = _parentVnode;
  45260. return vnode
  45261. };
  45262. }
  45263. /* */
  45264. function ensureCtor (comp, base) {
  45265. if (
  45266. comp.__esModule ||
  45267. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  45268. ) {
  45269. comp = comp.default;
  45270. }
  45271. return isObject(comp)
  45272. ? base.extend(comp)
  45273. : comp
  45274. }
  45275. function createAsyncPlaceholder (
  45276. factory,
  45277. data,
  45278. context,
  45279. children,
  45280. tag
  45281. ) {
  45282. var node = createEmptyVNode();
  45283. node.asyncFactory = factory;
  45284. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  45285. return node
  45286. }
  45287. function resolveAsyncComponent (
  45288. factory,
  45289. baseCtor
  45290. ) {
  45291. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  45292. return factory.errorComp
  45293. }
  45294. if (isDef(factory.resolved)) {
  45295. return factory.resolved
  45296. }
  45297. var owner = currentRenderingInstance;
  45298. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  45299. // already pending
  45300. factory.owners.push(owner);
  45301. }
  45302. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  45303. return factory.loadingComp
  45304. }
  45305. if (owner && !isDef(factory.owners)) {
  45306. var owners = factory.owners = [owner];
  45307. var sync = true;
  45308. var timerLoading = null;
  45309. var timerTimeout = null
  45310. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  45311. var forceRender = function (renderCompleted) {
  45312. for (var i = 0, l = owners.length; i < l; i++) {
  45313. (owners[i]).$forceUpdate();
  45314. }
  45315. if (renderCompleted) {
  45316. owners.length = 0;
  45317. if (timerLoading !== null) {
  45318. clearTimeout(timerLoading);
  45319. timerLoading = null;
  45320. }
  45321. if (timerTimeout !== null) {
  45322. clearTimeout(timerTimeout);
  45323. timerTimeout = null;
  45324. }
  45325. }
  45326. };
  45327. var resolve = once(function (res) {
  45328. // cache resolved
  45329. factory.resolved = ensureCtor(res, baseCtor);
  45330. // invoke callbacks only if this is not a synchronous resolve
  45331. // (async resolves are shimmed as synchronous during SSR)
  45332. if (!sync) {
  45333. forceRender(true);
  45334. } else {
  45335. owners.length = 0;
  45336. }
  45337. });
  45338. var reject = once(function (reason) {
  45339. warn(
  45340. "Failed to resolve async component: " + (String(factory)) +
  45341. (reason ? ("\nReason: " + reason) : '')
  45342. );
  45343. if (isDef(factory.errorComp)) {
  45344. factory.error = true;
  45345. forceRender(true);
  45346. }
  45347. });
  45348. var res = factory(resolve, reject);
  45349. if (isObject(res)) {
  45350. if (isPromise(res)) {
  45351. // () => Promise
  45352. if (isUndef(factory.resolved)) {
  45353. res.then(resolve, reject);
  45354. }
  45355. } else if (isPromise(res.component)) {
  45356. res.component.then(resolve, reject);
  45357. if (isDef(res.error)) {
  45358. factory.errorComp = ensureCtor(res.error, baseCtor);
  45359. }
  45360. if (isDef(res.loading)) {
  45361. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  45362. if (res.delay === 0) {
  45363. factory.loading = true;
  45364. } else {
  45365. timerLoading = setTimeout(function () {
  45366. timerLoading = null;
  45367. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  45368. factory.loading = true;
  45369. forceRender(false);
  45370. }
  45371. }, res.delay || 200);
  45372. }
  45373. }
  45374. if (isDef(res.timeout)) {
  45375. timerTimeout = setTimeout(function () {
  45376. timerTimeout = null;
  45377. if (isUndef(factory.resolved)) {
  45378. reject(
  45379. "timeout (" + (res.timeout) + "ms)"
  45380. );
  45381. }
  45382. }, res.timeout);
  45383. }
  45384. }
  45385. }
  45386. sync = false;
  45387. // return in case resolved synchronously
  45388. return factory.loading
  45389. ? factory.loadingComp
  45390. : factory.resolved
  45391. }
  45392. }
  45393. /* */
  45394. function isAsyncPlaceholder (node) {
  45395. return node.isComment && node.asyncFactory
  45396. }
  45397. /* */
  45398. function getFirstComponentChild (children) {
  45399. if (Array.isArray(children)) {
  45400. for (var i = 0; i < children.length; i++) {
  45401. var c = children[i];
  45402. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  45403. return c
  45404. }
  45405. }
  45406. }
  45407. }
  45408. /* */
  45409. /* */
  45410. function initEvents (vm) {
  45411. vm._events = Object.create(null);
  45412. vm._hasHookEvent = false;
  45413. // init parent attached events
  45414. var listeners = vm.$options._parentListeners;
  45415. if (listeners) {
  45416. updateComponentListeners(vm, listeners);
  45417. }
  45418. }
  45419. var target;
  45420. function add (event, fn) {
  45421. target.$on(event, fn);
  45422. }
  45423. function remove$1 (event, fn) {
  45424. target.$off(event, fn);
  45425. }
  45426. function createOnceHandler (event, fn) {
  45427. var _target = target;
  45428. return function onceHandler () {
  45429. var res = fn.apply(null, arguments);
  45430. if (res !== null) {
  45431. _target.$off(event, onceHandler);
  45432. }
  45433. }
  45434. }
  45435. function updateComponentListeners (
  45436. vm,
  45437. listeners,
  45438. oldListeners
  45439. ) {
  45440. target = vm;
  45441. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  45442. target = undefined;
  45443. }
  45444. function eventsMixin (Vue) {
  45445. var hookRE = /^hook:/;
  45446. Vue.prototype.$on = function (event, fn) {
  45447. var vm = this;
  45448. if (Array.isArray(event)) {
  45449. for (var i = 0, l = event.length; i < l; i++) {
  45450. vm.$on(event[i], fn);
  45451. }
  45452. } else {
  45453. (vm._events[event] || (vm._events[event] = [])).push(fn);
  45454. // optimize hook:event cost by using a boolean flag marked at registration
  45455. // instead of a hash lookup
  45456. if (hookRE.test(event)) {
  45457. vm._hasHookEvent = true;
  45458. }
  45459. }
  45460. return vm
  45461. };
  45462. Vue.prototype.$once = function (event, fn) {
  45463. var vm = this;
  45464. function on () {
  45465. vm.$off(event, on);
  45466. fn.apply(vm, arguments);
  45467. }
  45468. on.fn = fn;
  45469. vm.$on(event, on);
  45470. return vm
  45471. };
  45472. Vue.prototype.$off = function (event, fn) {
  45473. var vm = this;
  45474. // all
  45475. if (!arguments.length) {
  45476. vm._events = Object.create(null);
  45477. return vm
  45478. }
  45479. // array of events
  45480. if (Array.isArray(event)) {
  45481. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  45482. vm.$off(event[i$1], fn);
  45483. }
  45484. return vm
  45485. }
  45486. // specific event
  45487. var cbs = vm._events[event];
  45488. if (!cbs) {
  45489. return vm
  45490. }
  45491. if (!fn) {
  45492. vm._events[event] = null;
  45493. return vm
  45494. }
  45495. // specific handler
  45496. var cb;
  45497. var i = cbs.length;
  45498. while (i--) {
  45499. cb = cbs[i];
  45500. if (cb === fn || cb.fn === fn) {
  45501. cbs.splice(i, 1);
  45502. break
  45503. }
  45504. }
  45505. return vm
  45506. };
  45507. Vue.prototype.$emit = function (event) {
  45508. var vm = this;
  45509. {
  45510. var lowerCaseEvent = event.toLowerCase();
  45511. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  45512. tip(
  45513. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  45514. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  45515. "Note that HTML attributes are case-insensitive and you cannot use " +
  45516. "v-on to listen to camelCase events when using in-DOM templates. " +
  45517. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  45518. );
  45519. }
  45520. }
  45521. var cbs = vm._events[event];
  45522. if (cbs) {
  45523. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  45524. var args = toArray(arguments, 1);
  45525. var info = "event handler for \"" + event + "\"";
  45526. for (var i = 0, l = cbs.length; i < l; i++) {
  45527. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  45528. }
  45529. }
  45530. return vm
  45531. };
  45532. }
  45533. /* */
  45534. var activeInstance = null;
  45535. var isUpdatingChildComponent = false;
  45536. function setActiveInstance(vm) {
  45537. var prevActiveInstance = activeInstance;
  45538. activeInstance = vm;
  45539. return function () {
  45540. activeInstance = prevActiveInstance;
  45541. }
  45542. }
  45543. function initLifecycle (vm) {
  45544. var options = vm.$options;
  45545. // locate first non-abstract parent
  45546. var parent = options.parent;
  45547. if (parent && !options.abstract) {
  45548. while (parent.$options.abstract && parent.$parent) {
  45549. parent = parent.$parent;
  45550. }
  45551. parent.$children.push(vm);
  45552. }
  45553. vm.$parent = parent;
  45554. vm.$root = parent ? parent.$root : vm;
  45555. vm.$children = [];
  45556. vm.$refs = {};
  45557. vm._watcher = null;
  45558. vm._inactive = null;
  45559. vm._directInactive = false;
  45560. vm._isMounted = false;
  45561. vm._isDestroyed = false;
  45562. vm._isBeingDestroyed = false;
  45563. }
  45564. function lifecycleMixin (Vue) {
  45565. Vue.prototype._update = function (vnode, hydrating) {
  45566. var vm = this;
  45567. var prevEl = vm.$el;
  45568. var prevVnode = vm._vnode;
  45569. var restoreActiveInstance = setActiveInstance(vm);
  45570. vm._vnode = vnode;
  45571. // Vue.prototype.__patch__ is injected in entry points
  45572. // based on the rendering backend used.
  45573. if (!prevVnode) {
  45574. // initial render
  45575. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  45576. } else {
  45577. // updates
  45578. vm.$el = vm.__patch__(prevVnode, vnode);
  45579. }
  45580. restoreActiveInstance();
  45581. // update __vue__ reference
  45582. if (prevEl) {
  45583. prevEl.__vue__ = null;
  45584. }
  45585. if (vm.$el) {
  45586. vm.$el.__vue__ = vm;
  45587. }
  45588. // if parent is an HOC, update its $el as well
  45589. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  45590. vm.$parent.$el = vm.$el;
  45591. }
  45592. // updated hook is called by the scheduler to ensure that children are
  45593. // updated in a parent's updated hook.
  45594. };
  45595. Vue.prototype.$forceUpdate = function () {
  45596. var vm = this;
  45597. if (vm._watcher) {
  45598. vm._watcher.update();
  45599. }
  45600. };
  45601. Vue.prototype.$destroy = function () {
  45602. var vm = this;
  45603. if (vm._isBeingDestroyed) {
  45604. return
  45605. }
  45606. callHook(vm, 'beforeDestroy');
  45607. vm._isBeingDestroyed = true;
  45608. // remove self from parent
  45609. var parent = vm.$parent;
  45610. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  45611. remove(parent.$children, vm);
  45612. }
  45613. // teardown watchers
  45614. if (vm._watcher) {
  45615. vm._watcher.teardown();
  45616. }
  45617. var i = vm._watchers.length;
  45618. while (i--) {
  45619. vm._watchers[i].teardown();
  45620. }
  45621. // remove reference from data ob
  45622. // frozen object may not have observer.
  45623. if (vm._data.__ob__) {
  45624. vm._data.__ob__.vmCount--;
  45625. }
  45626. // call the last hook...
  45627. vm._isDestroyed = true;
  45628. // invoke destroy hooks on current rendered tree
  45629. vm.__patch__(vm._vnode, null);
  45630. // fire destroyed hook
  45631. callHook(vm, 'destroyed');
  45632. // turn off all instance listeners.
  45633. vm.$off();
  45634. // remove __vue__ reference
  45635. if (vm.$el) {
  45636. vm.$el.__vue__ = null;
  45637. }
  45638. // release circular reference (#6759)
  45639. if (vm.$vnode) {
  45640. vm.$vnode.parent = null;
  45641. }
  45642. };
  45643. }
  45644. function mountComponent (
  45645. vm,
  45646. el,
  45647. hydrating
  45648. ) {
  45649. vm.$el = el;
  45650. if (!vm.$options.render) {
  45651. vm.$options.render = createEmptyVNode;
  45652. {
  45653. /* istanbul ignore if */
  45654. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  45655. vm.$options.el || el) {
  45656. warn(
  45657. 'You are using the runtime-only build of Vue where the template ' +
  45658. 'compiler is not available. Either pre-compile the templates into ' +
  45659. 'render functions, or use the compiler-included build.',
  45660. vm
  45661. );
  45662. } else {
  45663. warn(
  45664. 'Failed to mount component: template or render function not defined.',
  45665. vm
  45666. );
  45667. }
  45668. }
  45669. }
  45670. callHook(vm, 'beforeMount');
  45671. var updateComponent;
  45672. /* istanbul ignore if */
  45673. if (config.performance && mark) {
  45674. updateComponent = function () {
  45675. var name = vm._name;
  45676. var id = vm._uid;
  45677. var startTag = "vue-perf-start:" + id;
  45678. var endTag = "vue-perf-end:" + id;
  45679. mark(startTag);
  45680. var vnode = vm._render();
  45681. mark(endTag);
  45682. measure(("vue " + name + " render"), startTag, endTag);
  45683. mark(startTag);
  45684. vm._update(vnode, hydrating);
  45685. mark(endTag);
  45686. measure(("vue " + name + " patch"), startTag, endTag);
  45687. };
  45688. } else {
  45689. updateComponent = function () {
  45690. vm._update(vm._render(), hydrating);
  45691. };
  45692. }
  45693. // we set this to vm._watcher inside the watcher's constructor
  45694. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  45695. // component's mounted hook), which relies on vm._watcher being already defined
  45696. new Watcher(vm, updateComponent, noop, {
  45697. before: function before () {
  45698. if (vm._isMounted && !vm._isDestroyed) {
  45699. callHook(vm, 'beforeUpdate');
  45700. }
  45701. }
  45702. }, true /* isRenderWatcher */);
  45703. hydrating = false;
  45704. // manually mounted instance, call mounted on self
  45705. // mounted is called for render-created child components in its inserted hook
  45706. if (vm.$vnode == null) {
  45707. vm._isMounted = true;
  45708. callHook(vm, 'mounted');
  45709. }
  45710. return vm
  45711. }
  45712. function updateChildComponent (
  45713. vm,
  45714. propsData,
  45715. listeners,
  45716. parentVnode,
  45717. renderChildren
  45718. ) {
  45719. {
  45720. isUpdatingChildComponent = true;
  45721. }
  45722. // determine whether component has slot children
  45723. // we need to do this before overwriting $options._renderChildren.
  45724. // check if there are dynamic scopedSlots (hand-written or compiled but with
  45725. // dynamic slot names). Static scoped slots compiled from template has the
  45726. // "$stable" marker.
  45727. var newScopedSlots = parentVnode.data.scopedSlots;
  45728. var oldScopedSlots = vm.$scopedSlots;
  45729. var hasDynamicScopedSlot = !!(
  45730. (newScopedSlots && !newScopedSlots.$stable) ||
  45731. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  45732. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  45733. );
  45734. // Any static slot children from the parent may have changed during parent's
  45735. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  45736. // update is necessary to ensure correctness.
  45737. var needsForceUpdate = !!(
  45738. renderChildren || // has new static slots
  45739. vm.$options._renderChildren || // has old static slots
  45740. hasDynamicScopedSlot
  45741. );
  45742. vm.$options._parentVnode = parentVnode;
  45743. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  45744. if (vm._vnode) { // update child tree's parent
  45745. vm._vnode.parent = parentVnode;
  45746. }
  45747. vm.$options._renderChildren = renderChildren;
  45748. // update $attrs and $listeners hash
  45749. // these are also reactive so they may trigger child update if the child
  45750. // used them during render
  45751. vm.$attrs = parentVnode.data.attrs || emptyObject;
  45752. vm.$listeners = listeners || emptyObject;
  45753. // update props
  45754. if (propsData && vm.$options.props) {
  45755. toggleObserving(false);
  45756. var props = vm._props;
  45757. var propKeys = vm.$options._propKeys || [];
  45758. for (var i = 0; i < propKeys.length; i++) {
  45759. var key = propKeys[i];
  45760. var propOptions = vm.$options.props; // wtf flow?
  45761. props[key] = validateProp(key, propOptions, propsData, vm);
  45762. }
  45763. toggleObserving(true);
  45764. // keep a copy of raw propsData
  45765. vm.$options.propsData = propsData;
  45766. }
  45767. // update listeners
  45768. listeners = listeners || emptyObject;
  45769. var oldListeners = vm.$options._parentListeners;
  45770. vm.$options._parentListeners = listeners;
  45771. updateComponentListeners(vm, listeners, oldListeners);
  45772. // resolve slots + force update if has children
  45773. if (needsForceUpdate) {
  45774. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  45775. vm.$forceUpdate();
  45776. }
  45777. {
  45778. isUpdatingChildComponent = false;
  45779. }
  45780. }
  45781. function isInInactiveTree (vm) {
  45782. while (vm && (vm = vm.$parent)) {
  45783. if (vm._inactive) { return true }
  45784. }
  45785. return false
  45786. }
  45787. function activateChildComponent (vm, direct) {
  45788. if (direct) {
  45789. vm._directInactive = false;
  45790. if (isInInactiveTree(vm)) {
  45791. return
  45792. }
  45793. } else if (vm._directInactive) {
  45794. return
  45795. }
  45796. if (vm._inactive || vm._inactive === null) {
  45797. vm._inactive = false;
  45798. for (var i = 0; i < vm.$children.length; i++) {
  45799. activateChildComponent(vm.$children[i]);
  45800. }
  45801. callHook(vm, 'activated');
  45802. }
  45803. }
  45804. function deactivateChildComponent (vm, direct) {
  45805. if (direct) {
  45806. vm._directInactive = true;
  45807. if (isInInactiveTree(vm)) {
  45808. return
  45809. }
  45810. }
  45811. if (!vm._inactive) {
  45812. vm._inactive = true;
  45813. for (var i = 0; i < vm.$children.length; i++) {
  45814. deactivateChildComponent(vm.$children[i]);
  45815. }
  45816. callHook(vm, 'deactivated');
  45817. }
  45818. }
  45819. function callHook (vm, hook) {
  45820. // #7573 disable dep collection when invoking lifecycle hooks
  45821. pushTarget();
  45822. var handlers = vm.$options[hook];
  45823. var info = hook + " hook";
  45824. if (handlers) {
  45825. for (var i = 0, j = handlers.length; i < j; i++) {
  45826. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  45827. }
  45828. }
  45829. if (vm._hasHookEvent) {
  45830. vm.$emit('hook:' + hook);
  45831. }
  45832. popTarget();
  45833. }
  45834. /* */
  45835. var MAX_UPDATE_COUNT = 100;
  45836. var queue = [];
  45837. var activatedChildren = [];
  45838. var has = {};
  45839. var circular = {};
  45840. var waiting = false;
  45841. var flushing = false;
  45842. var index = 0;
  45843. /**
  45844. * Reset the scheduler's state.
  45845. */
  45846. function resetSchedulerState () {
  45847. index = queue.length = activatedChildren.length = 0;
  45848. has = {};
  45849. {
  45850. circular = {};
  45851. }
  45852. waiting = flushing = false;
  45853. }
  45854. // Async edge case #6566 requires saving the timestamp when event listeners are
  45855. // attached. However, calling performance.now() has a perf overhead especially
  45856. // if the page has thousands of event listeners. Instead, we take a timestamp
  45857. // every time the scheduler flushes and use that for all event listeners
  45858. // attached during that flush.
  45859. var currentFlushTimestamp = 0;
  45860. // Async edge case fix requires storing an event listener's attach timestamp.
  45861. var getNow = Date.now;
  45862. // Determine what event timestamp the browser is using. Annoyingly, the
  45863. // timestamp can either be hi-res (relative to page load) or low-res
  45864. // (relative to UNIX epoch), so in order to compare time we have to use the
  45865. // same timestamp type when saving the flush timestamp.
  45866. // All IE versions use low-res event timestamps, and have problematic clock
  45867. // implementations (#9632)
  45868. if (inBrowser && !isIE) {
  45869. var performance = window.performance;
  45870. if (
  45871. performance &&
  45872. typeof performance.now === 'function' &&
  45873. getNow() > document.createEvent('Event').timeStamp
  45874. ) {
  45875. // if the event timestamp, although evaluated AFTER the Date.now(), is
  45876. // smaller than it, it means the event is using a hi-res timestamp,
  45877. // and we need to use the hi-res version for event listener timestamps as
  45878. // well.
  45879. getNow = function () { return performance.now(); };
  45880. }
  45881. }
  45882. /**
  45883. * Flush both queues and run the watchers.
  45884. */
  45885. function flushSchedulerQueue () {
  45886. currentFlushTimestamp = getNow();
  45887. flushing = true;
  45888. var watcher, id;
  45889. // Sort queue before flush.
  45890. // This ensures that:
  45891. // 1. Components are updated from parent to child. (because parent is always
  45892. // created before the child)
  45893. // 2. A component's user watchers are run before its render watcher (because
  45894. // user watchers are created before the render watcher)
  45895. // 3. If a component is destroyed during a parent component's watcher run,
  45896. // its watchers can be skipped.
  45897. queue.sort(function (a, b) { return a.id - b.id; });
  45898. // do not cache length because more watchers might be pushed
  45899. // as we run existing watchers
  45900. for (index = 0; index < queue.length; index++) {
  45901. watcher = queue[index];
  45902. if (watcher.before) {
  45903. watcher.before();
  45904. }
  45905. id = watcher.id;
  45906. has[id] = null;
  45907. watcher.run();
  45908. // in dev build, check and stop circular updates.
  45909. if (has[id] != null) {
  45910. circular[id] = (circular[id] || 0) + 1;
  45911. if (circular[id] > MAX_UPDATE_COUNT) {
  45912. warn(
  45913. 'You may have an infinite update loop ' + (
  45914. watcher.user
  45915. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  45916. : "in a component render function."
  45917. ),
  45918. watcher.vm
  45919. );
  45920. break
  45921. }
  45922. }
  45923. }
  45924. // keep copies of post queues before resetting state
  45925. var activatedQueue = activatedChildren.slice();
  45926. var updatedQueue = queue.slice();
  45927. resetSchedulerState();
  45928. // call component updated and activated hooks
  45929. callActivatedHooks(activatedQueue);
  45930. callUpdatedHooks(updatedQueue);
  45931. // devtool hook
  45932. /* istanbul ignore if */
  45933. if (devtools && config.devtools) {
  45934. devtools.emit('flush');
  45935. }
  45936. }
  45937. function callUpdatedHooks (queue) {
  45938. var i = queue.length;
  45939. while (i--) {
  45940. var watcher = queue[i];
  45941. var vm = watcher.vm;
  45942. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  45943. callHook(vm, 'updated');
  45944. }
  45945. }
  45946. }
  45947. /**
  45948. * Queue a kept-alive component that was activated during patch.
  45949. * The queue will be processed after the entire tree has been patched.
  45950. */
  45951. function queueActivatedComponent (vm) {
  45952. // setting _inactive to false here so that a render function can
  45953. // rely on checking whether it's in an inactive tree (e.g. router-view)
  45954. vm._inactive = false;
  45955. activatedChildren.push(vm);
  45956. }
  45957. function callActivatedHooks (queue) {
  45958. for (var i = 0; i < queue.length; i++) {
  45959. queue[i]._inactive = true;
  45960. activateChildComponent(queue[i], true /* true */);
  45961. }
  45962. }
  45963. /**
  45964. * Push a watcher into the watcher queue.
  45965. * Jobs with duplicate IDs will be skipped unless it's
  45966. * pushed when the queue is being flushed.
  45967. */
  45968. function queueWatcher (watcher) {
  45969. var id = watcher.id;
  45970. if (has[id] == null) {
  45971. has[id] = true;
  45972. if (!flushing) {
  45973. queue.push(watcher);
  45974. } else {
  45975. // if already flushing, splice the watcher based on its id
  45976. // if already past its id, it will be run next immediately.
  45977. var i = queue.length - 1;
  45978. while (i > index && queue[i].id > watcher.id) {
  45979. i--;
  45980. }
  45981. queue.splice(i + 1, 0, watcher);
  45982. }
  45983. // queue the flush
  45984. if (!waiting) {
  45985. waiting = true;
  45986. if (!config.async) {
  45987. flushSchedulerQueue();
  45988. return
  45989. }
  45990. nextTick(flushSchedulerQueue);
  45991. }
  45992. }
  45993. }
  45994. /* */
  45995. var uid$2 = 0;
  45996. /**
  45997. * A watcher parses an expression, collects dependencies,
  45998. * and fires callback when the expression value changes.
  45999. * This is used for both the $watch() api and directives.
  46000. */
  46001. var Watcher = function Watcher (
  46002. vm,
  46003. expOrFn,
  46004. cb,
  46005. options,
  46006. isRenderWatcher
  46007. ) {
  46008. this.vm = vm;
  46009. if (isRenderWatcher) {
  46010. vm._watcher = this;
  46011. }
  46012. vm._watchers.push(this);
  46013. // options
  46014. if (options) {
  46015. this.deep = !!options.deep;
  46016. this.user = !!options.user;
  46017. this.lazy = !!options.lazy;
  46018. this.sync = !!options.sync;
  46019. this.before = options.before;
  46020. } else {
  46021. this.deep = this.user = this.lazy = this.sync = false;
  46022. }
  46023. this.cb = cb;
  46024. this.id = ++uid$2; // uid for batching
  46025. this.active = true;
  46026. this.dirty = this.lazy; // for lazy watchers
  46027. this.deps = [];
  46028. this.newDeps = [];
  46029. this.depIds = new _Set();
  46030. this.newDepIds = new _Set();
  46031. this.expression = expOrFn.toString();
  46032. // parse expression for getter
  46033. if (typeof expOrFn === 'function') {
  46034. this.getter = expOrFn;
  46035. } else {
  46036. this.getter = parsePath(expOrFn);
  46037. if (!this.getter) {
  46038. this.getter = noop;
  46039. warn(
  46040. "Failed watching path: \"" + expOrFn + "\" " +
  46041. 'Watcher only accepts simple dot-delimited paths. ' +
  46042. 'For full control, use a function instead.',
  46043. vm
  46044. );
  46045. }
  46046. }
  46047. this.value = this.lazy
  46048. ? undefined
  46049. : this.get();
  46050. };
  46051. /**
  46052. * Evaluate the getter, and re-collect dependencies.
  46053. */
  46054. Watcher.prototype.get = function get () {
  46055. pushTarget(this);
  46056. var value;
  46057. var vm = this.vm;
  46058. try {
  46059. value = this.getter.call(vm, vm);
  46060. } catch (e) {
  46061. if (this.user) {
  46062. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  46063. } else {
  46064. throw e
  46065. }
  46066. } finally {
  46067. // "touch" every property so they are all tracked as
  46068. // dependencies for deep watching
  46069. if (this.deep) {
  46070. traverse(value);
  46071. }
  46072. popTarget();
  46073. this.cleanupDeps();
  46074. }
  46075. return value
  46076. };
  46077. /**
  46078. * Add a dependency to this directive.
  46079. */
  46080. Watcher.prototype.addDep = function addDep (dep) {
  46081. var id = dep.id;
  46082. if (!this.newDepIds.has(id)) {
  46083. this.newDepIds.add(id);
  46084. this.newDeps.push(dep);
  46085. if (!this.depIds.has(id)) {
  46086. dep.addSub(this);
  46087. }
  46088. }
  46089. };
  46090. /**
  46091. * Clean up for dependency collection.
  46092. */
  46093. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  46094. var i = this.deps.length;
  46095. while (i--) {
  46096. var dep = this.deps[i];
  46097. if (!this.newDepIds.has(dep.id)) {
  46098. dep.removeSub(this);
  46099. }
  46100. }
  46101. var tmp = this.depIds;
  46102. this.depIds = this.newDepIds;
  46103. this.newDepIds = tmp;
  46104. this.newDepIds.clear();
  46105. tmp = this.deps;
  46106. this.deps = this.newDeps;
  46107. this.newDeps = tmp;
  46108. this.newDeps.length = 0;
  46109. };
  46110. /**
  46111. * Subscriber interface.
  46112. * Will be called when a dependency changes.
  46113. */
  46114. Watcher.prototype.update = function update () {
  46115. /* istanbul ignore else */
  46116. if (this.lazy) {
  46117. this.dirty = true;
  46118. } else if (this.sync) {
  46119. this.run();
  46120. } else {
  46121. queueWatcher(this);
  46122. }
  46123. };
  46124. /**
  46125. * Scheduler job interface.
  46126. * Will be called by the scheduler.
  46127. */
  46128. Watcher.prototype.run = function run () {
  46129. if (this.active) {
  46130. var value = this.get();
  46131. if (
  46132. value !== this.value ||
  46133. // Deep watchers and watchers on Object/Arrays should fire even
  46134. // when the value is the same, because the value may
  46135. // have mutated.
  46136. isObject(value) ||
  46137. this.deep
  46138. ) {
  46139. // set new value
  46140. var oldValue = this.value;
  46141. this.value = value;
  46142. if (this.user) {
  46143. try {
  46144. this.cb.call(this.vm, value, oldValue);
  46145. } catch (e) {
  46146. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  46147. }
  46148. } else {
  46149. this.cb.call(this.vm, value, oldValue);
  46150. }
  46151. }
  46152. }
  46153. };
  46154. /**
  46155. * Evaluate the value of the watcher.
  46156. * This only gets called for lazy watchers.
  46157. */
  46158. Watcher.prototype.evaluate = function evaluate () {
  46159. this.value = this.get();
  46160. this.dirty = false;
  46161. };
  46162. /**
  46163. * Depend on all deps collected by this watcher.
  46164. */
  46165. Watcher.prototype.depend = function depend () {
  46166. var i = this.deps.length;
  46167. while (i--) {
  46168. this.deps[i].depend();
  46169. }
  46170. };
  46171. /**
  46172. * Remove self from all dependencies' subscriber list.
  46173. */
  46174. Watcher.prototype.teardown = function teardown () {
  46175. if (this.active) {
  46176. // remove self from vm's watcher list
  46177. // this is a somewhat expensive operation so we skip it
  46178. // if the vm is being destroyed.
  46179. if (!this.vm._isBeingDestroyed) {
  46180. remove(this.vm._watchers, this);
  46181. }
  46182. var i = this.deps.length;
  46183. while (i--) {
  46184. this.deps[i].removeSub(this);
  46185. }
  46186. this.active = false;
  46187. }
  46188. };
  46189. /* */
  46190. var sharedPropertyDefinition = {
  46191. enumerable: true,
  46192. configurable: true,
  46193. get: noop,
  46194. set: noop
  46195. };
  46196. function proxy (target, sourceKey, key) {
  46197. sharedPropertyDefinition.get = function proxyGetter () {
  46198. return this[sourceKey][key]
  46199. };
  46200. sharedPropertyDefinition.set = function proxySetter (val) {
  46201. this[sourceKey][key] = val;
  46202. };
  46203. Object.defineProperty(target, key, sharedPropertyDefinition);
  46204. }
  46205. function initState (vm) {
  46206. vm._watchers = [];
  46207. var opts = vm.$options;
  46208. if (opts.props) { initProps(vm, opts.props); }
  46209. if (opts.methods) { initMethods(vm, opts.methods); }
  46210. if (opts.data) {
  46211. initData(vm);
  46212. } else {
  46213. observe(vm._data = {}, true /* asRootData */);
  46214. }
  46215. if (opts.computed) { initComputed(vm, opts.computed); }
  46216. if (opts.watch && opts.watch !== nativeWatch) {
  46217. initWatch(vm, opts.watch);
  46218. }
  46219. }
  46220. function initProps (vm, propsOptions) {
  46221. var propsData = vm.$options.propsData || {};
  46222. var props = vm._props = {};
  46223. // cache prop keys so that future props updates can iterate using Array
  46224. // instead of dynamic object key enumeration.
  46225. var keys = vm.$options._propKeys = [];
  46226. var isRoot = !vm.$parent;
  46227. // root instance props should be converted
  46228. if (!isRoot) {
  46229. toggleObserving(false);
  46230. }
  46231. var loop = function ( key ) {
  46232. keys.push(key);
  46233. var value = validateProp(key, propsOptions, propsData, vm);
  46234. /* istanbul ignore else */
  46235. {
  46236. var hyphenatedKey = hyphenate(key);
  46237. if (isReservedAttribute(hyphenatedKey) ||
  46238. config.isReservedAttr(hyphenatedKey)) {
  46239. warn(
  46240. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  46241. vm
  46242. );
  46243. }
  46244. defineReactive$$1(props, key, value, function () {
  46245. if (!isRoot && !isUpdatingChildComponent) {
  46246. warn(
  46247. "Avoid mutating a prop directly since the value will be " +
  46248. "overwritten whenever the parent component re-renders. " +
  46249. "Instead, use a data or computed property based on the prop's " +
  46250. "value. Prop being mutated: \"" + key + "\"",
  46251. vm
  46252. );
  46253. }
  46254. });
  46255. }
  46256. // static props are already proxied on the component's prototype
  46257. // during Vue.extend(). We only need to proxy props defined at
  46258. // instantiation here.
  46259. if (!(key in vm)) {
  46260. proxy(vm, "_props", key);
  46261. }
  46262. };
  46263. for (var key in propsOptions) loop( key );
  46264. toggleObserving(true);
  46265. }
  46266. function initData (vm) {
  46267. var data = vm.$options.data;
  46268. data = vm._data = typeof data === 'function'
  46269. ? getData(data, vm)
  46270. : data || {};
  46271. if (!isPlainObject(data)) {
  46272. data = {};
  46273. warn(
  46274. 'data functions should return an object:\n' +
  46275. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  46276. vm
  46277. );
  46278. }
  46279. // proxy data on instance
  46280. var keys = Object.keys(data);
  46281. var props = vm.$options.props;
  46282. var methods = vm.$options.methods;
  46283. var i = keys.length;
  46284. while (i--) {
  46285. var key = keys[i];
  46286. {
  46287. if (methods && hasOwn(methods, key)) {
  46288. warn(
  46289. ("Method \"" + key + "\" has already been defined as a data property."),
  46290. vm
  46291. );
  46292. }
  46293. }
  46294. if (props && hasOwn(props, key)) {
  46295. warn(
  46296. "The data property \"" + key + "\" is already declared as a prop. " +
  46297. "Use prop default value instead.",
  46298. vm
  46299. );
  46300. } else if (!isReserved(key)) {
  46301. proxy(vm, "_data", key);
  46302. }
  46303. }
  46304. // observe data
  46305. observe(data, true /* asRootData */);
  46306. }
  46307. function getData (data, vm) {
  46308. // #7573 disable dep collection when invoking data getters
  46309. pushTarget();
  46310. try {
  46311. return data.call(vm, vm)
  46312. } catch (e) {
  46313. handleError(e, vm, "data()");
  46314. return {}
  46315. } finally {
  46316. popTarget();
  46317. }
  46318. }
  46319. var computedWatcherOptions = { lazy: true };
  46320. function initComputed (vm, computed) {
  46321. // $flow-disable-line
  46322. var watchers = vm._computedWatchers = Object.create(null);
  46323. // computed properties are just getters during SSR
  46324. var isSSR = isServerRendering();
  46325. for (var key in computed) {
  46326. var userDef = computed[key];
  46327. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  46328. if (getter == null) {
  46329. warn(
  46330. ("Getter is missing for computed property \"" + key + "\"."),
  46331. vm
  46332. );
  46333. }
  46334. if (!isSSR) {
  46335. // create internal watcher for the computed property.
  46336. watchers[key] = new Watcher(
  46337. vm,
  46338. getter || noop,
  46339. noop,
  46340. computedWatcherOptions
  46341. );
  46342. }
  46343. // component-defined computed properties are already defined on the
  46344. // component prototype. We only need to define computed properties defined
  46345. // at instantiation here.
  46346. if (!(key in vm)) {
  46347. defineComputed(vm, key, userDef);
  46348. } else {
  46349. if (key in vm.$data) {
  46350. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  46351. } else if (vm.$options.props && key in vm.$options.props) {
  46352. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  46353. }
  46354. }
  46355. }
  46356. }
  46357. function defineComputed (
  46358. target,
  46359. key,
  46360. userDef
  46361. ) {
  46362. var shouldCache = !isServerRendering();
  46363. if (typeof userDef === 'function') {
  46364. sharedPropertyDefinition.get = shouldCache
  46365. ? createComputedGetter(key)
  46366. : createGetterInvoker(userDef);
  46367. sharedPropertyDefinition.set = noop;
  46368. } else {
  46369. sharedPropertyDefinition.get = userDef.get
  46370. ? shouldCache && userDef.cache !== false
  46371. ? createComputedGetter(key)
  46372. : createGetterInvoker(userDef.get)
  46373. : noop;
  46374. sharedPropertyDefinition.set = userDef.set || noop;
  46375. }
  46376. if (sharedPropertyDefinition.set === noop) {
  46377. sharedPropertyDefinition.set = function () {
  46378. warn(
  46379. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  46380. this
  46381. );
  46382. };
  46383. }
  46384. Object.defineProperty(target, key, sharedPropertyDefinition);
  46385. }
  46386. function createComputedGetter (key) {
  46387. return function computedGetter () {
  46388. var watcher = this._computedWatchers && this._computedWatchers[key];
  46389. if (watcher) {
  46390. if (watcher.dirty) {
  46391. watcher.evaluate();
  46392. }
  46393. if (Dep.target) {
  46394. watcher.depend();
  46395. }
  46396. return watcher.value
  46397. }
  46398. }
  46399. }
  46400. function createGetterInvoker(fn) {
  46401. return function computedGetter () {
  46402. return fn.call(this, this)
  46403. }
  46404. }
  46405. function initMethods (vm, methods) {
  46406. var props = vm.$options.props;
  46407. for (var key in methods) {
  46408. {
  46409. if (typeof methods[key] !== 'function') {
  46410. warn(
  46411. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  46412. "Did you reference the function correctly?",
  46413. vm
  46414. );
  46415. }
  46416. if (props && hasOwn(props, key)) {
  46417. warn(
  46418. ("Method \"" + key + "\" has already been defined as a prop."),
  46419. vm
  46420. );
  46421. }
  46422. if ((key in vm) && isReserved(key)) {
  46423. warn(
  46424. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  46425. "Avoid defining component methods that start with _ or $."
  46426. );
  46427. }
  46428. }
  46429. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  46430. }
  46431. }
  46432. function initWatch (vm, watch) {
  46433. for (var key in watch) {
  46434. var handler = watch[key];
  46435. if (Array.isArray(handler)) {
  46436. for (var i = 0; i < handler.length; i++) {
  46437. createWatcher(vm, key, handler[i]);
  46438. }
  46439. } else {
  46440. createWatcher(vm, key, handler);
  46441. }
  46442. }
  46443. }
  46444. function createWatcher (
  46445. vm,
  46446. expOrFn,
  46447. handler,
  46448. options
  46449. ) {
  46450. if (isPlainObject(handler)) {
  46451. options = handler;
  46452. handler = handler.handler;
  46453. }
  46454. if (typeof handler === 'string') {
  46455. handler = vm[handler];
  46456. }
  46457. return vm.$watch(expOrFn, handler, options)
  46458. }
  46459. function stateMixin (Vue) {
  46460. // flow somehow has problems with directly declared definition object
  46461. // when using Object.defineProperty, so we have to procedurally build up
  46462. // the object here.
  46463. var dataDef = {};
  46464. dataDef.get = function () { return this._data };
  46465. var propsDef = {};
  46466. propsDef.get = function () { return this._props };
  46467. {
  46468. dataDef.set = function () {
  46469. warn(
  46470. 'Avoid replacing instance root $data. ' +
  46471. 'Use nested data properties instead.',
  46472. this
  46473. );
  46474. };
  46475. propsDef.set = function () {
  46476. warn("$props is readonly.", this);
  46477. };
  46478. }
  46479. Object.defineProperty(Vue.prototype, '$data', dataDef);
  46480. Object.defineProperty(Vue.prototype, '$props', propsDef);
  46481. Vue.prototype.$set = set;
  46482. Vue.prototype.$delete = del;
  46483. Vue.prototype.$watch = function (
  46484. expOrFn,
  46485. cb,
  46486. options
  46487. ) {
  46488. var vm = this;
  46489. if (isPlainObject(cb)) {
  46490. return createWatcher(vm, expOrFn, cb, options)
  46491. }
  46492. options = options || {};
  46493. options.user = true;
  46494. var watcher = new Watcher(vm, expOrFn, cb, options);
  46495. if (options.immediate) {
  46496. try {
  46497. cb.call(vm, watcher.value);
  46498. } catch (error) {
  46499. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  46500. }
  46501. }
  46502. return function unwatchFn () {
  46503. watcher.teardown();
  46504. }
  46505. };
  46506. }
  46507. /* */
  46508. var uid$3 = 0;
  46509. function initMixin (Vue) {
  46510. Vue.prototype._init = function (options) {
  46511. var vm = this;
  46512. // a uid
  46513. vm._uid = uid$3++;
  46514. var startTag, endTag;
  46515. /* istanbul ignore if */
  46516. if (config.performance && mark) {
  46517. startTag = "vue-perf-start:" + (vm._uid);
  46518. endTag = "vue-perf-end:" + (vm._uid);
  46519. mark(startTag);
  46520. }
  46521. // a flag to avoid this being observed
  46522. vm._isVue = true;
  46523. // merge options
  46524. if (options && options._isComponent) {
  46525. // optimize internal component instantiation
  46526. // since dynamic options merging is pretty slow, and none of the
  46527. // internal component options needs special treatment.
  46528. initInternalComponent(vm, options);
  46529. } else {
  46530. vm.$options = mergeOptions(
  46531. resolveConstructorOptions(vm.constructor),
  46532. options || {},
  46533. vm
  46534. );
  46535. }
  46536. /* istanbul ignore else */
  46537. {
  46538. initProxy(vm);
  46539. }
  46540. // expose real self
  46541. vm._self = vm;
  46542. initLifecycle(vm);
  46543. initEvents(vm);
  46544. initRender(vm);
  46545. callHook(vm, 'beforeCreate');
  46546. initInjections(vm); // resolve injections before data/props
  46547. initState(vm);
  46548. initProvide(vm); // resolve provide after data/props
  46549. callHook(vm, 'created');
  46550. /* istanbul ignore if */
  46551. if (config.performance && mark) {
  46552. vm._name = formatComponentName(vm, false);
  46553. mark(endTag);
  46554. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  46555. }
  46556. if (vm.$options.el) {
  46557. vm.$mount(vm.$options.el);
  46558. }
  46559. };
  46560. }
  46561. function initInternalComponent (vm, options) {
  46562. var opts = vm.$options = Object.create(vm.constructor.options);
  46563. // doing this because it's faster than dynamic enumeration.
  46564. var parentVnode = options._parentVnode;
  46565. opts.parent = options.parent;
  46566. opts._parentVnode = parentVnode;
  46567. var vnodeComponentOptions = parentVnode.componentOptions;
  46568. opts.propsData = vnodeComponentOptions.propsData;
  46569. opts._parentListeners = vnodeComponentOptions.listeners;
  46570. opts._renderChildren = vnodeComponentOptions.children;
  46571. opts._componentTag = vnodeComponentOptions.tag;
  46572. if (options.render) {
  46573. opts.render = options.render;
  46574. opts.staticRenderFns = options.staticRenderFns;
  46575. }
  46576. }
  46577. function resolveConstructorOptions (Ctor) {
  46578. var options = Ctor.options;
  46579. if (Ctor.super) {
  46580. var superOptions = resolveConstructorOptions(Ctor.super);
  46581. var cachedSuperOptions = Ctor.superOptions;
  46582. if (superOptions !== cachedSuperOptions) {
  46583. // super option changed,
  46584. // need to resolve new options.
  46585. Ctor.superOptions = superOptions;
  46586. // check if there are any late-modified/attached options (#4976)
  46587. var modifiedOptions = resolveModifiedOptions(Ctor);
  46588. // update base extend options
  46589. if (modifiedOptions) {
  46590. extend(Ctor.extendOptions, modifiedOptions);
  46591. }
  46592. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  46593. if (options.name) {
  46594. options.components[options.name] = Ctor;
  46595. }
  46596. }
  46597. }
  46598. return options
  46599. }
  46600. function resolveModifiedOptions (Ctor) {
  46601. var modified;
  46602. var latest = Ctor.options;
  46603. var sealed = Ctor.sealedOptions;
  46604. for (var key in latest) {
  46605. if (latest[key] !== sealed[key]) {
  46606. if (!modified) { modified = {}; }
  46607. modified[key] = latest[key];
  46608. }
  46609. }
  46610. return modified
  46611. }
  46612. function Vue (options) {
  46613. if (!(this instanceof Vue)
  46614. ) {
  46615. warn('Vue is a constructor and should be called with the `new` keyword');
  46616. }
  46617. this._init(options);
  46618. }
  46619. initMixin(Vue);
  46620. stateMixin(Vue);
  46621. eventsMixin(Vue);
  46622. lifecycleMixin(Vue);
  46623. renderMixin(Vue);
  46624. /* */
  46625. function initUse (Vue) {
  46626. Vue.use = function (plugin) {
  46627. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  46628. if (installedPlugins.indexOf(plugin) > -1) {
  46629. return this
  46630. }
  46631. // additional parameters
  46632. var args = toArray(arguments, 1);
  46633. args.unshift(this);
  46634. if (typeof plugin.install === 'function') {
  46635. plugin.install.apply(plugin, args);
  46636. } else if (typeof plugin === 'function') {
  46637. plugin.apply(null, args);
  46638. }
  46639. installedPlugins.push(plugin);
  46640. return this
  46641. };
  46642. }
  46643. /* */
  46644. function initMixin$1 (Vue) {
  46645. Vue.mixin = function (mixin) {
  46646. this.options = mergeOptions(this.options, mixin);
  46647. return this
  46648. };
  46649. }
  46650. /* */
  46651. function initExtend (Vue) {
  46652. /**
  46653. * Each instance constructor, including Vue, has a unique
  46654. * cid. This enables us to create wrapped "child
  46655. * constructors" for prototypal inheritance and cache them.
  46656. */
  46657. Vue.cid = 0;
  46658. var cid = 1;
  46659. /**
  46660. * Class inheritance
  46661. */
  46662. Vue.extend = function (extendOptions) {
  46663. extendOptions = extendOptions || {};
  46664. var Super = this;
  46665. var SuperId = Super.cid;
  46666. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  46667. if (cachedCtors[SuperId]) {
  46668. return cachedCtors[SuperId]
  46669. }
  46670. var name = extendOptions.name || Super.options.name;
  46671. if (name) {
  46672. validateComponentName(name);
  46673. }
  46674. var Sub = function VueComponent (options) {
  46675. this._init(options);
  46676. };
  46677. Sub.prototype = Object.create(Super.prototype);
  46678. Sub.prototype.constructor = Sub;
  46679. Sub.cid = cid++;
  46680. Sub.options = mergeOptions(
  46681. Super.options,
  46682. extendOptions
  46683. );
  46684. Sub['super'] = Super;
  46685. // For props and computed properties, we define the proxy getters on
  46686. // the Vue instances at extension time, on the extended prototype. This
  46687. // avoids Object.defineProperty calls for each instance created.
  46688. if (Sub.options.props) {
  46689. initProps$1(Sub);
  46690. }
  46691. if (Sub.options.computed) {
  46692. initComputed$1(Sub);
  46693. }
  46694. // allow further extension/mixin/plugin usage
  46695. Sub.extend = Super.extend;
  46696. Sub.mixin = Super.mixin;
  46697. Sub.use = Super.use;
  46698. // create asset registers, so extended classes
  46699. // can have their private assets too.
  46700. ASSET_TYPES.forEach(function (type) {
  46701. Sub[type] = Super[type];
  46702. });
  46703. // enable recursive self-lookup
  46704. if (name) {
  46705. Sub.options.components[name] = Sub;
  46706. }
  46707. // keep a reference to the super options at extension time.
  46708. // later at instantiation we can check if Super's options have
  46709. // been updated.
  46710. Sub.superOptions = Super.options;
  46711. Sub.extendOptions = extendOptions;
  46712. Sub.sealedOptions = extend({}, Sub.options);
  46713. // cache constructor
  46714. cachedCtors[SuperId] = Sub;
  46715. return Sub
  46716. };
  46717. }
  46718. function initProps$1 (Comp) {
  46719. var props = Comp.options.props;
  46720. for (var key in props) {
  46721. proxy(Comp.prototype, "_props", key);
  46722. }
  46723. }
  46724. function initComputed$1 (Comp) {
  46725. var computed = Comp.options.computed;
  46726. for (var key in computed) {
  46727. defineComputed(Comp.prototype, key, computed[key]);
  46728. }
  46729. }
  46730. /* */
  46731. function initAssetRegisters (Vue) {
  46732. /**
  46733. * Create asset registration methods.
  46734. */
  46735. ASSET_TYPES.forEach(function (type) {
  46736. Vue[type] = function (
  46737. id,
  46738. definition
  46739. ) {
  46740. if (!definition) {
  46741. return this.options[type + 's'][id]
  46742. } else {
  46743. /* istanbul ignore if */
  46744. if (type === 'component') {
  46745. validateComponentName(id);
  46746. }
  46747. if (type === 'component' && isPlainObject(definition)) {
  46748. definition.name = definition.name || id;
  46749. definition = this.options._base.extend(definition);
  46750. }
  46751. if (type === 'directive' && typeof definition === 'function') {
  46752. definition = { bind: definition, update: definition };
  46753. }
  46754. this.options[type + 's'][id] = definition;
  46755. return definition
  46756. }
  46757. };
  46758. });
  46759. }
  46760. /* */
  46761. function getComponentName (opts) {
  46762. return opts && (opts.Ctor.options.name || opts.tag)
  46763. }
  46764. function matches (pattern, name) {
  46765. if (Array.isArray(pattern)) {
  46766. return pattern.indexOf(name) > -1
  46767. } else if (typeof pattern === 'string') {
  46768. return pattern.split(',').indexOf(name) > -1
  46769. } else if (isRegExp(pattern)) {
  46770. return pattern.test(name)
  46771. }
  46772. /* istanbul ignore next */
  46773. return false
  46774. }
  46775. function pruneCache (keepAliveInstance, filter) {
  46776. var cache = keepAliveInstance.cache;
  46777. var keys = keepAliveInstance.keys;
  46778. var _vnode = keepAliveInstance._vnode;
  46779. for (var key in cache) {
  46780. var cachedNode = cache[key];
  46781. if (cachedNode) {
  46782. var name = getComponentName(cachedNode.componentOptions);
  46783. if (name && !filter(name)) {
  46784. pruneCacheEntry(cache, key, keys, _vnode);
  46785. }
  46786. }
  46787. }
  46788. }
  46789. function pruneCacheEntry (
  46790. cache,
  46791. key,
  46792. keys,
  46793. current
  46794. ) {
  46795. var cached$$1 = cache[key];
  46796. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  46797. cached$$1.componentInstance.$destroy();
  46798. }
  46799. cache[key] = null;
  46800. remove(keys, key);
  46801. }
  46802. var patternTypes = [String, RegExp, Array];
  46803. var KeepAlive = {
  46804. name: 'keep-alive',
  46805. abstract: true,
  46806. props: {
  46807. include: patternTypes,
  46808. exclude: patternTypes,
  46809. max: [String, Number]
  46810. },
  46811. created: function created () {
  46812. this.cache = Object.create(null);
  46813. this.keys = [];
  46814. },
  46815. destroyed: function destroyed () {
  46816. for (var key in this.cache) {
  46817. pruneCacheEntry(this.cache, key, this.keys);
  46818. }
  46819. },
  46820. mounted: function mounted () {
  46821. var this$1 = this;
  46822. this.$watch('include', function (val) {
  46823. pruneCache(this$1, function (name) { return matches(val, name); });
  46824. });
  46825. this.$watch('exclude', function (val) {
  46826. pruneCache(this$1, function (name) { return !matches(val, name); });
  46827. });
  46828. },
  46829. render: function render () {
  46830. var slot = this.$slots.default;
  46831. var vnode = getFirstComponentChild(slot);
  46832. var componentOptions = vnode && vnode.componentOptions;
  46833. if (componentOptions) {
  46834. // check pattern
  46835. var name = getComponentName(componentOptions);
  46836. var ref = this;
  46837. var include = ref.include;
  46838. var exclude = ref.exclude;
  46839. if (
  46840. // not included
  46841. (include && (!name || !matches(include, name))) ||
  46842. // excluded
  46843. (exclude && name && matches(exclude, name))
  46844. ) {
  46845. return vnode
  46846. }
  46847. var ref$1 = this;
  46848. var cache = ref$1.cache;
  46849. var keys = ref$1.keys;
  46850. var key = vnode.key == null
  46851. // same constructor may get registered as different local components
  46852. // so cid alone is not enough (#3269)
  46853. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  46854. : vnode.key;
  46855. if (cache[key]) {
  46856. vnode.componentInstance = cache[key].componentInstance;
  46857. // make current key freshest
  46858. remove(keys, key);
  46859. keys.push(key);
  46860. } else {
  46861. cache[key] = vnode;
  46862. keys.push(key);
  46863. // prune oldest entry
  46864. if (this.max && keys.length > parseInt(this.max)) {
  46865. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  46866. }
  46867. }
  46868. vnode.data.keepAlive = true;
  46869. }
  46870. return vnode || (slot && slot[0])
  46871. }
  46872. };
  46873. var builtInComponents = {
  46874. KeepAlive: KeepAlive
  46875. };
  46876. /* */
  46877. function initGlobalAPI (Vue) {
  46878. // config
  46879. var configDef = {};
  46880. configDef.get = function () { return config; };
  46881. {
  46882. configDef.set = function () {
  46883. warn(
  46884. 'Do not replace the Vue.config object, set individual fields instead.'
  46885. );
  46886. };
  46887. }
  46888. Object.defineProperty(Vue, 'config', configDef);
  46889. // exposed util methods.
  46890. // NOTE: these are not considered part of the public API - avoid relying on
  46891. // them unless you are aware of the risk.
  46892. Vue.util = {
  46893. warn: warn,
  46894. extend: extend,
  46895. mergeOptions: mergeOptions,
  46896. defineReactive: defineReactive$$1
  46897. };
  46898. Vue.set = set;
  46899. Vue.delete = del;
  46900. Vue.nextTick = nextTick;
  46901. // 2.6 explicit observable API
  46902. Vue.observable = function (obj) {
  46903. observe(obj);
  46904. return obj
  46905. };
  46906. Vue.options = Object.create(null);
  46907. ASSET_TYPES.forEach(function (type) {
  46908. Vue.options[type + 's'] = Object.create(null);
  46909. });
  46910. // this is used to identify the "base" constructor to extend all plain-object
  46911. // components with in Weex's multi-instance scenarios.
  46912. Vue.options._base = Vue;
  46913. extend(Vue.options.components, builtInComponents);
  46914. initUse(Vue);
  46915. initMixin$1(Vue);
  46916. initExtend(Vue);
  46917. initAssetRegisters(Vue);
  46918. }
  46919. initGlobalAPI(Vue);
  46920. Object.defineProperty(Vue.prototype, '$isServer', {
  46921. get: isServerRendering
  46922. });
  46923. Object.defineProperty(Vue.prototype, '$ssrContext', {
  46924. get: function get () {
  46925. /* istanbul ignore next */
  46926. return this.$vnode && this.$vnode.ssrContext
  46927. }
  46928. });
  46929. // expose FunctionalRenderContext for ssr runtime helper installation
  46930. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  46931. value: FunctionalRenderContext
  46932. });
  46933. Vue.version = '2.6.11';
  46934. /* */
  46935. // these are reserved for web because they are directly compiled away
  46936. // during template compilation
  46937. var isReservedAttr = makeMap('style,class');
  46938. // attributes that should be using props for binding
  46939. var acceptValue = makeMap('input,textarea,option,select,progress');
  46940. var mustUseProp = function (tag, type, attr) {
  46941. return (
  46942. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  46943. (attr === 'selected' && tag === 'option') ||
  46944. (attr === 'checked' && tag === 'input') ||
  46945. (attr === 'muted' && tag === 'video')
  46946. )
  46947. };
  46948. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  46949. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  46950. var convertEnumeratedValue = function (key, value) {
  46951. return isFalsyAttrValue(value) || value === 'false'
  46952. ? 'false'
  46953. // allow arbitrary string value for contenteditable
  46954. : key === 'contenteditable' && isValidContentEditableValue(value)
  46955. ? value
  46956. : 'true'
  46957. };
  46958. var isBooleanAttr = makeMap(
  46959. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  46960. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  46961. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  46962. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  46963. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  46964. 'truespeed,typemustmatch,visible'
  46965. );
  46966. var xlinkNS = 'http://www.w3.org/1999/xlink';
  46967. var isXlink = function (name) {
  46968. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  46969. };
  46970. var getXlinkProp = function (name) {
  46971. return isXlink(name) ? name.slice(6, name.length) : ''
  46972. };
  46973. var isFalsyAttrValue = function (val) {
  46974. return val == null || val === false
  46975. };
  46976. /* */
  46977. function genClassForVnode (vnode) {
  46978. var data = vnode.data;
  46979. var parentNode = vnode;
  46980. var childNode = vnode;
  46981. while (isDef(childNode.componentInstance)) {
  46982. childNode = childNode.componentInstance._vnode;
  46983. if (childNode && childNode.data) {
  46984. data = mergeClassData(childNode.data, data);
  46985. }
  46986. }
  46987. while (isDef(parentNode = parentNode.parent)) {
  46988. if (parentNode && parentNode.data) {
  46989. data = mergeClassData(data, parentNode.data);
  46990. }
  46991. }
  46992. return renderClass(data.staticClass, data.class)
  46993. }
  46994. function mergeClassData (child, parent) {
  46995. return {
  46996. staticClass: concat(child.staticClass, parent.staticClass),
  46997. class: isDef(child.class)
  46998. ? [child.class, parent.class]
  46999. : parent.class
  47000. }
  47001. }
  47002. function renderClass (
  47003. staticClass,
  47004. dynamicClass
  47005. ) {
  47006. if (isDef(staticClass) || isDef(dynamicClass)) {
  47007. return concat(staticClass, stringifyClass(dynamicClass))
  47008. }
  47009. /* istanbul ignore next */
  47010. return ''
  47011. }
  47012. function concat (a, b) {
  47013. return a ? b ? (a + ' ' + b) : a : (b || '')
  47014. }
  47015. function stringifyClass (value) {
  47016. if (Array.isArray(value)) {
  47017. return stringifyArray(value)
  47018. }
  47019. if (isObject(value)) {
  47020. return stringifyObject(value)
  47021. }
  47022. if (typeof value === 'string') {
  47023. return value
  47024. }
  47025. /* istanbul ignore next */
  47026. return ''
  47027. }
  47028. function stringifyArray (value) {
  47029. var res = '';
  47030. var stringified;
  47031. for (var i = 0, l = value.length; i < l; i++) {
  47032. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  47033. if (res) { res += ' '; }
  47034. res += stringified;
  47035. }
  47036. }
  47037. return res
  47038. }
  47039. function stringifyObject (value) {
  47040. var res = '';
  47041. for (var key in value) {
  47042. if (value[key]) {
  47043. if (res) { res += ' '; }
  47044. res += key;
  47045. }
  47046. }
  47047. return res
  47048. }
  47049. /* */
  47050. var namespaceMap = {
  47051. svg: 'http://www.w3.org/2000/svg',
  47052. math: 'http://www.w3.org/1998/Math/MathML'
  47053. };
  47054. var isHTMLTag = makeMap(
  47055. 'html,body,base,head,link,meta,style,title,' +
  47056. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  47057. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  47058. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  47059. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  47060. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  47061. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  47062. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  47063. 'output,progress,select,textarea,' +
  47064. 'details,dialog,menu,menuitem,summary,' +
  47065. 'content,element,shadow,template,blockquote,iframe,tfoot'
  47066. );
  47067. // this map is intentionally selective, only covering SVG elements that may
  47068. // contain child elements.
  47069. var isSVG = makeMap(
  47070. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  47071. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  47072. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  47073. true
  47074. );
  47075. var isPreTag = function (tag) { return tag === 'pre'; };
  47076. var isReservedTag = function (tag) {
  47077. return isHTMLTag(tag) || isSVG(tag)
  47078. };
  47079. function getTagNamespace (tag) {
  47080. if (isSVG(tag)) {
  47081. return 'svg'
  47082. }
  47083. // basic support for MathML
  47084. // note it doesn't support other MathML elements being component roots
  47085. if (tag === 'math') {
  47086. return 'math'
  47087. }
  47088. }
  47089. var unknownElementCache = Object.create(null);
  47090. function isUnknownElement (tag) {
  47091. /* istanbul ignore if */
  47092. if (!inBrowser) {
  47093. return true
  47094. }
  47095. if (isReservedTag(tag)) {
  47096. return false
  47097. }
  47098. tag = tag.toLowerCase();
  47099. /* istanbul ignore if */
  47100. if (unknownElementCache[tag] != null) {
  47101. return unknownElementCache[tag]
  47102. }
  47103. var el = document.createElement(tag);
  47104. if (tag.indexOf('-') > -1) {
  47105. // http://stackoverflow.com/a/28210364/1070244
  47106. return (unknownElementCache[tag] = (
  47107. el.constructor === window.HTMLUnknownElement ||
  47108. el.constructor === window.HTMLElement
  47109. ))
  47110. } else {
  47111. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  47112. }
  47113. }
  47114. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  47115. /* */
  47116. /**
  47117. * Query an element selector if it's not an element already.
  47118. */
  47119. function query (el) {
  47120. if (typeof el === 'string') {
  47121. var selected = document.querySelector(el);
  47122. if (!selected) {
  47123. warn(
  47124. 'Cannot find element: ' + el
  47125. );
  47126. return document.createElement('div')
  47127. }
  47128. return selected
  47129. } else {
  47130. return el
  47131. }
  47132. }
  47133. /* */
  47134. function createElement$1 (tagName, vnode) {
  47135. var elm = document.createElement(tagName);
  47136. if (tagName !== 'select') {
  47137. return elm
  47138. }
  47139. // false or null will remove the attribute but undefined will not
  47140. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  47141. elm.setAttribute('multiple', 'multiple');
  47142. }
  47143. return elm
  47144. }
  47145. function createElementNS (namespace, tagName) {
  47146. return document.createElementNS(namespaceMap[namespace], tagName)
  47147. }
  47148. function createTextNode (text) {
  47149. return document.createTextNode(text)
  47150. }
  47151. function createComment (text) {
  47152. return document.createComment(text)
  47153. }
  47154. function insertBefore (parentNode, newNode, referenceNode) {
  47155. parentNode.insertBefore(newNode, referenceNode);
  47156. }
  47157. function removeChild (node, child) {
  47158. node.removeChild(child);
  47159. }
  47160. function appendChild (node, child) {
  47161. node.appendChild(child);
  47162. }
  47163. function parentNode (node) {
  47164. return node.parentNode
  47165. }
  47166. function nextSibling (node) {
  47167. return node.nextSibling
  47168. }
  47169. function tagName (node) {
  47170. return node.tagName
  47171. }
  47172. function setTextContent (node, text) {
  47173. node.textContent = text;
  47174. }
  47175. function setStyleScope (node, scopeId) {
  47176. node.setAttribute(scopeId, '');
  47177. }
  47178. var nodeOps = /*#__PURE__*/Object.freeze({
  47179. createElement: createElement$1,
  47180. createElementNS: createElementNS,
  47181. createTextNode: createTextNode,
  47182. createComment: createComment,
  47183. insertBefore: insertBefore,
  47184. removeChild: removeChild,
  47185. appendChild: appendChild,
  47186. parentNode: parentNode,
  47187. nextSibling: nextSibling,
  47188. tagName: tagName,
  47189. setTextContent: setTextContent,
  47190. setStyleScope: setStyleScope
  47191. });
  47192. /* */
  47193. var ref = {
  47194. create: function create (_, vnode) {
  47195. registerRef(vnode);
  47196. },
  47197. update: function update (oldVnode, vnode) {
  47198. if (oldVnode.data.ref !== vnode.data.ref) {
  47199. registerRef(oldVnode, true);
  47200. registerRef(vnode);
  47201. }
  47202. },
  47203. destroy: function destroy (vnode) {
  47204. registerRef(vnode, true);
  47205. }
  47206. };
  47207. function registerRef (vnode, isRemoval) {
  47208. var key = vnode.data.ref;
  47209. if (!isDef(key)) { return }
  47210. var vm = vnode.context;
  47211. var ref = vnode.componentInstance || vnode.elm;
  47212. var refs = vm.$refs;
  47213. if (isRemoval) {
  47214. if (Array.isArray(refs[key])) {
  47215. remove(refs[key], ref);
  47216. } else if (refs[key] === ref) {
  47217. refs[key] = undefined;
  47218. }
  47219. } else {
  47220. if (vnode.data.refInFor) {
  47221. if (!Array.isArray(refs[key])) {
  47222. refs[key] = [ref];
  47223. } else if (refs[key].indexOf(ref) < 0) {
  47224. // $flow-disable-line
  47225. refs[key].push(ref);
  47226. }
  47227. } else {
  47228. refs[key] = ref;
  47229. }
  47230. }
  47231. }
  47232. /**
  47233. * Virtual DOM patching algorithm based on Snabbdom by
  47234. * Simon Friis Vindum (@paldepind)
  47235. * Licensed under the MIT License
  47236. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  47237. *
  47238. * modified by Evan You (@yyx990803)
  47239. *
  47240. * Not type-checking this because this file is perf-critical and the cost
  47241. * of making flow understand it is not worth it.
  47242. */
  47243. var emptyNode = new VNode('', {}, []);
  47244. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  47245. function sameVnode (a, b) {
  47246. return (
  47247. a.key === b.key && (
  47248. (
  47249. a.tag === b.tag &&
  47250. a.isComment === b.isComment &&
  47251. isDef(a.data) === isDef(b.data) &&
  47252. sameInputType(a, b)
  47253. ) || (
  47254. isTrue(a.isAsyncPlaceholder) &&
  47255. a.asyncFactory === b.asyncFactory &&
  47256. isUndef(b.asyncFactory.error)
  47257. )
  47258. )
  47259. )
  47260. }
  47261. function sameInputType (a, b) {
  47262. if (a.tag !== 'input') { return true }
  47263. var i;
  47264. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  47265. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  47266. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  47267. }
  47268. function createKeyToOldIdx (children, beginIdx, endIdx) {
  47269. var i, key;
  47270. var map = {};
  47271. for (i = beginIdx; i <= endIdx; ++i) {
  47272. key = children[i].key;
  47273. if (isDef(key)) { map[key] = i; }
  47274. }
  47275. return map
  47276. }
  47277. function createPatchFunction (backend) {
  47278. var i, j;
  47279. var cbs = {};
  47280. var modules = backend.modules;
  47281. var nodeOps = backend.nodeOps;
  47282. for (i = 0; i < hooks.length; ++i) {
  47283. cbs[hooks[i]] = [];
  47284. for (j = 0; j < modules.length; ++j) {
  47285. if (isDef(modules[j][hooks[i]])) {
  47286. cbs[hooks[i]].push(modules[j][hooks[i]]);
  47287. }
  47288. }
  47289. }
  47290. function emptyNodeAt (elm) {
  47291. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  47292. }
  47293. function createRmCb (childElm, listeners) {
  47294. function remove$$1 () {
  47295. if (--remove$$1.listeners === 0) {
  47296. removeNode(childElm);
  47297. }
  47298. }
  47299. remove$$1.listeners = listeners;
  47300. return remove$$1
  47301. }
  47302. function removeNode (el) {
  47303. var parent = nodeOps.parentNode(el);
  47304. // element may have already been removed due to v-html / v-text
  47305. if (isDef(parent)) {
  47306. nodeOps.removeChild(parent, el);
  47307. }
  47308. }
  47309. function isUnknownElement$$1 (vnode, inVPre) {
  47310. return (
  47311. !inVPre &&
  47312. !vnode.ns &&
  47313. !(
  47314. config.ignoredElements.length &&
  47315. config.ignoredElements.some(function (ignore) {
  47316. return isRegExp(ignore)
  47317. ? ignore.test(vnode.tag)
  47318. : ignore === vnode.tag
  47319. })
  47320. ) &&
  47321. config.isUnknownElement(vnode.tag)
  47322. )
  47323. }
  47324. var creatingElmInVPre = 0;
  47325. function createElm (
  47326. vnode,
  47327. insertedVnodeQueue,
  47328. parentElm,
  47329. refElm,
  47330. nested,
  47331. ownerArray,
  47332. index
  47333. ) {
  47334. if (isDef(vnode.elm) && isDef(ownerArray)) {
  47335. // This vnode was used in a previous render!
  47336. // now it's used as a new node, overwriting its elm would cause
  47337. // potential patch errors down the road when it's used as an insertion
  47338. // reference node. Instead, we clone the node on-demand before creating
  47339. // associated DOM element for it.
  47340. vnode = ownerArray[index] = cloneVNode(vnode);
  47341. }
  47342. vnode.isRootInsert = !nested; // for transition enter check
  47343. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  47344. return
  47345. }
  47346. var data = vnode.data;
  47347. var children = vnode.children;
  47348. var tag = vnode.tag;
  47349. if (isDef(tag)) {
  47350. {
  47351. if (data && data.pre) {
  47352. creatingElmInVPre++;
  47353. }
  47354. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  47355. warn(
  47356. 'Unknown custom element: <' + tag + '> - did you ' +
  47357. 'register the component correctly? For recursive components, ' +
  47358. 'make sure to provide the "name" option.',
  47359. vnode.context
  47360. );
  47361. }
  47362. }
  47363. vnode.elm = vnode.ns
  47364. ? nodeOps.createElementNS(vnode.ns, tag)
  47365. : nodeOps.createElement(tag, vnode);
  47366. setScope(vnode);
  47367. /* istanbul ignore if */
  47368. {
  47369. createChildren(vnode, children, insertedVnodeQueue);
  47370. if (isDef(data)) {
  47371. invokeCreateHooks(vnode, insertedVnodeQueue);
  47372. }
  47373. insert(parentElm, vnode.elm, refElm);
  47374. }
  47375. if (data && data.pre) {
  47376. creatingElmInVPre--;
  47377. }
  47378. } else if (isTrue(vnode.isComment)) {
  47379. vnode.elm = nodeOps.createComment(vnode.text);
  47380. insert(parentElm, vnode.elm, refElm);
  47381. } else {
  47382. vnode.elm = nodeOps.createTextNode(vnode.text);
  47383. insert(parentElm, vnode.elm, refElm);
  47384. }
  47385. }
  47386. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  47387. var i = vnode.data;
  47388. if (isDef(i)) {
  47389. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  47390. if (isDef(i = i.hook) && isDef(i = i.init)) {
  47391. i(vnode, false /* hydrating */);
  47392. }
  47393. // after calling the init hook, if the vnode is a child component
  47394. // it should've created a child instance and mounted it. the child
  47395. // component also has set the placeholder vnode's elm.
  47396. // in that case we can just return the element and be done.
  47397. if (isDef(vnode.componentInstance)) {
  47398. initComponent(vnode, insertedVnodeQueue);
  47399. insert(parentElm, vnode.elm, refElm);
  47400. if (isTrue(isReactivated)) {
  47401. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  47402. }
  47403. return true
  47404. }
  47405. }
  47406. }
  47407. function initComponent (vnode, insertedVnodeQueue) {
  47408. if (isDef(vnode.data.pendingInsert)) {
  47409. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  47410. vnode.data.pendingInsert = null;
  47411. }
  47412. vnode.elm = vnode.componentInstance.$el;
  47413. if (isPatchable(vnode)) {
  47414. invokeCreateHooks(vnode, insertedVnodeQueue);
  47415. setScope(vnode);
  47416. } else {
  47417. // empty component root.
  47418. // skip all element-related modules except for ref (#3455)
  47419. registerRef(vnode);
  47420. // make sure to invoke the insert hook
  47421. insertedVnodeQueue.push(vnode);
  47422. }
  47423. }
  47424. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  47425. var i;
  47426. // hack for #4339: a reactivated component with inner transition
  47427. // does not trigger because the inner node's created hooks are not called
  47428. // again. It's not ideal to involve module-specific logic in here but
  47429. // there doesn't seem to be a better way to do it.
  47430. var innerNode = vnode;
  47431. while (innerNode.componentInstance) {
  47432. innerNode = innerNode.componentInstance._vnode;
  47433. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  47434. for (i = 0; i < cbs.activate.length; ++i) {
  47435. cbs.activate[i](emptyNode, innerNode);
  47436. }
  47437. insertedVnodeQueue.push(innerNode);
  47438. break
  47439. }
  47440. }
  47441. // unlike a newly created component,
  47442. // a reactivated keep-alive component doesn't insert itself
  47443. insert(parentElm, vnode.elm, refElm);
  47444. }
  47445. function insert (parent, elm, ref$$1) {
  47446. if (isDef(parent)) {
  47447. if (isDef(ref$$1)) {
  47448. if (nodeOps.parentNode(ref$$1) === parent) {
  47449. nodeOps.insertBefore(parent, elm, ref$$1);
  47450. }
  47451. } else {
  47452. nodeOps.appendChild(parent, elm);
  47453. }
  47454. }
  47455. }
  47456. function createChildren (vnode, children, insertedVnodeQueue) {
  47457. if (Array.isArray(children)) {
  47458. {
  47459. checkDuplicateKeys(children);
  47460. }
  47461. for (var i = 0; i < children.length; ++i) {
  47462. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  47463. }
  47464. } else if (isPrimitive(vnode.text)) {
  47465. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  47466. }
  47467. }
  47468. function isPatchable (vnode) {
  47469. while (vnode.componentInstance) {
  47470. vnode = vnode.componentInstance._vnode;
  47471. }
  47472. return isDef(vnode.tag)
  47473. }
  47474. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  47475. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  47476. cbs.create[i$1](emptyNode, vnode);
  47477. }
  47478. i = vnode.data.hook; // Reuse variable
  47479. if (isDef(i)) {
  47480. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  47481. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  47482. }
  47483. }
  47484. // set scope id attribute for scoped CSS.
  47485. // this is implemented as a special case to avoid the overhead
  47486. // of going through the normal attribute patching process.
  47487. function setScope (vnode) {
  47488. var i;
  47489. if (isDef(i = vnode.fnScopeId)) {
  47490. nodeOps.setStyleScope(vnode.elm, i);
  47491. } else {
  47492. var ancestor = vnode;
  47493. while (ancestor) {
  47494. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  47495. nodeOps.setStyleScope(vnode.elm, i);
  47496. }
  47497. ancestor = ancestor.parent;
  47498. }
  47499. }
  47500. // for slot content they should also get the scopeId from the host instance.
  47501. if (isDef(i = activeInstance) &&
  47502. i !== vnode.context &&
  47503. i !== vnode.fnContext &&
  47504. isDef(i = i.$options._scopeId)
  47505. ) {
  47506. nodeOps.setStyleScope(vnode.elm, i);
  47507. }
  47508. }
  47509. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  47510. for (; startIdx <= endIdx; ++startIdx) {
  47511. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  47512. }
  47513. }
  47514. function invokeDestroyHook (vnode) {
  47515. var i, j;
  47516. var data = vnode.data;
  47517. if (isDef(data)) {
  47518. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  47519. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  47520. }
  47521. if (isDef(i = vnode.children)) {
  47522. for (j = 0; j < vnode.children.length; ++j) {
  47523. invokeDestroyHook(vnode.children[j]);
  47524. }
  47525. }
  47526. }
  47527. function removeVnodes (vnodes, startIdx, endIdx) {
  47528. for (; startIdx <= endIdx; ++startIdx) {
  47529. var ch = vnodes[startIdx];
  47530. if (isDef(ch)) {
  47531. if (isDef(ch.tag)) {
  47532. removeAndInvokeRemoveHook(ch);
  47533. invokeDestroyHook(ch);
  47534. } else { // Text node
  47535. removeNode(ch.elm);
  47536. }
  47537. }
  47538. }
  47539. }
  47540. function removeAndInvokeRemoveHook (vnode, rm) {
  47541. if (isDef(rm) || isDef(vnode.data)) {
  47542. var i;
  47543. var listeners = cbs.remove.length + 1;
  47544. if (isDef(rm)) {
  47545. // we have a recursively passed down rm callback
  47546. // increase the listeners count
  47547. rm.listeners += listeners;
  47548. } else {
  47549. // directly removing
  47550. rm = createRmCb(vnode.elm, listeners);
  47551. }
  47552. // recursively invoke hooks on child component root node
  47553. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  47554. removeAndInvokeRemoveHook(i, rm);
  47555. }
  47556. for (i = 0; i < cbs.remove.length; ++i) {
  47557. cbs.remove[i](vnode, rm);
  47558. }
  47559. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  47560. i(vnode, rm);
  47561. } else {
  47562. rm();
  47563. }
  47564. } else {
  47565. removeNode(vnode.elm);
  47566. }
  47567. }
  47568. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  47569. var oldStartIdx = 0;
  47570. var newStartIdx = 0;
  47571. var oldEndIdx = oldCh.length - 1;
  47572. var oldStartVnode = oldCh[0];
  47573. var oldEndVnode = oldCh[oldEndIdx];
  47574. var newEndIdx = newCh.length - 1;
  47575. var newStartVnode = newCh[0];
  47576. var newEndVnode = newCh[newEndIdx];
  47577. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  47578. // removeOnly is a special flag used only by <transition-group>
  47579. // to ensure removed elements stay in correct relative positions
  47580. // during leaving transitions
  47581. var canMove = !removeOnly;
  47582. {
  47583. checkDuplicateKeys(newCh);
  47584. }
  47585. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  47586. if (isUndef(oldStartVnode)) {
  47587. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  47588. } else if (isUndef(oldEndVnode)) {
  47589. oldEndVnode = oldCh[--oldEndIdx];
  47590. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  47591. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  47592. oldStartVnode = oldCh[++oldStartIdx];
  47593. newStartVnode = newCh[++newStartIdx];
  47594. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  47595. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  47596. oldEndVnode = oldCh[--oldEndIdx];
  47597. newEndVnode = newCh[--newEndIdx];
  47598. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  47599. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  47600. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  47601. oldStartVnode = oldCh[++oldStartIdx];
  47602. newEndVnode = newCh[--newEndIdx];
  47603. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  47604. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  47605. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  47606. oldEndVnode = oldCh[--oldEndIdx];
  47607. newStartVnode = newCh[++newStartIdx];
  47608. } else {
  47609. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  47610. idxInOld = isDef(newStartVnode.key)
  47611. ? oldKeyToIdx[newStartVnode.key]
  47612. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  47613. if (isUndef(idxInOld)) { // New element
  47614. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  47615. } else {
  47616. vnodeToMove = oldCh[idxInOld];
  47617. if (sameVnode(vnodeToMove, newStartVnode)) {
  47618. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  47619. oldCh[idxInOld] = undefined;
  47620. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  47621. } else {
  47622. // same key but different element. treat as new element
  47623. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  47624. }
  47625. }
  47626. newStartVnode = newCh[++newStartIdx];
  47627. }
  47628. }
  47629. if (oldStartIdx > oldEndIdx) {
  47630. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  47631. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  47632. } else if (newStartIdx > newEndIdx) {
  47633. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  47634. }
  47635. }
  47636. function checkDuplicateKeys (children) {
  47637. var seenKeys = {};
  47638. for (var i = 0; i < children.length; i++) {
  47639. var vnode = children[i];
  47640. var key = vnode.key;
  47641. if (isDef(key)) {
  47642. if (seenKeys[key]) {
  47643. warn(
  47644. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  47645. vnode.context
  47646. );
  47647. } else {
  47648. seenKeys[key] = true;
  47649. }
  47650. }
  47651. }
  47652. }
  47653. function findIdxInOld (node, oldCh, start, end) {
  47654. for (var i = start; i < end; i++) {
  47655. var c = oldCh[i];
  47656. if (isDef(c) && sameVnode(node, c)) { return i }
  47657. }
  47658. }
  47659. function patchVnode (
  47660. oldVnode,
  47661. vnode,
  47662. insertedVnodeQueue,
  47663. ownerArray,
  47664. index,
  47665. removeOnly
  47666. ) {
  47667. if (oldVnode === vnode) {
  47668. return
  47669. }
  47670. if (isDef(vnode.elm) && isDef(ownerArray)) {
  47671. // clone reused vnode
  47672. vnode = ownerArray[index] = cloneVNode(vnode);
  47673. }
  47674. var elm = vnode.elm = oldVnode.elm;
  47675. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  47676. if (isDef(vnode.asyncFactory.resolved)) {
  47677. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  47678. } else {
  47679. vnode.isAsyncPlaceholder = true;
  47680. }
  47681. return
  47682. }
  47683. // reuse element for static trees.
  47684. // note we only do this if the vnode is cloned -
  47685. // if the new node is not cloned it means the render functions have been
  47686. // reset by the hot-reload-api and we need to do a proper re-render.
  47687. if (isTrue(vnode.isStatic) &&
  47688. isTrue(oldVnode.isStatic) &&
  47689. vnode.key === oldVnode.key &&
  47690. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  47691. ) {
  47692. vnode.componentInstance = oldVnode.componentInstance;
  47693. return
  47694. }
  47695. var i;
  47696. var data = vnode.data;
  47697. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  47698. i(oldVnode, vnode);
  47699. }
  47700. var oldCh = oldVnode.children;
  47701. var ch = vnode.children;
  47702. if (isDef(data) && isPatchable(vnode)) {
  47703. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  47704. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  47705. }
  47706. if (isUndef(vnode.text)) {
  47707. if (isDef(oldCh) && isDef(ch)) {
  47708. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  47709. } else if (isDef(ch)) {
  47710. {
  47711. checkDuplicateKeys(ch);
  47712. }
  47713. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  47714. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  47715. } else if (isDef(oldCh)) {
  47716. removeVnodes(oldCh, 0, oldCh.length - 1);
  47717. } else if (isDef(oldVnode.text)) {
  47718. nodeOps.setTextContent(elm, '');
  47719. }
  47720. } else if (oldVnode.text !== vnode.text) {
  47721. nodeOps.setTextContent(elm, vnode.text);
  47722. }
  47723. if (isDef(data)) {
  47724. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  47725. }
  47726. }
  47727. function invokeInsertHook (vnode, queue, initial) {
  47728. // delay insert hooks for component root nodes, invoke them after the
  47729. // element is really inserted
  47730. if (isTrue(initial) && isDef(vnode.parent)) {
  47731. vnode.parent.data.pendingInsert = queue;
  47732. } else {
  47733. for (var i = 0; i < queue.length; ++i) {
  47734. queue[i].data.hook.insert(queue[i]);
  47735. }
  47736. }
  47737. }
  47738. var hydrationBailed = false;
  47739. // list of modules that can skip create hook during hydration because they
  47740. // are already rendered on the client or has no need for initialization
  47741. // Note: style is excluded because it relies on initial clone for future
  47742. // deep updates (#7063).
  47743. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  47744. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  47745. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  47746. var i;
  47747. var tag = vnode.tag;
  47748. var data = vnode.data;
  47749. var children = vnode.children;
  47750. inVPre = inVPre || (data && data.pre);
  47751. vnode.elm = elm;
  47752. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  47753. vnode.isAsyncPlaceholder = true;
  47754. return true
  47755. }
  47756. // assert node match
  47757. {
  47758. if (!assertNodeMatch(elm, vnode, inVPre)) {
  47759. return false
  47760. }
  47761. }
  47762. if (isDef(data)) {
  47763. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  47764. if (isDef(i = vnode.componentInstance)) {
  47765. // child component. it should have hydrated its own tree.
  47766. initComponent(vnode, insertedVnodeQueue);
  47767. return true
  47768. }
  47769. }
  47770. if (isDef(tag)) {
  47771. if (isDef(children)) {
  47772. // empty element, allow client to pick up and populate children
  47773. if (!elm.hasChildNodes()) {
  47774. createChildren(vnode, children, insertedVnodeQueue);
  47775. } else {
  47776. // v-html and domProps: innerHTML
  47777. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  47778. if (i !== elm.innerHTML) {
  47779. /* istanbul ignore if */
  47780. if (typeof console !== 'undefined' &&
  47781. !hydrationBailed
  47782. ) {
  47783. hydrationBailed = true;
  47784. console.warn('Parent: ', elm);
  47785. console.warn('server innerHTML: ', i);
  47786. console.warn('client innerHTML: ', elm.innerHTML);
  47787. }
  47788. return false
  47789. }
  47790. } else {
  47791. // iterate and compare children lists
  47792. var childrenMatch = true;
  47793. var childNode = elm.firstChild;
  47794. for (var i$1 = 0; i$1 < children.length; i$1++) {
  47795. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  47796. childrenMatch = false;
  47797. break
  47798. }
  47799. childNode = childNode.nextSibling;
  47800. }
  47801. // if childNode is not null, it means the actual childNodes list is
  47802. // longer than the virtual children list.
  47803. if (!childrenMatch || childNode) {
  47804. /* istanbul ignore if */
  47805. if (typeof console !== 'undefined' &&
  47806. !hydrationBailed
  47807. ) {
  47808. hydrationBailed = true;
  47809. console.warn('Parent: ', elm);
  47810. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  47811. }
  47812. return false
  47813. }
  47814. }
  47815. }
  47816. }
  47817. if (isDef(data)) {
  47818. var fullInvoke = false;
  47819. for (var key in data) {
  47820. if (!isRenderedModule(key)) {
  47821. fullInvoke = true;
  47822. invokeCreateHooks(vnode, insertedVnodeQueue);
  47823. break
  47824. }
  47825. }
  47826. if (!fullInvoke && data['class']) {
  47827. // ensure collecting deps for deep class bindings for future updates
  47828. traverse(data['class']);
  47829. }
  47830. }
  47831. } else if (elm.data !== vnode.text) {
  47832. elm.data = vnode.text;
  47833. }
  47834. return true
  47835. }
  47836. function assertNodeMatch (node, vnode, inVPre) {
  47837. if (isDef(vnode.tag)) {
  47838. return vnode.tag.indexOf('vue-component') === 0 || (
  47839. !isUnknownElement$$1(vnode, inVPre) &&
  47840. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  47841. )
  47842. } else {
  47843. return node.nodeType === (vnode.isComment ? 8 : 3)
  47844. }
  47845. }
  47846. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  47847. if (isUndef(vnode)) {
  47848. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  47849. return
  47850. }
  47851. var isInitialPatch = false;
  47852. var insertedVnodeQueue = [];
  47853. if (isUndef(oldVnode)) {
  47854. // empty mount (likely as component), create new root element
  47855. isInitialPatch = true;
  47856. createElm(vnode, insertedVnodeQueue);
  47857. } else {
  47858. var isRealElement = isDef(oldVnode.nodeType);
  47859. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  47860. // patch existing root node
  47861. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  47862. } else {
  47863. if (isRealElement) {
  47864. // mounting to a real element
  47865. // check if this is server-rendered content and if we can perform
  47866. // a successful hydration.
  47867. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  47868. oldVnode.removeAttribute(SSR_ATTR);
  47869. hydrating = true;
  47870. }
  47871. if (isTrue(hydrating)) {
  47872. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  47873. invokeInsertHook(vnode, insertedVnodeQueue, true);
  47874. return oldVnode
  47875. } else {
  47876. warn(
  47877. 'The client-side rendered virtual DOM tree is not matching ' +
  47878. 'server-rendered content. This is likely caused by incorrect ' +
  47879. 'HTML markup, for example nesting block-level elements inside ' +
  47880. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  47881. 'full client-side render.'
  47882. );
  47883. }
  47884. }
  47885. // either not server-rendered, or hydration failed.
  47886. // create an empty node and replace it
  47887. oldVnode = emptyNodeAt(oldVnode);
  47888. }
  47889. // replacing existing element
  47890. var oldElm = oldVnode.elm;
  47891. var parentElm = nodeOps.parentNode(oldElm);
  47892. // create new node
  47893. createElm(
  47894. vnode,
  47895. insertedVnodeQueue,
  47896. // extremely rare edge case: do not insert if old element is in a
  47897. // leaving transition. Only happens when combining transition +
  47898. // keep-alive + HOCs. (#4590)
  47899. oldElm._leaveCb ? null : parentElm,
  47900. nodeOps.nextSibling(oldElm)
  47901. );
  47902. // update parent placeholder node element, recursively
  47903. if (isDef(vnode.parent)) {
  47904. var ancestor = vnode.parent;
  47905. var patchable = isPatchable(vnode);
  47906. while (ancestor) {
  47907. for (var i = 0; i < cbs.destroy.length; ++i) {
  47908. cbs.destroy[i](ancestor);
  47909. }
  47910. ancestor.elm = vnode.elm;
  47911. if (patchable) {
  47912. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  47913. cbs.create[i$1](emptyNode, ancestor);
  47914. }
  47915. // #6513
  47916. // invoke insert hooks that may have been merged by create hooks.
  47917. // e.g. for directives that uses the "inserted" hook.
  47918. var insert = ancestor.data.hook.insert;
  47919. if (insert.merged) {
  47920. // start at index 1 to avoid re-invoking component mounted hook
  47921. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  47922. insert.fns[i$2]();
  47923. }
  47924. }
  47925. } else {
  47926. registerRef(ancestor);
  47927. }
  47928. ancestor = ancestor.parent;
  47929. }
  47930. }
  47931. // destroy old node
  47932. if (isDef(parentElm)) {
  47933. removeVnodes([oldVnode], 0, 0);
  47934. } else if (isDef(oldVnode.tag)) {
  47935. invokeDestroyHook(oldVnode);
  47936. }
  47937. }
  47938. }
  47939. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  47940. return vnode.elm
  47941. }
  47942. }
  47943. /* */
  47944. var directives = {
  47945. create: updateDirectives,
  47946. update: updateDirectives,
  47947. destroy: function unbindDirectives (vnode) {
  47948. updateDirectives(vnode, emptyNode);
  47949. }
  47950. };
  47951. function updateDirectives (oldVnode, vnode) {
  47952. if (oldVnode.data.directives || vnode.data.directives) {
  47953. _update(oldVnode, vnode);
  47954. }
  47955. }
  47956. function _update (oldVnode, vnode) {
  47957. var isCreate = oldVnode === emptyNode;
  47958. var isDestroy = vnode === emptyNode;
  47959. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  47960. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  47961. var dirsWithInsert = [];
  47962. var dirsWithPostpatch = [];
  47963. var key, oldDir, dir;
  47964. for (key in newDirs) {
  47965. oldDir = oldDirs[key];
  47966. dir = newDirs[key];
  47967. if (!oldDir) {
  47968. // new directive, bind
  47969. callHook$1(dir, 'bind', vnode, oldVnode);
  47970. if (dir.def && dir.def.inserted) {
  47971. dirsWithInsert.push(dir);
  47972. }
  47973. } else {
  47974. // existing directive, update
  47975. dir.oldValue = oldDir.value;
  47976. dir.oldArg = oldDir.arg;
  47977. callHook$1(dir, 'update', vnode, oldVnode);
  47978. if (dir.def && dir.def.componentUpdated) {
  47979. dirsWithPostpatch.push(dir);
  47980. }
  47981. }
  47982. }
  47983. if (dirsWithInsert.length) {
  47984. var callInsert = function () {
  47985. for (var i = 0; i < dirsWithInsert.length; i++) {
  47986. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  47987. }
  47988. };
  47989. if (isCreate) {
  47990. mergeVNodeHook(vnode, 'insert', callInsert);
  47991. } else {
  47992. callInsert();
  47993. }
  47994. }
  47995. if (dirsWithPostpatch.length) {
  47996. mergeVNodeHook(vnode, 'postpatch', function () {
  47997. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  47998. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  47999. }
  48000. });
  48001. }
  48002. if (!isCreate) {
  48003. for (key in oldDirs) {
  48004. if (!newDirs[key]) {
  48005. // no longer present, unbind
  48006. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  48007. }
  48008. }
  48009. }
  48010. }
  48011. var emptyModifiers = Object.create(null);
  48012. function normalizeDirectives$1 (
  48013. dirs,
  48014. vm
  48015. ) {
  48016. var res = Object.create(null);
  48017. if (!dirs) {
  48018. // $flow-disable-line
  48019. return res
  48020. }
  48021. var i, dir;
  48022. for (i = 0; i < dirs.length; i++) {
  48023. dir = dirs[i];
  48024. if (!dir.modifiers) {
  48025. // $flow-disable-line
  48026. dir.modifiers = emptyModifiers;
  48027. }
  48028. res[getRawDirName(dir)] = dir;
  48029. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  48030. }
  48031. // $flow-disable-line
  48032. return res
  48033. }
  48034. function getRawDirName (dir) {
  48035. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  48036. }
  48037. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  48038. var fn = dir.def && dir.def[hook];
  48039. if (fn) {
  48040. try {
  48041. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  48042. } catch (e) {
  48043. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  48044. }
  48045. }
  48046. }
  48047. var baseModules = [
  48048. ref,
  48049. directives
  48050. ];
  48051. /* */
  48052. function updateAttrs (oldVnode, vnode) {
  48053. var opts = vnode.componentOptions;
  48054. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  48055. return
  48056. }
  48057. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  48058. return
  48059. }
  48060. var key, cur, old;
  48061. var elm = vnode.elm;
  48062. var oldAttrs = oldVnode.data.attrs || {};
  48063. var attrs = vnode.data.attrs || {};
  48064. // clone observed objects, as the user probably wants to mutate it
  48065. if (isDef(attrs.__ob__)) {
  48066. attrs = vnode.data.attrs = extend({}, attrs);
  48067. }
  48068. for (key in attrs) {
  48069. cur = attrs[key];
  48070. old = oldAttrs[key];
  48071. if (old !== cur) {
  48072. setAttr(elm, key, cur);
  48073. }
  48074. }
  48075. // #4391: in IE9, setting type can reset value for input[type=radio]
  48076. // #6666: IE/Edge forces progress value down to 1 before setting a max
  48077. /* istanbul ignore if */
  48078. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  48079. setAttr(elm, 'value', attrs.value);
  48080. }
  48081. for (key in oldAttrs) {
  48082. if (isUndef(attrs[key])) {
  48083. if (isXlink(key)) {
  48084. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  48085. } else if (!isEnumeratedAttr(key)) {
  48086. elm.removeAttribute(key);
  48087. }
  48088. }
  48089. }
  48090. }
  48091. function setAttr (el, key, value) {
  48092. if (el.tagName.indexOf('-') > -1) {
  48093. baseSetAttr(el, key, value);
  48094. } else if (isBooleanAttr(key)) {
  48095. // set attribute for blank value
  48096. // e.g. <option disabled>Select one</option>
  48097. if (isFalsyAttrValue(value)) {
  48098. el.removeAttribute(key);
  48099. } else {
  48100. // technically allowfullscreen is a boolean attribute for <iframe>,
  48101. // but Flash expects a value of "true" when used on <embed> tag
  48102. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  48103. ? 'true'
  48104. : key;
  48105. el.setAttribute(key, value);
  48106. }
  48107. } else if (isEnumeratedAttr(key)) {
  48108. el.setAttribute(key, convertEnumeratedValue(key, value));
  48109. } else if (isXlink(key)) {
  48110. if (isFalsyAttrValue(value)) {
  48111. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  48112. } else {
  48113. el.setAttributeNS(xlinkNS, key, value);
  48114. }
  48115. } else {
  48116. baseSetAttr(el, key, value);
  48117. }
  48118. }
  48119. function baseSetAttr (el, key, value) {
  48120. if (isFalsyAttrValue(value)) {
  48121. el.removeAttribute(key);
  48122. } else {
  48123. // #7138: IE10 & 11 fires input event when setting placeholder on
  48124. // <textarea>... block the first input event and remove the blocker
  48125. // immediately.
  48126. /* istanbul ignore if */
  48127. if (
  48128. isIE && !isIE9 &&
  48129. el.tagName === 'TEXTAREA' &&
  48130. key === 'placeholder' && value !== '' && !el.__ieph
  48131. ) {
  48132. var blocker = function (e) {
  48133. e.stopImmediatePropagation();
  48134. el.removeEventListener('input', blocker);
  48135. };
  48136. el.addEventListener('input', blocker);
  48137. // $flow-disable-line
  48138. el.__ieph = true; /* IE placeholder patched */
  48139. }
  48140. el.setAttribute(key, value);
  48141. }
  48142. }
  48143. var attrs = {
  48144. create: updateAttrs,
  48145. update: updateAttrs
  48146. };
  48147. /* */
  48148. function updateClass (oldVnode, vnode) {
  48149. var el = vnode.elm;
  48150. var data = vnode.data;
  48151. var oldData = oldVnode.data;
  48152. if (
  48153. isUndef(data.staticClass) &&
  48154. isUndef(data.class) && (
  48155. isUndef(oldData) || (
  48156. isUndef(oldData.staticClass) &&
  48157. isUndef(oldData.class)
  48158. )
  48159. )
  48160. ) {
  48161. return
  48162. }
  48163. var cls = genClassForVnode(vnode);
  48164. // handle transition classes
  48165. var transitionClass = el._transitionClasses;
  48166. if (isDef(transitionClass)) {
  48167. cls = concat(cls, stringifyClass(transitionClass));
  48168. }
  48169. // set the class
  48170. if (cls !== el._prevClass) {
  48171. el.setAttribute('class', cls);
  48172. el._prevClass = cls;
  48173. }
  48174. }
  48175. var klass = {
  48176. create: updateClass,
  48177. update: updateClass
  48178. };
  48179. /* */
  48180. var validDivisionCharRE = /[\w).+\-_$\]]/;
  48181. function parseFilters (exp) {
  48182. var inSingle = false;
  48183. var inDouble = false;
  48184. var inTemplateString = false;
  48185. var inRegex = false;
  48186. var curly = 0;
  48187. var square = 0;
  48188. var paren = 0;
  48189. var lastFilterIndex = 0;
  48190. var c, prev, i, expression, filters;
  48191. for (i = 0; i < exp.length; i++) {
  48192. prev = c;
  48193. c = exp.charCodeAt(i);
  48194. if (inSingle) {
  48195. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  48196. } else if (inDouble) {
  48197. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  48198. } else if (inTemplateString) {
  48199. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  48200. } else if (inRegex) {
  48201. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  48202. } else if (
  48203. c === 0x7C && // pipe
  48204. exp.charCodeAt(i + 1) !== 0x7C &&
  48205. exp.charCodeAt(i - 1) !== 0x7C &&
  48206. !curly && !square && !paren
  48207. ) {
  48208. if (expression === undefined) {
  48209. // first filter, end of expression
  48210. lastFilterIndex = i + 1;
  48211. expression = exp.slice(0, i).trim();
  48212. } else {
  48213. pushFilter();
  48214. }
  48215. } else {
  48216. switch (c) {
  48217. case 0x22: inDouble = true; break // "
  48218. case 0x27: inSingle = true; break // '
  48219. case 0x60: inTemplateString = true; break // `
  48220. case 0x28: paren++; break // (
  48221. case 0x29: paren--; break // )
  48222. case 0x5B: square++; break // [
  48223. case 0x5D: square--; break // ]
  48224. case 0x7B: curly++; break // {
  48225. case 0x7D: curly--; break // }
  48226. }
  48227. if (c === 0x2f) { // /
  48228. var j = i - 1;
  48229. var p = (void 0);
  48230. // find first non-whitespace prev char
  48231. for (; j >= 0; j--) {
  48232. p = exp.charAt(j);
  48233. if (p !== ' ') { break }
  48234. }
  48235. if (!p || !validDivisionCharRE.test(p)) {
  48236. inRegex = true;
  48237. }
  48238. }
  48239. }
  48240. }
  48241. if (expression === undefined) {
  48242. expression = exp.slice(0, i).trim();
  48243. } else if (lastFilterIndex !== 0) {
  48244. pushFilter();
  48245. }
  48246. function pushFilter () {
  48247. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  48248. lastFilterIndex = i + 1;
  48249. }
  48250. if (filters) {
  48251. for (i = 0; i < filters.length; i++) {
  48252. expression = wrapFilter(expression, filters[i]);
  48253. }
  48254. }
  48255. return expression
  48256. }
  48257. function wrapFilter (exp, filter) {
  48258. var i = filter.indexOf('(');
  48259. if (i < 0) {
  48260. // _f: resolveFilter
  48261. return ("_f(\"" + filter + "\")(" + exp + ")")
  48262. } else {
  48263. var name = filter.slice(0, i);
  48264. var args = filter.slice(i + 1);
  48265. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  48266. }
  48267. }
  48268. /* */
  48269. /* eslint-disable no-unused-vars */
  48270. function baseWarn (msg, range) {
  48271. console.error(("[Vue compiler]: " + msg));
  48272. }
  48273. /* eslint-enable no-unused-vars */
  48274. function pluckModuleFunction (
  48275. modules,
  48276. key
  48277. ) {
  48278. return modules
  48279. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  48280. : []
  48281. }
  48282. function addProp (el, name, value, range, dynamic) {
  48283. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  48284. el.plain = false;
  48285. }
  48286. function addAttr (el, name, value, range, dynamic) {
  48287. var attrs = dynamic
  48288. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  48289. : (el.attrs || (el.attrs = []));
  48290. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  48291. el.plain = false;
  48292. }
  48293. // add a raw attr (use this in preTransforms)
  48294. function addRawAttr (el, name, value, range) {
  48295. el.attrsMap[name] = value;
  48296. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  48297. }
  48298. function addDirective (
  48299. el,
  48300. name,
  48301. rawName,
  48302. value,
  48303. arg,
  48304. isDynamicArg,
  48305. modifiers,
  48306. range
  48307. ) {
  48308. (el.directives || (el.directives = [])).push(rangeSetItem({
  48309. name: name,
  48310. rawName: rawName,
  48311. value: value,
  48312. arg: arg,
  48313. isDynamicArg: isDynamicArg,
  48314. modifiers: modifiers
  48315. }, range));
  48316. el.plain = false;
  48317. }
  48318. function prependModifierMarker (symbol, name, dynamic) {
  48319. return dynamic
  48320. ? ("_p(" + name + ",\"" + symbol + "\")")
  48321. : symbol + name // mark the event as captured
  48322. }
  48323. function addHandler (
  48324. el,
  48325. name,
  48326. value,
  48327. modifiers,
  48328. important,
  48329. warn,
  48330. range,
  48331. dynamic
  48332. ) {
  48333. modifiers = modifiers || emptyObject;
  48334. // warn prevent and passive modifier
  48335. /* istanbul ignore if */
  48336. if (
  48337. warn &&
  48338. modifiers.prevent && modifiers.passive
  48339. ) {
  48340. warn(
  48341. 'passive and prevent can\'t be used together. ' +
  48342. 'Passive handler can\'t prevent default event.',
  48343. range
  48344. );
  48345. }
  48346. // normalize click.right and click.middle since they don't actually fire
  48347. // this is technically browser-specific, but at least for now browsers are
  48348. // the only target envs that have right/middle clicks.
  48349. if (modifiers.right) {
  48350. if (dynamic) {
  48351. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  48352. } else if (name === 'click') {
  48353. name = 'contextmenu';
  48354. delete modifiers.right;
  48355. }
  48356. } else if (modifiers.middle) {
  48357. if (dynamic) {
  48358. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  48359. } else if (name === 'click') {
  48360. name = 'mouseup';
  48361. }
  48362. }
  48363. // check capture modifier
  48364. if (modifiers.capture) {
  48365. delete modifiers.capture;
  48366. name = prependModifierMarker('!', name, dynamic);
  48367. }
  48368. if (modifiers.once) {
  48369. delete modifiers.once;
  48370. name = prependModifierMarker('~', name, dynamic);
  48371. }
  48372. /* istanbul ignore if */
  48373. if (modifiers.passive) {
  48374. delete modifiers.passive;
  48375. name = prependModifierMarker('&', name, dynamic);
  48376. }
  48377. var events;
  48378. if (modifiers.native) {
  48379. delete modifiers.native;
  48380. events = el.nativeEvents || (el.nativeEvents = {});
  48381. } else {
  48382. events = el.events || (el.events = {});
  48383. }
  48384. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  48385. if (modifiers !== emptyObject) {
  48386. newHandler.modifiers = modifiers;
  48387. }
  48388. var handlers = events[name];
  48389. /* istanbul ignore if */
  48390. if (Array.isArray(handlers)) {
  48391. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  48392. } else if (handlers) {
  48393. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  48394. } else {
  48395. events[name] = newHandler;
  48396. }
  48397. el.plain = false;
  48398. }
  48399. function getRawBindingAttr (
  48400. el,
  48401. name
  48402. ) {
  48403. return el.rawAttrsMap[':' + name] ||
  48404. el.rawAttrsMap['v-bind:' + name] ||
  48405. el.rawAttrsMap[name]
  48406. }
  48407. function getBindingAttr (
  48408. el,
  48409. name,
  48410. getStatic
  48411. ) {
  48412. var dynamicValue =
  48413. getAndRemoveAttr(el, ':' + name) ||
  48414. getAndRemoveAttr(el, 'v-bind:' + name);
  48415. if (dynamicValue != null) {
  48416. return parseFilters(dynamicValue)
  48417. } else if (getStatic !== false) {
  48418. var staticValue = getAndRemoveAttr(el, name);
  48419. if (staticValue != null) {
  48420. return JSON.stringify(staticValue)
  48421. }
  48422. }
  48423. }
  48424. // note: this only removes the attr from the Array (attrsList) so that it
  48425. // doesn't get processed by processAttrs.
  48426. // By default it does NOT remove it from the map (attrsMap) because the map is
  48427. // needed during codegen.
  48428. function getAndRemoveAttr (
  48429. el,
  48430. name,
  48431. removeFromMap
  48432. ) {
  48433. var val;
  48434. if ((val = el.attrsMap[name]) != null) {
  48435. var list = el.attrsList;
  48436. for (var i = 0, l = list.length; i < l; i++) {
  48437. if (list[i].name === name) {
  48438. list.splice(i, 1);
  48439. break
  48440. }
  48441. }
  48442. }
  48443. if (removeFromMap) {
  48444. delete el.attrsMap[name];
  48445. }
  48446. return val
  48447. }
  48448. function getAndRemoveAttrByRegex (
  48449. el,
  48450. name
  48451. ) {
  48452. var list = el.attrsList;
  48453. for (var i = 0, l = list.length; i < l; i++) {
  48454. var attr = list[i];
  48455. if (name.test(attr.name)) {
  48456. list.splice(i, 1);
  48457. return attr
  48458. }
  48459. }
  48460. }
  48461. function rangeSetItem (
  48462. item,
  48463. range
  48464. ) {
  48465. if (range) {
  48466. if (range.start != null) {
  48467. item.start = range.start;
  48468. }
  48469. if (range.end != null) {
  48470. item.end = range.end;
  48471. }
  48472. }
  48473. return item
  48474. }
  48475. /* */
  48476. /**
  48477. * Cross-platform code generation for component v-model
  48478. */
  48479. function genComponentModel (
  48480. el,
  48481. value,
  48482. modifiers
  48483. ) {
  48484. var ref = modifiers || {};
  48485. var number = ref.number;
  48486. var trim = ref.trim;
  48487. var baseValueExpression = '$$v';
  48488. var valueExpression = baseValueExpression;
  48489. if (trim) {
  48490. valueExpression =
  48491. "(typeof " + baseValueExpression + " === 'string'" +
  48492. "? " + baseValueExpression + ".trim()" +
  48493. ": " + baseValueExpression + ")";
  48494. }
  48495. if (number) {
  48496. valueExpression = "_n(" + valueExpression + ")";
  48497. }
  48498. var assignment = genAssignmentCode(value, valueExpression);
  48499. el.model = {
  48500. value: ("(" + value + ")"),
  48501. expression: JSON.stringify(value),
  48502. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  48503. };
  48504. }
  48505. /**
  48506. * Cross-platform codegen helper for generating v-model value assignment code.
  48507. */
  48508. function genAssignmentCode (
  48509. value,
  48510. assignment
  48511. ) {
  48512. var res = parseModel(value);
  48513. if (res.key === null) {
  48514. return (value + "=" + assignment)
  48515. } else {
  48516. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  48517. }
  48518. }
  48519. /**
  48520. * Parse a v-model expression into a base path and a final key segment.
  48521. * Handles both dot-path and possible square brackets.
  48522. *
  48523. * Possible cases:
  48524. *
  48525. * - test
  48526. * - test[key]
  48527. * - test[test1[key]]
  48528. * - test["a"][key]
  48529. * - xxx.test[a[a].test1[key]]
  48530. * - test.xxx.a["asa"][test1[key]]
  48531. *
  48532. */
  48533. var len, str, chr, index$1, expressionPos, expressionEndPos;
  48534. function parseModel (val) {
  48535. // Fix https://github.com/vuejs/vue/pull/7730
  48536. // allow v-model="obj.val " (trailing whitespace)
  48537. val = val.trim();
  48538. len = val.length;
  48539. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  48540. index$1 = val.lastIndexOf('.');
  48541. if (index$1 > -1) {
  48542. return {
  48543. exp: val.slice(0, index$1),
  48544. key: '"' + val.slice(index$1 + 1) + '"'
  48545. }
  48546. } else {
  48547. return {
  48548. exp: val,
  48549. key: null
  48550. }
  48551. }
  48552. }
  48553. str = val;
  48554. index$1 = expressionPos = expressionEndPos = 0;
  48555. while (!eof()) {
  48556. chr = next();
  48557. /* istanbul ignore if */
  48558. if (isStringStart(chr)) {
  48559. parseString(chr);
  48560. } else if (chr === 0x5B) {
  48561. parseBracket(chr);
  48562. }
  48563. }
  48564. return {
  48565. exp: val.slice(0, expressionPos),
  48566. key: val.slice(expressionPos + 1, expressionEndPos)
  48567. }
  48568. }
  48569. function next () {
  48570. return str.charCodeAt(++index$1)
  48571. }
  48572. function eof () {
  48573. return index$1 >= len
  48574. }
  48575. function isStringStart (chr) {
  48576. return chr === 0x22 || chr === 0x27
  48577. }
  48578. function parseBracket (chr) {
  48579. var inBracket = 1;
  48580. expressionPos = index$1;
  48581. while (!eof()) {
  48582. chr = next();
  48583. if (isStringStart(chr)) {
  48584. parseString(chr);
  48585. continue
  48586. }
  48587. if (chr === 0x5B) { inBracket++; }
  48588. if (chr === 0x5D) { inBracket--; }
  48589. if (inBracket === 0) {
  48590. expressionEndPos = index$1;
  48591. break
  48592. }
  48593. }
  48594. }
  48595. function parseString (chr) {
  48596. var stringQuote = chr;
  48597. while (!eof()) {
  48598. chr = next();
  48599. if (chr === stringQuote) {
  48600. break
  48601. }
  48602. }
  48603. }
  48604. /* */
  48605. var warn$1;
  48606. // in some cases, the event used has to be determined at runtime
  48607. // so we used some reserved tokens during compile.
  48608. var RANGE_TOKEN = '__r';
  48609. var CHECKBOX_RADIO_TOKEN = '__c';
  48610. function model (
  48611. el,
  48612. dir,
  48613. _warn
  48614. ) {
  48615. warn$1 = _warn;
  48616. var value = dir.value;
  48617. var modifiers = dir.modifiers;
  48618. var tag = el.tag;
  48619. var type = el.attrsMap.type;
  48620. {
  48621. // inputs with type="file" are read only and setting the input's
  48622. // value will throw an error.
  48623. if (tag === 'input' && type === 'file') {
  48624. warn$1(
  48625. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  48626. "File inputs are read only. Use a v-on:change listener instead.",
  48627. el.rawAttrsMap['v-model']
  48628. );
  48629. }
  48630. }
  48631. if (el.component) {
  48632. genComponentModel(el, value, modifiers);
  48633. // component v-model doesn't need extra runtime
  48634. return false
  48635. } else if (tag === 'select') {
  48636. genSelect(el, value, modifiers);
  48637. } else if (tag === 'input' && type === 'checkbox') {
  48638. genCheckboxModel(el, value, modifiers);
  48639. } else if (tag === 'input' && type === 'radio') {
  48640. genRadioModel(el, value, modifiers);
  48641. } else if (tag === 'input' || tag === 'textarea') {
  48642. genDefaultModel(el, value, modifiers);
  48643. } else if (!config.isReservedTag(tag)) {
  48644. genComponentModel(el, value, modifiers);
  48645. // component v-model doesn't need extra runtime
  48646. return false
  48647. } else {
  48648. warn$1(
  48649. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  48650. "v-model is not supported on this element type. " +
  48651. 'If you are working with contenteditable, it\'s recommended to ' +
  48652. 'wrap a library dedicated for that purpose inside a custom component.',
  48653. el.rawAttrsMap['v-model']
  48654. );
  48655. }
  48656. // ensure runtime directive metadata
  48657. return true
  48658. }
  48659. function genCheckboxModel (
  48660. el,
  48661. value,
  48662. modifiers
  48663. ) {
  48664. var number = modifiers && modifiers.number;
  48665. var valueBinding = getBindingAttr(el, 'value') || 'null';
  48666. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  48667. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  48668. addProp(el, 'checked',
  48669. "Array.isArray(" + value + ")" +
  48670. "?_i(" + value + "," + valueBinding + ")>-1" + (
  48671. trueValueBinding === 'true'
  48672. ? (":(" + value + ")")
  48673. : (":_q(" + value + "," + trueValueBinding + ")")
  48674. )
  48675. );
  48676. addHandler(el, 'change',
  48677. "var $$a=" + value + "," +
  48678. '$$el=$event.target,' +
  48679. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  48680. 'if(Array.isArray($$a)){' +
  48681. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  48682. '$$i=_i($$a,$$v);' +
  48683. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  48684. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  48685. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  48686. null, true
  48687. );
  48688. }
  48689. function genRadioModel (
  48690. el,
  48691. value,
  48692. modifiers
  48693. ) {
  48694. var number = modifiers && modifiers.number;
  48695. var valueBinding = getBindingAttr(el, 'value') || 'null';
  48696. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  48697. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  48698. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  48699. }
  48700. function genSelect (
  48701. el,
  48702. value,
  48703. modifiers
  48704. ) {
  48705. var number = modifiers && modifiers.number;
  48706. var selectedVal = "Array.prototype.filter" +
  48707. ".call($event.target.options,function(o){return o.selected})" +
  48708. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  48709. "return " + (number ? '_n(val)' : 'val') + "})";
  48710. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  48711. var code = "var $$selectedVal = " + selectedVal + ";";
  48712. code = code + " " + (genAssignmentCode(value, assignment));
  48713. addHandler(el, 'change', code, null, true);
  48714. }
  48715. function genDefaultModel (
  48716. el,
  48717. value,
  48718. modifiers
  48719. ) {
  48720. var type = el.attrsMap.type;
  48721. // warn if v-bind:value conflicts with v-model
  48722. // except for inputs with v-bind:type
  48723. {
  48724. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  48725. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  48726. if (value$1 && !typeBinding) {
  48727. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  48728. warn$1(
  48729. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  48730. 'because the latter already expands to a value binding internally',
  48731. el.rawAttrsMap[binding]
  48732. );
  48733. }
  48734. }
  48735. var ref = modifiers || {};
  48736. var lazy = ref.lazy;
  48737. var number = ref.number;
  48738. var trim = ref.trim;
  48739. var needCompositionGuard = !lazy && type !== 'range';
  48740. var event = lazy
  48741. ? 'change'
  48742. : type === 'range'
  48743. ? RANGE_TOKEN
  48744. : 'input';
  48745. var valueExpression = '$event.target.value';
  48746. if (trim) {
  48747. valueExpression = "$event.target.value.trim()";
  48748. }
  48749. if (number) {
  48750. valueExpression = "_n(" + valueExpression + ")";
  48751. }
  48752. var code = genAssignmentCode(value, valueExpression);
  48753. if (needCompositionGuard) {
  48754. code = "if($event.target.composing)return;" + code;
  48755. }
  48756. addProp(el, 'value', ("(" + value + ")"));
  48757. addHandler(el, event, code, null, true);
  48758. if (trim || number) {
  48759. addHandler(el, 'blur', '$forceUpdate()');
  48760. }
  48761. }
  48762. /* */
  48763. // normalize v-model event tokens that can only be determined at runtime.
  48764. // it's important to place the event as the first in the array because
  48765. // the whole point is ensuring the v-model callback gets called before
  48766. // user-attached handlers.
  48767. function normalizeEvents (on) {
  48768. /* istanbul ignore if */
  48769. if (isDef(on[RANGE_TOKEN])) {
  48770. // IE input[type=range] only supports `change` event
  48771. var event = isIE ? 'change' : 'input';
  48772. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  48773. delete on[RANGE_TOKEN];
  48774. }
  48775. // This was originally intended to fix #4521 but no longer necessary
  48776. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  48777. /* istanbul ignore if */
  48778. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  48779. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  48780. delete on[CHECKBOX_RADIO_TOKEN];
  48781. }
  48782. }
  48783. var target$1;
  48784. function createOnceHandler$1 (event, handler, capture) {
  48785. var _target = target$1; // save current target element in closure
  48786. return function onceHandler () {
  48787. var res = handler.apply(null, arguments);
  48788. if (res !== null) {
  48789. remove$2(event, onceHandler, capture, _target);
  48790. }
  48791. }
  48792. }
  48793. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  48794. // implementation and does not fire microtasks in between event propagation, so
  48795. // safe to exclude.
  48796. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  48797. function add$1 (
  48798. name,
  48799. handler,
  48800. capture,
  48801. passive
  48802. ) {
  48803. // async edge case #6566: inner click event triggers patch, event handler
  48804. // attached to outer element during patch, and triggered again. This
  48805. // happens because browsers fire microtask ticks between event propagation.
  48806. // the solution is simple: we save the timestamp when a handler is attached,
  48807. // and the handler would only fire if the event passed to it was fired
  48808. // AFTER it was attached.
  48809. if (useMicrotaskFix) {
  48810. var attachedTimestamp = currentFlushTimestamp;
  48811. var original = handler;
  48812. handler = original._wrapper = function (e) {
  48813. if (
  48814. // no bubbling, should always fire.
  48815. // this is just a safety net in case event.timeStamp is unreliable in
  48816. // certain weird environments...
  48817. e.target === e.currentTarget ||
  48818. // event is fired after handler attachment
  48819. e.timeStamp >= attachedTimestamp ||
  48820. // bail for environments that have buggy event.timeStamp implementations
  48821. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  48822. // #9681 QtWebEngine event.timeStamp is negative value
  48823. e.timeStamp <= 0 ||
  48824. // #9448 bail if event is fired in another document in a multi-page
  48825. // electron/nw.js app, since event.timeStamp will be using a different
  48826. // starting reference
  48827. e.target.ownerDocument !== document
  48828. ) {
  48829. return original.apply(this, arguments)
  48830. }
  48831. };
  48832. }
  48833. target$1.addEventListener(
  48834. name,
  48835. handler,
  48836. supportsPassive
  48837. ? { capture: capture, passive: passive }
  48838. : capture
  48839. );
  48840. }
  48841. function remove$2 (
  48842. name,
  48843. handler,
  48844. capture,
  48845. _target
  48846. ) {
  48847. (_target || target$1).removeEventListener(
  48848. name,
  48849. handler._wrapper || handler,
  48850. capture
  48851. );
  48852. }
  48853. function updateDOMListeners (oldVnode, vnode) {
  48854. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  48855. return
  48856. }
  48857. var on = vnode.data.on || {};
  48858. var oldOn = oldVnode.data.on || {};
  48859. target$1 = vnode.elm;
  48860. normalizeEvents(on);
  48861. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  48862. target$1 = undefined;
  48863. }
  48864. var events = {
  48865. create: updateDOMListeners,
  48866. update: updateDOMListeners
  48867. };
  48868. /* */
  48869. var svgContainer;
  48870. function updateDOMProps (oldVnode, vnode) {
  48871. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  48872. return
  48873. }
  48874. var key, cur;
  48875. var elm = vnode.elm;
  48876. var oldProps = oldVnode.data.domProps || {};
  48877. var props = vnode.data.domProps || {};
  48878. // clone observed objects, as the user probably wants to mutate it
  48879. if (isDef(props.__ob__)) {
  48880. props = vnode.data.domProps = extend({}, props);
  48881. }
  48882. for (key in oldProps) {
  48883. if (!(key in props)) {
  48884. elm[key] = '';
  48885. }
  48886. }
  48887. for (key in props) {
  48888. cur = props[key];
  48889. // ignore children if the node has textContent or innerHTML,
  48890. // as these will throw away existing DOM nodes and cause removal errors
  48891. // on subsequent patches (#3360)
  48892. if (key === 'textContent' || key === 'innerHTML') {
  48893. if (vnode.children) { vnode.children.length = 0; }
  48894. if (cur === oldProps[key]) { continue }
  48895. // #6601 work around Chrome version <= 55 bug where single textNode
  48896. // replaced by innerHTML/textContent retains its parentNode property
  48897. if (elm.childNodes.length === 1) {
  48898. elm.removeChild(elm.childNodes[0]);
  48899. }
  48900. }
  48901. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  48902. // store value as _value as well since
  48903. // non-string values will be stringified
  48904. elm._value = cur;
  48905. // avoid resetting cursor position when value is the same
  48906. var strCur = isUndef(cur) ? '' : String(cur);
  48907. if (shouldUpdateValue(elm, strCur)) {
  48908. elm.value = strCur;
  48909. }
  48910. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  48911. // IE doesn't support innerHTML for SVG elements
  48912. svgContainer = svgContainer || document.createElement('div');
  48913. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  48914. var svg = svgContainer.firstChild;
  48915. while (elm.firstChild) {
  48916. elm.removeChild(elm.firstChild);
  48917. }
  48918. while (svg.firstChild) {
  48919. elm.appendChild(svg.firstChild);
  48920. }
  48921. } else if (
  48922. // skip the update if old and new VDOM state is the same.
  48923. // `value` is handled separately because the DOM value may be temporarily
  48924. // out of sync with VDOM state due to focus, composition and modifiers.
  48925. // This #4521 by skipping the unnecesarry `checked` update.
  48926. cur !== oldProps[key]
  48927. ) {
  48928. // some property updates can throw
  48929. // e.g. `value` on <progress> w/ non-finite value
  48930. try {
  48931. elm[key] = cur;
  48932. } catch (e) {}
  48933. }
  48934. }
  48935. }
  48936. // check platforms/web/util/attrs.js acceptValue
  48937. function shouldUpdateValue (elm, checkVal) {
  48938. return (!elm.composing && (
  48939. elm.tagName === 'OPTION' ||
  48940. isNotInFocusAndDirty(elm, checkVal) ||
  48941. isDirtyWithModifiers(elm, checkVal)
  48942. ))
  48943. }
  48944. function isNotInFocusAndDirty (elm, checkVal) {
  48945. // return true when textbox (.number and .trim) loses focus and its value is
  48946. // not equal to the updated value
  48947. var notInFocus = true;
  48948. // #6157
  48949. // work around IE bug when accessing document.activeElement in an iframe
  48950. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  48951. return notInFocus && elm.value !== checkVal
  48952. }
  48953. function isDirtyWithModifiers (elm, newVal) {
  48954. var value = elm.value;
  48955. var modifiers = elm._vModifiers; // injected by v-model runtime
  48956. if (isDef(modifiers)) {
  48957. if (modifiers.number) {
  48958. return toNumber(value) !== toNumber(newVal)
  48959. }
  48960. if (modifiers.trim) {
  48961. return value.trim() !== newVal.trim()
  48962. }
  48963. }
  48964. return value !== newVal
  48965. }
  48966. var domProps = {
  48967. create: updateDOMProps,
  48968. update: updateDOMProps
  48969. };
  48970. /* */
  48971. var parseStyleText = cached(function (cssText) {
  48972. var res = {};
  48973. var listDelimiter = /;(?![^(]*\))/g;
  48974. var propertyDelimiter = /:(.+)/;
  48975. cssText.split(listDelimiter).forEach(function (item) {
  48976. if (item) {
  48977. var tmp = item.split(propertyDelimiter);
  48978. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  48979. }
  48980. });
  48981. return res
  48982. });
  48983. // merge static and dynamic style data on the same vnode
  48984. function normalizeStyleData (data) {
  48985. var style = normalizeStyleBinding(data.style);
  48986. // static style is pre-processed into an object during compilation
  48987. // and is always a fresh object, so it's safe to merge into it
  48988. return data.staticStyle
  48989. ? extend(data.staticStyle, style)
  48990. : style
  48991. }
  48992. // normalize possible array / string values into Object
  48993. function normalizeStyleBinding (bindingStyle) {
  48994. if (Array.isArray(bindingStyle)) {
  48995. return toObject(bindingStyle)
  48996. }
  48997. if (typeof bindingStyle === 'string') {
  48998. return parseStyleText(bindingStyle)
  48999. }
  49000. return bindingStyle
  49001. }
  49002. /**
  49003. * parent component style should be after child's
  49004. * so that parent component's style could override it
  49005. */
  49006. function getStyle (vnode, checkChild) {
  49007. var res = {};
  49008. var styleData;
  49009. if (checkChild) {
  49010. var childNode = vnode;
  49011. while (childNode.componentInstance) {
  49012. childNode = childNode.componentInstance._vnode;
  49013. if (
  49014. childNode && childNode.data &&
  49015. (styleData = normalizeStyleData(childNode.data))
  49016. ) {
  49017. extend(res, styleData);
  49018. }
  49019. }
  49020. }
  49021. if ((styleData = normalizeStyleData(vnode.data))) {
  49022. extend(res, styleData);
  49023. }
  49024. var parentNode = vnode;
  49025. while ((parentNode = parentNode.parent)) {
  49026. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  49027. extend(res, styleData);
  49028. }
  49029. }
  49030. return res
  49031. }
  49032. /* */
  49033. var cssVarRE = /^--/;
  49034. var importantRE = /\s*!important$/;
  49035. var setProp = function (el, name, val) {
  49036. /* istanbul ignore if */
  49037. if (cssVarRE.test(name)) {
  49038. el.style.setProperty(name, val);
  49039. } else if (importantRE.test(val)) {
  49040. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  49041. } else {
  49042. var normalizedName = normalize(name);
  49043. if (Array.isArray(val)) {
  49044. // Support values array created by autoprefixer, e.g.
  49045. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  49046. // Set them one by one, and the browser will only set those it can recognize
  49047. for (var i = 0, len = val.length; i < len; i++) {
  49048. el.style[normalizedName] = val[i];
  49049. }
  49050. } else {
  49051. el.style[normalizedName] = val;
  49052. }
  49053. }
  49054. };
  49055. var vendorNames = ['Webkit', 'Moz', 'ms'];
  49056. var emptyStyle;
  49057. var normalize = cached(function (prop) {
  49058. emptyStyle = emptyStyle || document.createElement('div').style;
  49059. prop = camelize(prop);
  49060. if (prop !== 'filter' && (prop in emptyStyle)) {
  49061. return prop
  49062. }
  49063. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  49064. for (var i = 0; i < vendorNames.length; i++) {
  49065. var name = vendorNames[i] + capName;
  49066. if (name in emptyStyle) {
  49067. return name
  49068. }
  49069. }
  49070. });
  49071. function updateStyle (oldVnode, vnode) {
  49072. var data = vnode.data;
  49073. var oldData = oldVnode.data;
  49074. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  49075. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  49076. ) {
  49077. return
  49078. }
  49079. var cur, name;
  49080. var el = vnode.elm;
  49081. var oldStaticStyle = oldData.staticStyle;
  49082. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  49083. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  49084. var oldStyle = oldStaticStyle || oldStyleBinding;
  49085. var style = normalizeStyleBinding(vnode.data.style) || {};
  49086. // store normalized style under a different key for next diff
  49087. // make sure to clone it if it's reactive, since the user likely wants
  49088. // to mutate it.
  49089. vnode.data.normalizedStyle = isDef(style.__ob__)
  49090. ? extend({}, style)
  49091. : style;
  49092. var newStyle = getStyle(vnode, true);
  49093. for (name in oldStyle) {
  49094. if (isUndef(newStyle[name])) {
  49095. setProp(el, name, '');
  49096. }
  49097. }
  49098. for (name in newStyle) {
  49099. cur = newStyle[name];
  49100. if (cur !== oldStyle[name]) {
  49101. // ie9 setting to null has no effect, must use empty string
  49102. setProp(el, name, cur == null ? '' : cur);
  49103. }
  49104. }
  49105. }
  49106. var style = {
  49107. create: updateStyle,
  49108. update: updateStyle
  49109. };
  49110. /* */
  49111. var whitespaceRE = /\s+/;
  49112. /**
  49113. * Add class with compatibility for SVG since classList is not supported on
  49114. * SVG elements in IE
  49115. */
  49116. function addClass (el, cls) {
  49117. /* istanbul ignore if */
  49118. if (!cls || !(cls = cls.trim())) {
  49119. return
  49120. }
  49121. /* istanbul ignore else */
  49122. if (el.classList) {
  49123. if (cls.indexOf(' ') > -1) {
  49124. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  49125. } else {
  49126. el.classList.add(cls);
  49127. }
  49128. } else {
  49129. var cur = " " + (el.getAttribute('class') || '') + " ";
  49130. if (cur.indexOf(' ' + cls + ' ') < 0) {
  49131. el.setAttribute('class', (cur + cls).trim());
  49132. }
  49133. }
  49134. }
  49135. /**
  49136. * Remove class with compatibility for SVG since classList is not supported on
  49137. * SVG elements in IE
  49138. */
  49139. function removeClass (el, cls) {
  49140. /* istanbul ignore if */
  49141. if (!cls || !(cls = cls.trim())) {
  49142. return
  49143. }
  49144. /* istanbul ignore else */
  49145. if (el.classList) {
  49146. if (cls.indexOf(' ') > -1) {
  49147. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  49148. } else {
  49149. el.classList.remove(cls);
  49150. }
  49151. if (!el.classList.length) {
  49152. el.removeAttribute('class');
  49153. }
  49154. } else {
  49155. var cur = " " + (el.getAttribute('class') || '') + " ";
  49156. var tar = ' ' + cls + ' ';
  49157. while (cur.indexOf(tar) >= 0) {
  49158. cur = cur.replace(tar, ' ');
  49159. }
  49160. cur = cur.trim();
  49161. if (cur) {
  49162. el.setAttribute('class', cur);
  49163. } else {
  49164. el.removeAttribute('class');
  49165. }
  49166. }
  49167. }
  49168. /* */
  49169. function resolveTransition (def$$1) {
  49170. if (!def$$1) {
  49171. return
  49172. }
  49173. /* istanbul ignore else */
  49174. if (typeof def$$1 === 'object') {
  49175. var res = {};
  49176. if (def$$1.css !== false) {
  49177. extend(res, autoCssTransition(def$$1.name || 'v'));
  49178. }
  49179. extend(res, def$$1);
  49180. return res
  49181. } else if (typeof def$$1 === 'string') {
  49182. return autoCssTransition(def$$1)
  49183. }
  49184. }
  49185. var autoCssTransition = cached(function (name) {
  49186. return {
  49187. enterClass: (name + "-enter"),
  49188. enterToClass: (name + "-enter-to"),
  49189. enterActiveClass: (name + "-enter-active"),
  49190. leaveClass: (name + "-leave"),
  49191. leaveToClass: (name + "-leave-to"),
  49192. leaveActiveClass: (name + "-leave-active")
  49193. }
  49194. });
  49195. var hasTransition = inBrowser && !isIE9;
  49196. var TRANSITION = 'transition';
  49197. var ANIMATION = 'animation';
  49198. // Transition property/event sniffing
  49199. var transitionProp = 'transition';
  49200. var transitionEndEvent = 'transitionend';
  49201. var animationProp = 'animation';
  49202. var animationEndEvent = 'animationend';
  49203. if (hasTransition) {
  49204. /* istanbul ignore if */
  49205. if (window.ontransitionend === undefined &&
  49206. window.onwebkittransitionend !== undefined
  49207. ) {
  49208. transitionProp = 'WebkitTransition';
  49209. transitionEndEvent = 'webkitTransitionEnd';
  49210. }
  49211. if (window.onanimationend === undefined &&
  49212. window.onwebkitanimationend !== undefined
  49213. ) {
  49214. animationProp = 'WebkitAnimation';
  49215. animationEndEvent = 'webkitAnimationEnd';
  49216. }
  49217. }
  49218. // binding to window is necessary to make hot reload work in IE in strict mode
  49219. var raf = inBrowser
  49220. ? window.requestAnimationFrame
  49221. ? window.requestAnimationFrame.bind(window)
  49222. : setTimeout
  49223. : /* istanbul ignore next */ function (fn) { return fn(); };
  49224. function nextFrame (fn) {
  49225. raf(function () {
  49226. raf(fn);
  49227. });
  49228. }
  49229. function addTransitionClass (el, cls) {
  49230. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  49231. if (transitionClasses.indexOf(cls) < 0) {
  49232. transitionClasses.push(cls);
  49233. addClass(el, cls);
  49234. }
  49235. }
  49236. function removeTransitionClass (el, cls) {
  49237. if (el._transitionClasses) {
  49238. remove(el._transitionClasses, cls);
  49239. }
  49240. removeClass(el, cls);
  49241. }
  49242. function whenTransitionEnds (
  49243. el,
  49244. expectedType,
  49245. cb
  49246. ) {
  49247. var ref = getTransitionInfo(el, expectedType);
  49248. var type = ref.type;
  49249. var timeout = ref.timeout;
  49250. var propCount = ref.propCount;
  49251. if (!type) { return cb() }
  49252. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  49253. var ended = 0;
  49254. var end = function () {
  49255. el.removeEventListener(event, onEnd);
  49256. cb();
  49257. };
  49258. var onEnd = function (e) {
  49259. if (e.target === el) {
  49260. if (++ended >= propCount) {
  49261. end();
  49262. }
  49263. }
  49264. };
  49265. setTimeout(function () {
  49266. if (ended < propCount) {
  49267. end();
  49268. }
  49269. }, timeout + 1);
  49270. el.addEventListener(event, onEnd);
  49271. }
  49272. var transformRE = /\b(transform|all)(,|$)/;
  49273. function getTransitionInfo (el, expectedType) {
  49274. var styles = window.getComputedStyle(el);
  49275. // JSDOM may return undefined for transition properties
  49276. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  49277. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  49278. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  49279. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  49280. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  49281. var animationTimeout = getTimeout(animationDelays, animationDurations);
  49282. var type;
  49283. var timeout = 0;
  49284. var propCount = 0;
  49285. /* istanbul ignore if */
  49286. if (expectedType === TRANSITION) {
  49287. if (transitionTimeout > 0) {
  49288. type = TRANSITION;
  49289. timeout = transitionTimeout;
  49290. propCount = transitionDurations.length;
  49291. }
  49292. } else if (expectedType === ANIMATION) {
  49293. if (animationTimeout > 0) {
  49294. type = ANIMATION;
  49295. timeout = animationTimeout;
  49296. propCount = animationDurations.length;
  49297. }
  49298. } else {
  49299. timeout = Math.max(transitionTimeout, animationTimeout);
  49300. type = timeout > 0
  49301. ? transitionTimeout > animationTimeout
  49302. ? TRANSITION
  49303. : ANIMATION
  49304. : null;
  49305. propCount = type
  49306. ? type === TRANSITION
  49307. ? transitionDurations.length
  49308. : animationDurations.length
  49309. : 0;
  49310. }
  49311. var hasTransform =
  49312. type === TRANSITION &&
  49313. transformRE.test(styles[transitionProp + 'Property']);
  49314. return {
  49315. type: type,
  49316. timeout: timeout,
  49317. propCount: propCount,
  49318. hasTransform: hasTransform
  49319. }
  49320. }
  49321. function getTimeout (delays, durations) {
  49322. /* istanbul ignore next */
  49323. while (delays.length < durations.length) {
  49324. delays = delays.concat(delays);
  49325. }
  49326. return Math.max.apply(null, durations.map(function (d, i) {
  49327. return toMs(d) + toMs(delays[i])
  49328. }))
  49329. }
  49330. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  49331. // in a locale-dependent way, using a comma instead of a dot.
  49332. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  49333. // as a floor function) causing unexpected behaviors
  49334. function toMs (s) {
  49335. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  49336. }
  49337. /* */
  49338. function enter (vnode, toggleDisplay) {
  49339. var el = vnode.elm;
  49340. // call leave callback now
  49341. if (isDef(el._leaveCb)) {
  49342. el._leaveCb.cancelled = true;
  49343. el._leaveCb();
  49344. }
  49345. var data = resolveTransition(vnode.data.transition);
  49346. if (isUndef(data)) {
  49347. return
  49348. }
  49349. /* istanbul ignore if */
  49350. if (isDef(el._enterCb) || el.nodeType !== 1) {
  49351. return
  49352. }
  49353. var css = data.css;
  49354. var type = data.type;
  49355. var enterClass = data.enterClass;
  49356. var enterToClass = data.enterToClass;
  49357. var enterActiveClass = data.enterActiveClass;
  49358. var appearClass = data.appearClass;
  49359. var appearToClass = data.appearToClass;
  49360. var appearActiveClass = data.appearActiveClass;
  49361. var beforeEnter = data.beforeEnter;
  49362. var enter = data.enter;
  49363. var afterEnter = data.afterEnter;
  49364. var enterCancelled = data.enterCancelled;
  49365. var beforeAppear = data.beforeAppear;
  49366. var appear = data.appear;
  49367. var afterAppear = data.afterAppear;
  49368. var appearCancelled = data.appearCancelled;
  49369. var duration = data.duration;
  49370. // activeInstance will always be the <transition> component managing this
  49371. // transition. One edge case to check is when the <transition> is placed
  49372. // as the root node of a child component. In that case we need to check
  49373. // <transition>'s parent for appear check.
  49374. var context = activeInstance;
  49375. var transitionNode = activeInstance.$vnode;
  49376. while (transitionNode && transitionNode.parent) {
  49377. context = transitionNode.context;
  49378. transitionNode = transitionNode.parent;
  49379. }
  49380. var isAppear = !context._isMounted || !vnode.isRootInsert;
  49381. if (isAppear && !appear && appear !== '') {
  49382. return
  49383. }
  49384. var startClass = isAppear && appearClass
  49385. ? appearClass
  49386. : enterClass;
  49387. var activeClass = isAppear && appearActiveClass
  49388. ? appearActiveClass
  49389. : enterActiveClass;
  49390. var toClass = isAppear && appearToClass
  49391. ? appearToClass
  49392. : enterToClass;
  49393. var beforeEnterHook = isAppear
  49394. ? (beforeAppear || beforeEnter)
  49395. : beforeEnter;
  49396. var enterHook = isAppear
  49397. ? (typeof appear === 'function' ? appear : enter)
  49398. : enter;
  49399. var afterEnterHook = isAppear
  49400. ? (afterAppear || afterEnter)
  49401. : afterEnter;
  49402. var enterCancelledHook = isAppear
  49403. ? (appearCancelled || enterCancelled)
  49404. : enterCancelled;
  49405. var explicitEnterDuration = toNumber(
  49406. isObject(duration)
  49407. ? duration.enter
  49408. : duration
  49409. );
  49410. if (explicitEnterDuration != null) {
  49411. checkDuration(explicitEnterDuration, 'enter', vnode);
  49412. }
  49413. var expectsCSS = css !== false && !isIE9;
  49414. var userWantsControl = getHookArgumentsLength(enterHook);
  49415. var cb = el._enterCb = once(function () {
  49416. if (expectsCSS) {
  49417. removeTransitionClass(el, toClass);
  49418. removeTransitionClass(el, activeClass);
  49419. }
  49420. if (cb.cancelled) {
  49421. if (expectsCSS) {
  49422. removeTransitionClass(el, startClass);
  49423. }
  49424. enterCancelledHook && enterCancelledHook(el);
  49425. } else {
  49426. afterEnterHook && afterEnterHook(el);
  49427. }
  49428. el._enterCb = null;
  49429. });
  49430. if (!vnode.data.show) {
  49431. // remove pending leave element on enter by injecting an insert hook
  49432. mergeVNodeHook(vnode, 'insert', function () {
  49433. var parent = el.parentNode;
  49434. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  49435. if (pendingNode &&
  49436. pendingNode.tag === vnode.tag &&
  49437. pendingNode.elm._leaveCb
  49438. ) {
  49439. pendingNode.elm._leaveCb();
  49440. }
  49441. enterHook && enterHook(el, cb);
  49442. });
  49443. }
  49444. // start enter transition
  49445. beforeEnterHook && beforeEnterHook(el);
  49446. if (expectsCSS) {
  49447. addTransitionClass(el, startClass);
  49448. addTransitionClass(el, activeClass);
  49449. nextFrame(function () {
  49450. removeTransitionClass(el, startClass);
  49451. if (!cb.cancelled) {
  49452. addTransitionClass(el, toClass);
  49453. if (!userWantsControl) {
  49454. if (isValidDuration(explicitEnterDuration)) {
  49455. setTimeout(cb, explicitEnterDuration);
  49456. } else {
  49457. whenTransitionEnds(el, type, cb);
  49458. }
  49459. }
  49460. }
  49461. });
  49462. }
  49463. if (vnode.data.show) {
  49464. toggleDisplay && toggleDisplay();
  49465. enterHook && enterHook(el, cb);
  49466. }
  49467. if (!expectsCSS && !userWantsControl) {
  49468. cb();
  49469. }
  49470. }
  49471. function leave (vnode, rm) {
  49472. var el = vnode.elm;
  49473. // call enter callback now
  49474. if (isDef(el._enterCb)) {
  49475. el._enterCb.cancelled = true;
  49476. el._enterCb();
  49477. }
  49478. var data = resolveTransition(vnode.data.transition);
  49479. if (isUndef(data) || el.nodeType !== 1) {
  49480. return rm()
  49481. }
  49482. /* istanbul ignore if */
  49483. if (isDef(el._leaveCb)) {
  49484. return
  49485. }
  49486. var css = data.css;
  49487. var type = data.type;
  49488. var leaveClass = data.leaveClass;
  49489. var leaveToClass = data.leaveToClass;
  49490. var leaveActiveClass = data.leaveActiveClass;
  49491. var beforeLeave = data.beforeLeave;
  49492. var leave = data.leave;
  49493. var afterLeave = data.afterLeave;
  49494. var leaveCancelled = data.leaveCancelled;
  49495. var delayLeave = data.delayLeave;
  49496. var duration = data.duration;
  49497. var expectsCSS = css !== false && !isIE9;
  49498. var userWantsControl = getHookArgumentsLength(leave);
  49499. var explicitLeaveDuration = toNumber(
  49500. isObject(duration)
  49501. ? duration.leave
  49502. : duration
  49503. );
  49504. if (isDef(explicitLeaveDuration)) {
  49505. checkDuration(explicitLeaveDuration, 'leave', vnode);
  49506. }
  49507. var cb = el._leaveCb = once(function () {
  49508. if (el.parentNode && el.parentNode._pending) {
  49509. el.parentNode._pending[vnode.key] = null;
  49510. }
  49511. if (expectsCSS) {
  49512. removeTransitionClass(el, leaveToClass);
  49513. removeTransitionClass(el, leaveActiveClass);
  49514. }
  49515. if (cb.cancelled) {
  49516. if (expectsCSS) {
  49517. removeTransitionClass(el, leaveClass);
  49518. }
  49519. leaveCancelled && leaveCancelled(el);
  49520. } else {
  49521. rm();
  49522. afterLeave && afterLeave(el);
  49523. }
  49524. el._leaveCb = null;
  49525. });
  49526. if (delayLeave) {
  49527. delayLeave(performLeave);
  49528. } else {
  49529. performLeave();
  49530. }
  49531. function performLeave () {
  49532. // the delayed leave may have already been cancelled
  49533. if (cb.cancelled) {
  49534. return
  49535. }
  49536. // record leaving element
  49537. if (!vnode.data.show && el.parentNode) {
  49538. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  49539. }
  49540. beforeLeave && beforeLeave(el);
  49541. if (expectsCSS) {
  49542. addTransitionClass(el, leaveClass);
  49543. addTransitionClass(el, leaveActiveClass);
  49544. nextFrame(function () {
  49545. removeTransitionClass(el, leaveClass);
  49546. if (!cb.cancelled) {
  49547. addTransitionClass(el, leaveToClass);
  49548. if (!userWantsControl) {
  49549. if (isValidDuration(explicitLeaveDuration)) {
  49550. setTimeout(cb, explicitLeaveDuration);
  49551. } else {
  49552. whenTransitionEnds(el, type, cb);
  49553. }
  49554. }
  49555. }
  49556. });
  49557. }
  49558. leave && leave(el, cb);
  49559. if (!expectsCSS && !userWantsControl) {
  49560. cb();
  49561. }
  49562. }
  49563. }
  49564. // only used in dev mode
  49565. function checkDuration (val, name, vnode) {
  49566. if (typeof val !== 'number') {
  49567. warn(
  49568. "<transition> explicit " + name + " duration is not a valid number - " +
  49569. "got " + (JSON.stringify(val)) + ".",
  49570. vnode.context
  49571. );
  49572. } else if (isNaN(val)) {
  49573. warn(
  49574. "<transition> explicit " + name + " duration is NaN - " +
  49575. 'the duration expression might be incorrect.',
  49576. vnode.context
  49577. );
  49578. }
  49579. }
  49580. function isValidDuration (val) {
  49581. return typeof val === 'number' && !isNaN(val)
  49582. }
  49583. /**
  49584. * Normalize a transition hook's argument length. The hook may be:
  49585. * - a merged hook (invoker) with the original in .fns
  49586. * - a wrapped component method (check ._length)
  49587. * - a plain function (.length)
  49588. */
  49589. function getHookArgumentsLength (fn) {
  49590. if (isUndef(fn)) {
  49591. return false
  49592. }
  49593. var invokerFns = fn.fns;
  49594. if (isDef(invokerFns)) {
  49595. // invoker
  49596. return getHookArgumentsLength(
  49597. Array.isArray(invokerFns)
  49598. ? invokerFns[0]
  49599. : invokerFns
  49600. )
  49601. } else {
  49602. return (fn._length || fn.length) > 1
  49603. }
  49604. }
  49605. function _enter (_, vnode) {
  49606. if (vnode.data.show !== true) {
  49607. enter(vnode);
  49608. }
  49609. }
  49610. var transition = inBrowser ? {
  49611. create: _enter,
  49612. activate: _enter,
  49613. remove: function remove$$1 (vnode, rm) {
  49614. /* istanbul ignore else */
  49615. if (vnode.data.show !== true) {
  49616. leave(vnode, rm);
  49617. } else {
  49618. rm();
  49619. }
  49620. }
  49621. } : {};
  49622. var platformModules = [
  49623. attrs,
  49624. klass,
  49625. events,
  49626. domProps,
  49627. style,
  49628. transition
  49629. ];
  49630. /* */
  49631. // the directive module should be applied last, after all
  49632. // built-in modules have been applied.
  49633. var modules = platformModules.concat(baseModules);
  49634. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  49635. /**
  49636. * Not type checking this file because flow doesn't like attaching
  49637. * properties to Elements.
  49638. */
  49639. /* istanbul ignore if */
  49640. if (isIE9) {
  49641. // http://www.matts411.com/post/internet-explorer-9-oninput/
  49642. document.addEventListener('selectionchange', function () {
  49643. var el = document.activeElement;
  49644. if (el && el.vmodel) {
  49645. trigger(el, 'input');
  49646. }
  49647. });
  49648. }
  49649. var directive = {
  49650. inserted: function inserted (el, binding, vnode, oldVnode) {
  49651. if (vnode.tag === 'select') {
  49652. // #6903
  49653. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  49654. mergeVNodeHook(vnode, 'postpatch', function () {
  49655. directive.componentUpdated(el, binding, vnode);
  49656. });
  49657. } else {
  49658. setSelected(el, binding, vnode.context);
  49659. }
  49660. el._vOptions = [].map.call(el.options, getValue);
  49661. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  49662. el._vModifiers = binding.modifiers;
  49663. if (!binding.modifiers.lazy) {
  49664. el.addEventListener('compositionstart', onCompositionStart);
  49665. el.addEventListener('compositionend', onCompositionEnd);
  49666. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  49667. // switching focus before confirming composition choice
  49668. // this also fixes the issue where some browsers e.g. iOS Chrome
  49669. // fires "change" instead of "input" on autocomplete.
  49670. el.addEventListener('change', onCompositionEnd);
  49671. /* istanbul ignore if */
  49672. if (isIE9) {
  49673. el.vmodel = true;
  49674. }
  49675. }
  49676. }
  49677. },
  49678. componentUpdated: function componentUpdated (el, binding, vnode) {
  49679. if (vnode.tag === 'select') {
  49680. setSelected(el, binding, vnode.context);
  49681. // in case the options rendered by v-for have changed,
  49682. // it's possible that the value is out-of-sync with the rendered options.
  49683. // detect such cases and filter out values that no longer has a matching
  49684. // option in the DOM.
  49685. var prevOptions = el._vOptions;
  49686. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  49687. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  49688. // trigger change event if
  49689. // no matching option found for at least one value
  49690. var needReset = el.multiple
  49691. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  49692. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  49693. if (needReset) {
  49694. trigger(el, 'change');
  49695. }
  49696. }
  49697. }
  49698. }
  49699. };
  49700. function setSelected (el, binding, vm) {
  49701. actuallySetSelected(el, binding, vm);
  49702. /* istanbul ignore if */
  49703. if (isIE || isEdge) {
  49704. setTimeout(function () {
  49705. actuallySetSelected(el, binding, vm);
  49706. }, 0);
  49707. }
  49708. }
  49709. function actuallySetSelected (el, binding, vm) {
  49710. var value = binding.value;
  49711. var isMultiple = el.multiple;
  49712. if (isMultiple && !Array.isArray(value)) {
  49713. warn(
  49714. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  49715. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  49716. vm
  49717. );
  49718. return
  49719. }
  49720. var selected, option;
  49721. for (var i = 0, l = el.options.length; i < l; i++) {
  49722. option = el.options[i];
  49723. if (isMultiple) {
  49724. selected = looseIndexOf(value, getValue(option)) > -1;
  49725. if (option.selected !== selected) {
  49726. option.selected = selected;
  49727. }
  49728. } else {
  49729. if (looseEqual(getValue(option), value)) {
  49730. if (el.selectedIndex !== i) {
  49731. el.selectedIndex = i;
  49732. }
  49733. return
  49734. }
  49735. }
  49736. }
  49737. if (!isMultiple) {
  49738. el.selectedIndex = -1;
  49739. }
  49740. }
  49741. function hasNoMatchingOption (value, options) {
  49742. return options.every(function (o) { return !looseEqual(o, value); })
  49743. }
  49744. function getValue (option) {
  49745. return '_value' in option
  49746. ? option._value
  49747. : option.value
  49748. }
  49749. function onCompositionStart (e) {
  49750. e.target.composing = true;
  49751. }
  49752. function onCompositionEnd (e) {
  49753. // prevent triggering an input event for no reason
  49754. if (!e.target.composing) { return }
  49755. e.target.composing = false;
  49756. trigger(e.target, 'input');
  49757. }
  49758. function trigger (el, type) {
  49759. var e = document.createEvent('HTMLEvents');
  49760. e.initEvent(type, true, true);
  49761. el.dispatchEvent(e);
  49762. }
  49763. /* */
  49764. // recursively search for possible transition defined inside the component root
  49765. function locateNode (vnode) {
  49766. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  49767. ? locateNode(vnode.componentInstance._vnode)
  49768. : vnode
  49769. }
  49770. var show = {
  49771. bind: function bind (el, ref, vnode) {
  49772. var value = ref.value;
  49773. vnode = locateNode(vnode);
  49774. var transition$$1 = vnode.data && vnode.data.transition;
  49775. var originalDisplay = el.__vOriginalDisplay =
  49776. el.style.display === 'none' ? '' : el.style.display;
  49777. if (value && transition$$1) {
  49778. vnode.data.show = true;
  49779. enter(vnode, function () {
  49780. el.style.display = originalDisplay;
  49781. });
  49782. } else {
  49783. el.style.display = value ? originalDisplay : 'none';
  49784. }
  49785. },
  49786. update: function update (el, ref, vnode) {
  49787. var value = ref.value;
  49788. var oldValue = ref.oldValue;
  49789. /* istanbul ignore if */
  49790. if (!value === !oldValue) { return }
  49791. vnode = locateNode(vnode);
  49792. var transition$$1 = vnode.data && vnode.data.transition;
  49793. if (transition$$1) {
  49794. vnode.data.show = true;
  49795. if (value) {
  49796. enter(vnode, function () {
  49797. el.style.display = el.__vOriginalDisplay;
  49798. });
  49799. } else {
  49800. leave(vnode, function () {
  49801. el.style.display = 'none';
  49802. });
  49803. }
  49804. } else {
  49805. el.style.display = value ? el.__vOriginalDisplay : 'none';
  49806. }
  49807. },
  49808. unbind: function unbind (
  49809. el,
  49810. binding,
  49811. vnode,
  49812. oldVnode,
  49813. isDestroy
  49814. ) {
  49815. if (!isDestroy) {
  49816. el.style.display = el.__vOriginalDisplay;
  49817. }
  49818. }
  49819. };
  49820. var platformDirectives = {
  49821. model: directive,
  49822. show: show
  49823. };
  49824. /* */
  49825. var transitionProps = {
  49826. name: String,
  49827. appear: Boolean,
  49828. css: Boolean,
  49829. mode: String,
  49830. type: String,
  49831. enterClass: String,
  49832. leaveClass: String,
  49833. enterToClass: String,
  49834. leaveToClass: String,
  49835. enterActiveClass: String,
  49836. leaveActiveClass: String,
  49837. appearClass: String,
  49838. appearActiveClass: String,
  49839. appearToClass: String,
  49840. duration: [Number, String, Object]
  49841. };
  49842. // in case the child is also an abstract component, e.g. <keep-alive>
  49843. // we want to recursively retrieve the real component to be rendered
  49844. function getRealChild (vnode) {
  49845. var compOptions = vnode && vnode.componentOptions;
  49846. if (compOptions && compOptions.Ctor.options.abstract) {
  49847. return getRealChild(getFirstComponentChild(compOptions.children))
  49848. } else {
  49849. return vnode
  49850. }
  49851. }
  49852. function extractTransitionData (comp) {
  49853. var data = {};
  49854. var options = comp.$options;
  49855. // props
  49856. for (var key in options.propsData) {
  49857. data[key] = comp[key];
  49858. }
  49859. // events.
  49860. // extract listeners and pass them directly to the transition methods
  49861. var listeners = options._parentListeners;
  49862. for (var key$1 in listeners) {
  49863. data[camelize(key$1)] = listeners[key$1];
  49864. }
  49865. return data
  49866. }
  49867. function placeholder (h, rawChild) {
  49868. if (/\d-keep-alive$/.test(rawChild.tag)) {
  49869. return h('keep-alive', {
  49870. props: rawChild.componentOptions.propsData
  49871. })
  49872. }
  49873. }
  49874. function hasParentTransition (vnode) {
  49875. while ((vnode = vnode.parent)) {
  49876. if (vnode.data.transition) {
  49877. return true
  49878. }
  49879. }
  49880. }
  49881. function isSameChild (child, oldChild) {
  49882. return oldChild.key === child.key && oldChild.tag === child.tag
  49883. }
  49884. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  49885. var isVShowDirective = function (d) { return d.name === 'show'; };
  49886. var Transition = {
  49887. name: 'transition',
  49888. props: transitionProps,
  49889. abstract: true,
  49890. render: function render (h) {
  49891. var this$1 = this;
  49892. var children = this.$slots.default;
  49893. if (!children) {
  49894. return
  49895. }
  49896. // filter out text nodes (possible whitespaces)
  49897. children = children.filter(isNotTextNode);
  49898. /* istanbul ignore if */
  49899. if (!children.length) {
  49900. return
  49901. }
  49902. // warn multiple elements
  49903. if (children.length > 1) {
  49904. warn(
  49905. '<transition> can only be used on a single element. Use ' +
  49906. '<transition-group> for lists.',
  49907. this.$parent
  49908. );
  49909. }
  49910. var mode = this.mode;
  49911. // warn invalid mode
  49912. if (mode && mode !== 'in-out' && mode !== 'out-in'
  49913. ) {
  49914. warn(
  49915. 'invalid <transition> mode: ' + mode,
  49916. this.$parent
  49917. );
  49918. }
  49919. var rawChild = children[0];
  49920. // if this is a component root node and the component's
  49921. // parent container node also has transition, skip.
  49922. if (hasParentTransition(this.$vnode)) {
  49923. return rawChild
  49924. }
  49925. // apply transition data to child
  49926. // use getRealChild() to ignore abstract components e.g. keep-alive
  49927. var child = getRealChild(rawChild);
  49928. /* istanbul ignore if */
  49929. if (!child) {
  49930. return rawChild
  49931. }
  49932. if (this._leaving) {
  49933. return placeholder(h, rawChild)
  49934. }
  49935. // ensure a key that is unique to the vnode type and to this transition
  49936. // component instance. This key will be used to remove pending leaving nodes
  49937. // during entering.
  49938. var id = "__transition-" + (this._uid) + "-";
  49939. child.key = child.key == null
  49940. ? child.isComment
  49941. ? id + 'comment'
  49942. : id + child.tag
  49943. : isPrimitive(child.key)
  49944. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  49945. : child.key;
  49946. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  49947. var oldRawChild = this._vnode;
  49948. var oldChild = getRealChild(oldRawChild);
  49949. // mark v-show
  49950. // so that the transition module can hand over the control to the directive
  49951. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  49952. child.data.show = true;
  49953. }
  49954. if (
  49955. oldChild &&
  49956. oldChild.data &&
  49957. !isSameChild(child, oldChild) &&
  49958. !isAsyncPlaceholder(oldChild) &&
  49959. // #6687 component root is a comment node
  49960. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  49961. ) {
  49962. // replace old child transition data with fresh one
  49963. // important for dynamic transitions!
  49964. var oldData = oldChild.data.transition = extend({}, data);
  49965. // handle transition mode
  49966. if (mode === 'out-in') {
  49967. // return placeholder node and queue update when leave finishes
  49968. this._leaving = true;
  49969. mergeVNodeHook(oldData, 'afterLeave', function () {
  49970. this$1._leaving = false;
  49971. this$1.$forceUpdate();
  49972. });
  49973. return placeholder(h, rawChild)
  49974. } else if (mode === 'in-out') {
  49975. if (isAsyncPlaceholder(child)) {
  49976. return oldRawChild
  49977. }
  49978. var delayedLeave;
  49979. var performLeave = function () { delayedLeave(); };
  49980. mergeVNodeHook(data, 'afterEnter', performLeave);
  49981. mergeVNodeHook(data, 'enterCancelled', performLeave);
  49982. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  49983. }
  49984. }
  49985. return rawChild
  49986. }
  49987. };
  49988. /* */
  49989. var props = extend({
  49990. tag: String,
  49991. moveClass: String
  49992. }, transitionProps);
  49993. delete props.mode;
  49994. var TransitionGroup = {
  49995. props: props,
  49996. beforeMount: function beforeMount () {
  49997. var this$1 = this;
  49998. var update = this._update;
  49999. this._update = function (vnode, hydrating) {
  50000. var restoreActiveInstance = setActiveInstance(this$1);
  50001. // force removing pass
  50002. this$1.__patch__(
  50003. this$1._vnode,
  50004. this$1.kept,
  50005. false, // hydrating
  50006. true // removeOnly (!important, avoids unnecessary moves)
  50007. );
  50008. this$1._vnode = this$1.kept;
  50009. restoreActiveInstance();
  50010. update.call(this$1, vnode, hydrating);
  50011. };
  50012. },
  50013. render: function render (h) {
  50014. var tag = this.tag || this.$vnode.data.tag || 'span';
  50015. var map = Object.create(null);
  50016. var prevChildren = this.prevChildren = this.children;
  50017. var rawChildren = this.$slots.default || [];
  50018. var children = this.children = [];
  50019. var transitionData = extractTransitionData(this);
  50020. for (var i = 0; i < rawChildren.length; i++) {
  50021. var c = rawChildren[i];
  50022. if (c.tag) {
  50023. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  50024. children.push(c);
  50025. map[c.key] = c
  50026. ;(c.data || (c.data = {})).transition = transitionData;
  50027. } else {
  50028. var opts = c.componentOptions;
  50029. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  50030. warn(("<transition-group> children must be keyed: <" + name + ">"));
  50031. }
  50032. }
  50033. }
  50034. if (prevChildren) {
  50035. var kept = [];
  50036. var removed = [];
  50037. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  50038. var c$1 = prevChildren[i$1];
  50039. c$1.data.transition = transitionData;
  50040. c$1.data.pos = c$1.elm.getBoundingClientRect();
  50041. if (map[c$1.key]) {
  50042. kept.push(c$1);
  50043. } else {
  50044. removed.push(c$1);
  50045. }
  50046. }
  50047. this.kept = h(tag, null, kept);
  50048. this.removed = removed;
  50049. }
  50050. return h(tag, null, children)
  50051. },
  50052. updated: function updated () {
  50053. var children = this.prevChildren;
  50054. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  50055. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  50056. return
  50057. }
  50058. // we divide the work into three loops to avoid mixing DOM reads and writes
  50059. // in each iteration - which helps prevent layout thrashing.
  50060. children.forEach(callPendingCbs);
  50061. children.forEach(recordPosition);
  50062. children.forEach(applyTranslation);
  50063. // force reflow to put everything in position
  50064. // assign to this to avoid being removed in tree-shaking
  50065. // $flow-disable-line
  50066. this._reflow = document.body.offsetHeight;
  50067. children.forEach(function (c) {
  50068. if (c.data.moved) {
  50069. var el = c.elm;
  50070. var s = el.style;
  50071. addTransitionClass(el, moveClass);
  50072. s.transform = s.WebkitTransform = s.transitionDuration = '';
  50073. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  50074. if (e && e.target !== el) {
  50075. return
  50076. }
  50077. if (!e || /transform$/.test(e.propertyName)) {
  50078. el.removeEventListener(transitionEndEvent, cb);
  50079. el._moveCb = null;
  50080. removeTransitionClass(el, moveClass);
  50081. }
  50082. });
  50083. }
  50084. });
  50085. },
  50086. methods: {
  50087. hasMove: function hasMove (el, moveClass) {
  50088. /* istanbul ignore if */
  50089. if (!hasTransition) {
  50090. return false
  50091. }
  50092. /* istanbul ignore if */
  50093. if (this._hasMove) {
  50094. return this._hasMove
  50095. }
  50096. // Detect whether an element with the move class applied has
  50097. // CSS transitions. Since the element may be inside an entering
  50098. // transition at this very moment, we make a clone of it and remove
  50099. // all other transition classes applied to ensure only the move class
  50100. // is applied.
  50101. var clone = el.cloneNode();
  50102. if (el._transitionClasses) {
  50103. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  50104. }
  50105. addClass(clone, moveClass);
  50106. clone.style.display = 'none';
  50107. this.$el.appendChild(clone);
  50108. var info = getTransitionInfo(clone);
  50109. this.$el.removeChild(clone);
  50110. return (this._hasMove = info.hasTransform)
  50111. }
  50112. }
  50113. };
  50114. function callPendingCbs (c) {
  50115. /* istanbul ignore if */
  50116. if (c.elm._moveCb) {
  50117. c.elm._moveCb();
  50118. }
  50119. /* istanbul ignore if */
  50120. if (c.elm._enterCb) {
  50121. c.elm._enterCb();
  50122. }
  50123. }
  50124. function recordPosition (c) {
  50125. c.data.newPos = c.elm.getBoundingClientRect();
  50126. }
  50127. function applyTranslation (c) {
  50128. var oldPos = c.data.pos;
  50129. var newPos = c.data.newPos;
  50130. var dx = oldPos.left - newPos.left;
  50131. var dy = oldPos.top - newPos.top;
  50132. if (dx || dy) {
  50133. c.data.moved = true;
  50134. var s = c.elm.style;
  50135. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  50136. s.transitionDuration = '0s';
  50137. }
  50138. }
  50139. var platformComponents = {
  50140. Transition: Transition,
  50141. TransitionGroup: TransitionGroup
  50142. };
  50143. /* */
  50144. // install platform specific utils
  50145. Vue.config.mustUseProp = mustUseProp;
  50146. Vue.config.isReservedTag = isReservedTag;
  50147. Vue.config.isReservedAttr = isReservedAttr;
  50148. Vue.config.getTagNamespace = getTagNamespace;
  50149. Vue.config.isUnknownElement = isUnknownElement;
  50150. // install platform runtime directives & components
  50151. extend(Vue.options.directives, platformDirectives);
  50152. extend(Vue.options.components, platformComponents);
  50153. // install platform patch function
  50154. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  50155. // public mount method
  50156. Vue.prototype.$mount = function (
  50157. el,
  50158. hydrating
  50159. ) {
  50160. el = el && inBrowser ? query(el) : undefined;
  50161. return mountComponent(this, el, hydrating)
  50162. };
  50163. // devtools global hook
  50164. /* istanbul ignore next */
  50165. if (inBrowser) {
  50166. setTimeout(function () {
  50167. if (config.devtools) {
  50168. if (devtools) {
  50169. devtools.emit('init', Vue);
  50170. } else {
  50171. console[console.info ? 'info' : 'log'](
  50172. 'Download the Vue Devtools extension for a better development experience:\n' +
  50173. 'https://github.com/vuejs/vue-devtools'
  50174. );
  50175. }
  50176. }
  50177. if (config.productionTip !== false &&
  50178. typeof console !== 'undefined'
  50179. ) {
  50180. console[console.info ? 'info' : 'log'](
  50181. "You are running Vue in development mode.\n" +
  50182. "Make sure to turn on production mode when deploying for production.\n" +
  50183. "See more tips at https://vuejs.org/guide/deployment.html"
  50184. );
  50185. }
  50186. }, 0);
  50187. }
  50188. /* */
  50189. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  50190. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  50191. var buildRegex = cached(function (delimiters) {
  50192. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  50193. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  50194. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  50195. });
  50196. function parseText (
  50197. text,
  50198. delimiters
  50199. ) {
  50200. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  50201. if (!tagRE.test(text)) {
  50202. return
  50203. }
  50204. var tokens = [];
  50205. var rawTokens = [];
  50206. var lastIndex = tagRE.lastIndex = 0;
  50207. var match, index, tokenValue;
  50208. while ((match = tagRE.exec(text))) {
  50209. index = match.index;
  50210. // push text token
  50211. if (index > lastIndex) {
  50212. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  50213. tokens.push(JSON.stringify(tokenValue));
  50214. }
  50215. // tag token
  50216. var exp = parseFilters(match[1].trim());
  50217. tokens.push(("_s(" + exp + ")"));
  50218. rawTokens.push({ '@binding': exp });
  50219. lastIndex = index + match[0].length;
  50220. }
  50221. if (lastIndex < text.length) {
  50222. rawTokens.push(tokenValue = text.slice(lastIndex));
  50223. tokens.push(JSON.stringify(tokenValue));
  50224. }
  50225. return {
  50226. expression: tokens.join('+'),
  50227. tokens: rawTokens
  50228. }
  50229. }
  50230. /* */
  50231. function transformNode (el, options) {
  50232. var warn = options.warn || baseWarn;
  50233. var staticClass = getAndRemoveAttr(el, 'class');
  50234. if (staticClass) {
  50235. var res = parseText(staticClass, options.delimiters);
  50236. if (res) {
  50237. warn(
  50238. "class=\"" + staticClass + "\": " +
  50239. 'Interpolation inside attributes has been removed. ' +
  50240. 'Use v-bind or the colon shorthand instead. For example, ' +
  50241. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  50242. el.rawAttrsMap['class']
  50243. );
  50244. }
  50245. }
  50246. if (staticClass) {
  50247. el.staticClass = JSON.stringify(staticClass);
  50248. }
  50249. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  50250. if (classBinding) {
  50251. el.classBinding = classBinding;
  50252. }
  50253. }
  50254. function genData (el) {
  50255. var data = '';
  50256. if (el.staticClass) {
  50257. data += "staticClass:" + (el.staticClass) + ",";
  50258. }
  50259. if (el.classBinding) {
  50260. data += "class:" + (el.classBinding) + ",";
  50261. }
  50262. return data
  50263. }
  50264. var klass$1 = {
  50265. staticKeys: ['staticClass'],
  50266. transformNode: transformNode,
  50267. genData: genData
  50268. };
  50269. /* */
  50270. function transformNode$1 (el, options) {
  50271. var warn = options.warn || baseWarn;
  50272. var staticStyle = getAndRemoveAttr(el, 'style');
  50273. if (staticStyle) {
  50274. /* istanbul ignore if */
  50275. {
  50276. var res = parseText(staticStyle, options.delimiters);
  50277. if (res) {
  50278. warn(
  50279. "style=\"" + staticStyle + "\": " +
  50280. 'Interpolation inside attributes has been removed. ' +
  50281. 'Use v-bind or the colon shorthand instead. For example, ' +
  50282. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  50283. el.rawAttrsMap['style']
  50284. );
  50285. }
  50286. }
  50287. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  50288. }
  50289. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  50290. if (styleBinding) {
  50291. el.styleBinding = styleBinding;
  50292. }
  50293. }
  50294. function genData$1 (el) {
  50295. var data = '';
  50296. if (el.staticStyle) {
  50297. data += "staticStyle:" + (el.staticStyle) + ",";
  50298. }
  50299. if (el.styleBinding) {
  50300. data += "style:(" + (el.styleBinding) + "),";
  50301. }
  50302. return data
  50303. }
  50304. var style$1 = {
  50305. staticKeys: ['staticStyle'],
  50306. transformNode: transformNode$1,
  50307. genData: genData$1
  50308. };
  50309. /* */
  50310. var decoder;
  50311. var he = {
  50312. decode: function decode (html) {
  50313. decoder = decoder || document.createElement('div');
  50314. decoder.innerHTML = html;
  50315. return decoder.textContent
  50316. }
  50317. };
  50318. /* */
  50319. var isUnaryTag = makeMap(
  50320. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  50321. 'link,meta,param,source,track,wbr'
  50322. );
  50323. // Elements that you can, intentionally, leave open
  50324. // (and which close themselves)
  50325. var canBeLeftOpenTag = makeMap(
  50326. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  50327. );
  50328. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  50329. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  50330. var isNonPhrasingTag = makeMap(
  50331. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  50332. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  50333. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  50334. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  50335. 'title,tr,track'
  50336. );
  50337. /**
  50338. * Not type-checking this file because it's mostly vendor code.
  50339. */
  50340. // Regular Expressions for parsing tags and attributes
  50341. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  50342. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  50343. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  50344. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  50345. var startTagOpen = new RegExp(("^<" + qnameCapture));
  50346. var startTagClose = /^\s*(\/?)>/;
  50347. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  50348. var doctype = /^<!DOCTYPE [^>]+>/i;
  50349. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  50350. var comment = /^<!\--/;
  50351. var conditionalComment = /^<!\[/;
  50352. // Special Elements (can contain anything)
  50353. var isPlainTextElement = makeMap('script,style,textarea', true);
  50354. var reCache = {};
  50355. var decodingMap = {
  50356. '&lt;': '<',
  50357. '&gt;': '>',
  50358. '&quot;': '"',
  50359. '&amp;': '&',
  50360. '&#10;': '\n',
  50361. '&#9;': '\t',
  50362. '&#39;': "'"
  50363. };
  50364. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  50365. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  50366. // #5992
  50367. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  50368. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  50369. function decodeAttr (value, shouldDecodeNewlines) {
  50370. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  50371. return value.replace(re, function (match) { return decodingMap[match]; })
  50372. }
  50373. function parseHTML (html, options) {
  50374. var stack = [];
  50375. var expectHTML = options.expectHTML;
  50376. var isUnaryTag$$1 = options.isUnaryTag || no;
  50377. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  50378. var index = 0;
  50379. var last, lastTag;
  50380. while (html) {
  50381. last = html;
  50382. // Make sure we're not in a plaintext content element like script/style
  50383. if (!lastTag || !isPlainTextElement(lastTag)) {
  50384. var textEnd = html.indexOf('<');
  50385. if (textEnd === 0) {
  50386. // Comment:
  50387. if (comment.test(html)) {
  50388. var commentEnd = html.indexOf('-->');
  50389. if (commentEnd >= 0) {
  50390. if (options.shouldKeepComment) {
  50391. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  50392. }
  50393. advance(commentEnd + 3);
  50394. continue
  50395. }
  50396. }
  50397. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  50398. if (conditionalComment.test(html)) {
  50399. var conditionalEnd = html.indexOf(']>');
  50400. if (conditionalEnd >= 0) {
  50401. advance(conditionalEnd + 2);
  50402. continue
  50403. }
  50404. }
  50405. // Doctype:
  50406. var doctypeMatch = html.match(doctype);
  50407. if (doctypeMatch) {
  50408. advance(doctypeMatch[0].length);
  50409. continue
  50410. }
  50411. // End tag:
  50412. var endTagMatch = html.match(endTag);
  50413. if (endTagMatch) {
  50414. var curIndex = index;
  50415. advance(endTagMatch[0].length);
  50416. parseEndTag(endTagMatch[1], curIndex, index);
  50417. continue
  50418. }
  50419. // Start tag:
  50420. var startTagMatch = parseStartTag();
  50421. if (startTagMatch) {
  50422. handleStartTag(startTagMatch);
  50423. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  50424. advance(1);
  50425. }
  50426. continue
  50427. }
  50428. }
  50429. var text = (void 0), rest = (void 0), next = (void 0);
  50430. if (textEnd >= 0) {
  50431. rest = html.slice(textEnd);
  50432. while (
  50433. !endTag.test(rest) &&
  50434. !startTagOpen.test(rest) &&
  50435. !comment.test(rest) &&
  50436. !conditionalComment.test(rest)
  50437. ) {
  50438. // < in plain text, be forgiving and treat it as text
  50439. next = rest.indexOf('<', 1);
  50440. if (next < 0) { break }
  50441. textEnd += next;
  50442. rest = html.slice(textEnd);
  50443. }
  50444. text = html.substring(0, textEnd);
  50445. }
  50446. if (textEnd < 0) {
  50447. text = html;
  50448. }
  50449. if (text) {
  50450. advance(text.length);
  50451. }
  50452. if (options.chars && text) {
  50453. options.chars(text, index - text.length, index);
  50454. }
  50455. } else {
  50456. var endTagLength = 0;
  50457. var stackedTag = lastTag.toLowerCase();
  50458. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  50459. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  50460. endTagLength = endTag.length;
  50461. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  50462. text = text
  50463. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  50464. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  50465. }
  50466. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  50467. text = text.slice(1);
  50468. }
  50469. if (options.chars) {
  50470. options.chars(text);
  50471. }
  50472. return ''
  50473. });
  50474. index += html.length - rest$1.length;
  50475. html = rest$1;
  50476. parseEndTag(stackedTag, index - endTagLength, index);
  50477. }
  50478. if (html === last) {
  50479. options.chars && options.chars(html);
  50480. if (!stack.length && options.warn) {
  50481. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  50482. }
  50483. break
  50484. }
  50485. }
  50486. // Clean up any remaining tags
  50487. parseEndTag();
  50488. function advance (n) {
  50489. index += n;
  50490. html = html.substring(n);
  50491. }
  50492. function parseStartTag () {
  50493. var start = html.match(startTagOpen);
  50494. if (start) {
  50495. var match = {
  50496. tagName: start[1],
  50497. attrs: [],
  50498. start: index
  50499. };
  50500. advance(start[0].length);
  50501. var end, attr;
  50502. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  50503. attr.start = index;
  50504. advance(attr[0].length);
  50505. attr.end = index;
  50506. match.attrs.push(attr);
  50507. }
  50508. if (end) {
  50509. match.unarySlash = end[1];
  50510. advance(end[0].length);
  50511. match.end = index;
  50512. return match
  50513. }
  50514. }
  50515. }
  50516. function handleStartTag (match) {
  50517. var tagName = match.tagName;
  50518. var unarySlash = match.unarySlash;
  50519. if (expectHTML) {
  50520. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  50521. parseEndTag(lastTag);
  50522. }
  50523. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  50524. parseEndTag(tagName);
  50525. }
  50526. }
  50527. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  50528. var l = match.attrs.length;
  50529. var attrs = new Array(l);
  50530. for (var i = 0; i < l; i++) {
  50531. var args = match.attrs[i];
  50532. var value = args[3] || args[4] || args[5] || '';
  50533. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  50534. ? options.shouldDecodeNewlinesForHref
  50535. : options.shouldDecodeNewlines;
  50536. attrs[i] = {
  50537. name: args[1],
  50538. value: decodeAttr(value, shouldDecodeNewlines)
  50539. };
  50540. if (options.outputSourceRange) {
  50541. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  50542. attrs[i].end = args.end;
  50543. }
  50544. }
  50545. if (!unary) {
  50546. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  50547. lastTag = tagName;
  50548. }
  50549. if (options.start) {
  50550. options.start(tagName, attrs, unary, match.start, match.end);
  50551. }
  50552. }
  50553. function parseEndTag (tagName, start, end) {
  50554. var pos, lowerCasedTagName;
  50555. if (start == null) { start = index; }
  50556. if (end == null) { end = index; }
  50557. // Find the closest opened tag of the same type
  50558. if (tagName) {
  50559. lowerCasedTagName = tagName.toLowerCase();
  50560. for (pos = stack.length - 1; pos >= 0; pos--) {
  50561. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  50562. break
  50563. }
  50564. }
  50565. } else {
  50566. // If no tag name is provided, clean shop
  50567. pos = 0;
  50568. }
  50569. if (pos >= 0) {
  50570. // Close all the open elements, up the stack
  50571. for (var i = stack.length - 1; i >= pos; i--) {
  50572. if (i > pos || !tagName &&
  50573. options.warn
  50574. ) {
  50575. options.warn(
  50576. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  50577. { start: stack[i].start, end: stack[i].end }
  50578. );
  50579. }
  50580. if (options.end) {
  50581. options.end(stack[i].tag, start, end);
  50582. }
  50583. }
  50584. // Remove the open elements from the stack
  50585. stack.length = pos;
  50586. lastTag = pos && stack[pos - 1].tag;
  50587. } else if (lowerCasedTagName === 'br') {
  50588. if (options.start) {
  50589. options.start(tagName, [], true, start, end);
  50590. }
  50591. } else if (lowerCasedTagName === 'p') {
  50592. if (options.start) {
  50593. options.start(tagName, [], false, start, end);
  50594. }
  50595. if (options.end) {
  50596. options.end(tagName, start, end);
  50597. }
  50598. }
  50599. }
  50600. }
  50601. /* */
  50602. var onRE = /^@|^v-on:/;
  50603. var dirRE = /^v-|^@|^:|^#/;
  50604. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  50605. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  50606. var stripParensRE = /^\(|\)$/g;
  50607. var dynamicArgRE = /^\[.*\]$/;
  50608. var argRE = /:(.*)$/;
  50609. var bindRE = /^:|^\.|^v-bind:/;
  50610. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  50611. var slotRE = /^v-slot(:|$)|^#/;
  50612. var lineBreakRE = /[\r\n]/;
  50613. var whitespaceRE$1 = /\s+/g;
  50614. var invalidAttributeRE = /[\s"'<>\/=]/;
  50615. var decodeHTMLCached = cached(he.decode);
  50616. var emptySlotScopeToken = "_empty_";
  50617. // configurable state
  50618. var warn$2;
  50619. var delimiters;
  50620. var transforms;
  50621. var preTransforms;
  50622. var postTransforms;
  50623. var platformIsPreTag;
  50624. var platformMustUseProp;
  50625. var platformGetTagNamespace;
  50626. var maybeComponent;
  50627. function createASTElement (
  50628. tag,
  50629. attrs,
  50630. parent
  50631. ) {
  50632. return {
  50633. type: 1,
  50634. tag: tag,
  50635. attrsList: attrs,
  50636. attrsMap: makeAttrsMap(attrs),
  50637. rawAttrsMap: {},
  50638. parent: parent,
  50639. children: []
  50640. }
  50641. }
  50642. /**
  50643. * Convert HTML string to AST.
  50644. */
  50645. function parse (
  50646. template,
  50647. options
  50648. ) {
  50649. warn$2 = options.warn || baseWarn;
  50650. platformIsPreTag = options.isPreTag || no;
  50651. platformMustUseProp = options.mustUseProp || no;
  50652. platformGetTagNamespace = options.getTagNamespace || no;
  50653. var isReservedTag = options.isReservedTag || no;
  50654. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  50655. transforms = pluckModuleFunction(options.modules, 'transformNode');
  50656. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  50657. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  50658. delimiters = options.delimiters;
  50659. var stack = [];
  50660. var preserveWhitespace = options.preserveWhitespace !== false;
  50661. var whitespaceOption = options.whitespace;
  50662. var root;
  50663. var currentParent;
  50664. var inVPre = false;
  50665. var inPre = false;
  50666. var warned = false;
  50667. function warnOnce (msg, range) {
  50668. if (!warned) {
  50669. warned = true;
  50670. warn$2(msg, range);
  50671. }
  50672. }
  50673. function closeElement (element) {
  50674. trimEndingWhitespace(element);
  50675. if (!inVPre && !element.processed) {
  50676. element = processElement(element, options);
  50677. }
  50678. // tree management
  50679. if (!stack.length && element !== root) {
  50680. // allow root elements with v-if, v-else-if and v-else
  50681. if (root.if && (element.elseif || element.else)) {
  50682. {
  50683. checkRootConstraints(element);
  50684. }
  50685. addIfCondition(root, {
  50686. exp: element.elseif,
  50687. block: element
  50688. });
  50689. } else {
  50690. warnOnce(
  50691. "Component template should contain exactly one root element. " +
  50692. "If you are using v-if on multiple elements, " +
  50693. "use v-else-if to chain them instead.",
  50694. { start: element.start }
  50695. );
  50696. }
  50697. }
  50698. if (currentParent && !element.forbidden) {
  50699. if (element.elseif || element.else) {
  50700. processIfConditions(element, currentParent);
  50701. } else {
  50702. if (element.slotScope) {
  50703. // scoped slot
  50704. // keep it in the children list so that v-else(-if) conditions can
  50705. // find it as the prev node.
  50706. var name = element.slotTarget || '"default"'
  50707. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  50708. }
  50709. currentParent.children.push(element);
  50710. element.parent = currentParent;
  50711. }
  50712. }
  50713. // final children cleanup
  50714. // filter out scoped slots
  50715. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  50716. // remove trailing whitespace node again
  50717. trimEndingWhitespace(element);
  50718. // check pre state
  50719. if (element.pre) {
  50720. inVPre = false;
  50721. }
  50722. if (platformIsPreTag(element.tag)) {
  50723. inPre = false;
  50724. }
  50725. // apply post-transforms
  50726. for (var i = 0; i < postTransforms.length; i++) {
  50727. postTransforms[i](element, options);
  50728. }
  50729. }
  50730. function trimEndingWhitespace (el) {
  50731. // remove trailing whitespace node
  50732. if (!inPre) {
  50733. var lastNode;
  50734. while (
  50735. (lastNode = el.children[el.children.length - 1]) &&
  50736. lastNode.type === 3 &&
  50737. lastNode.text === ' '
  50738. ) {
  50739. el.children.pop();
  50740. }
  50741. }
  50742. }
  50743. function checkRootConstraints (el) {
  50744. if (el.tag === 'slot' || el.tag === 'template') {
  50745. warnOnce(
  50746. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  50747. 'contain multiple nodes.',
  50748. { start: el.start }
  50749. );
  50750. }
  50751. if (el.attrsMap.hasOwnProperty('v-for')) {
  50752. warnOnce(
  50753. 'Cannot use v-for on stateful component root element because ' +
  50754. 'it renders multiple elements.',
  50755. el.rawAttrsMap['v-for']
  50756. );
  50757. }
  50758. }
  50759. parseHTML(template, {
  50760. warn: warn$2,
  50761. expectHTML: options.expectHTML,
  50762. isUnaryTag: options.isUnaryTag,
  50763. canBeLeftOpenTag: options.canBeLeftOpenTag,
  50764. shouldDecodeNewlines: options.shouldDecodeNewlines,
  50765. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  50766. shouldKeepComment: options.comments,
  50767. outputSourceRange: options.outputSourceRange,
  50768. start: function start (tag, attrs, unary, start$1, end) {
  50769. // check namespace.
  50770. // inherit parent ns if there is one
  50771. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  50772. // handle IE svg bug
  50773. /* istanbul ignore if */
  50774. if (isIE && ns === 'svg') {
  50775. attrs = guardIESVGBug(attrs);
  50776. }
  50777. var element = createASTElement(tag, attrs, currentParent);
  50778. if (ns) {
  50779. element.ns = ns;
  50780. }
  50781. {
  50782. if (options.outputSourceRange) {
  50783. element.start = start$1;
  50784. element.end = end;
  50785. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  50786. cumulated[attr.name] = attr;
  50787. return cumulated
  50788. }, {});
  50789. }
  50790. attrs.forEach(function (attr) {
  50791. if (invalidAttributeRE.test(attr.name)) {
  50792. warn$2(
  50793. "Invalid dynamic argument expression: attribute names cannot contain " +
  50794. "spaces, quotes, <, >, / or =.",
  50795. {
  50796. start: attr.start + attr.name.indexOf("["),
  50797. end: attr.start + attr.name.length
  50798. }
  50799. );
  50800. }
  50801. });
  50802. }
  50803. if (isForbiddenTag(element) && !isServerRendering()) {
  50804. element.forbidden = true;
  50805. warn$2(
  50806. 'Templates should only be responsible for mapping the state to the ' +
  50807. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  50808. "<" + tag + ">" + ', as they will not be parsed.',
  50809. { start: element.start }
  50810. );
  50811. }
  50812. // apply pre-transforms
  50813. for (var i = 0; i < preTransforms.length; i++) {
  50814. element = preTransforms[i](element, options) || element;
  50815. }
  50816. if (!inVPre) {
  50817. processPre(element);
  50818. if (element.pre) {
  50819. inVPre = true;
  50820. }
  50821. }
  50822. if (platformIsPreTag(element.tag)) {
  50823. inPre = true;
  50824. }
  50825. if (inVPre) {
  50826. processRawAttrs(element);
  50827. } else if (!element.processed) {
  50828. // structural directives
  50829. processFor(element);
  50830. processIf(element);
  50831. processOnce(element);
  50832. }
  50833. if (!root) {
  50834. root = element;
  50835. {
  50836. checkRootConstraints(root);
  50837. }
  50838. }
  50839. if (!unary) {
  50840. currentParent = element;
  50841. stack.push(element);
  50842. } else {
  50843. closeElement(element);
  50844. }
  50845. },
  50846. end: function end (tag, start, end$1) {
  50847. var element = stack[stack.length - 1];
  50848. // pop stack
  50849. stack.length -= 1;
  50850. currentParent = stack[stack.length - 1];
  50851. if (options.outputSourceRange) {
  50852. element.end = end$1;
  50853. }
  50854. closeElement(element);
  50855. },
  50856. chars: function chars (text, start, end) {
  50857. if (!currentParent) {
  50858. {
  50859. if (text === template) {
  50860. warnOnce(
  50861. 'Component template requires a root element, rather than just text.',
  50862. { start: start }
  50863. );
  50864. } else if ((text = text.trim())) {
  50865. warnOnce(
  50866. ("text \"" + text + "\" outside root element will be ignored."),
  50867. { start: start }
  50868. );
  50869. }
  50870. }
  50871. return
  50872. }
  50873. // IE textarea placeholder bug
  50874. /* istanbul ignore if */
  50875. if (isIE &&
  50876. currentParent.tag === 'textarea' &&
  50877. currentParent.attrsMap.placeholder === text
  50878. ) {
  50879. return
  50880. }
  50881. var children = currentParent.children;
  50882. if (inPre || text.trim()) {
  50883. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  50884. } else if (!children.length) {
  50885. // remove the whitespace-only node right after an opening tag
  50886. text = '';
  50887. } else if (whitespaceOption) {
  50888. if (whitespaceOption === 'condense') {
  50889. // in condense mode, remove the whitespace node if it contains
  50890. // line break, otherwise condense to a single space
  50891. text = lineBreakRE.test(text) ? '' : ' ';
  50892. } else {
  50893. text = ' ';
  50894. }
  50895. } else {
  50896. text = preserveWhitespace ? ' ' : '';
  50897. }
  50898. if (text) {
  50899. if (!inPre && whitespaceOption === 'condense') {
  50900. // condense consecutive whitespaces into single space
  50901. text = text.replace(whitespaceRE$1, ' ');
  50902. }
  50903. var res;
  50904. var child;
  50905. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  50906. child = {
  50907. type: 2,
  50908. expression: res.expression,
  50909. tokens: res.tokens,
  50910. text: text
  50911. };
  50912. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  50913. child = {
  50914. type: 3,
  50915. text: text
  50916. };
  50917. }
  50918. if (child) {
  50919. if (options.outputSourceRange) {
  50920. child.start = start;
  50921. child.end = end;
  50922. }
  50923. children.push(child);
  50924. }
  50925. }
  50926. },
  50927. comment: function comment (text, start, end) {
  50928. // adding anyting as a sibling to the root node is forbidden
  50929. // comments should still be allowed, but ignored
  50930. if (currentParent) {
  50931. var child = {
  50932. type: 3,
  50933. text: text,
  50934. isComment: true
  50935. };
  50936. if (options.outputSourceRange) {
  50937. child.start = start;
  50938. child.end = end;
  50939. }
  50940. currentParent.children.push(child);
  50941. }
  50942. }
  50943. });
  50944. return root
  50945. }
  50946. function processPre (el) {
  50947. if (getAndRemoveAttr(el, 'v-pre') != null) {
  50948. el.pre = true;
  50949. }
  50950. }
  50951. function processRawAttrs (el) {
  50952. var list = el.attrsList;
  50953. var len = list.length;
  50954. if (len) {
  50955. var attrs = el.attrs = new Array(len);
  50956. for (var i = 0; i < len; i++) {
  50957. attrs[i] = {
  50958. name: list[i].name,
  50959. value: JSON.stringify(list[i].value)
  50960. };
  50961. if (list[i].start != null) {
  50962. attrs[i].start = list[i].start;
  50963. attrs[i].end = list[i].end;
  50964. }
  50965. }
  50966. } else if (!el.pre) {
  50967. // non root node in pre blocks with no attributes
  50968. el.plain = true;
  50969. }
  50970. }
  50971. function processElement (
  50972. element,
  50973. options
  50974. ) {
  50975. processKey(element);
  50976. // determine whether this is a plain element after
  50977. // removing structural attributes
  50978. element.plain = (
  50979. !element.key &&
  50980. !element.scopedSlots &&
  50981. !element.attrsList.length
  50982. );
  50983. processRef(element);
  50984. processSlotContent(element);
  50985. processSlotOutlet(element);
  50986. processComponent(element);
  50987. for (var i = 0; i < transforms.length; i++) {
  50988. element = transforms[i](element, options) || element;
  50989. }
  50990. processAttrs(element);
  50991. return element
  50992. }
  50993. function processKey (el) {
  50994. var exp = getBindingAttr(el, 'key');
  50995. if (exp) {
  50996. {
  50997. if (el.tag === 'template') {
  50998. warn$2(
  50999. "<template> cannot be keyed. Place the key on real elements instead.",
  51000. getRawBindingAttr(el, 'key')
  51001. );
  51002. }
  51003. if (el.for) {
  51004. var iterator = el.iterator2 || el.iterator1;
  51005. var parent = el.parent;
  51006. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  51007. warn$2(
  51008. "Do not use v-for index as key on <transition-group> children, " +
  51009. "this is the same as not using keys.",
  51010. getRawBindingAttr(el, 'key'),
  51011. true /* tip */
  51012. );
  51013. }
  51014. }
  51015. }
  51016. el.key = exp;
  51017. }
  51018. }
  51019. function processRef (el) {
  51020. var ref = getBindingAttr(el, 'ref');
  51021. if (ref) {
  51022. el.ref = ref;
  51023. el.refInFor = checkInFor(el);
  51024. }
  51025. }
  51026. function processFor (el) {
  51027. var exp;
  51028. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  51029. var res = parseFor(exp);
  51030. if (res) {
  51031. extend(el, res);
  51032. } else {
  51033. warn$2(
  51034. ("Invalid v-for expression: " + exp),
  51035. el.rawAttrsMap['v-for']
  51036. );
  51037. }
  51038. }
  51039. }
  51040. function parseFor (exp) {
  51041. var inMatch = exp.match(forAliasRE);
  51042. if (!inMatch) { return }
  51043. var res = {};
  51044. res.for = inMatch[2].trim();
  51045. var alias = inMatch[1].trim().replace(stripParensRE, '');
  51046. var iteratorMatch = alias.match(forIteratorRE);
  51047. if (iteratorMatch) {
  51048. res.alias = alias.replace(forIteratorRE, '').trim();
  51049. res.iterator1 = iteratorMatch[1].trim();
  51050. if (iteratorMatch[2]) {
  51051. res.iterator2 = iteratorMatch[2].trim();
  51052. }
  51053. } else {
  51054. res.alias = alias;
  51055. }
  51056. return res
  51057. }
  51058. function processIf (el) {
  51059. var exp = getAndRemoveAttr(el, 'v-if');
  51060. if (exp) {
  51061. el.if = exp;
  51062. addIfCondition(el, {
  51063. exp: exp,
  51064. block: el
  51065. });
  51066. } else {
  51067. if (getAndRemoveAttr(el, 'v-else') != null) {
  51068. el.else = true;
  51069. }
  51070. var elseif = getAndRemoveAttr(el, 'v-else-if');
  51071. if (elseif) {
  51072. el.elseif = elseif;
  51073. }
  51074. }
  51075. }
  51076. function processIfConditions (el, parent) {
  51077. var prev = findPrevElement(parent.children);
  51078. if (prev && prev.if) {
  51079. addIfCondition(prev, {
  51080. exp: el.elseif,
  51081. block: el
  51082. });
  51083. } else {
  51084. warn$2(
  51085. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  51086. "used on element <" + (el.tag) + "> without corresponding v-if.",
  51087. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  51088. );
  51089. }
  51090. }
  51091. function findPrevElement (children) {
  51092. var i = children.length;
  51093. while (i--) {
  51094. if (children[i].type === 1) {
  51095. return children[i]
  51096. } else {
  51097. if (children[i].text !== ' ') {
  51098. warn$2(
  51099. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  51100. "will be ignored.",
  51101. children[i]
  51102. );
  51103. }
  51104. children.pop();
  51105. }
  51106. }
  51107. }
  51108. function addIfCondition (el, condition) {
  51109. if (!el.ifConditions) {
  51110. el.ifConditions = [];
  51111. }
  51112. el.ifConditions.push(condition);
  51113. }
  51114. function processOnce (el) {
  51115. var once$$1 = getAndRemoveAttr(el, 'v-once');
  51116. if (once$$1 != null) {
  51117. el.once = true;
  51118. }
  51119. }
  51120. // handle content being passed to a component as slot,
  51121. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  51122. function processSlotContent (el) {
  51123. var slotScope;
  51124. if (el.tag === 'template') {
  51125. slotScope = getAndRemoveAttr(el, 'scope');
  51126. /* istanbul ignore if */
  51127. if (slotScope) {
  51128. warn$2(
  51129. "the \"scope\" attribute for scoped slots have been deprecated and " +
  51130. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  51131. "can also be used on plain elements in addition to <template> to " +
  51132. "denote scoped slots.",
  51133. el.rawAttrsMap['scope'],
  51134. true
  51135. );
  51136. }
  51137. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  51138. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  51139. /* istanbul ignore if */
  51140. if (el.attrsMap['v-for']) {
  51141. warn$2(
  51142. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  51143. "(v-for takes higher priority). Use a wrapper <template> for the " +
  51144. "scoped slot to make it clearer.",
  51145. el.rawAttrsMap['slot-scope'],
  51146. true
  51147. );
  51148. }
  51149. el.slotScope = slotScope;
  51150. }
  51151. // slot="xxx"
  51152. var slotTarget = getBindingAttr(el, 'slot');
  51153. if (slotTarget) {
  51154. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  51155. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  51156. // preserve slot as an attribute for native shadow DOM compat
  51157. // only for non-scoped slots.
  51158. if (el.tag !== 'template' && !el.slotScope) {
  51159. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  51160. }
  51161. }
  51162. // 2.6 v-slot syntax
  51163. {
  51164. if (el.tag === 'template') {
  51165. // v-slot on <template>
  51166. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  51167. if (slotBinding) {
  51168. {
  51169. if (el.slotTarget || el.slotScope) {
  51170. warn$2(
  51171. "Unexpected mixed usage of different slot syntaxes.",
  51172. el
  51173. );
  51174. }
  51175. if (el.parent && !maybeComponent(el.parent)) {
  51176. warn$2(
  51177. "<template v-slot> can only appear at the root level inside " +
  51178. "the receiving component",
  51179. el
  51180. );
  51181. }
  51182. }
  51183. var ref = getSlotName(slotBinding);
  51184. var name = ref.name;
  51185. var dynamic = ref.dynamic;
  51186. el.slotTarget = name;
  51187. el.slotTargetDynamic = dynamic;
  51188. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  51189. }
  51190. } else {
  51191. // v-slot on component, denotes default slot
  51192. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  51193. if (slotBinding$1) {
  51194. {
  51195. if (!maybeComponent(el)) {
  51196. warn$2(
  51197. "v-slot can only be used on components or <template>.",
  51198. slotBinding$1
  51199. );
  51200. }
  51201. if (el.slotScope || el.slotTarget) {
  51202. warn$2(
  51203. "Unexpected mixed usage of different slot syntaxes.",
  51204. el
  51205. );
  51206. }
  51207. if (el.scopedSlots) {
  51208. warn$2(
  51209. "To avoid scope ambiguity, the default slot should also use " +
  51210. "<template> syntax when there are other named slots.",
  51211. slotBinding$1
  51212. );
  51213. }
  51214. }
  51215. // add the component's children to its default slot
  51216. var slots = el.scopedSlots || (el.scopedSlots = {});
  51217. var ref$1 = getSlotName(slotBinding$1);
  51218. var name$1 = ref$1.name;
  51219. var dynamic$1 = ref$1.dynamic;
  51220. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  51221. slotContainer.slotTarget = name$1;
  51222. slotContainer.slotTargetDynamic = dynamic$1;
  51223. slotContainer.children = el.children.filter(function (c) {
  51224. if (!c.slotScope) {
  51225. c.parent = slotContainer;
  51226. return true
  51227. }
  51228. });
  51229. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  51230. // remove children as they are returned from scopedSlots now
  51231. el.children = [];
  51232. // mark el non-plain so data gets generated
  51233. el.plain = false;
  51234. }
  51235. }
  51236. }
  51237. }
  51238. function getSlotName (binding) {
  51239. var name = binding.name.replace(slotRE, '');
  51240. if (!name) {
  51241. if (binding.name[0] !== '#') {
  51242. name = 'default';
  51243. } else {
  51244. warn$2(
  51245. "v-slot shorthand syntax requires a slot name.",
  51246. binding
  51247. );
  51248. }
  51249. }
  51250. return dynamicArgRE.test(name)
  51251. // dynamic [name]
  51252. ? { name: name.slice(1, -1), dynamic: true }
  51253. // static name
  51254. : { name: ("\"" + name + "\""), dynamic: false }
  51255. }
  51256. // handle <slot/> outlets
  51257. function processSlotOutlet (el) {
  51258. if (el.tag === 'slot') {
  51259. el.slotName = getBindingAttr(el, 'name');
  51260. if (el.key) {
  51261. warn$2(
  51262. "`key` does not work on <slot> because slots are abstract outlets " +
  51263. "and can possibly expand into multiple elements. " +
  51264. "Use the key on a wrapping element instead.",
  51265. getRawBindingAttr(el, 'key')
  51266. );
  51267. }
  51268. }
  51269. }
  51270. function processComponent (el) {
  51271. var binding;
  51272. if ((binding = getBindingAttr(el, 'is'))) {
  51273. el.component = binding;
  51274. }
  51275. if (getAndRemoveAttr(el, 'inline-template') != null) {
  51276. el.inlineTemplate = true;
  51277. }
  51278. }
  51279. function processAttrs (el) {
  51280. var list = el.attrsList;
  51281. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  51282. for (i = 0, l = list.length; i < l; i++) {
  51283. name = rawName = list[i].name;
  51284. value = list[i].value;
  51285. if (dirRE.test(name)) {
  51286. // mark element as dynamic
  51287. el.hasBindings = true;
  51288. // modifiers
  51289. modifiers = parseModifiers(name.replace(dirRE, ''));
  51290. // support .foo shorthand syntax for the .prop modifier
  51291. if (modifiers) {
  51292. name = name.replace(modifierRE, '');
  51293. }
  51294. if (bindRE.test(name)) { // v-bind
  51295. name = name.replace(bindRE, '');
  51296. value = parseFilters(value);
  51297. isDynamic = dynamicArgRE.test(name);
  51298. if (isDynamic) {
  51299. name = name.slice(1, -1);
  51300. }
  51301. if (
  51302. value.trim().length === 0
  51303. ) {
  51304. warn$2(
  51305. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  51306. );
  51307. }
  51308. if (modifiers) {
  51309. if (modifiers.prop && !isDynamic) {
  51310. name = camelize(name);
  51311. if (name === 'innerHtml') { name = 'innerHTML'; }
  51312. }
  51313. if (modifiers.camel && !isDynamic) {
  51314. name = camelize(name);
  51315. }
  51316. if (modifiers.sync) {
  51317. syncGen = genAssignmentCode(value, "$event");
  51318. if (!isDynamic) {
  51319. addHandler(
  51320. el,
  51321. ("update:" + (camelize(name))),
  51322. syncGen,
  51323. null,
  51324. false,
  51325. warn$2,
  51326. list[i]
  51327. );
  51328. if (hyphenate(name) !== camelize(name)) {
  51329. addHandler(
  51330. el,
  51331. ("update:" + (hyphenate(name))),
  51332. syncGen,
  51333. null,
  51334. false,
  51335. warn$2,
  51336. list[i]
  51337. );
  51338. }
  51339. } else {
  51340. // handler w/ dynamic event name
  51341. addHandler(
  51342. el,
  51343. ("\"update:\"+(" + name + ")"),
  51344. syncGen,
  51345. null,
  51346. false,
  51347. warn$2,
  51348. list[i],
  51349. true // dynamic
  51350. );
  51351. }
  51352. }
  51353. }
  51354. if ((modifiers && modifiers.prop) || (
  51355. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  51356. )) {
  51357. addProp(el, name, value, list[i], isDynamic);
  51358. } else {
  51359. addAttr(el, name, value, list[i], isDynamic);
  51360. }
  51361. } else if (onRE.test(name)) { // v-on
  51362. name = name.replace(onRE, '');
  51363. isDynamic = dynamicArgRE.test(name);
  51364. if (isDynamic) {
  51365. name = name.slice(1, -1);
  51366. }
  51367. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  51368. } else { // normal directives
  51369. name = name.replace(dirRE, '');
  51370. // parse arg
  51371. var argMatch = name.match(argRE);
  51372. var arg = argMatch && argMatch[1];
  51373. isDynamic = false;
  51374. if (arg) {
  51375. name = name.slice(0, -(arg.length + 1));
  51376. if (dynamicArgRE.test(arg)) {
  51377. arg = arg.slice(1, -1);
  51378. isDynamic = true;
  51379. }
  51380. }
  51381. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  51382. if (name === 'model') {
  51383. checkForAliasModel(el, value);
  51384. }
  51385. }
  51386. } else {
  51387. // literal attribute
  51388. {
  51389. var res = parseText(value, delimiters);
  51390. if (res) {
  51391. warn$2(
  51392. name + "=\"" + value + "\": " +
  51393. 'Interpolation inside attributes has been removed. ' +
  51394. 'Use v-bind or the colon shorthand instead. For example, ' +
  51395. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  51396. list[i]
  51397. );
  51398. }
  51399. }
  51400. addAttr(el, name, JSON.stringify(value), list[i]);
  51401. // #6887 firefox doesn't update muted state if set via attribute
  51402. // even immediately after element creation
  51403. if (!el.component &&
  51404. name === 'muted' &&
  51405. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  51406. addProp(el, name, 'true', list[i]);
  51407. }
  51408. }
  51409. }
  51410. }
  51411. function checkInFor (el) {
  51412. var parent = el;
  51413. while (parent) {
  51414. if (parent.for !== undefined) {
  51415. return true
  51416. }
  51417. parent = parent.parent;
  51418. }
  51419. return false
  51420. }
  51421. function parseModifiers (name) {
  51422. var match = name.match(modifierRE);
  51423. if (match) {
  51424. var ret = {};
  51425. match.forEach(function (m) { ret[m.slice(1)] = true; });
  51426. return ret
  51427. }
  51428. }
  51429. function makeAttrsMap (attrs) {
  51430. var map = {};
  51431. for (var i = 0, l = attrs.length; i < l; i++) {
  51432. if (
  51433. map[attrs[i].name] && !isIE && !isEdge
  51434. ) {
  51435. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  51436. }
  51437. map[attrs[i].name] = attrs[i].value;
  51438. }
  51439. return map
  51440. }
  51441. // for script (e.g. type="x/template") or style, do not decode content
  51442. function isTextTag (el) {
  51443. return el.tag === 'script' || el.tag === 'style'
  51444. }
  51445. function isForbiddenTag (el) {
  51446. return (
  51447. el.tag === 'style' ||
  51448. (el.tag === 'script' && (
  51449. !el.attrsMap.type ||
  51450. el.attrsMap.type === 'text/javascript'
  51451. ))
  51452. )
  51453. }
  51454. var ieNSBug = /^xmlns:NS\d+/;
  51455. var ieNSPrefix = /^NS\d+:/;
  51456. /* istanbul ignore next */
  51457. function guardIESVGBug (attrs) {
  51458. var res = [];
  51459. for (var i = 0; i < attrs.length; i++) {
  51460. var attr = attrs[i];
  51461. if (!ieNSBug.test(attr.name)) {
  51462. attr.name = attr.name.replace(ieNSPrefix, '');
  51463. res.push(attr);
  51464. }
  51465. }
  51466. return res
  51467. }
  51468. function checkForAliasModel (el, value) {
  51469. var _el = el;
  51470. while (_el) {
  51471. if (_el.for && _el.alias === value) {
  51472. warn$2(
  51473. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  51474. "You are binding v-model directly to a v-for iteration alias. " +
  51475. "This will not be able to modify the v-for source array because " +
  51476. "writing to the alias is like modifying a function local variable. " +
  51477. "Consider using an array of objects and use v-model on an object property instead.",
  51478. el.rawAttrsMap['v-model']
  51479. );
  51480. }
  51481. _el = _el.parent;
  51482. }
  51483. }
  51484. /* */
  51485. function preTransformNode (el, options) {
  51486. if (el.tag === 'input') {
  51487. var map = el.attrsMap;
  51488. if (!map['v-model']) {
  51489. return
  51490. }
  51491. var typeBinding;
  51492. if (map[':type'] || map['v-bind:type']) {
  51493. typeBinding = getBindingAttr(el, 'type');
  51494. }
  51495. if (!map.type && !typeBinding && map['v-bind']) {
  51496. typeBinding = "(" + (map['v-bind']) + ").type";
  51497. }
  51498. if (typeBinding) {
  51499. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  51500. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  51501. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  51502. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  51503. // 1. checkbox
  51504. var branch0 = cloneASTElement(el);
  51505. // process for on the main node
  51506. processFor(branch0);
  51507. addRawAttr(branch0, 'type', 'checkbox');
  51508. processElement(branch0, options);
  51509. branch0.processed = true; // prevent it from double-processed
  51510. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  51511. addIfCondition(branch0, {
  51512. exp: branch0.if,
  51513. block: branch0
  51514. });
  51515. // 2. add radio else-if condition
  51516. var branch1 = cloneASTElement(el);
  51517. getAndRemoveAttr(branch1, 'v-for', true);
  51518. addRawAttr(branch1, 'type', 'radio');
  51519. processElement(branch1, options);
  51520. addIfCondition(branch0, {
  51521. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  51522. block: branch1
  51523. });
  51524. // 3. other
  51525. var branch2 = cloneASTElement(el);
  51526. getAndRemoveAttr(branch2, 'v-for', true);
  51527. addRawAttr(branch2, ':type', typeBinding);
  51528. processElement(branch2, options);
  51529. addIfCondition(branch0, {
  51530. exp: ifCondition,
  51531. block: branch2
  51532. });
  51533. if (hasElse) {
  51534. branch0.else = true;
  51535. } else if (elseIfCondition) {
  51536. branch0.elseif = elseIfCondition;
  51537. }
  51538. return branch0
  51539. }
  51540. }
  51541. }
  51542. function cloneASTElement (el) {
  51543. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  51544. }
  51545. var model$1 = {
  51546. preTransformNode: preTransformNode
  51547. };
  51548. var modules$1 = [
  51549. klass$1,
  51550. style$1,
  51551. model$1
  51552. ];
  51553. /* */
  51554. function text (el, dir) {
  51555. if (dir.value) {
  51556. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  51557. }
  51558. }
  51559. /* */
  51560. function html (el, dir) {
  51561. if (dir.value) {
  51562. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  51563. }
  51564. }
  51565. var directives$1 = {
  51566. model: model,
  51567. text: text,
  51568. html: html
  51569. };
  51570. /* */
  51571. var baseOptions = {
  51572. expectHTML: true,
  51573. modules: modules$1,
  51574. directives: directives$1,
  51575. isPreTag: isPreTag,
  51576. isUnaryTag: isUnaryTag,
  51577. mustUseProp: mustUseProp,
  51578. canBeLeftOpenTag: canBeLeftOpenTag,
  51579. isReservedTag: isReservedTag,
  51580. getTagNamespace: getTagNamespace,
  51581. staticKeys: genStaticKeys(modules$1)
  51582. };
  51583. /* */
  51584. var isStaticKey;
  51585. var isPlatformReservedTag;
  51586. var genStaticKeysCached = cached(genStaticKeys$1);
  51587. /**
  51588. * Goal of the optimizer: walk the generated template AST tree
  51589. * and detect sub-trees that are purely static, i.e. parts of
  51590. * the DOM that never needs to change.
  51591. *
  51592. * Once we detect these sub-trees, we can:
  51593. *
  51594. * 1. Hoist them into constants, so that we no longer need to
  51595. * create fresh nodes for them on each re-render;
  51596. * 2. Completely skip them in the patching process.
  51597. */
  51598. function optimize (root, options) {
  51599. if (!root) { return }
  51600. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  51601. isPlatformReservedTag = options.isReservedTag || no;
  51602. // first pass: mark all non-static nodes.
  51603. markStatic$1(root);
  51604. // second pass: mark static roots.
  51605. markStaticRoots(root, false);
  51606. }
  51607. function genStaticKeys$1 (keys) {
  51608. return makeMap(
  51609. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  51610. (keys ? ',' + keys : '')
  51611. )
  51612. }
  51613. function markStatic$1 (node) {
  51614. node.static = isStatic(node);
  51615. if (node.type === 1) {
  51616. // do not make component slot content static. this avoids
  51617. // 1. components not able to mutate slot nodes
  51618. // 2. static slot content fails for hot-reloading
  51619. if (
  51620. !isPlatformReservedTag(node.tag) &&
  51621. node.tag !== 'slot' &&
  51622. node.attrsMap['inline-template'] == null
  51623. ) {
  51624. return
  51625. }
  51626. for (var i = 0, l = node.children.length; i < l; i++) {
  51627. var child = node.children[i];
  51628. markStatic$1(child);
  51629. if (!child.static) {
  51630. node.static = false;
  51631. }
  51632. }
  51633. if (node.ifConditions) {
  51634. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  51635. var block = node.ifConditions[i$1].block;
  51636. markStatic$1(block);
  51637. if (!block.static) {
  51638. node.static = false;
  51639. }
  51640. }
  51641. }
  51642. }
  51643. }
  51644. function markStaticRoots (node, isInFor) {
  51645. if (node.type === 1) {
  51646. if (node.static || node.once) {
  51647. node.staticInFor = isInFor;
  51648. }
  51649. // For a node to qualify as a static root, it should have children that
  51650. // are not just static text. Otherwise the cost of hoisting out will
  51651. // outweigh the benefits and it's better off to just always render it fresh.
  51652. if (node.static && node.children.length && !(
  51653. node.children.length === 1 &&
  51654. node.children[0].type === 3
  51655. )) {
  51656. node.staticRoot = true;
  51657. return
  51658. } else {
  51659. node.staticRoot = false;
  51660. }
  51661. if (node.children) {
  51662. for (var i = 0, l = node.children.length; i < l; i++) {
  51663. markStaticRoots(node.children[i], isInFor || !!node.for);
  51664. }
  51665. }
  51666. if (node.ifConditions) {
  51667. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  51668. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  51669. }
  51670. }
  51671. }
  51672. }
  51673. function isStatic (node) {
  51674. if (node.type === 2) { // expression
  51675. return false
  51676. }
  51677. if (node.type === 3) { // text
  51678. return true
  51679. }
  51680. return !!(node.pre || (
  51681. !node.hasBindings && // no dynamic bindings
  51682. !node.if && !node.for && // not v-if or v-for or v-else
  51683. !isBuiltInTag(node.tag) && // not a built-in
  51684. isPlatformReservedTag(node.tag) && // not a component
  51685. !isDirectChildOfTemplateFor(node) &&
  51686. Object.keys(node).every(isStaticKey)
  51687. ))
  51688. }
  51689. function isDirectChildOfTemplateFor (node) {
  51690. while (node.parent) {
  51691. node = node.parent;
  51692. if (node.tag !== 'template') {
  51693. return false
  51694. }
  51695. if (node.for) {
  51696. return true
  51697. }
  51698. }
  51699. return false
  51700. }
  51701. /* */
  51702. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  51703. var fnInvokeRE = /\([^)]*?\);*$/;
  51704. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  51705. // KeyboardEvent.keyCode aliases
  51706. var keyCodes = {
  51707. esc: 27,
  51708. tab: 9,
  51709. enter: 13,
  51710. space: 32,
  51711. up: 38,
  51712. left: 37,
  51713. right: 39,
  51714. down: 40,
  51715. 'delete': [8, 46]
  51716. };
  51717. // KeyboardEvent.key aliases
  51718. var keyNames = {
  51719. // #7880: IE11 and Edge use `Esc` for Escape key name.
  51720. esc: ['Esc', 'Escape'],
  51721. tab: 'Tab',
  51722. enter: 'Enter',
  51723. // #9112: IE11 uses `Spacebar` for Space key name.
  51724. space: [' ', 'Spacebar'],
  51725. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  51726. up: ['Up', 'ArrowUp'],
  51727. left: ['Left', 'ArrowLeft'],
  51728. right: ['Right', 'ArrowRight'],
  51729. down: ['Down', 'ArrowDown'],
  51730. // #9112: IE11 uses `Del` for Delete key name.
  51731. 'delete': ['Backspace', 'Delete', 'Del']
  51732. };
  51733. // #4868: modifiers that prevent the execution of the listener
  51734. // need to explicitly return null so that we can determine whether to remove
  51735. // the listener for .once
  51736. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  51737. var modifierCode = {
  51738. stop: '$event.stopPropagation();',
  51739. prevent: '$event.preventDefault();',
  51740. self: genGuard("$event.target !== $event.currentTarget"),
  51741. ctrl: genGuard("!$event.ctrlKey"),
  51742. shift: genGuard("!$event.shiftKey"),
  51743. alt: genGuard("!$event.altKey"),
  51744. meta: genGuard("!$event.metaKey"),
  51745. left: genGuard("'button' in $event && $event.button !== 0"),
  51746. middle: genGuard("'button' in $event && $event.button !== 1"),
  51747. right: genGuard("'button' in $event && $event.button !== 2")
  51748. };
  51749. function genHandlers (
  51750. events,
  51751. isNative
  51752. ) {
  51753. var prefix = isNative ? 'nativeOn:' : 'on:';
  51754. var staticHandlers = "";
  51755. var dynamicHandlers = "";
  51756. for (var name in events) {
  51757. var handlerCode = genHandler(events[name]);
  51758. if (events[name] && events[name].dynamic) {
  51759. dynamicHandlers += name + "," + handlerCode + ",";
  51760. } else {
  51761. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  51762. }
  51763. }
  51764. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  51765. if (dynamicHandlers) {
  51766. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  51767. } else {
  51768. return prefix + staticHandlers
  51769. }
  51770. }
  51771. function genHandler (handler) {
  51772. if (!handler) {
  51773. return 'function(){}'
  51774. }
  51775. if (Array.isArray(handler)) {
  51776. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  51777. }
  51778. var isMethodPath = simplePathRE.test(handler.value);
  51779. var isFunctionExpression = fnExpRE.test(handler.value);
  51780. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  51781. if (!handler.modifiers) {
  51782. if (isMethodPath || isFunctionExpression) {
  51783. return handler.value
  51784. }
  51785. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  51786. } else {
  51787. var code = '';
  51788. var genModifierCode = '';
  51789. var keys = [];
  51790. for (var key in handler.modifiers) {
  51791. if (modifierCode[key]) {
  51792. genModifierCode += modifierCode[key];
  51793. // left/right
  51794. if (keyCodes[key]) {
  51795. keys.push(key);
  51796. }
  51797. } else if (key === 'exact') {
  51798. var modifiers = (handler.modifiers);
  51799. genModifierCode += genGuard(
  51800. ['ctrl', 'shift', 'alt', 'meta']
  51801. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  51802. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  51803. .join('||')
  51804. );
  51805. } else {
  51806. keys.push(key);
  51807. }
  51808. }
  51809. if (keys.length) {
  51810. code += genKeyFilter(keys);
  51811. }
  51812. // Make sure modifiers like prevent and stop get executed after key filtering
  51813. if (genModifierCode) {
  51814. code += genModifierCode;
  51815. }
  51816. var handlerCode = isMethodPath
  51817. ? ("return " + (handler.value) + "($event)")
  51818. : isFunctionExpression
  51819. ? ("return (" + (handler.value) + ")($event)")
  51820. : isFunctionInvocation
  51821. ? ("return " + (handler.value))
  51822. : handler.value;
  51823. return ("function($event){" + code + handlerCode + "}")
  51824. }
  51825. }
  51826. function genKeyFilter (keys) {
  51827. return (
  51828. // make sure the key filters only apply to KeyboardEvents
  51829. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  51830. // key events that do not have keyCode property...
  51831. "if(!$event.type.indexOf('key')&&" +
  51832. (keys.map(genFilterCode).join('&&')) + ")return null;"
  51833. )
  51834. }
  51835. function genFilterCode (key) {
  51836. var keyVal = parseInt(key, 10);
  51837. if (keyVal) {
  51838. return ("$event.keyCode!==" + keyVal)
  51839. }
  51840. var keyCode = keyCodes[key];
  51841. var keyName = keyNames[key];
  51842. return (
  51843. "_k($event.keyCode," +
  51844. (JSON.stringify(key)) + "," +
  51845. (JSON.stringify(keyCode)) + "," +
  51846. "$event.key," +
  51847. "" + (JSON.stringify(keyName)) +
  51848. ")"
  51849. )
  51850. }
  51851. /* */
  51852. function on (el, dir) {
  51853. if (dir.modifiers) {
  51854. warn("v-on without argument does not support modifiers.");
  51855. }
  51856. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  51857. }
  51858. /* */
  51859. function bind$1 (el, dir) {
  51860. el.wrapData = function (code) {
  51861. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  51862. };
  51863. }
  51864. /* */
  51865. var baseDirectives = {
  51866. on: on,
  51867. bind: bind$1,
  51868. cloak: noop
  51869. };
  51870. /* */
  51871. var CodegenState = function CodegenState (options) {
  51872. this.options = options;
  51873. this.warn = options.warn || baseWarn;
  51874. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  51875. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  51876. this.directives = extend(extend({}, baseDirectives), options.directives);
  51877. var isReservedTag = options.isReservedTag || no;
  51878. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  51879. this.onceId = 0;
  51880. this.staticRenderFns = [];
  51881. this.pre = false;
  51882. };
  51883. function generate (
  51884. ast,
  51885. options
  51886. ) {
  51887. var state = new CodegenState(options);
  51888. var code = ast ? genElement(ast, state) : '_c("div")';
  51889. return {
  51890. render: ("with(this){return " + code + "}"),
  51891. staticRenderFns: state.staticRenderFns
  51892. }
  51893. }
  51894. function genElement (el, state) {
  51895. if (el.parent) {
  51896. el.pre = el.pre || el.parent.pre;
  51897. }
  51898. if (el.staticRoot && !el.staticProcessed) {
  51899. return genStatic(el, state)
  51900. } else if (el.once && !el.onceProcessed) {
  51901. return genOnce(el, state)
  51902. } else if (el.for && !el.forProcessed) {
  51903. return genFor(el, state)
  51904. } else if (el.if && !el.ifProcessed) {
  51905. return genIf(el, state)
  51906. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  51907. return genChildren(el, state) || 'void 0'
  51908. } else if (el.tag === 'slot') {
  51909. return genSlot(el, state)
  51910. } else {
  51911. // component or element
  51912. var code;
  51913. if (el.component) {
  51914. code = genComponent(el.component, el, state);
  51915. } else {
  51916. var data;
  51917. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  51918. data = genData$2(el, state);
  51919. }
  51920. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  51921. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  51922. }
  51923. // module transforms
  51924. for (var i = 0; i < state.transforms.length; i++) {
  51925. code = state.transforms[i](el, code);
  51926. }
  51927. return code
  51928. }
  51929. }
  51930. // hoist static sub-trees out
  51931. function genStatic (el, state) {
  51932. el.staticProcessed = true;
  51933. // Some elements (templates) need to behave differently inside of a v-pre
  51934. // node. All pre nodes are static roots, so we can use this as a location to
  51935. // wrap a state change and reset it upon exiting the pre node.
  51936. var originalPreState = state.pre;
  51937. if (el.pre) {
  51938. state.pre = el.pre;
  51939. }
  51940. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  51941. state.pre = originalPreState;
  51942. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  51943. }
  51944. // v-once
  51945. function genOnce (el, state) {
  51946. el.onceProcessed = true;
  51947. if (el.if && !el.ifProcessed) {
  51948. return genIf(el, state)
  51949. } else if (el.staticInFor) {
  51950. var key = '';
  51951. var parent = el.parent;
  51952. while (parent) {
  51953. if (parent.for) {
  51954. key = parent.key;
  51955. break
  51956. }
  51957. parent = parent.parent;
  51958. }
  51959. if (!key) {
  51960. state.warn(
  51961. "v-once can only be used inside v-for that is keyed. ",
  51962. el.rawAttrsMap['v-once']
  51963. );
  51964. return genElement(el, state)
  51965. }
  51966. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  51967. } else {
  51968. return genStatic(el, state)
  51969. }
  51970. }
  51971. function genIf (
  51972. el,
  51973. state,
  51974. altGen,
  51975. altEmpty
  51976. ) {
  51977. el.ifProcessed = true; // avoid recursion
  51978. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  51979. }
  51980. function genIfConditions (
  51981. conditions,
  51982. state,
  51983. altGen,
  51984. altEmpty
  51985. ) {
  51986. if (!conditions.length) {
  51987. return altEmpty || '_e()'
  51988. }
  51989. var condition = conditions.shift();
  51990. if (condition.exp) {
  51991. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  51992. } else {
  51993. return ("" + (genTernaryExp(condition.block)))
  51994. }
  51995. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  51996. function genTernaryExp (el) {
  51997. return altGen
  51998. ? altGen(el, state)
  51999. : el.once
  52000. ? genOnce(el, state)
  52001. : genElement(el, state)
  52002. }
  52003. }
  52004. function genFor (
  52005. el,
  52006. state,
  52007. altGen,
  52008. altHelper
  52009. ) {
  52010. var exp = el.for;
  52011. var alias = el.alias;
  52012. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  52013. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  52014. if (state.maybeComponent(el) &&
  52015. el.tag !== 'slot' &&
  52016. el.tag !== 'template' &&
  52017. !el.key
  52018. ) {
  52019. state.warn(
  52020. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  52021. "v-for should have explicit keys. " +
  52022. "See https://vuejs.org/guide/list.html#key for more info.",
  52023. el.rawAttrsMap['v-for'],
  52024. true /* tip */
  52025. );
  52026. }
  52027. el.forProcessed = true; // avoid recursion
  52028. return (altHelper || '_l') + "((" + exp + ")," +
  52029. "function(" + alias + iterator1 + iterator2 + "){" +
  52030. "return " + ((altGen || genElement)(el, state)) +
  52031. '})'
  52032. }
  52033. function genData$2 (el, state) {
  52034. var data = '{';
  52035. // directives first.
  52036. // directives may mutate the el's other properties before they are generated.
  52037. var dirs = genDirectives(el, state);
  52038. if (dirs) { data += dirs + ','; }
  52039. // key
  52040. if (el.key) {
  52041. data += "key:" + (el.key) + ",";
  52042. }
  52043. // ref
  52044. if (el.ref) {
  52045. data += "ref:" + (el.ref) + ",";
  52046. }
  52047. if (el.refInFor) {
  52048. data += "refInFor:true,";
  52049. }
  52050. // pre
  52051. if (el.pre) {
  52052. data += "pre:true,";
  52053. }
  52054. // record original tag name for components using "is" attribute
  52055. if (el.component) {
  52056. data += "tag:\"" + (el.tag) + "\",";
  52057. }
  52058. // module data generation functions
  52059. for (var i = 0; i < state.dataGenFns.length; i++) {
  52060. data += state.dataGenFns[i](el);
  52061. }
  52062. // attributes
  52063. if (el.attrs) {
  52064. data += "attrs:" + (genProps(el.attrs)) + ",";
  52065. }
  52066. // DOM props
  52067. if (el.props) {
  52068. data += "domProps:" + (genProps(el.props)) + ",";
  52069. }
  52070. // event handlers
  52071. if (el.events) {
  52072. data += (genHandlers(el.events, false)) + ",";
  52073. }
  52074. if (el.nativeEvents) {
  52075. data += (genHandlers(el.nativeEvents, true)) + ",";
  52076. }
  52077. // slot target
  52078. // only for non-scoped slots
  52079. if (el.slotTarget && !el.slotScope) {
  52080. data += "slot:" + (el.slotTarget) + ",";
  52081. }
  52082. // scoped slots
  52083. if (el.scopedSlots) {
  52084. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  52085. }
  52086. // component v-model
  52087. if (el.model) {
  52088. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  52089. }
  52090. // inline-template
  52091. if (el.inlineTemplate) {
  52092. var inlineTemplate = genInlineTemplate(el, state);
  52093. if (inlineTemplate) {
  52094. data += inlineTemplate + ",";
  52095. }
  52096. }
  52097. data = data.replace(/,$/, '') + '}';
  52098. // v-bind dynamic argument wrap
  52099. // v-bind with dynamic arguments must be applied using the same v-bind object
  52100. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  52101. if (el.dynamicAttrs) {
  52102. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  52103. }
  52104. // v-bind data wrap
  52105. if (el.wrapData) {
  52106. data = el.wrapData(data);
  52107. }
  52108. // v-on data wrap
  52109. if (el.wrapListeners) {
  52110. data = el.wrapListeners(data);
  52111. }
  52112. return data
  52113. }
  52114. function genDirectives (el, state) {
  52115. var dirs = el.directives;
  52116. if (!dirs) { return }
  52117. var res = 'directives:[';
  52118. var hasRuntime = false;
  52119. var i, l, dir, needRuntime;
  52120. for (i = 0, l = dirs.length; i < l; i++) {
  52121. dir = dirs[i];
  52122. needRuntime = true;
  52123. var gen = state.directives[dir.name];
  52124. if (gen) {
  52125. // compile-time directive that manipulates AST.
  52126. // returns true if it also needs a runtime counterpart.
  52127. needRuntime = !!gen(el, dir, state.warn);
  52128. }
  52129. if (needRuntime) {
  52130. hasRuntime = true;
  52131. 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))) : '') + "},";
  52132. }
  52133. }
  52134. if (hasRuntime) {
  52135. return res.slice(0, -1) + ']'
  52136. }
  52137. }
  52138. function genInlineTemplate (el, state) {
  52139. var ast = el.children[0];
  52140. if (el.children.length !== 1 || ast.type !== 1) {
  52141. state.warn(
  52142. 'Inline-template components must have exactly one child element.',
  52143. { start: el.start }
  52144. );
  52145. }
  52146. if (ast && ast.type === 1) {
  52147. var inlineRenderFns = generate(ast, state.options);
  52148. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  52149. }
  52150. }
  52151. function genScopedSlots (
  52152. el,
  52153. slots,
  52154. state
  52155. ) {
  52156. // by default scoped slots are considered "stable", this allows child
  52157. // components with only scoped slots to skip forced updates from parent.
  52158. // but in some cases we have to bail-out of this optimization
  52159. // for example if the slot contains dynamic names, has v-if or v-for on them...
  52160. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  52161. var slot = slots[key];
  52162. return (
  52163. slot.slotTargetDynamic ||
  52164. slot.if ||
  52165. slot.for ||
  52166. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  52167. )
  52168. });
  52169. // #9534: if a component with scoped slots is inside a conditional branch,
  52170. // it's possible for the same component to be reused but with different
  52171. // compiled slot content. To avoid that, we generate a unique key based on
  52172. // the generated code of all the slot contents.
  52173. var needsKey = !!el.if;
  52174. // OR when it is inside another scoped slot or v-for (the reactivity may be
  52175. // disconnected due to the intermediate scope variable)
  52176. // #9438, #9506
  52177. // TODO: this can be further optimized by properly analyzing in-scope bindings
  52178. // and skip force updating ones that do not actually use scope variables.
  52179. if (!needsForceUpdate) {
  52180. var parent = el.parent;
  52181. while (parent) {
  52182. if (
  52183. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  52184. parent.for
  52185. ) {
  52186. needsForceUpdate = true;
  52187. break
  52188. }
  52189. if (parent.if) {
  52190. needsKey = true;
  52191. }
  52192. parent = parent.parent;
  52193. }
  52194. }
  52195. var generatedSlots = Object.keys(slots)
  52196. .map(function (key) { return genScopedSlot(slots[key], state); })
  52197. .join(',');
  52198. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  52199. }
  52200. function hash(str) {
  52201. var hash = 5381;
  52202. var i = str.length;
  52203. while(i) {
  52204. hash = (hash * 33) ^ str.charCodeAt(--i);
  52205. }
  52206. return hash >>> 0
  52207. }
  52208. function containsSlotChild (el) {
  52209. if (el.type === 1) {
  52210. if (el.tag === 'slot') {
  52211. return true
  52212. }
  52213. return el.children.some(containsSlotChild)
  52214. }
  52215. return false
  52216. }
  52217. function genScopedSlot (
  52218. el,
  52219. state
  52220. ) {
  52221. var isLegacySyntax = el.attrsMap['slot-scope'];
  52222. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  52223. return genIf(el, state, genScopedSlot, "null")
  52224. }
  52225. if (el.for && !el.forProcessed) {
  52226. return genFor(el, state, genScopedSlot)
  52227. }
  52228. var slotScope = el.slotScope === emptySlotScopeToken
  52229. ? ""
  52230. : String(el.slotScope);
  52231. var fn = "function(" + slotScope + "){" +
  52232. "return " + (el.tag === 'template'
  52233. ? el.if && isLegacySyntax
  52234. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  52235. : genChildren(el, state) || 'undefined'
  52236. : genElement(el, state)) + "}";
  52237. // reverse proxy v-slot without scope on this.$slots
  52238. var reverseProxy = slotScope ? "" : ",proxy:true";
  52239. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  52240. }
  52241. function genChildren (
  52242. el,
  52243. state,
  52244. checkSkip,
  52245. altGenElement,
  52246. altGenNode
  52247. ) {
  52248. var children = el.children;
  52249. if (children.length) {
  52250. var el$1 = children[0];
  52251. // optimize single v-for
  52252. if (children.length === 1 &&
  52253. el$1.for &&
  52254. el$1.tag !== 'template' &&
  52255. el$1.tag !== 'slot'
  52256. ) {
  52257. var normalizationType = checkSkip
  52258. ? state.maybeComponent(el$1) ? ",1" : ",0"
  52259. : "";
  52260. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  52261. }
  52262. var normalizationType$1 = checkSkip
  52263. ? getNormalizationType(children, state.maybeComponent)
  52264. : 0;
  52265. var gen = altGenNode || genNode;
  52266. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  52267. }
  52268. }
  52269. // determine the normalization needed for the children array.
  52270. // 0: no normalization needed
  52271. // 1: simple normalization needed (possible 1-level deep nested array)
  52272. // 2: full normalization needed
  52273. function getNormalizationType (
  52274. children,
  52275. maybeComponent
  52276. ) {
  52277. var res = 0;
  52278. for (var i = 0; i < children.length; i++) {
  52279. var el = children[i];
  52280. if (el.type !== 1) {
  52281. continue
  52282. }
  52283. if (needsNormalization(el) ||
  52284. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  52285. res = 2;
  52286. break
  52287. }
  52288. if (maybeComponent(el) ||
  52289. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  52290. res = 1;
  52291. }
  52292. }
  52293. return res
  52294. }
  52295. function needsNormalization (el) {
  52296. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  52297. }
  52298. function genNode (node, state) {
  52299. if (node.type === 1) {
  52300. return genElement(node, state)
  52301. } else if (node.type === 3 && node.isComment) {
  52302. return genComment(node)
  52303. } else {
  52304. return genText(node)
  52305. }
  52306. }
  52307. function genText (text) {
  52308. return ("_v(" + (text.type === 2
  52309. ? text.expression // no need for () because already wrapped in _s()
  52310. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  52311. }
  52312. function genComment (comment) {
  52313. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  52314. }
  52315. function genSlot (el, state) {
  52316. var slotName = el.slotName || '"default"';
  52317. var children = genChildren(el, state);
  52318. var res = "_t(" + slotName + (children ? ("," + children) : '');
  52319. var attrs = el.attrs || el.dynamicAttrs
  52320. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  52321. // slot props are camelized
  52322. name: camelize(attr.name),
  52323. value: attr.value,
  52324. dynamic: attr.dynamic
  52325. }); }))
  52326. : null;
  52327. var bind$$1 = el.attrsMap['v-bind'];
  52328. if ((attrs || bind$$1) && !children) {
  52329. res += ",null";
  52330. }
  52331. if (attrs) {
  52332. res += "," + attrs;
  52333. }
  52334. if (bind$$1) {
  52335. res += (attrs ? '' : ',null') + "," + bind$$1;
  52336. }
  52337. return res + ')'
  52338. }
  52339. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  52340. function genComponent (
  52341. componentName,
  52342. el,
  52343. state
  52344. ) {
  52345. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  52346. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  52347. }
  52348. function genProps (props) {
  52349. var staticProps = "";
  52350. var dynamicProps = "";
  52351. for (var i = 0; i < props.length; i++) {
  52352. var prop = props[i];
  52353. var value = transformSpecialNewlines(prop.value);
  52354. if (prop.dynamic) {
  52355. dynamicProps += (prop.name) + "," + value + ",";
  52356. } else {
  52357. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  52358. }
  52359. }
  52360. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  52361. if (dynamicProps) {
  52362. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  52363. } else {
  52364. return staticProps
  52365. }
  52366. }
  52367. // #3895, #4268
  52368. function transformSpecialNewlines (text) {
  52369. return text
  52370. .replace(/\u2028/g, '\\u2028')
  52371. .replace(/\u2029/g, '\\u2029')
  52372. }
  52373. /* */
  52374. // these keywords should not appear inside expressions, but operators like
  52375. // typeof, instanceof and in are allowed
  52376. var prohibitedKeywordRE = new RegExp('\\b' + (
  52377. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  52378. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  52379. 'extends,finally,continue,debugger,function,arguments'
  52380. ).split(',').join('\\b|\\b') + '\\b');
  52381. // these unary operators should not be used as property/method names
  52382. var unaryOperatorsRE = new RegExp('\\b' + (
  52383. 'delete,typeof,void'
  52384. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  52385. // strip strings in expressions
  52386. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  52387. // detect problematic expressions in a template
  52388. function detectErrors (ast, warn) {
  52389. if (ast) {
  52390. checkNode(ast, warn);
  52391. }
  52392. }
  52393. function checkNode (node, warn) {
  52394. if (node.type === 1) {
  52395. for (var name in node.attrsMap) {
  52396. if (dirRE.test(name)) {
  52397. var value = node.attrsMap[name];
  52398. if (value) {
  52399. var range = node.rawAttrsMap[name];
  52400. if (name === 'v-for') {
  52401. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  52402. } else if (name === 'v-slot' || name[0] === '#') {
  52403. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  52404. } else if (onRE.test(name)) {
  52405. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  52406. } else {
  52407. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  52408. }
  52409. }
  52410. }
  52411. }
  52412. if (node.children) {
  52413. for (var i = 0; i < node.children.length; i++) {
  52414. checkNode(node.children[i], warn);
  52415. }
  52416. }
  52417. } else if (node.type === 2) {
  52418. checkExpression(node.expression, node.text, warn, node);
  52419. }
  52420. }
  52421. function checkEvent (exp, text, warn, range) {
  52422. var stripped = exp.replace(stripStringRE, '');
  52423. var keywordMatch = stripped.match(unaryOperatorsRE);
  52424. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  52425. warn(
  52426. "avoid using JavaScript unary operator as property name: " +
  52427. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  52428. range
  52429. );
  52430. }
  52431. checkExpression(exp, text, warn, range);
  52432. }
  52433. function checkFor (node, text, warn, range) {
  52434. checkExpression(node.for || '', text, warn, range);
  52435. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  52436. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  52437. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  52438. }
  52439. function checkIdentifier (
  52440. ident,
  52441. type,
  52442. text,
  52443. warn,
  52444. range
  52445. ) {
  52446. if (typeof ident === 'string') {
  52447. try {
  52448. new Function(("var " + ident + "=_"));
  52449. } catch (e) {
  52450. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  52451. }
  52452. }
  52453. }
  52454. function checkExpression (exp, text, warn, range) {
  52455. try {
  52456. new Function(("return " + exp));
  52457. } catch (e) {
  52458. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  52459. if (keywordMatch) {
  52460. warn(
  52461. "avoid using JavaScript keyword as property name: " +
  52462. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  52463. range
  52464. );
  52465. } else {
  52466. warn(
  52467. "invalid expression: " + (e.message) + " in\n\n" +
  52468. " " + exp + "\n\n" +
  52469. " Raw expression: " + (text.trim()) + "\n",
  52470. range
  52471. );
  52472. }
  52473. }
  52474. }
  52475. function checkFunctionParameterExpression (exp, text, warn, range) {
  52476. try {
  52477. new Function(exp, '');
  52478. } catch (e) {
  52479. warn(
  52480. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  52481. " " + exp + "\n\n" +
  52482. " Raw expression: " + (text.trim()) + "\n",
  52483. range
  52484. );
  52485. }
  52486. }
  52487. /* */
  52488. var range = 2;
  52489. function generateCodeFrame (
  52490. source,
  52491. start,
  52492. end
  52493. ) {
  52494. if ( start === void 0 ) start = 0;
  52495. if ( end === void 0 ) end = source.length;
  52496. var lines = source.split(/\r?\n/);
  52497. var count = 0;
  52498. var res = [];
  52499. for (var i = 0; i < lines.length; i++) {
  52500. count += lines[i].length + 1;
  52501. if (count >= start) {
  52502. for (var j = i - range; j <= i + range || end > count; j++) {
  52503. if (j < 0 || j >= lines.length) { continue }
  52504. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  52505. var lineLength = lines[j].length;
  52506. if (j === i) {
  52507. // push underline
  52508. var pad = start - (count - lineLength) + 1;
  52509. var length = end > count ? lineLength - pad : end - start;
  52510. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  52511. } else if (j > i) {
  52512. if (end > count) {
  52513. var length$1 = Math.min(end - count, lineLength);
  52514. res.push(" | " + repeat$1("^", length$1));
  52515. }
  52516. count += lineLength + 1;
  52517. }
  52518. }
  52519. break
  52520. }
  52521. }
  52522. return res.join('\n')
  52523. }
  52524. function repeat$1 (str, n) {
  52525. var result = '';
  52526. if (n > 0) {
  52527. while (true) { // eslint-disable-line
  52528. if (n & 1) { result += str; }
  52529. n >>>= 1;
  52530. if (n <= 0) { break }
  52531. str += str;
  52532. }
  52533. }
  52534. return result
  52535. }
  52536. /* */
  52537. function createFunction (code, errors) {
  52538. try {
  52539. return new Function(code)
  52540. } catch (err) {
  52541. errors.push({ err: err, code: code });
  52542. return noop
  52543. }
  52544. }
  52545. function createCompileToFunctionFn (compile) {
  52546. var cache = Object.create(null);
  52547. return function compileToFunctions (
  52548. template,
  52549. options,
  52550. vm
  52551. ) {
  52552. options = extend({}, options);
  52553. var warn$$1 = options.warn || warn;
  52554. delete options.warn;
  52555. /* istanbul ignore if */
  52556. {
  52557. // detect possible CSP restriction
  52558. try {
  52559. new Function('return 1');
  52560. } catch (e) {
  52561. if (e.toString().match(/unsafe-eval|CSP/)) {
  52562. warn$$1(
  52563. 'It seems you are using the standalone build of Vue.js in an ' +
  52564. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  52565. 'The template compiler cannot work in this environment. Consider ' +
  52566. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  52567. 'templates into render functions.'
  52568. );
  52569. }
  52570. }
  52571. }
  52572. // check cache
  52573. var key = options.delimiters
  52574. ? String(options.delimiters) + template
  52575. : template;
  52576. if (cache[key]) {
  52577. return cache[key]
  52578. }
  52579. // compile
  52580. var compiled = compile(template, options);
  52581. // check compilation errors/tips
  52582. {
  52583. if (compiled.errors && compiled.errors.length) {
  52584. if (options.outputSourceRange) {
  52585. compiled.errors.forEach(function (e) {
  52586. warn$$1(
  52587. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  52588. generateCodeFrame(template, e.start, e.end),
  52589. vm
  52590. );
  52591. });
  52592. } else {
  52593. warn$$1(
  52594. "Error compiling template:\n\n" + template + "\n\n" +
  52595. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  52596. vm
  52597. );
  52598. }
  52599. }
  52600. if (compiled.tips && compiled.tips.length) {
  52601. if (options.outputSourceRange) {
  52602. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  52603. } else {
  52604. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  52605. }
  52606. }
  52607. }
  52608. // turn code into functions
  52609. var res = {};
  52610. var fnGenErrors = [];
  52611. res.render = createFunction(compiled.render, fnGenErrors);
  52612. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  52613. return createFunction(code, fnGenErrors)
  52614. });
  52615. // check function generation errors.
  52616. // this should only happen if there is a bug in the compiler itself.
  52617. // mostly for codegen development use
  52618. /* istanbul ignore if */
  52619. {
  52620. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  52621. warn$$1(
  52622. "Failed to generate render function:\n\n" +
  52623. fnGenErrors.map(function (ref) {
  52624. var err = ref.err;
  52625. var code = ref.code;
  52626. return ((err.toString()) + " in\n\n" + code + "\n");
  52627. }).join('\n'),
  52628. vm
  52629. );
  52630. }
  52631. }
  52632. return (cache[key] = res)
  52633. }
  52634. }
  52635. /* */
  52636. function createCompilerCreator (baseCompile) {
  52637. return function createCompiler (baseOptions) {
  52638. function compile (
  52639. template,
  52640. options
  52641. ) {
  52642. var finalOptions = Object.create(baseOptions);
  52643. var errors = [];
  52644. var tips = [];
  52645. var warn = function (msg, range, tip) {
  52646. (tip ? tips : errors).push(msg);
  52647. };
  52648. if (options) {
  52649. if (options.outputSourceRange) {
  52650. // $flow-disable-line
  52651. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  52652. warn = function (msg, range, tip) {
  52653. var data = { msg: msg };
  52654. if (range) {
  52655. if (range.start != null) {
  52656. data.start = range.start + leadingSpaceLength;
  52657. }
  52658. if (range.end != null) {
  52659. data.end = range.end + leadingSpaceLength;
  52660. }
  52661. }
  52662. (tip ? tips : errors).push(data);
  52663. };
  52664. }
  52665. // merge custom modules
  52666. if (options.modules) {
  52667. finalOptions.modules =
  52668. (baseOptions.modules || []).concat(options.modules);
  52669. }
  52670. // merge custom directives
  52671. if (options.directives) {
  52672. finalOptions.directives = extend(
  52673. Object.create(baseOptions.directives || null),
  52674. options.directives
  52675. );
  52676. }
  52677. // copy other options
  52678. for (var key in options) {
  52679. if (key !== 'modules' && key !== 'directives') {
  52680. finalOptions[key] = options[key];
  52681. }
  52682. }
  52683. }
  52684. finalOptions.warn = warn;
  52685. var compiled = baseCompile(template.trim(), finalOptions);
  52686. {
  52687. detectErrors(compiled.ast, warn);
  52688. }
  52689. compiled.errors = errors;
  52690. compiled.tips = tips;
  52691. return compiled
  52692. }
  52693. return {
  52694. compile: compile,
  52695. compileToFunctions: createCompileToFunctionFn(compile)
  52696. }
  52697. }
  52698. }
  52699. /* */
  52700. // `createCompilerCreator` allows creating compilers that use alternative
  52701. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  52702. // Here we just export a default compiler using the default parts.
  52703. var createCompiler = createCompilerCreator(function baseCompile (
  52704. template,
  52705. options
  52706. ) {
  52707. var ast = parse(template.trim(), options);
  52708. if (options.optimize !== false) {
  52709. optimize(ast, options);
  52710. }
  52711. var code = generate(ast, options);
  52712. return {
  52713. ast: ast,
  52714. render: code.render,
  52715. staticRenderFns: code.staticRenderFns
  52716. }
  52717. });
  52718. /* */
  52719. var ref$1 = createCompiler(baseOptions);
  52720. var compile = ref$1.compile;
  52721. var compileToFunctions = ref$1.compileToFunctions;
  52722. /* */
  52723. // check whether current browser encodes a char inside attribute values
  52724. var div;
  52725. function getShouldDecode (href) {
  52726. div = div || document.createElement('div');
  52727. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  52728. return div.innerHTML.indexOf('&#10;') > 0
  52729. }
  52730. // #3663: IE encodes newlines inside attribute values while other browsers don't
  52731. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  52732. // #6828: chrome encodes content in a[href]
  52733. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  52734. /* */
  52735. var idToTemplate = cached(function (id) {
  52736. var el = query(id);
  52737. return el && el.innerHTML
  52738. });
  52739. var mount = Vue.prototype.$mount;
  52740. Vue.prototype.$mount = function (
  52741. el,
  52742. hydrating
  52743. ) {
  52744. el = el && query(el);
  52745. /* istanbul ignore if */
  52746. if (el === document.body || el === document.documentElement) {
  52747. warn(
  52748. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  52749. );
  52750. return this
  52751. }
  52752. var options = this.$options;
  52753. // resolve template/el and convert to render function
  52754. if (!options.render) {
  52755. var template = options.template;
  52756. if (template) {
  52757. if (typeof template === 'string') {
  52758. if (template.charAt(0) === '#') {
  52759. template = idToTemplate(template);
  52760. /* istanbul ignore if */
  52761. if (!template) {
  52762. warn(
  52763. ("Template element not found or is empty: " + (options.template)),
  52764. this
  52765. );
  52766. }
  52767. }
  52768. } else if (template.nodeType) {
  52769. template = template.innerHTML;
  52770. } else {
  52771. {
  52772. warn('invalid template option:' + template, this);
  52773. }
  52774. return this
  52775. }
  52776. } else if (el) {
  52777. template = getOuterHTML(el);
  52778. }
  52779. if (template) {
  52780. /* istanbul ignore if */
  52781. if (config.performance && mark) {
  52782. mark('compile');
  52783. }
  52784. var ref = compileToFunctions(template, {
  52785. outputSourceRange: "development" !== 'production',
  52786. shouldDecodeNewlines: shouldDecodeNewlines,
  52787. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  52788. delimiters: options.delimiters,
  52789. comments: options.comments
  52790. }, this);
  52791. var render = ref.render;
  52792. var staticRenderFns = ref.staticRenderFns;
  52793. options.render = render;
  52794. options.staticRenderFns = staticRenderFns;
  52795. /* istanbul ignore if */
  52796. if (config.performance && mark) {
  52797. mark('compile end');
  52798. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  52799. }
  52800. }
  52801. }
  52802. return mount.call(this, el, hydrating)
  52803. };
  52804. /**
  52805. * Get outerHTML of elements, taking care
  52806. * of SVG elements in IE as well.
  52807. */
  52808. function getOuterHTML (el) {
  52809. if (el.outerHTML) {
  52810. return el.outerHTML
  52811. } else {
  52812. var container = document.createElement('div');
  52813. container.appendChild(el.cloneNode(true));
  52814. return container.innerHTML
  52815. }
  52816. }
  52817. Vue.compile = compileToFunctions;
  52818. module.exports = Vue;
  52819. /* 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))
  52820. /***/ }),
  52821. /***/ "./node_modules/vue/dist/vue.common.js":
  52822. /*!*********************************************!*\
  52823. !*** ./node_modules/vue/dist/vue.common.js ***!
  52824. \*********************************************/
  52825. /*! no static exports found */
  52826. /***/ (function(module, exports, __webpack_require__) {
  52827. if (false) {} else {
  52828. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  52829. }
  52830. /***/ }),
  52831. /***/ "./node_modules/webpack/buildin/global.js":
  52832. /*!***********************************!*\
  52833. !*** (webpack)/buildin/global.js ***!
  52834. \***********************************/
  52835. /*! no static exports found */
  52836. /***/ (function(module, exports) {
  52837. var g;
  52838. // This works in non-strict mode
  52839. g = (function() {
  52840. return this;
  52841. })();
  52842. try {
  52843. // This works if eval is allowed (see CSP)
  52844. g = g || new Function("return this")();
  52845. } catch (e) {
  52846. // This works if the window reference is available
  52847. if (typeof window === "object") g = window;
  52848. }
  52849. // g can still be undefined, but nothing to do about it...
  52850. // We return undefined, instead of nothing here, so it's
  52851. // easier to handle this case. if(!global) { ...}
  52852. module.exports = g;
  52853. /***/ }),
  52854. /***/ "./node_modules/webpack/buildin/module.js":
  52855. /*!***********************************!*\
  52856. !*** (webpack)/buildin/module.js ***!
  52857. \***********************************/
  52858. /*! no static exports found */
  52859. /***/ (function(module, exports) {
  52860. module.exports = function(module) {
  52861. if (!module.webpackPolyfill) {
  52862. module.deprecate = function() {};
  52863. module.paths = [];
  52864. // module.parent = undefined by default
  52865. if (!module.children) module.children = [];
  52866. Object.defineProperty(module, "loaded", {
  52867. enumerable: true,
  52868. get: function() {
  52869. return module.l;
  52870. }
  52871. });
  52872. Object.defineProperty(module, "id", {
  52873. enumerable: true,
  52874. get: function() {
  52875. return module.i;
  52876. }
  52877. });
  52878. module.webpackPolyfill = 1;
  52879. }
  52880. return module;
  52881. };
  52882. /***/ }),
  52883. /***/ "./node_modules/yeast/index.js":
  52884. /*!*************************************!*\
  52885. !*** ./node_modules/yeast/index.js ***!
  52886. \*************************************/
  52887. /*! no static exports found */
  52888. /***/ (function(module, exports, __webpack_require__) {
  52889. "use strict";
  52890. var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')
  52891. , length = 64
  52892. , map = {}
  52893. , seed = 0
  52894. , i = 0
  52895. , prev;
  52896. /**
  52897. * Return a string representing the specified number.
  52898. *
  52899. * @param {Number} num The number to convert.
  52900. * @returns {String} The string representation of the number.
  52901. * @api public
  52902. */
  52903. function encode(num) {
  52904. var encoded = '';
  52905. do {
  52906. encoded = alphabet[num % length] + encoded;
  52907. num = Math.floor(num / length);
  52908. } while (num > 0);
  52909. return encoded;
  52910. }
  52911. /**
  52912. * Return the integer value specified by the given string.
  52913. *
  52914. * @param {String} str The string to convert.
  52915. * @returns {Number} The integer value represented by the string.
  52916. * @api public
  52917. */
  52918. function decode(str) {
  52919. var decoded = 0;
  52920. for (i = 0; i < str.length; i++) {
  52921. decoded = decoded * length + map[str.charAt(i)];
  52922. }
  52923. return decoded;
  52924. }
  52925. /**
  52926. * Yeast: A tiny growing id generator.
  52927. *
  52928. * @returns {String} A unique id.
  52929. * @api public
  52930. */
  52931. function yeast() {
  52932. var now = encode(+new Date());
  52933. if (now !== prev) return seed = 0, prev = now;
  52934. return now +'.'+ encode(seed++);
  52935. }
  52936. //
  52937. // Map each character to its index.
  52938. //
  52939. for (; i < length; i++) map[alphabet[i]] = i;
  52940. //
  52941. // Expose the `yeast`, `encode` and `decode` functions.
  52942. //
  52943. yeast.encode = encode;
  52944. yeast.decode = decode;
  52945. module.exports = yeast;
  52946. /***/ }),
  52947. /***/ "./resources/js/app.js":
  52948. /*!*****************************!*\
  52949. !*** ./resources/js/app.js ***!
  52950. \*****************************/
  52951. /*! no static exports found */
  52952. /***/ (function(module, exports, __webpack_require__) {
  52953. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  52954. __webpack_require__(/*! ./mounted */ "./resources/js/mounted.js");
  52955. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  52956. window.tempTip = __webpack_require__(/*! ./utilities/tempTip */ "./resources/js/utilities/tempTip.js");
  52957. window.getGetVal = __webpack_require__(/*! ./utilities/getGetVal */ "./resources/js/utilities/getGetVal.js");
  52958. window.scanner = __webpack_require__(/*! ./utilities/scanner */ "./resources/js/utilities/scanner.js");
  52959. window.datetimeRelating = __webpack_require__(/*! ./utilities/datetimeRelating */ "./resources/js/utilities/datetimeRelating.js");
  52960. /***/ }),
  52961. /***/ "./resources/js/bootstrap.js":
  52962. /*!***********************************!*\
  52963. !*** ./resources/js/bootstrap.js ***!
  52964. \***********************************/
  52965. /*! no exports provided */
  52966. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  52967. "use strict";
  52968. __webpack_require__.r(__webpack_exports__);
  52969. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  52970. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  52971. /**
  52972. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  52973. * for JavaScript based Bootstrap features such as modals and tabs. This
  52974. * code may be modified to fit the specific needs of your application.
  52975. */
  52976. try {
  52977. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  52978. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  52979. window.$.cookie = __webpack_require__(/*! js-cookie */ "./node_modules/js-cookie/src/js.cookie.js");
  52980. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  52981. } catch (e) {}
  52982. /**
  52983. * We'll load the axios HTTP library which allows us to easily issue requests
  52984. * to our Laravel back-end. This library automatically handles sending the
  52985. * CSRF token as a header based on the value of the "XSRF" token cookie.
  52986. */
  52987. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  52988. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  52989. /**
  52990. * Next we will register the CSRF Token as a common header with Axios so that
  52991. * all outgoing HTTP requests automatically have it attached. This is just
  52992. * a simple convenience so we don't have to attach every token manually.
  52993. */
  52994. var token = document.head.querySelector('meta[name="csrf-token"]');
  52995. if (token) {
  52996. window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
  52997. } else {
  52998. console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
  52999. }
  53000. /**
  53001. * Echo exposes an expressive API for subscribing to channels and listening
  53002. * for events that are broadcast by Laravel. Echo and event broadcasting
  53003. * allows your team to easily build robust real-time web applications.
  53004. */
  53005. //
  53006. // const client = require('pusher-js');
  53007. window.io = __webpack_require__(/*! socket.io-client */ "./node_modules/socket.io-client/lib/index.js");
  53008. window.initEcho = function () {
  53009. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  53010. broadcaster: 'socket.io',
  53011. host: window.location.hostname + ':6001' //broadcaster: 'pusher',
  53012. // key: process.env.MIX_PUSHER_APP_KEY,
  53013. // key: 'bo20alg-1',
  53014. // authEndpoint: '/custom/endpoint/auth',
  53015. // cluster: process.env.MIX_PUSHER_APP_CLUSTER,
  53016. // encrypted: true,
  53017. // client:client
  53018. });
  53019. };
  53020. /***/ }),
  53021. /***/ "./resources/js/mounted.js":
  53022. /*!*********************************!*\
  53023. !*** ./resources/js/mounted.js ***!
  53024. \*********************************/
  53025. /*! no static exports found */
  53026. /***/ (function(module, exports) {
  53027. //解决input number类型上下滚动 禁用滚轮事件
  53028. setTimeout(function () {
  53029. for (var i = 0; i < $("input[type='number']").length; i++) {
  53030. $("input[type='number']")[i].setAttribute('onmousewheel', 'return false'); //禁止谷歌浏览器、Opera浏览器以及360浏览器等采用谷歌内核的浏览器
  53031. $("input[type='number']")[i].addEventListener('DOMMouseScroll', MouseWheel, false); //禁止Firefox浏览器
  53032. }
  53033. }, 100);
  53034. function MouseWheel(event) {
  53035. event = event || window.event;
  53036. event.preventDefault();
  53037. }
  53038. /***/ }),
  53039. /***/ "./resources/js/utilities/datetimeRelating.js":
  53040. /*!****************************************************!*\
  53041. !*** ./resources/js/utilities/datetimeRelating.js ***!
  53042. \****************************************************/
  53043. /*! no static exports found */
  53044. /***/ (function(module, exports) {
  53045. var datetime = {
  53046. verifyTime: function verifyTime(time) {
  53047. setTimeout(function () {
  53048. time.target.value = time.target.value.replace(':', ':');
  53049. time.target.value = time.target.value.replace(/[a-zA-Z]/, '');
  53050. time.target.value = time.target.value.replace(/^([\d]{1})([\s]{1})/, "$1:");
  53051. time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1})([\s]{1})/, "$1$2:");
  53052. time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1})([\d]{1})/, "$1$2:$3");
  53053. time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1})([\d]{1})([\d]{1})(.*?)/, "$1$2$3$4");
  53054. time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1})([\d]{1})([\d]{1})/, "$1$2:$3$4");
  53055. time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1}):([\d]{1})([\d]{1})([\s\S]{1})/, "$1$2:$3$4");
  53056. time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1}):([\D]{1,99})/, "$1$2:");
  53057. time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1})([\d]{1})\./, "$1:$2$3");
  53058. time.target.value = time.target.value.replace(/^([\d]{1})\.([\d]{1})([\d]{1})/, "$1:$2$3");
  53059. time.target.value = time.target.value.replace(/^([\d]{1})([\d]{2})([\S\s]{1,99})/, "$1$2:$3");
  53060. time.target.value = time.target.value.replace(/^([\d]{1}):([\d]{2})([\S\s]{1,99})/, "$1:$2");
  53061. time.target.value = time.target.value.replace(/^([\d])/, "$1");
  53062. time.target.value = time.target.value.replace(/^([1])([\d]{1})/, "$1$2");
  53063. time.target.value = time.target.value.replace(/^([3-9])([\d]{1})/, "2$2");
  53064. time.target.value = time.target.value.replace(/^([2-9]{1})([4-9]{1})/, "$13");
  53065. time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1}):([6-9]{1})/, "$1$2:5");
  53066. time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1})$/, "$1$2:");
  53067. }, 10);
  53068. }
  53069. };
  53070. module.exports = datetime;
  53071. /***/ }),
  53072. /***/ "./resources/js/utilities/getGetVal.js":
  53073. /*!*********************************************!*\
  53074. !*** ./resources/js/utilities/getGetVal.js ***!
  53075. \*********************************************/
  53076. /*! no static exports found */
  53077. /***/ (function(module, exports) {
  53078. var get = function get(name) {
  53079. var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
  53080. var r = window.location.search.substr(1).match(reg);
  53081. if (r != null) {
  53082. return unescape(r[2]);
  53083. }
  53084. return null;
  53085. };
  53086. module.exports = get;
  53087. /***/ }),
  53088. /***/ "./resources/js/utilities/scanner.js":
  53089. /*!*******************************************!*\
  53090. !*** ./resources/js/utilities/scanner.js ***!
  53091. \*******************************************/
  53092. /*! no static exports found */
  53093. /***/ (function(module, exports) {
  53094. var scanner = {
  53095. /**
  53096. * 监听document的扫描枪活动,扫描后调用doFunc执行,doFunc(str)
  53097. * str是扫到的内容,在doFunc内执行
  53098. * @param doFunc
  53099. */
  53100. monitorScan: function monitorScan(doFunc) {
  53101. var tightInputInterval = 50;
  53102. var leastCodeLength = 3;
  53103. var lastPressedAt = 0;
  53104. var scannedStr = "";
  53105. $(document).on('keyup', function (e) {
  53106. var nowAtMilli = new Date().getTime();
  53107. var inputInterval = nowAtMilli - lastPressedAt;
  53108. if (inputInterval < tightInputInterval) {
  53109. if (e.key !== 'Enter') {
  53110. scannedStr += e.key;
  53111. } else {
  53112. if (scannedStr.length >= leastCodeLength) {
  53113. doFunc(scannedStr);
  53114. }
  53115. scannedStr = '';
  53116. }
  53117. } else {
  53118. if (e.key !== 'Enter') {
  53119. scannedStr = e.key;
  53120. } else {
  53121. scannedStr = '';
  53122. }
  53123. }
  53124. lastPressedAt = nowAtMilli;
  53125. });
  53126. },
  53127. monitorFocusingTarget: function monitorFocusingTarget(doFunc) {
  53128. $('input').on('focus', function (e) {
  53129. doFunc(e.target);
  53130. });
  53131. }
  53132. };
  53133. module.exports = scanner;
  53134. /***/ }),
  53135. /***/ "./resources/js/utilities/tempTip.js":
  53136. /*!*******************************************!*\
  53137. !*** ./resources/js/utilities/tempTip.js ***!
  53138. \*******************************************/
  53139. /*! no static exports found */
  53140. /***/ (function(module, exports) {
  53141. var tempTip = {
  53142. fadingDuration: 4500,
  53143. inputType: 'input',
  53144. index: 99,
  53145. setIndex: function setIndex(index) {
  53146. this.index = parseInt(index);
  53147. },
  53148. setDuration: function setDuration(milliSec) {
  53149. this.fadingDuration = parseInt(milliSec);
  53150. },
  53151. setInputType: function setInputType(type) {
  53152. this.inputType = type;
  53153. },
  53154. showSuccess: function showSuccess(text) {
  53155. var tiper = $("<div class='row' style='color:white;opacity:0.9;position:fixed;top:40%;transform:translateY(-50%);width:100%;'>" + "<div class='col-8 offset-2'><div class='card'><div class='card-body h4 bg-success text-center'>" + text + "</div></div></div></div>");
  53156. tiper.animate({
  53157. opacity: '0'
  53158. }, this.fadingDuration, 'swing', function () {
  53159. tiper.remove();
  53160. });
  53161. $('body').append(tiper);
  53162. },
  53163. show: function show(text) {
  53164. var tiper = $("<div class='row' style='color:white;opacity:0.9;position:fixed;top:40%;transform:translateY(-50%);width:100%;z-index:" + this.index + ";'>" + "<div class='col-8 offset-2'><div class='card'><div class='card-body h2 bg-danger text-center'>" + text + "</div></div></div></div>");
  53165. tiper.animate({
  53166. opacity: '0'
  53167. }, this.fadingDuration, 'swing', function () {
  53168. tiper.remove();
  53169. });
  53170. $('body').append(tiper);
  53171. },
  53172. okWindow: function okWindow(text, okText) {
  53173. var bg = $("<div style='opacity:0.4;position:fixed;top:0;width:100%;height:100%;z-index:" + this.index + ";background-color:#000;'></div>");
  53174. if (typeof okText == 'undefined') okText = '确定';
  53175. var tiper = $("<div class='row' style='opacity:0.9;position:fixed;top:40%;transform:translateY(-50%);width:100%;z-index:" + (this.index + 1) + "'>" + "<div class='col-8 offset-2'><div class='card'><div class='card-body h2 text-center'>" + text + "<p><button class='btn btn-success btn-lg okWindow'>" + okText + "</button></p><div>" + "</div></div></div>");
  53176. tiper.find('.okWindow').on('click', function () {
  53177. tiper.off('click');
  53178. tiper.remove();
  53179. bg.remove();
  53180. });
  53181. $('html').css('height', '100%').append(bg);
  53182. $('body').append(tiper);
  53183. },
  53184. waitingTip: function waitingTip(text) {
  53185. var bg = $("<div style='opacity:0.4;position:fixed;top:0;width:100%;height:100%;z-index:" + this.index + ";background-color:#fff;' class='tipperBg'></div>");
  53186. var tipper = $("<div class='row tipper' style='color:white;opacity:0.9;position:fixed;top:40%;transform:translateY(-50%);width:100%;z-index:" + (this.index + 1) + ";'>" + "<div class='col-8 offset-2'><div class='card-body h5 bg-dark text-center' style='border-radius: 50px'>" + text + "</div></div></div>");
  53187. tipper.animate({
  53188. opacity: '0'
  53189. }, this.fadingDuration, 'swing', function () {
  53190. tipper.remove();
  53191. bg.remove();
  53192. });
  53193. $('html').css('height', '100%').append(bg);
  53194. $('body').append(tipper);
  53195. },
  53196. cancelWaitingTip: function cancelWaitingTip() {
  53197. var bg = $(".tipperBg");
  53198. var tipper = $(".tipper");
  53199. tipper.remove();
  53200. bg.remove();
  53201. },
  53202. confirm: function confirm(text, yesFunc, noFunc) {
  53203. var bg = $("<div style='opacity:0.4;position:fixed;top:0;width:100%;height:100%;z-index:" + this.index + ";background-color:#000;'></div>");
  53204. var tiper = $("<div class='row' style='color:#000;opacity:0.9;position:fixed;top:40%;transform:translateY(-50%);width:100%;z-index:" + (this.index + 1) + "'>" + "<div class='col-8 offset-2'><div class='card'><div class='card-body'><div class='card-title h4'>" + text + "</div><div class='card-text'><button class='btn btn-dark btn-lg ok'>确定</button>" + "<button class='btn btn-success btn-lg cancel ml-4'>取消</button></div>" + "</div></div></div></div>");
  53205. var $ok = tiper.find('.ok');
  53206. var $cancel = tiper.find('.cancel');
  53207. $ok.on('click', function () {
  53208. $ok.off('click');
  53209. $cancel.off('click');
  53210. tiper.remove();
  53211. bg.remove();
  53212. yesFunc();
  53213. });
  53214. $cancel.on('click', function () {
  53215. $ok.off('click');
  53216. $cancel.off('click');
  53217. tiper.remove();
  53218. bg.remove();
  53219. if (typeof noFunc != 'undefined') noFunc();
  53220. });
  53221. $('html').css('height', '100%').append(bg);
  53222. $('body').append(tiper);
  53223. },
  53224. inputVal: function inputVal(tipText, resultFunc) {
  53225. var bg = $("<div style='opacity:0.4;position:fixed;top:0;width:100%;height:100%;z-index:" + this.index + ";background-color:#000;'></div>");
  53226. var tiper = $("<div class='row' style='color:#000;opacity:0.9;position:fixed;top:40%;transform:translateY(-50%);width:100%;z-index:" + this.index + "'>" + "<div class='col-8 offset-2'><div class='card'><div class='card-body'><div class='card-title h5'>" + tipText + "</div><div><input type='" + this.inputType + "' class='input form-control mb-3'/></div>" + "<div class='card-text'><button class='btn btn-outline-success ok'>确定</button></div>" + "</div></div></div></div>");
  53227. var $ok = tiper.find('.ok');
  53228. var $input = tiper.find('.input');
  53229. $ok.on('click', function () {
  53230. $ok.off('click');
  53231. tiper.remove();
  53232. bg.remove();
  53233. resultFunc($input.val());
  53234. });
  53235. $('html').css('height', '100%').append(bg);
  53236. $('body').append(tiper);
  53237. $input.focus();
  53238. }
  53239. };
  53240. module.exports = tempTip;
  53241. /***/ }),
  53242. /***/ "./resources/sass/app.scss":
  53243. /*!*********************************!*\
  53244. !*** ./resources/sass/app.scss ***!
  53245. \*********************************/
  53246. /*! no static exports found */
  53247. /***/ (function(module, exports) {
  53248. // removed by extract-text-webpack-plugin
  53249. /***/ }),
  53250. /***/ 0:
  53251. /*!*************************************************************!*\
  53252. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  53253. \*************************************************************/
  53254. /*! no static exports found */
  53255. /***/ (function(module, exports, __webpack_require__) {
  53256. __webpack_require__(/*! D:\Reald\desktop\BsWAS\src\resources\js\app.js */"./resources/js/app.js");
  53257. module.exports = __webpack_require__(/*! D:\Reald\desktop\BsWAS\src\resources\sass\app.scss */"./resources/sass/app.scss");
  53258. /***/ }),
  53259. /***/ 1:
  53260. /*!********************!*\
  53261. !*** ws (ignored) ***!
  53262. \********************/
  53263. /*! no static exports found */
  53264. /***/ (function(module, exports) {
  53265. /* (ignored) */
  53266. /***/ })
  53267. /******/ });